1 | {footer_script} |
---|
2 | {literal} |
---|
3 | $(document).ready(function() { |
---|
4 | |
---|
5 | $(".grp_action").hide(); |
---|
6 | $("input.group_selection").click(function() { |
---|
7 | |
---|
8 | var nbSelected = 0; |
---|
9 | nbSelected = $("input.group_selection").filter(':checked').length; |
---|
10 | |
---|
11 | if (nbSelected == 0) { |
---|
12 | $("#permitAction").hide(); |
---|
13 | $("#forbidAction").show(); |
---|
14 | } |
---|
15 | else { |
---|
16 | $("#permitAction").show(); |
---|
17 | $("#forbidAction").hide(); |
---|
18 | } |
---|
19 | $("p[group_id="+$(this).prop("value")+"]").each(function () { |
---|
20 | $(this).toggle(); |
---|
21 | }); |
---|
22 | |
---|
23 | if (nbSelected<2) { |
---|
24 | $("#two_to_select").show(); |
---|
25 | $("#two_atleast").hide(); |
---|
26 | } |
---|
27 | else { |
---|
28 | $("#two_to_select").hide(); |
---|
29 | $("#two_atleast").show(); |
---|
30 | } |
---|
31 | }); |
---|
32 | $("[id^=action_]").hide(); |
---|
33 | $("select[name=selectAction]").change(function () { |
---|
34 | $("[id^=action_]").hide(); |
---|
35 | $("#action_"+$(this).prop("value")).show(); |
---|
36 | if ($(this).val() != -1 && $(this).val() !="manage_pemissions" && $(this).val() !="manage_members" ) { |
---|
37 | $("#applyActionBlock").show(); |
---|
38 | } |
---|
39 | else { |
---|
40 | $("#applyActionBlock").hide(); |
---|
41 | } |
---|
42 | }); |
---|
43 | }); |
---|
44 | |
---|
45 | {/literal} |
---|
46 | {/footer_script} |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | <div class="titrePage"> |
---|
51 | <h2>{'Group management'|@translate}</h2> |
---|
52 | </div> |
---|
53 | |
---|
54 | <form method="post" name="add_user" action="{$F_ADD_ACTION}" class="properties"> |
---|
55 | <fieldset> |
---|
56 | <legend>{'Add group'|@translate}</legend> |
---|
57 | <span class="property"> |
---|
58 | <label for="groupname">{'Group name'|@translate}</label> |
---|
59 | </span> |
---|
60 | <input type="text" id="groupname" name="groupname" maxlength="50" size="20"> |
---|
61 | <input type="submit" name="submit_add" value="{'Add'|@translate}"> |
---|
62 | <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> |
---|
63 | |
---|
64 | </fieldset> |
---|
65 | </form> |
---|
66 | <form method="post" name="add_user" action="{$F_ADD_ACTION}" class="properties"> |
---|
67 | <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> |
---|
68 | |
---|
69 | <ul style="text-align:center;"> |
---|
70 | {if not empty($groups)} |
---|
71 | {foreach from=$groups item=group name=group_loop} |
---|
72 | <li style="vertical-align: middle;position: relative;display: inline-block;text-align: left;background-color: #ccc;height: 300px; width: 250px; margin: 5px"> |
---|
73 | <p style="text-align: left;"><label>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i><input class="group_selection" name="group_selection[]" type="checkbox" value="{$group.ID}"></label></p> |
---|
74 | <p style="text-align: left;max-height: 200px;overflow: auto;">{if $group.MEMBERS>0}<a href="{$group.U_MEMBERS}" title="{'Manage the members'|@translate}">{$group.MEMBERS}</a><br>{$group.L_MEMBERS}{else}{$group.MEMBERS}{/if}</p> |
---|
75 | <p style="text-align: left;position: absolute;bottom: 0"><a class="buttonLike" href="{$group.U_PERM}" title="{'Permissions'|@translate}">{'Manage Permissions'|@translate}</a></p> |
---|
76 | </li> |
---|
77 | {/foreach} |
---|
78 | {/if} |
---|
79 | </ul> |
---|
80 | |
---|
81 | <fieldset id="action"> |
---|
82 | <legend>{'Action'|@translate}</legend> |
---|
83 | <div id="forbidAction">{'No group selected, no action possible.'|@translate}</div> |
---|
84 | <div id="permitAction" style="display:none"> |
---|
85 | |
---|
86 | <select name="selectAction"> |
---|
87 | <option value="-1">{'Choose an action'|@translate}</option> |
---|
88 | <option disabled="disabled">------------------</option> |
---|
89 | <option value="rename">{'Rename'|@translate}</option> |
---|
90 | <option value="delete">{'Delete'|@translate}</option> |
---|
91 | <option value="merge">{'Merge selected groups'|@translate}</option> |
---|
92 | <option value="duplicate">{'Duplicate'|@translate}</option> |
---|
93 | <option value="manage_members">{'Manage the members'|@translate}</option> |
---|
94 | <option value="manage_pemissions">{'Manage Permissions'|@translate}</option> |
---|
95 | <option value="toggle_default">{'Toggle \'default group\' property'|@translate}</option> |
---|
96 | {if !empty($element_set_groupe_plugins_actions)} |
---|
97 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
98 | <option value="{$action.ID}">{$action.NAME}</option> |
---|
99 | {/foreach} |
---|
100 | {/if} |
---|
101 | </select> |
---|
102 | |
---|
103 | <!-- rename --> |
---|
104 | <div id="action_rename" class="bulkAction"> |
---|
105 | {if not empty($groups)} |
---|
106 | {foreach from=$groups item=group} |
---|
107 | <p group_id="{$group.ID}" class="grp_action"> |
---|
108 | <input type="text" class="large" name="rename_{$group.ID}" value="{$group.NAME}" onfocus="this.value=(this.value=='{$group.NAME}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$group.NAME}' : this.value;"> |
---|
109 | </p> |
---|
110 | {/foreach} |
---|
111 | {/if} |
---|
112 | </div> |
---|
113 | |
---|
114 | <!-- merge --> |
---|
115 | <div id="action_merge" class="bulkAction"> |
---|
116 | <p id="two_to_select">{'Please select at least two groups'|@translate}</p> |
---|
117 | {assign var='mergeDefaultValue' value='Type here the name of the new group'|@translate} |
---|
118 | <p id="two_atleast"> |
---|
119 | <input type="text" class="large" name="merge" value="{$mergeDefaultValue}" onfocus="this.value=(this.value=='{$mergeDefaultValue}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$mergeDefaultValue}' : this.value;"> |
---|
120 | </p> |
---|
121 | </div> |
---|
122 | |
---|
123 | <!-- delete --> |
---|
124 | <div id="action_delete" class="bulkAction"> |
---|
125 | <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p> |
---|
126 | </div> |
---|
127 | |
---|
128 | <!-- duplicate --> |
---|
129 | <div id="action_duplicate" class="bulkAction"> |
---|
130 | {assign var='duplicateDefaultValue' value='Type here the name of the new group'|@translate} |
---|
131 | {if not empty($groups)} |
---|
132 | {foreach from=$groups item=group} |
---|
133 | <p group_id="{$group.ID}" class="grp_action"> |
---|
134 | {$group.NAME} > <input type="text" class="large" name="duplicate_{$group.ID}" value="{$duplicateDefaultValue}" onfocus="this.value=(this.value=='{$duplicateDefaultValue}') ? '' : this.value;" onblur="this.value=(this.value=='') ? '{$duplicateDefaultValue}' : this.value;"> |
---|
135 | </p> |
---|
136 | {/foreach} |
---|
137 | {/if} |
---|
138 | </div> |
---|
139 | |
---|
140 | <!-- manage_members --> |
---|
141 | <div id="action_manage_members" class="bulkAction"> |
---|
142 | {if not empty($groups)} |
---|
143 | {foreach from=$groups item=group} |
---|
144 | <p group_id="{$group.ID}" class="grp_action"> |
---|
145 | {$group.NAME} > {if $group.NB_MEMBERS!=0}<a class="buttonLike" href="{$group.U_MEMBERS}" title="{'Manage the members'|@translate}">{'Manage the members'|@translate}</a>{else}{'No members to manage'|@translate}{/if} |
---|
146 | </p> |
---|
147 | {/foreach} |
---|
148 | {/if} |
---|
149 | </div> |
---|
150 | |
---|
151 | <!-- manage_pemissions --> |
---|
152 | <div id="action_manage_pemissions" class="bulkAction"> |
---|
153 | {if not empty($groups)} |
---|
154 | {foreach from=$groups item=group} |
---|
155 | <p group_id="{$group.ID}" class="grp_action"> |
---|
156 | {$group.NAME} > <a class="buttonLike" href="{$group.U_PERM}" title="{'Permissions'|@translate}">{'Manage Permissions'|@translate}</a> |
---|
157 | </p> |
---|
158 | {/foreach} |
---|
159 | {/if} |
---|
160 | </div> |
---|
161 | |
---|
162 | <!-- toggle_default --> |
---|
163 | <div id="action_toggle_default" class="bulkAction"> |
---|
164 | {if not empty($groups)} |
---|
165 | {foreach from=$groups item=group} |
---|
166 | <p group_id="{$group.ID}" class="grp_action"> |
---|
167 | {$group.NAME} > {if empty($group.IS_DEFAULT)}{'This group will be set to default'|@translate}{else}{'This group will be unset to default'|@translate}{/if} |
---|
168 | </p> |
---|
169 | {/foreach} |
---|
170 | {/if} |
---|
171 | </div> |
---|
172 | |
---|
173 | |
---|
174 | <!-- plugins --> |
---|
175 | {if !empty($element_set_groupe_plugins_actions)} |
---|
176 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
177 | <div id="action_{$action.ID}" class="bulkAction"> |
---|
178 | {if !empty($action.CONTENT)}{$action.CONTENT}{/if} |
---|
179 | </div> |
---|
180 | {/foreach} |
---|
181 | {/if} |
---|
182 | |
---|
183 | <p id="applyActionBlock" style="display:none" class="actionButtons"> |
---|
184 | <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p> |
---|
185 | </div> <!-- #permitAction --> |
---|
186 | </fieldset> |
---|
187 | </form> |
---|
188 | </form> |
---|