Index: extensions/event_cats/admin/duplication.inc.php
===================================================================
--- extensions/event_cats/admin/duplication.inc.php	(revision 4247)
+++ extensions/event_cats/admin/duplication.inc.php	(revision 4263)
@@ -1,135 +1,7 @@
 <?php
-
-$t = read_ec_conf('reg_display');
-if ($t == '0') $reg_display = array('0', '');
-else $reg_display = explode(';', $t);
-
-$template->assign('reg_display', $reg_display);
-$template->assign('ec_conf', $ec_conf);
 
 
 
-
-
-
-// A lot of below code has simply been copied-pasted from file cat_perm.php .
-// Many thanks to people who wrote it !
-
-// +-----------------------------------------------------------------------+
-// |                          form construction                            |
-// +-----------------------------------------------------------------------+
-
-// groups denied are the groups not granted. So we need to find all groups
-// minus groups granted to find groups denied.
-
-$groups = array();
-
-$query = '
-SELECT id, name
-  FROM '.GROUPS_TABLE.'
-  ORDER BY name ASC
-;';
-$groups = simple_hash_from_query($query, 'id', 'name');
-$template->assign('all_groups', $groups);
-
-// groups granted to access the category
-$query = "
-SELECT `arg1`
-  FROM ".EVNTCATS_TABLE."
-  WHERE `code` IS NULL
-    AND `arg1` IS NOT NULL
-;";
-$group_granted_ids = array_from_query($query, 'arg1');
-$group_granted_ids = order_by_name($group_granted_ids, $groups);
-$template->assign('group_granted_ids', $group_granted_ids);
-
-
-// groups denied
-$template->assign('group_denied_ids',
-    order_by_name(array_diff(array_keys($groups), $group_granted_ids), $groups)
-  );
-
-// users...
-$users = array();
-
-$query = "
-SELECT ".$conf['user_fields']['id']." AS id,
-       ".$conf['user_fields']['username']." AS username
-  FROM ".USERS_TABLE."
-;";
-$users = simple_hash_from_query($query, 'id', 'username');
-$template->assign('all_users', $users);
-
-
-$query = "
-SELECT `arg2`
-  FROM ".EVNTCATS_TABLE."
-  WHERE `code` IS NULL
-    AND `arg2` IS NOT NULL
-;";
-$user_granted_direct_ids = array_from_query($query, 'arg2');
-$user_granted_direct_ids = order_by_name($user_granted_direct_ids, $users);
-$template->assign('user_granted_direct_ids', $user_granted_direct_ids);
-
-
-
-$user_granted_indirect_ids = array();
-if (count($group_granted_ids) > 0)
-{
-  $granted_groups = array();
-
-  $query = "
-SELECT user_id, group_id
-  FROM ".USER_GROUP_TABLE."
-  WHERE group_id IN (".implode(',', $group_granted_ids).") 
-";
-  $result = pwg_query($query);
-  while ($row = mysql_fetch_array($result))
-  {
-    if (!isset($granted_groups[$row['group_id']]))
-    {
-      $granted_groups[$row['group_id']] = array();
-    }
-    array_push($granted_groups[$row['group_id']], $row['user_id']);
-  }
-
-  $user_granted_by_group_ids = array();
-
-  foreach ($granted_groups as $group_users)
-  {
-    $user_granted_by_group_ids = array_merge($user_granted_by_group_ids,
-                                             $group_users);
-  }
-  $user_granted_by_group_ids = array_unique($user_granted_by_group_ids);
-  
-  
-  $user_granted_indirect_ids = array_diff($user_granted_by_group_ids,
-                                          $user_granted_direct_ids);
-  $user_granted_indirect_ids = 
-    order_by_name($user_granted_indirect_ids, $users);  
-  foreach ($user_granted_indirect_ids as $user_id)
-  {
-    foreach ($granted_groups as $group_id => $group_users)
-    {
-      if (in_array($user_id, $group_users))
-      {
-        $template->append(
-          'user_granted_indirects',
-          array(
-            'USER'=>$users[$user_id],
-            'GROUP'=>$groups[$group_id]
-            )
-          );
-        break;
-      }
-    }
-  }
-}
-
-$user_denied_ids = array_diff(array_keys($users),
-                              $user_granted_indirect_ids,
-                              $user_granted_direct_ids);
-$user_denied_ids = order_by_name($user_denied_ids, $users);
-$template->assign('user_denied_ids', $user_denied_ids);
+build_dup_arrays(true);
 
 
Index: extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- extensions/event_cats/admin/template/autolog_new.js	(revision 4247)
+++ extensions/event_cats/admin/template/autolog_new.js	(revision 4263)
@@ -511,12 +511,6 @@
    && ec_old_new_psd_text != ''
    && ec_selected_user == 'ec_sel_user_new'
