From: <sy...@us...> - 2003-09-30 13:05:06
|
Update of /cvsroot/tikiwiki/tiki/lib/wiki-plugins-dist In directory sc8-pr-cvs1:/tmp/cvs-serv17990/lib/wiki-plugins-dist Modified Files: wikiplugin_module.php Log Message: quick fix+optimisation Index: wikiplugin_module.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins-dist/wikiplugin_module.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- wikiplugin_module.php 7 Aug 2003 04:34:17 -0000 1.4 +++ wikiplugin_module.php 30 Sep 2003 13:05:01 -0000 1.5 @@ -1,17 +1,29 @@ <?php +/* $Id$ +Displays a module inlined in page + +Parameters +module name : module=>lambda +align : align=>(left|center|right) +max : max=>20 +np : np=>(0|1) # (for non-parsed content) +module args : arg=>value (depends on module) + +Example: +{MODULE(module=>last_modified_pages,align=>left,max=>3,maxlen=>22)} +{/MODULE} + +about module params : all params are passed in $module_params +so if you need to use parmas just add them in MODULE() +like the trackerId in the above example. +*/ +function wikiplugin_module_help() { + return tra("Displays a module inlined in page").":<br />~np~{MODULE(module=>,align=>left|center|right,max=>,np=>0|1,args...)}{MODULE}~/np~"; +} -// Displays a module inlined in page -// Parameters: module name, align, max, module args -// Example: -// {MODULE(module=>logged_users,align=>left,max=>3,trackerId=>1)} -// {/MODULE} -// -// about module params : all params are passed in $module_params -// so if you need to use parmas just add them in MODULE() -// like the trackerId in the above example. function wikiplugin_module($data, $params) { - global $tikilib, $cache_time, $smarty, $dbTiki, $feature_directory, $ranklib, $feature_trackers, $user, $feature_tasks, - $feature_user_bookmarks, $tiki_p_tasks, $tiki_p_create_bookmarks, $imagegallib, $tikidomain; + global $tikilib, $cache_time, $smarty, $dbTiki, $feature_directory, $ranklib, $feature_trackers, $tikidomain, $user, + $feature_tasks, $feature_user_bookmarks, $tiki_p_tasks, $tiki_p_create_bookmarks, $imagegallib, $language; $out = ''; extract ($params); @@ -24,10 +36,14 @@ $max = '10'; } + if (!isset($np)) { + $np = '0'; + } + if (!isset($module)) { $out = '<form class="box" id="modulebox">'; - $out .= '<br><select name="choose">'; + $out .= '<br /><select name="choose">'; $out .= '<option value="">' . tra('Please choose a module'). '</option>'; $out .= '<option value="" style="background-color:#bebebe;">' . tra('to be used as argument'). '</option>'; $out .= '<option value="" style="background-color:#bebebe;">{MODULE(module=>name_of_module)}</option>'; @@ -47,7 +63,7 @@ $args = ''; } - $cachefile = 'modules/cache/' . $tikidomain . 'mod-' . $module . '.tpl.cache'; + $cachefile = 'modules/cache/' . $tikidomain . 'mod-' . $module . '.tpl.'.$language.'.cache'; $phpfile = 'modules/mod-' . $module . '.php'; $template = 'modules/mod-' . $module . '.tpl'; $nocache = 'templates/modules/mod-' . $module . '.tpl.nocache'; @@ -61,7 +77,7 @@ } $template_file = 'templates/' . $template; - + $smarty->assign('no_module_controls', 'y'); if (file_exists($template_file)) { $out = $smarty->fetch($template); } else { @@ -73,10 +89,12 @@ $out = $smarty->fetch('modules/user_module.tpl'); } } - - $fp = fopen($cachefile, "w+"); - fwrite($fp, $data, strlen($data)); - fclose ($fp); + $smarty->clear_assign('no_module_controls'); + if (!file_exists($nocache)) { + $fp = fopen($cachefile, "w+"); + fwrite($fp, $data, strlen($data)); + fclose ($fp); + } } else { $fp = fopen($cachefile, "r"); @@ -88,7 +106,11 @@ } if ($out) { - $data = "<div style='float:$align;'>$out</div>" . $data; + if ($np) { + $data = "<div style='float:$align;'>~pp~$out~/pp~</div>" . $data; + } else { + $data = "<div style='float:$align;'>$out</div>" . $data; + } } else { $data = "<div style='float:$align;color:#AA2200;'>" . tra("Sorry no such module"). "<br/><b>$module</b></div>" . $data; } |