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).attr("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).attr("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 | <table class="table2"> |
---|
70 | <tr class="throw"> |
---|
71 | <th></th> |
---|
72 | <th>{'Group name'|@translate}</th> |
---|
73 | <th>{'Members'|@translate}</th> |
---|
74 | </tr> |
---|
75 | {if not empty($groups)} |
---|
76 | {foreach from=$groups item=group name=group_loop} |
---|
77 | <tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}"> |
---|
78 | <td><input class="group_selection" name="group_selection[]" type="checkbox" value="{$group.ID}"></td> |
---|
79 | <td>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i></td> |
---|
80 | <td>{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}</td> |
---|
81 | </tr> |
---|
82 | {/foreach} |
---|
83 | {/if} |
---|
84 | </table> |
---|
85 | |
---|
86 | <fieldset id="action"> |
---|
87 | <legend>{'Action'|@translate}</legend> |
---|
88 | <div id="forbidAction">{'No group selected, no action possible.'|@translate}</div> |
---|
89 | <div id="permitAction" style="display:none"> |
---|
90 | |
---|
91 | <select name="selectAction"> |
---|
92 | <option value="-1">{'Choose an action'|@translate}</option> |
---|
93 | <option disabled="disabled">------------------</option> |
---|
94 | <option value="rename">{'Rename'|@translate}</option> |
---|
95 | <option value="delete">{'Delete'|@translate}</option> |
---|
96 | <option value="merge">{'Merge selected groups'|@translate}</option> |
---|
97 | <option value="duplicate">{'Duplicate'|@translate}</option> |
---|
98 | <option value="manage_members">{'Manage the members'|@translate}</option> |
---|
99 | <option value="manage_pemissions">{'Manage Permissions'|@translate}</option> |
---|
100 | <option value="toggle_default">{'Toggle \'default group\' property'|@translate}</option> |
---|
101 | {if !empty($element_set_groupe_plugins_actions)} |
---|
102 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
103 | <option value="{$action.ID}">{$action.NAME}</option> |
---|
104 | {/foreach} |
---|
105 | {/if} |
---|
106 | </select> |
---|
107 | |
---|
108 | <!-- rename --> |
---|
109 | <div id="action_rename" class="bulkAction"> |
---|
110 | {if not empty($groups)} |
---|
111 | {foreach from=$groups item=group} |
---|
112 | <p group_id="{$group.ID}" class="grp_action"> |
---|
113 | <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;"> |
---|
114 | </p> |
---|
115 | {/foreach} |
---|
116 | {/if} |
---|
117 | </div> |
---|
118 | |
---|
119 | <!-- merge --> |
---|
120 | <div id="action_merge" class="bulkAction"> |
---|
121 | <p id="two_to_select">{'Please select at least two groups'|@translate}</p> |
---|
122 | {assign var='mergeDefaultValue' value='Type here the name of the new group'|@translate} |
---|
123 | <p id="two_atleast"> |
---|
124 | <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;"> |
---|
125 | </p> |
---|
126 | </div> |
---|
127 | |
---|
128 | <!-- delete --> |
---|
129 | <div id="action_delete" class="bulkAction"> |
---|
130 | <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p> |
---|
131 | </div> |
---|
132 | |
---|
133 | <!-- duplicate --> |
---|
134 | <div id="action_duplicate" class="bulkAction"> |
---|
135 | {assign var='duplicateDefaultValue' value='Type here the name of the new group'|@translate} |
---|
136 | {if not empty($groups)} |
---|
137 | {foreach from=$groups item=group} |
---|
138 | <p group_id="{$group.ID}" class="grp_action"> |
---|
139 | {$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;"> |
---|
140 | </p> |
---|
141 | {/foreach} |
---|
142 | {/if} |
---|
143 | </div> |
---|
144 | |
---|
145 | <!-- manage_members --> |
---|
146 | <div id="action_manage_members" class="bulkAction"> |
---|
147 | {if not empty($groups)} |
---|
148 | {foreach from=$groups item=group} |
---|
149 | <p group_id="{$group.ID}" class="grp_action"> |
---|
150 | {$group.NAME} > {if $group.NB_MEMBERS!=0}<a href="{$group.U_MEMBERS}" title="{'Manage the members'|@translate}">{'Manage the members'|@translate}</a>{else}{'No members to manage'|@translate}{/if} |
---|
151 | </p> |
---|
152 | {/foreach} |
---|
153 | {/if} |
---|
154 | </div> |
---|
155 | |
---|
156 | <!-- manage_pemissions --> |
---|
157 | <div id="action_manage_pemissions" class="bulkAction"> |
---|
158 | {if not empty($groups)} |
---|
159 | {foreach from=$groups item=group} |
---|
160 | <p group_id="{$group.ID}" class="grp_action"> |
---|
161 | {$group.NAME} > <a href="{$group.U_PERM}" title="{'Permissions'|@translate}">{'Manage Permissions'|@translate}</a> |
---|
162 | </p> |
---|
163 | {/foreach} |
---|
164 | {/if} |
---|
165 | </div> |
---|
166 | |
---|
167 | <!-- toggle_default --> |
---|
168 | <div id="action_toggle_default" class="bulkAction"> |
---|
169 | {if not empty($groups)} |
---|
170 | {foreach from=$groups item=group} |
---|
171 | <p group_id="{$group.ID}" class="grp_action"> |
---|
172 | {$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} |
---|
173 | </p> |
---|
174 | {/foreach} |
---|
175 | {/if} |
---|
176 | </div> |
---|
177 | |
---|
178 | |
---|
179 | <!-- plugins --> |
---|
180 | {if !empty($element_set_groupe_plugins_actions)} |
---|
181 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
182 | <div id="action_{$action.ID}" class="bulkAction"> |
---|
183 | {if !empty($action.CONTENT)}{$action.CONTENT}{/if} |
---|
184 | </div> |
---|
185 | {/foreach} |
---|
186 | {/if} |
---|
187 | |
---|
188 | <p id="applyActionBlock" style="display:none" class="actionButtons"> |
---|
189 | <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p> |
---|
190 | </div> <!-- #permitAction --> |
---|
191 | </fieldset> |
---|
192 | </form> |
---|
193 | </form> |
---|