Index: /extensions/Comments_on_Albums/admin.php
===================================================================
--- /extensions/Comments_on_Albums/admin.php	(revision 9641)
+++ /extensions/Comments_on_Albums/admin.php	(revision 9641)
@@ -0,0 +1,28 @@
+<?php
+if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+load_language('plugin.lang', COA_PATH);
+$conf['comments_on_albums'] = unserialize($conf['comments_on_albums']);
+
+// +-----------------------------------------------------------------------+
+//				Tabsheet
+// +-----------------------------------------------------------------------+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'config';
+	
+$tabsheet = new tabsheet();
+$tabsheet->add('config', l10n('Configuration'), COA_ADMIN . '-config'); 	// Configuration
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+//				Template
+// +-----------------------------------------------------------------------+
+$template->assign(array(
+	'COA_VERSION' => COA_NAME . ' ' . COA_VERSION,
+	'COA_PATH' => COA_PATH,
+	'COA_ADMIN' => COA_ADMIN,
+));
+
+include(COA_PATH.'admin/' . $page['tab'] . '.php');
+?>
Index: /extensions/Comments_on_Albums/admin/config.php
===================================================================
--- /extensions/Comments_on_Albums/admin/config.php	(revision 9641)
+++ /extensions/Comments_on_Albums/admin/config.php	(revision 9641)
@@ -0,0 +1,43 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// +-----------------------------------------------------------------------+
+//				Save configuration
+// +-----------------------------------------------------------------------+
+if (isset($_POST['config_submit'])) {
+	$user_config = array(
+		'icon_color' => $_POST['icon_color'],
+		'icon_color_over' => $_POST['icon_color_over'],
+	);
+	
+	pwg_query("UPDATE " . CONFIG_TABLE . " SET `value` = '" . serialize($user_config) . "' WHERE `param` = 'comments_on_albums';");
+	redirect(COA_ADMIN . '-config&amp;msg=saved');
+}	
+
+// +-----------------------------------------------------------------------+
+//				Template
+// +-----------------------------------------------------------------------+
+if (isset($_GET['msg']) AND $_GET['msg'] == 'saved') {
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+
+// available icons
+$dh = opendir(COA_PATH . 'template/s26');
+while (($file = readdir($dh)) !== false ) {
+	if ($file !== '.' && $file !== '..') {
+		$color = preg_replace('#^outline\_([a-f0-9]{6})\.png$#', '$1', $file);
+		$template->append('COLORS', $color);
+	}
+}
+closedir($dh);
+	
+
+$template->assign(array(
+	'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],
+	'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],
+));
+
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/config.tpl'));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Comments_on_Albums/admin/index.php
===================================================================
--- /extensions/Comments_on_Albums/admin/index.php	(revision 9641)
+++ /extensions/Comments_on_Albums/admin/index.php	(revision 9641)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/admin/template/config.tpl
===================================================================
--- /extensions/Comments_on_Albums/admin/template/config.tpl	(revision 9641)
+++ /extensions/Comments_on_Albums/admin/template/config.tpl	(revision 9641)
@@ -0,0 +1,67 @@
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
+{combine_script id='jquery.cluetip' path='themes/default/js/plugins/jquery.cluetip.js'}
+{combine_css path=$COA_PATH|@cat:'admin/template/style.css'}
+
+{footer_script}
+{literal}
+	jQuery().ready(function(){
+		// Cluetip
+		jQuery('.cluetip').cluetip({
+			width: 550,
+			splitTitle: '|'
+		});
+{/literal}		
+		jQuery('select').change(function() {ldelim}
+			jQuery('#' + jQuery(this).attr('name') + '_live').attr('src', '{$COA_PATH}template/s26/outline_' + jQuery(this).val() + '.png');
+		});
+	});
+
+{/footer_script}
+
+{html_head}
+<style type="text/css">
+	.cluetip:after {ldelim}
+		content:url('{$themeconf.admin_icon_dir}/help.png');
+	}
+</style>
+{/html_head}
+
+<h2 class="version_title">{$COA_VERSION}</h2>
+
+<div class="titrePage">
+	<h2>{'Configuration'|@translate}</h2>
+</div>
+
+<form method="post" action="" class="properties" id="CR_config">
+	<fieldset>
+		<legend><span class="title cluetip" title="{'COA_icon_pack'|@translate}|{'COA_help_icon_pack'|@translate}">{'COA_icon_pack'|@translate}</span></legend>
+		<table>	
+			<tr>
+				<td><span class="title">{'COA_icon_normal'|@translate}</span></td>
+				<td>
+					<select name="icon_color">
+					{foreach from=$COLORS item=COLOR}
+						<option value="{$COLOR}" style="color:#{$COLOR};" {if $COLOR == $ICON_COLOR}selected="selected"{/if}>{$COLOR}</option>
+					{/foreach}
+					</select>
+					
+					<img id="icon_color_live" class="pwg-icon" src="{$COA_PATH}template/s26/outline_{$ICON_COLOR}.png"/>
+				</td>
+			</tr>
+			<tr>
+				<td><span class="title">{'COA_icon_over'|@translate}</span></td>
+				<td>
+					<select name="icon_color_over">
+					{foreach from=$COLORS item=COLOR}
+						<option value="{$COLOR}" style="color:#{$COLOR};" {if $COLOR == $ICON_COLOR_OVER}selected="selected"{/if}>{$COLOR}</option>
+					{/foreach}
+					</select>
+					
+					<img id="icon_color_over_live" class="pwg-icon" src="{$COA_PATH}template/s26/outline_{$ICON_COLOR_OVER}.png"/>
+				</td>
+			</tr>
+		</table>
+	</fieldset>
+
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="config_submit"/></p>
+</form>
Index: /extensions/Comments_on_Albums/admin/template/index.php
===================================================================
--- /extensions/Comments_on_Albums/admin/template/index.php	(revision 9641)
+++ /extensions/Comments_on_Albums/admin/template/index.php	(revision 9641)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/admin/template/style.css
===================================================================
--- /extensions/Comments_on_Albums/admin/template/style.css	(revision 9641)
+++ /extensions/Comments_on_Albums/admin/template/style.css	(revision 9641)
@@ -0,0 +1,38 @@
+.titrePage {
+	clear:right;
+}
+.titrePage h2 {
+	text-align:center;
+}
+
+table {
+	width:80%;
+}
+td {
+	width:50%;
+	white-space: nowrap;
+}
+.title {
+	display:block;
+	font-weight:bold;
+	text-align:right;
+	margin-right:10px;
+}
+.title.cluetip:after {
+	margin-left:5px;
+	vertical-align:top;
+}
+
+.pwg-icon {
+	margin:-5px 0;
+}
+
+.version_title {
+	float:right;
+	position:relative;
+	top:-24px;
+	margin-bottom:-20px !important;
+	font-size:12px !important;
+	font-style:italic;
+	font-weight:normal;
+}
Index: /extensions/Comments_on_Albums/changelog.txt
===================================================================
--- /extensions/Comments_on_Albums/changelog.txt	(revision 9640)
+++ /extensions/Comments_on_Albums/changelog.txt	(revision 9641)
@@ -1,2 +1,6 @@
+0.3
+- stable version
+- all fonctionnalities complete
+
 0.2
 - Test version
