Skip to content

Commit

Permalink
feature 479: when more than 3 tags selected, be able to remove one tag
Browse files Browse the repository at this point in the history
from the multiple tags

git-svn-id: http://piwigo.org/svn/trunk@1606 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rvelices committed Nov 14, 2006
1 parent 998385c commit 6a314e6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 24 deletions.
48 changes: 48 additions & 0 deletions include/functions_html.inc.php
Expand Up @@ -610,4 +610,52 @@ function page_not_found($msg, $alternate_url=null)
.$msg.'</div>',
5 );
}

/* returns the title to be displayed above thumbnails on tag page
*/
function get_tags_content_title()
{
global $page;
$title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag');
$title.= ' ';

for ($i=0; $i<count($page['tags']); $i++)
{
$title.= $i>0 ? ' + ' : '';

$title.=
'<a href="'
.make_index_url(
array(
'tags' => array( $page['tags'][$i] )
)
)
.'" title="'
.l10n('See pictures linked to this tag only')
.'">'
.$page['tags'][$i]['name']
.'</a>';

if ( count($page['tags'])>2 )
{
$other_tags = $page['tags'];
unset ( $other_tags[$i] );
$title.=
'<a href="'
.make_index_url(
array(
'tags' => $other_tags
)
)
.'" style="border:none;" title="'
.l10n('remove this tag')
.'"><img src="'
.get_root_url().get_themeconf('icon_dir').'/remove_s.png'
.'" alt="x" style="vertical-align:bottom;" class="button"/>'
.'</a>';
}

}
return $title;
}
?>
26 changes: 2 additions & 24 deletions include/section_init.inc.php
Expand Up @@ -193,7 +193,7 @@
}
$result = pwg_query($query);
$tag_infos = array();
while ($row = mysql_fetch_array($result))
while ($row = mysql_fetch_assoc($result))
{
$tag_infos[ $row['id'] ] = $row;
array_push($page['tags'], $row );//we loose given tag order; is it important?
Expand Down Expand Up @@ -410,29 +410,7 @@
);
}

$title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag');
$title.= ' ';

$tag_num = 1;
foreach ($page['tag_ids'] as $tag_id)
{
$title.=
($tag_num++ > 1 ? ' + ' : '')
.'<a href="'
.make_index_url(
array(
'tags' => array(
array(
'id' => $tag_id,
'url_name' => $tag_infos[$tag_id]['url_name'],
),
)
)
)
.'">'
.$tag_infos[$tag_id]['name']
.'</a>';
}
$title = get_tags_content_title();

$page = array_merge(
$page,
Expand Down
1 change: 1 addition & 0 deletions language/en_UK.iso-8859-1/common.lang.php
Expand Up @@ -543,6 +543,7 @@
$lang['register_page_title'] = 'Registration';
$lang['register_title'] = 'Registration';
$lang['remember_me'] = 'Auto login';
$lang['remove this tag'] = 'remove this tag from the list';
$lang['representative'] = 'representative';
$lang['reset'] = 'Reset';
$lang['return to homepage'] = 'return to homepage';
Expand Down
1 change: 1 addition & 0 deletions language/fr_FR.iso-8859-1/common.lang.php
Expand Up @@ -542,6 +542,7 @@
$lang['register_page_title'] = 'Enregistrement';
$lang['register_title'] = 'Enregistrement';
$lang['remember_me'] = 'Connexion auto';
$lang['remove this tag'] = 'enlever ce tag de la liste';
$lang['representative'] = 'représentant';
$lang['reset'] = 'Annuler';
$lang['return to homepage'] = 'retour à la page d\'accueil';
Expand Down

0 comments on commit 6a314e6

Please sign in to comment.