From 520c8ba8bc0a6d33f12c6738d1fdcb30e5c8c20e Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 1 Dec 2008 14:07:48 +0000 Subject: [PATCH] Added read_only option 3/3 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13100 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 3 --- .../plugins/admin/acl/class_aclManagement.inc | 5 +++-- gosa-core/plugins/admin/acl/tabs_acl.inc | 7 ++++++- gosa-core/plugins/admin/acl/tabs_acl_role.inc | 6 +++++- .../departments/class_departmentManagement.inc | 11 ++++++----- .../fai/admin/fai/class_faiManagement.inc | 8 ++++++-- .../gofax/blocklists/class_blocklistGeneric.inc | 1 + .../blocklists/class_blocklistManagement.inc | 2 +- gosa-plugins/gofax/gofax/blocklists/generic.tpl | 2 ++ .../class_phoneConferenceManagment.inc | 16 +++++++++++----- .../gofon/macro/class_gofonMacroManagement.inc | 9 +++++++-- .../goto/admin/systems/goto/tabs_printers.inc | 1 + .../goto/admin/systems/goto/tabs_terminal.inc | 1 + .../goto/admin/systems/goto/tabs_workstation.inc | 1 + 14 files changed, 51 insertions(+), 22 deletions(-) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index e022dcd4e..701ac804e 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -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." Skipped!"; return; } } - //echo "Remove ".$object." Done!"; - /* Check for existance and remove the entry */ $ldap= $config->get_ldap_link(); $ldap->cd ($config->get_cfg_value("config")); diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc index 40711f61c..430382fbf 100644 --- a/gosa-core/plugins/admin/acl/class_aclManagement.inc +++ b/gosa-core/plugins/admin/acl/class_aclManagement.inc @@ -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); } diff --git a/gosa-core/plugins/admin/acl/tabs_acl.inc b/gosa-core/plugins/admin/acl/tabs_acl.inc index 4a652a849..8f883795b 100644 --- a/gosa-core/plugins/admin/acl/tabs_acl.inc +++ b/gosa-core/plugins/admin/acl/tabs_acl.inc @@ -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.= "

\n"; + $display.= " \n"; + $display.= "

"; + }elseif(!$this->by_object['acl']->dialog){ $display.= "

\n"; $display.= " \n"; $display.= "  \n"; diff --git a/gosa-core/plugins/admin/acl/tabs_acl_role.inc b/gosa-core/plugins/admin/acl/tabs_acl_role.inc index 4b8a211a2..06303492f 100644 --- a/gosa-core/plugins/admin/acl/tabs_acl_role.inc +++ b/gosa-core/plugins/admin/acl/tabs_acl_role.inc @@ -62,7 +62,11 @@ class aclroletab extends tabs function execute() { $display= tabs::execute(); - if(!$this->by_object['aclrole']->dialog){ + if($this->read_only){ + $display.= "

\n"; + $display.= " \n"; + $display.= "

"; + }elseif(!$this->by_object['aclrole']->dialog){ $display.= "

\n"; $display.= " \n"; $display.= "  \n"; diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc index 7637f1c38..96d0ec353 100644 --- a/gosa-core/plugins/admin/departments/class_departmentManagement.inc +++ b/gosa-core/plugins/admin/departments/class_departmentManagement.inc @@ -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.= "

+ +

"; + }elseif (!$this->deptabs->by_object[$this->deptabs->current]->dialog){ $display.= "

\n"; $display.= "\n"; $display.= " \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); } diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index e5f1bd8c6..1e4155283 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -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.= "

+ +

"; + }elseif((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){ $display.= "

\n"; if(!$this->no_save){ diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc index 5c23583e7..865e7c7fe 100644 --- a/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc +++ b/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc @@ -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))); } diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc index 1346ab95c..c2e5b3f1d 100644 --- a/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc +++ b/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc @@ -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); } diff --git a/gosa-plugins/gofax/gofax/blocklists/generic.tpl b/gosa-plugins/gofax/gofax/blocklists/generic.tpl index 05056c67a..11e6b56e2 100644 --- a/gosa-plugins/gofax/gofax/blocklists/generic.tpl +++ b/gosa-plugins/gofax/gofax/blocklists/generic.tpl @@ -96,10 +96,12 @@

+ {if !$read_only} {if $dn != "new"} {/if} + {/if}

diff --git a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc index ffa0f2ec2..97594a94f 100644 --- a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc +++ b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc @@ -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.= "

+ +

"; + }elseif (!$this->conftab->by_object[$this->conftab->current]->dialog){ $display.= "

\n"; $display.= "\n"; $display.= " \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); } diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc index 04cb48277..4dc2f7c86 100644 --- a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc +++ b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc @@ -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.= "

+ +

"; + }elseif (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){ $display.= "

\n"; $display.= "\n"; $display.= " \n"; diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc b/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc index a7d777d5e..5b8eb259d 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc @@ -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 == ""){ diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc index 86bee8ac0..266566c2c 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc @@ -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 == ""){ diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc b/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc index 517ed4bcf..a84b5fcb9 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc @@ -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 == ""){ -- 2.30.2