Index: /extensions/Comments_on_Albums/include/coa_admin_comments.php
===================================================================
--- /extensions/Comments_on_Albums/include/coa_admin_comments.php	(revision 9640)
+++ /extensions/Comments_on_Albums/include/coa_admin_comments.php	(revision 9641)
@@ -2,4 +2,6 @@
 /* Code adapted from admin/comments.php */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+load_language('plugin.lang', COA_PATH);
 
 // +-----------------------------------------------------------------------+
@@ -11,9 +13,9 @@
 	array(
 		'code' => 'pictures',
-		'label' => l10n('Photos'),
+		'label' => l10n('COA_comments_photos'),
 	),
 	array(
 		'code' => 'albums',
-		'label' => l10n('Albums'),
+		'label' => l10n('COA_comments_albums'),
 	),
 );
Index: /extensions/Comments_on_Albums/include/coa_albums.php
===================================================================
--- /extensions/Comments_on_Albums/include/coa_albums.php	(revision 9640)
+++ /extensions/Comments_on_Albums/include/coa_albums.php	(revision 9641)
@@ -44,5 +44,4 @@
 			}
 		}
-		
 		case 'delete_comment' : {
 			check_pwg_token();
@@ -57,5 +56,4 @@
 			redirect($url_self);
 		}
