Ignore:
Timestamp:
Aug 17, 2010, 5:47:14 PM (14 years ago)
Author:
plg
Message:

feature 1802 added: filtering system. Only 3 filters available, more to come
later. Ability to add/remove filters on the fly.

When an administrator displays the "caddie" content, it means bulk manager
with a single filter "prefilter=caddie". Same principle for the photos of a
given album.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/bulk_manager/element_set_global.tpl

    r6756 r6772  
    235235  });
    236236
     237  $(".removeFilter").click(function () {
     238    var filter = $(this).parent('li').attr("id");
     239    filter_disable(filter);
     240
     241    return false;
     242  });
     243
     244  function filter_enable(filter) {
     245    /* show the filter*/
     246    $("#"+filter).show();
     247
     248    /* check the checkbox to declare we use this filter */
     249    $("input[type=checkbox][name="+filter+"_use]").attr("checked", true);
     250
     251    /* forbid to select this filter in the addFilter list */
     252    $("#addFilter").children("option[value="+filter+"]").attr("disabled", "disabled");
     253  }
     254
     255  $("#addFilter").change(function () {
     256    var filter = $(this).attr("value");
     257    filter_enable(filter);
     258    $(this).attr("value", -1);
     259  });
     260
     261  function filter_disable(filter) {
     262    /* hide the filter line */
     263    $("#"+filter).hide();
     264
     265    /* uncheck the checkbox to declare we do not use this filter */
     266    $("input[name="+filter+"_use]").removeAttr("checked");
     267
     268    /* give the possibility to show it again */
     269    $("#addFilter").children("option[value="+filter+"]").removeAttr("disabled");
     270  }
     271
     272  $("#removeFilters").click(function() {
     273    $("#filterList li").each(function() {
     274      var filter = $(this).attr("id");
     275      filter_disable(filter);
     276    });
     277    return false;
     278  });
     279
    237280  checkPermitAction()
    238281});
     
    253296#selectSet a {border-bottom:1px dotted}
    254297#applyOnDetails {font-style:italic;}
     298
     299.actionButtons {text-align:left;}
     300#filterList {padding-left:5px;}
     301#filterList li {margin-bottom:5px; list-style-type:none;}
     302a.removeFilter {background: url(plugins/bulk_manager/remove_filter.png) no-repeat top left;width:7px;height:7px;display:inline-block}
     303a.removeFilter:hover {background: url(plugins/bulk_manager/remove_filter_hover.png); border:none;}
     304.removeFilter span {display:none}
     305#applyFilterBlock {margin-top:20px;}
     306.useFilterCheckbox {display:none}
    255307</style>
    256308{/literal}
    257309
     310  <p style="float:left; font-size:90%;margin:5px 0 0 0;padding:0;">
     311    <a href="{$U_UNIT_MODE}">Switch to unit mode</a>
     312  </p>
     313
    258314<h2>{'Batch management'|@translate}</h2>
    259315
    260 <h3>{$CATEGORIES_NAV}</h3>
    261 
    262 {if !empty($thumbnails)}
    263   <p style="text-align:center;">
    264     {'global mode'|@translate}
    265     | <a href="{$U_UNIT_MODE}">{'unit mode'|@translate}</a>
    266   </p>
    267 
    268   <fieldset style="display:none;">
    269 
    270     <legend>{'Display options'|@translate}</legend>
    271 
    272     <p>{'elements per page'|@translate}:
    273         <a href="{$U_DISPLAY}&amp;display=20">20</a>
    274       | <a href="{$U_DISPLAY}&amp;display=50">50</a>
    275       | <a href="{$U_DISPLAY}&amp;display=100">100</a>
    276       | <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
     316  <form action="{$F_ACTION}" method="post">
     317
     318  <fieldset>
     319    <legend>{'Filter'|@translate}</legend>
     320
     321    <ul id="filterList">
     322      <li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
     323        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
     324        <input type="checkbox" name="filter_prefilter_use" class="useFilterCheckbox" {if isset($filter.prefilter)}checked="checked"{/if}>
     325        predefined filter
     326        <select name="filter_prefilter">
     327          <option value="caddie" {if $filter.prefilter eq 'caddie'}selected="selected"{/if}>caddie</option>
     328          <option value="last import" {if $filter.prefilter eq 'last import'}selected="selected"{/if}>last import</option>
     329<!--          <option value="with no album">with no album</option> -->
     330<!--          <option value="with no virtual album">with no virtual album</option> -->
     331<!--          <option value="with no tag">with no tag</option> -->
     332        </select>
     333      </li>
     334      <li id="filter_category" {if !isset($filter.category)}style="display:none"{/if}>
     335        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
     336        <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
     337        album
     338        <select style="width:400px" name="filter_category" size="1">
     339          {html_options options=$filter_category_options selected=$filter_category_options_selected}
     340        </select>
     341        <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
     342      </li>
     343      <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}>
     344        <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a>
     345        <input type="checkbox" name="filter_level_use" class="useFilterCheckbox" {if isset($filter.level)}checked="checked"{/if}>
     346        {'Who can see these photos?'|@translate}
     347        <select name="filter_level" size="1">
     348          {html_options options=$filter_level_options selected=$filter_level_options_selected}
     349        </select>
     350      </li>
     351    </ul>
     352
     353    <p class="actionButtons" style="">
     354      <select id="addFilter">
     355        <option value="-1">Add a filter</option>
     356        <option disabled="disabled">------------------</option>
     357        <option value="filter_prefilter">predefined filter</option>
     358        <option value="filter_category">album</option>
     359        <option value="filter_level">{'Who can see these photos?'|@translate}</option>
     360      </select>
     361<!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
     362      <a id="removeFilters" href="">Remove all filters</a>
    277363    </p>
    278364
     365    <p class="actionButtons" id="applyFilterBlock">
     366      <input id="applyFilter" class="submit" type="submit" value="Refresh photo set" name="submitFilter">
     367    </p>
     368
    279369  </fieldset>
    280370
    281 <!--  <fieldset> -->
    282 <!--    <legend>{'Filter'|@translate}</legend> -->
    283 <!--  </fieldset> -->
    284 
    285   <form action="{$F_ACTION}" method="post">
    286 
    287371  <fieldset>
    288372
    289373    <legend>{'Selection'|@translate}</legend>
    290374
     375  {if !empty($thumbnails)}
    291376  <p id="checkActions">
    292377    {'Select:'|@translate}
     
    304389  </p>
    305390
    306   {if !empty($thumbnails)}
    307391    <ul class="thumbnails">
    308392      {foreach from=$thumbnails item=thumbnail}
     
    332416      {/foreach}
    333417    </ul>
    334   {/if}
    335418
    336419  {if !empty($navbar) }
     
    351434  {/if}
    352435
     436  {else}
     437  <div>No photo in the current set.</div>
     438  {/if}
    353439  </fieldset>
    354440
     
    462548    </div>
    463549
    464     <p id="applyActionBlock" style="display:none">
     550    <p id="applyActionBlock" style="display:none" class="actionButtons">
    465551      <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit" {$TAG_INPUT_ENABLED}> <span id="applyOnDetails"></span></p>
    466552
     
    469555
    470556  </form>
    471 
    472 {else}
    473   <div class="infos"><p>{'Caddie is currently empty'|@translate}</p></div>
    474 {/if}
Note: See TracChangeset for help on using the changeset viewer.