From: hickert Date: Mon, 1 Dec 2008 09:30:27 +0000 (+0000) Subject: Updated read-only handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e58bd848e63a6dd71cf745fc08f2391ddabc598a;p=gosa.git Updated read-only handling -Added read-only to user management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13090 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/ihtml/themes/default/islocked.tpl b/gosa-core/ihtml/themes/default/islocked.tpl index 2845fa2ea..75de1c40e 100644 --- a/gosa-core/ihtml/themes/default/islocked.tpl +++ b/gosa-core/ihtml/themes/default/islocked.tpl @@ -11,8 +11,10 @@

+ {if $allow_readonly}   + {/if}  

diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 7d3a6dd4e..f834f454a 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -150,8 +150,14 @@ class plugin return; } + /* Check if this entry was opened in read only mode */ if(isset($_POST['open_readonly'])){ - $this->read_only = TRUE; + if(session::is_set("LOCK_CACHE")){ + $cache = &session::get("LOCK_CACHE"); + if(isset($cache['READ_ONLY'][$this->dn])){ + $this->read_only = TRUE; + } + } } /* Save current dn as acl_base */ diff --git a/gosa-core/include/class_tabs.inc b/gosa-core/include/class_tabs.inc index 38567747c..b4e72f9e0 100644 --- a/gosa-core/include/class_tabs.inc +++ b/gosa-core/include/class_tabs.inc @@ -37,6 +37,8 @@ class tabs var $acl_category; var $multiple_support_active = FALSE; + var $read_only = FALSE; // Used when the entry is opened as "readonly" due to locks. + function tabs(&$config, $data, $dn, $acl_category= "") { /* Save dn */ @@ -68,6 +70,7 @@ class tabs $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject); } + $this->read_only |= $this->by_object[$tab['CLASS']]->read_only; $this->by_object[$tab['CLASS']]->parent= &$this; $this->by_object[$tab['CLASS']]->set_acl_category($this->acl_category); diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 66c22e9ae..e022dcd4e 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -608,15 +608,12 @@ function add_lock($object, $user) $cache = &session::get("LOCK_CACHE"); if(isset($_POST['open_readonly'])){ $cache['READ_ONLY'][$object] = TRUE; - echo "ADDED : {$user}:{$object}
"; return; } if(isset($cache['READ_ONLY'][$object])){ - echo "Removed lock entry $object
"; unset($cache['READ_ONLY'][$object]); } - if(is_array($object)){ foreach($object as $obj){ add_lock($obj,$user); @@ -680,15 +677,14 @@ function del_lock ($object) if(session::is_set("LOCK_CACHE")){ $cache = &session::get("LOCK_CACHE"); if(isset($cache['READ_ONLY'][$object])){ - if(isset($_POST['delete_lock'])){ - unset($cache['READ_ONLY'][$object]); - }else{ - echo "Skipped: $object
"; - return; - } + 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")); @@ -1289,7 +1285,7 @@ function get_uid_regexp() } -function gen_locked_message($user, $dn) +function gen_locked_message($user, $dn, $allow_readonly = FALSE) { global $plug, $config; @@ -1326,7 +1322,7 @@ function gen_locked_message($user, $dn) /* Prepare and show template */ $smarty= get_smarty(); - + $smarty->assign("allow_readonly",$allow_readonly); if(is_array($dn)){ $msg = "
";
     foreach($dn as $sub_dn){
diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index 945f60ebd..1171849cc 100644
--- a/gosa-core/plugins/admin/users/class_userManagement.inc
+++ b/gosa-core/plugins/admin/users/class_userManagement.inc
@@ -396,7 +396,7 @@ class userManagement 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
@@ -931,15 +931,21 @@ class userManagement extends plugin
         }
 
         if(!is_object($dia) && $dia != TRUE){
-          $display.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; + if(($this->usertab instanceOf tabs || $this->usertab instanceOf plugin) && $this->usertab->read_only == TRUE){ + $display.= "

+ +

"; + }else{ + $display.= "

\n"; + $display.= "\n"; $display.= " \n"; + if ($this->dn != "new"){ + $display.= "\n"; + $display.= " \n"; + } + $display.= "\n"; + $display.= "

"; } - $display.= "\n"; - $display.= "

"; } return ($display); } @@ -1080,8 +1086,7 @@ class userManagement extends plugin /* Remove user lock if a DN is marked as "currently edited" */ if (isset($this->usertab->dn)){ del_lock ($this->usertab->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)){