-		
 		case 'validate_comment' : {
 			check_pwg_token();
@@ -89,5 +87,5 @@
 
 	include_once(COA_PATH.'include/functions_comment.inc.php');
-	$comment_action = insert_user_comment($comm, @$_POST['key'], $infos);
+	$comment_action = insert_user_comment_albums($comm, @$_POST['key'], $infos);
 
 	switch ($comment_action) {
Index: /extensions/Comments_on_Albums/include/coa_comments_page.php
===================================================================
--- /extensions/Comments_on_Albums/include/coa_comments_page.php	(revision 9640)
+++ /extensions/Comments_on_Albums/include/coa_comments_page.php	(revision 9641)
@@ -1,255 +1,274 @@
 <?php 
+/* inspired by include/comments.php */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+load_language('plugin.lang', COA_PATH);
+$conf['comments_on_albums'] = unserialize($conf['comments_on_albums']);
 
 $template->assign(array(
 	'COA_PATH' => COA_PATH,
-	'ICON_COLOR' => 'ff3363',
-	'ICON_COLOR_OVER' => 'ff7700',
+	'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],
+	'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],
 ));
 
-// ajout d'un bouton sur la page principale
+
+// +-----------------------------------------------------------------------+
+//				Main page (comments on photos)
+// +-----------------------------------------------------------------------+
+
 if (!isset($_GET['display_mode'])) {	
-	
+	// adds a button for switch page
 	$template->set_prefilter('comments', 'coa_add_button');
-
 	function coa_add_button($content, &$smarty) {
-		$search = '#<ul class="categoryActions">#';
-
-		$replacement = '
-		{html_head}
-			<style type="text/css">
-				.pwg-icon-comments-albums {ldelim}
-					background-image: url({$COA_PATH}template/s26/outline_{$ICON_COLOR}.png);
-					background-position: -26px 0;
+		$search = '<ul class="categoryActions">';
+
+$replacement = '
+{html_head}
+	<style type="text/css">
+		.pwg-icon-comments-albums {ldelim}
+			background-image: url({$COA_PATH}template/s26/outline_{$ICON_COLOR}.png);
+			background-position: -26px 0;
+		}
+		a:hover .pwg-icon-comments-albums {ldelim}
+			background-image: url({$COA_PATH}template/s26/outline_{$ICON_COLOR_OVER}.png);
+			background-position: -26px 0;
+		}
+	</style>
+{/html_head}
+
+	<ul class="categoryActions">
+		<li><a href="comments.php?display_mode=albums" title="' . l10n('COA_comments_albums') . '" class="pwg-state-default pwg-button">
+			<span class="pwg-icon pwg-icon-comments-albums">&nbsp;</span><span class="pwg-button-text">' . l10n('COA_comments_albums') . '</span>
+		</a></li>';
+
+		return str_replace($search, $replacement, $content);
+	}
+	
+	
+// +-----------------------------------------------------------------------+
+//				Second page (comments on albums)
+// +-----------------------------------------------------------------------+
+
+} else if ($_GET['display_mode'] == 'albums') {
+	// reset some template vars
+	$template->clear_assign(array('comments', 'navbar', 'sort_by_options'));
+	
+	// sort_by : database fields proposed for sorting comments list
+	$sort_by = array(
+		'date' => l10n('comment date'),
+		'category_id' => l10n('album')
+	);
+	$template->assign('sort_by_options', $sort_by);
+
+	// +-----------------------------------------------------------------------+
+	// |                         comments management                           |
+	// +-----------------------------------------------------------------------+
+	$comment_id = null;
+	$action = null;
+
+	$actions = array('delete_albums', 'validate_albums', 'edit_albums'); // different indexes to not interfer with the main process
+	foreach ($actions as $loop_action) {
+		if (isset($_GET[$loop_action])) {
+			$action = $loop_action;
+			check_input_parameter($action, $_GET, false, PATTERN_ID);
+			$comment_id = $_GET[$action];
+			break;
+		}
+	}
+
+	if (isset($action)) {
+		include_once(COA_PATH.'include/functions_comment.inc.php');
+		check_pwg_token();
+		$comment_author_id = get_comment_author_id_albums($comment_id);
+		$true_action = str_replace('_albums', null, $action); // but we must check true action names
+
+		if (can_manage_comment($true_action, $comment_author_id)) {
+			$perform_redirect = false;
+
+			if ('delete_albums' == $action) {
+				delete_user_comment_albums($comment_id);
+				$perform_redirect = true;
+			}
+			if ('validate_albums' == $action) {
+				validate_user_comment_albums($comment_id);
+				$perform_redirect = true;
+			}
+			if ('edit_albums' == $action) {
+				if (!empty($_POST['content'])) {
+					update_user_comment_albums(array(
+						'comment_id' => $_GET['edit_albums'],
+						'image_id' => $_POST['image_id'],
+						'content' => $_POST['content']
+						), $_POST['key']
+					);
+					$perform_redirect = true;
+				} else {
+					$edit_comment = $_GET['edit_albums'];
 				}
-				a:hover .pwg-icon-comments-albums {ldelim}
-					background-image: url({$COA_PATH}template/s26/outline_{$ICON_COLOR_OVER}.png);
-					background-position: -26px 0;
-				}
-			</style>
-		{/html_head}
-
-		<ul class="categoryActions">
-			<li><a href="comments.php?display_mode=albums" title="Commentaires albums" class="pwg-state-default pwg-button">
-				<span class="pwg-icon pwg-icon-comments-albums">&nbsp;</span><span class="pwg-button-text">Commentaires albums</span>
-			</a></li>';
-
-		return preg_replace($search, $replacement, $content);
-	}
-	
-// page modifiée pour les commentaires albums
-} else if ($_GET['display_mode'] == 'albums') {
-	$template->clear_assign(array('comments', 'navbar', 'sort_by_options'));
-	
-// sort_by : database fields proposed for sorting comments list
-$sort_by = array(
-	'date' => l10n('comment date'),
-	'category_id' => l10n('album')
-);
-$template->assign('sort_by_options', $sort_by);
-
-// +-----------------------------------------------------------------------+
-// |                         comments management                           |
-// +-----------------------------------------------------------------------+
-
-$comment_id = null;
-$action = null;
-
-$actions = array('delete_albums', 'validate_albums', 'edit_albums');
-foreach ($actions as $loop_action) {
-	if (isset($_GET[$loop_action])) {
-		$action = $loop_action;
-		check_input_parameter($action, $_GET, false, PATTERN_ID);
-		$comment_id = $_GET[$action];
-		break;
-	}
-}
-
-if (isset($action)) {
-	include_once(COA_PATH.'include/functions_comment.inc.php');
-	check_pwg_token();
-	$comment_author_id = get_comment_author_id_albums($comment_id);
-	$true_action = str_replace('_albums', null, $action);
-
-	if (can_manage_comment($true_action, $comment_author_id)) {
-		$perform_redirect = false;
-
-		if ('delete_albums' == $action) {
-			delete_user_comment_albums($comment_id);
-			$perform_redirect = true;
-		}
-
-		if ('validate_albums' == $action) {
-			validate_user_comment_albums($comment_id);
-			$perform_redirect = true;
-		}
-
-		if ('edit_albums' == $action) {
-			if (!empty($_POST['content'])) {
-				update_user_comment_albums(array(
-					'comment_id' => $_GET['edit_albums'],
-					'image_id' => $_POST['image_id'],
-					'content' => $_POST['content']
-					), $_POST['key']
-				);
-				$perform_redirect = true;
-			} else {
-				$edit_comment = $_GET['edit_albums'];
-			}
-		}
-
-		if ($perform_redirect) {
-			$redirect_url = PHPWG_ROOT_PATH.'comments.php'.get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token'));
-			redirect($redirect_url);
-		}
-	}
-}
-
-// +-----------------------------------------------------------------------+
-// |                            navigation bar                             |
-// +-----------------------------------------------------------------------+
-
-if (isset($_GET['start']) and is_numeric($_GET['start'])) {
-	$start = $_GET['start'];
-} else {
-	$start = 0;
-}
-
-$query = 'SELECT COUNT(DISTINCT(com.id))
-	FROM '.COA_TABLE.' AS com
-	LEFT JOIN '.USERS_TABLE.' As u
-	ON u.'.$conf['user_fields']['id'].' = com.author_id
-	WHERE '.implode('
-	AND ', $page['where_clauses']).'
-;';
-
-list($counter) = pwg_db_fetch_row(pwg_query($query));
-
-$url = PHPWG_ROOT_PATH . 'comments.php' . get_query_string_diff(array('start','delete','validate','pwg_token'));
-$navbar = create_navigation_bar($url, $counter, $start, $page['items_number'], '');
-$template->assign('navbar', $navbar);
-
-// +-----------------------------------------------------------------------+
-// |                        last comments display                          |
-// +-----------------------------------------------------------------------+
-
-$comments = array();
-$element_ids = array();
-$category_ids = array();
-
-$query = 'SELECT
-		com.id AS comment_id,
-		com.category_id,
-		com.author,
-		com.author_id,
-		com.date,
-		com.content,
-		com.validated
-	FROM '.COA_TABLE.' AS com
-	LEFT JOIN '.USERS_TABLE.' As u
-	ON u.'.$conf['user_fields']['id'].' = com.author_id
-	WHERE '.implode('
-	AND ', $page['where_clauses']).'
-	GROUP BY
-		comment_id,
-		com.category_id,
-		com.author,
-		com.author_id,
-		com.date,
-		com.content,
-		com.validated
-	ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
-	if ('all' != $page['items_number']) {
+			}
+			if ($perform_redirect) {
+				$redirect_url = PHPWG_ROOT_PATH.'comments.php'.get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token'));
+				redirect($redirect_url);
+			}
+		}
+	}
+
+	// +-----------------------------------------------------------------------+
+	// |                            navigation bar                             |
+	// +-----------------------------------------------------------------------+
+	if (isset($_GET['start']) and is_numeric($_GET['start'])) {
+		$start = $_GET['start'];
+	} else {
+		$start = 0;
+	}
+
+	$query = 'SELECT COUNT(DISTINCT(com.id))
+		FROM '.COA_TABLE.' AS com
+		LEFT JOIN '.USERS_TABLE.' As u
+		ON u.'.$conf['user_fields']['id'].' = com.author_id
+		WHERE '.implode('
+		AND ', $page['where_clauses']).'
+	;';
+	list($counter) = pwg_db_fetch_row(pwg_query($query));
+
+	$url = PHPWG_ROOT_PATH . 'comments.php' . get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token'));
+	$navbar = create_navigation_bar($url, $counter, $start, $page['items_number'], '');
+	$template->assign('navbar', $navbar);
+
+	// +-----------------------------------------------------------------------+
+	// |                        last comments display                          |
+	// +-----------------------------------------------------------------------+
+	$comments = array();
+	$element_ids = array();
+	$category_ids = array();
+
+	$query = 'SELECT
+			com.id AS comment_id,
+			com.category_id,
+			com.author,
+			com.author_id,
+			com.date,
+			com.content,
+			com.validated
+		FROM '.COA_TABLE.' AS com
+		LEFT JOIN '.USERS_TABLE.' As u
+		ON u.'.$conf['user_fields']['id'].' = com.author_id
+		WHERE '.implode('
+		AND ', $page['where_clauses']).'
+		GROUP BY
+			comment_id,
+			com.category_id,
+			com.author,
+			com.author_id,
+			com.date,
+			com.content,
+			com.validated
+		ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
+		if ('all' != $page['items_number']) {
+			$query.= '
+			LIMIT '.$page['items_number'].' OFFSET '.$start;
+		}
 		$query.= '
