mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
Merge branch 'jeremydurand-bug/403-configuration-new-album-position'
This commit is contained in:
commit
102e0f0608
2 changed files with 21 additions and 1 deletions
|
@ -1365,9 +1365,26 @@ function create_virtual_category($category_name, $parent_id=null, $options=array
|
||||||
return array('error' => l10n('The name of an album must not be empty'));
|
return array('error' => l10n('The name of an album must not be empty'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rank = 0;
|
||||||
|
if ('last' == $conf['newcat_default_position'])
|
||||||
|
{
|
||||||
|
//what is the current higher rank for this parent?
|
||||||
|
$query = '
|
||||||
|
SELECT MAX(rank) AS max_rank
|
||||||
|
FROM '. CATEGORIES_TABLE .'
|
||||||
|
WHERE id_uppercat '.(empty($parent_id) ? 'IS NULL' : '= '.$parent_id).'
|
||||||
|
;';
|
||||||
|
$row = pwg_db_fetch_assoc(pwg_query($query));
|
||||||
|
|
||||||
|
if (is_numeric($row['max_rank']))
|
||||||
|
{
|
||||||
|
$rank = $row['max_rank'] + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$insert = array(
|
$insert = array(
|
||||||
'name' => $category_name,
|
'name' => $category_name,
|
||||||
'rank' => 0,
|
'rank' => $rank,
|
||||||
'global_rank' => 0,
|
'global_rank' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,9 @@ $conf['newcat_default_visible'] = true;
|
||||||
// automatically create private.
|
// automatically create private.
|
||||||
$conf['newcat_default_status'] = 'public';
|
$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';
|
||||||
|
|
||||||
// level_separator : character string used for separating a category level
|
// level_separator : character string used for separating a category level
|
||||||
// to the sub level. Suggestions : ' / ', ' » ', ' → ', ' - ',
|
// to the sub level. Suggestions : ' / ', ' » ', ' → ', ' - ',
|
||||||
// ' >'
|
// ' >'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue