Changeset 12630 for trunk/admin


Ignore:
Timestamp:
11/15/11 12:58:10 (8 years ago)
Author:
plg
Message:

merge r12629 from branch 2.3 to trunk

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:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r12259 r12630  
    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 
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r12474 r12630  
    484484        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label> 
    485485      </li> 
    486                         <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}> 
    487                                 <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> 
    488                                 <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}> 
    489                                 {'Tags'|@translate} 
    490                                 <select id="tagsFilter" name="filter_tags"> 
    491                                         {foreach from=$filter_tags item=tag} 
    492                                         <option value="{$tag.id}">{$tag.name}</option> 
    493                                         {/foreach} 
    494                                 </select> 
    495                         </li> 
     486      <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}> 
     487        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> 
     488        <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}> 
     489        {'Tags'|@translate} 
     490        <select id="tagsFilter" name="filter_tags"> 
     491          {foreach from=$filter_tags item=tag} 
     492          <option value="{$tag.id}">{$tag.name}</option> 
     493          {/foreach} 
     494        </select> 
     495        <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> 
     496        <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> 
     497      </li> 
    496498      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}> 
    497499        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> 
Note: See TracChangeset for help on using the changeset viewer.