source: extensions/header_manager/admin/template/add.tpl @ 26308

Last change on this file since 26308 was 26308, checked in by mistic100, 10 years ago

hide NESW handles when forcing ratio

File size: 4.8 KB
Line 
1{combine_css path=$HEADER_MANAGER_PATH|cat:'admin/template/style.css'}
2
3<div class="titrePage">
4        <h2>Header Manager</h2>
5</div>
6
7{if $IN_CROP}
8{combine_css path="themes/default/js/plugins/jquery.Jcrop.css"}
9{combine_script id='jquery.jcrop' load='footer' require='jquery' path='themes/default/js/plugins/jquery.Jcrop.min.js'}
10
11{footer_script require="jquery"}
12(function(){
13  var jcrop_api;
14
15  jQuery("#jcrop").Jcrop({
16    boxWidth: {$crop.box_width},
17    boxHeight: {$crop.box_height},
18    trueSize: [{$picture.width}, {$picture.height}],
19    {if $keep_ratio}aspectRatio: {$crop.real_width}/{$crop.real_height},{/if}
20    setSelect: [{$crop.l}, {$crop.t}, {$crop.r}, {$crop.b}],
21    onChange: function(sel) {
22      jQuery("input[name='x']").val(Math.round(sel.x));
23      jQuery("input[name='y']").val(Math.round(sel.y));
24      jQuery("input[name='x2']").val(Math.round(sel.x2));
25      jQuery("input[name='y2']").val(Math.round(sel.y2));
26     
27      var final_width = Math.min(Math.round(sel.x2-sel.x), {$crop.desired_width}),
28          final_height = Math.round((sel.y2-sel.y)*final_width/(sel.x2-sel.x));
29     
30      jQuery("#width").html(final_width);
31      jQuery("#height").html(final_height);
32    },
33    onRelease: function() {
34      jcrop_api.setSelect([{$crop.l}, {$crop.t}, {$crop.r}, {$crop.b}]);
35    }
36  },
37  function() {
38    jcrop_api = this;
39    {if $keep_ratio}jQuery(".jcrop-holder").addClass('fixed-ratio');{/if}
40  });
41 
42  jQuery('input[name="keep_ratio"]').on('change', function() {
43    jcrop_api.setOptions({
44      aspectRatio: jQuery(this).prop('checked') ? {$crop.real_width}/{$crop.real_height} : 0
45    });
46    if (!jQuery(this).prop('checked')) {
47      jcrop_api.release();
48    }
49    jQuery(".jcrop-holder").toggleClass('fixed-ratio');
50  });
51}());
52{/footer_script}
53
54<form method="post" action="{$F_ACTION}">
55<fieldset>
56  <legend>{'Crop banner image'|translate}</legend>
57  {'Choose the part of the image you want to use as your header.'|translate}<br>
58 
59  <img id="jcrop" src="{$picture.banner_src}">
60 
61  <ul>
62    <li><b>{'Width'|translate}:</b> <span id="width"></span>px</li>
63    <li><b>{'Height'|translate}:</b> <span id="height"></span>px</li>
64    <li><label><input type="checkbox" name="keep_ratio" {if $keep_ratio}checked{/if}> {'Respect %s aspect ratio'|translate:($crop.desired_width|cat:'/'|cat:$crop.desired_height)}</label></li>
65  </ul>
66 
67  <input type="hidden" name="x">
68  <input type="hidden" name="y">
69  <input type="hidden" name="x2">
70  <input type="hidden" name="y2">
71  <input type="hidden" name="picture_file" value="{$picture.filename}">
72 
73  <input type="submit" name="submit_crop" value="{'Submit'|translate}">
74  <input type="submit" name="cancel_crop" value="{'Cancel'|translate}">
75</fieldset>
76</form>
77
78{else}
79{footer_script require="jquery"}
80jQuery(".showInfo").tipTip({
81  delay: 0,
82  fadeIn: 200,
83  fadeOut: 200,
84  maxWidth: '300px',
85});
86
87$("input").bind("keydown", function(event) {
88  var keycode = event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode);
89  if (keycode == 13 && $("input[name='picture_id']").val() != '') {
90    $("input[name='upload_gallery_image']").click();
91    return false;
92  }
93  else {
94    return true;
95  }
96});
97{/footer_script}
98
99<form method="post" action="{$F_ACTION}" ENCTYPE="multipart/form-data">
100  <fieldset>
101    <legend>{'Banner size'|translate}</legend>
102   
103    <label>
104      {'Width'|translate}:
105      <input type="text" name="width" size="4" value="{$BANNER_WIDTH}"> px
106    </label>
107    <br>
108    <br>
109    <label>
110      {'Height'|translate}:
111      <input type="text" name="height" size="4" value="{$BANNER_HEIGHT}"> px
112    </label>
113    <br>
114    <br>
115    <i>{'For MontBlancXL and BlancMontXL, advised size is 900&times;190.'|translate}</i>
116  </fieldset>
117 
118  <fieldset>
119    <legend>{'Select an image'|translate}</legend>
120    {'You can upload a custom header image or select one from your gallery. On the next screen you will be able to crop the image.'|translate}
121    <br><br>
122   
123    <b>{'Choose an image from your computer'|translate}</b>
124    <blockquote>
125      {'Maximum file size: %sB.'|translate:$upload_max_filesize_shorthand} {'Allowed file types: %s.'|translate:'jpg, png, gif'}<br>
126      <input type="file" name="new_image">
127      <input type="hidden" name="MAX_FILE_SIZE" value="{$upload_max_filesize}">
128      <input type="submit" name="upload_new_image" value="{'Upload'|translate}" class="submit">
129    </blockquote>
130   
131    <b>{'or choose a picture from the gallery'|translate}</b>
132    <blockquote>
133      {'Picture id.'|translate} <a class="icon-info-circled-1 showInfo" title="{'The numeric identifier can be found on the picture edition page, near the thumbnail.'|translate}"></a>
134      <input type="text" name="picture_id" size="5">
135      <input type="submit" name="upload_gallery_image" value="{'Use'|translate}" class="submit">
136    </blockquote>
137  </fieldset>
138</form>
139
140{/if}
Note: See TracBrowser for help on using the repository browser.