Changeset 19230 for trunk


Ignore:
Timestamp:
Nov 29, 2012, 6:23:37 PM (11 years ago)
Author:
flop25
Message:

bug:2425
New interface like the Batch Mananger : select menu and js to handle the actions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/group_list.tpl

    r18976 r19230  
     1{footer_script}
     2{literal}
     3$(document).ready(function() {
     4
     5  $(".grp_action").hide();
     6  $("input[name=group_selection]").click(function() {
     7
     8    var nbSelected = 0;
     9    nbSelected = $("input[name=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) {
     37      $("#applyActionBlock").show();
     38    }
     39    else {
     40      $("#applyActionBlock").hide();
     41    }
     42  });
     43});
     44
     45{/literal}
     46{/footer_script}
     47
     48
     49
    150<div class="titrePage">
    251  <h2>{'Group management'|@translate}</h2>
     
    1564  </fieldset>
    1665</form>
    17 
    18 <table class="table2">
    19   <tr class="throw">
    20     <th>{'Group name'|@translate}</th>
    21     <th>{'Members'|@translate}</th>
    22     <th>{'Actions'|@translate}</th>
    23   </tr>
    24   {if not empty($groups)}
    25   {foreach from=$groups item=group name=group_loop}
    26   <tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}">
    27     <td>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i></td>
    28     <td><a href="{$group.U_MEMBERS}">{$group.MEMBERS}</a></td>
    29     <td style="text-align:center;">
    30       <a href="{$group.U_PERM}">
    31         <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/permissions.png" style="border:none" alt="{'Permissions'|@translate}" title="{'Permissions'|@translate}"></a>
    32       <a href="{$group.U_DELETE}" onclick="return confirm('{'delete'|@translate|@escape:'javascript'}'
    33                                 + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
    34         <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" style="border:none" alt="{'Delete'|@translate}" title="{'Delete'|@translate}"></a>
    35       <a href="{$group.U_ISDEFAULT}" onclick="return confirm('{'Toggle \'default group\' property'|@translate|@escape:'javascript'}'
    36                                 +'\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
    37         <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/toggle_is_default_group.png" style="border:none" alt="{'Toggle \'default group\' property'|@translate}" title="{'Toggle \'default group\' property'|@translate}"></a>
    38     </td>
    39   </tr>
    40   {/foreach}
    41   {/if}
    42 </table>
     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      <th>{'Actions'|@translate}</th>
     75    </tr>
     76    {if not empty($groups)}
     77    {foreach from=$groups item=group name=group_loop}
     78    <tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}">
     79      <td><input name="group_selection" type="checkbox" value="{$group.ID}"></td>
     80      <td>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i></td>
     81      <td><a href="{$group.U_MEMBERS}">{$group.MEMBERS}</a></td>
     82      <td style="text-align:center;">
     83        <a href="{$group.U_PERM}">
     84          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/permissions.png" style="border:none" alt="{'Permissions'|@translate}" title="{'Permissions'|@translate}"></a>
     85        <a href="{$group.U_DELETE}" onclick="return confirm('{'delete'|@translate|@escape:'javascript'}'
     86          + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
     87          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" style="border:none" alt="{'Delete'|@translate}" title="{'Delete'|@translate}"></a>
     88        <a href="{$group.U_ISDEFAULT}" onclick="return confirm('{'Toggle \'default group\' property'|@translate|@escape:'javascript'}'
     89          +'\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
     90          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/toggle_is_default_group.png" style="border:none" alt="{'Toggle \'default group\' property'|@translate}" title="{'Toggle \'default group\' property'|@translate}"></a>
     91      </td>
     92    </tr>
     93    {/foreach}
     94    {/if}
     95  </table>
     96 
     97  <fieldset id="action">
     98    <legend>{'Action'|@translate}</legend>
     99      <div id="forbidAction"{if count($selection) != 0} style="display:none"{/if}>{'No group selected, no action possible.'|@translate}</div>
     100      <div id="permitAction"{if count($selection) == 0} style="display:none"{/if}>
     101
     102        <select name="selectAction">
     103          <option value="-1">{'Choose an action'|@translate}</option>
     104          <option disabled="disabled">------------------</option>
     105          <option value="rename">{'Rename'|@translate}</option>
     106          <option value="delete">{'Delete'|@translate}</option>
     107          <option value="merge">{'Merge selected groups'|@translate}</option>
     108          <option value="duplicate">{'Duplicate'|@translate}</option>
     109          <option value="manage_members">{'Manage the members'|@translate}</option>
     110          <option value="manage_pemissions">{'Manage permissions'|@translate}</option>
     111          <option value="toggle_default">{'Toggle \'default group\' property'|@translate}</option>
     112      {if !empty($element_set_groupe_plugins_actions)}
     113        {foreach from=$element_set_groupe_plugins_actions item=action}
     114          <option value="{$action.ID}">{$action.NAME}</option>
     115        {/foreach}
     116      {/if}
     117        </select>
     118
     119        <!-- rename -->
     120        <div id="action_rename" class="bulkAction">
     121        {if not empty($groups)}
     122        {foreach from=$groups item=group}
     123        <p group_id="{$group.ID}" class="grp_action">
     124          <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;">
     125        </p>
     126        {/foreach}
     127        {/if}
     128        </div>
     129
     130        <!-- merge -->
     131        <div id="action_merge" class="bulkAction">
     132          <p id="two_to_select">{'Please select at least two groups'|@translate}</p>
     133          {assign var='mergeDefaultValue' value='Type here the name of the new group'|@translate}
     134          <p id="two_atleast">
     135            <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;">
     136          </p>
     137        </div>
     138
     139        <!-- delete -->
     140        <div id="action_delete" class="bulkAction">
     141        <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p>
     142        </div>
     143
     144        <!-- duplicate -->
     145        <div id="action_duplicate" class="bulkAction">
     146        {assign var='duplicateDefaultValue' value='Type here the name of the new group'|@translate}
     147        {if not empty($groups)}
     148        {foreach from=$groups item=group}
     149        <p group_id="{$group.ID}" class="grp_action">
     150          {$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;">
     151        </p>
     152        {/foreach}
     153        {/if}
     154        </div>
     155
     156        <!-- manage_members -->
     157        <div id="action_manage_members" 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} > {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}
     162        </p>
     163        {/foreach}
     164        {/if}
     165        </div>
     166
     167        <!-- manage_pemissions -->
     168        <div id="action_manage_pemissions" 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} > <a href="{$group.U_PERM}" title="{'Permissions'|@translate}">{'Manage permissions'|@translate}</a>
     173        </p>
     174        {/foreach}
     175        {/if}
     176        </div>
     177
     178        <!-- toggle_default -->
     179        <div id="action_toggle_default" class="bulkAction">
     180        {if not empty($groups)}
     181        {foreach from=$groups item=group}
     182        <p group_id="{$group.ID}" class="grp_action">
     183          {$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}
     184        </p>
     185        {/foreach}
     186        {/if}
     187        </div>
     188   
     189   
     190        <!-- plugins -->
     191    {if !empty($element_set_groupe_plugins_actions)}
     192      {foreach from=$element_set_groupe_plugins_actions item=action}
     193        <div id="action_{$action.ID}" class="bulkAction">
     194        {if !empty($action.CONTENT)}{$action.CONTENT}{/if}
     195        </div>
     196      {/foreach}
     197    {/if}
     198   
     199        <p id="applyActionBlock" style="display:none" class="actionButtons">
     200          <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span></p>
     201    </div> <!-- #permitAction -->
     202  </fieldset>
     203</form>
     204</form>
Note: See TracChangeset for help on using the changeset viewer.