-  ) {
-    de('ec_in_up_pwd_warn1').innerHTML = ec_JS_message['ec_new_pwd_gen1'];
-    de('ec_in_up_pwd_warn2').innerHTML = ec_JS_message['ec_new_pwd_gen2'];
-  }
-  else {
-    de('ec_in_up_pwd_warn1').innerHTML = '';
-    de('ec_in_up_pwd_warn2').innerHTML = '';
-  }
+  ) de('ec_in_up_pwd_warn').innerHTML = ec_JS_message['ec_new_pwd_gen'];
+  else de('ec_in_up_pwd_warn').innerHTML = '';
 }
 
@@ -701,6 +695,5 @@
   de('ec_in_up_grp_txt_id').value                 = '';
   de('ec_in_up_newgroup_id').checked              = '';
-  de('ec_in_up_pwd_warn1').innerHTML              = '';
-  de('ec_in_up_pwd_warn2').innerHTML              = '';
+  de('ec_in_up_pwd_warn').innerHTML               = '';
   de('ec_in_up_aps_id').selectedIndex             = '-1';
   de('ec_in_up_cats_id').selectedIndex            = '-1';
Index: extensions/event_cats/admin/template/autolog_new.tpl
===================================================================
--- extensions/event_cats/admin/template/autolog_new.tpl	(revision 4247)
+++ extensions/event_cats/admin/template/autolog_new.tpl	(revision 4263)
@@ -126,6 +126,5 @@
         {'ec_up_code_lbl_user'|@translate}<br>
         <br>
-        <span style = "font-weight:bold; color:red;" id = "ec_in_up_pwd_warn1">&nbsp;</span><br>
-        <span style = "font-weight:bold; color:red;" id = "ec_in_up_pwd_warn2">&nbsp;</span>
+        <span style = "font-weight:bold; color:red;" id = "ec_in_up_pwd_warn">&nbsp;</span><br>
       </td>
       <td>
@@ -276,6 +275,5 @@
   ec_JS_message['ec_act_cat_miss']        = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
   ec_JS_message['ec_act_img_miss']        = "{'ec_act_img_miss'|@translate|@escape:javascript}";
-  ec_JS_message['ec_new_pwd_gen1']        = "{'ec_new_pwd_gen1'|@translate|@escape:javascript}";
-  ec_JS_message['ec_new_pwd_gen2']        = "{'ec_new_pwd_gen2'|@translate|@escape:javascript}";
+  ec_JS_message['ec_new_pwd_gen']         = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
   ec_JS_message['ec_act_entry_miss']      = "{'ec_act_entry_miss'|@translate|@escape:javascript}";
   ec_JS_message['ec_confirm_force']       = "{'ec_confirm_force'|@translate|@escape:javascript}";
Index: extensions/event_cats/admin/template/config.tpl
===================================================================
--- extensions/event_cats/admin/template/config.tpl	(revision 4247)
+++ extensions/event_cats/admin/template/config.tpl	(revision 4263)
@@ -13,5 +13,5 @@
   ec_JS_message['ec_gen_user_act_miss'] = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}";
   ec_JS_message['ec_act_cat_miss']      = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
