noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 07/13: Reduce the number of file in HTML fold


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 07/13: Reduce the number of file in HTML folder, move ajax_history to include/ajax called from ajax_misc.php
Date: Wed, 14 Oct 2015 21:38:32 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit d064ed5773f6c79eaa4cde1ed88432eb9c693878
Author: Dany De Bontridder <address@hidden>
Date:   Tue Oct 13 12:59:25 2015 +0200

    Reduce the number of file in HTML folder, move ajax_history to include/ajax 
called from ajax_misc.php
---
 html/ajax_misc.php                      |    9 +++-
 html/js/acc_ledger.js                   |   75 +++++++++++++++++++++++--------
 {html => include/ajax}/ajax_history.php |   27 +----------
 3 files changed, 64 insertions(+), 47 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index a01a884..6b9334b 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -58,8 +58,8 @@ foreach ($var as $v)
 }
 if ($cont != 0)
        exit();
-extract($_REQUEST);
-set_language();
+ajax_disconnected($div);
+
 global $g_user, $cn, $g_parameter;
 //
 // If database id == 0 then we are not connected to a folder 
@@ -80,7 +80,7 @@ else
     $g_user->check(true);
 }
 $html = var_export($_REQUEST, true);
-
+set_language();
 if ( LOGINPUT)
     {
         
$file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
@@ -104,6 +104,9 @@ switch ($op)
         case "todo_list":
             require NOALYSS_INCLUDE.'/ajax/ajax_todo_list.php';
             return;
+        case "history":
+            require NOALYSS.'/ajax/ajax_history.php';
+            return;
         case 'pcmn_update':
             require NOALYSS_INCLUDE.'/ajax/ajax_pcmn_update.php';
             return;
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 4ff1814..e9e2eb6 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -648,23 +648,31 @@ function go_next_concerned()
     }
     return true;
 }
