Code

A
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 07:42:38 +0000 (07:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 07:42:38 +0000 (07:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2740 594d385d-05f5-0310-b6e9-bd551577e9d8

ihtml/themes/altlinux/MultiSelectWindow.tpl [new file with mode: 0644]
ihtml/themes/default/MultiSelectWindow.tpl [new file with mode: 0644]
include/class_MultiSelectWindow.inc [new file with mode: 0644]
plugins/admin/systems/class_servDHCP.inc
plugins/personal/generic/class_user.inc
plugins/personal/generic/generic.tpl

diff --git a/ihtml/themes/altlinux/MultiSelectWindow.tpl b/ihtml/themes/altlinux/MultiSelectWindow.tpl
new file mode 100644 (file)
index 0000000..d03f4e3
--- /dev/null
@@ -0,0 +1,70 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+       <tr>
+               <td style="vertical-align:top; width:50%;">
+                       <div class="contentboxh">
+                               <p class="contentboxh">
+                                       {$Summary} 
+                               </p>
+                       </div>
+                       <div class="contentboxb">
+                       {$Header}
+                       </div>
+                       <div style='height:4px;'>
+                       </div>
+                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+                       {$DivList}
+                       <input type=hidden name="edit_helper">
+                       </div>
+               </td>
+               <td style="vertical-align:top;">
+                       <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:22px;">
+                       <p class="contentboxh">
+                                       <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
+                               </p>
+                       </div>
+                       <div class="contentboxb" style="padding:5px;">
+                               {$Information}
+                       </div>
+                       <br>
+                       <div class="contentboxh" style="height:22px;">
+                       <p class="contentboxh">
+                                       <img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}
+                               </p>
+                       </div>
+                       <div class="contentboxb">
+                               {if $Display_alphabet}
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+                                       {$alphabet}
+                               </table>
+                               {/if}
+                               { if $CheckBoxes != ""}
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+                                       <tr>
+                                               <td>
+                                                       {$CheckBoxes}
+                                               </td>
+                                       </tr>
+                               </table>   
+                               {/if}
+                       {$regexes}
+                       {$apply}
+                       </div>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;
+</p>
+<div style="text-align:right;" align="right">
+       <p>
+               {if $Display_Save}
+                       <input type="submit" name="SaveMultiSelectWindow" value="{$SaveButtonString}"> 
+               {/if}
+               {if $Display_Close}
+                       <input type="submit" name="CloseMultiSelectWindow" value="{$CloseButtonString}"> 
+               {/if}
+       </p>
+</div>
+
+<input type="hidden" name="ignore">
+<input type="hidden" name="MultiSelectWindow" value="1">
+
diff --git a/ihtml/themes/default/MultiSelectWindow.tpl b/ihtml/themes/default/MultiSelectWindow.tpl
new file mode 100644 (file)
index 0000000..d03f4e3
--- /dev/null
@@ -0,0 +1,70 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+       <tr>
+               <td style="vertical-align:top; width:50%;">
+                       <div class="contentboxh">
+                               <p class="contentboxh">
+                                       {$Summary} 
+                               </p>
+                       </div>
+                       <div class="contentboxb">
+                       {$Header}
+                       </div>
+                       <div style='height:4px;'>
+                       </div>
+                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+                       {$DivList}
+                       <input type=hidden name="edit_helper">
+                       </div>
+               </td>
+               <td style="vertical-align:top;">
+                       <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:22px;">
+                       <p class="contentboxh">
+                                       <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
+                               </p>
+                       </div>
+                       <div class="contentboxb" style="padding:5px;">
+                               {$Information}
+                       </div>
+                       <br>
+                       <div class="contentboxh" style="height:22px;">
+                       <p class="contentboxh">
+                                       <img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}
+                               </p>
+                       </div>
+                       <div class="contentboxb">
+                               {if $Display_alphabet}
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+                                       {$alphabet}
+                               </table>
+                               {/if}
+                               { if $CheckBoxes != ""}
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+                                       <tr>
+                                               <td>
+                                                       {$CheckBoxes}
+                                               </td>
+                                       </tr>
+                               </table>   
+                               {/if}
+                       {$regexes}
+                       {$apply}
+                       </div>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;
+</p>
+<div style="text-align:right;" align="right">
+       <p>
+               {if $Display_Save}
+                       <input type="submit" name="SaveMultiSelectWindow" value="{$SaveButtonString}"> 
+               {/if}
+               {if $Display_Close}
+                       <input type="submit" name="CloseMultiSelectWindow" value="{$CloseButtonString}"> 
+               {/if}
+       </p>
+</div>
+
+<input type="hidden" name="ignore">
+<input type="hidden" name="MultiSelectWindow" value="1">
+
diff --git a/include/class_MultiSelectWindow.inc b/include/class_MultiSelectWindow.inc
new file mode 100644 (file)
index 0000000..f1cdb16
--- /dev/null
@@ -0,0 +1,253 @@
+<?php
+
+class MultiSelectWindow{
+
+       var $bool_DisplayAlpahabet      = false;
+       var $bool_DisplayCloseButton= true;     
+       var $bool_DisplaySaveButton = true;     
+
+       var $SaveButtonString           = "";
+       var $CloseButtonString          = "";
+       var $string_Title                       = "";
+       var $string_ListHeader          = "";
+       var $string_Summary                     = "";
+       var $string_Information         = "";
+
+       var $array_Header                       = array();
+       var $array_Elements                     = array();      
+       var $array_Checkboxes           = array();      
+       var $array_Regexes                      = array();      
+
+       var $config                                     = "";
+
+       var $is_closed                          = false;
+       var $is_saved                           = false;
+
+       function ClearElementsList()
+       {
+               $this->array_Elements = array();
+       }
+
+       function AddRegex($name,$string,$value,$conn)
+       {
+               $arr = array();
+               $arr['name']            = $name;
+               $arr['string']          = $string;
+               $arr['value']           = $value;       
+               $arr['connAlpha']       = $conn;                // Connect with alphabet select 
+               $this->array_Regexes[] = $arr;
+       }
+
+       function MultiSelectWindow($config){
+               $this->config = $config;
+               $this->SaveButtonString         = _("Save");
+               $this->CloseButtonString        = _("Close");
+       }
+
+       function SetTitle($str){
+               $this->string_Title = $str;
+       }
+
+       function SetListHeader($str){
+               $this->string_ListHeader = $str;
+       }
+
+       function SetSummary($str){
+               $this->string_Summary = $str;
+       }
+
+       function SetSaveButtonString($str){
+               $this->SaveButtonString = $str;
+       }
+
+       function SetCloseButtonString($str){
+               $this->CloseButtonString = $str;
+       }
+
+       function SetInformation($str){
+               $this->string_Information = $str;
+       }
+
+       function EnableAplhabet($bool){
+               $this->bool_DisplayAlpahabet = $bool;
+       }
+
+       function AddHeader($arr){
+               $this->array_Header[] = $arr;
+       }
+
+       function AddElement($arr){
+               $this->array_Elements[] = $arr;
+       }
+
+       function AddCheckBox($name,$value,$string,$default){
+               $arr = array();
+               $arr['name']    = $name;
+               $arr['string']  = $string;
+               $arr['value']   = $value;
+               $arr['default'] = $default;
+               $this->array_Checkboxes[] = $arr;
+       }
+
+       function isClosed()
+       {
+               return($this->is_closed);
+       }
+
+       function EnableCloseButton($bool)
+       {
+               $this->bool_DisplayCloseButton = $bool;
+       }
+
+       function EnableSaveButton ($bool)
+       {
+               $this->bool_DisplaySaveButton = $bool;
+       }
+
+       function Draw()
+       {
+               $smarty = get_smarty();
+
+               $divlist = new divlist($this->string_Title);
+               $divlist->SetSummary($this->string_Summary);
+               $divlist->SetEntriesPerPage(0); // 0 for scrollable list 
+
+               /* set Header informations 
+                */
+               $header = array();
+               foreach($this->array_Header as $head){
+                       $header[] = $head;
+               }
+               $divlist->SetHeader($header);
+
+               /* set Entries 
+                */
+               $elements = array();
+               foreach($this->array_Elements as $element){
+                       $divlist->AddEntry($element);
+               }
+
+               /* Create checkboxes fields 
+                */
+               $boxes = "";
+               $boxClick = " onClick='document.mainform.submit();' ";
+               foreach($this->array_Checkboxes as $box){
+                       if($box['default'] == true){
+                               $boxes .="<input type='checkbox' name='".$box['name']."' value='".$box['value']."' checked ".$boxClick.">&nbsp;".$box['string']."<br>";
+                       }else{
+                               $boxes .="<input type='checkbox' name='".$box['name']."' value='".$box['value']."'".$boxClick.";>&nbsp;".$box['string']."<br>";
+                       }
+               }
+               $smarty->assign("CheckBoxes", $boxes);
+
+               /* Assign regex fields 
+                */
+               $regexes = "";
+               foreach($this->array_Regexes as $regex){
+                       $regexes.="<table summary=\"\" style=\"width:100%;border-top:1px solid #B0B0B0;\">
+                               <tr>
+                               <td>
+                               <label for=\"".$regex['name']."\">
+                               <img alt=\"".$regex['string']."\" src=\"images/search.png\" align=middle>
+                               </label>
+                               </td>
+                               <td width=\"99%\">
+                               <input type='text' style='width:99%' name='".$regex['name']."' maxlength='20'
+                               value='".$regex['value']."' title=\"".$regex['string']."\"> 
+                               </td>
+                               </tr>
+                               </table>";
+               }
+               $smarty->assign("regexes"                       , $regexes );
+               
+               /* Assign alphabet and display it 
+         */    
+               $smarty->assign("Display_alphabet",     $this->bool_DisplayAlpahabet);
+               $smarty->assign("alphabet",             generate_alphabet());
+
+               $smarty->assign("Header"                        , $this->string_ListHeader );
+               $smarty->assign("Summary"                       , $this->string_Summary);
+               $smarty->assign("Title"                         , $this->string_Title);
+               $smarty->assign("Information"           , $this->string_Information);
+
+               $smarty->assign("DivList"                       , $divlist->DrawList());
+
+               $smarty->assign("search_image",         get_template_path('images/search.png'));
+               $smarty->assign("searchu_image",        get_template_path('images/search_user.png'));
+               $smarty->assign("tree_image",           get_template_path('images/tree.png'));
+               $smarty->assign("infoimage",            get_template_path('images/info_small.png'));
+               $smarty->assign("launchimage",          get_template_path('images/rocket.png'));
+               $smarty->assign("apply",                        apply_filter());
+
+               /* Button handling */
+               $smarty->assign("SaveButtonString" ,$this->SaveButtonString);
+               $smarty->assign("CloseButtonString",$this->CloseButtonString);
+       
+               $smarty->assign("Display_Close",        $this->bool_DisplayCloseButton);
+               $smarty->assign("Display_Save" ,        $this->bool_DisplaySaveButton);
+
+               $display = $smarty->fetch(get_template_path("MultiSelectWindow.tpl"));
+               return($display);
+       }
+
+       function Close()
+       {
+               $this->is_closed = true;
+       }
+
+       function Save()
+       {
+               $this->is_saved = true;
+       }
+
+       function save_object()
+       {
+               if(isset($_POST['MultiSelectWindow'])){
+
+                       /* Check posts from checkboxes 
+             */
+                       foreach($this->array_Checkboxes as $key => $box){
+                               if(isset($_POST[$box['name']])){
+                                       $this->array_Checkboxes[$key]['default'] = true;
+                                       $this->$box['name'] = true;
+                               }else{
+                                       $this->array_Checkboxes[$key]['default'] = false;
+                                       $this->$box['name'] = false;
+                               }
+                       }
+
+                       /* Check regex posts */
+                       foreach($this->array_Regexes as $key => $box){
+                               $this->array_Regexes[$key]['value'] = $_POST[$box['name']];
+                               $this->$box['name'] = $_POST[$box['name']];
+                       }
+
+                       /* call close/save if buttons are pressed */
+                       if(isset($_POST['CloseMultiSelectWindow'])){
+                               $this->Close();
+                       }
+                       
+                       if(isset($_POST['SaveMultiSelectWindow'])){
+                               $this->Save();
+                       }
+               }
+
+               /* check for alphabet selection
+           Check which regexes are connected to the alphabet 
+         */    
+               if(isset($_GET['search'])){
+                       foreach($this->array_Regexes as $key => $box){
+                               /* check if this regex is connected to the alphabet selection */
+                               if(($box['connAlpha'])&&(isset($_GET['search']))){
+                                       $val =  $_GET['search']."*";
+                                       $val = preg_replace("/\*\**/","*",$val);
+                                       $this->array_Regexes[$key]['value'] = $val;
+                                       $this->$box['name'] = $val;
+                               }
+                       }
+               }
+
+       }
+}
+
+?>
index 9f4a6e867c19a278a84431ab82d4fb4b3ad976da..4ab97ed61c85d677d45f5c42ce42deb4614971d1 100644 (file)
@@ -12,34 +12,29 @@ class servdhcp extends plugin
   var $attributes= array();
   var $objectclasses= array("whatever");
 
