Changeset 19121


Ignore:
Timestamp:
Nov 21, 2012, 3:28:55 PM (8 years ago)
Author:
mistic100
Message:

feature:2718 Add batch manager filters for photo dimensions, small cleaning in the code

Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r19069 r19121  
    371371  if (isset($_SESSION['bulk_manager_filter']['dimension']['max_ratio']))
    372372  {
    373     $where_clause[] = 'width/height <= '.sprintf('%.2f99', $_SESSION['bulk_manager_filter']['dimension']['max_ratio']);
     373    // max_ratio is a floor value, so must be a bit increased
     374    $where_clause[] = 'width/height < '.($_SESSION['bulk_manager_filter']['dimension']['max_ratio']+0.01);
    374375  }
    375376 
     
    447448$ratios = array();
    448449
     450// get all width, height and ratios
    449451$query = '
    450452SELECT
     
    455457;';
    456458$result = pwg_query($query);
     459
    457460while ($row = pwg_db_fetch_assoc($result))
    458461{
     
    474477$dimensions['heights'] = implode(',', $heights);
    475478$dimensions['ratios'] = implode(',', $ratios);
    476 
    477 $dimensions['bounds'] = pwg_db_fetch_assoc(pwg_query($query));
    478479
    479480$dimensions['bounds'] = array(
     
    486487  );
    487488
     489// find ratio categories
    488490$ratio_categories = array(
    489491  'portrait' => array(),
     
    499501    $ratio_categories['portrait'][] = $ratio;
    500502  }
    501 
    502   if ($ratio >= 0.95 and $ratio < 1.05)
     503  else if ($ratio >= 0.95 and $ratio <= 1.05)
    503504  {
    504505    $ratio_categories['square'][] = $ratio;
    505506  }
    506 
    507   if ($ratio > 1.05 and $ratio <= 2.5)
     507  else if ($ratio > 1.05 and $ratio < 2)
    508508  {
    509509    $ratio_categories['landscape'][] = $ratio;
    510510  }
    511 
    512   if ($ratio > 2.5)
     511  else if ($ratio >= 2)
    513512  {
    514513    $ratio_categories['panorama'][] = $ratio;
     
    527526}
    528527
     528// selected=bound if nothing selected
    529529foreach (array_keys($dimensions['bounds']) as $type)
    530530{
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r19069 r19121  
    490490  /* dimensions sliders */
    491491  /**
    492    * find the key from a value in the startStopValues array, for the hour slider
     492   * find the key from a value in the startStopValues array
    493493   */
    494494  function getSliderKeyFromValue(value, values) {
     
    604604    var max = jQuery(this).data("max");
    605605
    606     $("#filter_dimension_"+ type +"_slider").slider(
    607       "values",
    608       0,
     606    $("#filter_dimension_"+ type +"_slider").slider("values", 0,
    609607      getSliderKeyFromValue(min, dimension_values[type])
    610608    );
    611609
    612     $("#filter_dimension_"+type+"_slider").slider("values", 1, getSliderKeyFromValue(max, dimension_values[type]));
     610    $("#filter_dimension_"+type+"_slider").slider("values", 1,
     611      getSliderKeyFromValue(max, dimension_values[type])
     612    );
    613613  });
    614614});
     
    686686         
    687687          {'Ratio'|@translate} ({'Width'|@translate}/{'Height'|@translate}) <span id="filter_dimension_ratio_info">{'between %.2f and %.2f'|@translate|sprintf:$dimensions.selected.min_ratio:$dimensions.selected.max_ratio}</span>
    688 {if isset($dimensions.ratio_portrait.min)}
     688{if isset($dimensions.ratio_portrait)}
    689689          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_portrait.min}" data-max="{$dimensions.ratio_portrait.max}">{'Portrait'|@translate}</a>
    690690{/if}
    691 {if isset($dimensions.ratio_square.min)}
     691{if isset($dimensions.ratio_square)}
    692692          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_square.min}" data-max="{$dimensions.ratio_square.max}">{'square'|@translate}</a>
    693693{/if}
    694 {if isset($dimensions.ratio_landscape.min)}
     694{if isset($dimensions.ratio_landscape)}
    695695          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_landscape.min}" data-max="{$dimensions.ratio_landscape.max}">{'Landscape'|@translate}</a>
    696696{/if}
    697 {if isset($dimensions.ratio_panorama.min)}
     697{if isset($dimensions.ratio_panorama)}
    698698          | <a class="dimensions-choice" data-type="ratio" data-min="{$dimensions.ratio_panorama.min}" data-max="{$dimensions.ratio_panorama.max}">{'Panorama'|@translate}</a>
    699699{/if}
Note: See TracChangeset for help on using the changeset viewer.