Code

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

gosa-plugins/systems/admin/systems/class_servGeneric.inc
gosa-plugins/systems/admin/systems/server.tpl

index df682a60523d8d4279c0ff355acb53dc78d3a51b..83cba2f758cc1651935eff036bbf9baa428f775e 100644 (file)
@@ -54,6 +54,7 @@ class servgeneric extends plugin
   var $currently_installing_warned = FALSE;
 
   var $kerberos_key_service = NULL;
+  var $baseSelector;
 
   var $mapActions   = array("reboot"          => "",
                             "instant_update"  => "softupdate",
@@ -117,6 +118,12 @@ class servgeneric 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);
   }
 
 
@@ -173,38 +180,9 @@ class servgeneric extends plugin
       }
     }
 
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once ){
-        $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()){
-  
-        /* Only accept allowed bases */
-        $tmp = $this->get_allowed_bases();
-        if($tmp[$this->dialog->isSelected()]){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
     /* Fill templating stuff */
     $smarty= get_smarty();
+    $smarty->assign("usePrototype", "true");
 
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translated){
@@ -212,7 +190,7 @@ class servgeneric extends plugin
     }
 
     /* Assign base ACL */
-    $smarty->assign("bases"   , $this->get_allowed_bases());
+    $smarty->assign("base", $this->baseSelector->render());
 
     /* Assign attributes */
     foreach ($this->attributes as $attr){
@@ -220,7 +198,6 @@ class servgeneric extends plugin
     }
 
     $smarty->assign("staticAddress", "");
-    $smarty->assign("base_select", $this->base);
 
     /* Assign status */
     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
@@ -311,16 +288,18 @@ class servgeneric extends plugin
     plugin::save_object();
     $this->netConfigDNS->save_object();
 
-    /* Get base selection */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if($tmp[$_POST['base']]){
-        $this->base = $_POST['base'];
-      }else{
-        $this->base = $base_tmp;
+    /* 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;
       }
     }
 
+
     /* Hanle kerberos host key plugin */
     if(is_object($this->kerberos_key_service)){
       $this->kerberos_key_service->save_object_by_prefix("host/");
index ca6419fc6d98ce32304ef4b4ff5aac39e4ffc793..bb530c414ee761829883f2a5ef690d5a1f242265 100644 (file)
          <td>
           <br>
 {render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place server 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>