Code

Updated base selector
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 17:52:36 +0000 (17:52 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 17:52:36 +0000 (17:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15480 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc
gosa-plugins/goto/admin/systems/goto/terminal.tpl

index ca80b1a7f842bf7005da9178ed995eb8f807dab2..c1af91cae6cf0ab30ec3c5b09cd73188f35ce75c 100644 (file)
@@ -37,6 +37,7 @@ class termgeneric extends plugin
 
   /* Plugin side filled */
   var $modes= array();
+  var $baseSelector;
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
@@ -144,6 +145,12 @@ class termgeneric extends plugin
     $this->orig_dn= $this->dn;
     $this->orig_cn= $this->cn;
     $this->orig_base= $this->base;
+
+    /* Instanciate base selector */
+    $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
+    $this->baseSelector->setSubmitButton(false);
+    $this->baseSelector->setHeight(300);
+    $this->baseSelector->update(true);
   }
 
   function set_acl_base($base)
@@ -196,36 +203,6 @@ class termgeneric extends plugin
 
     }
 
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $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()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
     /* Do we represent a valid terminal? */
     if (!$this->is_account && $this->parent === NULL){
       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
@@ -247,6 +224,7 @@ class termgeneric extends plugin
 
     /* Fill templating stuff */
     $smarty= get_smarty();
+    $smarty->assign("usePrototype", "true");
     
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation){
@@ -257,8 +235,6 @@ class termgeneric extends plugin
     $smarty->assign("description", $this->description);
     $smarty->assign("staticAddress", "");
 
-    $smarty->assign("bases", $this->get_allowed_bases());
-
     /* tell smarty the inherit checkbox state */
     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
 
@@ -317,9 +293,10 @@ class termgeneric extends plugin
     $smarty->assign("fai_activated",$this->fai_activated);
 
     /* Variables */
-    foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
+    foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
       $smarty->assign($val."_select", $this->$val);
     }
+    $smarty->assign("base", $this->baseSelector->render());
 
     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
 
@@ -396,11 +373,14 @@ class termgeneric extends plugin
     plugin::save_object();
     $this->base = $base_tmp;
 
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
+    /* Refresh base */
+    if ($this->acl_is_moveable($this->base)){
+      if (!$this->baseSelector->update()) {
+        msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+      }
+      if ($this->base != $this->baseSelector->getBase()) {
+        $this->base= $this->baseSelector->getBase();
+        $this->is_modified= TRUE;
       }
     }
     
index e43e5d0fbf4fefdb5a523acd541f333635ba8be2..d5e6e81e2a0d08d0560479a66df9a867c33a2ed3 100644 (file)
      <td>
 
 {render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place terminal in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
-        <input type="image" name="chooseBase" src="images/lists/folder.png" class="center" title="{t}Select a base{/t}">
+       {$base}
 {/render}
      </td>
     </tr>