Code

Converted base selector
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 15:25:28 +0000 (15:25 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 15:25:28 +0000 (15:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15457 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/devices/class_deviceGeneric.inc
gosa-plugins/goto/admin/devices/deviceGeneric.tpl

index 1ceff18aead292a53e171c80c9989a57b608808a..b4a8ebe5a6e794693c5c6f43922722ea244d8573 100644 (file)
@@ -14,6 +14,7 @@ class deviceGeneric extends plugin
   public $base          = "";  
   public $types;
   public $type;
+  public $baseSelector;
 
   public $attributes      = array("cn","description","devID","serial","vendor", "type");
   public $objectclasses   = array("top","gotoDevice");
@@ -59,14 +60,20 @@ class deviceGeneric extends plugin
     }
     $this->orig_base = $this->base;
     $this->orig_dn   = $this->dn;
+
+    /* 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);
   }
 
 
   public function execute()
   {
     $smarty = get_smarty();
-    $smarty->assign("base",$this->base);
-    $smarty->assign("bases",$this->get_allowed_bases());
+    $smarty->assign("usePrototype", "true");
+    $smarty->assign("base", $this->baseSelector->render());
     foreach($this->attributes as $attr){
       $smarty->assign($attr,$this->$attr);
     }
@@ -129,15 +136,19 @@ class deviceGeneric extends plugin
 
   public function save_object()
   {
+    /* 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;
+      }
+    }
+
     if(isset($_POST['deviceGeneric_posted'])){
       plugin::save_object();
-  
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[get_post("base")])){
-          $this->base = get_post("base");
-        }
-      }
     }
   }
 
index 294dddbe894022c8112e7426e7026848a0000880..523b81a2c76c29ff0fde8c4a910e54885a03f078 100644 (file)
@@ -10,9 +10,7 @@
             </td>
             <td>
 {render acl=$baseACL}
-                               <select name="base">
-                                       {html_options options=$bases selected=$base}
-                               </select>
+              {$base}
 {/render}
             </td>
         </tr>