-		LIMIT '.$page['items_number'].' OFFSET '.$start;
-	}
-	$query.= '
-;';
-$result = pwg_query($query);
-
-while ($row = pwg_db_fetch_assoc($result)) {
-	array_push($comments, $row);
-	array_push($element_ids, $row['category_id']);
-}
-
-if (count($comments) > 0) {
-	// retrieving category informations
-	$query = 'SELECT 
-			cat.id, 
-			cat.name, 
-			cat.permalink, 
-			cat.uppercats, 
-			com.id as comment_id
-		FROM '.CATEGORIES_TABLE.' AS cat
-		LEFT JOIN '.COA_TABLE.' AS com
-		ON cat.id=com.category_id
-		'.get_sql_condition_FandF(array(
-			'forbidden_categories' => 'cat.id',
-			'visible_categories' => 'cat.id'
-		), 'WHERE').'
-		AND cat.id IN ('.implode(',', $element_ids).')
 	;';
-	$categories = hash_from_query($query, 'comment_id');
-
-	foreach ($comments as $comment) {
-		$name = $categories[$comment['comment_id']]['name'];
-
-		$url = duplicate_index_url(array(
-			'category' => array(
-				'id' => $categories[$comment['comment_id']]['id'], 
-				'name' => $categories[$comment['comment_id']]['name'], 
-				'permalink' => $categories[$comment['comment_id']]['permalink'],
-			),array('start')
-		));
-
-		$tpl_comment = array(
-			'U_PICTURE' => $url,
-			'TN_SRC' => $url,
-			'ALT' => $name,
-			'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
-			'DATE' => format_date($comment['date'], true),
-			'CONTENT' => trigger_event('render_comment_content',$comment['content']),
-		);
-
-		if (can_manage_comment('delete', $comment['author_id'])) {
-			$url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate','edit', 'pwg_token'));
-
-			$tpl_comment['U_DELETE'] = add_url_params($url, array(
-				'delete_albums' => $comment['comment_id'],
-				'pwg_token' => get_pwg_token(),
+	$result = pwg_query($query);
+
+	while ($row = pwg_db_fetch_assoc($result)) {
+		array_push($comments, $row);
+		array_push($element_ids, $row['category_id']);
+	}
+
+	if (count($comments) > 0) {
+		// retrieving category informations
+		$query = 'SELECT 
+				cat.id, 
+				cat.name, 
+				cat.permalink, 
+				cat.uppercats, 
+				com.id as comment_id
+			FROM '.CATEGORIES_TABLE.' AS cat
+			LEFT JOIN '.COA_TABLE.' AS com
+			ON cat.id=com.category_id
+			'.get_sql_condition_FandF(array(
+				'forbidden_categories' => 'cat.id',
+				'visible_categories' => 'cat.id'
+			), 'WHERE').'
+			AND cat.id IN ('.implode(',', $element_ids).')
+		;';
+		$categories = hash_from_query($query, 'comment_id');
+
+		foreach ($comments as $comment) {
+			// comment content
+			$name = $categories[$comment['comment_id']]['name'];
+			$url = duplicate_index_url(array(
+				'category' => array(
+					'id' => $categories[$comment['comment_id']]['id'], 
+					'name' => $categories[$comment['comment_id']]['name'], 
+					'permalink' => $categories[$comment['comment_id']]['permalink'],
+				),array('start')
 			));
-		}
-		if (can_manage_comment('edit', $comment['author_id'])) {
-			$url = get_root_url().'comments.php'.get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));
-
-			$tpl_comment['U_EDIT'] = add_url_params($url, array(
-				'edit_albums' => $comment['comment_id'],
-				'pwg_token' => get_pwg_token(),
-			));
-
-			if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) {
-				$key = get_ephemeral_key(2, $comment['category_id']);
-				$tpl_comment['IN_EDIT'] = true;
-				$tpl_comment['KEY'] = $key;
-				$tpl_comment['IMAGE_ID'] = $comment['category_id'];
-				$tpl_comment['CONTENT'] = $comment['content'];
-			}
-		}
-		if (can_manage_comment('validate', $comment['author_id'])) {
-			if ('true' != $comment['validated']) {
-				$tpl_comment['U_VALIDATE'] = add_url_params($url, array(
-					'validate_albums'=> $comment['comment_id'],
+			$tpl_comment = array(
+				'CAT_URL' => $url,
+				'CAT_NAME' => $name,
+				'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
+				'DATE' => format_date($comment['date'], true),
+				'CONTENT' => trigger_event('render_comment_content',$comment['content']),
+			);
+
+			// rights
+			if (can_manage_comment('delete', $comment['author_id'])) {
+				$url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate','edit', 'pwg_token'));
+
+				$tpl_comment['U_DELETE'] = add_url_params($url, array(
+					'delete_albums' => $comment['comment_id'],
 					'pwg_token' => get_pwg_token(),
 				));
 			}
-		}
-		
-		$template->append('comments', $tpl_comment);
+			if (can_manage_comment('edit', $comment['author_id'])) {
+				$url = get_root_url().'comments.php'.get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));
+
+				$tpl_comment['U_EDIT'] = add_url_params($url, array(
+					'edit_albums' => $comment['comment_id'],
+					'pwg_token' => get_pwg_token(),
+				));
+
+				if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) {
+					$key = get_ephemeral_key(2, $comment['category_id']);
+					$tpl_comment['IN_EDIT'] = true;
+					$tpl_comment['KEY'] = $key;
+					$tpl_comment['IMAGE_ID'] = $comment['category_id'];
+					$tpl_comment['CONTENT'] = $comment['content'];
+				}
+			}
+			if (can_manage_comment('validate', $comment['author_id'])) {
+				if ('true' != $comment['validated']) {
+					$tpl_comment['U_VALIDATE'] = add_url_params($url, array(
+						'validate_albums'=> $comment['comment_id'],
+						'pwg_token' => get_pwg_token(),
+					));
+				}
+			}
+			
+			$template->append('comments', $tpl_comment);
+		}
+	}
+
+	// +-----------------------------------------------------------------------+
+	// |                        template                                       |
+	// +-----------------------------------------------------------------------+
+	$template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/coa_comments_page.tpl'));
+	
+	// add a layer for display category name
+	$template->set_prefilter('comments', 'coa_change_comments_list');
+	function coa_change_comments_list($content, &$smarty) {
+		$search = '<div class="description"{if isset($comment.IN_EDIT)} style="height:200px"{/if}>';
+
+$replacement = '<div class="category-title">
+	<a href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>
+</div>
+<div class="description"{if isset($comment.IN_EDIT)} style="height:220px"{/if}>';
+
+		return str_replace($search, $replacement, $content);
 	}
 }
 
