noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 02/03: #1153 Dialog box : confirm_form in jav


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 02/03: #1153 Dialog box : confirm_form in javascript , use of smoke, add style
Date: Mon, 24 Aug 2015 22:43:54 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 8f855f8a5045acab8152353cba917616de7774ef
Author: Dany De Bontridder <address@hidden>
Date:   Fri Aug 21 23:03:14 2015 +0200

    #1153 Dialog box :  confirm_form in javascript , use of smoke, add style
---
 html/js/admin.js                |   27 +++++++++-----
 html/js/anc_script.js           |   28 +++++++++------
 html/js/gestion.js              |   34 ++++++++++--------
 html/js/scripts.js              |   70 ++++++++++++++++++++++----------------
 html/js/todo_list.js            |   34 ++++++++-----------
 html/style-classic.css          |   14 +++++++-
 html/style-mandarine.css        |   19 +++++++++--
 html/style-mobile.css           |   19 +++++++++--
 html/style-test.css             |   12 +++++++
 include/fiche.inc.php           |    4 +-
 include/template/fiche_list.php |    8 +++--
 11 files changed, 171 insertions(+), 98 deletions(-)

diff --git a/html/js/admin.js b/html/js/admin.js
index d700aae..7d56493 100644
--- a/html/js/admin.js
+++ b/html/js/admin.js
@@ -76,16 +76,23 @@ function folder_display(p_user)
  */
 function folder_remove(p_user,p_dossier )
 {
-    if ( ! confirm('Confirmer')) return;
-    waiting_box();
-    new Ajax.Request('ajax_misc.php', {
-        method: "get",
-        parameters: {"p_user": p_user, 'p_dossier': p_dossier, "op": 
"folder_remove", 'gDossier': 0},
-        onSuccess: function (p_xml) {
-            // table id = database_list
-            new Effect.Opacity('row'+p_dossier, { from: 1.0, to: 0.0, 
duration: 0.2 });
-            remove_waiting_box();
-        }
+    smoke.confirm ('Confirmer',
+    function (e) {
+        if (e ) {
+            waiting_box();
+            new Ajax.Request('ajax_misc.php', {
+                method: "get",
+                parameters: {"p_user": p_user, 'p_dossier': p_dossier, "op": 
"folder_remove", 'gDossier': 0},
+                onSuccess: function (p_xml) {
+                    // table id = database_list
+                    new Effect.Opacity('row'+p_dossier, { from: 1.0, to: 0.0, 
duration: 0.2 });
+                    remove_waiting_box();
+                }
+            
+        });
+    } else {
+        return ;
+    }
     });
 }
 
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index 0b1ed5e..2530d49 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -322,17 +322,23 @@ function caod_checkTotal()
  */
 function anc_remove_operation(p_dossier, p_oa_group)
 {
-    var a = confirm("Etes-vous sur de vouloir effacer cette operation ?\n");
-    if (a == false)
-        return;
-    var obj = {"oa":
-                p_oa_group, "gDossier":
-                p_dossier, "op": "remove_anc"};
-    var queryString = encodeJSON(obj);
-    g(p_oa_group).style.display = 'none';
-    var e = new Ajax.Request("ajax_misc.php",
-            {method: 'get', parameters: queryString});
-
+     smoke.confirm("Etes-vous sur de vouloir effacer cette operation ?\n",
+     function (a)
+     {
+         if ( a) {
+            var obj = {"oa":
+                        p_oa_group, "gDossier":
+                        p_dossier, "op": "remove_anc"};
+            var queryString = encodeJSON(obj);
+            g(p_oa_group).style.display = 'none';
+            var e = new Ajax.Request("ajax_misc.php",
+                    {method: 'get', parameters: queryString});
+             
+         } else
+         {
+             return;
+         }
+     });
 }
 /**
  * add a row in misc operation for ANC
diff --git a/html/js/gestion.js b/html/js/gestion.js
index 231a2e8..408700b 100644
--- a/html/js/gestion.js
+++ b/html/js/gestion.js
@@ -221,22 +221,26 @@ function check_hour(p_ctl)
 
 function removeStock(s_id,p_dossier)
 {
-       if ( ! confirm("Confirmez-vous l'effacement de cette entrée dans le 
stock?") )
-       {
-               return;
-       }
-       queryString="gDossier="+p_dossier+"&op=rm_stock&s_id="+s_id;
-       var action=new Ajax.Request (
-               "ajax_misc.php",
-               {
-                       method:'get',
-                       parameters:queryString,
-                       onFailure:errorRemoveStock,
-                       onSuccess:successRemoveStock
-               }
-
+       smoke.confirm("Confirmez-vous l'effacement de cette entrée dans le 
stock?",
+        function (a) {
+            if (a)
+            {
+                queryString="gDossier="+p_dossier+"&op=rm_stock&s_id="+s_id;
+                var action=new Ajax.Request (
+                        "ajax_misc.php",
+                        {
+                                method:'get',
+                                parameters:queryString,
+                                onFailure:errorRemoveStock,
+                                onSuccess:successRemoveStock
+                        }
                );
-
+                
+            }
+            else {
+                    return ;
+            }
+        });
 }
 /**
  address@hidden error if a document if removed
diff --git a/html/js/scripts.js b/html/js/scripts.js
index d2e9c8b..ca0f0c0 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -69,13 +69,18 @@ function infodiv(req, json)
  */
 function deleteRow(tb, obj)
 {
-    if (confirm('Confirmez effacement'))
-    {
-        var td = obj.parentNode;
-        var tr = td.parentNode;
-        var lidx = tr.rowIndex;
-        g(tb).deleteRow(lidx);
-    }
+    smoke.confirm('Confirmez effacement',function (e)
+    {
+        if (e) {
+            var td = obj.parentNode;
+            var tr = td.parentNode;
+            var lidx = tr.rowIndex;
+            g(tb).deleteRow(lidx);
+            
+        } else {
+            return ;
+        }
+    });
 }
 function deleteRowRec(tb, obj)
 {
@@ -1508,27 +1513,33 @@ function 
display_sub_menu(p_dossier,p_profile,p_dep,p_level)
 function remove_sub_menu(p_dossier,profile_menu_id)
 {
     if ( ! confirm ('Confirm ?')) return;
-    waiting_box();
-    new Ajax.Request('ajax_misc.php',
-                    {                   
-                        method:'get',
-                        parameters: { op:'remove_submenu',gDossier:p_dossier,
-                        p_profile_menu_id:profile_menu_id},
-                        onSuccess:function (req) {
-                            try {
-                                remove_waiting_box();
-                                 if ( $('menu_table').rows.length > 1 ) {
-                                      $('menu_table').rows[1].remove();
-                                 }
-                                $('sub'+profile_menu_id).remove();
-                            } catch(e)
-                            {
-                                alert_box(e.message);
-                            }
-                        }
-                    }
-                            
-            );
+    smoke.confirm('Confirme ?', 
+    function (e) {
+    if (e) {
+        waiting_box();
+        new Ajax.Request('ajax_misc.php',
+        {                   
+            method:'get',
+            parameters: { op:'remove_submenu',gDossier:p_dossier,
+            p_profile_menu_id:profile_menu_id},
+            onSuccess:function (req) {
+                try {
+                    remove_waiting_box();
+                     if ( $('menu_table').rows.length > 1 ) {
+                          $('menu_table').rows[1].remove();
+                     }
+                    $('sub'+profile_menu_id).remove();
+                } catch(e)
+                {
+                    alert_box(e.message);
+                }
+            }
+        }
+       );
+       } else {
+                return;
+            }
+        });
 }
 /**
  * @brief add a menu to a profile, propose only the available menu
@@ -2871,8 +2882,7 @@ function confirm_form(p_obj, p_message)
 
         var newdiv = document.createElement('DIV');
         newdiv.id = 'confirm_12';
-        newdiv.addClassName("inner_box");
-        newdiv.setStyle('z-index:101;width:50%;left:25%;');
+        newdiv.addClassName("inner_box confirm_box");
         //newdiv.innerHTML="<h2 class='title'></h2>";
         newdiv.innerHTML += '<p style="text-align:center">';
         newdiv.innerHTML += p_message;
diff --git a/html/js/todo_list.js b/html/js/todo_list.js
index f2a94c9..c44c588 100644
--- a/html/js/todo_list.js
+++ b/html/js/todo_list.js
@@ -98,27 +98,21 @@ function add_todo()
 }
 function todo_list_remove(p_ctl)
 {
-    if (confirm('Effacer ?') == false)
-    {
-        return;
-    }
-    $("tr" + p_ctl).hide();
-    var gDossier = $('gDossier').value;
-
-    var action = new Ajax.Request(
-            'ajax_todo_list.php',
-            {
-                method: 'get',
-                parameters:
-                        {'del':
-                                    1, 'id':
-                                    p_ctl, 'gDossier':
-                                    gDossier
-                        }
-            }
-    );
-    return false;
+    smoke.confirm('Effacer ?',
+    function (e) {
+        if ( !e ) {return;}
+        $("tr" + p_ctl).hide();
+        var gDossier = $('gDossier').value;
 
+        var action = new Ajax.Request(
+                'ajax_todo_list.php',
+                {
+                    method: 'get',
+                    parameters:{'del':1, 'id':p_ctl, 'gDossier':gDossier}
+                }
+        );
+        return false;
+    });
 }
 function todo_list_save(p_form)
 {
diff --git a/html/style-classic.css b/html/style-classic.css
index 11d0716..da131ff 100644
--- a/html/style-classic.css
+++ b/html/style-classic.css
@@ -674,7 +674,7 @@ span.action a.action:hover {
     color:#000000;
 }
 div.popup_back{
-    position:absolute;
+    position:fixed;
     top:0px;
     left:0px;
     opacity:0.30;
@@ -1964,4 +1964,16 @@ td.cut {
 }
 td.box {
     border-left: #9999ff solid 1px;
+}
+/***************************************************************************
+ * Confirm dialog box
+ ***************************************************************************/
+div.confirm_box {
+    position:fixed;
+    top:100px;
+    left:0px;
+    right:0px;
+    z-index:101;
+    width:50%;
+    left:25%;
 }
\ No newline at end of file
diff --git a/html/style-mandarine.css b/html/style-mandarine.css
index c847d41..4fc5590 100644
--- a/html/style-mandarine.css
+++ b/html/style-mandarine.css
@@ -634,14 +634,15 @@ span.action a.action:hover {
     color:#000000;
 }
 div.popup_back{
-    position:absolute;
+    position:fixed;
     top:0px;
     left:0px;
-    opacity:0.6;
+    opacity:0.2;
     width:100%;
     height:100%;
     z-index:1;
-    display:none;
+    display:block;
+    background: #F93;
 }
 
 div.popup_border_title {
@@ -1881,4 +1882,16 @@ td.cut {
 }
 td.box {
     border-left : #C76626 solid 1px;
+}
+/***************************************************************************
+ * Confirm dialog box
+ ***************************************************************************/
+div.confirm_box {
+    position:fixed;
+    top:100px;
+    left:0px;
+    right:0px;
+    z-index:101;
+    width:50%;
+    left:25%;
 }
\ No newline at end of file
diff --git a/html/style-mobile.css b/html/style-mobile.css
index a7d025f..e093ac6 100644
--- a/html/style-mobile.css
+++ b/html/style-mobile.css
@@ -661,14 +661,15 @@ span.action a.action:hover {
     color:#000000;
 }
 div.popup_back{
-    position:absolute;
+    position:fixed;
     top:0px;
     left:0px;
-    opacity:0.6;
+    opacity:0.2;
     width:100%;
     height:100%;
     z-index:1;
-    display:none;
+    display:block;
+    background: #3f4c6b;
 }
 
 div.popup_border_title {
@@ -1945,4 +1946,16 @@ td.cut {
 }
 td.box {
     border-left : #3f4c6b solid 1px;
+}
+/***************************************************************************
+ * Confirm dialog box
+ ***************************************************************************/
+div.confirm_box {
+    position:fixed;
+    top:100px;
+    left:0px;
+    right:0px;
+    z-index:101;
+    width:50%;
+    left:25%;
 }
\ No newline at end of file
diff --git a/html/style-test.css b/html/style-test.css
index fe76636..5bccfbc 100644
--- a/html/style-test.css
+++ b/html/style-test.css
@@ -71,4 +71,16 @@ table.sortable td,table.result td
        position: absolute;
        top:0;
        left:0;
+}
+/***************************************************************************
+ * Confirm dialog box
+ ***************************************************************************/
+div.confirm_box {
+    position:fixed;
+    top:100px;
+    left:0px;
+    right:0px;
+    z-index:101;
+    width:50%;
+    left:25%;
 }
\ No newline at end of file
diff --git a/include/fiche.inc.php b/include/fiche.inc.php
index cc855c2..36b97cb 100644
--- a/include/fiche.inc.php
+++ b/include/fiche.inc.php
@@ -154,7 +154,7 @@ if ($_GET['histo'] == -1)
                        /**
                         * Move
                         */
-                       if (isset($_POST['move']))
+                       if (isset($_POST['move'])&& $_POST['move'] == 1)
                        {
                                for ($i = 0; $i < count($ack); $i++)
                                {
@@ -165,7 +165,7 @@ if ($_GET['histo'] == -1)
                        /**
                         * Delete
                         */
-                       if (isset($_POST['delete']))
+                       if (isset($_POST['delete'])&& $_POST['delete']==1)
                        {
                                $msg="";
                                for ($i = 0; $i < count($ack); $i++)
diff --git a/include/template/fiche_list.php b/include/template/fiche_list.php
index 9571893..bd7566c 100644
--- a/include/template/fiche_list.php
+++ b/include/template/fiche_list.php
@@ -27,7 +27,7 @@
  */
 ?>
 <?php echo  $bar?>
-<form method="POST" class="print" style="display:inline" onsubmit="return 
confirm('<?php echo _("Vous confirmez ?")?>')">
+<form method="POST" id="fiche_list_frm" class="print" style="display:inline" 
onsubmit="return confirm_form(this,'<?php echo _("Vous confirmez ?")?>')">
        <table class="sortable" id="fiche_list_table_id">
                <tr>
                        <th >
@@ -86,9 +86,11 @@
        </table>
        <?php echo $str_add_card?>
 <?php echo HtmlInput::hidden('action',"1");?>
-<?php echo HtmlInput::submit('delete',_('Effacer la sélection '))?>
+<?php echo HtmlInput::hidden('delete',"0");?>
+<?php echo HtmlInput::hidden('move',"0");?>
+<?php echo HtmlInput::submit('delete_bt',_('Effacer la sélection 
'),'onclick="$(\'delete\').value=1;$(\'move\').value=0"')?>
 <?php if ( $allcard ==  0  ): ?>
-<?php echo HtmlInput::submit('move',_('Déplacer la sélection  vers'))?>
+<?php echo HtmlInput::submit('move_bt',_('Déplacer la sélection  
vers'),'onclick="$(\'delete\').value=0;$(\'move\').value=1"')?>
 <?php 
 $iselect=new ISelect('move_to');
 $iselect->value=$cn->make_array("select fd_id,fd_label from fiche_def order by 
2");



reply via email to

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