diff --git a/wp-includes/js/swfupload/handlers.dev.js b/wp-includes/js/swfupload/handlers.dev.js new file mode 100644 index 0000000000..fccaf71cd4 --- /dev/null +++ b/wp-includes/js/swfupload/handlers.dev.js @@ -0,0 +1,287 @@ +function fileDialogStart() { + jQuery("#media-upload-error").empty(); +} + +// progress and success handlers for media multi uploads +function fileQueued(fileObj) { + // Get rid of unused form + jQuery('.media-blank').remove(); + // Collapse a single item + if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) { + jQuery('.toggle').toggle(); + jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden'); + } + // Create a progress bar containing the filename + jQuery('#media-items').append('
' + fileObj.name + '
'); + // Display the progress div + jQuery('#media-item-' + fileObj.id + ' .progress').show(); + + // Disable the submit button + jQuery('#insert-gallery').attr('disabled', 'disabled'); +} + +function uploadStart(fileObj) { return true; } + +function uploadProgress(fileObj, bytesDone, bytesTotal) { + // Lengthen the progress bar + jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); + + if ( bytesDone == bytesTotal ) + jQuery('#media-item-' + fileObj.id + ' .bar').html('' + swfuploadL10n.crunching + ''); +} + +function prepareMediaItem(fileObj, serverData) { + // Move the progress bar to 100% + jQuery('#media-item-' + fileObj.id + ' .bar').remove(); + jQuery('#media-item-' + fileObj.id + ' .progress').hide(); + + var f = ( typeof shortform == 'undefined' ) ? 1 : 2; + // Old style: Append the HTML returned by the server -- thumbnail and form inputs + if ( isNaN(serverData) || !serverData ) { + jQuery('#media-item-' + fileObj.id).append(serverData); + prepareMediaItemInit(fileObj); + } + // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server + else { + jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()}); + } +} + +function prepareMediaItemInit(fileObj) { + + // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename + jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id); + + // Replace the original filename with the new (unique) one assigned during upload + jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new')); + + // Also bind toggle to the links + jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){var o=jQuery(this).offset();window.scrollTo(0,o.top-36);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); + + // Bind AJAX to the new Delete button + jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){ + // Tell the server to delete it. TODO: handle exceptions + jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{ + id : this.id.replace(/[^0-9]/g,''), + action : 'delete-post', + _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')} + }); + return false; + }); + + // Open this item if it says to start open (e.g. to display an error) + jQuery('#media-item-' + fileObj.id + '.startopen') + .removeClass('startopen') + .slideToggle(500) + .parent().eq(0).children('.toggle').toggle(); +} + +function itemAjaxError(id, html) { + var error = jQuery('#media-item-error' + id); + + error.html('
'+html+'
'); + jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})}); +} + +function deleteSuccess(data, textStatus) { + if ( data == '-1' ) + return itemAjaxError(this.id, 'You do not have permission. Has your session expired?'); + if ( data == '0' ) + return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?'); + + var item = jQuery('#media-item-' + this.id); + + // Decrement the counters. + if ( type = jQuery('#type-of-' + this.id).val() ) + jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1); + if ( item.hasClass('child-of-'+post_id) ) + jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1); + + if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) { + jQuery('.toggle').toggle(); + jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden'); + } + + // Vanish it. + jQuery('#media-item-' + this.id + ' .filename:empty').remove(); + jQuery('#media-item-' + this.id + ' .filename').append(' '+swfuploadL10n.deleted+'').siblings('a.toggle').remove(); + jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end() + .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50}) + .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()}) + .animate({backgroundColor:'#fff'}, 400) + .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();}); + + return; +} + +function deleteError(X, textStatus, errorThrown) { + // TODO +} + +function updateMediaForm() { + storeState(); + // Just one file, no need for collapsible part + if ( jQuery('.type-form #media-items>*').length == 1 ) { + jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle(); + jQuery('.type-form .slidetoggle').siblings().addClass('hidden'); + } + + // Only show Save buttons when there is at least one file. + if ( jQuery('#media-items>*').not('.media-blank').length > 0 ) + jQuery('.savebutton').show(); + else + jQuery('.savebutton').hide(); + + // Only show Gallery button when there are at least two files. + if ( jQuery('#media-items>*').length > 1 ) + jQuery('.insert-gallery').show(); + else + jQuery('.insert-gallery').hide(); +} + +function uploadSuccess(fileObj, serverData) { + // if async-upload returned an error message, place it in the media item div and return + if ( serverData.match('media-upload-error') ) { + jQuery('#media-item-' + fileObj.id).html(serverData); + return; + } + + prepareMediaItem(fileObj, serverData); + updateMediaForm(); + + // Increment the counter. + if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) ) + jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1); +} + +function uploadComplete(fileObj) { + // If no more uploads queued, enable the submit button + if ( swfu.getStats().files_queued == 0 ) + jQuery('#insert-gallery').attr('disabled', ''); +} + + +// wp-specific error handlers + +// generic message +function wpQueueError(message) { + jQuery('#media-upload-error').show().text(message); +} + +// file-specific message +function wpFileError(fileObj, message) { + jQuery('#media-item-' + fileObj.id + ' .filename').after('
'+message+'
').siblings('.toggle').remove(); + jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})}); +} + +function fileQueueError(fileObj, error_code, message) { + // Handle this error separately because we don't want to create a FileProgress element for it. + if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) { + wpQueueError(swfuploadL10n.queue_limit_exceeded); + } + else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) { + fileQueued(fileObj); + wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit); + } + else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) { + fileQueued(fileObj); + wpFileError(fileObj, swfuploadL10n.zero_byte_file); + } + else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) { + fileQueued(fileObj); + wpFileError(fileObj, swfuploadL10n.invalid_filetype); + } + else { + wpQueueError(swfuploadL10n.default_error); + } +} + +function fileDialogComplete(num_files_queued) { + try { + if (num_files_queued > 0) { + this.startUpload(); + } + } catch (ex) { + this.debug(ex); + } +} + +function swfuploadPreLoad() { + var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0); + jQuery('#' + swfu.customSettings.degraded_element_id).hide(); + // Doing this directly because jQuery().show() seems to have timing problems + if ( swfupload_element && ! swfupload_element.style.display ) + swfupload_element.style.display = 'block'; +} + +function swfuploadLoadFailed() { + jQuery('#' + swfu.customSettings.swfupload_element_id).hide(); + jQuery('#' + swfu.customSettings.degraded_element_id).show(); +} + +function uploadError(fileObj, error_code, message) { + // first the file specific error + if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { + wpFileError(fileObj, swfuploadL10n.missing_upload_url); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { + wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); + } + else { + wpFileError(fileObj, swfuploadL10n.default_error); + } + + // now the general upload status + if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { + wpQueueError(swfuploadL10n.http_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { + wpQueueError(swfuploadL10n.upload_failed); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { + wpQueueError(swfuploadL10n.io_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { + wpQueueError(swfuploadL10n.security_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { + wpQueueError(swfuploadL10n.security_error); + } +} + +// remember the last used image size, alignment and url +var storeState; +(function($){ + +storeState = function(){ + var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || ''; + + $('tr.align input[type="radio"]').click(function(){ + setUserSetting('align', $(this).val()); + }).filter(function(){ + if ( $(this).val() == align ) + return true; + return false; + }).attr('checked','checked'); + + $('tr.image-size input[type="radio"]').click(function(){ + setUserSetting('imgsize', $(this).val()); + }).filter(function(){ + if ( $(this).attr('disabled') || $(this).val() != imgsize ) + return false; + return true; + }).attr('checked','checked'); + + $('tr.url button').click(function(){ + var c = this.className || ''; + c = c.replace(/.*?(url[^ '"]+).*/, '$1'); + if (c) setUserSetting('urlbutton', c); + $(this).siblings('.urlfield').val( $(this).attr('title') ); + }); + + $('tr.url .urlfield').each(function(){ + var b = getUserSetting('urlbutton'); + $(this).val( $(this).siblings('button.'+b).attr('title') ); + }); +} +})(jQuery); diff --git a/wp-includes/js/swfupload/handlers.js b/wp-includes/js/swfupload/handlers.js index fccaf71cd4..ca053e7b15 100644 --- a/wp-includes/js/swfupload/handlers.js +++ b/wp-includes/js/swfupload/handlers.js @@ -1,287 +1 @@ -function fileDialogStart() { - jQuery("#media-upload-error").empty(); -} - -// progress and success handlers for media multi uploads -function fileQueued(fileObj) { - // Get rid of unused form - jQuery('.media-blank').remove(); - // Collapse a single item - if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) { - jQuery('.toggle').toggle(); - jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden'); - } - // Create a progress bar containing the filename - jQuery('#media-items').append('
' + fileObj.name + '
'); - // Display the progress div - jQuery('#media-item-' + fileObj.id + ' .progress').show(); - - // Disable the submit button - jQuery('#insert-gallery').attr('disabled', 'disabled'); -} - -function uploadStart(fileObj) { return true; } - -function uploadProgress(fileObj, bytesDone, bytesTotal) { - // Lengthen the progress bar - jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); - - if ( bytesDone == bytesTotal ) - jQuery('#media-item-' + fileObj.id + ' .bar').html('' + swfuploadL10n.crunching + ''); -} - -function prepareMediaItem(fileObj, serverData) { - // Move the progress bar to 100% - jQuery('#media-item-' + fileObj.id + ' .bar').remove(); - jQuery('#media-item-' + fileObj.id + ' .progress').hide(); - - var f = ( typeof shortform == 'undefined' ) ? 1 : 2; - // Old style: Append the HTML returned by the server -- thumbnail and form inputs - if ( isNaN(serverData) || !serverData ) { - jQuery('#media-item-' + fileObj.id).append(serverData); - prepareMediaItemInit(fileObj); - } - // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server - else { - jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()}); - } -} - -function prepareMediaItemInit(fileObj) { - - // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename - jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id); - - // Replace the original filename with the new (unique) one assigned during upload - jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new')); - - // Also bind toggle to the links - jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){var o=jQuery(this).offset();window.scrollTo(0,o.top-36);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); - - // Bind AJAX to the new Delete button - jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){ - // Tell the server to delete it. TODO: handle exceptions - jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{ - id : this.id.replace(/[^0-9]/g,''), - action : 'delete-post', - _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')} - }); - return false; - }); - - // Open this item if it says to start open (e.g. to display an error) - jQuery('#media-item-' + fileObj.id + '.startopen') - .removeClass('startopen') - .slideToggle(500) - .parent().eq(0).children('.toggle').toggle(); -} - -function itemAjaxError(id, html) { - var error = jQuery('#media-item-error' + id); - - error.html('
'+html+'
'); - jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})}); -} - -function deleteSuccess(data, textStatus) { - if ( data == '-1' ) - return itemAjaxError(this.id, 'You do not have permission. Has your session expired?'); - if ( data == '0' ) - return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?'); - - var item = jQuery('#media-item-' + this.id); - - // Decrement the counters. - if ( type = jQuery('#type-of-' + this.id).val() ) - jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1); - if ( item.hasClass('child-of-'+post_id) ) - jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1); - - if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) { - jQuery('.toggle').toggle(); - jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden'); - } - - // Vanish it. - jQuery('#media-item-' + this.id + ' .filename:empty').remove(); - jQuery('#media-item-' + this.id + ' .filename').append(' '+swfuploadL10n.deleted+'').siblings('a.toggle').remove(); - jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end() - .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50}) - .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()}) - .animate({backgroundColor:'#fff'}, 400) - .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();}); - - return; -} - -function deleteError(X, textStatus, errorThrown) { - // TODO -} - -function updateMediaForm() { - storeState(); - // Just one file, no need for collapsible part - if ( jQuery('.type-form #media-items>*').length == 1 ) { - jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle(); - jQuery('.type-form .slidetoggle').siblings().addClass('hidden'); - } - - // Only show Save buttons when there is at least one file. - if ( jQuery('#media-items>*').not('.media-blank').length > 0 ) - jQuery('.savebutton').show(); - else - jQuery('.savebutton').hide(); - - // Only show Gallery button when there are at least two files. - if ( jQuery('#media-items>*').length > 1 ) - jQuery('.insert-gallery').show(); - else - jQuery('.insert-gallery').hide(); -} - -function uploadSuccess(fileObj, serverData) { - // if async-upload returned an error message, place it in the media item div and return - if ( serverData.match('media-upload-error') ) { - jQuery('#media-item-' + fileObj.id).html(serverData); - return; - } - - prepareMediaItem(fileObj, serverData); - updateMediaForm(); - - // Increment the counter. - if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) ) - jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1); -} - -function uploadComplete(fileObj) { - // If no more uploads queued, enable the submit button - if ( swfu.getStats().files_queued == 0 ) - jQuery('#insert-gallery').attr('disabled', ''); -} - - -// wp-specific error handlers - -// generic message -function wpQueueError(message) { - jQuery('#media-upload-error').show().text(message); -} - -// file-specific message -function wpFileError(fileObj, message) { - jQuery('#media-item-' + fileObj.id + ' .filename').after('
'+message+'
').siblings('.toggle').remove(); - jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})}); -} - -function fileQueueError(fileObj, error_code, message) { - // Handle this error separately because we don't want to create a FileProgress element for it. - if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) { - wpQueueError(swfuploadL10n.queue_limit_exceeded); - } - else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) { - fileQueued(fileObj); - wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit); - } - else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) { - fileQueued(fileObj); - wpFileError(fileObj, swfuploadL10n.zero_byte_file); - } - else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) { - fileQueued(fileObj); - wpFileError(fileObj, swfuploadL10n.invalid_filetype); - } - else { - wpQueueError(swfuploadL10n.default_error); - } -} - -function fileDialogComplete(num_files_queued) { - try { - if (num_files_queued > 0) { - this.startUpload(); - } - } catch (ex) { - this.debug(ex); - } -} - -function swfuploadPreLoad() { - var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0); - jQuery('#' + swfu.customSettings.degraded_element_id).hide(); - // Doing this directly because jQuery().show() seems to have timing problems - if ( swfupload_element && ! swfupload_element.style.display ) - swfupload_element.style.display = 'block'; -} - -function swfuploadLoadFailed() { - jQuery('#' + swfu.customSettings.swfupload_element_id).hide(); - jQuery('#' + swfu.customSettings.degraded_element_id).show(); -} - -function uploadError(fileObj, error_code, message) { - // first the file specific error - if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { - wpFileError(fileObj, swfuploadL10n.missing_upload_url); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { - wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); - } - else { - wpFileError(fileObj, swfuploadL10n.default_error); - } - - // now the general upload status - if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { - wpQueueError(swfuploadL10n.http_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { - wpQueueError(swfuploadL10n.upload_failed); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { - wpQueueError(swfuploadL10n.io_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { - wpQueueError(swfuploadL10n.security_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { - wpQueueError(swfuploadL10n.security_error); - } -} - -// remember the last used image size, alignment and url -var storeState; -(function($){ - -storeState = function(){ - var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || ''; - - $('tr.align input[type="radio"]').click(function(){ - setUserSetting('align', $(this).val()); - }).filter(function(){ - if ( $(this).val() == align ) - return true; - return false; - }).attr('checked','checked'); - - $('tr.image-size input[type="radio"]').click(function(){ - setUserSetting('imgsize', $(this).val()); - }).filter(function(){ - if ( $(this).attr('disabled') || $(this).val() != imgsize ) - return false; - return true; - }).attr('checked','checked'); - - $('tr.url button').click(function(){ - var c = this.className || ''; - c = c.replace(/.*?(url[^ '"]+).*/, '$1'); - if (c) setUserSetting('urlbutton', c); - $(this).siblings('.urlfield').val( $(this).attr('title') ); - }); - - $('tr.url .urlfield').each(function(){ - var b = getUserSetting('urlbutton'); - $(this).val( $(this).siblings('button.'+b).attr('title') ); - }); -} -})(jQuery); +function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('
'+a.name+"
");jQuery("#media-item-"+a.id+" .progress").show();jQuery("#insert-gallery").attr("disabled","disabled")}function uploadStart(a){return true}function uploadProgress(c,a,b){jQuery("#media-item-"+c.id+" .bar").width(620*a/b);if(a==b){jQuery("#media-item-"+c.id+" .bar").html(''+swfuploadL10n.crunching+"")}}function prepareMediaItem(b,a){jQuery("#media-item-"+b.id+" .bar").remove();jQuery("#media-item-"+b.id+" .progress").hide();var c=(typeof shortform=="undefined")?1:2;if(isNaN(a)||!a){jQuery("#media-item-"+b.id).append(a);prepareMediaItemInit(b)}else{jQuery("#media-item-"+b.id).load("async-upload.php",{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery("#media-item-"+a.id+" .thumbnail").clone().attr("className","pinkynail toggle").prependTo("#media-item-"+a.id);jQuery("#media-item-"+a.id+" .filename.original").replaceWith(jQuery("#media-item-"+a.id+" .filename.new"));jQuery("#media-item-"+a.id+" a.toggle").bind("click",function(){jQuery(this).siblings(".slidetoggle").slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().eq(0).children(".toggle").toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("#media-item-"+a.id+" a.delete").bind("click",function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"delete-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).parent().eq(0).children(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('
"+b+"
");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var a=jQuery("#media-item-"+this.id);if(type=jQuery("#type-of-"+this.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-item-"+this.id+" .filename:empty").remove();jQuery("#media-item-"+this.id+" .filename").append(' '+swfuploadL10n.deleted+"").siblings("a.toggle").remove();jQuery("#media-item-"+this.id).children(".describe").css({backgroundColor:"#fff"}).end().animate({backgroundColor:"#ffc0c0"},{queue:false,duration:50}).animate({minHeight:0,height:36},400,null,function(){jQuery(this).children(".describe").remove()}).animate({backgroundColor:"#fff"},400).animate({height:0},800,null,function(){jQuery(this).remove();updateMediaForm()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(".type-form #media-items>*").length==1){jQuery("#media-items .slidetoggle").slideDown(500).parent().eq(0).children(".toggle").toggle();jQuery(".type-form .slidetoggle").siblings().addClass("hidden")}if(jQuery("#media-items>*").not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(jQuery("#media-items>*").length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('
"+a+"
").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function swfuploadPreLoad(){var a=jQuery("#"+swfu.customSettings.swfupload_element_id).get(0);jQuery("#"+swfu.customSettings.degraded_element_id).hide();if(a&&!a.style.display){a.style.display="block"}}function swfuploadLoadFailed(){jQuery("#"+swfu.customSettings.swfupload_element_id).hide();jQuery("#"+swfu.customSettings.degraded_element_id).show()}function uploadError(c,a,b){if(a==SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL){wpFileError(c,swfuploadL10n.missing_upload_url)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED){wpFileError(c,swfuploadL10n.upload_limit_exceeded)}else{wpFileError(c,swfuploadL10n.default_error)}}if(a==SWFUpload.UPLOAD_ERROR.HTTP_ERROR){wpQueueError(swfuploadL10n.http_error)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED){wpQueueError(swfuploadL10n.upload_failed)}else{if(a==SWFUpload.UPLOAD_ERROR.IO_ERROR){wpQueueError(swfuploadL10n.io_error)}else{if(a==SWFUpload.UPLOAD_ERROR.SECURITY_ERROR){wpQueueError(swfuploadL10n.security_error)}else{if(a==SWFUpload.UPLOAD_ERROR.FILE_CANCELLED){wpQueueError(swfuploadL10n.security_error)}}}}}}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(jQuery); \ No newline at end of file diff --git a/wp-includes/js/swfupload/swfupload-all.js b/wp-includes/js/swfupload/swfupload-all.js index d7773382b4..ec15f6a226 100644 --- a/wp-includes/js/swfupload/swfupload-all.js +++ b/wp-includes/js/swfupload/swfupload-all.js @@ -1,5 +1,4 @@ var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Beta 2";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+"?swfuploadrnd="+Math.floor(Math.random()*999999999)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){if(this.settings.button_placeholder_id!==""){this.replaceWithFlash()}else{this.appendFlash()}};SWFUpload.prototype.appendFlash=function(){var b,a;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}b=document.getElementsByTagName("body")[0];if(b==undefined){throw"Could not find the 'body' element."}a=document.createElement("div");a.style.width="1px";a.style.height="1px";a.style.overflow="hidden";b.appendChild(a);a.innerHTML=this.getFlashHTML()};SWFUpload.prototype.replaceWithFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id);if(a==undefined){throw"Could not find the placeholder element."}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a)};SWFUpload.prototype.getFlashHTML=function(){return['','','','','','','',""].join("")};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString();var a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(a),"&params=",encodeURIComponent(b),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params;var b=[];if(typeof(c)==="object"){for(var a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&")};SWFUpload.prototype.destroy=function(){try{this.stopUpload();var b=null;try{b=this.getMovieElement()}catch(c){}if(b!=undefined&&b.parentNode!=undefined&&typeof b.parentNode.removeChild==="function"){var a=b.parentNode;if(a!=undefined){a.removeChild(b);if(a.parentNode!=undefined&&typeof a.parentNode.removeChild==="function"){a.parentNode.removeChild(a)}}}SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];delete this.movieElement;delete this.settings;delete this.customSettings;delete this.eventQueue;delete this.movieName;delete window[this.movieName];return true}catch(d){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned: ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned: ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned: ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned: ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned: ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned: ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned: ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned: ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(c,d){d=d||[];var a=this.getMovieElement();var b;if(typeof a[c]==="function"){if(d.length===0){b=a[c]()}else{if(d.length===1){b=a[c](d[0])}else{if(d.length===2){b=a[c](d[0],d[1])}else{if(d.length===3){b=a[c](d[0],d[1],d[2])}else{throw"Too many arguments"}}}}if(b!=undefined&&typeof b.post==="object"){b=this.unescapeFilePostParams(b)}return b}else{throw"Invalid function name: "+c}};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i;var f={};var d;if(c!=undefined){for(var a in c.post){if(c.post.hasOwnProperty(a)){d=a;var b;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(typeof a.StartUpload!=="function"){throw"ExternalInterface methods failed to initialize."}if(window[this.movieName]==undefined){window[this.movieName]=a}this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(a,b){this.queueEvent("file_dialog_complete_handler",[a,b])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])};SWFUpload.prototype.uploadSuccess=function(b,a){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)};SWFUpload.prototype.debugMessage=function(c){if(this.settings.debug){var a,d=[];if(typeof c==="object"&&typeof c.name==="string"&&typeof c.message==="string"){for(var b in c){if(c.hasOwnProperty(b)){d.push(b+": "+c[b])}}a=d.join("\n")||"";d=a.split("\n");a="EXCEPTION: "+d.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(a)}else{SWFUpload.Console.writeLine(c)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(d){var b,a;try{b=document.getElementById("SWFUpload_Console");if(!b){a=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(a);b=document.createElement("textarea");b.id="SWFUpload_Console";b.style.fontFamily="monospace";b.setAttribute("wrap","off");b.wrap="off";b.style.overflow="auto";b.style.width="700px";b.style.height="350px";b.style.margin="5px";a.appendChild(b)}b.value+=d+"\n";b.scrollTop=b.scrollHeight-b.clientHeight}catch(c){alert("Exception: "+c.name+" Message: "+c.message)}}; var swfobject=function(){var X="undefined",P="object",a="visibility:visible",e="visibility:hidden",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",V="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,S=false,C=false;var Y=function(){var l=typeof g.getElementById!=X&&typeof g.getElementsByTagName!=X&&typeof g.createElement!=X&&typeof g.appendChild!=X&&typeof g.replaceChild!=X&&typeof g.removeChild!=X&&typeof g.cloneNode!=X,t=[0,0,0],n=null;if(typeof N.plugins!=X&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=X){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var d=function(){if(!Y.w3cdom){return }J(I);if(Y.ie&&Y.win){try{g.write("