diff options
author | rvelices <rv-github@modusoptimus.com> | 2010-04-10 09:47:19 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2010-04-10 09:47:19 +0000 |
commit | b7e2107181e78c29ee9829d5d6b346ec1dc49d67 (patch) | |
tree | 8c0532ffaf54606a69e09eef1a292711c41f328c | |
parent | aaccf93392bf3a9e0712d8bcbd51ef9cc8a5fbba (diff) |
feqture 1583 : show related tags block also when browsing non tag sections
git-svn-id: http://piwigo.org/svn/trunk@5752 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/menubar.inc.php | 62 | ||||
-rw-r--r-- | themes/default/template/menubar_tags.tpl | 12 |
2 files changed, 51 insertions, 23 deletions
diff --git a/include/menubar.inc.php b/include/menubar.inc.php index 052f3d830..a5cc2ffed 100644 --- a/include/menubar.inc.php +++ b/include/menubar.inc.php @@ -110,32 +110,54 @@ function initialize_menu() //------------------------------------------------------------------------ tags $block = $menu->get_block('mbTags'); - if ( $block!=null and 'tags'==@$page['section'] and !empty($page['items']) ) + if ( $block!=null and !empty($page['items']) ) { - $tags = get_common_tags( - $page['items'], - $conf['menubar_tag_cloud_items_number'], - $page['tag_ids'] - ); - $tags = add_level_to_tags($tags); - - foreach ($tags as $tag) + if ('tags'==@$page['section']) { - $block->data[] = array_merge( - $tag, - array( - 'U_ADD' => make_index_url( - array( - 'tags' => array_merge( - $page['tags'], - array($tag) + $tags = get_common_tags( + $page['items'], + $conf['menubar_tag_cloud_items_number'], + $page['tag_ids'] + ); + $tags = add_level_to_tags($tags); + + foreach ($tags as $tag) + { + $block->data[] = array_merge( + $tag, + array( + 'U_ADD' => make_index_url( + array( + 'tags' => array_merge( + $page['tags'], + array($tag) + ) ) - ) - ), + ), + 'URL' => make_index_url( array( 'tags' => array($tag) ) + ), + ) + ); + } + } + else + { + $selection = array_slice( $page['items'], $page['start'], $page['nb_image_page'] ); + $tags = add_level_to_tags( get_common_tags($selection, 12) ); + foreach ($tags as $tag) + { + $block->data[] = + array_merge( $tag, + array( + 'URL' => make_index_url( array( 'tags' => array($tag) ) ), ) ); + } + } + if ( !empty($block->data) ) + { + $block->template = 'menubar_tags.tpl'; } - $block->template = 'menubar_tags.tpl'; } //----------------------------------------------------------- special categories diff --git a/themes/default/template/menubar_tags.tpl b/themes/default/template/menubar_tags.tpl index ad1d752da..f357efba4 100644 --- a/themes/default/template/menubar_tags.tpl +++ b/themes/default/template/menubar_tags.tpl @@ -3,10 +3,16 @@ <div id="menuTagCloud"> {foreach from=$block->data item=tag} <span> - <a class="tagLevel{$tag.level}" href="{$tag.U_ADD}" + <a class="tagLevel{$tag.level}" + {if isset($tag.U_ADD)} + href="{$tag.U_ADD}" title="{$pwg->l10n_dec('%d image is also linked to current tags', '%d images are also linked to current tags', $tag.counter)}" - rel="nofollow"> - +{$tag.name}</a></span> + rel="nofollow">+ + {else} + href="{$tag.URL}" + title="{'See elements linked to this tag only'|@translate}"> + {/if} + {$tag.name}</a></span> {* ABOVE there should be no space between text, </a> and </span> elements to avoid IE8 bug https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=366567 *} {/foreach} </div> |