Code

Added diabled picture to render funktion
[gosa.git] / include / smarty / plugins / block.render.php
index 0b764c2800c08adde8a12676e284a6afe02cfd38..831009fda1921b1a682ff363cb8c8dd14f841a1d 100755 (executable)
@@ -16,18 +16,26 @@ function smarty_block_render($params, $text, &$smarty)
                unset($params['acl']);
        }
 
-       echo "<font color='blue' size='2'>".$acl."</font>";
+//     echo "<font color='blue' size='2'>".$acl."</font>";
 
        /* Read / Write*/
        if(preg_match("/w/i",$acl)){
                return ($text);
        }
 
-       /* Disable objects, but keep submit buttons active in readmode */
-       if(!preg_match("/submit/",$text)){
+       /* Disable objects, but keep those active that have mode=read_active */
+       if(!(isset($params['mode']) && $params['mode']=='readable')){
                $from   =  array("/name=/i");
                $to     =  array("disabled name=");
                $text = preg_replace($from,$to,$text);
+
+               /* Replace picture if object is disabled */
+               if(isset($params['disable_picture'])){
+                       $syn = "/src=['\"][a-z0-9\/.]*['\"]/i";
+                       $new = "src=\"".$params['disable_picture']."\"";
+                       $text = preg_replace($syn,$new,$text);
+               }
+
        }               
 
        /* Read only */