mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 17:32:25 +02:00
feature 2737: improve tag administration screen
show for every tag - the number of photos - link to public index page - link to batch manager edit add an event for extended description multi language strings (used for autocompletion and shown in the tag admin screen) instead of hard coded in the core [lang=.. git-svn-id: http://piwigo.org/svn/trunk@17765 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+42
-31
@@ -1205,7 +1205,7 @@ function create_virtual_category($category_name, $parent_id=null, $options=array
|
||||
{
|
||||
return array('error' => l10n('The name of an album must not be empty'));
|
||||
}
|
||||
|
||||
|
||||
$insert = array(
|
||||
'name' => $category_name,
|
||||
'rank' => 0,
|
||||
@@ -1474,11 +1474,14 @@ DELETE
|
||||
}
|
||||
}
|
||||
|
||||
mass_inserts(
|
||||
IMAGE_TAG_TABLE,
|
||||
array_keys($inserts[0]),
|
||||
$inserts
|
||||
);
|
||||
if (count($inserts))
|
||||
{
|
||||
mass_inserts(
|
||||
IMAGE_TAG_TABLE,
|
||||
array_keys($inserts[0]),
|
||||
$inserts
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1498,7 +1501,7 @@ function associate_images_to_categories($images, $categories)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// get existing associations
|
||||
$query = '
|
||||
SELECT
|
||||
@@ -1509,7 +1512,7 @@ SELECT
|
||||
AND category_id IN ('.implode(',', $categories).')
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
||||
$existing = array();
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
@@ -2119,38 +2122,46 @@ function get_taglist($query, $only_user_language=true)
|
||||
$result = pwg_query($query);
|
||||
|
||||
$taglist = array();
|
||||
$altlist = array();
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
if (!$only_user_language and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
|
||||
$raw_name = $row['name'];
|
||||
$name = trigger_event('render_tag_name', $raw_name);
|
||||
|
||||
$taglist[] = array(
|
||||
'name' => $name,
|
||||
'id' => '~~'.$row['id'].'~~',
|
||||
);
|
||||
|
||||
if (!$only_user_language)
|
||||
{
|
||||
foreach ($matches[2] as $tag_name)
|
||||
$alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
|
||||
|
||||
// TEMP 2.4
|
||||
if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
|
||||
{
|
||||
array_push(
|
||||
$taglist,
|
||||
array(
|
||||
'name' => trigger_event('render_tag_name', $tag_name),
|
||||
'id' => '~~'.$row['id'].'~~',
|
||||
)
|
||||
);
|
||||
foreach ($matches[2] as $alt)
|
||||
{
|
||||
$alt_names[] = $alt;
|
||||
}
|
||||
}
|
||||
|
||||
$row['name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['name']);
|
||||
}
|
||||
|
||||
if (strlen($row['name']) > 0)
|
||||
{
|
||||
array_push(
|
||||
$taglist,
|
||||
array(
|
||||
'name' => trigger_event('render_tag_name', $row['name']),
|
||||
'id' => '~~'.$row['id'].'~~',
|
||||
)
|
||||
);
|
||||
foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
|
||||
{
|
||||
$altlist[] = array(
|
||||
'name' => $alt,
|
||||
'id' => '~~'.$row['id'].'~~',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);');
|
||||
usort($taglist, $cmp);
|
||||
usort($taglist, 'tag_alpha_compare');
|
||||
if (count($altlist))
|
||||
{
|
||||
usort($altlist, 'tag_alpha_compare');
|
||||
$taglist = array_merge($taglist, $altlist);
|
||||
}
|
||||
|
||||
return $taglist;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user