Index: /trunk/admin/picture_modify.php
===================================================================
--- /trunk/admin/picture_modify.php	(revision 639)
+++ /trunk/admin/picture_modify.php	(revision 640)
@@ -112,4 +112,27 @@
   pwg_query($query);
   update_category($_POST['cat_associated']);
+}
+// elect the element to represent the given categories
+if (isset($_POST['elect'])
+    and isset($_POST['cat_dismissed'])
+    and count($_POST['cat_dismissed']) > 0)
+{
+  $datas = array();
+  foreach ($_POST['cat_dismissed'] as $category_id)
+  {
+    array_push($datas,
+               array('id' => $category_id,
+                     'representative_picture_id' => $_GET['image_id']));
+  }
+  $fields = array('primary' => array('id'),
+                  'update' => array('representative_picture_id'));
+  mass_updates(CATEGORIES_TABLE, $fields, $datas);
+}
+// dismiss the element as representant of the given categories
+if (isset($_POST['dismiss'])
+    and isset($_POST['cat_elected'])
+    and count($_POST['cat_elected']) > 0)
+{
+  set_random_representant($_POST['cat_elected']);
 }
 
@@ -184,4 +207,6 @@
   'L_PATH'=>$lang['path'],
   'L_STORAGE_CATEGORY'=>$lang['storage_category'],
+  'L_REPRESENTS'=>$lang['represents'],
+  'L_DOESNT_REPRESENT'=>$lang['doesnt_represent'],
   
   'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
@@ -220,4 +245,19 @@
 ;';
 display_select_cat_wrapper($query,array(),'dissociated_option');
+// representing
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+  WHERE representative_picture_id = '.$_GET['image_id'].'
+;';
+display_select_cat_wrapper($query,array(),'elected_option');
+
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+  WHERE id IN ('.implode(',', $associateds).')
+    AND representative_picture_id != '.$_GET['image_id'].'
+;';
+display_select_cat_wrapper($query,array(),'dismissed_option');
 //----------------------------------------------------------- sending html code
 $template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
Index: /trunk/language/en_UK.iso-8859-1/admin.lang.php
===================================================================
--- /trunk/language/en_UK.iso-8859-1/admin.lang.php	(revision 639)
+++ /trunk/language/en_UK.iso-8859-1/admin.lang.php	(revision 640)
@@ -350,3 +350,5 @@
 $lang['cat_dissociated'] = 'dissociated from';
 $lang['storage_category'] = 'storage category';
+$lang['represents'] = 'represents';
+$lang['doesnt_represent'] = 'doesn\'t represent';
 ?>
Index: /trunk/template/default/admin/picture_modify.tpl
===================================================================
--- /trunk/template/default/admin/picture_modify.tpl	(revision 639)
+++ /trunk/template/default/admin/picture_modify.tpl	(revision 640)
@@ -106,2 +106,39 @@
 
 </form>
+
+<form name="form2" method="post" action="{F_ACTION}" style="text-align:center;width:800px;">
+
+  <div style="clear:both;"></div>
+
+  <div style="height:auto;">
+
+    <div style="float:left;padding:10px;width:300px;">
+      <span class="titreMenu">{L_REPRESENTS}</span><br />
+      <select style="height:auto;width:280px" name="cat_elected[]" multiple="multiple" size="10">
+        <!-- BEGIN elected_option -->
+        <option class="{elected_option.CLASS}" {elected_option.SELECTED} value="{elected_option.VALUE}">{elected_option.OPTION}</option>
+        <!-- END elected_option -->
+      </select>
+    </div>
+
+    <div style="float:left;padding-top:80px;padding-bottom:80px;text-align:center;width:160px;" >
+      <input type="submit" value="&larr;" name="elect" style="font-size:15px;" class="bouton" /><br/>
+      <input type="submit" value="&rarr;" name="dismiss" style="font-size:15px;" class="bouton" />
+    </div>
+
+    <div style="float:right;padding:10px;width:300px;">
+      <span class="titreMenu">{L_DOESNT_REPRESENT}</span><br />
+      <select style="width:280px" name="cat_dismissed[]" multiple="multiple" size="10">
+        <!-- BEGIN dismissed_option -->
+        <option class="{dismissed_option.CLASS}" {dismissed_option.SELECTED} value="{dismissed_option.VALUE}">{dismissed_option.OPTION}</option>
+        <!-- END dismissed_option -->
+      </select>
+    </div>
+
+  </div>
+
+  <div style="clear:both;"></div>
+
+  <input type="reset" name="reset" value="{L_RESET}" class="bouton" />
+
+</form>
