Changeset 6625 for trunk/admin/themes/default/template
- Timestamp:
- Jun 29, 2010, 8:42:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/photos_add_direct.tpl
r6622 r6625 50 50 } 51 51 52 function humanReadableFileSize(bytes) { 53 var byteSize = Math.round(bytes / 1024 * 100) * .01; 54 var suffix = 'KB'; 55 56 if (byteSize > 1000) { 57 byteSize = Math.round(byteSize *.001 * 100) * .01; 58 suffix = 'MB'; 59 } 60 61 var sizeParts = byteSize.toString().split('.'); 62 if (sizeParts.length > 1) { 63 byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); 64 } 65 else { 66 byteSize = sizeParts[0]; 67 } 68 69 return byteSize+suffix; 70 } 71 52 72 if ($("select[name=category] option").length == 0) { 53 73 $('input[name=category_type][value=existing]').attr('disabled', true); … … 91 111 var pwg_token = '{$pwg_token}'; 92 112 var buttonText = 'Browse'; 113 var sizeLimit = {$upload_max_filesize}; 93 114 94 115 {literal} … … 109 130 'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)', 110 131 'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG', 132 'sizeLimit' : sizeLimit, 111 133 'onAllComplete' : function(event, data) { 112 134 if (data.errors) { … … 119 141 onError: function (event, queueID ,fileObj, errorObj) { 120 142 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; 143 144 if (errorObj.type === "HTTP") { 145 if (errorObj.info === 404) { 146 alert('Could not find upload script.'); 147 msg = 'Could not find upload script.'; 148 } 149 else { 150 msg = errorObj.type+": "+errorObj.info; 151 } 127 152 } 128 153 else if (errorObj.type ==="File Size") { 129 msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB'; 154 msg = "File too big"; 155 msg = msg + '<br>'+fileObj.name+': '+humanReadableFileSize(fileObj.size); 156 msg = msg + '<br>Limit: '+humanReadableFileSize(sizeLimit); 130 157 } 131 158 else { 132 msg = errorObj.type+": "+errorObj. text;159 msg = errorObj.type+": "+errorObj.info; 133 160 } 134 161 … … 240 267 <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p> 241 268 </fieldset> 242 <p><a href=" ">{'Add another set of photos'|@translate}</a></p>269 <p><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p> 243 270 {else} 244 271 … … 251 278 </div> 252 279 253 <form id="uploadForm" enctype="multipart/form-data" method="post" action="{$ F_ACTION}" class="properties">280 <form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}" class="properties"> 254 281 <fieldset> 255 282 <legend>{'Drop into category'|@translate}</legend>
Note: See TracChangeset
for help on using the changeset viewer.