Code

Added read only option - 2/3
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 1 Dec 2008 13:33:22 +0000 (13:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 1 Dec 2008 13:33:22 +0000 (13:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13099 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/devices/class_deviceManagement.inc
gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc
gosa-plugins/systems/admin/systems/class_systemManagement.inc
gosa-plugins/systems/admin/systems/tabs_server.inc

index 6635ee07189251e8d3a722e6fc15dc8335123013..634d863c9d3fb7e2e7d8d488c62901703b37b32e 100644 (file)
@@ -395,7 +395,7 @@ class ogroupManagement 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
@@ -471,7 +471,11 @@ class ogroupManagement extends plugin
       $display= $this->ogroup->execute();
 
       /* Don't show buttons if tab dialog requests this */
-      if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
+      if(($this->ogroup instanceOf tabs || $this->ogroup instanceOf plugin) && $this->ogroup->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->ogroup->by_object[$this->ogroup->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";
@@ -709,8 +713,7 @@ class ogroupManagement extends plugin
   {
     if (isset($this->apptabs->dn)){
       del_lock ($this->apptabs->dn);
-    }
-    if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+    }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
       del_lock($this->dn);
     }
     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
index 78ec8dede967db3de03095669ac666ad1e540fdb..a8959a121096714a9bc8d63082bb03c41e4d8b1d 100644 (file)
@@ -308,7 +308,7 @@ class applicationManagement 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
@@ -511,7 +511,11 @@ class applicationManagement extends plugin
       if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
 
-        if(isset($this->apptabs->FAIstate) && !preg_match("/freeze/i",$this->apptabs->FAIstate)){
+        if(($this->apptabs instanceOf tabs || $this->apptabs instanceOf plugin) && $this->apptabs->read_only == TRUE){
+          $display.= "<p style=\"text-align:right\">
+            <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+            </p>";
+        }elseif(isset($this->apptabs->FAIstate) && !preg_match("/freeze/i",$this->apptabs->FAIstate)){
           $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
           $display.= "&nbsp;\n";
           if ($this->dn != "new"){
@@ -716,8 +720,7 @@ class applicationManagement extends plugin
   {
     if (isset($this->apptabs->dn)){
       del_lock ($this->apptabs->dn);
-    }
-    if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+    }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
       del_lock($this->dn);
     }
     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
index e8735a43571e9cb5f988053d31ed549565b2043a..7f2e02171774b5512d865770bea1a5deb55cc8de 100644 (file)
@@ -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
@@ -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";
index d41c7b95879bf22ab114c41c74d937dbe16dbb77..397e0bee188e999fb033a9e293039d898f97d67c 100644 (file)
@@ -317,7 +317,7 @@ class mimetypeManagement 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
@@ -517,7 +517,12 @@ class mimetypeManagement extends plugin
       $display= $this->mimetabs->execute();
 
       /* Don't show buttons if tab dialog requests this */
-      if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
+
+      if(($this->mimetabs instanceOf tabs || $this->mimetabs instanceOf plugin) && $this->mimetabs->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
 
         if(isset($this->mimetabs->FAIstate) && !preg_match("/freeze/i",$this->mimetabs->FAIstate)){
@@ -727,8 +732,7 @@ class mimetypeManagement extends plugin
   {
     if (isset($this->mimetabs->dn)){
       del_lock ($this->mimetabs->dn);
-    }
-    if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+    }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
       del_lock($this->dn);
     }
     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
index 40d58f000f3e72d06a2c9a62b782e56288d3f624..17b1667fef80d3cf5f3da6f4b489f818289b56cc 100644 (file)
@@ -525,7 +525,7 @@ class systems 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));
       }
 
       /* Find out more about the object type */
@@ -540,12 +540,14 @@ class systems extends plugin
         if(!class_available("ArpNewDeviceTabs")){
           msg_dialog::display(_("Error"), msgPool::class_not_found("ArpNewDevice"), ERROR_DIALOG);
         }else{
+          add_lock ($this->dn, $this->ui->dn);
           $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
         }
       }elseif($type == "NewDevice"){
         if(!class_available("SelectDeviceType")){
           msg_dialog::display(_("Error"), msgPool::class_not_found("SelectDeviceType"), ERROR_DIALOG);
         }else{
+          add_lock ($this->dn, $this->ui->dn);
           $this->system_activation_object= array($this->dn);
           $this->systab = new SelectDeviceType($this->config,$this->dn) ;
 
@@ -560,10 +562,10 @@ class systems extends plugin
         if(!class_available($tabclass)){
           msg_dialog::display(_("Error"), msgPool::class_not_found($tabclass), ERROR_DIALOG);
         }else{
+          add_lock ($this->dn, $this->ui->dn);
           $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
           $this->systab->set_acl_base($this->dn);
           session::set('objectinfo',$this->dn);
-          add_lock ($this->dn, $this->ui->dn);
         }
       }else{ 
         msg_dialog::display(_("Error"), _("Editing this type of object is not supported yet!"), ERROR_DIALOG);
@@ -1056,7 +1058,11 @@ class systems extends plugin
         $dialog = TRUE;
       }
 
-      if (!$dialog){
+      if(($this->systab instanceOf tabs || $this->systab instanceOf plugin) && $this->systab->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$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";
@@ -1427,8 +1433,7 @@ class systems extends plugin
   {
     if (isset($this->systab->dn)){
       del_lock ($this->systab->dn);
-    }
-    if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+    }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
       del_lock($this->dn);
     }
     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
index a2f37eb50779665f6898b3c4ab5c76f52f2eed51..39c030953e4a79ce799e8324b8c5019c19a2298d 100644 (file)
@@ -48,6 +48,7 @@ class servtabs extends tabs
 
       $this->by_object[$tab['CLASS']]->parent= &$this;
       $this->by_object[$tab['CLASS']]->set_acl_category($category);
+      $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
 
       /* Initialize current */
       if ($this->current == ""){