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

Last change on this file since 31482 was 16006, checked in by grum, 12 years ago

feature:2642- compatibility with Piwigo 2.4

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