mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-25 19:00:03 +03:00
fixes #2064 re-use existing code to open an album
This commit is contained in:
parent
fa92e9c3f7
commit
8c25d7d2a1
3 changed files with 11 additions and 16 deletions
|
@ -25,6 +25,8 @@ list($albums_counter) = pwg_db_fetch_row(pwg_query($query));
|
|||
// +-----------------------------------------------------------------------+
|
||||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
check_input_parameter('parent_id', $_GET, false, PATTERN_ID);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | tabs |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -36,7 +38,7 @@ include(PHPWG_ROOT_PATH.'admin/include/albums_tab.inc.php');
|
|||
// | categories auto order |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$open_cat = -1;
|
||||
$open_cat = $_GET['parent_id'] ?? -1;
|
||||
|
||||
$sort_orders = array(
|
||||
'name ASC',
|
||||
|
|
|
@ -198,7 +198,7 @@ $template->assign(
|
|||
|
||||
'U_ADD_PHOTOS_ALBUM' => $base_url.'photos_add&album='.$category['id'],
|
||||
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
|
||||
'U_MOVE' => $base_url.'albums&parent_id='.$category['id'].'#cat-'.$category['id'],
|
||||
'U_MOVE' => $base_url.'albums&parent_id='.$category['id'],
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -13,18 +13,6 @@ $(document).ready(() => {
|
|||
onCanSelectNode: function(node) {return false}
|
||||
});
|
||||
|
||||
var url_split = window.location.href.split("cat_move");
|
||||
var catToOpen = url_split[url_split.length-1].split("-")[1];
|
||||
|
||||
if(catToOpen && isNumeric(catToOpen)) {
|
||||
nodeToGo = $('.tree').tree('getNodeById', catToOpen);
|
||||
|
||||
goToNode(nodeToGo, nodeToGo);
|
||||
if (nodeToGo.children) {
|
||||
$(".tree").tree("openNode", nodeToGo, false);
|
||||
}
|
||||
}
|
||||
|
||||
$('.tree').on( 'click', '.move-cat-toogler', function(e) {
|
||||
var node_id = $(this).attr('data-id');
|
||||
var node = $('.tree').tree('getNodeById', node_id);
|
||||
|
@ -121,8 +109,13 @@ $(document).ready(() => {
|
|||
});
|
||||
|
||||
if (openCat != -1) {
|
||||
var node = $('.tree').tree('getNodeById', openCat);
|
||||
$('.tree').tree('openNode', node);
|
||||
nodeToGo = $('.tree').tree('getNodeById', openCat);
|
||||
|
||||
goToNode(nodeToGo, nodeToGo);
|
||||
if (nodeToGo.children) {
|
||||
$(".tree").tree("openNode", nodeToGo, false);
|
||||
}
|
||||
|
||||
$([document.documentElement, document.body]).animate({
|
||||
scrollTop: $("#cat-"+openCat).offset().top
|
||||
}, 500);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue