From: <sy...@us...> - 2008-07-09 14:38:52
|
Revision: 13479 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=13479&view=rev Author: sylvieg Date: 2008-07-09 07:38:51 -0700 (Wed, 09 Jul 2008) Log Message: ----------- [MOD]menu: possibility to change for a menu the folders icons by giving the path to the open folder icon + some fix to be able to overload the folder icons for a theme Modified Paths: -------------- branches/1.10/db/tiki.sql branches/1.10/db/tiki_1.9to1.10.sql branches/1.10/lib/menubuilder/menulib.php branches/1.10/lib/tikilib.php branches/1.10/templates/tiki-admin_menus.tpl branches/1.10/templates/tiki-user_menu.tpl branches/1.10/tiki-admin_menus.php Modified: branches/1.10/db/tiki.sql =================================================================== --- branches/1.10/db/tiki.sql 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/db/tiki.sql 2008-07-09 14:38:51 UTC (rev 13479) @@ -2300,6 +2300,7 @@ name varchar(200) NOT NULL default '', description text, type char(1) default NULL, + icon varchar(200) NULL default NULL, PRIMARY KEY (menuId) ) ENGINE=MyISAM AUTO_INCREMENT=1 ; # -------------------------------------------------------- Modified: branches/1.10/db/tiki_1.9to1.10.sql =================================================================== --- branches/1.10/db/tiki_1.9to1.10.sql 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/db/tiki_1.9to1.10.sql 2008-07-09 14:38:51 UTC (rev 13479) @@ -1869,3 +1869,5 @@ INSERT INTO tiki_menu_options (menuId,type,name,url,position,section,perm,groupname) VALUES (42,'o','Admin topics','tiki-admin_topics.php',390,'feature_articles','tiki_p_articles_admin_topics',''); INSERT INTO tiki_menu_options (menuId,type,name,url,position,section,perm,groupname) VALUES (42,'o','Admin types','tiki-article_types.php',395,'feature_articles','tiki_p_articles_admin_types',''); +#2008-07-09 sylvieg +ALTER TABLE tiki_menus ADD icon varchar(200) NULL default NULL AFTER type; Modified: branches/1.10/lib/menubuilder/menulib.php =================================================================== --- branches/1.10/lib/menubuilder/menulib.php 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/lib/menubuilder/menulib.php 2008-07-09 14:38:51 UTC (rev 13479) @@ -42,15 +42,15 @@ return $retval; } - function replace_menu($menuId, $name, $description, $type) { + function replace_menu($menuId, $name, $description='', $type='d', $icon=null) { // Check the name if (isset($menuId) and $menuId > 0) { - $query = "update `tiki_menus` set `name`=?,`description`=?,`type`=? where `menuId`=?"; - $bindvars=array($name,$description,$type,(int)$menuId); + $query = "update `tiki_menus` set `name`=?,`description`=?,`type`=?, `icon`=? where `menuId`=?"; + $bindvars=array($name,$description,$type,$icon,(int)$menuId); } else { // was: replace into. probably we need a delete here - $query = "insert into `tiki_menus`(`name`,`description`,`type`) values(?,?,?)"; - $bindvars=array($name,$description,$type); + $query = "insert into `tiki_menus`(`name`,`description`,`type`,`icon`) values(?,?,?,?)"; + $bindvars=array($name,$description,$type,$icon); } $result = $this->query($query,$bindvars); Modified: branches/1.10/lib/tikilib.php =================================================================== --- branches/1.10/lib/tikilib.php 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/lib/tikilib.php 2008-07-09 14:38:51 UTC (rev 13479) @@ -1812,6 +1812,10 @@ $result = $this->query($query,array((int)$menuId)); if (!$result->numRows()) return false; $res = $result->fetchRow(); + if (empty($res['icon'])) + $res['oicon'] = null; + else + $res['oicon'] = dirname($res['icon']).'/o'.basename($res['icon']); return $res; } Modified: branches/1.10/templates/tiki-admin_menus.tpl =================================================================== --- branches/1.10/templates/tiki-admin_menus.tpl 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/templates/tiki-admin_menus.tpl 2008-07-09 14:38:51 UTC (rev 13479) @@ -20,12 +20,14 @@ <li>{literal}{phplayers id=X type=horiz}{/literal}</li> <li>{literal}{phplayers id=X type=vert}{/literal}</li> </ul> - {tr}This will work well (or not!) depending on your theme. To learn more about <a target="tikihelp" href="http://themes.tikiwiki.org">themes</a>{/tr} + {tr}This will work well (or not!) depending on your theme. To learn more about <a target="tikihelp" href="http://themes.tikiwiki.org">themes</a>{/tr}<br /> + {tr}To use a menu in a tiki format: {/tr}{literal}{menu id=X}{/literal}<br /> + {tr}To use menu in a css/suckerfish format: {/tr}{literal}{menu id=X css=y}{/literal} </div> </div> {if $menuId > 0} -<h2>{tr}Edit this Menu:{/tr} {$name}</h2> +<h2>{tr}Edit this Menu:{/tr} {$info.name}</h2> <a href="tiki-admin_menus.php" class="linkbut">{tr}Create new Menu{/tr}</a> {else} <h2>{tr}Create new Menu{/tr}</h2> @@ -33,15 +35,18 @@ <form action="tiki-admin_menus.php" method="post"> <input type="hidden" name="menuId" value="{$menuId|escape}" /> <table class="normal"> -<tr><td class="formcolor"><label for="menus_name">{tr}Name{/tr}:</label></td><td class="formcolor"><input type="text" name="name" id="menus_name" value="{$name|escape}" style="width:95%" /></td></tr> -<tr><td class="formcolor"><label for="menus_desc">{tr}Description{/tr}:</label></td><td class="formcolor"><textarea name="description" id="menus_desc" rows="4" cols="40" style="width:95%">{$description|escape}</textarea></td></tr> +<tr><td class="formcolor"><label for="menus_name">{tr}Name{/tr}:</label></td><td class="formcolor"><input type="text" name="name" id="menus_name" value="{$info.name|escape}" style="width:95%" /></td></tr> +<tr><td class="formcolor"><label for="menus_desc">{tr}Description{/tr}:</label></td><td class="formcolor"><textarea name="description" id="menus_desc" rows="4" cols="40" style="width:95%">{$info.description|escape}</textarea></td></tr> <tr><td class="formcolor"><label for="menus_type">{tr}Type{/tr}:</label></td><td class="formcolor"> <select name="type" id="menus_type"> -<option value="d" {if $type eq 'd'}selected="selected"{/if}>{tr}dynamic collapsed{/tr} (d)</option> -<option value="e" {if $type eq 'e'}selected="selected"{/if}>{tr}dynamic extended{/tr} (e)</option> -<option value="f" {if $type eq 'f'}selected="selected"{/if}>{tr}fixed{/tr} (f)</option> +<option value="d" {if $info.type eq 'd'}selected="selected"{/if}>{tr}dynamic collapsed{/tr} (d)</option> +<option value="e" {if $info.type eq 'e'}selected="selected"{/if}>{tr}dynamic extended{/tr} (e)</option> +<option value="f" {if $info.type eq 'f'}selected="selected"{/if}>{tr}fixed{/tr} (f)</option> </select> </td></tr> +{if $prefs.feature_menusfolderstyle eq 'y'} +<tr><td class="formcolor">{tr}Path to the folder icon for close sections{/tr}</td><td><input type="text" name="icon" value="{$info.icon}" /><br />{tr}Example:{/tr} styles/mose/pics/icons/folder.png<br />{tr}Provide also a folder icon for open sections with the same name with the letter 'o' before in the same directory (ex: folder.png and ofolder.png){/tr}<br />{tr}Default:{/tr}{icon _id="folder"}</td></tr> +{/if} <tr><td class="formcolor"> </td><td class="formcolor"><input type="submit" name="save" value="{tr}Save{/tr}" /></td></tr> </table> </form> Modified: branches/1.10/templates/tiki-user_menu.tpl =================================================================== --- branches/1.10/templates/tiki-user_menu.tpl 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/templates/tiki-user_menu.tpl 2008-07-09 14:38:51 UTC (rev 13479) @@ -29,7 +29,21 @@ {if $menu_info.type eq 'e' or $menu_info.type eq 'd'} {if $prefs.feature_menusfolderstyle eq 'y'} {assign var="name" value=icnmenu$cname} - <a class='separator' href="javascript:icntoggle('menu{$cname}');" title="{tr}Toggle options{/tr}">{if $menu_info.type ne 'd'}{icon _id="folder_open" alt='Toggle' name="$name"}{else}{icon _id="folder" alt='Toggle' name="$name"}{/if}</a> + <a class='separator' href="javascript:icntoggle('menu{$cname}');" title="{tr}Toggle options{/tr}"> + {if $menu_info.type ne 'd'} + {if empty($menu_info.icon)} + {icon _id="ofolder" alt='Toggle' name="$name"} + {else} + <img src="{$menu_info.oicon}" border="0" alt='{tr}Toggle{/tr}' name="{$name}" /> + {/if} + {else} + {if empty($menu_info.icon)} + {icon _id="folder" alt='Toggle' name="$name"} + {else} + <img src="{$menu_info.icon}" border="0" alt='{tr}Toggle{/tr}' name="{$name}" /> + {/if} + {/if} + </a> {else} <a class='separator' href="javascript:toggle('menu{$cname}');">[-]</a> {/if} Modified: branches/1.10/tiki-admin_menus.php =================================================================== --- branches/1.10/tiki-admin_menus.php 2008-07-09 07:58:36 UTC (rev 13478) +++ branches/1.10/tiki-admin_menus.php 2008-07-09 14:38:51 UTC (rev 13479) @@ -33,11 +33,10 @@ $info["name"] = ''; $info["description"] = ''; $info["type"] = 'd'; + $info['icon'] = null; } -$smarty->assign('name', $info["name"]); -$smarty->assign('description', $info["description"]); -$smarty->assign('type', $info["type"]); +$smarty->assign_by_ref('info', $info); if (isset($_REQUEST["remove"])) { $area = 'delmenu'; @@ -52,13 +51,12 @@ if (isset($_REQUEST["save"])) { check_ticket('admin-menus'); - $menulib->replace_menu($_REQUEST["menuId"], $_REQUEST["name"], $_REQUEST["description"], $_REQUEST["type"]); + if (!isset($_REQUEST['icon'])) $_REQUEST['icon'] = null; + $menulib->replace_menu($_REQUEST['menuId'], $_REQUEST['name'], $_REQUEST['description'], $_REQUEST['type'], $_REQUEST['icon']); $smarty->clear_cache('tiki-user_menu.tpl', $_REQUEST['menuId']); - $smarty->assign('name', ''); - $smarty->assign('description', ''); - $smarty->assign('type', ''); $_REQUEST["menuId"] = 0; $smarty->assign('menuId', 0); + $smarty->assign('info', array('name'=>'', 'description'=>'', 'type'=>'d', 'icon'=>null)); } if (!isset($_REQUEST["sort_mode"])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |