source: branches/2.1/admin/themes/default/template/photos_add_direct.tpl @ 6348

Last change on this file since 6348 was 6323, checked in by plg, 14 years ago

merge r6320 from trunk to branch 2.1

bug 1667 fixed: r6027 was fixing a minor error on tabs for Google Chrome/Safari
BUT was introducing a major visual issue for IE8. Backmerged + adds the -webkit
radius anyway.

This is a quickfix for release 2.1.1, the improved display introduced by nikrou
was nice and it would be better to have it, but working in IE8

File size: 8.9 KB
Line 
1{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
2{known_script id="jquery.jgrowl" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.jgrowl_minimized.js"}
3
4{if $upload_mode eq 'multiple'}
5<script type="text/javascript" src="{$uploadify_path}/swfobject.js"></script>
6<script type="text/javascript" src="{$uploadify_path}/jquery.uploadify.v2.1.0.min.js"></script>
7{/if}
8{html_head}
9<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/default/uploadify.jGrowl.css">
10{/html_head}
11
12{literal}
13<script type="text/javascript">
14jQuery(document).ready(function(){
15  function checkUploadStart() {
16    var nbErrors = 0;
17    $("#formErrors").hide();
18    $("#formErrors li").hide();
19
20    if ($("input[name=category_type]:checked").val() == "new" && $("input[name=category_name]").val() == "") {
21      $("#formErrors #emptyCategoryName").show();
22      nbErrors++;
23    }
24
25    var nbFiles = 0;
26    if ($("#uploadBoxes").size() == 1) {
27      $("input[name^=image_upload]").each(function() {
28        if ($(this).val() != "") {
29          nbFiles++;
30        }
31      });
32    }
33    else {
34      nbFiles = $(".uploadifyQueueItem").size();
35    }
36
37    if (nbFiles == 0) {
38      $("#formErrors #noPhoto").show();
39      nbErrors++;
40    }
41
42    if (nbErrors != 0) {
43      $("#formErrors").show();
44      return false;
45    }
46    else {
47      return true;
48    }
49
50  }
51
52  if ($("select[name=category] option").length == 0) {
53    $('input[name=category_type][value=existing]').attr('disabled', true);
54    $('input[name=category_type]').attr('checked', false);
55    $('input[name=category_type][value=new]').attr('checked', true);
56  }
57
58  $("input[name=category_type]").click(function () {
59    $("[id^=category_type_]").hide();
60    $("#category_type_"+$(this).attr("value")).show();
61  });
62
63  $("#hideErrors").click(function() {
64    $("#formErrors").hide();
65    return false;
66  });
67
68{/literal}
69{if $upload_mode eq 'html'}
70{literal}
71  function addUploadBox() {
72    var uploadBox = '<p class="file"><input type="file" size="60" name="image_upload[]"></p>';
73    $(uploadBox).appendTo("#uploadBoxes");
74  }
75
76  addUploadBox();
77
78  $("#addUploadBox A").click(function () {
79    addUploadBox();
80  });
81
82  $("#uploadForm").submit(function() {
83    return checkUploadStart();
84  });
85{/literal}
86{elseif $upload_mode eq 'multiple'}
87
88var uploadify_path = '{$uploadify_path}';
89var upload_id = '{$upload_id}';
90var session_id = '{$session_id}';
91var pwg_token = '{$pwg_token}';
92var buttonText = 'Browse';
93
94{literal}
95  jQuery("#uploadify").uploadify({
96    'uploader'       : uploadify_path + '/uploadify.swf',
97    'script'         : uploadify_path + '/uploadify.php',
98    'scriptData'     : {
99      'upload_id' : upload_id,
100      'session_id' : session_id,
101      'pwg_token' : pwg_token,
102    },
103    'cancelImg'      : uploadify_path + '/cancel.png',
104    'queueID'        : 'fileQueue',
105    'auto'           : false,
106    'displayData'    : 'speed',
107    'buttonText'     : buttonText,
108    'multi'          : true,
109    'fileDesc'       : 'Photo files (*.jpg,*.jpeg)',
110    'fileExt'        : '*.jpg;*.JPG;*.jpeg;*.JPEG',
111    'onAllComplete'  : function(event, data) {
112      if (data.errors) {
113        return false;
114      }
115      else {
116        $("input[name=submit_upload]").click();
117      }
118    },
119    onError: function (event, queueID ,fileObj, errorObj) {
120      var msg;
121      if (errorObj.status == 404) {
122        alert('Could not find upload script.');
123        msg = 'Could not find upload script.';
124      }
125      else if (errorObj.type === "HTTP") {
126        msg = errorObj.type+": "+errorObj.status;
127      }
128      else if (errorObj.type ==="File Size") {
129        msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
130      }
131      else {
132        msg = errorObj.type+": "+errorObj.text;
133      }
134
135      $.jGrowl(
136        '<p></p>'+msg,
137        {
138          theme:  'error',
139          header: 'ERROR',
140          sticky: true
141        }
142      );
143
144      $("#fileUploadgrowl" + queueID).fadeOut(
145        250,
146        function() {
147          $("#fileUploadgrowl" + queueID).remove()
148        }
149      );
150      return false;
151    },
152    onCancel: function (a, b, c, d) {
153      var msg = "Cancelled uploading: "+c.name;
154      $.jGrowl(
155        '<p></p>'+msg,
156        {
157          theme:  'warning',
158          header: 'Cancelled Upload',
159          life:   4000,
160          sticky: false
161        }
162      );
163    },
164    onClearQueue: function (a, b) {
165      var msg = "Cleared "+b.fileCount+" files from queue";
166      $.jGrowl(
167        '<p></p>'+msg,
168        {
169          theme:  'warning',
170          header: 'Cleared Queue',
171          life:   4000,
172          sticky: false
173        }
174      );
175    },
176    onComplete: function (a, b ,c, d, e) {
177      var size = Math.round(c.size/1024);
178      $.jGrowl(
179        '<p></p>'+c.name+' - '+size+'KB',
180        {
181          theme:  'success',
182          header: 'Upload Complete',
183          life:   4000,
184          sticky: false
185        }
186      );
187    }
188  });
189
190  $("input[type=button]").click(function() {
191    if (!checkUploadStart()) {
192      return false;
193    }
194
195    $("#uploadify").uploadifyUpload();
196  });
197
198{/literal}
199{/if}
200});
201</script>
202
203<div class="titrePage">
204  <h2>{'Upload Photos'|@translate}</h2>
205</div>
206
207<div id="photosAddContent">
208
209{if count($setup_errors) > 0}
210<div class="errors">
211  <ul>
212  {foreach from=$setup_errors item=error}
213    <li>{$error}</li>
214  {/foreach}
215  </ul>
216</div>
217{else}
218
219{if !empty($thumbnails)}
220<fieldset>
221  <legend>{'Uploaded Photos'|@translate}</legend>
222  <div>
223  {foreach from=$thumbnails item=thumbnail}
224    <a href="{$thumbnail.link}" class="externalLink">
225      <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail">
226    </a>
227  {/foreach}
228  </div>
229  <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p>
230</fieldset>
231<p><a href="">{'Add another set of photos'|@translate}</a></p>
232{else}
233
234<div id="formErrors" class="errors" style="display:none">
235  <ul>
236    <li id="emptyCategoryName">{'The name of a category should not be empty'|@translate}</li>
237    <li id="noPhoto">{'Select at least one picture'|@translate}</li>
238  </ul>
239  <div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div>
240</div>
241
242<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties">
243    <fieldset>
244      <legend>{'Drop into category'|@translate}</legend>
245      {if $upload_mode eq 'multiple'}
246      <input name="upload_id" value="{$upload_id}" type="hidden">
247      {/if}
248
249      <label><input type="radio" name="category_type" value="existing"> {'existing category'|@translate}</label>
250      <label><input type="radio" name="category_type" value="new" checked="checked"> {'create a new category'|@translate}</label>
251
252      <div id="category_type_existing" style="display:none" class="category_selection">
253        <select class="categoryDropDown" name="category">
254          {html_options options=$category_options selected=$category_options_selected}
255        </select>
256      </div>
257
258      <div id="category_type_new" class="category_selection">
259        <table>
260          <tr>
261            <td>{'Parent category'|@translate}</td>
262            <td>
263              <select class="categoryDropDown" name="category_parent">
264                <option value="0">------------</option>
265                {html_options options=$category_parent_options selected=$category_parent_options_selected}
266              </select>
267            </td>
268          </tr>
269          <tr>
270            <td>{'Category name'|@translate}</td>
271            <td>
272              <input type="text" name="category_name" value="{$F_CATEGORY_NAME}" style="width:400px">
273            </td>
274          </tr>
275        </table>
276      </div>
277    </fieldset>
278
279    <fieldset>
280      <legend>{'Who can see these photos?'|@translate}</legend>
281
282      <select name="level" size="1">
283        {html_options options=$level_options selected=$level_options_selected}
284      </select>
285    </fieldset>
286
287    <fieldset>
288      <legend>{'Select files'|@translate}</legend>
289
290{if $upload_mode eq 'html'}
291    <p><a href="{$switch_url}">{'... or switch to the multiple files form'|@translate}</a></p>
292
293      <p>{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}</p>
294
295      <div id="uploadBoxes"></div>
296      <div id="addUploadBox">
297        <a href="javascript:">{'+ Add an upload box'|@translate}</a>
298      </div>
299   
300    </fieldset>
301
302    <p>
303      <input class="submit" type="submit" name="submit_upload" value="{'Upload'|@translate}" {$TAG_INPUT_ENABLED}>
304    </p>
305{elseif $upload_mode eq 'multiple'}
306    <p>
307      <input type="file" name="uploadify" id="uploadify">
308    </p>
309
310    <p><a href="{$switch_url}">{'... or switch to the old style form'|@translate}</a></p>
311
312    <div id="fileQueue"></div>
313
314    </fieldset>
315    <p>
316      <input class="submit" type="button" value="{'Upload'|@translate}">
317      <input type="submit" name="submit_upload" style="display:none">
318    </p>
319{/if}
320</form>
321{/if} {* empty($thumbnails) *}
322{/if} {* $setup_errors *}
323
324</div> <!-- photosAddContent -->
Note: See TracBrowser for help on using the repository browser.