+/**
+ * @brief View the history of an account
+ * @param {type} p_value
+ * @param {type} dossier
+ * @returns {undefined}
+ */
 function view_history_account(p_value, dossier)
 {
     layer++;
     id = 'det' + layer;
     var popup = {'id': id, 'cssclass': 'inner_box', 'html': loading(), 'drag': 
true};
 
-    querystring = 'gDossier=' + dossier + '&act=de&pcm_val=' + p_value + 
'&div=' + id + "&l=" + layer;
-    add_div(popup);
+    var 
querystring={'gDossier':dossier,'act':'de','pcm_val':p_value,'div':id,'l':layer,'op':'history'};
+    waiting_box();
 
     var action = new Ajax.Request(
-            "ajax_history.php",
+            "ajax_misc.php",
             {
                 method: 'get',
                 parameters: querystring,
                 onFailure: error_box,
                 onSuccess: function (req, xml)
                 {
+                    remove_waiting_box();
+                    add_div(popup);
                     success_box(req, xml);
                     g(id).style.top = calcy(140 + (layer * 3)) + "px";
                 }
@@ -672,19 +680,31 @@ function view_history_account(p_value, dossier)
     );
 
 }
-
+/**
+ * @brief Change the view of account history
+ * @param {type} obj
+ * @returns {Boolean}
+ */
 function update_history_account(obj)
 {
     try {
-        var querystring = "l=" + obj.div + "&div=" + obj.div + "&gDossier=" + 
obj.gDossier + "&pcm_val=" + obj.pcm_val + "&ex=" + 
obj.select.options[obj.select.selectedIndex].text;
+        var querystring = {
+            "l" :obj.div ,
+            "div" :obj.div ,
+            "gDossier" : obj.gDossier,
+            "pcm_val" : obj.pcm_val ,
+            "ex" : obj.select.options[obj.select.selectedIndex].text
+        };
+        waiting_box();
         var action = new Ajax.Request(
-                "ajax_history.php",
+                "ajax_misc.php",
                 {
                     method: 'get',
                     parameters: querystring,
                     onFailure: error_box,
                     onSuccess: function (req, xml)
                     {
+                        remove_waiting_box();
                         success_box(req, xml);
                         g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
                     }
@@ -696,48 +716,65 @@ function update_history_account(obj)
 
     return false;
 }
-/*!\brief
+/*!\brief Change the view of card history
  * \param p_value f_id of the card
  */
-
 function view_history_card(p_value, dossier)
 {
     layer++;
     id = 'det' + layer;
-    var popup = {'id':
-                id, 'cssclass': 'inner_box'
-        , 'html':
-                loading(), 'drag':
-                true};
-    querystring = 'gDossier=' + dossier + '&act=de&f_id=' + p_value + '&div=' 
+ id + "&l=" + layer;
-    add_div(popup);
+    var popup = {'id':id,
+                'cssclass': 'inner_box', 
+                'html':loading(), 
+                'drag':true};
+    var querystring = { 'gDossier' : dossier ,
+         'act':'de',
+         'f_id' : p_value , 
+         'div' : id ,
+          "l" : layer,
+          "op":"history"};
+    waiting_box();
     var action = new Ajax.Request(
-            "ajax_history.php",
+            "ajax_misc.php",
             {
                 method: 'get',
                 parameters: querystring,
                 onFailure: error_box,
                 onSuccess: function (req, xml)
                 {
+                    remove_waiting_box();
+                    add_div(popup);
                     success_box(req, xml);
                     g(id).style.top = calcy(140 + (layer * 3)) + "px";
                 }
             }
     );
 }
-
+/**
+ * @brief update history view after changing the exercice
+ * @param {type} obj
+ * @returns {Boolean}
+ */
 function update_history_card(obj)
 {
     try {
-        var querystring = "l=" + obj.div + "&div=" + obj.div + "&gDossier=" + 
obj.gDossier + "&f_id=" + obj.f_id + "&ex=" + 
obj.select.options[obj.select.selectedIndex].text;
+        var querystring = {
+            "l" : obj.div , 
+            "div" : obj.div ,
+            "gDossier" : obj.gDossier,
+            "f_id" : obj.f_id ,
+            "ex" : obj.select.options[obj.select.selectedIndex].text
+        };
+        waiting_box();
         var action = new Ajax.Request(
-                "ajax_history.php",
+                "ajax_misc.php",
                 {
                     method: 'get',
                     parameters: querystring,
                     onFailure: error_box,
                     onSuccess: function (req, xml)
                     {
+                        remove_waiting_box();
                         success_box(req, xml);
                         g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
                     }
diff --git a/html/ajax_history.php b/include/ajax/ajax_history.php
similarity index 85%
rename from html/ajax_history.php
rename to include/ajax/ajax_history.php
index c7b3285..a9d3c66 100644
--- a/html/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -23,9 +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);
+if ( ! defined('ALLOWED')) die (_('Accès interdit'));
 
-require_once '../include/constant.php';
 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
 require_once NOALYSS_INCLUDE.'/class/class_user.php';
 require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
@@ -39,33 +38,11 @@ mb_internal_encoding("UTF-8");
 /**
  *if $_SESSION['g_user'] is not set : echo a warning
  */
-ajax_disconnected($div);
-global $g_user,$cn;
-$cn=Dossier::connect();
-$g_user=new User($cn);
-set_language();
 /* security */
 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,"<?php \n");
-        fwrite ($file_loginput,"//@description:\n");
-        fwrite($file_loginput, '$_GET='.var_export($_GET,true));
-        fwrite($file_loginput,";\n");
-        fwrite($file_loginput, '$_POST='.var_export($_POST,true));
-        fwrite($file_loginput,";\n");
-        fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
-        fwrite($file_loginput,"\n");
-        fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
-        fwrite($file_loginput,"\n");
-        fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
-        fwrite($file_loginput,"\n");
-        fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
-        fclose($file_loginput);
-    }
+
 ///////////////////////////////////////////////////////////////////////////
 /* first detail for a card */
 ///////////////////////////////////////////////////////////////////////////



reply via email to

[Prev in Thread] Current Thread [Next in Thread]