fixes #626 related albums (menu, combine, url)

* ability to combine albums in URL index.php?/category/1/2/3 will consider 1 as $page['category'] and {2,3} as $page['combined_categories']

* new menu block "related albums" which displays only the hierarchy of albums related to the current set of photos, excluding current album(s). In the hierarchy, only the related albums have a link, not ancestors
This commit is contained in:
plegall
2020-11-09 13:00:01 +01:00
parent 35f0450699
commit 4f3880af89
9 changed files with 388 additions and 6 deletions
+50
View File
@@ -441,6 +441,55 @@ function get_tags_content_title()
return $title;
}
/**
* Returns the breadcrumb to be displayed above thumbnails on combined categories page.
*
* @return string
*/
function get_combined_categories_content_title()
{
global $page;
$title = l10n('Albums').' ';
$is_first = true;
$all_categories = array_merge(array($page['category']), $page['combined_categories']);
foreach ($all_categories as $idx => $category)
{
$title.= $is_first ? '' : ' + ';
$is_first = false;
$title.= get_cat_display_name(array($category));
if (count($all_categories) > 1) // should be always the case
{
$other_cats = $all_categories;
unset($other_cats[$idx]);
$params = array(
'category' => array_shift($other_cats),
);
if (count($other_cats) > 0)
{
$params['combined_categories'] = $other_cats;
}
$remove_url = make_index_url($params);
$title.=
'<a id="TagsGroupRemoveTag" href="'.$remove_url.'" style="border:none;" title="'
.l10n('remove this tag from the list')
.'"><img src="'
.get_root_url().get_themeconf('icon_dir').'/remove_s.png'
.'" alt="x" style="vertical-align:bottom;" >'
.'<span class="pwg-icon pwg-icon-close" ></span>'
.'</a>';
}
}
return $title;
}
/**
* Sets the http status header (200,401,...)
* @param int $code
@@ -501,6 +550,7 @@ function register_default_menubar_blocks($menu_ref_arr)
$menu->register_block( new RegisteredBlock( 'mbTags', 'Related tags', 'piwigo'));
$menu->register_block( new RegisteredBlock( 'mbSpecials', 'Specials', 'piwigo'));
$menu->register_block( new RegisteredBlock( 'mbMenu', 'Menu', 'piwigo'));
$menu->register_block( new RegisteredBlock( 'mbRelatedCategories', 'Related albums', 'piwigo') );
// We hide the quick identification menu on the identification page. It
// would be confusing.