{combine_script id='jquery' path='themes/default/js/jquery.min.js'} {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } {if $upload_mode eq 'multiple'} {combine_script id='swfobject' load='footer' path='admin/include/uploadify/swfobject.js'} {combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v2.1.0.min.js' } {/if} {combine_css path="admin/include/uploadify/uploadify.css"} {combine_css path="admin/themes/default/uploadify.jGrowl.css"} {footer_script}{literal} jQuery(document).ready(function(){ function checkUploadStart() { var nbErrors = 0; $("#formErrors").hide(); $("#formErrors li").hide(); if ($("input[name=category_type]:checked").val() == "new" && $("input[name=category_name]").val() == "") { $("#formErrors #emptyCategoryName").show(); nbErrors++; } var nbFiles = 0; if ($("#uploadBoxes").size() == 1) { $("input[name^=image_upload]").each(function() { if ($(this).val() != "") { nbFiles++; } }); } else { nbFiles = $(".uploadifyQueueItem").size(); } if (nbFiles == 0) { $("#formErrors #noPhoto").show(); nbErrors++; } if (nbErrors != 0) { $("#formErrors").show(); return false; } else { return true; } } function humanReadableFileSize(bytes) { var byteSize = Math.round(bytes / 1024 * 100) * .01; var suffix = 'KB'; if (byteSize > 1000) { byteSize = Math.round(byteSize *.001 * 100) * .01; suffix = 'MB'; } var sizeParts = byteSize.toString().split('.'); if (sizeParts.length > 1) { byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); } else { byteSize = sizeParts[0]; } return byteSize+suffix; } if ($("select[name=category] option").length == 0) { $('input[name=category_type][value=existing]').attr('disabled', true); $('input[name=category_type]').attr('checked', false); $('input[name=category_type][value=new]').attr('checked', true); } $("input[name=category_type]").click(function () { $("[id^=category_type_]").hide(); $("#category_type_"+$(this).attr("value")).show(); }); $("#hideErrors").click(function() { $("#formErrors").hide(); return false; }); $("a.externalLink").click(function() { window.open($(this).attr("href")); return false; }); {/literal} {if $upload_mode eq 'html'} {literal} function addUploadBox() { var uploadBox = '

'; $(uploadBox).appendTo("#uploadBoxes"); } addUploadBox(); $("#addUploadBox A").click(function () { addUploadBox(); }); $("#uploadForm").submit(function() { return checkUploadStart(); }); {/literal} {elseif $upload_mode eq 'multiple'} var uploadify_path = '{$uploadify_path}'; var upload_id = '{$upload_id}'; var session_id = '{$session_id}'; var pwg_token = '{$pwg_token}'; var buttonText = 'Browse'; var sizeLimit = {$upload_max_filesize}; {literal} jQuery("#uploadify").uploadify({ 'uploader' : uploadify_path + '/uploadify.swf', 'script' : uploadify_path + '/uploadify.php', 'scriptData' : { 'upload_id' : upload_id, 'session_id' : session_id, 'pwg_token' : pwg_token, }, 'cancelImg' : uploadify_path + '/cancel.png', 'queueID' : 'fileQueue', 'auto' : false, 'displayData' : 'speed', 'buttonText' : buttonText, 'multi' : true, 'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)', 'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG', 'sizeLimit' : sizeLimit, 'onAllComplete' : function(event, data) { if (data.errors) { return false; } else { $("input[name=submit_upload]").click(); } }, onError: function (event, queueID ,fileObj, errorObj) { var msg; if (errorObj.type === "HTTP") { if (errorObj.info === 404) { alert('Could not find upload script.'); msg = 'Could not find upload script.'; } else { msg = errorObj.type+": "+errorObj.info; } } else if (errorObj.type ==="File Size") { msg = "File too big"; msg = msg + '
'+fileObj.name+': '+humanReadableFileSize(fileObj.size); msg = msg + '
Limit: '+humanReadableFileSize(sizeLimit); } else { msg = errorObj.type+": "+errorObj.info; } $.jGrowl( '

'+msg, { theme: 'error', header: 'ERROR', sticky: true } ); $("#fileUploadgrowl" + queueID).fadeOut( 250, function() { $("#fileUploadgrowl" + queueID).remove() } ); return false; }, onCancel: function (a, b, c, d) { var msg = "Cancelled uploading: "+c.name; $.jGrowl( '

'+msg, { theme: 'warning', header: 'Cancelled Upload', life: 4000, sticky: false } ); }, onClearQueue: function (a, b) { var msg = "Cleared "+b.fileCount+" files from queue"; $.jGrowl( '

'+msg, { theme: 'warning', header: 'Cleared Queue', life: 4000, sticky: false } ); }, onComplete: function (a, b ,c, d, e) { var size = Math.round(c.size/1024); $.jGrowl( '

'+c.name+' - '+size+'KB', { theme: 'success', header: 'Upload Complete', life: 4000, sticky: false } ); } }); $("input[type=button]").click(function() { if (!checkUploadStart()) { return false; } $("#uploadify").uploadifyUpload(); }); {/literal} {/if} }); {/footer_script} {literal} {/literal}
{if isset($errors)}
{/if} {if isset($infos)}
{/if} {if count($setup_errors) > 0}
{else} {if count($setup_warnings) > 0}
{/if} {if !empty($thumbnails)}
{'Uploaded Photos'|@translate}
{foreach from=$thumbnails item=thumbnail} {$thumbnail.file} {/foreach}

{'Add another set of photos'|@translate}

{else}
{'Drop into album'|@translate} {if $upload_mode eq 'multiple'} {/if} {if $create_subcategories} {else} {/if}
{if $create_subcategories}
{'Parent album'|@translate}
{'Album name'|@translate}
{/if}
{'Select files'|@translate} {if $upload_mode eq 'html'}

{'... or switch to the multiple files form'|@translate}

{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}

{elseif $upload_mode eq 'multiple'}

{'... or switch to the old style form'|@translate}

{/if}
{/if} {* empty($thumbnails) *} {/if} {* $setup_errors *}