Code

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

gosa-plugins/systems/admin/systems/class_componentGeneric.inc
gosa-plugins/systems/admin/systems/component.tpl

index b3ff77e38c4df28568bca1ea8d2d5cb9496def74..35ed070d6fafe8f362690faab43c9bec26605dcf 100644 (file)
@@ -39,6 +39,7 @@ class componentGeneric extends plugin
   var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
   var $netConfigDNS;
   var $view_logged  = FALSE;
+  var $baseSelector;
 
   function componentGeneric (&$config, $dn= NULL, $parent= NULL)
   {
@@ -58,6 +59,12 @@ class componentGeneric extends plugin
 
     $this->orig_base = $this->base;
     $this->orig_cn = $this->cn;
+
+    /* 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);
   }
 
 
@@ -111,7 +118,7 @@ class componentGeneric extends plugin
 
     /* Fill templating stuff */
     $smarty= get_smarty();
-    $smarty->assign("bases", $this->config->idepartments);
+    $smarty->assign("usePrototype", "true");
 
     /* Set acls */
     $tmp = $this->plInfo();
@@ -119,13 +126,11 @@ class componentGeneric extends plugin
       $smarty->assign($name."ACL",$this->getacl($name));
     }
 
-    $smarty->assign("bases", $this->get_allowed_bases());
-
     /* Assign attributes */
     foreach ($this->attributes as $attr){
       $smarty->assign("$attr", $this->$attr);
     }
-    $smarty->assign("base_select", $this->base);
+    $smarty->assign("base", $this->baseSelector->render());
 
     /* Show main page */
     $str = $this->netConfigDNS->execute();
@@ -186,13 +191,17 @@ class componentGeneric extends plugin
 
     $this->netConfigDNS->save_object();
 
-    /* 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 cc84e5335e96a326d313b867c36feec3051d8b18..8cb5154527d505be64be1bd1debd8f79ac2d9ee0 100644 (file)
          <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
          <td>
 {render acl=$baseACL}
-           <select id="base" size="1" name="base" title="{t}Choose subtree to place component in{/t}">
-            {html_options options=$bases selected=$base_select}
-           </select>
+            {$base}
 {/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}">
-{/render}
-
           </td>
          </tr>
        </table>