aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-09-05 20:38:30 +0000
committerrvelices <rv-github@modusoptimus.com>2012-09-05 20:38:30 +0000
commitdadd8f6307843311c9025be00915c95ff52407a7 (patch)
tree425b8ec1b77809abe6f540bb5727b30f2dd1b871 /admin/include
parent528c75ab35b915b574b4977b8d19412b69845d26 (diff)
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
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php71
1 files changed, 41 insertions, 30 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 2be457816..30f1517e9 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -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),
+ foreach ($matches[2] as $alt)
+ {
+ $alt_names[] = $alt;
+ }
+ }
+
+ foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
+ {
+ $altlist[] = array(
+ 'name' => $alt,
'id' => '~~'.$row['id'].'~~',
- )
);
}
-
- $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'].'~~',
- )
- );
}
}
- $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;
}