Show
Ignore:
Timestamp:
12/30/10 16:54:43 (2 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.

Files:
1 modified

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