{combine_css path=$URLUPLOADER_PATH|cat:'template/style.css'} {combine_script id='URI' load='footer' path=$URLUPLOADER_PATH|cat:'template/URI.min.js'} {combine_css path=$URLUPLOADER_PATH|cat:'template/jquery.textarea-lines-numbers.css'} {combine_script id='createTextareaWithLines' load='footer' require='jquery.ui.resizable' path=$URLUPLOADER_PATH|cat:'template/jquery.textarea-lines-numbers.js'} {if $upload_mode == 'multiple'} {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } {combine_script id='jquery.ui.progressbar' load='footer'} {combine_css path='themes/default/js/plugins/jquery.jgrowl.css'} {/if} {include file='include/colorbox.inc.tpl'} {include file='include/add_album.inc.tpl'} {footer_script} (function($){ var allowed_extensions = new Array('jpeg','jpg','png','gif'); $('#hideErrors').click(function() { $('#formErrors').hide(); return false; }); $('#uploadWarningsSummary a.showInfo').click(function() { $('#uploadWarningsSummary').hide(); $('#uploadWarnings').show(); return false; }); $('#showPermissions').click(function() { $(this).parent('.showFieldset').hide(); $('#permissions').show(); return false; }); {* *} {if $upload_mode == 'multiple'} function checkUploadStart() { var nbErrors = 0; $('#formErrors').hide(); $('#formErrors li').hide(); if ($('#albumSelect option:selected').length == 0) { $('#formErrors #noAlbum').show(); nbErrors++; } var nbFiles = $('table#links tr.pending').length; if (nbFiles == 0) { $('#formErrors #noPhoto').show(); nbErrors++; } if (nbErrors != 0) { $('#formErrors').show(); return false; } else { return true; } } function trim (str) { return str.replace(/^\s+/g,'').replace(/\s+$/g,'') } $('input[name=add_links]').click(function() { $input = $('textarea#urls'); if ($input.val() != '') { $('table#links').show(); var lines = $input.val().split('\n'); var html = ''; $input.val(''); for (i in lines) { line = lines[i].split('|'); item = {}; // no name given if (line.length == 1) { uri = new URI(trim(line[0])); item.name = ''; } // name given else { uri = new URI(trim(line[1])); item.name = trim(line[0]); } uri.fragment(''); item.url = uri.href(); item.short_url = item.url; // shortened url for display if (item.url.length > 40) { item.short_url = item.url.substring(0, 15) + ' ... ' + item.url.substring(item.url.length-15); } // check if consistent url if (uri.is('relative')) { item.status = 'error'; item.info = '{'Invalid file URL'|translate|escape:javascript}'; } else { // check if good extension if (allowed_extensions.indexOf(uri.suffix().toLowerCase()) == -1) { item.status = 'error'; item.info = '{'Invalid file type'|translate|escape:javascript}'; } else { item.status = 'pending'; item.info = '{'Pending'|translate|escape:javascript}'; } } // add link to table html+= ''+ ''+ item.name +''+ ''+ item.short_url +''+ ''+ item.info +''+ ' '+ ''; } $('table#links tbody').append(html); } $input.focus(); return false; }); $('table#links').on('click', 'a.delete', function() { $(this).parents('tr').remove(); $('textarea#urls').focus(); }); // AJAX MANAGER var import_done = 0; var import_selected = 0; var queuedManager = $.manageAjax.create('queued', { queue: true, maxRequests: 1 }); function performImport(file_url, category, name, level, url_in_comment, $target) { queuedManager.add({ type: 'GET', dataType: 'json', url: 'ws.php', data: { method: 'pwg.images.addRemote', file_url: file_url, category: category, name: name, level: level, url_in_comment: url_in_comment, format: 'json' }, success: function(data) { if (data['stat'] == 'ok') { $target.remove(); $('#uploadedPhotos').parent('fieldset').show(); $('#uploadedPhotos').prepend(' '); $('#uploadForm').append(''); } else { $.jGrowl(name +' : '+ data['message'], { theme: 'error', sticky: true, header: '{'ERROR'|translate}' }); $target.children('td:nth-child(3)').html(lang[data['message']]); $('#uploadForm').append(''); } import_done++; $('#progressbar').progressbar({ value: import_done }); $('#progressCurrent').text(import_done); if (import_done == import_selected) { $('#uploadForm').submit(); } }, error: function(data) { $.jGrowl(name +' : '+ '{'an error happened'|translate|escape:javascript}', { theme: 'error', sticky: true, header: '{'ERROR'|translate}' }); $target.children('td:nth-child(3)').html('{'an error happened'|translate|escape:javascript}'); } }); } $('input[name=submit_upload]').click(function() { if (!checkUploadStart()) { return false; } import_selected = $('table#links tr.pending').length; $('table#links a.delete').hide(); $('#progressbar').progressbar({ max: import_selected, value:0 }); $('#progressMax').text(import_selected); $('#progressCurrent').text(0); $('#uploadProgress').show(); $('table#links tr.pending').each(function() { performImport( $(this).data('url'), $('select[name=category] option:selected').val(), $(this).data('name'), $('select[name=level] option:selected').val(), $('input[name=url_in_comment]').is(':checked'), $(this) ); }); return false; }); $('textarea#urls').textareaLinesNumbers({ lines:999, trailing:'.' }); {* *} {else} function checkUploadStart() { var nbErrors = 0; $('#formErrors').hide(); $('#formErrors li').hide(); if ($('#albumSelect option:selected').length == 0) { $('#formErrors #noAlbum').show(); nbErrors++; } if ($('input[name=file_url]').val() == '') { $('#formErrors #urlEmpty').show(); nbErrors++; } else { uri = new URI($('input[name=file_url]').val()); if (uri.is('relative')) { $('#formErrors #urlError').show(); nbErrors++; } else if (allowed_extensions.indexOf(uri.suffix().toLowerCase()) == -1) { $('#formErrors #typeError').show(); nbErrors++; } } if (nbErrors != 0) { $('#formErrors').show(); return false; } else { return true; } } $('input[name=submit_upload]').click(function() { return checkUploadStart(); }); {/if} }(jQuery)); {/footer_script} {html_style} a.delete { background:url('admin/include/uploadify/cancel.png'); } {/html_style}

{'Upload Photos'|translate} {$TABSHEET_TITLE}

{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} {'create a new album'|translate}
{'Select files'|translate}

{'Allowed file types: %s.'|translate:$upload_file_types} {if isset($max_upload_resolution)} {$max_upload_resolution}Mpx i {/if}

{'Allowed file types: %s.'|translate:$upload_file_types} {if isset($max_upload_resolution)} {'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|translate:$max_upload_resolution:$max_upload_width:$max_upload_height} {/if}

{* *} {if $upload_mode == 'single'}

{'Want to upload many files? Try the multiple uploader instead.'|translate:$switch_url}

{* *} {else}

{'One link by line, separate photo name and url with a « | ». Photo name is optional.'|translate}

{'Multiple uploader doesn\'t work? Try the single uploader instead.'|translate:$switch_url}

{/if}

{'Manage Permissions'|translate}

{'Uploaded Photos'|translate}
{/if} {* empty($thumbnails) *} {/if} {* $setup_errors *}