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/tags.php

    r12922 r17766  
    4646;';
    4747  $existing_names = array_from_query($query, 'name');
    48  
     48
    4949
    5050  $current_name_of = array();
     
    5959    $current_name_of[ $row['id'] ] = $row['name'];
    6060  }
    61  
     61
    6262  $updates = array();
    6363  // we must not rename tag with an already existing name
     
    118118    $destination_tag_id = $_POST['destination_tag'];
    119119    $tag_ids = explode(',', $_POST['merge_list']);
    120    
     120
    121121    if (is_array($tag_ids) and count($tag_ids) > 1)
    122122    {
     
    134134        $name_of_tag[ $row['id'] ] = trigger_event('render_tag_name', $row['name']);
    135135      }
    136      
     136
    137137      $tag_ids_to_delete = array_diff(
    138138        $tag_ids,
     
    189189        $tags_deleted[] = $name_of_tag[$tag_id];
    190190      }
    191      
     191
    192192      array_push(
    193193        $page['infos'],
     
    217217
    218218  delete_tags($_POST['tags']);
    219  
     219
    220220  array_push(
    221221    $page['infos'],
    222222    l10n_dec(
    223       'The following tag was deleted', 
     223      'The following tag was deleted',
    224224      'The %d following tags were deleted',
    225225      count($tag_names)).' : '.
     
    235235{
    236236  check_pwg_token();
    237  
     237
    238238  delete_orphan_tags();
    239239  $_SESSION['page_infos'] = array(l10n('Orphan tags deleted'));
     
    269269        )
    270270      );
    271    
     271
    272272    array_push(
    273273      $page['infos'],
     
    332332// +-----------------------------------------------------------------------+
    333333
     334
     335// tag counters
     336$query = '
     337SELECT tag_id, COUNT(image_id) AS counter
     338  FROM '.IMAGE_TAG_TABLE.'
     339  GROUP BY tag_id';
     340$tag_counters = simple_hash_from_query($query, 'tag_id', 'counter');
     341
     342// all tags
     343$query = '
     344SELECT *
     345  FROM '.TAGS_TABLE.'
     346;';
     347$result = pwg_query($query);
     348$all_tags = array();
     349while ($tag = pwg_db_fetch_assoc($result))
     350{
     351  $raw_name = $tag['name'];
     352  $tag['name'] = trigger_event('render_tag_name', $raw_name);
     353  $tag['counter'] = intval(@$tag_counters[ $tag['id'] ]);
     354  $tag['U_VIEW'] = make_index_url(array('tags'=>array($tag)));
     355  $tag['U_EDIT'] = 'admin.php?page=batch_manager&cat=tag-'.$tag['id'];
     356
     357  $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
     358  $alt_names = array_diff( array_unique($alt_names), array($tag['name']) );
     359  if (count($alt_names))
     360  {
     361    $tag['alt_names'] = implode(', ', $alt_names);
     362  }
     363  $all_tags[] = $tag;
     364}
     365usort($all_tags, 'tag_alpha_compare');
     366
     367
     368
    334369$template->assign(
    335370  array(
    336     'TAG_SELECTION' => get_html_tag_selection(
    337       get_all_tags(),
    338       'tags'
    339       ),
     371    'all_tags' => $all_tags,
    340372    )
    341373  );
     
    348380    $list_name = 'MERGE_TAGS_LIST';
    349381  }
    350  
     382
    351383  $template->assign(
    352384    array(
Note: See TracChangeset for help on using the changeset viewer.