-  ec_JS_message['ec_new_pwd_gen1']       = "{'ec_new_pwd_gen1'|@translate|@escape:javascript}";
+  ec_JS_message['ec_new_pwd_gen']       = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
   ec_JS_message['ec_up_code_lbl_home']  = "{'ec_up_code_lbl_home'|@translate}";
   ec_init();
Index: extensions/event_cats/admin/template/duplication.tpl
===================================================================
--- extensions/event_cats/admin/template/duplication.tpl	(revision 4247)
+++ extensions/event_cats/admin/template/duplication.tpl	(revision 4263)
@@ -6,8 +6,8 @@
 <p>Bientôt disponible :-] !</p>
 
-<!-- Aknowledgement ------------------------------------------------------
-A lot of below code has simply been copied-pasted from file cat_perm.tpl .
-Many thanks to people who wrote it !
-------------------------------------------------------------------------->
+<!-- Aknowledgement ----------------------------------------------------------
+| A lot of below code has simply been copied-pasted from file cat_perm.tpl . |
+| Many thanks to people who wrote it !                                       |
+----------------------------------------------------------------------------->
 
 {* <!-- Duplication configuration parameters --> *}
@@ -18,5 +18,5 @@
       <tr>
         <td>
-          <span style = "font-weight:bold;">{'ec_duplication_allowance'|@translate}</span>
+          <span style = "font-weight:bold;">{'ec_duplication_allowance'|@translate}&nbsp;&nbsp;</span>
         </td>
         <td>
@@ -28,31 +28,21 @@
             <input type = "radio" name = "ec_dup_conf" id = "ec_dup_conf_group_id" />
             {'ec_dup_allowance_group'|@translate}
-          </label><br>
+          </label><br> {* <!--
+          <label for = "ec_dup_conf_gen_id">
+            <input type = "radio" name = "ec_dup_conf" id = "ec_dup_conf_gen_id" />
+            {'ec_dup_allowance_gen'|@translate}
+          </label><br> --> *}
           <label for = "ec_dup_conf_all_id">
             <input type = "radio" name = "ec_dup_conf" id = "ec_dup_conf_all_id" />
             {'ec_dup_allowance_all'|@translate}
-          </label><br>
-        </td>
-        <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
-        <td>
-          <span style = "font-weight:bold;">{'ec_duplication_display'|@translate}</span>
-        </td>
-        <td>
-          <label for = "ec_dup_disp_normal_id">
-            <input type = "radio" name = "ec_dup_disp" id = "ec_dup_disp_normal_id" />
-            {'ec_dup_display_normal'|@translate}{if $reg_display.0 != '0'} ("{$reg_display.1}"){/if}
-          </label><br>
-          <label for = "ec_dup_disp_dup_id">
-            <input type = "radio" name = "ec_dup_disp" id = "ec_dup_disp_dup_id" />
-            {'ec_dup_display_dup'|@translate} ("{'ec_duplication'|@translate}")
-          </label><br>
+          </label>
         </td>
       </tr>
     </table>
-    <input class = "submit" type = "submit" name = "ec_duplic_conf_submit" value = "{'ec_dup_conf_submit_lbl'|@translate}" />
+    <input class = "submit" type = "submit" name = "ec_duplic_conf_submit" value = "{'ec_dup_conf_sbmt_lbl'|@translate}" />
   </fieldset>
 </form>
 
-{* <!-- Duplication settings by groups / user ids --> *}
+{* <!-- Duplication settings by groups / types / user ids --> *}
 <form action = "" method = "post" name = "ec_duplic_set" id="categoryPermissions">
 
@@ -60,5 +50,5 @@
 
   <fieldset>
-    <legend>{'Permission granted'|@translate}</legend>
+    <legend>{'ec_duplic_ok'|@translate}</legend>
     <ul>
       {foreach from=$group_granted_ids item=id}
@@ -66,9 +56,9 @@
       {/foreach}
     </ul>
