Ignore:
Timestamp:
Feb 9, 2012, 11:16:56 AM (12 years ago)
Author:
plg
Message:

feature 2309 added: ability to "move photos" into an album from the Batch
Manager, ie "dissociate from all albums" + "associate" in a single action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r13063 r13064  
    4545check_input_parameter('del_tags', $_POST, true, PATTERN_ID);
    4646check_input_parameter('associate', $_POST, false, PATTERN_ID);
     47check_input_parameter('move', $_POST, false, PATTERN_ID);
    4748check_input_parameter('dissociate', $_POST, false, PATTERN_ID);
    4849
     
    174175        redirect($redirect_url);
    175176      }
     177    }
     178  }
     179
     180  if ('move' == $action)
     181  {
     182    // let's first break links with all albums but their "storage album"
     183    $query = '
     184DELETE '.IMAGE_CATEGORY_TABLE.'.*
     185  FROM '.IMAGE_CATEGORY_TABLE.'
     186    JOIN '.IMAGES_TABLE.' ON image_id=id
     187  WHERE id IN ('.implode(',', $collection).')
     188    AND (storage_category_id IS NULL OR storage_category_id != category_id)
     189;';
     190    pwg_query($query);
     191   
     192    associate_images_to_categories(
     193      $collection,
     194      array($_POST['move'])
     195      );
     196
     197    $_SESSION['page_infos'] = array(
     198      l10n('Information data registered in database')
     199      );
     200   
     201    // let's refresh the page because we the current set might be modified
     202    if ('with no album' == $page['prefilter'])
     203    {
     204      redirect($redirect_url);
     205    }
     206
     207    if ('with no virtual album' == $page['prefilter'])
     208    {
     209      $category_info = get_cat_info($_POST['move']);
     210      if (empty($category_info['dir']))
     211      {
     212        redirect($redirect_url);
     213      }
     214    }
     215
     216    if (isset($_SESSION['bulk_manager_filter']['category'])
     217        and $_POST['move'] != $_SESSION['bulk_manager_filter']['category'])
     218    {
     219      redirect($redirect_url);
    176220    }
    177221  }
     
    204248      pwg_query($query);
    205249
    206       update_category($_POST['dissociate']);
    207      
    208250      $_SESSION['page_infos'] = array(
    209251        l10n('Information data registered in database')
    210252        );
    211253     
    212       // let's refresh the page because we the current set might be modified
     254      // let's refresh the page because the current set might be modified
    213255      redirect($redirect_url);
    214256    }
     
    529571;';
    530572display_select_cat_wrapper($query, array(), 'associate_options', true);
     573display_select_cat_wrapper($query, array(), 'move_options', true);
    531574display_select_cat_wrapper($query, array(), 'category_parent_options');
    532575
Note: See TracChangeset for help on using the changeset viewer.