Code

Enabled base selection for devices
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:32:33 +0000 (13:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:32:33 +0000 (13:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19757 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/Device.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc

index d4a3e45e900c05e9b2662bbb4bc79363c34583da..a722aa08ef944a1913d710c1b5b6731a2cfe654b 100644 (file)
                         {/render}
                     </td>
                 </tr>
+                <tr>
+                    <td>
+                        <div style="height:10px;"> </div>
+                        {t}Base{/t}
+                    </td>
+                    <td>
+                        <div style="height:10px;"> </div>
+                        {render acl=$baseACL}
+                            {$base}
+                        {/render}
+                    </td>
+                </tr>
             </table>
             <hr>
             <table>
index a6a8a42fa46e7bd40fb12855a792fcbc467c0d31..b333c5a42de42f23a0a7529b88716bdd1a7d6151 100644 (file)
@@ -42,6 +42,12 @@ class Device extends plugin
         plugin::plugin($config, $dn);
         $this->base = $this->config->current['BASE'];
         $this->orig_dn = $this->dn;
+
+        // Prepare the base selector
+        $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
+        $this->baseSelector->setSubmitButton(false);
+        $this->baseSelector->setHeight(300);
+        $this->baseSelector->update(true);
     }
 
     
@@ -77,7 +83,9 @@ class Device extends plugin
         // Assign just user names instead of the complete dn.
         $smarty->assign("owner_name", $this->getUserName($this->owner));
         $smarty->assign("manager_name", $this->getUserName($this->manager));
+        $smarty->assign("base", $this->baseSelector->render());
 
+        // Assign attribute values 
         foreach($this->attributes as $attr){
             $smarty->assign($attr, $this->$attr);
         }
@@ -193,6 +201,18 @@ class Device extends plugin
       
         // Regenerate a new uuid 
         if(isset($_POST['reloadUUID']))  $this->deviceUUID = $this->genFakeUuid();
+
+        // Update the 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;
+            }
+        }
+
     }
 
 
@@ -253,6 +273,7 @@ class Device extends plugin
                             "description"  => _("Device"),
                             "objectClass"  => "Device")),
                     "plProvidedAcls" => array(
+                        "base" => _("Base"),
                         "cn" => _("Name"),
                         "serialNumber" => _("Serial number"),
                         "seeAlso" => _("See also"),