-	
-	$template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/coa_comments_page.tpl'));
-}
-
 ?>
Index: /extensions/Comments_on_Albums/language/en_UK/description.txt
===================================================================
--- /extensions/Comments_on_Albums/language/en_UK/description.txt	(revision 9641)
+++ /extensions/Comments_on_Albums/language/en_UK/description.txt	(revision 9641)
@@ -0,0 +1,1 @@
+Activate comments on albums pages
Index: /extensions/Comments_on_Albums/language/en_UK/index.php
===================================================================
--- /extensions/Comments_on_Albums/language/en_UK/index.php	(revision 9641)
+++ /extensions/Comments_on_Albums/language/en_UK/index.php	(revision 9641)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php	(revision 9641)
+++ /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php	(revision 9641)
@@ -0,0 +1,17 @@
+<?php
+
+/* common */
+$lang['COA_comments_photos'] = "Comments on photos";
+$lang['COA_comments_albums'] = "Comments on albums";
+
+/* admin */
+$lang['COA_icon_pack'] = 'Icons pack';
+$lang['COA_icon_normal'] = 'Basic state';
+$lang['COA_icon_over'] = 'Over state';
+
+$lang['COA_help_icon_pack'] = "Select which icons must be used on the main Comments page.";/*<br>
+	<br>
+	You can add your owns in the folder <i>plugins/comments_on_pictures/template/s26</i>.<br>
+	Please respect the name scheme !";*/
+	
+?>
Index: /extensions/Comments_on_Albums/language/fr_FR/description.txt
===================================================================
--- /extensions/Comments_on_Albums/language/fr_FR/description.txt	(revision 9641)
+++ /extensions/Comments_on_Albums/language/fr_FR/description.txt	(revision 9641)
@@ -0,0 +1,1 @@
+Active les commentaires sur les pages d'albums
Index: /extensions/Comments_on_Albums/language/fr_FR/index.php
===================================================================
--- /extensions/Comments_on_Albums/language/fr_FR/index.php	(revision 9641)
+++ /extensions/Comments_on_Albums/language/fr_FR/index.php	(revision 9641)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php	(revision 9641)
+++ /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php	(revision 9641)
@@ -0,0 +1,17 @@
+<?php
+
+/* common */
+$lang['COA_comments_photos'] = "Commentaires sur les photos";
+$lang['COA_comments_albums'] = "Commentaires sur les albums";
+
+/* admin */
+$lang['COA_icon_pack'] = "Pack d'icônes";
+$lang['COA_icon_normal'] = 'Etat bas';
+$lang['COA_icon_over'] = 'Etat haut';
+
+$lang['COA_help_icon_pack'] = "Selectionnez les icônes à utiliser sur la page principale des commentaires";/*<br>
+	<br>
+	Vous pouvez ajouter les votres dans le dossier <i>plugins/comments_on_pictures/template/s26</i>.<br>
+	Attention à respecter le même nommage !";*/
+	
+?>
Index: /extensions/Comments_on_Albums/language/index.php
===================================================================
--- /extensions/Comments_on_Albums/language/index.php	(revision 9641)
+++ /extensions/Comments_on_Albums/language/index.php	(revision 9641)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/main.inc.php
===================================================================
--- /extensions/Comments_on_Albums/main.inc.php	(revision 9640)
+++ /extensions/Comments_on_Albums/main.inc.php	(revision 9641)
@@ -1,7 +1,7 @@
 <?php
 /*
-Plugin Name: Comment on Albums
-Version: 0.2
-Description: Allows users to comment albums
+Plugin Name: Comments on Albums
+Version: 0.3
+Description: Activate comments on albums pages
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512
 Author: Mistic
@@ -16,9 +16,10 @@
 //					Global variables
 // +-----------------------------------------------------------------------+
-define('COA_NAME' , 'Comment on Albums');
-define('COA_VERSION', '0.2');
+define('COA_NAME' , 'Comments on Albums');
+define('COA_VERSION', '0.3');
 define('COA_DIR' , basename(dirname(__FILE__)));
 define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
 define('COA_TABLE' , $prefixeTable . 'comments_categories');
+define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
 
 
@@ -29,4 +30,5 @@
 add_event_handler('loc_after_page_header', 'COA_comments_page');
 add_event_handler('loc_end_admin', 'COA_admin');
+add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
 
 
@@ -61,3 +63,11 @@
 }
 
+function COA_admin_menu($menu) {
+	array_push($menu, array(
+		'NAME' => COA_NAME,
+		'URL' => COA_ADMIN
+	));
+	return $menu;
+}
+
 ?>
Index: /extensions/Comments_on_Albums/maintain.inc.php
===================================================================
--- /extensions/Comments_on_Albums/maintain.inc.php	(revision 9640)
+++ /extensions/Comments_on_Albums/maintain.inc.php	(revision 9641)
@@ -1,4 +1,10 @@
 <?php
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Default configuration
+define('default_config', serialize(array(
+	'icon_color' => 'ff3363',
+	'icon_color_over' => 'ff7700',
+)));
 
 // Installation
@@ -17,4 +23,6 @@
 		PRIMARY KEY (`id`)
 	) DEFAULT CHARSET=utf8;");
+	
+	pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('comments_on_albums', '" . default_config . "', 'Parametres du plugin Comments on Albums');");
 }
 
@@ -24,4 +32,5 @@
 
 	pwg_query("DROP TABLE `" . $prefixeTable . "comments_categories`;");
+	pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'comments_on_albums';");
 }
 ?>
Index: /extensions/Comments_on_Albums/template/coa_admin_comments.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/coa_admin_comments.tpl	(revision 9640)
+++ /extensions/Comments_on_Albums/template/coa_admin_comments.tpl	(revision 9641)
@@ -1,2 +1,4 @@
+{* this is a copy of admin/theme/defaults/template/comments.tpl a bit modified *}
+	
 {literal}
 <script type="text/javascript">
@@ -27,5 +29,5 @@
 
 <div class="titrePage">
-	<h2>{'Waiting'|@translate} {$TABSHEET_TITLE}</h2>
+	<h2>{'Waiting'|@translate}</h2>
 </div>
 
Index: /extensions/Comments_on_Albums/template/coa_admin_intro.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/coa_admin_intro.tpl	(revision 9640)
+++ /extensions/Comments_on_Albums/template/coa_admin_intro.tpl	(revision 9641)
@@ -1,4 +1,5 @@
+{* this code add a line to the database infos list *}
+
 {footer_script}
-	// add element to database informations, non intrusive way
 	jQuery('dl[style="padding-top: 30px;"] dd:last-child ul li:last-child').append('[{'Photos'|@translate}]');
 	jQuery('<li>'+
Index: /extensions/Comments_on_Albums/template/coa_albums.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/coa_albums.tpl	(revision 9640)
+++ /extensions/Comments_on_Albums/template/coa_albums.tpl	(revision 9641)
@@ -1,2 +1,4 @@
+{* this is inspired by theme/defaults/template/picture.tpl *}
+	
 {combine_script id="jquery"}
 {combine_css path=$COA_PATH|@cat:'template/style_albums.css'}
Index: /extensions/Comments_on_Albums/template/coa_comments_page.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/coa_comments_page.tpl	(revision 9640)
+++ /extensions/Comments_on_Albums/template/coa_comments_page.tpl	(revision 9641)
@@ -1,2 +1,6 @@
+{* this is a copy of theme/defaults/template/comments.tpl a bit modified *}
+	
+{combine_css path=$COA_PATH|@cat:'template/style_comments.css'}
+
 {html_head}
 	<style type="text/css">
@@ -16,6 +20,6 @@
 <div class="titrePage">
 	<ul class="categoryActions">
-		<li><a href="comments.php" title="Commentaires images" class="pwg-state-default pwg-button">
-			<span class="pwg-icon pwg-icon-comments-images">&nbsp;</span><span class="pwg-button-text">Commentaires images</span>
+		<li><a href="comments.php" title="{'COA_comments_photos'|@translate}" class="pwg-state-default pwg-button">
+			<span class="pwg-icon pwg-icon-comments-images">&nbsp;</span><span class="pwg-button-text">{'COA_comments_photos'|@translate}</span>
 		</a></li>
 		<li><a href="{$U_HOME}" title="{'Home'|@translate}" class="pwg-state-default pwg-button">
Index: /extensions/Comments_on_Albums/template/navigation_bar.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/navigation_bar.tpl	(revision 9640)
+++ /extensions/Comments_on_Albums/template/navigation_bar.tpl	(revision 9641)
@@ -1,2 +1,5 @@
+{* this is a copy of theme/defaults/template/navigation_bar.tpl 
+	but with other variables to not interfer with the thumbnails' navigation bar *}
+	
 <div class="navigationBar">
 	{if isset($comment_navbar.URL_FIRST)}
Index: /extensions/Comments_on_Albums/template/style_comments.css
===================================================================
--- /extensions/Comments_on_Albums/template/style_comments.css	(revision 9641)
+++ /extensions/Comments_on_Albums/template/style_comments.css	(revision 9641)
@@ -0,0 +1,6 @@
+.thumbnailCategory .category-title {
+	position:absolute;
+	margin-top:-5px;
+	font-size:1.2em;
+	font-weight:bold;
+}
