Code

Added read_only option 3/3
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 1 Dec 2008 14:07:48 +0000 (14:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 1 Dec 2008 14:07:48 +0000 (14:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13100 594d385d-05f5-0310-b6e9-bd551577e9d8

14 files changed:
gosa-core/include/functions.inc
gosa-core/plugins/admin/acl/class_aclManagement.inc
gosa-core/plugins/admin/acl/tabs_acl.inc
gosa-core/plugins/admin/acl/tabs_acl_role.inc
gosa-core/plugins/admin/departments/class_departmentManagement.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc
gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc
gosa-plugins/gofax/gofax/blocklists/generic.tpl
gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc
gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc
gosa-plugins/goto/admin/systems/goto/tabs_printers.inc
gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc
gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc

index e022dcd4e2c42a6102aaed4add8e867e31203242..701ac804e4716445c39f5959c65f3225375453ed 100644 (file)
@@ -678,13 +678,10 @@ function del_lock ($object)
     $cache = &session::get("LOCK_CACHE");
     if(isset($cache['READ_ONLY'][$object])){
       unset($cache['READ_ONLY'][$object]);
-      //echo "Remove ".$object."<b> Skipped!</b>";
       return;
     }
   }
 
-  //echo "Remove ".$object."<b> Done!</b>";
-
   /* Check for existance and remove the entry */
   $ldap= $config->get_ldap_link();
   $ldap->cd ($config->get_cfg_value("config"));
index 40711f61c05d3f569b0136e1104d73930c75cd06..430382fbf1c1e9db8e6e8440efd940bdcf8a273f 100644 (file)
@@ -188,7 +188,7 @@ class aclManagement extends plugin
         /* Check locking, save current plugin in 'back_plugin', so
            the dialog knows where to return. */
         if (($acl= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($acl, $this->dn));
+          return(gen_locked_message ($acl, $this->dn,TRUE));
         }
 
         /* Lock the current entry, so everyone will get the above dialog */
@@ -641,8 +641,9 @@ class aclManagement extends plugin
     /* Remove acl lock if a DN is marked as "currently edited" */
     if (isset($this->acltabs->dn)){
       del_lock ($this->acltabs->dn);
+    }else{
+      del_lock ($this->dn);
     }
-    del_lock ($this->dn);
     del_lock ($this->dns);
   }
 
index 4a652a849260ecef7bba52709d68df68f5ca51de..8f883795b2e2b9678b4ede9c294ae38f9a7645aa 100644 (file)
@@ -54,6 +54,7 @@ class acltab extends tabs
 
       $this->by_object[$tab['CLASS']]->parent= &$this;
       $this->by_object[$tab['CLASS']]->set_acl_category("acl");
