Ignore:
Timestamp:
Apr 22, 2011, 12:35:16 AM (13 years ago)
Author:
patdenice
Message:

feature:2273
Add crop functionality to webservice and batch manager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r10454 r10553  
    3737var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}";
    3838var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}";
     39
     40var width_str = '{'Width'|@translate}';
     41var height_str = '{'Height'|@translate}';
     42var max_width_str = '{'Maximum Width'|@translate}';
     43var max_height_str = '{'Maximum Height'|@translate}';
    3944{literal}
    4045function str_repeat(i, m) {
     
    334339      maxheight = jQuery('input[name="thumb_maxheight"]').val();
    335340      regenerationText = regenerateThumbnailsMessage;
     341      crop = jQuery('input[name="thumb_crop"]').is(':checked');
     342      follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked');
    336343    }
    337344    else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize')
     
    342349      maxheight = jQuery('input[name="websize_maxheight"]').val();
    343350      regenerationText = regenerateWebsizeMessage;
     351      crop = false;
     352      follow_orientation = false;
    344353    }
    345354    else return true;
     
    386395          maxwidth: maxwidth,
    387396          maxheight: maxheight,
     397          crop: crop,
     398          follow_orientation: follow_orientation,
    388399          image_id: elements[i],
    389400          format: 'json'
     
    396407    return false;
    397408  });
     409
     410  function toggleCropFields(prefix) {
     411    if (jQuery("#"+prefix+"_crop").is(':checked')) {
     412      jQuery("#"+prefix+"_width_th").text(width_str);
     413      jQuery("#"+prefix+"_height_th").text(height_str);
     414      jQuery("#"+prefix+"_follow_orientation_tr").show();
     415    }
     416    else {
     417      jQuery("#"+prefix+"_width_th").text(max_width_str);
     418      jQuery("#"+prefix+"_height_th").text(max_height_str);
     419      jQuery("#"+prefix+"_follow_orientation_tr").hide();
     420    }
     421  }
     422
     423  toggleCropFields("thumb");
     424  jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")});
    398425
    399426  checkPermitAction()
     
    662689      <table style="margin-left:20px;">
    663690        <tr>
    664           <th>{'Maximum Width'|@translate}</th>
     691          <th><label for="thumb_crop">{'Crop'|@translate}</label></th>
     692          <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td>
     693        </tr>
     694        <tr id="thumb_follow_orientation_tr">
     695          <th><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></th>
     696          <td><input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {if $upload_form_settings.thumb_follow_orientation}checked="checked"{/if}></td>
     697        </tr>
     698        <tr>
     699          <th id="thumb_width_th">{'Maximum Width'|@translate}</th>
    665700          <td><input type="text" name="thumb_maxwidth" value="{$upload_form_settings.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
    666701        </tr>
    667702        <tr>
    668           <th>{'Maximum Height'|@translate}</th>
     703          <th id="thumb_height_th">{'Maximum Height'|@translate}</th>
    669704          <td><input type="text" name="thumb_maxheight" value="{$upload_form_settings.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
    670705        </tr>
Note: See TracChangeset for help on using the changeset viewer.