Code

Updated msg_dialog to support non js systems
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Sep 2007 07:48:19 +0000 (07:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Sep 2007 07:48:19 +0000 (07:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7433 594d385d-05f5-0310-b6e9-bd551577e9d8

ihtml/themes/default/msg_dialog.tpl
include/class_msg_dialog.inc

index 3d870e7284d6a537da41c628892e3aaa90524c44..d7d9ac49bc6048fc1e1efff3fe7521dd97949f3e 100644 (file)
 {/if}
 {else}
 
-       {if $s_Trace != ""}
-       <div id='trace_{$i_ID}' style='visibility:hidden;'>
-               {$s_Trace}
-       </div>
-       
+
+       {if !$JS}
+
+               <div id='e_layer{$i_ID}'
+                               style='
+                                       width:60%;
+                                       left:200px;
+                                       top:200px;
+                                       background-color:white;
+                                       padding:5px;
+                                       border:5px solid red;
+                                       z-index:150;
+                                       position:absolute;'>
+                       <table style='width:100%' summary='' border=0>
+                               <tr>
+                                       <td style='vertical-align:top;padding:10px'>
+       {if $i_Type == ERROR_DIALOG}
+                                               <img src='images/error.png' alt='{t}Error{/t}'>
+       {elseif $i_Type == WARNING_DIALOG}
+                                               <img src='images/warning.png'  alt='{t}Warning{/t}'>
+       {elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG}
+                                               <img src='images/info.png' alt='{t}Information{/t}'>
+       {/if}
+                                       </td>
+                                       <td style='width:100%'>
+                                               <h1>{$s_Title}</h1>
+                                               <b>{$s_Message}</b>
+                                               <br>
+                                               <br>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td colspan='2' align='center'>
+       {if $i_Type == ERROR_DIALOG || $i_Type == WARNING_DIALOG || $i_Type == INFO_DIALOG}
+                                               <button type='submit' name='MSG_OK{$i_ID}'>{t}Ok{/t}</button>
+       {elseif $i_Type == CONFIRM_DIALOG}
+                                               <button type='submit' name='MSG_OK{$i_ID}'>{t}Ok{/t}</button>
+                                               <button type='submit' name='MSG_CANCEL{$i_ID}'>{t}Cancel{/t}</button>
        {/if}
+                                       </td>
+                               </tr>
+                       </table>
+               </div>
 
-       <div id='e_layer{$i_ID}'
-                       style='
-                               width:60%;
-                               left:200px;
-                               top:200px;
-                               background-color:white;
-                               padding:5px;
-                               border:5px solid red;
-                               z-index:150;
-                               display:none;
-                               position:absolute;'>
-               <table style='width:100%' summary='' border=0>
-                       <tr>
-                               <td style='vertical-align:top;padding:10px'>
-{if $i_Type == ERROR_DIALOG}
-                                       <img src='images/error.png' alt='{t}Error{/t}'>
-{elseif $i_Type == WARNING_DIALOG}
-                                       <img src='images/warning.png'  alt='{t}Warning{/t}'>
-{elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG}
-                                       <img src='images/info.png' alt='{t}Information{/t}'>
-{/if}
-                               </td>
-                               <td style='width:100%'>
-                                       <h1>{$s_Title}</h1>
-                                       <b>{$s_Message}</b>
-                                       <br>
-                                       <br>
-                               </td>
-                               {if $s_Trace}
-                               <td style='width:20px; vertical-align:top; cursor:pointer;'>
-                                       <div onClick="toggle('trace_{$i_ID}')"><u>Trace</u></div>
-                               </td>
-                               {/if}
-                       </tr>
-                       <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='next_msg_dialog();'>{t}Ok{/t}</button>
-{elseif $i_Type == CONFIRM_DIALOG}
-                                       <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>
-               </table>
-       </div>
+       {else}
+
+               {if $s_Trace != ""}
+               <div id='trace_{$i_ID}' style='visibility:hidden;'>
+                       {$s_Trace}
+               </div>
+               
+               {/if}
+
+               <div id='e_layer{$i_ID}'
+                               style='
+                                       width:60%;
+                                       left:200px;
+                                       top:200px;
+                                       background-color:white;
+                                       padding:5px;
+                                       border:5px solid red;
+                                       z-index:150;
+                                       display:none;
+                                       position:absolute;'>
+                       <table style='width:100%' summary='' border=0>
+                               <tr>
+                                       <td style='vertical-align:top;padding:10px'>
+       {if $i_Type == ERROR_DIALOG}
+                                               <img src='images/error.png' alt='{t}Error{/t}'>
+       {elseif $i_Type == WARNING_DIALOG}
+                                               <img src='images/warning.png'  alt='{t}Warning{/t}'>
+       {elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG}
+                                               <img src='images/info.png' alt='{t}Information{/t}'>
+       {/if}
+                                       </td>
+                                       <td style='width:100%'>
+                                               <h1>{$s_Title}</h1>
+                                               <b>{$s_Message}</b>
+                                               <br>
+                                               <br>
+                                       </td>
+                                       {if $s_Trace}
+                                       <td style='width:20px; vertical-align:top; cursor:pointer;'>
+                                               <div onClick="toggle('trace_{$i_ID}')"><u>Trace</u></div>
+                                       </td>
+                                       {/if}
+                               </tr>
+                               <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='next_msg_dialog();'>{t}Ok{/t}</button>
+       {elseif $i_Type == CONFIRM_DIALOG}
+                                               <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>
+                       </table>
+               </div>
+       {/if}
 {/if}
index b72e61b4e1f85f029540d67b10bec9e5ac9d2b55..1d5a81d6664f711c10b8fa70c6f30ed956e5a2be 100644 (file)
@@ -50,6 +50,7 @@ class msg_dialog
                $smarty->assign("s_Title",$this->s_Title);
                $smarty->assign("i_ID",$this->i_ID);
                $smarty->assign("frame",false);
+               $smarty->assign("JS",$_SESSION['js']);
                $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']));
                return($smarty->fetch(get_template_path('msg_dialog.tpl')));
        }
@@ -75,7 +76,7 @@ class msg_dialog
 #                      $seen = $_POST['closed_msg_dialogs'];
                }
 
-               if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){
+               if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs']) && count($_SESSION['msg_dialogs'])){
 
                        /* Get frame one */
                        $smarty = get_smarty();
@@ -83,15 +84,20 @@ class msg_dialog
                        $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']));
                        $return = $smarty->fetch(get_template_path('msg_dialog.tpl'));
 
-                       foreach($_SESSION['msg_dialogs'] as $key => $dialog){
+                       if(!$_SESSION['js']){
+                               $dialog = array_pop($_SESSION['msg_dialogs']);
+                               $return.= $dialog->execute();
+                       }else{
+                               foreach($_SESSION['msg_dialogs'] as $key => $dialog){
 
-                               if(preg_match("/".$dialog->get_ID()."/",$seen)){
+                                       if(preg_match("/".$dialog->get_ID()."/",$seen)){
+                                               unset($_SESSION['msg_dialogs'][$key]);
+                                       }else{
+                                               $return.= $dialog->execute();
+                                               $dialog_ids= $dialog->get_ID().",".$dialog_ids;
+                                       }
                                        unset($_SESSION['msg_dialogs'][$key]);
-                               }else{
-                                       $return.= $dialog->execute();
-                                       $dialog_ids= $dialog->get_ID().",".$dialog_ids;
                                }
-                               unset($_SESSION['msg_dialogs'][$key]);
                        }
                        $dialog_ids = preg_replace("/,$/","",$dialog_ids);