noalyss-commit
[Top][All Lists]
Advanced

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

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


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

sparkyx pushed a commit to branch master
in repository noalyss.

commit 228ac8254ed585a5f41eb9e93e664841f4439044
Author: Dany De Bontridder <address@hidden>
Date:   Tue Oct 13 12:34:40 2015 +0200

    Reduce the number of file in HTML folder, move ajax_todo_list to 
include/ajax called from ajax_misc.php
---
 html/ajax_misc.php                        |    3 +
 html/js/todo_list.js                      |   29 ++++----
 {html => include/ajax}/ajax_todo_list.php |    3 +-
 include/lib/class_tool_uos.php            |  107 -----------------------------
 4 files changed, 18 insertions(+), 124 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 379091d..a01a884 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -101,6 +101,9 @@ if ( LOGINPUT)
     }
 switch ($op)
 {
+        case "todo_list":
+            require NOALYSS_INCLUDE.'/ajax/ajax_todo_list.php';
+            return;
         case 'pcmn_update':
             require NOALYSS_INCLUDE.'/ajax/ajax_pcmn_update.php';
             return;
diff --git a/html/js/todo_list.js b/html/js/todo_list.js
index c44c588..c34b995 100644
--- a/html/js/todo_list.js
+++ b/html/js/todo_list.js
@@ -37,15 +37,11 @@ function todo_list_show(p_id)
     {
          var gDossier = $('gDossier').value;
         var action = new Ajax.Request(
-                'ajax_todo_list.php',
+                'ajax_misc.php',
                 {
                     method: 'get',
                     parameters:
-                            {'show':
-                                        1, 'id':
-                                        p_id, 'gDossier':
-                                        gDossier
-                            },
+                            {'show':1, 'id':p_id, 
'gDossier':gDossier,op:'todo_list'},
                     onFailure: todo_list_show_error,
                     onSuccess: function (req)
                     {
@@ -105,10 +101,10 @@ function todo_list_remove(p_ctl)
         var gDossier = $('gDossier').value;
 
         var action = new Ajax.Request(
-                'ajax_todo_list.php',
+                'ajax_misc.php',
                 {
                     method: 'get',
-                    parameters:{'del':1, 'id':p_ctl, 'gDossier':gDossier}
+                    parameters:{'del':1, 'id':p_ctl, 
'gDossier':gDossier,op:'todo_list'}
                 }
         );
         return false;
@@ -119,7 +115,8 @@ function todo_list_save(p_form)
     try {
     var form=$('todo_form_'+p_form);
     var json=form.serialize(true);
-    new Ajax.Request('ajax_todo_list.php',
+    json['op']="todo_list";
+    new Ajax.Request('ajax_misc.php',
                     {
                         method:'get',
                        parameters:json,
@@ -198,12 +195,13 @@ function todo_list_share(p_note, p_dossier)
 {
     waiting_node();
     new Ajax.Request(
-            'ajax_todo_list.php',
+            'ajax_misc.php',
             {
                 method: "get",
                 parameters: {"act": 'shared_note',
                     "todo_id": p_note,
-                    "gDossier": p_dossier
+                    "gDossier": p_dossier,
+                    op:'todo_list'
                 },
                 onSuccess: function (p_xml) {
                     try {
@@ -236,10 +234,10 @@ function todo_list_share(p_note, p_dossier)
 function todo_list_set_share(note_id,p_login,p_dossier)
 {
     waiting_node();
-    new Ajax.Request('ajax_todo_list.php',
+    new Ajax.Request('ajax_misc.php',
             {
                 method:"get",
-                parameters: { 
todo_id:note_id,act:"set_share","gDossier":p_dossier,"login":p_login},
+                parameters: { 
todo_id:note_id,act:"set_share","gDossier":p_dossier,"login":p_login,op:'todo_list'},
                 onSuccess:function() {
                     remove_waiting_node();
                 }
@@ -249,12 +247,13 @@ function todo_list_set_share(note_id,p_login,p_dossier)
 function todo_list_remove_share(note_id,p_login,p_dossier)
 {
     waiting_node();
-    new Ajax.Request('ajax_todo_list.php',{
+    new Ajax.Request('ajax_misc.php',{
         parameters : {
             'gDossier':p_dossier,
             'todo_id':note_id,
             'login':p_login,
-            'act':"remove_share"
+            'act':"remove_share",
+            op:'todo_list'
         },
         method:"get",
         onSuccess:function (p_xml) {
diff --git a/html/ajax_todo_list.php b/include/ajax/ajax_todo_list.php
similarity index 99%
rename from html/ajax_todo_list.php
rename to include/ajax/ajax_todo_list.php
index e71dfd7..85d055f 100644
--- a/html/ajax_todo_list.php
+++ b/include/ajax/ajax_todo_list.php
@@ -33,8 +33,7 @@
  * - gDossier
  * - i id
  */
-define ('ALLOWED',1);
-require_once '../include/constant.php';
+if ( ! defined ('ALLOWED') ) die (_('Aucun accès direct'));
 require_once  NOALYSS_INCLUDE.'/class/class_dossier.php';
 require_once  NOALYSS_INCLUDE.'/class/class_todo_list.php';
 require_once  NOALYSS_INCLUDE.'/lib/class_database.php';
diff --git a/include/lib/class_tool_uos.php b/include/lib/class_tool_uos.php
deleted file mode 100644
index 1a1cf50..0000000
--- a/include/lib/class_tool_uos.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/*
- *   This file is part of NOALYSS.
- *
- *   NOALYSS is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   NOALYSS is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with NOALYSS; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-/**
- * @file
- * @brief Objec to check a double insert into the database, this duplicate 
occurs after
- * a refresh of the web page
- */
-// Copyright Author Dany De Bontridder address@hidden
-
-require_once NOALYSS_INCLUDE.'/lib/class_database.php';
-define ('CODE_EXCP_DUPLICATE',901);
-/**
- * @brief Objec to check a double insert into the database, this duplicate 
occurs after
- * a refresh of the web page
- * in
- */
-
-class Tool_Uos
-{
-    /**
-     * Constructor $p_name will be set to $this->name, it is also the name
-     * of the tag hidden in a form
-     * @global $cn Db connxion
-     * @param $p_name
-     */
-    function __construct($p_name)
-    {
-        $this->name=$p_name;
-    }
-    /**
-     * @brief return a string with a tag hidden and a uniq value
-     * @param $hHidden is the name of the tag hidden
-     * @return string : tag hidden
-     */
-    function hidden()
-    {
-               global $cn;
-        $this->id=$cn->get_next_seq('uos_pk_seq');
-        return HtmlInput::hidden($this->name,$this->id);
-    }
-    /**
-     * @brief Try to insert into the table tool_uos
-     * @global $cn Database connx
-     * @throws Exception if the value $p_id is not unique
-     */
-    function save($p_array=null)
-    {
-        global $cn;
-               if ( $p_array == null ) $p_array=$_POST;
-               $this->id=$p_array[$this->name];
-        $sql="insert into tool_uos(uos_value) values ($1)";
-        try {
-            $cn->exec_sql($sql,array($this->id));
-        } catch (Exception $e)
-        {
-            throw new Exception('Duplicate value');
-        }
-    }
-    /**
-     * Count how many time we have this->id into the table tool_uos
-     * @global $cn Database connx
-     * @param $p_array is the array where to find the key name, usually it is
-     * $_POST. The default value is $_POST
-     * @return integer : 0 or 1
-     */
-    function get_count($p_array=null)
-    {
-        global $cn;
-        if ( $p_array == null ) $p_array=$_POST;
-        $this->id=$p_array[$this->name];
-        $count=$cn->get_value('select count(*) from tool_uos where 
uos_value=$1',
-                array($this->id));
-        return $count;
-    }
-    function check ($p_array=null)
-    {
-        global $cn;
-        if ( $p_array == null ) $p_array=$_POST;
-        $this->id=$p_array[$this->name];
-        try
-        {
-            $count=$cn->get_value('select count(*) from tool_uos where 
uos_value=$1',
-                    array($this->id));
-            if ($count != 0 ) throw new Exception 
('DUPLICATE',CODE_EXCP_DUPLICATE);
-        }catch (Exception $e)
-        {
-            throw $e;
-        }
-    }
-}
-?>



reply via email to

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