source: extensions/AMenuManager/admin/amm_sections.tpl @ 8970

Last change on this file since 8970 was 5421, checked in by grum, 15 years ago

Update the plugin for compatibility with Piwigo 2.1 and fix some bugs
feature 1384, feature 1476, feature 1541

  • Property svn:executable set to *
File size: 4.4 KB
Line 
1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
2{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.sortable.packed.js"}
3
4<div id="containerMenu">
5  {foreach from=$sections item=sectionName key=section}
6  <div id="containerMenu_{$section}" class="containerMenuSection">
7    <h3>{$sectionName|@translate}</h3>
8    <ul class="connectedSortable categoryUl" id="menu_{$section}">
9    {foreach from=$items item=data key=id}
10      {if $data.container==$section}
11        <li class="categoryLi menuItem {if $id=='qsearch'}menuItemDisabled{/if}" id="i{$id}">
12          {if $id=="qsearch"}
13          {else}
14          <img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}"/>
15          {/if}
16          {$data.translation|@translate}
17          <a  onclick="switchVisibility('i{$id}_visibility');">
18          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/permissions.png"  class="button drag_button" alt="{'g002_click_to_manage_rights'|@translate}" title="{'g002_click_to_manage_rights'|@translate}"
19                style="float:right;"/></a>
20          <div id="i{$id}_visibility" class="visibility">
21            {$data.visibilityForm}
22          </div>
23        </li>
24      {/if}
25    {/foreach}
26    </ul>
27  </div>
28  {/foreach}
29  <br/>
30  <input type="button" value="{'g002_cancel'|@translate}" onclick="resetMenu('cancel');"/>
31  <input type="button" value="{'g002_piwigo_default'|@translate}" onclick="resetMenu('default');"/>
32  <p><input type="button" value="{'g002_apply_changes'|@translate}" onclick="submitChanges();"></p>
33  <form id="submitForm" method="POST" action="">
34    <input type="hidden" name="fList" id="iList" value=""/>
35  </form>
36</div>
37
38
39{literal}
40<script type="text/javascript">
41
42  var resetValues = new Array(new Array(), new Array());
43
44  {/literal}
45
46  // initialization for cancel et reset functions
47  {foreach from=$defaultValues item=value key=id}
48    resetValues[0].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order}, visibility:"{$value.visibility}" {literal} } {/literal} );
49  {/foreach}
50  {foreach from=$items item=value key=id}
51    resetValues[1].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order}, visibility:"{$value.visibility}" {literal} } {/literal} );
52  {/foreach}
53  {literal}
54
55  $("#containerMenu").sortable(
56    {
57      connectWith: '.connectedSortable',
58      cursor: 'move',
59      opacity:0.6,
60      items: 'li:not(.menuItemDisabled)',
61      tolerance:'pointer'
62    }
63  );
64
65  function resetMenu(mode)
66  {
67    (mode=='default')?key=0:key=1;
68
69    for(i=0;i<resetValues[key].length;i++)
70    {
71      $("#menu_"+resetValues[key][i].section).get(0).appendChild($("#i"+resetValues[key][i].id).get(0));
72
73      {/literal}
74      {foreach from=$visibility.users item=value}
75      $("#i"+resetValues[key][i].id+"_vis_user_{$value.id}").get(0).checked=/(.*,|^){$value.id}(?!\w)(\/)?/.test(resetValues[key][i].visibility);
76      {/foreach}
77
78      {foreach from=$visibility.groups item=value}
79      $("#i"+resetValues[key][i].id+"_vis_group_{$value.id}").get(0).checked=/(\/.*,|\/){$value.id}(?!\w)(\/)?/.test(resetValues[key][i].visibility);
80      {/foreach}
81      {literal}
82
83    }
84  }
85
86  function submitChanges()
87  {
88    datas="";
89
90    items=$("#menu_menu").children();
91    for(i=0;i<items.length;i++)
92    {
93      datas+=items.get(i).id.substr(1)+",menu,"+i+"#"+makeVisibility(items.get(i).id)+";";
94    }
95
96    items=$("#menu_special").children();
97    for(i=0;i<items.length;i++)
98    {
99      datas+=items.get(i).id.substr(1)+",special,"+i+"#"+makeVisibility(items.get(i).id)+";";
100    }
101
102    $("#iList").val(datas);
103    $("#submitForm").get(0).submit();
104  }
105
106  function switchVisibility(id)
107  {
108    if($("#"+id).css('display')!='none')
109    {
110      $("#"+id).css({display:'none'});
111    }
112    else
113    {
114      $("#"+id).css({display:'block'});
115    }
116  }
117
118  function makeVisibility(id)
119  {
120    {/literal}
121    returned="";
122    {foreach from=$visibility.users item=value}
123    returned+=($("#"+id+"_vis_user_{$value.id}").get(0).checked)?((returned=="")?"":",")+"{$value.id}":"";
124    {/foreach}
125
126    returned2="";
127    {foreach from=$visibility.groups item=value}
128    returned2+=($("#"+id+"_vis_group_{$value.id}").get(0).checked)?((returned2=="")?"":",")+"{$value.id}":"";
129    {/foreach}
130    {literal}
131
132    return(returned+"/"+returned2);
133  }
134
135</script>
136{/literal}
Note: See TracBrowser for help on using the repository browser.