source: trunk/admin/themes/default/template/cat_perm.tpl @ 28550

Last change on this file since 28550 was 28550, checked in by mistic100, 10 years ago

feature 3077 : factorize code for cache/selectize

  • Property svn:eol-style set to LF
File size: 6.0 KB
Line 
1{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
2
3{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
4{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"}
5
6{footer_script}
7(function(){
8{* <!-- GROUPS --> *}
9var groupsCache = new GroupsCache({
10  serverKey: '{$CACHE_KEYS.groups}',
11  serverId: '{$CACHE_KEYS._hash}',
12  rootUrl: '{$ROOT_URL}'
13});
14
15groupsCache.selectize(jQuery('[data-selectize=groups]'));
16
17{* <!-- USERS --> *}
18var usersCache = new UsersCache({
19  serverKey: '{$CACHE_KEYS.users}',
20  serverId: '{$CACHE_KEYS._hash}',
21  rootUrl: '{$ROOT_URL}'
22});
23
24usersCache.selectize(jQuery('[data-selectize=users]'));
25
26{* <!-- TOGGLES --> *}
27function checkStatusOptions() {
28  if (jQuery("input[name=status]:checked").val() == "private") {
29    jQuery("#privateOptions, #applytoSubAction").show();
30  }
31  else {
32    jQuery("#privateOptions, #applytoSubAction").hide();
33  }
34}
35
36checkStatusOptions();
37jQuery("#selectStatus").change(function() {
38  checkStatusOptions();
39});
40
41{if isset($nb_users_granted_indirect) && $nb_users_granted_indirect>0}
42  jQuery(".toggle-indirectPermissions").click(function(e){
43    jQuery(".toggle-indirectPermissions").toggle();
44    jQuery("#indirectPermissionsDetails").toggle();
45    e.preventDefault();
46  });
47{/if}
48}());
49{/footer_script}
50
51<div class="titrePage">
52  <h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> &#8250; {'Edit album'|@translate} {$TABSHEET_TITLE}</h2>
53</div>
54
55<form action="{$F_ACTION}" method="post" id="categoryPermissions">
56
57<fieldset>
58  <legend>{'Access type'|@translate}</legend>
59
60  <p id="selectStatus">
61    <label><input type="radio" name="status" value="public" {if not $private}checked="checked"{/if}> <strong>{'public'|@translate}</strong> : <em>{'any visitor can see this album'|@translate}</em></label>
62    <br>
63    <label><input type="radio" name="status" value="private" {if $private}checked="checked"{/if}> <strong>{'private'|@translate}</strong> : <em>{'visitors need to login and have the appropriate permissions to see this album'|@translate}</em></label>
64  </p>
65</fieldset>
66
67<fieldset id="privateOptions">
68  <legend>{'Groups and users'|@translate}</legend>
69
70  <p>
71{if count($groups) > 0}
72    <strong>{'Permission granted for groups'|@translate}</strong>
73    <br>
74    <select data-selectize="groups" data-value="{$groups_selected|@json_encode|escape:html}"
75        name="groups[]" multiple style="width:600px;"></select>
76{else}
77    {'There is no group in this gallery.'|@translate} <a href="admin.php?page=group_list" class="externalLink">{'Group management'|@translate}</a>
78{/if}
79  </p>
80
81  <p>
82    <strong>{'Permission granted for users'|@translate}</strong>
83    <br>
84    <select data-selectize="users" data-value="{$users_selected|@json_encode|escape:html}"
85        name="users[]" multiple style="width:600px;"></select>
86  </p>
87
88{if isset($nb_users_granted_indirect) && $nb_users_granted_indirect>0}
89  <p>
90    {'%u users have automatic permission because they belong to a granted group.'|@translate:$nb_users_granted_indirect}
91    <a href="#" class="toggle-indirectPermissions" style="display:none">{'hide details'|@translate}</a>
92    <a href="#" class="toggle-indirectPermissions">{'show details'|@translate}</a>
93
94    <ul id="indirectPermissionsDetails" style="display:none">
95  {foreach from=$user_granted_indirect_groups item=group_details}
96      <li><strong>{$group_details.group_name}</strong> : {$group_details.group_users}</li>
97  {/foreach}
98    </ul>
99  </p>
100{/if}
101
102{*
103  <h4>{'Groups'|@translate}</h4>
104
105  <fieldset>
106    <legend>{'Permission granted'|@translate}</legend>
107    <ul>
108      {foreach from=$group_granted_ids item=id}
109      <li><label><input type="checkbox" name="deny_groups[]" value="{$id}"> {$all_groups[$id]}</label></li>
110      {/foreach}
111    </ul>
112    <input class="submit" type="submit" name="deny_groups_submit" value="{'Deny selected groups'|@translate}">
113  </fieldset>
114
115  <fieldset>
116    <legend>{'Permission denied'|@translate}</legend>
117    <ul>
118      {foreach from=$group_denied_ids item=id}
119      <li><label><input type="checkbox" name="grant_groups[]" value="{$id}"> {$all_groups[$id]}</label></li>
120      {/foreach}
121    </ul>
122    <input class="submit" type="submit" name="grant_groups_submit" value="{'Grant selected groups'|@translate}">
123    <label><input type="checkbox" name="apply_on_sub">{'Apply to sub-albums'|@translate}</label>
124  </fieldset>
125
126  <h4>{'Users'|@translate}</h4>
127
128  <fieldset>
129    <legend>{'Permission granted'|@translate}</legend>
130    <ul>
131      {foreach from=$user_granted_direct_ids item=id}
132      <li><label><input type="checkbox" name="deny_users[]" value="{$id}"> {$all_users[$id]}</label></li>
133      {/foreach}
134    </ul>
135    <input class="submit" type="submit" name="deny_users_submit" value="{'Deny selected users'|@translate}">
136  </fieldset>
137
138  <fieldset>
139    <legend>{'Permission granted thanks to a group'|@translate}</legend>
140    {if isset($user_granted_indirects) }
141    <ul>
142      {foreach from=$user_granted_indirects item=user_group}
143      <li>{$user_group.USER} ({$user_group.GROUP})</li>
144      {/foreach}
145    </ul>
146    {/if}
147  </fieldset>
148
149  <fieldset>
150    <legend>{'Permission denied'|@translate}</legend>
151    <ul>
152      {foreach from=$user_denied_ids item=id}
153      <li><label><input type="checkbox" name="grant_users[]" value="{$id}"> {$all_users[$id]}</label></li>
154      {/foreach}
155    </ul>
156    <input class="submit" type="submit" name="grant_users_submit" value="{'Grant selected users'|@translate}">
157    <label><input type="checkbox" name="apply_on_sub">{'Apply to sub-albums'|@translate}</label>
158  </fieldset>
159*}
160</fieldset>
161
162  <p style="margin:12px;text-align:left;">
163    <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit">
164    <label id="applytoSubAction" style="display:none;">
165      <input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}>
166      {'Apply to sub-albums'|@translate}
167    </label>
168  </p>
169
170<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
171</form>
Note: See TracBrowser for help on using the repository browser.