+  var $dialog ;
+
   function servdhcp ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
+    $this->dialog = new baseSelectDialog($config);
   }
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
-
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
 
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Show tab dialog headers */
-    if ($this->is_account){
-      $display= $this->show_header(_("Remove DHCP service"),
-          _("This server has DHCP features enabled. You can disable them by clicking below."));
-    } else {
-      $display= $this->show_header(_("Add DHCP service"),
-          _("This server has DHCP features disabled. You can enable them by clicking below."));
-      return ($display);
+    $this->dialog->save_object(); 
+    if($this->dialog->isSelected()){
+      $base = $this->dialog->isSelected();
+    }  
+    if($this->dialog->isClosed()){
+      echo "blub";
     }
+    echo $base;
+    return($this->dialog->execute());
 
     $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
     return($display);
index bcbd2d14c63dc078d8668492909404a18d311ec7..7e3d3f45c8d0f05f711246cd27130282fe1cf772 100644 (file)
@@ -76,6 +76,8 @@ class user extends plugin
   var $role= "";
   var $publicVisible= "";
 
+  var $dialog;
+
   /* variables to trigger password changes */
   var $pw_storage= "crypt";
   var $last_pw_storage= "unset";
@@ -206,8 +208,8 @@ class user extends plugin
   /* execute generates the html output for this node */
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     $smarty= get_smarty();
 
@@ -269,6 +271,27 @@ class user extends plugin
       return;
     }
 
