Changeset 8398


Ignore:
Timestamp:
Dec 30, 2010, 4:54:43 PM (14 years ago)
Author:
plg
Message:

feature 2089: report feature:1845 in the new Batch Manager.

+ once the photos are deleted, redirect the page to reset the current photo set
and avoid being on an empty 2nd page.

Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r8397 r8398  
    152152      // we remove the dissociated images if we are currently displaying the
    153153      // category to dissociate from.
     154      //
     155      // TODO we can display the photo of a given album without the $_GET['cat']
    154156      if (is_numeric($_GET['cat']) and $_POST['dissociate'] == $_GET['cat'])
    155157      {
     
    270272    if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
    271273    {
    272       // filter selection on photos that have no storage_category_id (ie
    273       // that were added via pLoader)
    274       $query = '
    275 SELECT id
    276   FROM '.IMAGES_TABLE.'
    277   WHERE id IN ('.implode(',', $collection).')
    278     AND storage_category_id IS NULL
    279 ;';
    280       $deletables = array_from_query($query, 'id');
    281 
    282       if (count($deletables) > 0)
     274      $deleted_count = delete_elements($collection, true);
     275      if ($deleted_count > 0)
    283276      {
    284         $physical_deletion = true;
    285         delete_elements($deletables, $physical_deletion);
    286 
    287         array_push(
    288           $page['infos'],
     277        $_SESSION['page_infos'] = array(
    289278          sprintf(
    290279            l10n_dec(
    291280              '%d photo was deleted',
    292281              '%d photos were deleted',
    293               count($deletables)
     282              $deleted_count
    294283              ),
    295             count($deletables)
     284            $deleted_count
    296285            )
    297286          );
    298287
    299         // we have to remove the deleted photos from the current set
    300         $page['cat_elements_id'] = array_diff($page['cat_elements_id'], $deletables);
     288        $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
     289        redirect($redirect_url);
    301290      }
    302291      else
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r8396 r8398  
    496496    <!-- delete -->
    497497    <div id="action_delete" class="bulkAction">
    498 {if $ENABLE_SYNCHRONIZATION}
    499     <p style="font-style:italic;width:500px;">{'Note: photo deletion does not apply to photos added by synchronization. For photos added by synchronization, remove them from the filesystem and then perform another synchronization.'|@translate}</p>
    500 {/if}
    501498    <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p>
    502499    </div>
Note: See TracChangeset for help on using the changeset viewer.