Ignore:
Timestamp:
Sep 5, 2012, 10:49:12 PM (12 years ago)
Author:
rvelices
Message:

merge-r17765 from trunk to branch 2.4 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=..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/admin/include/functions.php

    r17725 r17766  
    12061206    return array('error' => l10n('The name of an album must not be empty'));
    12071207  }
    1208    
     1208
    12091209  $insert = array(
    12101210    'name' => $category_name,
     
    14751475    }
    14761476
    1477     mass_inserts(
    1478       IMAGE_TAG_TABLE,
    1479       array_keys($inserts[0]),
    1480       $inserts
    1481       );
     1477    if (count($inserts))
     1478    {
     1479      mass_inserts(
     1480        IMAGE_TAG_TABLE,
     1481        array_keys($inserts[0]),
     1482        $inserts
     1483        );
     1484    }
    14821485  }
    14831486}
     
    20962099
    20972100  $taglist = array();
     2101  $altlist = array();
    20982102  while ($row = pwg_db_fetch_assoc($result))
    20992103  {
    2100     if (!$only_user_language and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
    2101     {
    2102       foreach ($matches[2] as $tag_name)
     2104    $raw_name = $row['name'];
     2105    $name = trigger_event('render_tag_name', $raw_name);
     2106
     2107    $taglist[] =  array(
     2108        'name' => $name,
     2109        'id' => '~~'.$row['id'].'~~',
     2110      );
     2111
     2112    if (!$only_user_language)
     2113    {
     2114      $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
     2115
     2116      // TEMP 2.4
     2117      if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
    21032118      {
    2104         array_push(
    2105           $taglist,
    2106           array(
    2107             'name' => trigger_event('render_tag_name', $tag_name),
     2119        foreach ($matches[2] as $alt)
     2120        {
     2121          $alt_names[] = $alt;
     2122        }
     2123      }
     2124
     2125      foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
     2126      {
     2127        $altlist[] =  array(
     2128            'name' => $alt,
    21082129            'id' => '~~'.$row['id'].'~~',
    2109             )
    21102130          );
    21112131      }
    2112 
    2113       $row['name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['name']);
    2114     }
    2115 
    2116     if (strlen($row['name']) > 0)
    2117     {
    2118       array_push(
    2119         $taglist,
    2120         array(
    2121           'name' => trigger_event('render_tag_name', $row['name']),
    2122           'id' => '~~'.$row['id'].'~~',
    2123           )
    2124         );
    2125     }
    2126   }
    2127 
    2128   $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);');
    2129   usort($taglist, $cmp);
     2132    }
     2133  }
     2134
     2135  usort($taglist, 'tag_alpha_compare');
     2136  if (count($altlist))
     2137  {
     2138    usort($altlist, 'tag_alpha_compare');
     2139    $taglist = array_merge($taglist, $altlist);
     2140  }
    21302141
    21312142  return $taglist;
Note: See TracChangeset for help on using the changeset viewer.