From 0b4ecc56a7475376aa589bd12567b71b2dc40904 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 15 Nov 2014 17:04:09 +0100 Subject: [PATCH] Task #1044 - Implementation de Test Test files : ajout ajax --- html/ajax_card.php | 28 +++++++-- html/ajax_history.php | 29 ++++++++-- html/ajax_ledger.php | 22 ++++++- html/ajax_misc.php | 21 ++++++- html/ajax_poste.php | 22 ++++++- html/test.php | 131 ++++++++++++++++++++++-------------------- 6 files changed, 179 insertions(+), 74 deletions(-) diff --git a/html/ajax_card.php b/html/ajax_card.php index ed34e2336..00a21f041 100644 --- a/html/ajax_card.php +++ b/html/ajax_card.php @@ -53,7 +53,7 @@ * - ref if we want to refresh the window *\see fiche fiche::Save constant.php */ -define ('ALLOWED',1); +if ( ! defined('ALLOWED')) define ('ALLOWED',1); require_once '../include/constant.php'; require_once('class_database.php'); @@ -94,6 +94,24 @@ $g_user=new User($cn); $g_user->check(true); $g_user->check_dossier($gDossier,true); $html=var_export($_REQUEST,true); +if ( LOGINPUT) + { + $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); + fwrite ($file_loginput," $ctl -$html +$xml EOF; diff --git a/html/ajax_history.php b/html/ajax_history.php index cf2169e53..3ff482c67 100644 --- a/html/ajax_history.php +++ b/html/ajax_history.php @@ -23,6 +23,8 @@ * \brief show the history of a card of an accounting * for the card f_id is set and for an accounting : pcm_val */ +if ( ! defined('ALLOWED')) define ('ALLOWED',1); + require_once '../include/constant.php'; require_once('class_database.php'); require_once('class_user.php'); @@ -33,7 +35,6 @@ require_once('class_acc_account.php'); require_once('class_exercice.php'); $div=$_REQUEST['div']; mb_internal_encoding("UTF-8"); -define ('ALLOWED',1); /** *if $_SESSION['g_user'] is not set : echo a warning @@ -46,7 +47,24 @@ $g_user=new User($cn); if ( $g_user->check_dossier(dossier::id(),true) == 'X' ) exit(); $from_div = (isset($_REQUEST['ajax'])) ? 1 : $_GET['l']; - +if ( LOGINPUT) + { + $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); + fwrite ($file_loginput," $div -$html +$xml EOF; diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php index a28aa3ac6..2c319c75e 100644 --- a/html/ajax_ledger.php +++ b/html/ajax_ledger.php @@ -28,7 +28,8 @@ - for reconcialiation - update of analytic content */ -define ('ALLOWED',1); +if ( ! defined('ALLOWED')) define ('ALLOWED',1); + require_once '../include/constant.php'; require_once('class_database.php'); require_once('class_user.php'); @@ -63,7 +64,24 @@ ajax_disconnected($div); $cn=new Database(dossier::id()); $g_parameter=new Own($cn); - +if ( LOGINPUT) + { + $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); + fwrite ($file_loginput,"0) { } $html = var_export($_REQUEST, true); +if ( LOGINPUT) + { + $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); + fwrite ($file_loginput,"Check(); if ($g_user->check_dossier(dossier::id()) == 'X') exit(); $xml=""; - +if ( LOGINPUT) + { + $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+'); + fwrite ($file_loginput,"Test NOALYSS"; - /* - * cherche pour fichier a include, s'il y en a alors les affiche - * avec une description - */ - $scan=scandir('../scenario/'); - $max=count($scan); - echo ''; - $get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts")); - echo ''; - echo ''; - echo ''; - echo ''; +/* + * Loading of all scenario + */ +$scan=scandir('../scenario/'); +$maxscan=count($scan); +$cnt_scenario=0;$scenario=array(); - for ($e=0; $e<$max; $e++) - { - if (is_file('../scenario/'.$scan[$e])&&strpos($scan[$e], '.php')==true) - { - $description=""; - $a_description=file('../scenario/'.$scan[$e]); - $max_description=count($a_description); - for ($w=0; $w<$max_description; $w++) - { - if (strpos($a_description[$w], '@description:')==true) - { - $description=$a_description[$w]; - $description=str_replace('//@description:', '', $description); - } - } - $get='test.php?'.http_build_query(array('script'=>$scan[$e], 'gDossier'=>$gDossierLogInput, 'description'=>$description)); - echo ''; - echo ''; - echo ''; - echo ''; - } - } - echo '
'; - echo ''; - echo "Tous "; - echo ''; - echo 'Tous les scripts
'; - echo ''; - echo $scan[$e]; - echo ''; - echo ''.$description.'
'; -} -else if ($script=='all') -{ - $scan=scandir('../scenario/'); - $maxscan=count($scan); - - echo ''; - for ($e_scan=0; $e_scan<$maxscan; $e_scan++) +for ($e_scan=0; $e_scan<$maxscan; $e_scan++) { if (is_file('../scenario/'.$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true) { @@ -129,13 +81,64 @@ else if ($script=='all') $description=str_replace('//@description:', '', $description); } } + $scenario[$cnt_scenario]['file']=$scan[$e_scan]; + $scenario[$cnt_scenario]['desc']=$description; + $cnt_scenario++; + + + } + } +$script=HtmlInput::default_value_get('script', ''); +if ($script=="") +{ + echo "

Test NOALYSS

"; + /* + * cherche pour fichier a include, s'il y en a alors les affiche + * avec une description + */ + + + echo '
'; + $get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts")); + echo ''; + echo ''; + echo ''; + echo ''; + + for ($e=0; $e<$cnt_scenario; $e++) + { + + $get='test.php?'.http_build_query(array('script'=>$scenario[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$scenario[$e]['desc'])); + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + } + echo '
'; + echo ''; + echo "Tous "; + echo ''; + echo 'Tous les scripts
'; + echo $e; + echo ''; + echo ''; + echo $scenario[$e]['file']; + echo ''; + echo ''.$scenario[$e]['desc'].'
'; +} +else if ($script=='all') +{ + $nb=HtmlInput::default_value_get('nb_script', 0); + $start_mem=memory_get_usage(); $start_time=microtime(true); $script=str_replace('../', '', $script); - - echo '

'.$script."

"; - echo '

description = '.$description.'

'; - include '../scenario/'.$scan[$e_scan]; + + echo '

'.$nb." ".$scenario[$nb]['file']."

"; + echo '

description = '.$scenario[$nb]["desc"].'

'; + include '../scenario/'.$scenario[$nb]['file']; echo ''; echo ''; $end_mem=memory_get_usage(); @@ -150,8 +153,14 @@ else if ($script=='all') echo "

Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes "; echo '

'; echo "

Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes

"; - } - } + $nb++; + if ( $nb == $maxscan ) { + echo "Dernier test"; + } else { + $get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'nb_script'=>$nb)); + echo ''; + echo $scenario[$nb]['file']; + } } else {