aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrum <grum@piwigo.org>2008-08-07 21:52:45 +0000
committergrum <grum@piwigo.org>2008-08-07 21:52:45 +0000
commit526d8006a16bd8b666d94aaf152346537045a0a5 (patch)
treebe1a62befe2bdbe3d0d03a8155aa1d1b228093e5
parent5e3d71c9cab75c7796c566823df96765522c8965 (diff)
updating files for the Menu class (test_menu)
+ add functionnalities updating files for the AMenuManager plugin + fixes some bugs + add functionnalities updating common classes grum_plugins_classes-2 (needed for the AMenuManager plugin) + add functionalities for google_translator use git-svn-id: http://piwigo.org/svn/trunk@2468 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/AMenuManager/admin/amm_linksconfig.tpl25
-rw-r--r--plugins/AMenuManager/admin/amm_personalisedlist.tpl50
-rw-r--r--plugins/AMenuManager/admin/amm_personalisedlist_detail.tpl22
-rw-r--r--plugins/AMenuManager/admin/amm_personalisedlist_edit.tpl155
-rw-r--r--plugins/AMenuManager/admin/amm_randompicconfig.tpl132
-rw-r--r--plugins/AMenuManager/admin/amm_sections.tpl58
-rw-r--r--plugins/AMenuManager/admin/amm_sectionsmod_detail.tpl17
-rw-r--r--plugins/AMenuManager/amm.sql25
-rwxr-xr-xplugins/AMenuManager/amm_aip.class.inc.php518
-rw-r--r--plugins/AMenuManager/amm_install.class.inc.php12
-rw-r--r--plugins/AMenuManager/amm_pip.class.inc.php80
-rw-r--r--plugins/AMenuManager/amm_root.class.inc.php82
-rwxr-xr-xplugins/AMenuManager/language/en_UK/plugin.lang.php37
-rwxr-xr-xplugins/AMenuManager/language/fr_FR/plugin.lang.php38
-rw-r--r--plugins/AMenuManager/menu_templates/menubar_personalised.tpl8
-rw-r--r--plugins/AMenuManager/menu_templates/menubar_randompic.tpl14
-rwxr-xr-xplugins/grum_plugins_classes-2/google_translate.js56
-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
21 files changed, 1322 insertions, 251 deletions
diff --git a/plugins/AMenuManager/admin/amm_linksconfig.tpl b/plugins/AMenuManager/admin/amm_linksconfig.tpl
index 55ee8b6a0..25e6d75cc 100644
--- a/plugins/AMenuManager/admin/amm_linksconfig.tpl
+++ b/plugins/AMenuManager/admin/amm_linksconfig.tpl
@@ -35,6 +35,15 @@
objhidden[objnames.indexOf(input_id)][objlang.options.selectedIndex].value = obj.value;
}
+ function do_translation()
+ {
+ var inputid = document.getElementById('iamm_links_title');
+ var tolang = objlang.options[objlang.options.selectedIndex].value.substr(0,2);
+
+ google_translate(inputid.value, '{/literal}{$datas.fromlang}{literal}', tolang, inputid, 'value', apply_changes, inputid.id);
+ }
+
+
</script>
{/literal}
@@ -46,7 +55,7 @@
<form method="post" action="" class="general">
<fieldset>
- <legend>{'g002_setting_link_block_menu'|@translate}</legend>
+ <legend>{'g002_setting_block_menu'|@translate}</legend>
{if isset($datas.language_list) and count($datas.language_list)}
{foreach from=$datas.language_list key=name item=language_row}
@@ -57,7 +66,7 @@
<table class="formtable">
<tr>
- <td>{'g002_setting_link_block_active'|@translate}</td>
+ <td>{'g002_setting_block_active'|@translate}</td>
<td>
<select name="famm_links_active" id="iamm_links_active">
{html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.active_selected}
@@ -66,12 +75,18 @@
</tr>
<tr>
- <td>{'g002_setting_link_block_title'|@translate}</td>
+ <td>{'g002_setting_block_title'|@translate}</td>
<td>
- <input type="text" id="iamm_links_title" value="" maxlength="50" onkeyup="apply_changes('iamm_links_title');" />
+ <input type="text" id="iamm_links_title" value="" maxlength="50" onkeyup="apply_changes('iamm_links_title');" onblur="apply_changes('iamm_links_title');"/>
<select onchange="change_lang();" id="islang">
{html_options values=$datas.language_list_values output=$datas.language_list_labels selected=$datas.lang_selected}
- </select>
+ </select><br>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td style="font-size:80%;">
+ <a style="cursor:pointer;" onclick="do_translation()">{'g002_translate'|@translate}</a>
</td>
</tr>
diff --git a/plugins/AMenuManager/admin/amm_personalisedlist.tpl b/plugins/AMenuManager/admin/amm_personalisedlist.tpl
new file mode 100644
index 000000000..d7595e036
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_personalisedlist.tpl
@@ -0,0 +1,50 @@
+{literal}
+<script type="text/javascript">
+
+ function load_list(do_action, item)
+ {
+ /*
+ do_action
+ 'list' : just load list
+ 'delete' : delete the item in list
+ */
+ var doc = document.getElementById("isections");
+
+ action_todo='';
+ if(do_action=='delete')
+ {
+ if(confirm('{/literal}{'g002_confirm_delete_link'|@translate}{literal}'))
+ {
+ action_todo='personalised_delete&fItem='+item;
+ }
+ }
+ else
+ {
+ action_todo='personalised_list';
+ }
+
+ if(action_todo!='')
+ {
+ http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
+ http_request.send(null);
+ doc.innerHTML=http_request.responseText;
+ }
+ }
+
+</script>
+{/literal}
+
+
+<h3>{'g002_personalisedlist'|@translate}</h3>
+
+[{$datas.nbsections}]<br/>
+<a href="{$datas.lnk_create}" title="{'g002_addsection'|@translate}">{'g002_addsection'|@translate}</a>
+
+<br/>
+
+<div id="isections"></div>
+
+
+<script type="text/javascript">
+ load_list('list', 0);
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_personalisedlist_detail.tpl b/plugins/AMenuManager/admin/amm_personalisedlist_detail.tpl
new file mode 100644
index 000000000..fd785e359
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_personalisedlist_detail.tpl
@@ -0,0 +1,22 @@
+
+{if isset($datas.sections) and count($datas.sections)}
+ <table class="table2 littlefont">
+ <tr class="throw">
+ <th>{'g002_setting_personalised_nfo'|@translate}</th>
+ <th>{'g002_title'|@translate}</th>
+ <th>{'g002_visible'|@translate}</th>
+ <th colspan=2>&nbsp;</th>
+ </tr>
+
+ {foreach from=$datas.sections key=name item=section}
+ <tr>
+ <td>{$section.nfo}</td>
+ <td>{$section.title}</td>
+ <td style="text-align:center;">{$section.visible}</td>
+ <td width="15px"><a href="{$section.edit}"><img src='{$themeconf.icon_dir}/category_edit.png'/></a></td>
+ <td width="15px"><a style="cursor:pointer;" onclick="load_list('delete', {$section.ID})"><img src='{$themeconf.icon_dir}/delete.png'/></a></td>
+ </tr>
+ {/foreach}
+
+ </table>
+{/if}
diff --git a/plugins/AMenuManager/admin/amm_personalisedlist_edit.tpl b/plugins/AMenuManager/admin/amm_personalisedlist_edit.tpl
new file mode 100644
index 000000000..ddccc6b23
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_personalisedlist_edit.tpl
@@ -0,0 +1,155 @@
+{literal}
+<script type="text/javascript">
+
+ //global var ; need to not have to initialize them every time a value is changed
+ var objlang;
+ var objnames = new Array('iamm_personalised_title', 'iamm_personalised_content');
+ var objinput = new Array(); //input text from form => objinput[name]
+ var objhidden = new Array(); //input hidden from form => objhidden[name][lang]
+
+ function init()
+ {
+ objlang = document.getElementById('islang');
+ for(i=0;i<objnames.length;i++)
+ {
+ objinput[i] = document.getElementById(objnames[i]);
+ objhidden[i] = new Array();
+ for(j=0;j<objlang.options.length;j++)
+ {
+ objhidden[i][j] = document.getElementById(objnames[i]+'_'+objlang.options[j].value);
+ }
+ }
+ }
+
+ function change_lang()
+ {
+ for(i=0;i<objnames.length;i++)
+ {
+ objinput[i].value = objhidden[i][objlang.options.selectedIndex].value;
+ }
+ }
+
+ function apply_changes(input_id)
+ {
+ var obj=document.getElementById(input_id);
+ objhidden[objnames.indexOf(input_id)][objlang.options.selectedIndex].value = obj.value;
+ }
+
+ function do_translation()
+ {
+ var inputid = document.getElementById('iamm_personalised_title');
+ var tolang = objlang.options[objlang.options.selectedIndex].value.substr(0,2);
+
+ google_translate(inputid.value, '{/literal}{$datas.fromlang}{literal}', tolang, inputid, 'value', apply_changes, inputid.id);
+ }
+
+</script>
+{/literal}
+
+
+{if isset($datas.modeedit)}
+
+ <h3>
+ {if $datas.modeedit=='create'}
+ {'g002_createofpersonalised'|@translate}
+ {else}
+ {'g002_editofpersonalised'|@translate}
+ {/if}
+ / <span style="font-weight:normal"><a href="{$datas.personalised_list}">{'g002_personalisedlist'|@translate}</a></span></h3>
+ </h3>
+
+
+<form method="post" action="" class="general">
+ <fieldset>
+ <legend>{'g002_setting_personalised_properties'|@translate}</legend>
+
+ <table class="formtable">
+ <tr>
+ <td>{'g002_setting_block_active'|@translate}</td>
+ <td>
+ <select name="famm_personalised_visible" id="iamm_personalised_visible">
+ {html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.visible_selected}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_personalised_nfo'|@translate}</td>
+ <td>
+ <input type="text" name="famm_personalised_nfo" id="iamm_personalised_nfo" value="{$datas.nfo}" maxlength="25"/>
+ </td>
+ </tr>
+
+ </table>
+
+ </fieldset>
+
+ <fieldset>
+ <legend>{'g002_setting_block_menu'|@translate}</legend>
+
+ {if isset($datas.language_list) and count($datas.language_list)}
+ {foreach from=$datas.language_list key=name item=language_row}
+ <input type="hidden" name="famm_personalised_title_{$language_row.LANG}"
+ id="iamm_personalised_title_{$language_row.LANG}" value="{$language_row.MENUBARTIT}">
+ <input type="hidden" name="famm_personalised_content_{$language_row.LANG}"
+ id="iamm_personalised_content_{$language_row.LANG}" value="{$language_row.MENUBARCONTENT}">
+ {/foreach}
+ {/if}
+
+ <table class="formtable">
+
+ <tr>
+ <td>{'g002_setting_block_langchoice'|@translate}</td>
+ <td>
+ <select onchange="change_lang();" id="islang">
+ {html_options values=$datas.language_list_values output=$datas.language_list_labels selected=$datas.lang_selected}
+ </select><br>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan=2><hr/></td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_block_title'|@translate}</td>
+ <td>
+ <input type="text" id="iamm_personalised_title" value="" maxlength="50" onkeyup="apply_changes('iamm_personalised_title');" onblur="apply_changes('iamm_personalised_title');"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td style="font-size:80%;">
+ <a style="cursor:pointer;" onclick="do_translation()">{'g002_translate'|@translate}</a>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_personalised_content'|@translate}</td>
+ <td>
+ <textarea id="iamm_personalised_content" cols=80 rows=25 onkeyup="apply_changes('iamm_personalised_content');" /></textarea>
+ </td>
+ </tr>
+
+
+ </table>
+
+ </fieldset>
+
+
+ <p>
+ <input type="submit" name="famm_submit_apply" id="iamm_submit_apply" value="{'g002_apply'|@translate}" >
+ </p>
+
+ <input type="hidden" name="famm_modeedit" value="{$datas.modeedit}">
+ <input type="hidden" name="famm_id" value="{$datas.id}">
+
+</form>
+
+
+<script type="text/javascript">
+ init();
+ change_lang();
+</script>
+
+{/if} \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_randompicconfig.tpl b/plugins/AMenuManager/admin/amm_randompicconfig.tpl
new file mode 100644
index 000000000..df70311f0
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_randompicconfig.tpl
@@ -0,0 +1,132 @@
+{literal}
+<script type="text/javascript">
+
+ //global var ; need to not have to initialize them every time a value is changed
+ var objlang;
+ var objnames = new Array('iamm_randompicture_title');
+ var objinput = new Array(); //input text from form => objinput[name]
+ var objhidden = new Array(); //input hidden from form => objhidden[name][lang]
+
+ function init()
+ {
+ objlang = document.getElementById('islang');
+ for(i=0;i<objnames.length;i++)
+ {
+ objinput[i] = document.getElementById(objnames[i]);
+ objhidden[i] = new Array();
+ for(j=0;j<objlang.options.length;j++)
+ {
+ objhidden[i][j] = document.getElementById(objnames[i]+'_'+objlang.options[j].value);
+ }
+ }
+ }
+
+ function change_lang()
+ {
+ for(i=0;i<objnames.length;i++)
+ {
+ objinput[i].value = objhidden[i][objlang.options.selectedIndex].value;
+ }
+ }
+
+ function apply_changes(input_id)
+ {
+ var obj=document.getElementById(input_id);
+ objhidden[objnames.indexOf(input_id)][objlang.options.selectedIndex].value = obj.value;
+ }
+
+ function do_translation()
+ {
+ var inputid = document.getElementById('iamm_randompicture_title');
+ var tolang = objlang.options[objlang.options.selectedIndex].value.substr(0,2);
+
+ google_translate(inputid.value, '{/literal}{$datas.fromlang}{literal}', tolang, inputid, 'value', apply_changes, inputid.id);
+
+ }
+
+
+</script>
+{/literal}
+
+
+
+<h3>{'g002_configrandompic'|@translate}</h3>
+
+
+<form method="post" action="" class="general">
+ <fieldset>
+ <legend>{'g002_setting_block_menu'|@translate}</legend>
+
+ {if isset($datas.language_list) and count($datas.language_list)}
+ {foreach from=$datas.language_list key=name item=language_row}
+ <input type="hidden" name="famm_randompicture_title_{$language_row.LANG}"
+ id="iamm_randompicture_title_{$language_row.LANG}" value="{$language_row.MENUBARTIT}">
+ {/foreach}
+ {/if}
+
+ <table class="formtable">
+ <tr>
+ <td>{'g002_setting_block_active'|@translate}</td>
+ <td>
+ <select name="famm_randompicture_active" id="iamm_randompicture_active">
+ {html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.active_selected}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_block_title'|@translate}</td>
+ <td>
+ <input type="text" id="iamm_randompicture_title" value="" maxlength="50" onkeyup="apply_changes('iamm_randompicture_title');" onblur="apply_changes('iamm_randompicture_title');"/>
+ <select onchange="change_lang();" id="islang">
+ {html_options values=$datas.language_list_values output=$datas.language_list_labels selected=$datas.lang_selected}
+ </select><br>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td style="font-size:80%;">
+ <a style="cursor:pointer;" onclick="do_translation()">{'g002_translate'|@translate}</a>
+ </td>
+ </tr>
+
+ </table>
+
+ </fieldset>
+
+ <fieldset>
+ <legend>{'g002_setting_randompic_aboutpicture'|@translate}</legend>
+ <table class="formclass">
+ <tr>
+ <td>{'g002_setting_randompic_showname'|@translate}</td>
+ <td>
+ <select name="famm_randompicture_showname" id="iamm_randompicture_showname">
+ {html_options values=$datas.show_values output=$datas.show_labels selected=$datas.showname_selected}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_randompic_showcomment'|@translate}</td>
+ <td>
+ <select name="famm_randompicture_showcomment" id="iamm_randompicture_showcomment">
+ {html_options values=$datas.show_values output=$datas.show_labels selected=$datas.showcomment_selected}
+ </select>
+ </td>
+ </tr>
+
+ </table>
+ </fieldset>
+
+ <p>
+ <input type="submit" name="famm_submit_apply" id="iamm_submit_apply" value="{'g002_apply'|@translate}" >
+ </p>
+
+ <input type="hidden" name="famm_modeedit" value="config">
+
+</form>
+
+<script type="text/javascript">
+ init();
+ change_lang();
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_sections.tpl b/plugins/AMenuManager/admin/amm_sections.tpl
new file mode 100644
index 000000000..da132a622
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_sections.tpl
@@ -0,0 +1,58 @@
+{literal}
+<script type="text/javascript">
+
+ function load_list(do_action, item, position)
+ {
+ /*
+ do_action
+ 'list' : just load list
+ 'permut' : permut items in list
+ 'delete' : delete the item in list
+ */
+ var doc = document.getElementById("isections");
+
+ action_todo='';
+ if(do_action=='position')
+ {
+ action_todo='sections_position&fItem='+item+'&fPosition='+position;
+ }
+ else if(do_action=='showhide')
+ {
+ action_todo='sections_showhide&fItem='+item;
+ }
+ else
+ {
+ action_todo='sections_list';
+ }
+
+ if(action_todo!='')
+ {
+ http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
+ http_request.send(null);
+ doc.innerHTML=http_request.responseText;
+ }
+ }
+
+</script>
+{/literal}
+
+
+<h3>
+{foreach from=$datas.LIST item=data}
+ {$data.separator}
+ {if $data.link!=''}
+ <span style="font-weight:normal"><a href="{$data.link}" title="{$data.label|@translate}">
+ {/if}
+ {$data.label|@translate}
+ {if $data.link!=''}
+ </a></span>
+ {/if}
+{/foreach}
+</h3>
+
+<div id="isections"></div>
+
+
+<script type="text/javascript">
+ load_list('list', 0, 0);
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_sectionsmod_detail.tpl b/plugins/AMenuManager/admin/amm_sectionsmod_detail.tpl
new file mode 100644
index 000000000..dcaf625f6
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_sectionsmod_detail.tpl
@@ -0,0 +1,17 @@
+
+{if isset($datas.LIST) and count($datas.LIST)}
+ <table class="table2 littlefont">
+ <tr class="throw">
+ <th>{'g002_labelmenu'|@translate}</th>
+ <th>{'g002_visible'|@translate}</th>
+ </tr>
+
+ {foreach from=$datas.LIST key=name item=data}
+ <tr>
+ <td>{$data.LABEL|@translate}</td>
+ <td style="text-align:center;"><a style="cursor:pointer;" onclick="load_list('showhide', '{$data.ID}', '')">{$data.VISIBLE|@translate}</a></td>
+ </tr>
+ {/foreach}
+
+ </table>
+{/if}
diff --git a/plugins/AMenuManager/amm.sql b/plugins/AMenuManager/amm.sql
deleted file mode 100644
index ab9c2f2b1..000000000
--- a/plugins/AMenuManager/amm.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-
--- *************************************************************** -- EOQ
--- * SQL export made with Grum Plugins Classes (Export tool r1.3) -- EOQ
--- * Export date :2008-08-02 02:51:37 -- EOQ
--- * Export options : [drop] [create] [insert] -- EOQ
--- *************************************************************** -- EOQ
-
-
-
--- *************************************************************** -- EOQ
--- * Statements for piwigo_amm_urls table -- EOQ
--- *************************************************************** -- EOQ
-DROP TABLE `piwigo_amm_urls`; -- EOQ
-CREATE TABLE `piwigo_amm_urls` (
- `id` int(11) NOT NULL auto_increment,
- `label` varchar(50) NOT NULL default '',
- `url` varchar(255) NOT NULL default '',
- `mode` int(11) NOT NULL default '0',
- `icon` varchar(50) NOT NULL default '',
- `position` int(11) NOT NULL default '0',
- `visible` char(1) NOT NULL default 'y',
- PRIMARY KEY (`id`),
- KEY `order_key` (`position`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- EOQ
-INSERT INTO `piwigo_amm_urls` VALUES('1', 'Test', 'http://192.168.1.1', '0', 'internet.png', '0', 'y'); -- EOQ
diff --git a/plugins/AMenuManager/amm_aip.class.inc.php b/plugins/AMenuManager/amm_aip.class.inc.php
index de0901eac..9fd5ce1cb 100755
--- a/plugins/AMenuManager/amm_aip.class.inc.php
+++ b/plugins/AMenuManager/amm_aip.class.inc.php
@@ -20,9 +20,11 @@ include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php');
class AMM_AIP extends AMM_root
{
+ protected $google_translate;
protected $tabsheet;
protected $css; //the css object
protected $ajax;
@@ -51,6 +53,7 @@ class AMM_AIP extends AMM_root
$this->page_link.'&amp;fAMM_tabsheet=personnalblock');
$this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
$this->ajax = new Ajax();
+ $this->google_translate = new translate();
}
@@ -115,7 +118,8 @@ class AMM_AIP extends AMM_root
}
else
{
- $this->display_links_manage_page($_REQUEST['action']);
+ ($_REQUEST['action']=='modify')?$urlid=$_REQUEST['fItem']:$urlid=0;
+ $this->display_links_manage_page($_REQUEST['action'], $urlid);
}
break;
case 'config':
@@ -123,7 +127,7 @@ class AMM_AIP extends AMM_root
{
if(!$this->adviser_abort())
{
- $this->action_modify_config();
+ $this->action_links_modify_config();
}
}
$this->display_links_config_page();
@@ -133,15 +137,46 @@ class AMM_AIP extends AMM_root
elseif($_REQUEST['fAMM_tabsheet']=='randompict')
{
$page_nfo=l10n('g002_randompict_nfo');
+ if($post_action=='config')
+ {
+ if(!$this->adviser_abort())
+ {
+ $this->action_randompic_modify_config();
+ }
+ }
+ $this->display_randompic_config_page();
}
elseif($_REQUEST['fAMM_tabsheet']=='personnalblock')
{
$page_nfo=l10n('g002_personnalblock_nfo');
+
+ switch($_REQUEST['action'])
+ {
+ case 'list':
+ $this->display_personalised_list_page();
+ break;
+ case 'create':
+ case 'modify':
+ if($post_action==$_REQUEST['action'])
+ {
+ if(!$this->adviser_abort())
+ {
+ $this->action_create_modify_personalised();
+ }
+ $this->display_personalised_list_page();
+ }
+ else
+ {
+ ($_REQUEST['action']=='modify')?$sectionid=$_REQUEST['fItem']:$sectionid=0;
+ $this->display_personalised_manage_page($_REQUEST['action'], $sectionid);
+ }
+ break;
+ }
}
elseif($_REQUEST['fAMM_tabsheet']=='setmenu')
{
$page_nfo=l10n('g002_setmenu_nfo');
- $this->display_sections_list_page();
+ $this->display_sections_list_page($_REQUEST['action']);
}
$template->assign('page_nfo', $page_nfo);
@@ -184,14 +219,35 @@ class AMM_AIP extends AMM_root
case 'links_delete':
$result=$this->ajax_amm_links_delete($_REQUEST['fItem']);
break;
- case 'sections_list':
- $result=$this->ajax_amm_section_list();
+ case 'setmenu_list_sections_list':
+ $result=$this->ajax_amm_setmenu_list_section_list();
+ break;
+ case 'setmenu_list_sections_position':
+ $result=$this->ajax_amm_setmenu_list_section_position($_REQUEST['fItem'], $_REQUEST['fPosition']);
+ break;
+ case 'setmenu_list_sections_showhide':
+ $result=$this->ajax_amm_setmenu_list_section_showhide($_REQUEST['fItem']);
+ break;
+
+ case 'setmenu_modmenu_sections_list':
+ $result=$this->ajax_amm_setmenu_mod_section_list('amm_sections_modmenu');
+ break;
+ case 'setmenu_modmenu_sections_showhide':
+ $result=$this->ajax_amm_setmenu_mod_section_showhide('amm_sections_modmenu', $_REQUEST['fItem']);
+ break;
+
+ case 'setmenu_modspecial_sections_list':
+ $result=$this->ajax_amm_setmenu_mod_section_list('amm_sections_modspecial');
+ break;
+ case 'setmenu_modspecial_sections_showhide':
+ $result=$this->ajax_amm_setmenu_mod_section_showhide('amm_sections_modspecial', $_REQUEST['fItem']);
break;
- case 'sections_position':
- $result=$this->ajax_amm_section_position($_REQUEST['fItem'], $_REQUEST['fPosition']);
+
+ case 'personalised_list':
+ $result=$this->ajax_amm_personalised_list();
break;
- case 'sections_showhide':
- $result=$this->ajax_amm_section_showhide($_REQUEST['fItem']);
+ case 'personalised_delete':
+ $result=$this->ajax_amm_personalised_delete($_REQUEST['fItem']);
break;
}
//$template->
@@ -210,7 +266,9 @@ class AMM_AIP extends AMM_root
$_REQUEST['fAMM_tabsheet']='setmenu';
}
- if(($_REQUEST['fAMM_tabsheet']=='links') and !isset($_REQUEST['action']))
+ if((($_REQUEST['fAMM_tabsheet']=='links') or
+ ($_REQUEST['fAMM_tabsheet']=='personnalblock') or
+ ($_REQUEST['fAMM_tabsheet']=='setmenu')) and !isset($_REQUEST['action']))
{
$_REQUEST['action']='list';
}
@@ -268,7 +326,8 @@ class AMM_AIP extends AMM_root
'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
'show_icons_selected' => $this->my_config['amm_links_show_icons'],
'active_selected' => $this->my_config['amm_links_active'],
- 'lang_selected' => $user['language']
+ 'lang_selected' => $user['language'],
+ 'fromlang' => substr($user['language'],0,2)
);
$template_datas['language_list'] = array();
@@ -327,7 +386,7 @@ class AMM_AIP extends AMM_root
$template_datas=array(
'id' => $urlid,
'modeedit' => 'modify',
- 'label' => $url['label'],
+ 'label' => htmlentities($url['label'], ENT_QUOTES, 'UTF-8'),
'url' => $url['url'],
'icons_selected' => $url['icon'],
'mode_selected' => $url['mode'],
@@ -397,29 +456,176 @@ class AMM_AIP extends AMM_root
/*
manage urls config save into database
*/
- protected function action_modify_config()
+ protected function action_links_modify_config()
{
$this->my_config['amm_links_show_icons']=$_POST['famm_links_show_icons'];
$this->my_config['amm_links_active']=$_POST['famm_links_active'];
$languages=get_languages();
foreach($languages as $key => $val)
{
- $this->my_config['amm_links_title'][$key]=base64_encode(stripslashes($_POST['famm_links_title_'.$key]));
+ $this->my_config['amm_links_title'][$key]=base64_encode($_POST['famm_links_title_'.$key]);
}
$this->save_config();
}
/*
+ manage randompic config save into database
+ */
+ protected function action_randompic_modify_config()
+ {
+ $this->my_config['amm_randompicture_active']=$_POST['famm_randompicture_active'];
+ $this->my_config['amm_randompicture_showname']=$_POST['famm_randompicture_showname'];
+ $this->my_config['amm_randompicture_showcomment']=$_POST['famm_randompicture_showcomment'];
+ $languages=get_languages();
+ foreach($languages as $key => $val)
+ {
+ $this->my_config['amm_randompicture_title'][$key]=base64_encode(stripslashes($_POST['famm_randompicture_title_'.$key]));
+ }
+ $this->save_config();
+ }
+
+
+
+ /*
manage display for sections table page
*/
- private function display_sections_list_page()
+ private function display_sections_list_page($action)
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_sections.tpl');
+
+ switch($action)
+ {
+ case 'list':
+ $tmp_list=array(
+ array('separator' => '', 'link' => '', 'label' => 'g002_sectionslist'),
+ array('separator' => ' / ', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=modmenu', 'label' => 'g002_modmenu'),
+ array('separator' => ' / ', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=modspecial', 'label' => 'g002_modspecial')
+ );
+ break;
+ case 'modmenu':
+ $tmp_list=array(
+ array('separator' => '', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=list', 'label' => 'g002_sectionslist'),
+ array('separator' => ' / ', 'link' => '', 'label' => 'g002_modmenu'),
+ array('separator' => ' / ', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=modspecial', 'label' => 'g002_modspecial')
+ );
+ break;
+ case 'modspecial':
+ $tmp_list=array(
+ array('separator' => '', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=list', 'label' => 'g002_sectionslist'),
+ array('separator' => ' / ', 'link' => $this->page_link.'&amp;fAMM_tabsheet=setmenu&amp;action=modmenu', 'label' => 'g002_modmenu'),
+ array('separator' => ' / ', 'link' => '', 'label' => 'g002_modspecial')
+ );
+ break;
+ }
+
+ $template_datas=array(
+ 'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=setmenu_".$action."_",
+ 'LIST' => $tmp_list
+ );
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+
+ /*
+ manage display for randompic config page
+ */
+ private function display_randompic_config_page()
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_randompicconfig.tpl');
+
+ $template_datas=array(
+ 'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links',
+ 'active_selected' => $this->my_config['amm_randompicture_active'],
+ 'showname_selected' => $this->my_config['amm_randompicture_showname'],
+ 'showcomment_selected' => $this->my_config['amm_randompicture_showcomment'],
+ 'lang_selected' => $user['language'],
+ 'fromlang' => substr($user['language'],0,2)
+ );
+
+ $template_datas['language_list'] = array();
+ foreach($this->my_config['amm_randompicture_title'] as $key => $val)
+ {
+ $template_datas['language_list'][] = array(
+ 'LANG' => $key,
+ 'MENUBARTIT' => htmlentities(base64_decode($val), ENT_QUOTES, 'UTF-8')
+ );
+ }
+
+
+
+ $lang=get_languages();
+ foreach($lang as $key => $val)
+ {
+ $template_datas['language_list_values'][] = $key;
+ $template_datas['language_list_labels'][] = $val;
+ }
+
+
+ $template_datas['yesno_values'] = array('y','n');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_y');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_n');
+
+ $template_datas['show_values'] = array('n', 'o', 'u');
+ $template_datas['show_labels'][] = l10n('g002_show_n');
+ $template_datas['show_labels'][] = l10n('g002_show_o');
+ $template_datas['show_labels'][] = l10n('g002_show_u');
+
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+
+
+
+
+
+
+ /*
+ manage display for personalised sections list page
+ */
+ private function display_personalised_list_page()
{
global $template, $user;
$template->set_filename('body_page',
- dirname($this->filelocation).'/admin/amm_sectionslist.tpl');
+ dirname($this->filelocation).'/admin/amm_personalisedlist.tpl');
+
+ $sql="SELECT COUNT(DISTINCT ID) as countid FROM ".$this->tables['personalised'];
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $tmp=mysql_fetch_row($result);
+ $tmp=$tmp[0];
+ }
+ else
+ {
+ $tmp=0;
+ }
+
+ if($tmp==0)
+ {
+ $tmp=l10n("g002_nosections");
+ }
+ elseif($tmp==1)
+ {
+ $tmp="1 ".l10n("g002_section");
+ }
+ else
+ {
+ $tmp=$tmp." ".l10n("g002_sections");
+ }
+
$template_datas=array(
+ 'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=create',
'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
+ 'nbsections' => $tmp
);
$template->assign("datas", $template_datas);
@@ -428,6 +634,117 @@ class AMM_AIP extends AMM_root
+ /*
+ manage display for personalised sections create/modify page
+ */
+ private function display_personalised_manage_page($modeedit = 'create', $sectionid=0)
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_personalisedlist_edit.tpl');
+
+ $template_datas=array();
+
+ $lang=get_languages();
+ $lang['all']=l10n('g002_all_languages');
+ foreach($lang as $key => $val)
+ {
+ $template_datas['language_list_values'][] = $key;
+ $template_datas['language_list_labels'][] = $val;
+ $template_datas['language_list'][$key]=array(
+ 'LANG' => $key,
+ 'MENUBARTIT' => '',
+ 'MENUBARCONTENT' => ''
+ );
+ }
+
+
+ if($modeedit=='modify')
+ {
+ $sections=$this->get_personalised($sectionid);
+
+ $template_datas['id'] = $sectionid;
+ $template_datas['modeedit'] = 'modify';
+ $template_datas['visible_selected'] = $sections[0]['visible'];
+ $template_datas['nfo'] = htmlentities($sections[0]['nfo'], ENT_QUOTES, 'UTF-8');
+
+ foreach($sections as $key => $val)
+ {
+ $lang=($val['lang']=='*')?'all':$val['lang'];
+ $template_datas['language_list'][$lang] = array(
+ 'LANG' => $lang,
+ 'MENUBARTIT' => htmlentities($val['title'], ENT_QUOTES, 'UTF-8'),
+ 'MENUBARCONTENT' => htmlentities($val['content'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+ }
+ else
+ {
+ $template_datas['nfo'] = '';
+ $template_datas['id'] = '';
+ $template_datas['modeedit'] = 'create';
+ $template_datas['visible_selected'] = 'y';
+ }
+
+ $template_datas['lang_selected'] = $user['language'];
+
+ $template_datas['personalised_list'] = $this->page_link.'&amp;fAMM_tabsheet=personnalblock';
+ $template_datas['yesno_values'] = array('y','n');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_y');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_n');
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+ /*
+ manage create/modify pesonalised sections into database and display result
+ */
+ protected function action_create_modify_personalised()
+ {
+ global $menu, $user;
+
+ if($_POST['famm_modeedit']=='create')
+ {
+ $id=$this->get_personalised_id();
+ }
+ else
+ {
+ $id=$_POST['famm_id'];
+ }
+ $languages=get_languages();
+ $languages['all']='*';
+ foreach($languages as $key => $val)
+ {
+ $datas=array(
+ 'id' => $id,
+ 'lang' => ($key=='all')?'*':$key,
+ 'visible' => $_POST['famm_personalised_visible'],
+ 'nfo' => ($_POST['famm_personalised_nfo']=='')?$_POST['famm_personalised_title_'.$user['language']]:$_POST['famm_personalised_nfo'],
+ 'title' => $_POST['famm_personalised_title_'.$key],
+ 'content' => $_POST['famm_personalised_content_'.$key]
+ );
+ switch($_POST['famm_modeedit'])
+ {
+ case 'create':
+ $this->add_personalised($datas);
+ break;
+ case 'modify':
+ $this->modify_personalised($datas);
+ }
+ }
+
+ if($_POST['famm_modeedit']=='create')
+ {
+ $menu->register('mbAMM_personalised'.$id, ($_POST['famm_personalised_nfo']=='')?$_POST['famm_personalised_title_'.$user['language']]:$_POST['famm_personalised_nfo'], 0, 'AMM');
+ }
+
+
+
+ }
+
+
+
/*
@@ -460,6 +777,7 @@ class AMM_AIP extends AMM_root
if($result)
{
$returned=mysql_fetch_array($result);
+ //$returned['label']=stripslashes($returned['label']);
}
return($returned);
}
@@ -495,7 +813,7 @@ class AMM_AIP extends AMM_root
{
$numurl=$this->get_count_url();
$sql="INSERT INTO ".$this->tables['urls']." (id, label, url, mode, icon, position, visible)
- VALUES ('', '".addslashes($datas['label'])."', '".$datas['url']."', '".$datas['mode']."',
+ VALUES ('', '".$datas['label']."', '".$datas['url']."', '".$datas['mode']."',
'".$datas['icon']."', '".$numurl."', '".$datas['visible']."')";
return(pwg_query($sql));
}
@@ -503,7 +821,7 @@ class AMM_AIP extends AMM_root
// modify an url
private function modify_url($datas)
{
- $sql="UPDATE ".$this->tables['urls']." SET label = '".addslashes($datas['label'])."',
+ $sql="UPDATE ".$this->tables['urls']." SET label = '".$datas['label']."',
url = '".$datas['url']."', mode = '".$datas['mode']."', icon = '".$datas['icon']."',
visible = '".$datas['visible']."'
WHERE id = '".$datas['id']."'";
@@ -518,6 +836,67 @@ class AMM_AIP extends AMM_root
return(pwg_query($sql));
}
+ /* ---------------------------------------------------------------------------
+ functions to manage sections tables
+ --------------------------------------------------------------------------- */
+ // protected function get_sections($only_visible=false, $lang="")
+ // => defined in root class
+
+ // return properties of a given section (return each languages)
+ private function get_personalised($section_id)
+ {
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['personalised']." WHERE id = '".$section_id."'";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($returned[]=mysql_fetch_array($result));
+ }
+ return($returned);
+ }
+
+ // delete a section
+ private function delete_personalised($section_id)
+ {
+ $sql="DELETE FROM ".$this->tables['personalised']." WHERE id = '".$section_id."' ";
+ return(pwg_query($sql));
+ }
+
+ // add a section
+ private function add_personalised($datas)
+ {
+ $sql="INSERT INTO ".$this->tables['personalised']." (id, lang, title, content, visible, nfo)
+ VALUES ('".$datas['id']."', '".$datas['lang']."', '".$datas['title']."', '".$datas['content']."', '".$datas['visible']."', '".$datas['nfo']."')";
+ return(pwg_query($sql));
+ }
+
+ // modify a section
+ private function modify_personalised($datas)
+ {
+ $sql="UPDATE ".$this->tables['personalised']." SET title = '".$datas['title']."',
+ content = '".$datas['content']."', visible = '".$datas['visible']."',
+ nfo = '".$datas['nfo']."'
+ WHERE id = '".$datas['id']."'
+ AND lang = '".$datas['lang']."'";
+ return(pwg_query($sql));
+ }
+
+ // return the next personalised id
+ private function get_personalised_id()
+ {
+ $sql='SELECT MAX(ID) FROM '.$this->tables['personalised'];
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $row=mysql_fetch_row($result);
+ if(is_array($row))
+ {
+ return($row[0]+1);
+ }
+ }
+ return(0);
+ }
+
/* ---------------------------------------------------------------------------
ajax functions
@@ -582,7 +961,7 @@ class AMM_AIP extends AMM_root
// return a html formatted list of menu's sections
- private function ajax_amm_section_list()
+ private function ajax_amm_setmenu_list_section_list()
{
global $menu;
$local_tpl = new Template(AMM_PATH."admin/", "");
@@ -614,28 +993,117 @@ class AMM_AIP extends AMM_root
}
// move item to the specified position
- private function ajax_amm_section_position($urlid, $position)
+ private function ajax_amm_setmenu_list_section_position($urlid, $position)
{
global $menu;
$menu->register_position($urlid, $position);
- return($this->ajax_amm_section_list());
+ return($this->ajax_amm_setmenu_list_section_list());
}
- // move item to the specified position
- private function ajax_amm_section_showhide($urlid)
+ // show/hide item to the specified position
+ private function ajax_amm_setmenu_list_section_showhide($urlid)
+ {
+ $switchvisible=array('y'=>'n', 'n'=>'y');
+
+ $this->my_config['amm_sections_visible'][$urlid]=$switchvisible[$this->my_config['amm_sections_visible'][$urlid]];
+ $this->save_config();
+
+ return($this->ajax_amm_setmenu_list_section_list());
+ }
+
+ // return a html formatted list of personalised sections
+ private function ajax_amm_personalised_list()
+ {
+ global $template, $user;
+ $local_tpl = new Template(AMM_PATH."admin/", "");
+ $local_tpl->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_personalisedlist_detail.tpl');
+
+ $template_datas['sections']=array();
+
+ $sections=$this->get_sections(false, '', false);
+ $is_done=array();
+ foreach($sections as $key => $val)
+ {
+ if(!isset($is_done[$val['id']]))
+ {
+ $template_datas['sections'][]=array(
+ 'title' => ($val['title']!='')?$val['title']:l10n('g002_notitle'),
+ 'edit' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=modify&amp;fItem='.$val['id'],
+ 'ID' => $val['id'],
+ 'visible' => l10n('g002_yesno_'.$val['visible']),
+ 'nfo' => $val['nfo']
+ );
+ $is_done[$val['id']]='';
+ }
+ }
+
+ $themeconf=array(
+ 'icon_dir' => $template->get_themeconf('icon_dir')
+ );
+
+ $local_tpl->assign('themeconf', $themeconf);
+ $local_tpl->assign('datas', $template_datas);
+ $local_tpl->assign('plugin', array('PATH' => AMM_PATH));
+
+ return($local_tpl->parse('body_page', true));
+ }
+
+ // delete a section and returns a html formatted list
+ private function ajax_amm_personalised_delete($sectionid)
{
global $menu;
+ if(!$this->adviser_abort())
+ {
+ $this->delete_personalised($sectionid);
+ $menu->unregister('mbAMM_personalised'.$sectionid);
+ }
+ return($this->ajax_amm_personalised_list());
+ }
+
+
+
+
+ // return a html formatted list of special menu sections items
+ private function ajax_amm_setmenu_mod_section_list($menuname)
+ {
+ $local_tpl = new Template(AMM_PATH."admin/", "");
+ $local_tpl->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_sectionsmod_detail.tpl');
+
+ $template_datas = array('LIST' => array());
+ foreach($this->my_config[$menuname] as $key => $val)
+ {
+ $template_datas['LIST'][] = array(
+ 'ID' => base64_encode($key),
+ 'LABEL' => $key,
+ 'VISIBLE' => 'g002_yesno_'.$val
+ );
+ }
+
+ $local_tpl->assign('datas', $template_datas);
+ $local_tpl->assign('plugin', array('PATH' => AMM_PATH));
+
+ return($local_tpl->parse('body_page', true));
+ }
+
+
+ // move item to the specified position
+ private function ajax_amm_setmenu_mod_section_showhide($menuname, $urlid)
+ {
$switchvisible=array('y'=>'n', 'n'=>'y');
- $this->my_config['amm_sections_visible'][$urlid]=$switchvisible[$this->my_config['amm_sections_visible'][$urlid]];
+ $this->my_config[$menuname][base64_decode($urlid)]=$switchvisible[$this->my_config[$menuname][base64_decode($urlid)]];
$this->save_config();
- return($this->ajax_amm_section_list());
+ return($this->ajax_amm_setmenu_mod_section_list($menuname));
}
+
+
} // AMM_AIP class
diff --git a/plugins/AMenuManager/amm_install.class.inc.php b/plugins/AMenuManager/amm_install.class.inc.php
index 4a71d1b14..2f2bb9e47 100644
--- a/plugins/AMenuManager/amm_install.class.inc.php
+++ b/plugins/AMenuManager/amm_install.class.inc.php
@@ -47,8 +47,18 @@
`visible` char(1) NOT NULL default 'y',
PRIMARY KEY (`id`),
KEY `order_key` (`position`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['personalised']."` (
+ `id` int(11) NOT NULL default '0',
+ `lang` varchar(5) NOT NULL default '',
+ `title` varchar(50) NOT NULL default '',
+ `content` text NOT NULL,
+ `visible` char(1) NOT NULL default 'y',
+ `nfo` varchar(25) NOT NULL default '',
+ PRIMARY KEY (`id`,`lang`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1"
- );
+);
//$table_def array
$result=$this->tablef->create_tables($tables_def);
diff --git a/plugins/AMenuManager/amm_pip.class.inc.php b/plugins/AMenuManager/amm_pip.class.inc.php
index 57ba0db78..dc34e1d84 100644
--- a/plugins/AMenuManager/amm_pip.class.inc.php
+++ b/plugins/AMenuManager/amm_pip.class.inc.php
@@ -49,7 +49,6 @@ class AMM_PIP extends AMM_root
global $menu, $user;
-
/*
Add a new section (links)
*/
@@ -67,11 +66,72 @@ class AMM_PIP extends AMM_root
$section = new Section('mbAMM_links', base64_decode($this->my_config['amm_links_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_links.tpl');
$section->set_items(array(
'LINKS' => $urls,
- 'icons' => 'y'
+ 'icons' => $this->my_config['amm_links_show_icons']
));
$menu->add($section->get());
}
+
+ /*
+ Add a new random picture section
+ */
+ if($this->my_config['amm_randompicture_active']=='y')
+ {
+ $sql="SELECT i.id as image_id, i.file as image_file, i.comment, i.path, i.tn_ext, c.id as catid, c.name, c.permalink, RAND() as rndvalue, i.name as imgname
+FROM ".CATEGORIES_TABLE." c, ".IMAGES_TABLE." i, ".IMAGE_CATEGORY_TABLE." ic
+WHERE c.status='public'
+ AND c.id = ic.category_id
+ AND ic.image_id = i.id
+ORDER BY rndvalue
+LIMIT 0,1
+";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $nfo = mysql_fetch_array($result);
+ $nfo['section']='category';
+ $nfo['category']=array(
+ 'id' => $nfo['catid'],
+ 'name' => $nfo['name'],
+ 'permalink' => $nfo['permalink']
+ );
+
+ $section = new Section('mbAMM_randompict', base64_decode($this->my_config['amm_randompicture_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_randompic.tpl');
+ $section->set_items(array(
+ 'LINK' => make_picture_url($nfo),
+ 'IMG' => get_thumbnail_url($nfo),
+ 'IMGNAME' => $nfo['imgname'],
+ 'IMGCOMMENT' => $nfo['comment'],
+ 'SHOWNAME' => $this->my_config['amm_randompicture_showname'],
+ 'SHOWCOMMENT' => $this->my_config['amm_randompicture_showcomment']
+ ));
+ $menu->add($section->get());
+ }
+ }
+
+ /*
+ Add personnal blocks random picture section
+ */
+ $sections=$this->get_sections(true);
+
+ if(count($sections))
+ {
+ $id_done=array();
+ foreach($sections as $key => $val)
+ {
+ if(!isset($id_done[$val['id']]))
+ {
+ $section = new Section('mbAMM_personalised'.$val['id'], $val['title'], dirname(__FILE__).'/menu_templates/menubar_personalised.tpl');
+ $section->set_items(array(
+ 'CONTENT' => stripslashes($val['content'])));
+ $menu->add($section->get());
+
+ $id_done[$val['id']]="";
+ }
+ }
+ }
+
+
/*
Hide sections
*/
@@ -83,6 +143,22 @@ class AMM_PIP extends AMM_root
}
}
+ /*
+ hide items from special & menu sections
+ */
+ foreach(array('mbMenu' => 'amm_sections_modmenu', 'mbSpecial' =>'amm_sections_modspecial') as $key0 => $val0)
+ {
+ $section_menu=$menu->section($key0);
+ foreach($this->my_config[$val0] as $key => $val)
+ {
+ if($val=='n')
+ {
+ unset($section_menu['ITEMS'][$key]);
+ }
+ }
+ $menu->replace($section_menu);
+ }
+
}
diff --git a/plugins/AMenuManager/amm_root.class.inc.php b/plugins/AMenuManager/amm_root.class.inc.php
index 50d9742e2..2dfa604e0 100644
--- a/plugins/AMenuManager/amm_root.class.inc.php
+++ b/plugins/AMenuManager/amm_root.class.inc.php
@@ -26,7 +26,7 @@ class AMM_root extends common_plugin
$this->plugin_name_files="amm";
parent::__construct($prefixeTable, $filelocation);
- $list=array('urls');
+ $list=array('urls', 'personalised');
$this->set_tables_list($list);
}
@@ -43,7 +43,28 @@ class AMM_root extends common_plugin
'amm_links_show_icons' => 'y',
'amm_links_active' => 'y',
'amm_links_title' => array(),
- 'amm_sections_visible' => array()
+ 'amm_sections_visible' => array(),
+ 'amm_randompicture_active' => 'n',
+ 'amm_randompicture_showname' => 'n', //n:no, o:over, u:under
+ 'amm_randompicture_showcomment' => 'n', //n:no, o:over, u:under
+ 'amm_randompicture_title' => array(),
+ 'amm_sections_modspecial' => array(
+ 'favorite_cat' => 'y',
+ 'most_visited_cat' => 'y',
+ 'best_rated_cat' => 'y',
+ 'random_cat' => 'y',
+ 'recent_pics_cat' => 'y',
+ 'recent_cats_cat' => 'y',
+ 'calendar' => 'y'
+ ),
+ 'amm_sections_modmenu' => array(
+ 'qsearch' => 'y',
+ 'Tags' => 'y',
+ 'Search' => 'y',
+ 'comments' => 'y',
+ 'About' => 'y',
+ 'Notification' => 'y'
+ )
);
$languages=get_languages();
@@ -51,11 +72,13 @@ class AMM_root extends common_plugin
{
if($key=='fr_FR')
{
- $this->my_config['amm_links_title'][$key]='Liens';
+ $this->my_config['amm_links_title'][$key]=base64_encode('Liens');
+ $this->my_config['amm_randompicture_title'][$key]=base64_encode('Une image au hasard');
}
else
{
- $this->my_config['amm_links_title'][$key]='Links';
+ $this->my_config['amm_links_title'][$key]=base64_encode('Links');
+ $this->my_config['amm_randompicture_title'][$key]=base64_encode('A random picture');
}
}
@@ -66,6 +89,22 @@ class AMM_root extends common_plugin
}
}
+ public function load_config()
+ {
+ global $menu;
+
+ parent::load_config();
+
+ $sections=$menu->registered();
+ foreach($sections as $key => $val)
+ {
+ if(!isset($this->my_config['amm_sections_visible'][$key]))
+ {
+ $this->my_config['amm_sections_visible'][$key]='y';
+ }
+ }
+
+ }
// return an array of urls (each url is an array)
protected function get_urls($only_visible=false)
@@ -82,6 +121,7 @@ class AMM_root extends common_plugin
{
while($row=mysql_fetch_array($result))
{
+ $row['label']=stripslashes($row['label']);
$returned[]=$row;
}
}
@@ -106,6 +146,40 @@ class AMM_root extends common_plugin
return($returned);
}
+ // return an array of sections (each section is an array)
+ protected function get_sections($only_visible=false, $lang="", $only_with_content=true)
+ {
+ global $user;
+
+ if($lang=="")
+ {
+ $lang=$user['language'];
+ }
+
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['personalised']."
+WHERE (lang = '*' OR lang = '".$lang."') ";
+ if($only_visible)
+ {
+ $sql.=" AND visible = 'y' ";
+ }
+ if($only_with_content)
+ {
+ $sql.=" AND content != '' ";
+ }
+ $sql.=" ORDER BY id, lang DESC ";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_array($result))
+ {
+ $returned[]=$row;
+ }
+ }
+ return($returned);
+ }
+
+
} // amm_root class
diff --git a/plugins/AMenuManager/language/en_UK/plugin.lang.php b/plugins/AMenuManager/language/en_UK/plugin.lang.php
index 79b1bdd11..a0514fe2c 100755
--- a/plugins/AMenuManager/language/en_UK/plugin.lang.php
+++ b/plugins/AMenuManager/language/en_UK/plugin.lang.php
@@ -38,11 +38,12 @@ $lang['g002_createthelink'] = 'Add link';
$lang['g002_editthelink'] = 'Edit link';
$lang['g002_configlinks'] = 'Links settings';
-$lang['g002_setting_link_block_menu'] = 'Menu integration';
$lang['g002_setting_link_links']='Links';
$lang['g002_setting_link_show_icon'] = 'Display links representative picture';
-$lang['g002_setting_link_block_active'] = 'Display block in menu';
-$lang['g002_setting_link_block_title'] = 'Block title';
+
+$lang['g002_setting_block_menu'] = 'Menu integration';
+$lang['g002_setting_block_active'] = 'Display block in menu';
+$lang['g002_setting_block_title'] = 'Block title';
$lang['g002_apply'] = 'Apply';
$lang['g002_sectionslist'] = 'Menu\'s blocks';
@@ -54,5 +55,35 @@ $lang['g002_owner'] = 'Owner';
$lang['g002_sectionid'] = 'Identifier';
$lang['g002_name'] = 'Label';
+$lang['g002_translate'] = 'Translate with Google Translate';
+
+$lang['g002_configrandompic'] = 'Random picture settings';
+$lang['g002_setting_randompic_aboutpicture'] = 'Displayed datas';
+$lang['g002_setting_randompic_showname'] = 'Show picture\'s name';
+$lang['g002_setting_randompic_showcomment'] = 'Show picure\'s comment';
+$lang['g002_show_n'] = 'No';
+$lang['g002_show_o'] = 'Display over the picture';
+$lang['g002_show_u'] = 'Display under thpicture';
+
+$lang['g002_personalisedlist'] = "Liste of personalised blocks";
+$lang['g002_notitle'] = '[No title]';
+$lang['g002_title'] = 'Title';
+$lang['g002_sections'] = 'blocks';
+$lang['g002_section'] = 'block';
+$lang['g002_nosections'] = 'No blocks';
+$lang['g002_addsection'] = 'Add a new block';
+$lang['g002_createofpersonalised'] = 'Create a new personalized block';
+$lang['g002_editofpersonalised'] = 'Modify a personalized block';
+$lang['g002_setting_block_langchoice'] = 'Lang choice';
+$lang['g002_setting_personalised_content'] = 'Block\'s content';
+$lang['g002_setting_personalised_properties'] = 'Properties';
+$lang['g002_setting_personalised_nfo'] = 'Description';
+
+$lang['g002_all_languages'] = "All languages";
+
+$lang['g002_modmenu'] = '\'menu\' block';
+$lang['g002_modspecial'] = '\'special\' block';
+$lang['g002_labelmenu'] = 'Menu\'s label';
+
?>
diff --git a/plugins/AMenuManager/language/fr_FR/plugin.lang.php b/plugins/AMenuManager/language/fr_FR/plugin.lang.php
index 828bf9d98..27b32e611 100755
--- a/plugins/AMenuManager/language/fr_FR/plugin.lang.php
+++ b/plugins/AMenuManager/language/fr_FR/plugin.lang.php
@@ -15,7 +15,7 @@ $lang['g002_personnalblock'] = 'Menu personnalisé';
$lang['g002_setmenu_nfo'] = 'Gestion de l\'affichage des sections affichées dans le menu';
$lang['g002_addlinks_nfo'] = 'Section permettant d\'afficher dans le menu une liste d\'hyperliens vers d\'autres sites internet';
$lang['g002_randompict_nfo'] = 'Section permettant d\'afficher dans le menu une image prise au hasard dans la gallerie';
-$lang['g002_personnalblock_nfo'] = 'Afficher dans le menu des sections au contenu personnalisés';
+$lang['g002_personnalblock_nfo'] = 'Afficher dans le menu des sections au contenu personnalisé';
$lang['g002_mode_new_window'] = 'Nouvelle fenêtre';
@@ -38,11 +38,12 @@ $lang['g002_createthelink'] = 'Ajouter le lien';
$lang['g002_editthelink'] = 'Modifier le lien';
$lang['g002_configlinks'] = 'Configuration des liens';
-$lang['g002_setting_link_block_menu'] = 'Intégration dans le menu';
$lang['g002_setting_link_links']='Liens';
$lang['g002_setting_link_show_icon'] = 'Afficher les icônes de liens';
-$lang['g002_setting_link_block_active'] = 'Afficher la section dans le menu';
-$lang['g002_setting_link_block_title'] = 'Titre de la section dans le menu';
+
+$lang['g002_setting_block_menu'] = 'Intégration dans le menu';
+$lang['g002_setting_block_active'] = 'Afficher la section dans le menu';
+$lang['g002_setting_block_title'] = 'Titre de la section dans le menu';
$lang['g002_apply'] = 'Appliquer';
$lang['g002_sectionslist'] = 'Sections du menu';
@@ -54,5 +55,34 @@ $lang['g002_owner'] = 'Propriétaire';
$lang['g002_sectionid'] = 'Identifiant';
$lang['g002_name'] = 'Libellé';
+$lang['g002_translate'] = 'Traduire avec Google Translate';
+
+$lang['g002_configrandompic'] = 'Configuration de l\'image aléatoire';
+$lang['g002_setting_randompic_aboutpicture'] = 'Données affichées';
+$lang['g002_setting_randompic_showname'] = 'Afficher le nom de la photo';
+$lang['g002_setting_randompic_showcomment'] = 'Afficher le commentaire de la photo';
+$lang['g002_show_n'] = 'Non';
+$lang['g002_show_o'] = 'Afficher au-dessus de la photo';
+$lang['g002_show_u'] = 'Afficher en-dessous de la photo';
+
+$lang['g002_personalisedlist'] = "Liste des sections personnalisées";
+$lang['g002_notitle'] = '[Pas de titre]';
+$lang['g002_title'] = 'Titre';
+$lang['g002_sections'] = 'sections';
+$lang['g002_section'] = 'section';
+$lang['g002_nosections'] = 'Pas de sections';
+$lang['g002_addsection'] = 'Ajouter une section';
+$lang['g002_createofpersonalised'] = 'Ajout d\'une section personnalisée';
+$lang['g002_editofpersonalised'] = 'Modification d\'une section personnalisée';
+$lang['g002_setting_block_langchoice'] = 'Choix de la langue';
+$lang['g002_setting_personalised_content'] = 'Contenu de la section';
+$lang['g002_setting_personalised_properties'] = 'Propriétés';
+$lang['g002_setting_personalised_nfo'] = 'Description';
+
+$lang['g002_all_languages'] = "Toutes langues";
+
+$lang['g002_modspecial'] = 'Section \'speciale\'';
+$lang['g002_modmenu'] = 'Section \'menu\'';
+$lang['g002_labelmenu'] = 'Libellé du menu';
?>
diff --git a/plugins/AMenuManager/menu_templates/menubar_personalised.tpl b/plugins/AMenuManager/menu_templates/menubar_personalised.tpl
new file mode 100644
index 000000000..93c3b860b
--- /dev/null
+++ b/plugins/AMenuManager/menu_templates/menubar_personalised.tpl
@@ -0,0 +1,8 @@
+
+<!-- personalised menu bar -->
+{if $section.NAME!=""}
+ <dt>{$section.NAME|@translate}</dt>
+{/if}
+<dd>
+ {if $section.ITEMS.CONTENT!=""}{$section.ITEMS.CONTENT}{/if}
+</dd> \ No newline at end of file
diff --git a/plugins/AMenuManager/menu_templates/menubar_randompic.tpl b/plugins/AMenuManager/menu_templates/menubar_randompic.tpl
new file mode 100644
index 000000000..a79206103
--- /dev/null
+++ b/plugins/AMenuManager/menu_templates/menubar_randompic.tpl
@@ -0,0 +1,14 @@
+
+<!-- random picture menu bar -->
+{if $section.NAME!=""}
+ <dt>{$section.NAME|@translate}</dt>
+{/if}
+<dd>
+ <div class="illustration" style="text-align:center;padding:5px;font-size:85%;">
+ {if $section.ITEMS.IMGNAME!="" and $section.ITEMS.SHOWNAME=="o"}{$section.ITEMS.IMGNAME}<br/>{/if}
+ {if $section.ITEMS.IMGCOMMENT!="" and $section.ITEMS.SHOWCOMMENT=="o"}{$section.ITEMS.IMGCOMMENT}<br/>{/if}
+ <a href="{$section.ITEMS.LINK}"><img src="{$section.ITEMS.IMG}"/></a>
+ {if $section.ITEMS.IMGNAME!="" and $section.ITEMS.SHOWNAME=="u"}<br/>{$section.ITEMS.IMGNAME}{/if}
+ {if $section.ITEMS.IMGCOMMENT!="" and $section.ITEMS.SHOWCOMMENT=="u"}<br/>{$section.ITEMS.IMGCOMMENT}{/if}
+ </div>
+</dd> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/google_translate.js b/plugins/grum_plugins_classes-2/google_translate.js
index 2798150e2..98b5507f5 100755
--- a/plugins/grum_plugins_classes-2/google_translate.js
+++ b/plugins/grum_plugins_classes-2/google_translate.js
@@ -12,7 +12,8 @@
------------------------------------------------------------------------------
HISTORY VERSION
- v2.0.0 +
+ v2.0.0 + adapted for piwigo
+ + add of a 5th&6th parameters for the google_translate function
-------------------------------------------------------------------------- */
@@ -21,15 +22,57 @@
var global_google_translate_plugin_objdest;
var global_google_translate_plugin_objproperty;
+ var global_google_translate_plugin_objcallback;
+ var global_google_translate_plugin_objcallback_param;
function google_translate(text, pfrom, pto, objdest, objproperty)
{
+ /*
+ ** args needed **
+ 1st arg : text to translate
+ 2nd arg : translate from lang ("en", "fr", "es", ...)
+ 3rd arg : translate to lang ("en", "fr", "es", ...)
+ 4th arg : target of result (id)
+ 5th arg : affected propertie ('value' or 'innerHTML')
+ ** facultative args **
+ 6th arg : pointer on a function definition (callback is made when
+ translation is done ; notice that translation is made asynchronous)
+ 7th arg : arg for the callback (or array of arg if callbakc need more than
+ one parameter)
+ */
+ if(arguments.length>=6)
+ {
+ global_google_translate_plugin_objcallback=arguments[5];
+ }
+ else
+ {
+ global_google_translate_plugin_objcallback=null;
+ }
+
+ if(arguments.length>=7)
+ {
+ if(arguments[6].pop)
+ {
+ global_google_translate_plugin_objcallback_param=arguments[6];
+ }
+ else
+ {
+ global_google_translate_plugin_objcallback_param=new Array(arguments[6]);
+ }
+ }
+ else
+ {
+ global_google_translate_plugin_objcallback_param=null;
+ }
+
+
global_google_translate_plugin_objdest = objdest;
global_google_translate_plugin_objproperty = objproperty;
google.language.translate(text, pfrom, pto, google_translate_do);
}
+
function google_translate_do(result)
{
if (!result.error)
@@ -42,6 +85,17 @@
{
global_google_translate_plugin_objdest.innerHTML = result.translation;
}
+ if(global_google_translate_plugin_objcallback!=null)
+ {
+ if(global_google_translate_plugin_objcallback_param!=null)
+ {
+ global_google_translate_plugin_objcallback.apply(null, global_google_translate_plugin_objcallback_param);
+ }
+ else
+ {
+ global_google_translate_plugin_objcallback();
+ }
+ }
}
}
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',