Index: /trunk/admin/group_list.php
===================================================================
--- /trunk/admin/group_list.php	(revision 19289)
+++ /trunk/admin/group_list.php	(revision 19290)
@@ -119,5 +119,5 @@
   // +
 
-  if ($action=="delete" and $_POST['confirm_deletion'])
+  if ($action=="delete" and isset($_POST['confirm_deletion']) and $_POST['confirm_deletion'])
   {
     foreach($groups as $group)
@@ -161,4 +161,86 @@
   }
 
+  // +
+  // |merge groups into a new one
+  // +
+
+  if ($action=="merge" )
+  {
+    // is the group not already existing ?
+    $query = '
+SELECT COUNT(*)
+  FROM '.GROUPS_TABLE.'
+  WHERE name = \''.pwg_db_real_escape_string($_POST['merge']).'\'
+;';
+    list($count) = pwg_db_fetch_row(pwg_query($query));
+    if ($count != 0)
+    {
+      array_push($page['errors'], l10n('This name is already used by another group.'));
+    }
+    else
+    {
+      // creating the group
+      $query = '
+  INSERT INTO '.GROUPS_TABLE.'
+    (name)
+    VALUES
+    (\''.pwg_db_real_escape_string($_POST['merge']).'\')
+  ;';
+      pwg_query($query);
+      $query = '
+      SELECT id
+        FROM '.GROUPS_TABLE.'
+        WHERE name = \''.pwg_db_real_escape_string($_POST['merge']).'\'
+      ;';
+      list($groupid) = pwg_db_fetch_row(pwg_query($query));
+    }
+    $grp_access = array();
+    $usr_grp = array();
+    foreach($groups as $group)
+    {
+      $query = '
+    SELECT *
+      FROM '.GROUP_ACCESS_TABLE.'
+      WHERE group_id = '.$group.'
+    ;';
+      $res=pwg_query($query);
+      while ($row = pwg_db_fetch_assoc($res))
+      {
+        $new_grp_access= array(
+          'cat_id' => $row['cat_id'],
+          'group_id' => $groupid
+        );
+        if (!in_array($new_grp_access,$grp_access))
+        {
+          $grp_access[]=$new_grp_access;
+        }
+      }
+
+      $query = '
+    SELECT *
+      FROM '.USER_GROUP_TABLE.'
+      WHERE group_id = '.$group.'
+    ;';
+      $res=pwg_query($query);
+      while ($row = pwg_db_fetch_assoc($res))
+      {
+        $new_usr_grp= array(
+          'user_id' => $row['user_id'],
+          'group_id' => $groupid
+        );
+        if (!in_array($new_usr_grp,$usr_grp))
+        {
+          $usr_grp[]=$new_usr_grp;
+        }
+      }
+    }
+    mass_inserts(USER_GROUP_TABLE, array('user_id','group_id'), $usr_grp);
+    mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $grp_access);
+    array_push(
+      $page['infos'],
+      sprintf(l10n('group "%s" added'), $_POST['merge'])
+      );
+  }
+  
   // +
   // |duplicate a group
@@ -304,10 +386,16 @@
 {
   $query = '
-SELECT COUNT(*)
-  FROM '.USER_GROUP_TABLE.'
-  WHERE group_id = '.$row['id'].'
+SELECT username
+  FROM '.USERS_TABLE.' AS u
+  INNER JOIN '.USER_GROUP_TABLE.' AS ug
+    ON u.'.$conf['user_fields']['id'].' = ug.user_id
+  WHERE ug.group_id = '.$row['id'].'
 ;';
-  list($counter) = pwg_db_fetch_row(pwg_query($query));
-  
+  $members=array();
+  $res=pwg_query($query);
+  while ($us= pwg_db_fetch_assoc($res))
+  {
+    $members[]=$us['username'];
+  }
   $template->append(
     'groups',
@@ -316,6 +404,7 @@
       'ID' => $row['id'],
       'IS_DEFAULT' => (get_boolean($row['is_default']) ? ' ['.l10n('default').']' : ''),
-      'NB_MEMBERS' => $counter,
-      'MEMBERS' => l10n_dec('%d member', '%d members', $counter),
+      'NB_MEMBERS' => count($members),
+      'L_MEMBERS' => implode(' - ', $members),
+      'MEMBERS' => l10n_dec('%d member', '%d members', count($members)),
       'U_MEMBERS' => $members_url.$row['id'],
       'U_DELETE' => $del_url.$row['id'].'&amp;pwg_token='.get_pwg_token(),
Index: /trunk/admin/themes/default/template/group_list.tpl
===================================================================
--- /trunk/admin/themes/default/template/group_list.tpl	(revision 19289)
+++ /trunk/admin/themes/default/template/group_list.tpl	(revision 19290)
@@ -72,5 +72,4 @@
       <th>{'Group name'|@translate}</th>
       <th>{'Members'|@translate}</th>
-      <th>{'Actions'|@translate}</th>
     </tr>
     {if not empty($groups)}
@@ -79,15 +78,5 @@
       <td><input class="group_selection" name="group_selection[]" type="checkbox" value="{$group.ID}"></td>
       <td>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i></td>
-      <td><a href="{$group.U_MEMBERS}">{$group.MEMBERS}</a></td>
-      <td style="text-align:center;">
-        <a href="{$group.U_PERM}">
-          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/permissions.png" style="border:none" alt="{'Permissions'|@translate}" title="{'Permissions'|@translate}"></a>
-        <a href="{$group.U_DELETE}" onclick="return confirm('{'delete'|@translate|@escape:'javascript'}' 
-          + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
-          <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" style="border:none" alt="{'Delete'|@translate}" title="{'Delete'|@translate}"></a>
-        <a href="{$group.U_ISDEFAULT}" onclick="return confirm('{'Toggle \'default group\' property'|@translate|@escape:'javascript'}' 
-          +'\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
-          <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>
-      </td>
+      <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>
     </tr>
     {/foreach}