-    <input class = "submit" type = "submit" name = "deny_groups_submit" value = "{'Deny selected groups'|@translate}" />
+    <input class = "submit" type = "submit" name = "deny_groups_submit" value = "{'ec_dup_grp_ok_sbmt_lbl'|@translate}" />
   </fieldset>
 
   <fieldset>
-    <legend>{'Permission denied'|@translate}</legend>
+    <legend>{'ec_duplic_nok'|@translate}</legend>
     <ul>
       {foreach from=$group_denied_ids item=id}
@@ -76,5 +66,19 @@
       {/foreach}
     </ul>
-    <input class = "submit" type = "submit" name = "grant_groups_submit" value = "{'Grant selected groups'|@translate}" />
+    <input class = "submit" type = "submit" name = "grant_groups_submit" value = "{'ec_dup_grp_nok_sbmt_lbl'|@translate}" />
+  </fieldset>
+
+  <h4>{'ec_dup_types'|@translate}</h4>
+
+  <fieldset>
+    <legend>{'ec_duplic_ok'|@translate}</legend>
+    <ul>
+      <li><label><input type = "checkbox" name = "ec_dup_types_generic_ok" value = "ec_dup_types_generic_ok_id" /> {'user_status_generic'|@translate}</label></li>
+      <br />
+      <li><label><input type = "checkbox" name = "ec_dup_types_contacts_ok" value = "ec_dup_types_contacts_ok_id" /> {'Level 1'|@translate}</label></li>
+      <li><label><input type = "checkbox" name = "ec_dup_types_friends_ok" value = "ec_dup_types_friends_ok_id" /> {'Level 2'|@translate}</label></li>
+      <li><label><input type = "checkbox" name = "ec_dup_types_family_ok" value = "ec_dup_types_family_ok_id" /> {'Level 4'|@translate}</label></li>
+    </ul>
+    <input class = "submit" type = "submit" name = "deny_users_submit" value = "{'ec_dup_typ_sbmt_lbl'|@translate}" />
   </fieldset>
 
@@ -82,5 +86,5 @@
 
   <fieldset>
-    <legend>{'Permission granted'|@translate}</legend>
+    <legend>{'ec_duplic_ok'|@translate}</legend>
     <ul>
       {foreach from=$user_granted_direct_ids item=id}
@@ -88,9 +92,9 @@
       {/foreach}
     </ul>
-    <input class = "submit" type = "submit" name = "deny_users_submit" value = "{'Deny selected users'|@translate}" />
+    <input class = "submit" type = "submit" name = "deny_users_submit" value = "{'ec_dup_usr_ok_sbmt_lbl'|@translate}" />
   </fieldset>
 
   <fieldset>
-    <legend>{'Permission granted thanks to a group'|@translate}</legend>
+    <legend>{'ec_duplic_ok_groups'|@translate}</legend>
     {if isset($user_granted_indirects) }
     <ul>
@@ -103,5 +107,5 @@
 
   <fieldset>
-    <legend>{'Permission denied'|@translate}</legend>
+    <legend>{'ec_duplic_nok'|@translate}</legend>
     <ul>
       {foreach from=$user_denied_ids item=id}
@@ -109,5 +113,5 @@
       {/foreach}
     </ul>
-    <input class = "submit" type = "submit" name = "grant_users_submit" value = "{'Grant selected users'|@translate}" />
+    <input class = "submit" type = "submit" name = "grant_users_submit" value = "{'ec_dup_usr_nok_sbmt_lbl'|@translate}" />
   </fieldset>
 
@@ -123,5 +127,5 @@
   ec_JS_message['ec_gen_user_act_miss'] = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}";
   ec_JS_message['ec_act_cat_miss']      = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
-  ec_JS_message['ec_new_pwd_gen1']       = "{'ec_new_pwd_gen1'|@translate|@escape:javascript}";
+  ec_JS_message['ec_new_pwd_gen']       = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
   ec_JS_message['ec_up_code_lbl_home']  = "{'ec_up_code_lbl_home'|@translate}";
   ec_init();
