Changeset 13064


Ignore:
Timestamp:
Feb 9, 2012, 11:16:56 AM (9 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.

Location:
trunk
Files:
4 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
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r13063 r13064  
    195195    $("#action_"+$(this).attr("value")).show();
    196196
     197    /* make sure the #albumSelect is on the right select box so that the */
     198    /* "add new album" popup fills the right select box                  */
     199    if ("associate" == $(this).attr("value") || "move" == $(this).attr("value")) {
     200      jQuery("#albumSelect").removeAttr("id");
     201      jQuery("#action_"+$(this).attr("value")+" select").attr("id", "albumSelect");
     202    }
     203
    197204    if ($(this).val() != -1) {
    198205      $("#applyActionBlock").show();
     
    613620  {/if}
    614621      <option value="associate">{'Associate to album'|@translate}</option>
     622      <option value="move">{'Move to album'|@translate}</option>
    615623  {if !empty($dissociate_options)}
    616624      <option value="dissociate">{'Dissociate from album'|@translate}</option>
     
    646654    <!-- associate -->
    647655    <div id="action_associate" class="bulkAction">
    648           <select id="albumSelect" style="width:400px" name="associate" size="1">
     656          <select style="width:400px" name="associate" size="1">
    649657            {html_options options=$associate_options }
    650658         </select>
    651659<br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
    652660    </div>
     661
     662    <!-- move -->
     663    <div id="action_move" class="bulkAction">
     664          <select style="width:400px" name="move" size="1">
     665            {html_options options=$move_options }
     666         </select>
     667<br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
     668    </div>
     669
    653670
    654671    <!-- dissociate -->
  • trunk/language/en_UK/admin.lang.php

    r13013 r13064  
    847847$lang['This album contains %d photos, added between %s and %s.'] = 'This album contains %d photos, added between %s and %s.';
    848848$lang['This album contains no photo.'] = 'This album contains no photo.';
     849$lang['Move to album'] = 'Move to album';
    849850?>
  • trunk/language/fr_FR/admin.lang.php

    r13041 r13064  
    847847$lang['This album contains no photo.'] = 'Cet album ne contient pas de photo.';
    848848$lang['%s has been successfully updated.'] = '%s a été mis à jour avec succès.';
     849$lang['Move to album'] = 'Déplacer vers l\'album';
    849850?>
Note: See TracChangeset for help on using the changeset viewer.