Code

Added simple js handling to popup js dialogs, not finished yet
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Sep 2007 09:35:32 +0000 (09:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Sep 2007 09:35:32 +0000 (09:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7325 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js
ihtml/themes/default/msg_dialog.tpl
include/class_msg_dialog.inc

index 615c211f9174e8b0a1ff35d732001d45e4bc8310..57fbf000662ec386b7803bafe4101ce9274cc6ea 100644 (file)
@@ -446,6 +446,62 @@ function focus_field()
         element.focus();
     }
 }
+
+
+
+function next_msg_dialog()
+{
+       var s_pending = "";
+       var a_pending = new Array();
+       var i_id                        = 0;
+       var i                                   = 0;
+       var tmp                         = "";
+
+       if(document.getElementById('current_msg_dialogs')){
+               var cur_id = document.getElementById('current_msg_dialogs').value;
+               if(cur_id != ""){
+                       hide('e_layer2' + cur_id);      
+               }
+       }
+
+       if(document.getElementById('pending_msg_dialogs')){
+               s_pending = document.getElementById('pending_msg_dialogs').value;
+               a_pending = s_pending.split(",");
+               if(a_pending.length){
+                               i_id = a_pending.pop();
+                               for (i = 0 ; i < a_pending.length; ++i){
+                                               tmp = tmp + a_pending[i] + ',';
+                               }
+                               tmp = tmp.replace(/,$/g,"");
+                               if(i_id != ""){
+                                               var ele = document.getElementById('e_layer2' + i_id);
+                                               ele.style.display= 'block'      ;
+                                               document.getElementById('pending_msg_dialogs').value= tmp;
+                                               document.getElementById('current_msg_dialogs').value= i_id;
+                               }
+               }
+       }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 // vim:ts=2:syntax
index 15f54bbea081d22cac98cff1a4cf7bfedddc8ef6..57c1a7ff3282d654b7ef5a16ede761b24cc860aa 100644 (file)
@@ -27,7 +27,9 @@
                        height:100%;
                        filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='images/opacity_black.png'); ">
 {else}
-       <div  id='e_layer2{$i_ID}'>
+       <div  id='e_layer2{$i_ID}'
+                       style='display:none;'
+                       >
 <!--           style="
                        position: absolute;
                        left: 0px;
@@ -58,7 +60,6 @@
 {elseif $i_Type == INFO_DIALOG}
                                        <img src='images/info.png' alt='{t}Information{/t}'>
 {/if}
-                               <img alt='' src=''>
                                </td>
                                <td style='width:100%'>
                                        <h1>{$s_Title}</h1>
                        <tr>
                                <td colspan='2' align='center'>
 {if $i_Type == ERROR_DIALOG || $i_Type == WARNING_DIALOG || $i_Type == INFO_DIALOG}
-                                       <button type='button' name='MSG_OK{$i_ID}' 
-                                               onClick='hide("e_layer{$i_ID}");hide("e_layer2{$i_ID}");'>{t}Ok{/t}</button>
+                                       <button type='button' name='MSG_OK{$i_ID}' onClick='next_msg_dialog();'>{t}Ok{/t}</button>
 {elseif $i_Type == CONFIRM_DIALOG}
-                                       <button type='submit' name='MSG_OK{$i_ID}'      
-                                               onClick='hide("e_layer{$i_ID}");hide("e_layer2{$i_ID}");'>{t}Ok{/t}</button>
-                                       <button type='button' name='MSG_CANCEL{$i_ID}' 
-                                               onClick='hide("e_layer{$i_ID}");hide("e_layer2{$i_ID}");'>{t}Cancel{/t}</button>
+                                       <button type='submit' name='MSG_OK{$i_ID}' onClick='next_msg_dialog();'>{t}Ok{/t}</button>
+                                       <button type='button' name='MSG_CANCEL{$i_ID}' onClick='next_msg_dialog();'>{t}Cancel{/t}</button>
 {/if}
                                </td>
                        </tr>
index 5e3a7cd286d7a845cfb816b93ed1d9da33477947..08b536c087407109a927cfb6753adab0824db0d0 100644 (file)
@@ -36,6 +36,11 @@ class msg_dialog
                }
        }
 
+       public function get_ID()
+       {
+               return($this->i_ID);
+       }
+
        public function execute()
        {
                $smarty = get_smarty();
@@ -51,12 +56,18 @@ class msg_dialog
        public static function get_dialogs()
        {
                $return  ="";
+               $dialog_ids= "";        
                if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){
                        foreach($_SESSION['msg_dialogs'] as $key => $dialog){
                                $return.= $dialog->execute();
+                               $dialog_ids= $dialog->get_ID().",".$dialog_ids;
                        }
                }
                unset($_SESSION['msg_dialogs']);
+               $dialog_ids = preg_replace("/,$/","",$dialog_ids);
+               
+               $return .="<input type='text' style='width:400px;' name='pending_msg_dialogs' id='pending_msg_dialogs' value='".$dialog_ids."'>";
+               $return .="<input type='text' style='width:400px;' name='current_msg_dialogs' id='current_msg_dialogs' value=''>";
                return($return);
        }
 }