aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/test_menu
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugins/test_menu/menu.class.inc.php19
-rw-r--r--plugins/test_menu/menu_templates/menubar.tpl165
-rw-r--r--plugins/test_menu/menu_templates/menubar_menu.tpl18
-rw-r--r--plugins/test_menu/menubar.inc.php42
4 files changed, 63 insertions, 181 deletions
diff --git a/plugins/test_menu/menu.class.inc.php b/plugins/test_menu/menu.class.inc.php
index d37a8345e..7eece66bd 100644
--- a/plugins/test_menu/menu.class.inc.php
+++ b/plugins/test_menu/menu.class.inc.php
@@ -1,9 +1,9 @@
<?php
/* -----------------------------------------------------------------------------
- class name: menu, blocks
- class version: 1.0
- date: 2008-07-25
+ classes names : menu, section
+ class version : 1.0
+ date : 2008-07-25
------------------------------------------------------------------------------
Author : Grum
@@ -56,6 +56,7 @@
unregister($id)
registered()
apply()
+ get_registered_filename()
How to use Menu class :
1/ create an instance
@@ -99,14 +100,24 @@ class Menu
protected $registered_sections=array();
protected $registered_file="registered.dat";
- public function Menu()
+ public function Menu($registered_path='')
{
+ if($registered_path!='')
+ {
+ $this->registered_file=$registered_path.$this->registered_file;
+ }
$this->load_registered();
}
/*
public functions
*/
+ public function get_registered_filename()
+ {
+ // return filename of file for maintain of registered sections
+ return($this->registered_file);
+ }
+
public function add($section_datas)
{
// add a section to the menu ; datas can be made with the Section class
diff --git a/plugins/test_menu/menu_templates/menubar.tpl b/plugins/test_menu/menu_templates/menubar.tpl
deleted file mode 100644
index 0bc538e87..000000000
--- a/plugins/test_menu/menu_templates/menubar.tpl
+++ /dev/null
@@ -1,165 +0,0 @@
-{* $Id: menubar.tpl 2409 2008-07-01 02:09:21Z rvelices $ *}
-
-<div id="menubar">
-{if not empty($links)}
-<dl id="mbLinks">
- <dt>{'Links'|@translate}</dt>
- <dd>
- <ul>
- {foreach from=$links item=link}
- <li>
- <a href="{$link.URL}"
- {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME|@escape:'javascript'}','{$link.new_window.FEATURES|@escape:'javascript'}'); return false;"{/if}
- >
- {$link.LABEL}
- </a>
- </li>
- {/foreach}{*links*}
- </ul>
- </dd>
-</dl>
-{/if}{*links*}
-
- {if isset($U_START_FILTER)}
- <a href="{$U_START_FILTER}" title="{'start_filter_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_filter.png" class="button" alt="start filter"></a>
- {/if}
- {if isset($U_STOP_FILTER)}
- <a href="{$U_STOP_FILTER}" title="{'stop_filter_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_filter.png" class="button" alt="stop filter"></a>
- {/if}
-
-<dl id="mbCategories">
- <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
- <dd>
- {$MENU_CATEGORIES_CONTENT}
- {if isset($U_UPLOAD)}
- <ul><li>
- <a href="{$U_UPLOAD}">{'upload_picture'|@translate}</a>
- </li></ul>
- {/if}
- <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
- </dd>
-</dl>
-
-
-{if not empty($related_tags)}
-<dl id="mbTags">
- <dt>{'Related tags'|@translate}</dt>
- <dd>
- <ul id="menuTagCloud">
- {foreach from=$related_tags item=tag}
- <li>
- {if !empty($tag.U_ADD) }
- <a href="{$tag.U_ADD}"
- title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.counter)}"
- rel="nofollow">
- <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
- </a>
- {/if}
- <a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{'See elements linked to this tag only'|@translate}">{$tag.name}</a>
- </li>
- {/foreach}
- </ul>
- </dd>
-</dl>
-{/if}
-
-
-<dl id="mbSpecial">
- <dt>{'special_categories'|@translate}</dt>
- <dd>
- <ul>
- {foreach from=$special_categories item=cat}
- <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
- {/foreach}
- </ul>
- </dd>
-</dl>
-
-
-<dl id="mbMenu">
- <dt>{'title_menu'|@translate}</dt>
- <dd>
- <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
- <p>
- <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
- </p>
- </form>
- <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
-
- <ul>
- {foreach from=$summaries item=sum}
- <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
- {/foreach}
- </ul>
- </dd>
-</dl>
-
-
-<dl id="mbIdentification">
- <dt>{'identification'|@translate}</dt>
- <dd>
- {if isset($USERNAME)}
- <p>{'hello'|@translate}&nbsp;{$USERNAME}&nbsp;!</p>
- {/if}
-
- <ul>
- {if isset($U_REGISTER)}
- <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
- {/if}
-
- {if isset($U_IDENTIFY)}
- <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
- {/if}
-
- {if isset($U_LOGOUT)}
- <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
- {/if}
-
- {if isset($U_PROFILE)}
- <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
- {/if}
-
- {if isset($U_ADMIN)}
- <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
- {/if}
- </ul>
-
- {if isset($U_IDENTIFY)}
- <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
- <fieldset>
- <legend>{'Quick connect'|@translate}</legend>
-
- <label>
- {'Username'|@translate}
- <input type="text" name="username" size="15" value="">
- </label>
-
- <label>
- {'Password'|@translate}
- <input type="password" name="password" size="15">
- </label>
-
- {if $AUTHORIZE_REMEMBERING}
- <label>
- {'remember_me'|@translate}
- <input type="checkbox" name="remember_me" value="1">
- </label>
- {/if}
- <p>
- <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
- </p>
-
- <ul class="actions">
- <li><a href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/lost_password.png" class="button" alt="{'Forgot your password?'|@translate}"></a></li>
- {if isset($U_REGISTER)}
- <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/register.png" class="button" alt="{'Register'|@translate}"/></a></li>
- {/if}
- </ul>
-
- </fieldset>
- </form>
- {/if}
-
- </dd>
-</dl>
-</div> <!-- menubar -->
diff --git a/plugins/test_menu/menu_templates/menubar_menu.tpl b/plugins/test_menu/menu_templates/menubar_menu.tpl
index 9d42eeea5..7b80881ed 100644
--- a/plugins/test_menu/menu_templates/menubar_menu.tpl
+++ b/plugins/test_menu/menu_templates/menubar_menu.tpl
@@ -2,16 +2,20 @@
<!-- menu menu bar -->
<dt>{$section.NAME|@translate}</dt>
<dd>
- <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
- <p>
- <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
- </p>
- </form>
- <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
+ {if isset($section.ITEMS.qsearch) and $section.ITEMS.qsearch=='y'}
+ <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
+ <p>
+ <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
+ </p>
+ </form>
+ <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
+ {/if}
<ul>
{foreach from=$section.ITEMS item=sum}
- <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
+ {if is_array($sum)}
+ <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
+ {/if}
{/foreach}
</ul>
</dd>
diff --git a/plugins/test_menu/menubar.inc.php b/plugins/test_menu/menubar.inc.php
index 0bcca0a08..5a504ce6d 100644
--- a/plugins/test_menu/menubar.inc.php
+++ b/plugins/test_menu/menubar.inc.php
@@ -110,7 +110,30 @@ if ('tags' == @$page['section'])
//---------------------------------------------------------- special categories
-// favorites categories
+/*
+ ** note for usage with Menu class **
+ items of Special section are defined with a named key rather than a
+ numeric key
+
+ Example :
+ $datas['special']=array(
+ 'favorite_cat' => array( ... ),
+ 'most_visited_cat' => array( ... ),
+ 'best_rated_cat' => array( ... ),
+ [...]
+ );
+
+ This permits to easily find datas and modify content with a callback on the
+ 'loc_begin_menubar' event.
+
+ Example :
+ $section_special=$menu->section('mbSpecial');
+ unset($section['ITEMS']['favorite_cat']);
+ $menu->replace($section_special);
+
+ this code permit to remove the items "favorite_cat" from the
+ section "mbSpecial"
+*/
$datas['special']=array();
if ( !is_a_guest() )
{
@@ -213,16 +236,25 @@ else
//--------------------------------------------------------------- menu summaries
+/*
+ ** note for usage with Menu class **
+ items of menu section are defined with a named key rather than a numeric key
+
+ see notes from "sepcial categories" for more informations
+*/
$datas['menu']=array();
+//qsearch input zone visible y/n ; if set to 'n' the qsearch zone isn't visible
+$datas['menu']['qsearch']='y';
+
// tags link
-$datas['menu']['tags']=array(
+$datas['menu']['Tags']=array(
'TITLE' => l10n('See available tags'),
'NAME' => l10n('Tags'),
'U_SUMMARY'=> get_root_url().'tags.php',
);
// search link
-$datas['menu']['search']=array(
+$datas['menu']['Search']=array(
'TITLE'=>l10n('hint_search'),
'NAME'=>l10n('Search'),
'U_SUMMARY'=> get_root_url().'search.php',
@@ -237,14 +269,14 @@ $datas['menu']['comments']=array(
);
// about link
-$datas['menu']['about']=array(
+$datas['menu']['About']=array(
'TITLE' => l10n('about_page_title'),
'NAME' => l10n('About'),
'U_SUMMARY' => get_root_url().'about.php',
);
// notification
-$datas['menu']['notification']=array(
+$datas['menu']['Notification']=array(
'TITLE'=>l10n('RSS feed'),
'NAME'=>l10n('Notification'),
'U_SUMMARY'=> get_root_url().'notification.php',