Changeset 12629 for branches/2.3/admin


Ignore:
Timestamp:
Nov 15, 2011, 12:48:37 PM (12 years ago)
Author:
plg
Message:

bug 2506 fixed: Batch Manager does not take permissions into account when
filtering on tags

feature 2507 added: Batch Manager can filter on "all tags" or "any tag"

Location:
branches/2.3/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/admin/batch_manager.php

    r12259 r12629  
    7272  {
    7373    $_SESSION['bulk_manager_filter']['tags'] = get_tag_ids($_POST['filter_tags'], false);
     74
     75    if (isset($_POST['tag_mode']) and in_array($_POST['tag_mode'], array('AND', 'OR')))
     76    {
     77      $_SESSION['bulk_manager_filter']['tag_mode'] = $_POST['tag_mode'];
     78    }
    7479  }
    7580
     
    298303if (!empty($_SESSION['bulk_manager_filter']['tags']))
    299304{
    300         $query = '
    301 SELECT image_id
    302         FROM '.IMAGE_TAG_TABLE.
    303         'WHERE tag_id IN('.implode(',',$_SESSION['bulk_manager_filter']['tags']).')
    304         GROUP BY image_id
    305         HAVING COUNT(tag_id)='.count($_SESSION['bulk_manager_filter']['tags']);
    306         array_push(
     305  array_push(
    307306    $filter_sets,
    308                 get_image_ids_for_tags($_SESSION['bulk_manager_filter']['tags'])
    309                 );
     307    get_image_ids_for_tags(
     308      $_SESSION['bulk_manager_filter']['tags'],
     309      $_SESSION['bulk_manager_filter']['tag_mode'],
     310      null,
     311      null,
     312      false // we don't apply permissions in administration screens
     313      )
     314    );
    310315}
    311316
  • branches/2.3/admin/themes/default/template/batch_manager_global.tpl

    r12476 r12629  
    481481        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
    482482      </li>
    483                         <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
    484                                 <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
    485                                 <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}>
    486                                 {'Tags'|@translate}
    487                                 <select id="tagsFilter" name="filter_tags">
    488                                         {foreach from=$filter_tags item=tag}
    489                                         <option value="{$tag.id}">{$tag.name}</option>
    490                                         {/foreach}
    491                                 </select>
    492                         </li>
     483      <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
     484        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
     485        <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}>
     486        {'Tags'|@translate}
     487        <select id="tagsFilter" name="filter_tags">
     488          {foreach from=$filter_tags item=tag}
     489          <option value="{$tag.id}">{$tag.name}</option>
     490          {/foreach}
     491        </select>
     492        <label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label>
     493        <label><span><input type="radio" name="tag_mode" value="OR" {if isset($filter.tag_mode) and $filter.tag_mode eq 'OR'}checked="checked"{/if}> {'Any tag'|@translate}</span></label>
     494      </li>
    493495      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
    494496        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
Note: See TracChangeset for help on using the changeset viewer.