Changeset 8764


Ignore:
Timestamp:
Jan 19, 2011, 3:51:03 PM (9 years ago)
Author:
plg
Message:

feature 1062 added: ability to delete a single photo from its administration
screen

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r8728 r8764  
    3838
    3939// +-----------------------------------------------------------------------+
     40// |                             delete photo                              |
     41// +-----------------------------------------------------------------------+
     42
     43if (isset($_GET['delete']))
     44{
     45  check_pwg_token();
     46
     47  delete_elements(array($_GET['image_id']), true);
     48
     49  // where to redirect the user now?
     50  //
     51  // 1. if a category is available in the URL, use it
     52  // 2. else use the first reachable linked category
     53  // 3. redirect to gallery root
     54
     55  if (isset($_GET['cat_id']))
     56  {
     57    redirect(
     58      make_index_url(
     59        array(
     60          'category' => get_cat_info($_GET['cat_id'])
     61          )
     62        )
     63      );
     64  }
     65
     66  $query = '
     67SELECT category_id
     68  FROM '.IMAGE_CATEGORY_TABLE.'
     69  WHERE image_id = '.$_GET['image_id'].'
     70;';
     71
     72  $authorizeds = array_diff(
     73    array_from_query($query, 'category_id'),
     74    explode(',', calculate_permissions($user['id'], $user['status']))
     75    );
     76 
     77  foreach ($authorizeds as $category_id)
     78  {
     79    redirect(
     80      make_index_url(
     81        array(
     82          'category' => get_cat_info($category_id)
     83          )
     84        )
     85      );
     86  }
     87
     88  redirect(make_index_url());
     89}
     90
     91// +-----------------------------------------------------------------------+
    4092// |                          synchronize metadata                         |
    4193// +-----------------------------------------------------------------------+
     
    210262  );
    211263
     264$admin_url_start = get_root_url().'admin.php?page=picture_modify';
     265$admin_url_start.= '&image_id='.$_GET['image_id'];
     266$admin_url_start.= isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : '';
     267
    212268$template->assign(
    213269  array(
    214270    'tags' => $tags,
    215     'U_SYNC' =>
    216         get_root_url().'admin.php?page=picture_modify'.
    217         '&image_id='.$_GET['image_id'].
    218         (isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : '').
    219         '&sync_metadata=1',
     271    'U_SYNC' => $admin_url_start.'&sync_metadata=1',
     272    'U_DELETE' => $admin_url_start.'&delete=1&pwg_token='.get_pwg_token(),
    220273
    221274    'PATH'=>$row['path'],
  • trunk/admin/themes/default/template/picture_modify.tpl

    r8723 r8764  
    3333  {if !url_is_remote($PATH)}
    3434  <li><a href="{$U_SYNC}" title="{'synchronize'|@translate}"><img src="{$themeconf.admin_icon_dir}/sync_metadata.png" class="button" alt="{'synchronize'|@translate}"></a></li>
     35
     36  <li><a href="{$U_DELETE}" title="{'delete photo'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'delete photo'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"></a></li>
    3537  {/if}
    3638</ul>
  • trunk/language/en_UK/admin.lang.php

    r8762 r8764  
    216216$lang['delete album'] = "delete album";
    217217$lang['Delete orphan tags'] = 'Delete orphan tags';
     218$lang['delete photo'] = 'delete photo';
    218219$lang['Delete Representant'] = "Delete Representant";
    219220$lang['Delete selected photos'] = "Delete selected photos";
  • trunk/language/fr_FR/admin.lang.php

    r8762 r8764  
    785785$lang['You have %d orphan tags: %s.'] = 'Vous avez %d tags orphelins: %s.';
    786786$lang['Delete orphan tags'] = 'Supprimer les tags orphelins';
     787$lang['delete photo'] = 'supprimer la photo';
    787788?>
Note: See TracChangeset for help on using the changeset viewer.