- Timestamp:
- Aug 19, 2011, 6:04:43 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/photos_add_direct.tpl
r11967 r11975 1 1 {if $upload_mode eq 'multiple'} 2 2 {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } 3 {combine_script id='swfobject' load='footer' path='admin/include/uploadify/swfobject.js'} 4 {combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v2.1.0.min.js' } 3 {combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v3.0.0.min.js' } 5 4 {combine_css path="admin/themes/default/uploadify.jGrowl.css"} 6 5 {combine_css path="admin/include/uploadify/uploadify.css"} … … 177 176 var session_id = '{$session_id}'; 178 177 var pwg_token = '{$pwg_token}'; 179 var buttonText = 'Browse';180 var sizeLimit = {$upload_max_filesize};178 var buttonText = "{'Select files'|@translate}"; 179 var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */ 181 180 182 181 {literal} 183 182 jQuery("#uploadify").uploadify({ 184 'uploader' : uploadify_path + '/uploadify. swf',185 ' script' : uploadify_path + '/uploadify.php',186 's criptData' : {187 'upload_id' : upload_id, 188 'session_id' : session_id,189 'pwg_token' : pwg_token,190 },191 'cancelIm g': uploadify_path + '/cancel.png',183 'uploader' : uploadify_path + '/uploadify.php', 184 'langFile' : uploadify_path + '/uploadifyLang_en.js', 185 'swf' : uploadify_path + '/uploadify.swf', 186 187 buttonCursor : 'pointer', 188 'buttonText' : buttonText, 189 'width' : 300, 190 'cancelImage' : uploadify_path + '/cancel.png', 192 191 'queueID' : 'fileQueue', 193 192 'auto' : false, 194 'buttonText' : buttonText,195 193 'multi' : true, 196 'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)', 197 'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG', 198 'sizeLimit' : sizeLimit, 194 'fileTypeDesc' : 'Photo files', 195 'fileTypeExts' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF', 196 'fileSizeLimit' : sizeLimit, 197 'progressData' : 'percentage', 198 requeueErrors : false, 199 199 'onSelect' : function(event,ID,fileObj) { 200 200 jQuery("#fileQueue").show(); 201 201 }, 202 'onAllComplete' : function(event, data) { 203 if (data.errors) { 202 'onQueueComplete' : function(stats) { 203 jQuery("input[name=submit_upload]").click(); 204 }, 205 onUploadError: function (file,errorCode,errorMsg,errorString,swfuploadifyQueue) { 206 /* uploadify calls the onUploadError trigger when the user cancels a file! */ 207 /* There no error so we skip it to avoid panic. */ 208 if ("Cancelled" == errorString) { 204 209 return false; 205 210 } 206 else { 207 jQuery("input[name=submit_upload]").click(); 208 } 209 }, 210 onError: function (event, queueID ,fileObj, errorObj) { 211 var msg; 212 213 if (errorObj.type === "HTTP") { 214 if (errorObj.info === 404) { 215 alert('Could not find upload script.'); 216 msg = 'Could not find upload script.'; 217 } 218 else { 219 msg = errorObj.type+": "+errorObj.info; 220 } 221 } 222 else if (errorObj.type ==="File Size") { 223 msg = "File too big"; 224 msg = msg + '<br>'+fileObj.name+': '+humanReadableFileSize(fileObj.size); 225 msg = msg + '<br>Limit: '+humanReadableFileSize(sizeLimit); 226 } 227 else { 228 msg = errorObj.type+": "+errorObj.info; 229 } 211 212 var msg = file.name+', '+errorString; 213 214 /* Let's put the error message in the form to display once the form is */ 215 /* performed, it makes support easier when user can copy/paste the error */ 216 /* thrown. */ 217 jQuery("#uploadForm").append('<input type="hidden" name="onUploadError[]" value="'+msg+'">'); 230 218 231 219 jQuery.jGrowl( 232 '<p></p> '+msg,220 '<p></p>onUploadError '+msg, 233 221 { 234 222 theme: 'error', 235 223 header: 'ERROR', 236 sticky: true237 }238 );239 240 jQuery("#fileUploadgrowl" + queueID).fadeOut(241 250,242 function() {243 jQuery("#fileUploadgrowl" + queueID).remove()244 }245 );246 return false;247 },248 onCancel: function (a, b, c, d) {249 var msg = "Cancelled uploading: "+c.name;250 jQuery.jGrowl(251 '<p></p>'+msg,252 {253 theme: 'warning',254 header: 'Cancelled Upload',255 224 life: 4000, 256 225 sticky: false 257 226 } 258 227 ); 228 229 return false; 259 230 }, 260 onClearQueue: function (a, b) { 261 var msg = "Cleared "+b.fileCount+" files from queue"; 262 jQuery.jGrowl( 263 '<p></p>'+msg, 264 { 265 theme: 'warning', 266 header: 'Cleared Queue', 267 life: 4000, 268 sticky: false 269 } 270 ); 271 }, 272 onComplete: function (a, b ,c, response, e) { 273 var size = Math.round(c.size/1024); 274 275 var response = jQuery.parseJSON(response); 276 231 onUploadSuccess: function (file,data,response) { 232 var data = jQuery.parseJSON(data); 277 233 jQuery("#uploadedPhotos").parent("fieldset").show(); 278 jQuery("#uploadedPhotos").prepend('<img src="'+response.thumbnail_url+'" class="thumbnail"> '); 279 280 jQuery.jGrowl( 281 '<p></p>'+c.name+' - '+size+'KB', 282 { 283 theme: 'success', 284 header: 'Upload Complete', 285 life: 4000, 286 sticky: false 287 } 288 ); 234 235 /* Let's display the thumbnail of the uploaded photo, no need to wait the */ 236 /* end of the queue */ 237 jQuery("#uploadedPhotos").prepend('<img src="'+data.thumbnail_url+'" class="thumbnail"> '); 289 238 } 290 239 }); … … 296 245 297 246 jQuery("#uploadify").uploadifySettings( 298 ' scriptData',247 'postData', 299 248 { 300 249 'category_id' : jQuery("select[name=category] option:selected").val(), 301 250 'level' : jQuery("select[name=level] option:selected").val(), 251 'upload_id' : upload_id, 252 'session_id' : session_id, 253 'pwg_token' : pwg_token, 302 254 } 303 255 ); … … 413 365 414 366 {elseif $upload_mode eq 'multiple'} 415 416 <p> 417 <input type="file" name="uploadify" id="uploadify"> 418 </p> 367 <div id="uploadify">You've got a problem with your JavaScript</div> 419 368 420 369 <div id="fileQueue" style="display:none"></div>
Note: See TracChangeset
for help on using the changeset viewer.