+      $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
 
       /* Initialize current */
       if ($this->current == ""){
@@ -76,7 +77,11 @@ class acltab extends tabs
   function execute()
   {
     $display= tabs::execute();
-    if(!$this->by_object['acl']->dialog){
+    if($this->read_only){
+      $display.= "<p style=\"text-align:right\">\n";
+      $display.= "  <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+      $display.= "</p>";
+    }elseif(!$this->by_object['acl']->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 4b8a211a2cf10a51def2a9475d3b1614cd41fefa..06303492f19189b7ffe1986afcec5f61e102fa80 100644 (file)
@@ -62,7 +62,11 @@ class aclroletab extends tabs
   function execute()
   {
     $display= tabs::execute();
-    if(!$this->by_object['aclrole']->dialog){
+    if($this->read_only){
+      $display.= "<p style=\"text-align:right\">\n";
+      $display.= "  <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+      $display.= "</p>";
+    }elseif(!$this->by_object['aclrole']->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 7637f1c38e036cca01def98e5718a382c5cc0c51..96d0ec35353ec07806fea73388d8cc1535434178 100644 (file)
@@ -166,7 +166,7 @@ class departmentManagement extends plugin
       }else{
 
         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  above dialog */
@@ -381,7 +381,11 @@ class departmentManagement extends plugin
 
       /* Show main page (tabs) */
       $display= $this->deptabs->execute();
-      if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
+      if(($this->deptabs instanceOf tabs || $this->deptabs instanceOf plugin) && $this->deptabs->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
         $display.= "<input type=submit name=\"edit_finish\" value=\"".msgPool::okButton()."\">\n";
         $display.= "&nbsp;\n";
@@ -516,9 +520,6 @@ class departmentManagement extends plugin
 
   function remove_lock()
   {
-    if (isset($this->dn)){
-      del_lock ($this->dn);
-    }
     if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
       del_lock($this->dn);
     }
index e5f1bd8c6a3287afc75c055bbf8754e2bed563e2..1e4155283131d0880a24d94f4257e4b49f980ed2 100644 (file)
@@ -509,7 +509,7 @@ class faiManagement 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));
                        }
                        add_lock ($this->dn, $this->ui->dn);
 
@@ -1022,7 +1022,11 @@ class faiManagement extends plugin
 
         $obj = $this->dialog->by_object[$this->dialog->current];
 
-        if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
+        if(($this->dialog instanceOf tabs || $this->dialog instanceOf plugin) && $this->dialog->read_only == TRUE){
+          $display.= "<p style=\"text-align:right\">
+            <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+            </p>";
+        }elseif((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
 
           $display.= "<p style=\"text-align:right\">\n";
           if(!$this->no_save){
index 5c23583e711d995cb1d4c7062fbf9502a1f31c10..865e7c7fe71571663bfb06f1890692348a31dad4 100644 (file)
@@ -164,6 +164,7 @@ class blocklistGeneric extends plugin
     $smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
     $smarty->assign("type", $this->type);
     $smarty->assign("dn", $this->dn);
+    $smarty->assign("read_only",$this->read_only);
     return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
   }
 
index 1346ab95c728dc15547a0c9034e5e74eb05e9b32..c2e5b3f1d57a70fe4c7c724f9739d21e1dd6b467 100644 (file)
@@ -185,7 +185,7 @@ class blocklist extends plugin
       $this->dn=$this->blocklists[$s_entry]['dn'];
 
       if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message($user, $this->dn));
+        return(gen_locked_message($user, $this->dn,TRUE));
       }else{
         add_lock ($this->dn, $this->ui->dn);
       }
index 05056c67a3c68310c71a9e6e31740805614e7521..11e6b56e29f044bcaef192eb67aaf8ee251865ea 100644 (file)
 </table>
 
 <p class="plugbottom">
+  {if !$read_only}
   <input type=submit name="edit_finish" style="width:80px" value="{msgPool type=okButton}">
        {if $dn != "new"}
          <input type=submit name="edit_apply" value="{msgPool type=applyButton}">
        {/if}
+  {/if}
   <input type=submit name="edit_cancel" value="{msgPool type=cancelButton}">
 </p>
 <input type='hidden' name='blocklist_posted' value="1">
index ffa0f2ec230e7d7950541d7b726c5e99344d02a3..97594a94fc2e58bf071351dbd4b0bacbce6088d9 100644 (file)
@@ -303,7 +303,7 @@ class phoneConferenceManagment extends plugin
       $this->dn= $this->conferences[$s_entry]['dn'];
 
       if (($conf= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($conf, $this->dn));
+        return(gen_locked_message ($conf, $this->dn,TRUE));
       }
 
       /* Lock the current entry, so everyone will get the  above dialog */
@@ -380,7 +380,12 @@ class phoneConferenceManagment extends plugin
       $display= $this->conftab->execute();
 
       /* Don't show buttons if tab dialog requests this */
-      if (!$this->conftab->by_object[$this->conftab->current]->dialog){
+
+      if(($this->conftab instanceOf tabs || $this->conftab instanceOf plugin) && $this->conftab->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->conftab->by_object[$this->conftab->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";
@@ -552,11 +557,12 @@ class phoneConferenceManagment extends plugin
    */
   function remove_lock()
   {
-    if($this->dn) del_lock($this->dn);
-    if(is_array($this->dns) && count($this->dns)) del_lock($this->dns);
-    if(isset($this->conftab) && isset($this->conftab->dn)){
+    if($this->dn) {
+      del_lock($this->dn);
+    }elseif(isset($this->conftab) && isset($this->conftab->dn)){
       del_lock ($this->conftab->dn);
     }
+    if(is_array($this->dns) && count($this->dns)) del_lock($this->dns);
   }
 
 
index 04cb48277e3ad6f23284d5e09d3a4534cbeb7357..4dc2f7c8618bdca61f536ae4957e936fab41629f 100644 (file)
@@ -232,7 +232,7 @@ class goFonMacro 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
@@ -412,7 +412,12 @@ class goFonMacro extends plugin
       $display= $this->macrotabs->execute();
 
       /* Don't show buttons if tab dialog requests this */
-      if (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){
+
+      if(($this->macrotabs instanceOf tabs || $this->macrotabs instanceOf plugin) && $this->macrotabs->read_only == TRUE){
+        $display.= "<p style=\"text-align:right\">
+          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+          </p>";
+      }elseif (!$this->macrotabs->by_object[$this->macrotabs->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 a7d777d5ee03c8f7b0babb529e5c2a2fe18f3625..5b8eb259d729743fa5a97b67eae94d54302f2ba5 100644 (file)
@@ -26,6 +26,7 @@ class printtabs 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 == ""){
index 86bee8ac0d111d0cc4517b4666f2052b280ed4b6..266566c2c288db64be8a34baf665080e1b7414bb 100644 (file)
@@ -26,6 +26,7 @@ class termtabs 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 == ""){
index 517ed4bcf2f68d5e1dd019379ccbc3b89ee9623c..a84b5fcb9dc38f75bb01e1f1ad1fdb2d565ec24b 100644 (file)
@@ -28,6 +28,7 @@ class worktabs 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 == ""){