Dodanie aplikacji sorl.thumbnail i filebrowser.
[redakcja.git] / apps / filebrowser / media / filebrowser / uploadify / .svn / text-base / jquery.uploadify.v2.1.0.js.svn-base
diff --git a/apps/filebrowser/media/filebrowser/uploadify/.svn/text-base/jquery.uploadify.v2.1.0.js.svn-base b/apps/filebrowser/media/filebrowser/uploadify/.svn/text-base/jquery.uploadify.v2.1.0.js.svn-base
new file mode 100644 (file)
index 0000000..9a78cd3
--- /dev/null
@@ -0,0 +1,258 @@
+/*\r
+Uploadify v2.1.0\r
+Release Date: August 24, 2009\r
+\r
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+*/\r
+\r
+if(jQuery)(\r
+       function(jQuery){\r
+               jQuery.extend(jQuery.fn,{\r
+                       uploadify:function(options) {\r
+                               jQuery(this).each(function(){\r
+                                       settings = jQuery.extend({\r
+                                       id             : jQuery(this).attr('id'), // The ID of the object being Uploadified\r
+                                       uploader       : 'uploadify.swf', // The path to the uploadify swf file\r
+                                       script         : 'uploadify.php', // The path to the uploadify backend upload script\r
+                                       expressInstall : null, // The path to the express install swf file\r
+                                       folder         : '', // The path to the upload folder\r
+                                       height         : 30, // The height of the flash button\r
+                                       width          : 110, // The width of the flash button\r
+                                       cancelImg      : 'cancel.png', // The path to the cancel image for the default file queue item container\r
+                                       wmode          : 'opaque', // The wmode of the flash file\r
+                                       scriptAccess   : 'sameDomain', // Set to "always" to allow script access across domains\r
+                                       fileDataName   : 'Filedata', // The name of the file collection object in the backend upload script\r
+                                       method         : 'POST', // The method for sending variables to the backend upload script\r
+                                       queueSizeLimit : 999, // The maximum size of the file queue\r
+                                       simUploadLimit : 1, // The number of simultaneous uploads allowed\r
+                                       queueID        : false, // The optional ID of the queue container\r
+                                       displayData    : 'percentage', // Set to "speed" to show the upload speed in the default queue item\r
+                                       onInit         : function() {}, // Function to run when uploadify is initialized\r
+                                       onSelect       : function() {}, // Function to run when a file is selected\r
+                                       onQueueFull    : function() {}, // Function to run when the queue reaches capacity\r
+                                       onCheck        : function() {}, // Function to run when script checks for duplicate files on the server\r
+                                       onCancel       : function() {}, // Function to run when an item is cleared from the queue\r
+                                       onError        : function() {}, // Function to run when an upload item returns an error\r
+                                       onProgress     : function() {}, // Function to run each time the upload progress is updated\r
+                                       onComplete     : function() {}, // Function to run when an upload is completed\r
+                                       onAllComplete  : function() {}  // Functino to run when all uploads are completed\r
+                               }, options);\r
+                               var pagePath = location.pathname;\r
+                               pagePath = pagePath.split('/');\r
+                               pagePath.pop();\r
+                               pagePath = pagePath.join('/') + '/';\r
+                               var data = {};\r
+                               data.uploadifyID = settings.id;\r
+                               data.pagepath = pagePath;\r
+                               if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);\r
+                               if (settings.buttonText) data.buttonText = escape(settings.buttonText);\r
+                               if (settings.rollover) data.rollover = true;\r
+                               data.script = settings.script;\r
+                               data.folder = escape(settings.folder);\r
+                               if (settings.scriptData) {\r
+                                       var scriptDataString = '';\r
+                                       for (var name in settings.scriptData) {\r
+                                               scriptDataString += '&' + name + '=' + settings.scriptData[name];\r
+                                       }\r
+                                       data.scriptData = escape(scriptDataString.substr(1));\r
+                               }\r
+                               data.width          = settings.width;\r
+                               data.height         = settings.height;\r
+                               data.wmode          = settings.wmode;\r
+                               data.method         = settings.method;\r
+                               data.queueSizeLimit = settings.queueSizeLimit;\r
+                               data.simUploadLimit = settings.simUploadLimit;\r
+                               if (settings.hideButton)   data.hideButton   = true;\r
+                               if (settings.fileDesc)     data.fileDesc     = settings.fileDesc;\r
+                               if (settings.fileExt)      data.fileExt      = settings.fileExt;\r
+                               if (settings.multi)        data.multi        = true;\r
+                               if (settings.auto)         data.auto         = true;\r
+                               if (settings.sizeLimit)    data.sizeLimit    = settings.sizeLimit;\r
+                               if (settings.checkScript)  data.checkScript  = settings.checkScript;\r
+                               if (settings.fileDataName) data.fileDataName = settings.fileDataName;\r
+                               if (settings.queueID)      data.queueID      = settings.queueID;\r
+                               if (settings.onInit() !== false) {\r
+                                       jQuery(this).css('display','none');\r
+                                       jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');\r
+                                       swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess});\r
+                                       if (settings.queueID == false) {\r
+                                               jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');\r
+                                       }\r
+                               }\r
+                               if (typeof(settings.onOpen) == 'function') {\r
+                                       jQuery(this).bind("uploadifyOpen", settings.onOpen);\r
+                               }\r
+                               jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {\r
+                                       if (event.data.action(event, ID, fileObj) !== false) {\r
+                                               var byteSize = Math.round(fileObj.size / 1024 * 100) * .01;\r
+                                               var suffix = 'KB';\r
+                                               if (byteSize > 1000) {\r
+                                                       byteSize = Math.round(byteSize *.001 * 100) * .01;\r
+                                                       suffix = 'MB';\r
+                                               }\r
+                                               var sizeParts = byteSize.toString().split('.');\r
+                                               if (sizeParts.length > 1) {\r
+                                                       byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);\r
+                                               } else {\r
+                                                       byteSize = sizeParts[0];\r
+                                               }\r
+                                               if (fileObj.name.length > 20) {\r
+                                                       fileName = fileObj.name.substr(0,20) + '...';\r
+                                               } else {\r
+                                                       fileName = fileObj.name;\r
+                                               }\r
+                                               queue = '#' + jQuery(this).attr('id') + 'Queue';\r
+                                               if (event.data.queueID) {\r
+                                                       queue = '#' + event.data.queueID;\r
+                                               }\r
+                                               jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\\r
+                                                               <div class="cancel">\\r
+                                                                       <a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>\\r
+                                                               </div>\\r
+                                                               <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\\r
+                                                               <div class="uploadifyProgress">\\r
+                                                                       <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\\r
+                                                               </div>\\r
+                                                       </div>');\r
+                                       }\r
+                               });\r
+                               if (typeof(settings.onSelectOnce) == 'function') {\r
+                                       jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce);\r
+                               }\r
+                               jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) {\r
+                                       if (event.data.action(event, queueSizeLimit) !== false) {\r
+                                               alert('The queue is full.  The max size is ' + queueSizeLimit + '.');\r
+                                       }\r
+                               });\r
+                               jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {\r
+                                       var postData = new Object();\r
+                                       postData = fileQueueObj;\r
+                                       postData.folder = pagePath + folder;\r
+                                       if (single) {\r
+                                               for (var ID in fileQueueObj) {\r
+                                                       var singleFileID = ID;\r
+                                               }\r
+                                       }\r
+                                       jQuery.post(checkScript, postData, function(data) {\r
+                                               for(var key in data) {\r
+                                                       if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) {\r
+                                                               var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");\r
+                                                               if (!replaceFile) {\r
+                                                                       document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true);\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                               if (single) {\r
+                                                       document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);\r
+                                               } else {\r
+                                                       document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);\r
+                                               }\r
+                                       }, "json");\r
+                               });\r
+                               jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) {\r
+                                       if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {\r
+                                               var fadeSpeed = (clearFast == true) ? 0 : 250;\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });\r
+                                       }\r
+                               });\r
+                               if (typeof(settings.onClearQueue) == 'function') {\r
+                                       jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue);\r
+                               }\r
+                               var errorArray = [];\r
+                               jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {\r
+                                       if (event.data.action(event, ID, fileObj, errorObj) !== false) {\r
+                                               var fileArray = new Array(ID, fileObj, errorObj);\r
+                                               errorArray.push(fileArray);\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error");\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');\r
+                                       }\r
+                               });\r
+                               jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) {\r
+                                       if (event.data.action(event, ID, fileObj, data) !== false) {\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%');\r
+                                               if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';\r
+                                               if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';\r
+                                               if (event.data.toDisplay == null) displayData = ' ';\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData);\r
+                                       }\r
+                               });\r
+                               jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {\r
+                                       if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed');\r
+                                               jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()});\r
+                                       }\r
+                               });\r
+                               if (typeof(settings.onAllComplete) == 'function') {\r
+                                       jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) {\r
+                                               if (event.data.action(event, uploadObj) !== false) {\r
+                                                       errorArray = [];\r
+                                               }\r
+                                       });\r
+                               }\r
+                       });\r
+               },\r
+               uploadifySettings:function(settingName, settingValue, resetObject) {\r
+                       var returnValue = false;\r
+                       jQuery(this).each(function() {\r
+                               if (settingName == 'scriptData' && settingValue != null) {\r
+                                       if (resetObject) {\r
+                                               var scriptData = settingValue;\r
+                                       } else {\r
+                                               var scriptData = jQuery.extend(settings.scriptData, settingValue);\r
+                                       }\r
+                                       var scriptDataString = '';\r
+                                       for (var name in scriptData) {\r
+                                               scriptDataString += '&' + name + '=' + escape(scriptData[name]);\r
+                                       }\r
+                                       settingValue = scriptDataString.substr(1);\r
+                               }\r
+                               returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);\r
+                       });\r
+                       if (settingValue == null) {\r
+                               if (settingName == 'scriptData') {\r
+                                       var returnSplit = unescape(returnValue).split('&');\r
+                                       var returnObj   = new Object();\r
+                                       for (var i = 0; i < returnSplit.length; i++) {\r
+                                               var iSplit = returnSplit[i].split('=');\r
+                                               returnObj[iSplit[0]] = iSplit[1];\r
+                                       }\r
+                                       returnValue = returnObj;\r
+                               }\r
+                               return returnValue;\r
+                       }\r
+               },\r
+               uploadifyUpload:function(ID) {\r
+                       jQuery(this).each(function() {\r
+                               document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false);\r
+                       });\r
+               },\r
+               uploadifyCancel:function(ID) {\r
+                       jQuery(this).each(function() {\r
+                               document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false);\r
+                       });\r
+               },\r
+               uploadifyClearQueue:function() {\r
+                       jQuery(this).each(function() {\r
+                               document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);\r
+                       });\r
+               }\r
+       })\r
+})(jQuery);
\ No newline at end of file