diff --git a/admin/albums.php b/admin/albums.php index 5022b0bac..afcc8b82d 100644 --- a/admin/albums.php +++ b/admin/albums.php @@ -13,6 +13,25 @@ if (!defined('PHPWG_ROOT_PATH')) include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); +$query = ' +SELECT + COUNT(*) + FROM '.CATEGORIES_TABLE.' +;'; +list($albums_counter) = pwg_db_fetch_row(pwg_query($query)); + +if ($albums_counter > $conf['light_album_manager_threshold']) +{ + $url = get_root_url().'admin.php?page=cat_list'; + + if (isset($_GET['parent_id'])) + { + $url.= '&parent_id='.$_GET['parent_id']; + } + + redirect($url); +} + // +-----------------------------------------------------------------------+ // | Check Access and exit when user status is not ok | // +-----------------------------------------------------------------------+ diff --git a/admin/cat_modify.php b/admin/cat_modify.php index 8690ea088..d6549e36d 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -226,7 +226,7 @@ $template->assign( 'U_ADD_PHOTOS_ALBUM' => $base_url.'photos_add&album='.$category['id'], 'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'], 'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify', - 'U_MOVE' => $base_url.'albums#cat-'.$category['id'], + 'U_MOVE' => $base_url.'albums&parent_id='.$category['id'].'#cat-'.$category['id'], 'F_ACTION' => $form_action, ) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 9ffd16b66..8c15ac9c8 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -98,6 +98,9 @@ $conf['newcat_default_status'] = 'public'; // newcat_default_position : at creation, should the album appear at the first or last position ? $conf['newcat_default_position'] = 'first'; +// above which number of albums should Piwigo use the lighter album manager +$conf['light_album_manager_threshold'] = 2000; + // level_separator : character string used for separating a category level // to the sub level. Suggestions : ' / ', ' » ', ' → ', ' - ', // ' >'