From: hickert Date: Tue, 11 Dec 2007 06:27:30 +0000 (+0000) Subject: Updated block render. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f33fd9518bb70114fe1fdd82d6903a5c868da972;p=gosa.git Updated block render. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8074 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/smarty/plugins/block.render.php b/include/smarty/plugins/block.render.php index 63e02b68f..40a456aef 100755 --- a/include/smarty/plugins/block.render.php +++ b/include/smarty/plugins/block.render.php @@ -8,15 +8,60 @@ function smarty_block_render($params, $text, &$smarty) } /* Get acl parameter */ + $acl = ""; if (isset($params['acl'])) { $acl = $params['acl']; - unset($params['acl']); } + /* Debug output */ if (isset($_SESSION['DEBUGLEVEL']) && $_SESSION['DEBUGLEVEL'] & DEBUG_ACL ){ echo " ".$acl.""; } + + + /* Parameter : checkbox, checked + * If the parameter 'checkbox' is given, we create a html checkbox in front + * of the current object. + * The parameter 'checked' specifies whether the box is checked or not. + * The checkbox disables or enables the current object. + */ + if(isset($params['checkbox'])){ + + /* Detect name and id of the current object */ + $use_text = preg_replace("/\n/"," ",$text); + $name = preg_replace('/^.* name[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text); + + /* Detect id */ + if(preg_match("/ id=(\"|')[^\"']*(\"|')/i",$text)){ + $id = preg_replace('/^.* id[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text); + }else{ + $id = ""; + } + + /* Is the box checked? */ + isset($params['checked'])&&$params['checked'] ? $check = " checked " : $check = ""; + + /* If name isset, we have a html input field */ + if(!empty($name)){ + + /* Print checkbox */ + echo ""; + + /* Disable current object, if checkbox isn't checked */ + if($check == ""){ + $text = preg_replace("/name=/i"," disabled name=",$text); + } + + /* Add id to current entry, if it is missing */ + if($id == ""){ + $text = preg_replace("/name=/i"," id=\"".$name."\" name=",$text); + } + } + } + + /* Read / Write*/ if(preg_match("/w/i",$acl)){ return ($text);