[12333] | 1 | {if $upload_mode eq 'multiple'} |
---|
[9372] | 2 | {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } |
---|
[29970] | 3 | {combine_script id='jquery.uploadify' load='footer' require='jquery' path='plugins/community/uploadify/jquery.uploadify.v3.0.0.min.js' } |
---|
[12333] | 4 | {combine_script id='jquery.ui.progressbar' load='footer'} |
---|
[27037] | 5 | {combine_css path="themes/default/js/plugins/jquery.jgrowl.css"} |
---|
[29970] | 6 | {combine_css path="plugins/community/uploadify/uploadify.css"} |
---|
[9372] | 7 | {/if} |
---|
| 8 | |
---|
[12333] | 9 | {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'} |
---|
| 10 | {combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"} |
---|
[9372] | 11 | |
---|
| 12 | {footer_script}{literal} |
---|
| 13 | jQuery(document).ready(function(){ |
---|
[23037] | 14 | function sprintf() { |
---|
| 15 | var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = ''; |
---|
| 16 | while (f) { |
---|
| 17 | if (m = /^[^\x25]+/.exec(f)) { |
---|
| 18 | o.push(m[0]); |
---|
| 19 | } |
---|
| 20 | else if (m = /^\x25{2}/.exec(f)) { |
---|
| 21 | o.push('%'); |
---|
| 22 | } |
---|
| 23 | else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) { |
---|
| 24 | if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) { |
---|
| 25 | throw('Too few arguments.'); |
---|
| 26 | } |
---|
| 27 | if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) { |
---|
| 28 | throw('Expecting number but found ' + typeof(a)); |
---|
| 29 | } |
---|
| 30 | switch (m[7]) { |
---|
| 31 | case 'b': a = a.toString(2); break; |
---|
| 32 | case 'c': a = String.fromCharCode(a); break; |
---|
| 33 | case 'd': a = parseInt(a); break; |
---|
| 34 | case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break; |
---|
| 35 | case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break; |
---|
| 36 | case 'o': a = a.toString(8); break; |
---|
| 37 | case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break; |
---|
| 38 | case 'u': a = Math.abs(a); break; |
---|
| 39 | case 'x': a = a.toString(16); break; |
---|
| 40 | case 'X': a = a.toString(16).toUpperCase(); break; |
---|
| 41 | } |
---|
| 42 | a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a); |
---|
| 43 | c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' '; |
---|
| 44 | x = m[5] - String(a).length - s.length; |
---|
| 45 | p = m[5] ? str_repeat(c, x) : ''; |
---|
| 46 | o.push(s + (m[4] ? a + p : p + a)); |
---|
| 47 | } |
---|
| 48 | else { |
---|
| 49 | throw('Huh ?!'); |
---|
| 50 | } |
---|
| 51 | f = f.substring(m[0].length); |
---|
| 52 | } |
---|
| 53 | return o.join(''); |
---|
| 54 | } |
---|
| 55 | |
---|
[9372] | 56 | function checkUploadStart() { |
---|
| 57 | var nbErrors = 0; |
---|
[10171] | 58 | jQuery("#formErrors").hide(); |
---|
| 59 | jQuery("#formErrors li").hide(); |
---|
[9372] | 60 | |
---|
[12333] | 61 | if (jQuery("#albumSelect option:selected").length == 0) { |
---|
| 62 | jQuery("#formErrors #noAlbum").show(); |
---|
[9372] | 63 | nbErrors++; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | var nbFiles = 0; |
---|
[10171] | 67 | if (jQuery("#uploadBoxes").size() == 1) { |
---|
| 68 | jQuery("input[name^=image_upload]").each(function() { |
---|
| 69 | if (jQuery(this).val() != "") { |
---|
[9372] | 70 | nbFiles++; |
---|
| 71 | } |
---|
| 72 | }); |
---|
| 73 | } |
---|
| 74 | else { |
---|
[10171] | 75 | nbFiles = jQuery(".uploadifyQueueItem").size(); |
---|
[9372] | 76 | } |
---|
| 77 | |
---|
| 78 | if (nbFiles == 0) { |
---|
[10171] | 79 | jQuery("#formErrors #noPhoto").show(); |
---|
[9372] | 80 | nbErrors++; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | if (nbErrors != 0) { |
---|
[10171] | 84 | jQuery("#formErrors").show(); |
---|
[9372] | 85 | return false; |
---|
| 86 | } |
---|
| 87 | else { |
---|
| 88 | return true; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | function humanReadableFileSize(bytes) { |
---|
| 94 | var byteSize = Math.round(bytes / 1024 * 100) * .01; |
---|
| 95 | var suffix = 'KB'; |
---|
| 96 | |
---|
| 97 | if (byteSize > 1000) { |
---|
| 98 | byteSize = Math.round(byteSize *.001 * 100) * .01; |
---|
| 99 | suffix = 'MB'; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | var sizeParts = byteSize.toString().split('.'); |
---|
| 103 | if (sizeParts.length > 1) { |
---|
| 104 | byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); |
---|
| 105 | } |
---|
| 106 | else { |
---|
| 107 | byteSize = sizeParts[0]; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | return byteSize+suffix; |
---|
| 111 | } |
---|
| 112 | |
---|
[12333] | 113 | function fillCategoryListbox(selectId, selectedValue) { |
---|
| 114 | jQuery.getJSON( |
---|
| 115 | "ws.php?format=json&method=pwg.categories.getList", |
---|
| 116 | { |
---|
| 117 | recursive: true, |
---|
| 118 | fullname: true, |
---|
| 119 | format: "json", |
---|
| 120 | }, |
---|
| 121 | function(data) { |
---|
| 122 | jQuery.each( |
---|
| 123 | data.result.categories, |
---|
| 124 | function(i,category) { |
---|
| 125 | var selected = null; |
---|
| 126 | if (category.id == selectedValue) { |
---|
| 127 | selected = "selected"; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | jQuery("<option/>") |
---|
| 131 | .attr("value", category.id) |
---|
| 132 | .attr("selected", selected) |
---|
| 133 | .text(category.name) |
---|
| 134 | .appendTo("#"+selectId) |
---|
| 135 | ; |
---|
| 136 | } |
---|
| 137 | ); |
---|
| 138 | } |
---|
| 139 | ); |
---|
[9372] | 140 | } |
---|
| 141 | |
---|
[12333] | 142 | jQuery(".addAlbumOpen").colorbox({ |
---|
| 143 | inline:true, |
---|
| 144 | href:"#addAlbumForm", |
---|
| 145 | onComplete:function(){ |
---|
| 146 | jQuery("input[name=category_name]").focus(); |
---|
| 147 | } |
---|
[9372] | 148 | }); |
---|
| 149 | |
---|
[12333] | 150 | jQuery("#addAlbumForm form").submit(function(){ |
---|
| 151 | jQuery("#categoryNameError").text(""); |
---|
| 152 | |
---|
| 153 | jQuery.ajax({ |
---|
| 154 | url: "ws.php?format=json&method=pwg.categories.add", |
---|
| 155 | data: { |
---|
| 156 | parent: jQuery("select[name=category_parent] option:selected").val(), |
---|
| 157 | name: jQuery("input[name=category_name]").val(), |
---|
| 158 | }, |
---|
| 159 | beforeSend: function() { |
---|
| 160 | jQuery("#albumCreationLoading").show(); |
---|
| 161 | }, |
---|
| 162 | success:function(html) { |
---|
| 163 | jQuery("#albumCreationLoading").hide(); |
---|
| 164 | |
---|
| 165 | var newAlbum = jQuery.parseJSON(html).result.id; |
---|
| 166 | jQuery(".addAlbumOpen").colorbox.close(); |
---|
| 167 | |
---|
| 168 | jQuery("#albumSelect").find("option").remove(); |
---|
| 169 | fillCategoryListbox("albumSelect", newAlbum); |
---|
| 170 | |
---|
| 171 | jQuery(".albumSelection").show(); |
---|
| 172 | |
---|
| 173 | /* we hide the ability to create another album, this is different from the admin upload form */ |
---|
| 174 | /* in Community, it's complicated to refresh the list of parent albums */ |
---|
| 175 | jQuery("#linkToCreate").hide(); |
---|
| 176 | |
---|
| 177 | return true; |
---|
| 178 | }, |
---|
| 179 | error:function(XMLHttpRequest, textStatus, errorThrows) { |
---|
| 180 | jQuery("#albumCreationLoading").hide(); |
---|
| 181 | jQuery("#categoryNameError").text(errorThrows).css("color", "red"); |
---|
| 182 | } |
---|
| 183 | }); |
---|
| 184 | |
---|
| 185 | return false; |
---|
| 186 | }); |
---|
| 187 | |
---|
[10171] | 188 | jQuery("#hideErrors").click(function() { |
---|
| 189 | jQuery("#formErrors").hide(); |
---|
[9372] | 190 | return false; |
---|
| 191 | }); |
---|
| 192 | |
---|
[12333] | 193 | jQuery("#uploadWarningsSummary a.showInfo").click(function() { |
---|
| 194 | jQuery("#uploadWarningsSummary").hide(); |
---|
| 195 | jQuery("#uploadWarnings").show(); |
---|
[9372] | 196 | }); |
---|
| 197 | |
---|
[12333] | 198 | jQuery("#showPermissions").click(function() { |
---|
| 199 | jQuery(this).parent(".showFieldset").hide(); |
---|
| 200 | jQuery("#permissions").show(); |
---|
| 201 | }); |
---|
| 202 | |
---|
| 203 | jQuery("#showPhotoProperties").click(function() { |
---|
| 204 | jQuery(this).parent(".showFieldset").hide(); |
---|
| 205 | jQuery("#photoProperties").show(); |
---|
[23393] | 206 | jQuery("input[name=set_photo_properties]").prop('checked', true); |
---|
[12333] | 207 | }); |
---|
| 208 | |
---|
[9372] | 209 | {/literal} |
---|
| 210 | {if $upload_mode eq 'html'} |
---|
[23037] | 211 | {if isset($limit_nb_photos)} |
---|
| 212 | var limit_nb_photos = {$limit_nb_photos}; |
---|
| 213 | {/if} |
---|
[9372] | 214 | {literal} |
---|
[23037] | 215 | |
---|
[9372] | 216 | function addUploadBox() { |
---|
| 217 | var uploadBox = '<p class="file"><input type="file" size="60" name="image_upload[]"></p>'; |
---|
[10171] | 218 | jQuery(uploadBox).appendTo("#uploadBoxes"); |
---|
[23037] | 219 | |
---|
| 220 | if (typeof limit_nb_photos != 'undefined') { |
---|
| 221 | if (jQuery("input[name^=image_upload]").size() >= limit_nb_photos) { |
---|
| 222 | jQuery("#addUploadBox").hide(); |
---|
| 223 | } |
---|
| 224 | } |
---|
[9372] | 225 | } |
---|
| 226 | |
---|
| 227 | addUploadBox(); |
---|
| 228 | |
---|
[10171] | 229 | jQuery("#addUploadBox A").click(function () { |
---|
[23037] | 230 | if (typeof limit_nb_photos != 'undefined') { |
---|
| 231 | if (jQuery("input[name^=image_upload]").size() >= limit_nb_photos) { |
---|
| 232 | alert('tu rigoles mon gaillard !'); |
---|
| 233 | return false; |
---|
| 234 | } |
---|
| 235 | } |
---|
| 236 | |
---|
[9372] | 237 | addUploadBox(); |
---|
| 238 | }); |
---|
| 239 | |
---|
[10171] | 240 | jQuery("#uploadForm").submit(function() { |
---|
[9372] | 241 | return checkUploadStart(); |
---|
| 242 | }); |
---|
| 243 | {/literal} |
---|
| 244 | {elseif $upload_mode eq 'multiple'} |
---|
| 245 | |
---|
| 246 | var uploadify_path = '{$uploadify_path}'; |
---|
| 247 | var upload_id = '{$upload_id}'; |
---|
| 248 | var session_id = '{$session_id}'; |
---|
| 249 | var pwg_token = '{$pwg_token}'; |
---|
[12333] | 250 | var buttonText = "{'Select files'|@translate}"; |
---|
| 251 | var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */ |
---|
[23037] | 252 | var sumQueueFilesize = 0; |
---|
| 253 | {if isset($limit_storage)} |
---|
| 254 | var limit_storage = {$limit_storage}; |
---|
| 255 | {/if} |
---|
[9372] | 256 | |
---|
| 257 | {literal} |
---|
| 258 | jQuery("#uploadify").uploadify({ |
---|
[12333] | 259 | 'uploader' : uploadify_path + '/uploadify.php', |
---|
| 260 | 'langFile' : uploadify_path + '/uploadifyLang_en.js', |
---|
| 261 | 'swf' : uploadify_path + '/uploadify.swf', |
---|
[29970] | 262 | 'checkExisting' : false, |
---|
[12333] | 263 | |
---|
| 264 | buttonCursor : 'pointer', |
---|
| 265 | 'buttonText' : buttonText, |
---|
| 266 | 'width' : 300, |
---|
| 267 | 'cancelImage' : uploadify_path + '/cancel.png', |
---|
[9372] | 268 | 'queueID' : 'fileQueue', |
---|
| 269 | 'auto' : false, |
---|
| 270 | 'multi' : true, |
---|
[12333] | 271 | 'fileTypeDesc' : 'Photo files', |
---|
[26562] | 272 | 'fileTypeExts' : '{/literal}{$uploadify_fileTypeExts}{literal}', |
---|
[12333] | 273 | 'fileSizeLimit' : sizeLimit, |
---|
| 274 | 'progressData' : 'percentage', |
---|
[23037] | 275 | {/literal} |
---|
| 276 | {if isset($limit_nb_photos)} |
---|
| 277 | 'queueSizeLimit' : {$limit_nb_photos}, |
---|
| 278 | {/if} |
---|
| 279 | {literal} |
---|
[12333] | 280 | requeueErrors : false, |
---|
[23037] | 281 | 'onSelect' : function(file) { |
---|
| 282 | console.log('filesize = '+file.size+'bytes'); |
---|
| 283 | |
---|
| 284 | if (typeof limit_storage != 'undefined') { |
---|
| 285 | if (sumQueueFilesize + file.size > limit_storage) { |
---|
| 286 | jQuery.jGrowl( |
---|
| 287 | '<p></p>'+sprintf( |
---|
| 288 | '{/literal}{'File %s too big (%uMB), quota of %uMB exceeded'|@translate}{literal}', |
---|
| 289 | file.name, |
---|
| 290 | Math.round(file.size/(1024*1024)), |
---|
| 291 | limit_storage/(1024*1024) |
---|
| 292 | ), |
---|
| 293 | { |
---|
| 294 | theme: 'error', |
---|
| 295 | header: 'ERROR', |
---|
| 296 | life: 4000, |
---|
| 297 | sticky: false |
---|
| 298 | } |
---|
| 299 | ); |
---|
| 300 | |
---|
| 301 | jQuery('#uploadify').uploadifyCancel(file.id); |
---|
| 302 | return false; |
---|
| 303 | } |
---|
| 304 | else { |
---|
| 305 | sumQueueFilesize += file.size; |
---|
| 306 | } |
---|
| 307 | } |
---|
| 308 | |
---|
[12333] | 309 | jQuery("#fileQueue").show(); |
---|
| 310 | }, |
---|
[23037] | 311 | 'onCancel' : function(file) { |
---|
| 312 | console.log('The file ' + file.name + ' was cancelled ('+file.size+')'); |
---|
| 313 | }, |
---|
[12333] | 314 | 'onQueueComplete' : function(stats) { |
---|
| 315 | jQuery("input[name=submit_upload]").click(); |
---|
| 316 | }, |
---|
| 317 | onUploadError: function (file,errorCode,errorMsg,errorString,swfuploadifyQueue) { |
---|
| 318 | /* uploadify calls the onUploadError trigger when the user cancels a file! */ |
---|
| 319 | /* There no error so we skip it to avoid panic. */ |
---|
| 320 | if ("Cancelled" == errorString) { |
---|
[9372] | 321 | return false; |
---|
| 322 | } |
---|
| 323 | |
---|
[12333] | 324 | var msg = file.name+', '+errorString; |
---|
[9372] | 325 | |
---|
[12333] | 326 | /* Let's put the error message in the form to display once the form is */ |
---|
| 327 | /* performed, it makes support easier when user can copy/paste the error */ |
---|
| 328 | /* thrown. */ |
---|
| 329 | jQuery("#uploadForm").append('<input type="hidden" name="onUploadError[]" value="'+msg+'">'); |
---|
| 330 | |
---|
[10171] | 331 | jQuery.jGrowl( |
---|
[12333] | 332 | '<p></p>onUploadError '+msg, |
---|
[9372] | 333 | { |
---|
| 334 | theme: 'error', |
---|
| 335 | header: 'ERROR', |
---|
[12333] | 336 | life: 4000, |
---|
| 337 | sticky: false |
---|
[9372] | 338 | } |
---|
| 339 | ); |
---|
| 340 | |
---|
| 341 | return false; |
---|
| 342 | }, |
---|
[12333] | 343 | onUploadSuccess: function (file,data,response) { |
---|
| 344 | var data = jQuery.parseJSON(data); |
---|
| 345 | jQuery("#uploadedPhotos").parent("fieldset").show(); |
---|
| 346 | |
---|
| 347 | /* Let's display the thumbnail of the uploaded photo, no need to wait the */ |
---|
| 348 | /* end of the queue */ |
---|
| 349 | jQuery("#uploadedPhotos").prepend('<img src="'+data.thumbnail_url+'" class="thumbnail"> '); |
---|
[9372] | 350 | }, |
---|
[12333] | 351 | onUploadComplete: function(file,swfuploadifyQueue) { |
---|
| 352 | var max = parseInt(jQuery("#progressMax").text()); |
---|
| 353 | var next = parseInt(jQuery("#progressCurrent").text())+1; |
---|
| 354 | var addToProgressBar = 2; |
---|
| 355 | if (next <= max) { |
---|
| 356 | jQuery("#progressCurrent").text(next); |
---|
| 357 | } |
---|
| 358 | else { |
---|
| 359 | addToProgressBar = 1; |
---|
| 360 | } |
---|
| 361 | |
---|
| 362 | jQuery("#progressbar").progressbar({ |
---|
| 363 | value: jQuery("#progressbar").progressbar("option", "value") + addToProgressBar |
---|
| 364 | }); |
---|
[9372] | 365 | } |
---|
| 366 | }); |
---|
| 367 | |
---|
[10171] | 368 | jQuery("input[type=button]").click(function() { |
---|
[9372] | 369 | if (!checkUploadStart()) { |
---|
| 370 | return false; |
---|
| 371 | } |
---|
| 372 | |
---|
[12333] | 373 | jQuery("#uploadify").uploadifySettings( |
---|
| 374 | 'postData', |
---|
| 375 | { |
---|
| 376 | 'category_id' : jQuery("select[name=category] option:selected").val(), |
---|
| 377 | 'level' : jQuery("select[name=level] option:selected").val(), |
---|
| 378 | 'upload_id' : upload_id, |
---|
| 379 | 'session_id' : session_id, |
---|
| 380 | 'pwg_token' : pwg_token, |
---|
| 381 | } |
---|
| 382 | ); |
---|
| 383 | |
---|
| 384 | nb_files = jQuery(".uploadifyQueueItem").size(); |
---|
| 385 | jQuery("#progressMax").text(nb_files); |
---|
| 386 | jQuery("#progressbar").progressbar({max: nb_files*2, value:1}); |
---|
| 387 | jQuery("#progressCurrent").text(1); |
---|
| 388 | |
---|
| 389 | jQuery("#uploadProgress").show(); |
---|
| 390 | |
---|
[10171] | 391 | jQuery("#uploadify").uploadifyUpload(); |
---|
[9372] | 392 | }); |
---|
| 393 | |
---|
| 394 | {/literal} |
---|
| 395 | {/if} |
---|
| 396 | }); |
---|
| 397 | {/footer_script} |
---|
| 398 | |
---|
| 399 | {literal} |
---|
[12333] | 400 | <style type="text/css"> |
---|
| 401 | /* |
---|
| 402 | #photosAddContent form p { |
---|
| 403 | text-align:left; |
---|
| 404 | } |
---|
| 405 | */ |
---|
| 406 | |
---|
[9372] | 407 | #photosAddContent FIELDSET { |
---|
| 408 | width:650px; |
---|
| 409 | margin:20px auto; |
---|
| 410 | } |
---|
| 411 | |
---|
[10756] | 412 | #photosAddContent fieldset#photoProperties {padding-bottom:0} |
---|
| 413 | #photosAddContent fieldset#photoProperties p {text-align:left;margin:0 0 1em 0;line-height:20px;} |
---|
| 414 | #photosAddContent fieldset#photoProperties input[type="text"] {width:320px} |
---|
| 415 | #photosAddContent fieldset#photoProperties textarea {width:500px; height:100px} |
---|
| 416 | |
---|
[9372] | 417 | #photosAddContent P { |
---|
[12333] | 418 | margin:0; |
---|
[9372] | 419 | } |
---|
| 420 | |
---|
| 421 | #uploadBoxes P { |
---|
| 422 | margin:0; |
---|
| 423 | margin-bottom:2px; |
---|
| 424 | padding:0; |
---|
| 425 | } |
---|
| 426 | |
---|
[12333] | 427 | #uploadBoxes .file {margin-bottom:5px;text-align:left;} |
---|
| 428 | #uploadBoxes {margin-top:20px;} |
---|
| 429 | #addUploadBox {margin-bottom:2em;} |
---|
[9372] | 430 | |
---|
[12333] | 431 | p#uploadWarningsSummary {text-align:left;margin-bottom:1em;font-size:90%;color:#999;} |
---|
| 432 | p#uploadWarningsSummary .showInfo {position:static;display:inline;padding:1px 6px;margin-left:3px;} |
---|
| 433 | p#uploadWarnings {display:none;text-align:left;margin-bottom:1em;font-size:90%;color:#999;} |
---|
| 434 | p#uploadModeInfos {text-align:left;margin-top:1em;font-size:90%;color:#999;} |
---|
[9372] | 435 | |
---|
[12333] | 436 | #photosAddContent p.showFieldset {text-align:left;margin: 0 auto 10px auto;width: 650px;} |
---|
| 437 | |
---|
| 438 | #uploadProgress {width:650px; margin:10px auto;font-size:90%;} |
---|
| 439 | #progressbar {border:1px solid #ccc; background-color:#eee;} |
---|
| 440 | .ui-progressbar-value { background-image: url(admin/themes/default/images/pbar-ani.gif); height:10px;margin:-1px;border:1px solid #E78F08;} |
---|
| 441 | |
---|
| 442 | .showInfo {display:block;position:absolute;top:0;right:5px;width:15px;font-style:italic;font-family:"Georgia",serif;background-color:#464646;font-size:0.9em;border-radius:10px;-moz-border-radius:10px;} |
---|
| 443 | .showInfo:hover {cursor:pointer} |
---|
| 444 | .showInfo {color:#fff;background-color:#999; } |
---|
| 445 | .showInfo:hover {color:#fff;border:none;background-color:#333} |
---|
[9372] | 446 | </style> |
---|
| 447 | {/literal} |
---|
| 448 | |
---|
| 449 | <div id="photosAddContent"> |
---|
| 450 | |
---|
| 451 | {if count($setup_errors) > 0} |
---|
| 452 | <div class="errors"> |
---|
| 453 | <ul> |
---|
| 454 | {foreach from=$setup_errors item=error} |
---|
| 455 | <li>{$error}</li> |
---|
| 456 | {/foreach} |
---|
| 457 | </ul> |
---|
| 458 | </div> |
---|
| 459 | {else} |
---|
| 460 | |
---|
| 461 | {if count($setup_warnings) > 0} |
---|
| 462 | <div class="warnings"> |
---|
| 463 | <ul> |
---|
| 464 | {foreach from=$setup_warnings item=warning} |
---|
| 465 | <li>{$warning}</li> |
---|
| 466 | {/foreach} |
---|
| 467 | </ul> |
---|
| 468 | <div class="hideButton" style="text-align:center"><a href="{$hide_warnings_link}">{'Hide'|@translate}</a></div> |
---|
| 469 | </div> |
---|
| 470 | {/if} |
---|
| 471 | |
---|
| 472 | |
---|
| 473 | {if !empty($thumbnails)} |
---|
| 474 | <fieldset> |
---|
| 475 | <legend>{'Uploaded Photos'|@translate}</legend> |
---|
| 476 | <div> |
---|
| 477 | {foreach from=$thumbnails item=thumbnail} |
---|
[16637] | 478 | <a href="{$thumbnail.link}" class="{if isset($thumbnail.lightbox)}colorboxThumb{else}externalLink{/if}"> |
---|
[9372] | 479 | <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail"> |
---|
| 480 | </a> |
---|
| 481 | {/foreach} |
---|
| 482 | </div> |
---|
| 483 | </fieldset> |
---|
[12333] | 484 | <p style="margin:10px"><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p> |
---|
[9372] | 485 | {else} |
---|
| 486 | |
---|
| 487 | <div id="formErrors" class="errors" style="display:none"> |
---|
| 488 | <ul> |
---|
[12333] | 489 | <li id="noAlbum">{'Select an album'|@translate}</li> |
---|
[9372] | 490 | <li id="noPhoto">{'Select at least one photo'|@translate}</li> |
---|
| 491 | </ul> |
---|
| 492 | <div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div> |
---|
| 493 | </div> |
---|
| 494 | |
---|
[12333] | 495 | <div style="display:none"> |
---|
| 496 | <div id="addAlbumForm" style="text-align:left;padding:1em;"> |
---|
| 497 | <form> |
---|
| 498 | {'Parent album'|@translate}<br> |
---|
| 499 | <select id ="category_parent" name="category_parent"> |
---|
[29970] | 500 | {if $create_whole_gallery} |
---|
[12333] | 501 | <option value="0">------------</option> |
---|
[29970] | 502 | {/if} |
---|
[12333] | 503 | {html_options options=$category_parent_options selected=$category_parent_options_selected} |
---|
| 504 | </select> |
---|
| 505 | |
---|
| 506 | <br><br>{'Album name'|@translate}<br><input name="category_name" type="text"> <span id="categoryNameError"></span> |
---|
| 507 | <br><br><br><input type="submit" value="{'Create'|@translate}"> <span id="albumCreationLoading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span> |
---|
| 508 | </form> |
---|
| 509 | </div> |
---|
| 510 | </div> |
---|
| 511 | |
---|
[9372] | 512 | <form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}" class="properties"> |
---|
[12333] | 513 | {if $upload_mode eq 'multiple'} |
---|
| 514 | <input name="upload_id" value="{$upload_id}" type="hidden"> |
---|
| 515 | {/if} |
---|
| 516 | |
---|
[9372] | 517 | <fieldset> |
---|
| 518 | <legend>{'Drop into album'|@translate}</legend> |
---|
| 519 | |
---|
[12333] | 520 | <span class="albumSelection"{if count($category_options) == 0} style="display:none"{/if}> |
---|
| 521 | <select id="albumSelect" name="category"> |
---|
| 522 | {html_options options=$category_options selected=$category_options_selected} |
---|
| 523 | </select> |
---|
| 524 | </span> |
---|
[9372] | 525 | {if $create_subcategories} |
---|
[12333] | 526 | <div id="linkToCreate"> |
---|
| 527 | <span class="albumSelection">{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> |
---|
| 528 | </div> |
---|
| 529 | {/if} |
---|
| 530 | </fieldset> |
---|
[9372] | 531 | |
---|
[12333] | 532 | <fieldset> |
---|
| 533 | <legend>{'Select files'|@translate}</legend> |
---|
| 534 | |
---|
[23393] | 535 | <p id="uploadWarningsSummary">{$upload_max_filesize_shorthand}B. {$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx.{/if} {if isset($quota_summary)}{$quota_summary}{/if} |
---|
[23037] | 536 | <a class="showInfo" title="{'Learn more'|@translate}">i</a></p> |
---|
[12333] | 537 | |
---|
| 538 | <p id="uploadWarnings"> |
---|
| 539 | {'Maximum file size: %sB.'|@translate|@sprintf:$upload_max_filesize_shorthand} |
---|
| 540 | {'Allowed file types: %s.'|@translate|@sprintf:$upload_file_types} |
---|
| 541 | {if isset($max_upload_resolution)} |
---|
| 542 | {'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|@translate|@sprintf:$max_upload_resolution:$max_upload_width:$max_upload_height} |
---|
| 543 | {/if} |
---|
[23037] | 544 | {$quota_details} |
---|
[12333] | 545 | </p> |
---|
| 546 | |
---|
| 547 | {if $upload_mode eq 'html'} |
---|
| 548 | <div id="uploadBoxes"></div> |
---|
| 549 | <div id="addUploadBox"> |
---|
| 550 | <a href="javascript:">{'+ Add an upload box'|@translate}</a> |
---|
[9372] | 551 | </div> |
---|
| 552 | |
---|
[12333] | 553 | <p id="uploadModeInfos">{'You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'|@translate|@sprintf:$switch_url}</p> |
---|
| 554 | |
---|
| 555 | {elseif $upload_mode eq 'multiple'} |
---|
| 556 | <div id="uploadify">You've got a problem with your JavaScript</div> |
---|
| 557 | |
---|
| 558 | <div id="fileQueue" style="display:none"></div> |
---|
| 559 | |
---|
| 560 | <p id="uploadModeInfos">{'You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'|@translate|@sprintf:$switch_url}</p> |
---|
| 561 | |
---|
[9372] | 562 | {/if} |
---|
| 563 | </fieldset> |
---|
| 564 | |
---|
[12333] | 565 | <p class="showFieldset"><a id="showPhotoProperties" href="#">{'Set Photo Properties'|@translate}</a></p> |
---|
| 566 | |
---|
| 567 | <fieldset id="photoProperties" style="display:none"> |
---|
[10756] | 568 | <legend>{'Photo Properties'|@translate}</legend> |
---|
| 569 | |
---|
[12616] | 570 | <input type="checkbox" name="set_photo_properties" style="display:none"> |
---|
| 571 | |
---|
[10756] | 572 | <p> |
---|
[22820] | 573 | {'Title'|@translate}<br> |
---|
[23393] | 574 | <input type="text" class="large" name="name" value=""> |
---|
[10756] | 575 | </p> |
---|
| 576 | |
---|
| 577 | <p> |
---|
| 578 | {'Author'|@translate}<br> |
---|
[23393] | 579 | <input type="text" class="large" name="author" value=""> |
---|
[10756] | 580 | </p> |
---|
| 581 | |
---|
| 582 | <p> |
---|
| 583 | {'Description'|@translate}<br> |
---|
[23393] | 584 | <textarea name="description" id="description" class="description" style="margin:0"></textarea> |
---|
[10756] | 585 | </p> |
---|
| 586 | |
---|
| 587 | </fieldset> |
---|
| 588 | |
---|
[12333] | 589 | {if $upload_mode eq 'html'} |
---|
[9372] | 590 | <p> |
---|
[12333] | 591 | <input class="submit" type="submit" name="submit_upload" value="{'Start Upload'|@translate}"> |
---|
[9372] | 592 | </p> |
---|
| 593 | {elseif $upload_mode eq 'multiple'} |
---|
[12333] | 594 | <p style="margin-bottom:1em"> |
---|
| 595 | <input class="submit" type="button" value="{'Start Upload'|@translate}"> |
---|
| 596 | <input type="submit" name="submit_upload" style="display:none"> |
---|
[9372] | 597 | </p> |
---|
[12333] | 598 | {/if} |
---|
| 599 | </form> |
---|
[9372] | 600 | |
---|
[12333] | 601 | <div id="uploadProgress" style="display:none"> |
---|
| 602 | {'Photo %s of %s'|@translate|@sprintf:'<span id="progressCurrent">1</span>':'<span id="progressMax">10</span>'} |
---|
| 603 | <br> |
---|
| 604 | <div id="progressbar"></div> |
---|
| 605 | </div> |
---|
[9372] | 606 | |
---|
[12333] | 607 | <fieldset style="display:none"> |
---|
| 608 | <legend>{'Uploaded Photos'|@translate}</legend> |
---|
| 609 | <div id="uploadedPhotos"></div> |
---|
| 610 | </fieldset> |
---|
[9372] | 611 | |
---|
| 612 | {/if} {* empty($thumbnails) *} |
---|
| 613 | {/if} {* $setup_errors *} |
---|
| 614 | |
---|
[16637] | 615 | </div> <!-- photosAddContent --> |
---|
| 616 | |
---|
| 617 | {* Community specific *} |
---|
| 618 | {footer_script}{literal} |
---|
| 619 | jQuery(document).ready(function(){ |
---|
| 620 | jQuery("a.colorboxThumb").colorbox({rel:"colorboxThumb"}); |
---|
| 621 | |
---|
| 622 | jQuery("a.externalLink").click(function() { |
---|
| 623 | window.open($(this).attr("href")); |
---|
| 624 | return false; |
---|
| 625 | }); |
---|
| 626 | }); |
---|
[22820] | 627 | {/literal}{/footer_script} |
---|