Code

Updated plugin creation && locking for all main.incs
[gosa.git] / gosa-plugins / goto / admin / devices / class_deviceManagement.inc
index d82ac62e8d8a6ecc78b4ed4facdfc90e78208659..1acd7d6fa5e0b22a47124e9b4789c925a6411969 100644 (file)
@@ -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";