+    /* Base select dialog */
+    if(isset($_POST['chooseBase'])){
+      $this->dialog = new baseSelectDialog($this->config);
+      $this->dialog->setCurrentBase($this->base);
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+   
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        $this->base = $this->dialog->isSelected();
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
     /* Want picture edit dialog? */
     if (isset($_POST['edit_picture'])){
       /* Save values for later recovery, in case some presses
@@ -442,7 +465,7 @@ class user extends plugin
     /* Show us the edit screen */
     @$smarty->assign("bases", $this->allowedBasesToMoveTo());
 #  $smarty->assign("bases", $this->config->idepartments);
-    $smarty->assign("base_select", $this->base);
+    $smarty->assign("base_select",      trim($this->config->idepartments[$this->base]));
     $smarty->assign("selectmode",       chkacl($this->acl, "create"));
     $smarty->assign("certificatesACL",  chkacl($this->acl, "certificates"));
     $smarty->assign("jpegPhotoACL",     chkacl($this->acl, "jpegPhoto"));
index 81fd56016a5fcec407dd3aa7a71503e181992ce9..d8bbab58fe9c6ebccce1547090c7fe0f53861303 100644 (file)
      </td>
      <td>
       <div style="height:10px;"></div>
+               <!--
       <select id="base" size="1" name="base" {$selectmode} title="{t}Choose subtree to place user in{/t}">
        {html_options options=$bases selected=$base_select}
       </select>
+               -->
+          {$base_select}
+          <input type="submit" name="chooseBase" value="{t}Edit{/t}">
      </td>
     </tr>
    </table>