1 | {footer_script} |
---|
2 | {literal} |
---|
3 | $(document).ready(function() { |
---|
4 | $('.groups input').change(function () { $(this).parent('p').toggleClass('group_select'); }); |
---|
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 ) { |
---|
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 class="groups"> |
---|
70 | {if not empty($groups)} |
---|
71 | {foreach from=$groups item=group name=group_loop} |
---|
72 | <li> |
---|
73 | <label><p>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i><input class="group_selection" name="group_selection[]" type="checkbox" value="{$group.ID}"></p></label> |
---|
74 | <p class="list_user">{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 | <a class="buttonLike group_perm" href="{$group.U_PERM}" title="{'Permissions'|@translate}">{'Manage Permissions'|@translate}</a> |
---|
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="toggle_default">{'Toggle \'default group\' property'|@translate}</option> |
---|
94 | {if !empty($element_set_groupe_plugins_actions)} |
---|
95 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
96 | <option value="{$action.ID}">{$action.NAME}</option> |
---|
97 | {/foreach} |
---|
98 | {/if} |
---|
99 | </select> |
---|
100 | |
---|
101 | <!-- rename --> |
---|
102 | <div id="action_rename" class="bulkAction"> |
---|
103 | {if not empty($groups)} |
---|
104 | {foreach from=$groups item=group} |
---|
105 | <p group_id="{$group.ID}" class="grp_action"> |
---|
106 | <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;"> |
---|
107 | </p> |
---|
108 | {/foreach} |
---|
109 | {/if} |
---|
110 | </div> |
---|
111 | |
---|
112 | <!-- merge --> |
---|
113 | <div id="action_merge" class="bulkAction"> |
---|
114 | <p id="two_to_select">{'Please select at least two groups'|@translate}</p> |
---|
115 | {assign var='mergeDefaultValue' value='Type here the name of the new group'|@translate} |
---|
116 | <p id="two_atleast"> |
---|
117 | <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;"> |
---|
118 | </p> |
---|
119 | </div> |
---|
120 | |
---|
121 | <!-- delete --> |
---|
122 | <div id="action_delete" class="bulkAction"> |
---|
123 | <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p> |
---|
124 | </div> |
---|
125 | |
---|
126 | <!-- duplicate --> |
---|
127 | <div id="action_duplicate" class="bulkAction"> |
---|
128 | {assign var='duplicateDefaultValue' value='Type here the name of the new group'|@translate} |
---|
129 | {if not empty($groups)} |
---|
130 | {foreach from=$groups item=group} |
---|
131 | <p group_id="{$group.ID}" class="grp_action"> |
---|
132 | {$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;"> |
---|
133 | </p> |
---|
134 | {/foreach} |
---|
135 | {/if} |
---|
136 | </div> |
---|
137 | |
---|
138 | <!-- toggle_default --> |
---|
139 | <div id="action_toggle_default" class="bulkAction"> |
---|
140 | {if not empty($groups)} |
---|
141 | {foreach from=$groups item=group} |
---|
142 | <p group_id="{$group.ID}" class="grp_action"> |
---|
143 | {$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} |
---|
144 | </p> |
---|
145 | {/foreach} |
---|
146 | {/if} |
---|
147 | </div> |
---|
148 | |
---|
149 | |
---|
150 | <!-- plugins --> |
---|
151 | {if !empty($element_set_groupe_plugins_actions)} |
---|
152 | {foreach from=$element_set_groupe_plugins_actions item=action} |
---|
153 | <div id="action_{$action.ID}" class="bulkAction"> |
---|
154 | {if !empty($action.CONTENT)}{$action.CONTENT}{/if} |
---|
155 | </div> |
---|
156 | {/foreach} |
---|
157 | {/if} |
---|
158 | |
---|
159 | <p id="applyActionBlock" style="display:none" class="actionButtons"> |
---|
160 | <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p> |
---|
161 | </div> <!-- #permitAction --> |
---|
162 | </fieldset> |
---|
163 | </form> |
---|
164 | </form> |
---|