Code

Updated plugin creation && locking for all main.incs
[gosa.git] / gosa-plugins / goto / admin / devices / class_deviceManagement.inc
index 3b1c6375446b5985662ecda69746389e1ffeacc5..1acd7d6fa5e0b22a47124e9b4789c925a6411969 100644 (file)
@@ -27,7 +27,7 @@ class deviceManagement extends plugin
     $this->ui = get_userinfo();  
 
     /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+    if($this->config->get_cfg_value("copyPaste") == "true"){
       $this->CopyPasteHandler = new CopyPasteHandler($this->config);
     }
 
@@ -149,7 +149,7 @@ class deviceManagement extends plugin
     if (isset($_POST['edit_cancel']) && is_object($this->devicetabs)){
       $this->remove_lock();
       $this->devicetabs= NULL;
-      session::un_set('objectinfo');
+      set_object_info();
     }
 
 
@@ -179,7 +179,7 @@ class deviceManagement extends plugin
           }
           unset ($this->devicetabs);
           $this->devicetabs= NULL;
-          session::un_set('objectinfo');
+          set_object_info();
         }else{
 
           /* Reinitialize tab */
@@ -208,7 +208,7 @@ class deviceManagement extends plugin
       /* Check locking, save current plugin in 'back_plugin', so
          the dialog knows where to return. */
       if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
+        return(gen_locked_message ($user, $this->dn,TRUE));
       }
 
       /* Lock the current entry, so everyone will get the
@@ -219,7 +219,7 @@ class deviceManagement extends plugin
       /* Register devicetabs to trigger edit dialog */
       $this->devicetabs= new devicetabs($this->config,$this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
       $this->devicetabs->set_acl_base($this->dn);
-      session::set('objectinfo',$this->dn);
+      set_object_info($this->dn);
     }
 
 
@@ -255,7 +255,7 @@ class deviceManagement extends plugin
 
           $dns_names = array();
           foreach($this->dns as $dn){
-            $dns_names[] =@LDAP::fix($dn);
+            $dns_names[] =LDAP::fix($dn);
           }
           add_lock ($this->dns, $this->ui->dn);
 
@@ -342,7 +342,7 @@ class deviceManagement extends plugin
         /* Lock the current entry, so nobody will edit it during deletion */
         add_lock ($this->dn, $this->ui->dn);
         $smarty= get_smarty();
-        $smarty->assign("intro", msgPool::deleteInfo(@LDAP::fix($this->dn),_("device")));
+        $smarty->assign("intro", msgPool::deleteInfo(LDAP::fix($this->dn),_("device")));
         $smarty->assign("multiple", false);
         return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
       } else {
@@ -395,7 +395,7 @@ class deviceManagement extends plugin
     /* Delete device canceled? */
     if (isset($_POST['delete_cancel'])){
       $this->remove_lock();
-      session::un_set('objectinfo');
+      set_object_info();
     }
 
     /* Show tab dialog if object is present */
@@ -403,7 +403,12 @@ class deviceManagement extends plugin
       $display= $this->devicetabs->execute();
 
       /* Don't show buttons if tab dialog requests this */
-      if (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
+
+      if(($this->devicetabs instanceOf tabs || $this->devicetabs instanceOf plugin) && $this->devicetabs->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
         $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
         $display.= "&nbsp;\n";
@@ -449,7 +454,7 @@ class deviceManagement extends plugin
   /* Return departments, that will be included within snapshot detection */
   function get_used_snapshot_bases()
   {
-    return(array(get_ou('deviceou').$this->DivListDevices->selectedBase));
+    return(array(get_ou('deviceRDN').$this->DivListDevices->selectedBase));
   }
 
   function copyPasteHandling_from_queue($s_action,$s_entry)
@@ -535,11 +540,11 @@ class deviceManagement extends plugin
     if($SubSearch){
       $Flags    |= GL_SUBSEARCH;
     }else{
-      $base = get_ou('deviceou').$base;
+      $base = get_ou('deviceRDN').$base;
     }
 
     /* Get results and create index */
-    $res= get_sub_list($Filter,"devices",get_ou('deviceou'), $base, array("cn","gotoHotplugDevice","description","dn","objectClass"), $Flags);
+    $res= get_sub_list($Filter,"devices",get_ou('deviceRDN'), $base, array("cn","gotoHotplugDevice","description","dn","objectClass"), $Flags);
     $tmp2 = array();
     foreach ($res as $val){
       if (!isset($val['description']) && isset($val['gotoHotplugDevice'][0])) {