diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-10-24 21:08:27 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-10-24 21:08:27 +0000 |
commit | da1493b95a2f0b5000a487ae373c9318c58d0b2d (patch) | |
tree | a339b053ade9fb15a1717bdf248a59afc9b3d239 /vendors/uploadify | |
parent | 5161b1c8fdc8ff69005f864a89127fc18db6d4ed (diff) | |
download | elgg-da1493b95a2f0b5000a487ae373c9318c58d0b2d.tar.gz elgg-da1493b95a2f0b5000a487ae373c9318c58d0b2d.tar.bz2 |
partial implementation of flash uploader
Diffstat (limited to 'vendors/uploadify')
85 files changed, 11015 insertions, 0 deletions
diff --git a/vendors/uploadify/Uploadify v2.1.0 Manual.pdf b/vendors/uploadify/Uploadify v2.1.0 Manual.pdf Binary files differnew file mode 100644 index 000000000..c8b2565b5 --- /dev/null +++ b/vendors/uploadify/Uploadify v2.1.0 Manual.pdf diff --git a/vendors/uploadify/cancel.png b/vendors/uploadify/cancel.png Binary files differnew file mode 100644 index 000000000..1c062ae5d --- /dev/null +++ b/vendors/uploadify/cancel.png diff --git a/vendors/uploadify/check.php b/vendors/uploadify/check.php new file mode 100644 index 000000000..d7dc57177 --- /dev/null +++ b/vendors/uploadify/check.php @@ -0,0 +1,35 @@ +<?php
+/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+$fileArray = array();
+foreach ($_POST as $key => $value) {
+ if ($key != 'folder') {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
+ $fileArray[$key] = $value;
+ }
+ }
+}
+echo json_encode($fileArray);
+?>
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/air/logging/FileTarget.as b/vendors/uploadify/com/adobe/air/logging/FileTarget.as new file mode 100644 index 000000000..0dda3eb18 --- /dev/null +++ b/vendors/uploadify/com/adobe/air/logging/FileTarget.as @@ -0,0 +1,98 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.air.logging +{ + import mx.logging.AbstractTarget; + import flash.filesystem.File; + import flash.filesystem.FileStream; + import flash.filesystem.FileMode; + import mx.logging.LogEvent; + import flash.system.System; + import flash.system.Capabilities; + import mx.logging.targets.LineFormattedTarget; + import mx.core.mx_internal; + + use namespace mx_internal; + + /** + * An Adobe AIR only class that provides a log target for the Flex logging + * framework, that logs files to a file on the user's system. + * + * This class will only work when running within Adobe AIR> + */ + public class FileTarget extends LineFormattedTarget + { + private const DEFAULT_LOG_PATH:String = "app-storage:/application.log"; + + private var log:File; + + public function FileTarget(logFile:File = null) + { + if(logFile != null) + { + log = logFile; + } + else + { + log = new File(DEFAULT_LOG_PATH); + } + } + + public function get logURI():String + { + return log.url; + } + + mx_internal override function internalLog(message:String):void + { + write(message); + } + + private function write(msg:String):void + { + var fs:FileStream = new FileStream(); + fs.open(log, FileMode.APPEND); + fs.writeUTFBytes(msg + "\n"); + fs.close(); + } + + public function clear():void + { + var fs:FileStream = new FileStream(); + fs.open(log, FileMode.WRITE); + fs.writeUTFBytes(""); + fs.close(); + } + + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/crypto/HMAC.as b/vendors/uploadify/com/adobe/crypto/HMAC.as new file mode 100644 index 000000000..72f9bffc9 --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/HMAC.as @@ -0,0 +1,127 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.crypto {
+ import flash.utils.ByteArray;
+ import flash.utils.Endian;
+ import flash.utils.describeType;
+ /**
+ * Keyed-Hashing for Message Authentication
+ * Implementation based on algorithm description at
+ * http://www.faqs.org/rfcs/rfc2104.html
+ */
+ public class HMAC
+ {
+ /**
+ * Performs the HMAC hash algorithm using byte arrays.
+ *
+ * @param secret The secret key
+ * @param message The message to hash
+ * @param algorithm Hash object to use
+ * @return A string containing the hash value of message
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 8.5
+ * @tiptext
+ */
+ public static function hash( secret:String, message:String, algorithm:Object = null ):String
+ {
+ var text:ByteArray = new ByteArray();
+ var k_secret:ByteArray = new ByteArray();
+
+ text.writeUTFBytes(message);
+ k_secret.writeUTFBytes(secret);
+
+ return hashBytes(k_secret, text, algorithm);
+ }
+
+ /**
+ * Performs the HMAC hash algorithm using string.
+ *
+ * @param secret The secret key
+ * @param message The message to hash
+ * @param algorithm Hash object to use
+ * @return A string containing the hash value of message
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 8.5
+ * @tiptext
+ */
+ public static function hashBytes( secret:ByteArray, message:ByteArray, algorithm:Object = null ):String
+ {
+ var ipad:ByteArray = new ByteArray();
+ var opad:ByteArray = new ByteArray();
+ var endian:String = Endian.BIG_ENDIAN;
+
+ if(algorithm == null){
+ algorithm = MD5;
+ }
+
+ if ( describeType(algorithm).@name.toString() == "com.adobe.crypto::MD5" ) {
+ endian = Endian.LITTLE_ENDIAN;
+ }
+
+ if ( secret.length > 64 ) {
+ algorithm.hashBytes(secret);
+ secret = new ByteArray();
+ secret.endian = endian;
+
+ while ( algorithm.digest.bytesAvailable != 0 ) {
+ secret.writeInt(algorithm.digest.readInt());
+ }
+ }
+
+ secret.length = 64
+ secret.position = 0;
+ for ( var x:int = 0; x < 64; x++ ) {
+ var byte:int = secret.readByte();
+ ipad.writeByte(0x36 ^ byte);
+ opad.writeByte(0x5c ^ byte);
+ }
+
+ ipad.writeBytes(message);
+ algorithm.hashBytes(ipad);
+ var tmp:ByteArray = new ByteArray();
+ tmp.endian = endian;
+
+ while ( algorithm.digest.bytesAvailable != 0 ) {
+ tmp.writeInt(algorithm.digest.readInt());
+ }
+ tmp.position = 0;
+
+ while ( tmp.bytesAvailable != 0 ) {
+ opad.writeByte(tmp.readUnsignedByte());
+ }
+ return algorithm.hashBytes( opad );
+ }
+
+ }
+
+}
diff --git a/vendors/uploadify/com/adobe/crypto/MD5.as b/vendors/uploadify/com/adobe/crypto/MD5.as new file mode 100644 index 000000000..da533cc44 --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/MD5.as @@ -0,0 +1,281 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto { + + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + /** + * The MD5 Message-Digest Algorithm + * + * Implementation based on algorithm description at + * http://www.faqs.org/rfcs/rfc1321.html + */ + public class MD5 { + + public static var digest:ByteArray; + /** + * Performs the MD5 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion Flash 8.5 + * @tiptext + */ + + public static function hash(s:String) :String{ + //Convert to byteArray and send through hashBinary function + // so as to only have complex code in one location + var ba:ByteArray = new ByteArray(); + ba.writeUTFBytes(s); + return hashBinary(ba); + } + + public static function hashBytes(s:ByteArray) :String{ + return hashBinary(s); + } + + /** + * Performs the MD5 hash algorithm on a ByteArray. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion Flash 8.5 + * @tiptext + */ + public static function hashBinary( s:ByteArray ):String { + // initialize the md buffers + var a:int = 1732584193; + var b:int = -271733879; + var c:int = -1732584194; + var d:int = 271733878; + + // variables to store previous values + var aa:int; + var bb:int; + var cc:int; + var dd:int; + + // create the blocks from the string and + // save the length as a local var to reduce + // lookup in the loop below + var x:Array = createBlocks( s ); + var len:int = x.length; + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16) { + // save previous values + aa = a; + bb = b; + cc = c; + dd = d; + + // Round 1 + a = ff( a, b, c, d, x[int(i+ 0)], 7, -680876936 ); // 1 + d = ff( d, a, b, c, x[int(i+ 1)], 12, -389564586 ); // 2 + c = ff( c, d, a, b, x[int(i+ 2)], 17, 606105819 ); // 3 + b = ff( b, c, d, a, x[int(i+ 3)], 22, -1044525330 ); // 4 + a = ff( a, b, c, d, x[int(i+ 4)], 7, -176418897 ); // 5 + d = ff( d, a, b, c, x[int(i+ 5)], 12, 1200080426 ); // 6 + c = ff( c, d, a, b, x[int(i+ 6)], 17, -1473231341 ); // 7 + b = ff( b, c, d, a, x[int(i+ 7)], 22, -45705983 ); // 8 + a = ff( a, b, c, d, x[int(i+ 8)], 7, 1770035416 ); // 9 + d = ff( d, a, b, c, x[int(i+ 9)], 12, -1958414417 ); // 10 + c = ff( c, d, a, b, x[int(i+10)], 17, -42063 ); // 11 + b = ff( b, c, d, a, x[int(i+11)], 22, -1990404162 ); // 12 + a = ff( a, b, c, d, x[int(i+12)], 7, 1804603682 ); // 13 + d = ff( d, a, b, c, x[int(i+13)], 12, -40341101 ); // 14 + c = ff( c, d, a, b, x[int(i+14)], 17, -1502002290 ); // 15 + b = ff( b, c, d, a, x[int(i+15)], 22, 1236535329 ); // 16 + + // Round 2 + a = gg( a, b, c, d, x[int(i+ 1)], 5, -165796510 ); // 17 + d = gg( d, a, b, c, x[int(i+ 6)], 9, -1069501632 ); // 18 + c = gg( c, d, a, b, x[int(i+11)], 14, 643717713 ); // 19 + b = gg( b, c, d, a, x[int(i+ 0)], 20, -373897302 ); // 20 + a = gg( a, b, c, d, x[int(i+ 5)], 5, -701558691 ); // 21 + d = gg( d, a, b, c, x[int(i+10)], 9, 38016083 ); // 22 + c = gg( c, d, a, b, x[int(i+15)], 14, -660478335 ); // 23 + b = gg( b, c, d, a, x[int(i+ 4)], 20, -405537848 ); // 24 + a = gg( a, b, c, d, x[int(i+ 9)], 5, 568446438 ); // 25 + d = gg( d, a, b, c, x[int(i+14)], 9, -1019803690 ); // 26 + c = gg( c, d, a, b, x[int(i+ 3)], 14, -187363961 ); // 27 + b = gg( b, c, d, a, x[int(i+ 8)], 20, 1163531501 ); // 28 + a = gg( a, b, c, d, x[int(i+13)], 5, -1444681467 ); // 29 + d = gg( d, a, b, c, x[int(i+ 2)], 9, -51403784 ); // 30 + c = gg( c, d, a, b, x[int(i+ 7)], 14, 1735328473 ); // 31 + b = gg( b, c, d, a, x[int(i+12)], 20, -1926607734 ); // 32 + + // Round 3 + a = hh( a, b, c, d, x[int(i+ 5)], 4, -378558 ); // 33 + d = hh( d, a, b, c, x[int(i+ 8)], 11, -2022574463 ); // 34 + c = hh( c, d, a, b, x[int(i+11)], 16, 1839030562 ); // 35 + b = hh( b, c, d, a, x[int(i+14)], 23, -35309556 ); // 36 + a = hh( a, b, c, d, x[int(i+ 1)], 4, -1530992060 ); // 37 + d = hh( d, a, b, c, x[int(i+ 4)], 11, 1272893353 ); // 38 + c = hh( c, d, a, b, x[int(i+ 7)], 16, -155497632 ); // 39 + b = hh( b, c, d, a, x[int(i+10)], 23, -1094730640 ); // 40 + a = hh( a, b, c, d, x[int(i+13)], 4, 681279174 ); // 41 + d = hh( d, a, b, c, x[int(i+ 0)], 11, -358537222 ); // 42 + c = hh( c, d, a, b, x[int(i+ 3)], 16, -722521979 ); // 43 + b = hh( b, c, d, a, x[int(i+ 6)], 23, 76029189 ); // 44 + a = hh( a, b, c, d, x[int(i+ 9)], 4, -640364487 ); // 45 + d = hh( d, a, b, c, x[int(i+12)], 11, -421815835 ); // 46 + c = hh( c, d, a, b, x[int(i+15)], 16, 530742520 ); // 47 + b = hh( b, c, d, a, x[int(i+ 2)], 23, -995338651 ); // 48 + + // Round 4 + a = ii( a, b, c, d, x[int(i+ 0)], 6, -198630844 ); // 49 + d = ii( d, a, b, c, x[int(i+ 7)], 10, 1126891415 ); // 50 + c = ii( c, d, a, b, x[int(i+14)], 15, -1416354905 ); // 51 + b = ii( b, c, d, a, x[int(i+ 5)], 21, -57434055 ); // 52 + a = ii( a, b, c, d, x[int(i+12)], 6, 1700485571 ); // 53 + d = ii( d, a, b, c, x[int(i+ 3)], 10, -1894986606 ); // 54 + c = ii( c, d, a, b, x[int(i+10)], 15, -1051523 ); // 55 + b = ii( b, c, d, a, x[int(i+ 1)], 21, -2054922799 ); // 56 + a = ii( a, b, c, d, x[int(i+ 8)], 6, 1873313359 ); // 57 + d = ii( d, a, b, c, x[int(i+15)], 10, -30611744 ); // 58 + c = ii( c, d, a, b, x[int(i+ 6)], 15, -1560198380 ); // 59 + b = ii( b, c, d, a, x[int(i+13)], 21, 1309151649 ); // 60 + a = ii( a, b, c, d, x[int(i+ 4)], 6, -145523070 ); // 61 + d = ii( d, a, b, c, x[int(i+11)], 10, -1120210379 ); // 62 + c = ii( c, d, a, b, x[int(i+ 2)], 15, 718787259 ); // 63 + b = ii( b, c, d, a, x[int(i+ 9)], 21, -343485551 ); // 64 + + a += aa; + b += bb; + c += cc; + d += dd; + } + digest = new ByteArray() + digest.writeInt(a); + digest.writeInt(b); + digest.writeInt(c); + digest.writeInt(d); + digest.position = 0; + // Finish up by concatening the buffers with their hex output + return IntUtil.toHex( a ) + IntUtil.toHex( b ) + IntUtil.toHex( c ) + IntUtil.toHex( d ); + } + + /** + * Auxiliary function f as defined in RFC + */ + private static function f( x:int, y:int, z:int ):int { + return ( x & y ) | ( (~x) & z ); + } + + /** + * Auxiliary function g as defined in RFC + */ + private static function g( x:int, y:int, z:int ):int { + return ( x & z ) | ( y & (~z) ); + } + + /** + * Auxiliary function h as defined in RFC + */ + private static function h( x:int, y:int, z:int ):int { + return x ^ y ^ z; + } + + /** + * Auxiliary function i as defined in RFC + */ + private static function i( x:int, y:int, z:int ):int { + return y ^ ( x | (~z) ); + } + + /** + * A generic transformation function. The logic of ff, gg, hh, and + * ii are all the same, minus the function used, so pull that logic + * out and simplify the method bodies for the transoformation functions. + */ + private static function transform( func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int { + var tmp:int = a + int( func( b, c, d ) ) + x + t; + return IntUtil.rol( tmp, s ) + b; + } + + /** + * ff transformation function + */ + private static function ff ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( f, a, b, c, d, x, s, t ); + } + + /** + * gg transformation function + */ + private static function gg ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( g, a, b, c, d, x, s, t ); + } + + /** + * hh transformation function + */ + private static function hh ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( h, a, b, c, d, x, s, t ); + } + + /** + * ii transformation function + */ + private static function ii ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( i, a, b, c, d, x, s, t ); + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was + * split into. + */ + private static function createBlocks( s:ByteArray ):Array { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ int(i >> 5) ] |= ( s[ i / 8 ] & mask ) << ( i % 32 ); + } + + // append padding and length + blocks[ int(len >> 5) ] |= 0x80 << ( len % 32 ); + blocks[ int(( ( ( len + 64 ) >>> 9 ) << 4 ) + 14) ] = len; + return blocks; + } + + } +} diff --git a/vendors/uploadify/com/adobe/crypto/MD5Stream.as b/vendors/uploadify/com/adobe/crypto/MD5Stream.as new file mode 100644 index 000000000..6e5eed0d8 --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/MD5Stream.as @@ -0,0 +1,402 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.crypto
+{
+ import com.adobe.utils.IntUtil;
+ import flash.utils.ByteArray;
+
+ /**
+ * Perform MD5 hash of an input stream in chunks. This class is
+ * based on com.adobe.crypto.MD5 and can process data in
+ * chunks. Both block creation and hash computation are done
+ * together for whatever input is available so that the memory
+ * overhead at a time is always fixed. Memory usage is governed by
+ * two parameters: one is the amount of data passed in to update()
+ * and the other is memoryBlockSize. The latter comes into play
+ * only when the memory window exceeds the pre allocated memory
+ * window of flash player. Usage: create an instance, call
+ * update(data) repeatedly for all chunks and finally complete()
+ * which will return the md5 hash.
+ */
+ public class MD5Stream
+ {
+ private static var mask:int = 0xFF;
+
+ private var arr:Array = [];
+
+ /* running count of length */
+ private var arrLen:int;
+
+ // initialize the md buffers
+ private var a:int = 1732584193;
+ private var b:int = -271733879;
+ private var c:int = -1732584194;
+ private var d:int = 271733878;
+
+ // variables to store previous values
+ private var aa:int;
+ private var bb:int;
+ private var cc:int;
+ private var dd:int;
+
+ /* index for data read */
+ private var arrIndexLen:int = 0;
+ /* index for hash computation */
+ private var arrProcessIndex:int = 0;
+ /* index for removing stale arr values */
+ private var cleanIndex:int = 0;
+
+ /**
+ * Change this value from the default (16384) in the range of
+ * MBs to actually affect GC as GC allocates in pools of
+ * memory */
+ public var memoryBlockSize:int = 16384;
+
+
+ public function MD5Stream()
+ {
+
+ }
+
+
+ /**
+ * Pass in chunks of the input data with update(), call
+ * complete() with an optional chunk which will return the
+ * final hash. Equivalent to the way
+ * java.security.MessageDigest works.
+ *
+ * @param input The optional bytearray chunk which is the final part of the input
+ * @return A string containing the hash value
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 8.5
+ * @tiptext
+ */
+ public function complete(input:ByteArray=null):String
+ {
+ if ( arr.length == 0 )
+ {
+ if ( input == null )
+ {
+ throw new Error("null input to complete without prior call to update. At least an empty bytearray must be passed.");
+ }
+ }
+
+ if ( input != null )
+ {
+ readIntoArray(input);
+ }
+
+ //pad, append length
+ padArray(arrLen);
+
+ hashRemainingChunks(false);
+
+ var res:String = IntUtil.toHex( a ) + IntUtil.toHex( b ) +
+ IntUtil.toHex( c ) + IntUtil.toHex( d );
+ resetFields();
+
+ return res;
+ }
+
+ /**
+ * Pass in chunks of the input data with update(), call
+ * complete() with an optional chunk which will return the
+ * final hash. Equivalent to the way
+ * java.security.MessageDigest works.
+ *
+ * @param input The bytearray chunk to perform the hash on
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 8.5
+ * @tiptext
+ */
+ public function update(input:ByteArray):void
+ {
+ readIntoArray(input);
+ hashRemainingChunks();
+ }
+
+ /**
+ * Re-initialize this instance for use to perform hashing on
+ * another input stream. This is called automatically by
+ * complete().
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 8.5
+ * @tiptext
+ */
+ public function resetFields():void
+ {
+ //truncate array
+ arr.length = 0;
+ arrLen = 0;
+
+ // initialize the md buffers
+ a = 1732584193;
+ b = -271733879;
+ c = -1732584194;
+ d = 271733878;
+
+ // variables to store previous values
+ aa = 0;
+ bb = 0;
+ cc = 0;
+ dd = 0;
+
+ arrIndexLen = 0;
+ arrProcessIndex = 0;
+ cleanIndex = 0;
+ }
+
+ /** read into arr and free up used blocks of arr */
+ private function readIntoArray(input:ByteArray):void
+ {
+ var closestChunkLen:int = input.length * 8;
+ arrLen += closestChunkLen;
+
+ /* clean up memory. if there are entries in the array that
+ * are already processed and the amount is greater than
+ * memoryBlockSize, create a new array, copy the last
+ * block into it and let the old one get picked up by
+ * GC. */
+ if ( arrProcessIndex - cleanIndex > memoryBlockSize )
+ {
+ var newarr:Array= new Array();
+
+ /* AS Arrays in sparse arrays. arr[2002] can exist
+ * without values for arr[0] - arr[2001] */
+ for ( var j:int = arrProcessIndex; j < arr.length; j++ )
+ {
+ newarr[j] = arr[j];
+ }
+
+ cleanIndex = arrProcessIndex;
+ arr = null;
+ arr = newarr;
+ }
+
+ for ( var k:int = 0; k < closestChunkLen; k+=8 )
+ {
+ //discard high bytes (convert to uint)
+ arr[ int(arrIndexLen >> 5) ] |= ( input[ k / 8 ] & mask ) << ( arrIndexLen % 32 );
+ arrIndexLen += 8;
+ }
+
+
+ }
+
+ private function hashRemainingChunks(bUpdate:Boolean=true):void
+ {
+ var len:int = arr.length;
+
+ /* leave a 16 word block untouched if we are called from
+ * update. This is because, padArray() can modify the last
+ * block and this modification has to happen before we
+ * compute the hash. */
+ if ( bUpdate )
+ {
+ len -= 16;
+ }
+
+ /* don't do anything if don't have a 16 word block. */
+ if ( arrProcessIndex >= len || len - arrProcessIndex < 15 )
+ {
+ return;
+ }
+
+
+ for ( var i:int = arrProcessIndex; i < len ; i += 16, arrProcessIndex += 16)
+ {
+ // save previous values
+ aa = a;
+ bb = b;
+ cc = c;
+ dd = d;
+
+ // Round 1
+ a = ff( a, b, c, d, arr[int(i+ 0)], 7, -680876936 ); // 1
+ d = ff( d, a, b, c, arr[int(i+ 1)], 12, -389564586 ); // 2
+ c = ff( c, d, a, b, arr[int(i+ 2)], 17, 606105819 ); // 3
+ b = ff( b, c, d, a, arr[int(i+ 3)], 22, -1044525330 ); // 4
+ a = ff( a, b, c, d, arr[int(i+ 4)], 7, -176418897 ); // 5
+ d = ff( d, a, b, c, arr[int(i+ 5)], 12, 1200080426 ); // 6
+ c = ff( c, d, a, b, arr[int(i+ 6)], 17, -1473231341 ); // 7
+ b = ff( b, c, d, a, arr[int(i+ 7)], 22, -45705983 ); // 8
+ a = ff( a, b, c, d, arr[int(i+ 8)], 7, 1770035416 ); // 9
+ d = ff( d, a, b, c, arr[int(i+ 9)], 12, -1958414417 ); // 10
+ c = ff( c, d, a, b, arr[int(i+10)], 17, -42063 ); // 11
+ b = ff( b, c, d, a, arr[int(i+11)], 22, -1990404162 ); // 12
+ a = ff( a, b, c, d, arr[int(i+12)], 7, 1804603682 ); // 13
+ d = ff( d, a, b, c, arr[int(i+13)], 12, -40341101 ); // 14
+ c = ff( c, d, a, b, arr[int(i+14)], 17, -1502002290 ); // 15
+ b = ff( b, c, d, a, arr[int(i+15)], 22, 1236535329 ); // 16
+
+ // Round 2
+ a = gg( a, b, c, d, arr[int(i+ 1)], 5, -165796510 ); // 17
+ d = gg( d, a, b, c, arr[int(i+ 6)], 9, -1069501632 ); // 18
+ c = gg( c, d, a, b, arr[int(i+11)], 14, 643717713 ); // 19
+ b = gg( b, c, d, a, arr[int(i+ 0)], 20, -373897302 ); // 20
+ a = gg( a, b, c, d, arr[int(i+ 5)], 5, -701558691 ); // 21
+ d = gg( d, a, b, c, arr[int(i+10)], 9, 38016083 ); // 22
+ c = gg( c, d, a, b, arr[int(i+15)], 14, -660478335 ); // 23
+ b = gg( b, c, d, a, arr[int(i+ 4)], 20, -405537848 ); // 24
+ a = gg( a, b, c, d, arr[int(i+ 9)], 5, 568446438 ); // 25
+ d = gg( d, a, b, c, arr[int(i+14)], 9, -1019803690 ); // 26
+ c = gg( c, d, a, b, arr[int(i+ 3)], 14, -187363961 ); // 27
+ b = gg( b, c, d, a, arr[int(i+ 8)], 20, 1163531501 ); // 28
+ a = gg( a, b, c, d, arr[int(i+13)], 5, -1444681467 ); // 29
+ d = gg( d, a, b, c, arr[int(i+ 2)], 9, -51403784 ); // 30
+ c = gg( c, d, a, b, arr[int(i+ 7)], 14, 1735328473 ); // 31
+ b = gg( b, c, d, a, arr[int(i+12)], 20, -1926607734 ); // 32
+
+ // Round 3
+ a = hh( a, b, c, d, arr[int(i+ 5)], 4, -378558 ); // 33
+ d = hh( d, a, b, c, arr[int(i+ 8)], 11, -2022574463 ); // 34
+ c = hh( c, d, a, b, arr[int(i+11)], 16, 1839030562 ); // 35
+ b = hh( b, c, d, a, arr[int(i+14)], 23, -35309556 ); // 36
+ a = hh( a, b, c, d, arr[int(i+ 1)], 4, -1530992060 ); // 37
+ d = hh( d, a, b, c, arr[int(i+ 4)], 11, 1272893353 ); // 38
+ c = hh( c, d, a, b, arr[int(i+ 7)], 16, -155497632 ); // 39
+ b = hh( b, c, d, a, arr[int(i+10)], 23, -1094730640 ); // 40
+ a = hh( a, b, c, d, arr[int(i+13)], 4, 681279174 ); // 41
+ d = hh( d, a, b, c, arr[int(i+ 0)], 11, -358537222 ); // 42
+ c = hh( c, d, a, b, arr[int(i+ 3)], 16, -722521979 ); // 43
+ b = hh( b, c, d, a, arr[int(i+ 6)], 23, 76029189 ); // 44
+ a = hh( a, b, c, d, arr[int(i+ 9)], 4, -640364487 ); // 45
+ d = hh( d, a, b, c, arr[int(i+12)], 11, -421815835 ); // 46
+ c = hh( c, d, a, b, arr[int(i+15)], 16, 530742520 ); // 47
+ b = hh( b, c, d, a, arr[int(i+ 2)], 23, -995338651 ); // 48
+
+ // Round 4
+ a = ii( a, b, c, d, arr[int(i+ 0)], 6, -198630844 ); // 49
+ d = ii( d, a, b, c, arr[int(i+ 7)], 10, 1126891415 ); // 50
+ c = ii( c, d, a, b, arr[int(i+14)], 15, -1416354905 ); // 51
+ b = ii( b, c, d, a, arr[int(i+ 5)], 21, -57434055 ); // 52
+ a = ii( a, b, c, d, arr[int(i+12)], 6, 1700485571 ); // 53
+ d = ii( d, a, b, c, arr[int(i+ 3)], 10, -1894986606 ); // 54
+ c = ii( c, d, a, b, arr[int(i+10)], 15, -1051523 ); // 55
+ b = ii( b, c, d, a, arr[int(i+ 1)], 21, -2054922799 ); // 56
+ a = ii( a, b, c, d, arr[int(i+ 8)], 6, 1873313359 ); // 57
+ d = ii( d, a, b, c, arr[int(i+15)], 10, -30611744 ); // 58
+ c = ii( c, d, a, b, arr[int(i+ 6)], 15, -1560198380 ); // 59
+ b = ii( b, c, d, a, arr[int(i+13)], 21, 1309151649 ); // 60
+ a = ii( a, b, c, d, arr[int(i+ 4)], 6, -145523070 ); // 61
+ d = ii( d, a, b, c, arr[int(i+11)], 10, -1120210379 ); // 62
+ c = ii( c, d, a, b, arr[int(i+ 2)], 15, 718787259 ); // 63
+ b = ii( b, c, d, a, arr[int(i+ 9)], 21, -343485551 ); // 64
+
+ a += aa;
+ b += bb;
+ c += cc;
+ d += dd;
+
+ }
+
+ }
+
+ private function padArray(len:int):void
+ {
+ arr[ int(len >> 5) ] |= 0x80 << ( len % 32 );
+ arr[ int(( ( ( len + 64 ) >>> 9 ) << 4 ) + 14) ] = len;
+ arrLen = arr.length;
+ }
+
+ /* Code below same as com.adobe.crypto.MD5 */
+
+ /**
+ * Auxiliary function f as defined in RFC
+ */
+ private static function f( x:int, y:int, z:int ):int {
+ return ( x & y ) | ( (~x) & z );
+ }
+
+ /**
+ * Auxiliary function g as defined in RFC
+ */
+ private static function g( x:int, y:int, z:int ):int {
+ return ( x & z ) | ( y & (~z) );
+ }
+
+ /**
+ * Auxiliary function h as defined in RFC
+ */
+ private static function h( x:int, y:int, z:int ):int {
+ return x ^ y ^ z;
+ }
+
+ /**
+ * Auxiliary function i as defined in RFC
+ */
+ private static function i( x:int, y:int, z:int ):int {
+ return y ^ ( x | (~z) );
+ }
+
+ /**
+ * A generic transformation function. The logic of ff, gg, hh, and
+ * ii are all the same, minus the function used, so pull that logic
+ * out and simplify the method bodies for the transoformation functions.
+ */
+ private static function transform( func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int {
+ var tmp:int = a + int( func( b, c, d ) ) + x + t;
+ return IntUtil.rol( tmp, s ) + b;
+ }
+
+ /**
+ * ff transformation function
+ */
+ private static function ff ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
+ return transform( f, a, b, c, d, x, s, t );
+ }
+
+ /**
+ * gg transformation function
+ */
+ private static function gg ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
+ return transform( g, a, b, c, d, x, s, t );
+ }
+
+ /**
+ * hh transformation function
+ */
+ private static function hh ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
+ return transform( h, a, b, c, d, x, s, t );
+ }
+
+ /**
+ * ii transformation function
+ */
+ private static function ii ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
+ return transform( i, a, b, c, d, x, s, t );
+ }
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/crypto/SHA1.as b/vendors/uploadify/com/adobe/crypto/SHA1.as new file mode 100644 index 000000000..952f3c70f --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/SHA1.as @@ -0,0 +1,271 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.crypto
+{
+ import com.adobe.utils.IntUtil;
+ import flash.utils.ByteArray;
+ import mx.utils.Base64Encoder;
+
+ /**
+ * US Secure Hash Algorithm 1 (SHA1)
+ *
+ * Implementation based on algorithm description at
+ * http://www.faqs.org/rfcs/rfc3174.html
+ */
+ public class SHA1
+ {
+ public static var digest:ByteArray;
+
+ /**
+ * Performs the SHA1 hash algorithm on a string.
+ *
+ * @param s The string to hash
+ * @return A string containing the hash value of s
+ * @langversion ActionScript 3.0
+ * @playerversion 9.0
+ * @tiptext
+ */
+ public static function hash( s:String ):String
+ {
+ var blocks:Array = createBlocksFromString( s );
+ var byteArray:ByteArray = hashBlocks( blocks );
+
+ return IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true );
+ }
+
+ /**
+ * Performs the SHA1 hash algorithm on a ByteArray.
+ *
+ * @param data The ByteArray data to hash
+ * @return A string containing the hash value of data
+ * @langversion ActionScript 3.0
+ * @playerversion 9.0
+ */
+ public static function hashBytes( data:ByteArray ):String
+ {
+ var blocks:Array = SHA1.createBlocksFromByteArray( data );
+ var byteArray:ByteArray = hashBlocks(blocks);
+
+ return IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true )
+ + IntUtil.toHex( byteArray.readInt(), true );
+ }
+
+ /**
+ * Performs the SHA1 hash algorithm on a string, then does
+ * Base64 encoding on the result.
+ *
+ * @param s The string to hash
+ * @return The base64 encoded hash value of s
+ * @langversion ActionScript 3.0
+ * @playerversion 9.0
+ * @tiptext
+ */
+ public static function hashToBase64( s:String ):String
+ {
+ var blocks:Array = SHA1.createBlocksFromString( s );
+ var byteArray:ByteArray = hashBlocks(blocks);
+
+ // ByteArray.toString() returns the contents as a UTF-8 string,
+ // which we can't use because certain byte sequences might trigger
+ // a UTF-8 conversion. Instead, we convert the bytes to characters
+ // one by one.
+ var charsInByteArray:String = "";
+ byteArray.position = 0;
+ for (var j:int = 0; j < byteArray.length; j++)
+ {
+ var byte:uint = byteArray.readUnsignedByte();
+ charsInByteArray += String.fromCharCode(byte);
+ }
+
+ var encoder:Base64Encoder = new Base64Encoder();
+ encoder.encode(charsInByteArray);
+ return encoder.flush();
+ }
+
+ private static function hashBlocks( blocks:Array ):ByteArray
+ {
+ // initialize the h's
+ var h0:int = 0x67452301;
+ var h1:int = 0xefcdab89;
+ var h2:int = 0x98badcfe;
+ var h3:int = 0x10325476;
+ var h4:int = 0xc3d2e1f0;
+
+ var len:int = blocks.length;
+ var w:Array = new Array( 80 );
+
+ // loop over all of the blocks
+ for ( var i:int = 0; i < len; i += 16 ) {
+
+ // 6.1.c
+ var a:int = h0;
+ var b:int = h1;
+ var c:int = h2;
+ var d:int = h3;
+ var e:int = h4;
+
+ // 80 steps to process each block
+ // TODO: unroll for faster execution, or 4 loops of
+ // 20 each to avoid the k and f function calls
+ for ( var t:int = 0; t < 80; t++ ) {
+
+ if ( t < 16 ) {
+ // 6.1.a
+ w[ t ] = blocks[ i + t ];
+ } else {
+ // 6.1.b
+ w[ t ] = IntUtil.rol( w[ t - 3 ] ^ w[ t - 8 ] ^ w[ t - 14 ] ^ w[ t - 16 ], 1 );
+ }
+
+ // 6.1.d
+ var temp:int = IntUtil.rol( a, 5 ) + f( t, b, c, d ) + e + int( w[ t ] ) + k( t );
+
+ e = d;
+ d = c;
+ c = IntUtil.rol( b, 30 );
+ b = a;
+ a = temp;
+ }
+
+ // 6.1.e
+ h0 += a;
+ h1 += b;
+ h2 += c;
+ h3 += d;
+ h4 += e;
+ }
+
+ var byteArray:ByteArray = new ByteArray();
+ byteArray.writeInt(h0);
+ byteArray.writeInt(h1);
+ byteArray.writeInt(h2);
+ byteArray.writeInt(h3);
+ byteArray.writeInt(h4);
+ byteArray.position = 0;
+
+ digest = new ByteArray();
+ digest.writeBytes(byteArray);
+ digest.position = 0;
+ return byteArray;
+ }
+
+ /**
+ * Performs the logical function based on t
+ */
+ private static function f( t:int, b:int, c:int, d:int ):int {
+ if ( t < 20 ) {
+ return ( b & c ) | ( ~b & d );
+ } else if ( t < 40 ) {
+ return b ^ c ^ d;
+ } else if ( t < 60 ) {
+ return ( b & c ) | ( b & d ) | ( c & d );
+ }
+ return b ^ c ^ d;
+ }
+
+ /**
+ * Determines the constant value based on t
+ */
+ private static function k( t:int ):int {
+ if ( t < 20 ) {
+ return 0x5a827999;
+ } else if ( t < 40 ) {
+ return 0x6ed9eba1;
+ } else if ( t < 60 ) {
+ return 0x8f1bbcdc;
+ }
+ return 0xca62c1d6;
+ }
+
+ /**
+ * Converts a ByteArray to a sequence of 16-word blocks
+ * that we'll do the processing on. Appends padding
+ * and length in the process.
+ *
+ * @param data The data to split into blocks
+ * @return An array containing the blocks into which data was split
+ */
+ private static function createBlocksFromByteArray( data:ByteArray ):Array
+ {
+ var oldPosition:int = data.position;
+ data.position = 0;
+
+ var blocks:Array = new Array();
+ var len:int = data.length * 8;
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
+ for( var i:int = 0; i < len; i += 8 )
+ {
+ blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 );
+ }
+
+ // append padding and length
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
+
+ data.position = oldPosition;
+
+ return blocks;
+ }
+
+ /**
+ * Converts a string to a sequence of 16-word blocks
+ * that we'll do the processing on. Appends padding
+ * and length in the process.
+ *
+ * @param s The string to split into blocks
+ * @return An array containing the blocks that s was split into.
+ */
+ private static function createBlocksFromString( s:String ):Array
+ {
+ var blocks:Array = new Array();
+ var len:int = s.length * 8;
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
+ for( var i:int = 0; i < len; i += 8 ) {
+ blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 );
+ }
+
+ // append padding and length
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
+ return blocks;
+ }
+
+ }
+}
diff --git a/vendors/uploadify/com/adobe/crypto/SHA224.as b/vendors/uploadify/com/adobe/crypto/SHA224.as new file mode 100644 index 000000000..ee1545373 --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/SHA224.as @@ -0,0 +1,257 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + import mx.utils.Base64Encoder; + + /** + * The SHA-224 algorithm + * + * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf + */ + public class SHA224 + { + public static var digest:ByteArray; + + /** + * Performs the SHA224 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hash( s:String ):String { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks( blocks ); + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA224 hash algorithm on a ByteArray. + * + * @param data The ByteArray data to hash + * @return A string containing the hash value of data + * @langversion ActionScript 3.0 + * @playerversion 9.0 + */ + public static function hashBytes( data:ByteArray ):String + { + var blocks:Array = createBlocksFromByteArray( data ); + var byteArray:ByteArray = hashBlocks(blocks); + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA224 hash algorithm on a string, then does + * Base64 encoding on the result. + * + * @param s The string to hash + * @return The base64 encoded hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hashToBase64( s:String ):String + { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks(blocks); + + // ByteArray.toString() returns the contents as a UTF-8 string, + // which we can't use because certain byte sequences might trigger + // a UTF-8 conversion. Instead, we convert the bytes to characters + // one by one. + var charsInByteArray:String = ""; + byteArray.position = 0; + for (var j:int = 0; j < byteArray.length; j++) + { + var byte:uint = byteArray.readUnsignedByte(); + charsInByteArray += String.fromCharCode(byte); + } + + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(charsInByteArray); + return encoder.flush(); + } + + private static function hashBlocks( blocks:Array ):ByteArray { + var h0:int = 0xc1059ed8; + var h1:int = 0x367cd507; + var h2:int = 0x3070dd17; + var h3:int = 0xf70e5939; + var h4:int = 0xffc00b31; + var h5:int = 0x68581511; + var h6:int = 0x64f98fa7; + var h7:int = 0xbefa4fa4; + + var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2); + + var len:int = blocks.length; + var w:Array = new Array(); + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16 ) { + + var a:int = h0; + var b:int = h1; + var c:int = h2; + var d:int = h3; + var e:int = h4; + var f:int = h5; + var g:int = h6; + var h:int = h7; + + for(var t:int = 0; t < 64; t++) { + + if ( t < 16 ) { + w[t] = blocks[ i + t ]; + if(isNaN(w[t])) { w[t] = 0; } + } else { + var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3); + var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10); + w[t] = w[t-16] + ws0 + w[t-7] + ws1; + } + + var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22); + var maj:int = (a & b) ^ (a & c) ^ (b & c); + var t2:int = s0 + maj; + var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25); + var ch:int = (e & f) ^ ((~e) & g); + var t1:int = h + s1 + ch + k[t] + w[t]; + + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + //Add this chunk's hash to result so far: + h0 += a; + h1 += b; + h2 += c; + h3 += d; + h4 += e; + h5 += f; + h6 += g; + h7 += h; + } + + var byteArray:ByteArray = new ByteArray(); + byteArray.writeInt(h0); + byteArray.writeInt(h1); + byteArray.writeInt(h2); + byteArray.writeInt(h3); + byteArray.writeInt(h4); + byteArray.writeInt(h5); + byteArray.writeInt(h6); + byteArray.position = 0; + + digest = new ByteArray(); + digest.writeBytes(byteArray); + digest.position = 0; + return byteArray; + } + + /** + * Converts a ByteArray to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param data The data to split into blocks + * @return An array containing the blocks into which data was split + */ + private static function createBlocksFromByteArray( data:ByteArray ):Array + { + var oldPosition:int = data.position; + data.position = 0; + + var blocks:Array = new Array(); + var len:int = data.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) + { + blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + + data.position = oldPosition; + + return blocks; + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was split into. + */ + private static function createBlocksFromString( s:String ):Array + { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + return blocks; + } + } +} diff --git a/vendors/uploadify/com/adobe/crypto/SHA256.as b/vendors/uploadify/com/adobe/crypto/SHA256.as new file mode 100644 index 000000000..09a2ba23d --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/SHA256.as @@ -0,0 +1,261 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + import mx.utils.Base64Encoder; + + /** + * The SHA-256 algorithm + * + * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf + */ + public class SHA256 + { + public static var digest:ByteArray; + /** + * Performs the SHA256 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hash( s:String ):String { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks( blocks ); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA256 hash algorithm on a ByteArray. + * + * @param data The ByteArray data to hash + * @return A string containing the hash value of data + * @langversion ActionScript 3.0 + * @playerversion 9.0 + */ + public static function hashBytes( data:ByteArray ):String + { + var blocks:Array = createBlocksFromByteArray( data ); + var byteArray:ByteArray = hashBlocks(blocks); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA256 hash algorithm on a string, then does + * Base64 encoding on the result. + * + * @param s The string to hash + * @return The base64 encoded hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hashToBase64( s:String ):String + { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks(blocks); + + // ByteArray.toString() returns the contents as a UTF-8 string, + // which we can't use because certain byte sequences might trigger + // a UTF-8 conversion. Instead, we convert the bytes to characters + // one by one. + var charsInByteArray:String = ""; + byteArray.position = 0; + for (var j:int = 0; j < byteArray.length; j++) + { + var byte:uint = byteArray.readUnsignedByte(); + charsInByteArray += String.fromCharCode(byte); + } + + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(charsInByteArray); + return encoder.flush(); + } + + private static function hashBlocks( blocks:Array ):ByteArray { + var h0:int = 0x6a09e667; + var h1:int = 0xbb67ae85; + var h2:int = 0x3c6ef372; + var h3:int = 0xa54ff53a; + var h4:int = 0x510e527f; + var h5:int = 0x9b05688c; + var h6:int = 0x1f83d9ab; + var h7:int = 0x5be0cd19; + + var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2); + + var len:int = blocks.length; + var w:Array = new Array( 64 ); + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16 ) { + + var a:int = h0; + var b:int = h1; + var c:int = h2; + var d:int = h3; + var e:int = h4; + var f:int = h5; + var g:int = h6; + var h:int = h7; + + for(var t:int = 0; t < 64; t++) { + + if ( t < 16 ) { + w[t] = blocks[ i + t ]; + if(isNaN(w[t])) { w[t] = 0; } + } else { + var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3); + var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10); + w[t] = w[t-16] + ws0 + w[t-7] + ws1; + } + + var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22); + var maj:int = (a & b) ^ (a & c) ^ (b & c); + var t2:int = s0 + maj; + var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25); + var ch:int = (e & f) ^ ((~e) & g); + var t1:int = h + s1 + ch + k[t] + w[t]; + + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + //Add this chunk's hash to result so far: + h0 += a; + h1 += b; + h2 += c; + h3 += d; + h4 += e; + h5 += f; + h6 += g; + h7 += h; + } + + var byteArray:ByteArray = new ByteArray(); + byteArray.writeInt(h0); + byteArray.writeInt(h1); + byteArray.writeInt(h2); + byteArray.writeInt(h3); + byteArray.writeInt(h4); + byteArray.writeInt(h5); + byteArray.writeInt(h6); + byteArray.writeInt(h7); + byteArray.position = 0; + + digest = new ByteArray(); + digest.writeBytes(byteArray); + digest.position = 0; + return byteArray; + } + + /** + * Converts a ByteArray to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param data The data to split into blocks + * @return An array containing the blocks into which data was split + */ + private static function createBlocksFromByteArray( data:ByteArray ):Array + { + var oldPosition:int = data.position; + data.position = 0; + + var blocks:Array = new Array(); + var len:int = data.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) + { + blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + + data.position = oldPosition; + + return blocks; + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was split into. + */ + private static function createBlocksFromString( s:String ):Array + { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + return blocks; + } + } +} diff --git a/vendors/uploadify/com/adobe/crypto/WSSEUsernameToken.as b/vendors/uploadify/com/adobe/crypto/WSSEUsernameToken.as new file mode 100644 index 000000000..92bbba6dc --- /dev/null +++ b/vendors/uploadify/com/adobe/crypto/WSSEUsernameToken.as @@ -0,0 +1,114 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.crypto
+{
+ import mx.formatters.DateFormatter;
+ import mx.utils.Base64Encoder;
+
+ /**
+ * Web Services Security Username Token
+ *
+ * Implementation based on algorithm description at
+ * http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf
+ */
+ public class WSSEUsernameToken
+ {
+ /**
+ * Generates a WSSE Username Token.
+ *
+ * @param username The username
+ * @param password The password
+ * @param nonce A cryptographically random nonce (if null, the nonce
+ * will be generated)
+ * @param timestamp The time at which the token is generated (if null,
+ * the time will be set to the moment of execution)
+ * @return The generated token
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function getUsernameToken(username:String, password:String, nonce:String=null, timestamp:Date=null):String
+ {
+ if (nonce == null)
+ {
+ nonce = generateNonce();
+ }
+ nonce = base64Encode(nonce);
+
+ var created:String = generateTimestamp(timestamp);
+
+ var password64:String = getBase64Digest(nonce,
+ created,
+ password);
+
+ var token:String = new String("UsernameToken Username=\"");
+ token += username + "\", " +
+ "PasswordDigest=\"" + password64 + "\", " +
+ "Nonce=\"" + nonce + "\", " +
+ "Created=\"" + created + "\"";
+ return token;
+ }
+
+ private static function generateNonce():String
+ {
+ // Math.random returns a Number between 0 and 1. We don't want our
+ // nonce to contain invalid characters (e.g. the period) so we
+ // strip them out before returning the result.
+ var s:String = Math.random().toString();
+ return s.replace(".", "");
+ }
+
+ internal static function base64Encode(s:String):String
+ {
+ var encoder:Base64Encoder = new Base64Encoder();
+ encoder.encode(s);
+ return encoder.flush();
+ }
+
+ internal static function generateTimestamp(timestamp:Date):String
+ {
+ if (timestamp == null)
+ {
+ timestamp = new Date();
+ }
+ var dateFormatter:DateFormatter = new DateFormatter();
+ dateFormatter.formatString = "YYYY-MM-DDTJJ:NN:SS"
+ return dateFormatter.format(timestamp) + "Z";
+ }
+
+ internal static function getBase64Digest(nonce:String, created:String, password:String):String
+ {
+ return SHA1.hashToBase64(nonce + created + password);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/errors/IllegalStateError.as b/vendors/uploadify/com/adobe/errors/IllegalStateError.as new file mode 100644 index 000000000..fa16191d5 --- /dev/null +++ b/vendors/uploadify/com/adobe/errors/IllegalStateError.as @@ -0,0 +1,63 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.errors
+{
+ /**
+ * This class represents an Error that is thrown when a method is called when
+ * the receiving instance is in an invalid state.
+ *
+ * For example, this may occur if a method has been called, and other properties
+ * in the instance have not been initialized properly.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ *
+ */
+ public class IllegalStateError extends Error
+ {
+ /**
+ * Constructor
+ *
+ * @param message A message describing the error in detail.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function IllegalStateError(message:String)
+ {
+ super(message);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/fileformats/vcard/Address.as b/vendors/uploadify/com/adobe/fileformats/vcard/Address.as new file mode 100644 index 000000000..a368ffb06 --- /dev/null +++ b/vendors/uploadify/com/adobe/fileformats/vcard/Address.as @@ -0,0 +1,47 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.fileformats.vcard +{ + public class Address + { + public var type:String; + public var street:String; + public var city:String; + public var state:String; + public var postalCode:String; + + public function toString():String + { + return (street + " " + city + ", " + state + " " + postalCode); + } + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/fileformats/vcard/Email.as b/vendors/uploadify/com/adobe/fileformats/vcard/Email.as new file mode 100644 index 000000000..071c39edf --- /dev/null +++ b/vendors/uploadify/com/adobe/fileformats/vcard/Email.as @@ -0,0 +1,39 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.fileformats.vcard +{ + public class Email + { + public var type:String; + public var address:String; + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/fileformats/vcard/Phone.as b/vendors/uploadify/com/adobe/fileformats/vcard/Phone.as new file mode 100644 index 000000000..27f98e4ed --- /dev/null +++ b/vendors/uploadify/com/adobe/fileformats/vcard/Phone.as @@ -0,0 +1,39 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.fileformats.vcard +{ + public class Phone + { + public var type:String; + public var number:String; + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/fileformats/vcard/VCard.as b/vendors/uploadify/com/adobe/fileformats/vcard/VCard.as new file mode 100644 index 000000000..d6bc28322 --- /dev/null +++ b/vendors/uploadify/com/adobe/fileformats/vcard/VCard.as @@ -0,0 +1,54 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.fileformats.vcard +{ + import flash.utils.ByteArray; + + public class VCard + { + public var fullName:String; + public var orgs:Array; + public var title:String; + public var image:ByteArray; + public var phones:Array; + public var emails:Array; + public var addresses:Array; + + public function VCard() + { + orgs = new Array(); + phones = new Array(); + emails = new Array(); + addresses = new Array(); + } + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/fileformats/vcard/VCardParser.as b/vendors/uploadify/com/adobe/fileformats/vcard/VCardParser.as new file mode 100644 index 000000000..45c954aa9 --- /dev/null +++ b/vendors/uploadify/com/adobe/fileformats/vcard/VCardParser.as @@ -0,0 +1,246 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.fileformats.vcard +{ + import mx.utils.Base64Decoder; + import mx.utils.StringUtil; + + public class VCardParser + { + public static function parse(vcardStr:String):Array + { + var vcards:Array = new Array(); + var lines:Array = vcardStr.split(/\r\n/); + var vcard:VCard; + var type:String; + var typeTmp:String; + var line:String; + + for (var i:uint = 0; i < lines.length; ++i) + { + line = lines[i]; + if (line == "BEGIN:VCARD") + { + vcard = new VCard(); + } + else if (line == "END:VCARD") + { + if (vcard != null) + { + vcards.push(vcard); + } + } + else if(line.search(/^ORG/i) != -1) + { + var org:String = line.substring(4, line.length); + var orgArray:Array = org.split(";"); + for each (var orgToken:String in orgArray) + { + if (StringUtil.trim(orgToken).length > 0) + { + vcard.orgs.push(orgToken); + } + } + } + else if(line.search(/^TITLE/i) != -1) + { + var title:String = line.substring(6, line.length); + vcard.title = title; + } + else if (line.search(/^FN:/i) != -1) + { + var fullName:String = line.substring(3, line.length); + vcard.fullName = fullName; + } + else if (line.search(/^TEL/i) != -1) + { + type = new String(); + typeTmp = new String(); + var phone:Phone = new Phone(); + var number:String; + var phoneTokens:Array = line.split(";"); + for each (var phoneToken:String in phoneTokens) + { + if (phoneToken.search(/^TYPE=/i) != -1) + { + if (phoneToken.indexOf(":") != -1) + { + typeTmp = phoneToken.substring(5, phoneToken.indexOf(":")); + number = phoneToken.substring(phoneToken.indexOf(":")+1, phoneToken.length); + } + else + { + typeTmp = phoneToken.substring(5, phoneToken.length); + } + + typeTmp = typeTmp.toLocaleLowerCase(); + + if (typeTmp == "pref") + { + continue; + } + if (type.length != 0) + { + type += (" "); + } + type += typeTmp; + } + } + if (type.length > 0 && number != null) + { + phone.type = type; + phone.number = number; + } + vcard.phones.push(phone); + } + else if (line.search(/^EMAIL/i) != -1) + { + type = new String(); + typeTmp = new String(); + var email:Email = new Email(); + var emailAddress:String; + var emailTokens:Array = line.split(";"); + for each (var emailToken:String in emailTokens) + { + if (emailToken.search(/^TYPE=/i) != -1) + { + if (emailToken.indexOf(":") != -1) + { + typeTmp = emailToken.substring(5, emailToken.indexOf(":")); + emailAddress = emailToken.substring(emailToken.indexOf(":")+1, emailToken.length); + } + else + { + typeTmp = emailToken.substring(5, emailToken.length); + } + + typeTmp = typeTmp.toLocaleLowerCase(); + + if (typeTmp == "pref" || typeTmp == "internet") + { + continue; + } + if (type.length != 0) + { + type += (" "); + } + type += typeTmp; + } + } + if (type.length > 0 && emailAddress != null) + { + email.type = type; + email.address = emailAddress; + } + vcard.emails.push(email); + } + else if (line.indexOf("ADR;") != -1) + { + var addressTokens:Array = line.split(";"); + var address:Address = new Address(); + for (var j:uint = 0; j < addressTokens.length; ++j) + { + var addressToken:String = addressTokens[j]; + if (addressToken.search(/^home:+$/i) != -1) // For Outlook, which uses non-standard vCards. + { + address.type = "home"; + } + else if (addressToken.search(/^work:+$/i) != -1) // For Outlook, which uses non-standard vCards. + { + address.type = "work"; + } + if (addressToken.search(/^type=/i) != -1) // The "type" parameter is the standard way (which Address Book uses) + { + // First, remove the optional ":" character. + addressToken = addressToken.replace(/:/,""); + var addressType:String = addressToken.substring(5, addressToken.length).toLowerCase(); + if (addressType == "pref") // Not interested in which one is preferred. + { + continue; + } + else if (addressType.indexOf("home") != -1) // home + { + addressType = "home"; + } + else if (addressType.indexOf("work") != -1) // work + { + addressType = "work"; + } + else if (addressType.indexOf(",") != -1) // if the comma technique is used, just use the first one + { + var typeTokens:Array = addressType.split(","); + for each (var typeToken:String in typeTokens) + { + if (typeToken != "pref") + { + addressType = typeToken; + break; + } + } + } + address.type = addressType; + } + else if (addressToken.search(/^\d/) != -1 && address.street == null) + { + address.street = addressToken.replace(/\\n/, ""); + address.city = addressTokens[j+1]; + address.state = addressTokens[j+2]; + address.postalCode = addressTokens[j+3]; + } + } + if (address.type != null && address.street != null) + { + vcard.addresses.push(address); + } + + } + else if (line.search(/^PHOTO;BASE64/i) != -1) + { + var imageStr:String = new String(); + for (var k:uint = i+1; k < lines.length; ++k) + { + imageStr += lines[k]; + //if (lines[k].search(/.+\=$/) != -1) // Very slow in Mac due to RegEx bug + if (lines[k].indexOf('=') != -1) + { + var decoder:Base64Decoder = new Base64Decoder(); + decoder.decode(imageStr); + vcard.image = decoder.flush(); + break; + } + } + } + } + return vcards; + } + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/images/BitString.as b/vendors/uploadify/com/adobe/images/BitString.as new file mode 100644 index 000000000..b5c2b8410 --- /dev/null +++ b/vendors/uploadify/com/adobe/images/BitString.as @@ -0,0 +1,39 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package com.adobe.images
+{
+ public class BitString
+ {
+ public var len:int = 0;
+ public var val:int = 0;
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/images/JPGEncoder.as b/vendors/uploadify/com/adobe/images/JPGEncoder.as new file mode 100644 index 000000000..100d7e968 --- /dev/null +++ b/vendors/uploadify/com/adobe/images/JPGEncoder.as @@ -0,0 +1,648 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package com.adobe.images
+{
+ import flash.geom.*;
+ import flash.display.*;
+ import flash.utils.*;
+
+ /**
+ * Class that converts BitmapData into a valid JPEG
+ */
+ public class JPGEncoder
+ {
+
+ // Static table initialization
+
+ private var ZigZag:Array = [
+ 0, 1, 5, 6,14,15,27,28,
+ 2, 4, 7,13,16,26,29,42,
+ 3, 8,12,17,25,30,41,43,
+ 9,11,18,24,31,40,44,53,
+ 10,19,23,32,39,45,52,54,
+ 20,22,33,38,46,51,55,60,
+ 21,34,37,47,50,56,59,61,
+ 35,36,48,49,57,58,62,63
+ ];
+
+ private var YTable:Array = new Array(64);
+ private var UVTable:Array = new Array(64);
+ private var fdtbl_Y:Array = new Array(64);
+ private var fdtbl_UV:Array = new Array(64);
+
+ private function initQuantTables(sf:int):void
+ {
+ var i:int;
+ var t:Number;
+ var YQT:Array = [
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 56, 68,109,103, 77,
+ 24, 35, 55, 64, 81,104,113, 92,
+ 49, 64, 78, 87,103,121,120,101,
+ 72, 92, 95, 98,112,100,103, 99
+ ];
+ for (i = 0; i < 64; i++) {
+ t = Math.floor((YQT[i]*sf+50)/100);
+ if (t < 1) {
+ t = 1;
+ } else if (t > 255) {
+ t = 255;
+ }
+ YTable[ZigZag[i]] = t;
+ }
+ var UVQT:Array = [
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+ ];
+ for (i = 0; i < 64; i++) {
+ t = Math.floor((UVQT[i]*sf+50)/100);
+ if (t < 1) {
+ t = 1;
+ } else if (t > 255) {
+ t = 255;
+ }
+ UVTable[ZigZag[i]] = t;
+ }
+ var aasf:Array = [
+ 1.0, 1.387039845, 1.306562965, 1.175875602,
+ 1.0, 0.785694958, 0.541196100, 0.275899379
+ ];
+ i = 0;
+ for (var row:int = 0; row < 8; row++)
+ {
+ for (var col:int = 0; col < 8; col++)
+ {
+ fdtbl_Y[i] = (1.0 / (YTable [ZigZag[i]] * aasf[row] * aasf[col] * 8.0));
+ fdtbl_UV[i] = (1.0 / (UVTable[ZigZag[i]] * aasf[row] * aasf[col] * 8.0));
+ i++;
+ }
+ }
+ }
+
+ private var YDC_HT:Array;
+ private var UVDC_HT:Array;
+ private var YAC_HT:Array;
+ private var UVAC_HT:Array;
+
+ private function computeHuffmanTbl(nrcodes:Array, std_table:Array):Array
+ {
+ var codevalue:int = 0;
+ var pos_in_table:int = 0;
+ var HT:Array = new Array();
+ for (var k:int=1; k<=16; k++) {
+ for (var j:int=1; j<=nrcodes[k]; j++) {
+ HT[std_table[pos_in_table]] = new BitString();
+ HT[std_table[pos_in_table]].val = codevalue;
+ HT[std_table[pos_in_table]].len = k;
+ pos_in_table++;
+ codevalue++;
+ }
+ codevalue*=2;
+ }
+ return HT;
+ }
+
+ private var std_dc_luminance_nrcodes:Array = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0];
+ private var std_dc_luminance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11];
+ private var std_ac_luminance_nrcodes:Array = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d];
+ private var std_ac_luminance_values:Array = [
+ 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,
+ 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,
+ 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,
+ 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,
+ 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,
+ 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,
+ 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,
+ 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
+ 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,
+ 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,
+ 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,
+ 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
+ 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,
+ 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,
+ 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,
+ 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,
+ 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,
+ 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,
+ 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,
+ 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
+ 0xf9,0xfa
+ ];
+
+ private var std_dc_chrominance_nrcodes:Array = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0];
+ private var std_dc_chrominance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11];
+ private var std_ac_chrominance_nrcodes:Array = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77];
+ private var std_ac_chrominance_values:Array = [
+ 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,
+ 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,
+ 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,
+ 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,
+ 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,
+ 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,
+ 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,
+ 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,
+ 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,
+ 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,
+ 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,
+ 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
+ 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,
+ 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,
+ 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,
+ 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,
+ 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,
+ 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,
+ 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,
+ 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
+ 0xf9,0xfa
+ ];
+
+ private function initHuffmanTbl():void
+ {
+ YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values);
+ UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values);
+ YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values);
+ UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values);
+ }
+
+ private var bitcode:Array = new Array(65535);
+ private var category:Array = new Array(65535);
+
+ private function initCategoryNumber():void
+ {
+ var nrlower:int = 1;
+ var nrupper:int = 2;
+ var nr:int;
+ for (var cat:int=1; cat<=15; cat++) {
+ //Positive numbers
+ for (nr=nrlower; nr<nrupper; nr++) {
+ category[32767+nr] = cat;
+ bitcode[32767+nr] = new BitString();
+ bitcode[32767+nr].len = cat;
+ bitcode[32767+nr].val = nr;
+ }
+ //Negative numbers
+ for (nr=-(nrupper-1); nr<=-nrlower; nr++) {
+ category[32767+nr] = cat;
+ bitcode[32767+nr] = new BitString();
+ bitcode[32767+nr].len = cat;
+ bitcode[32767+nr].val = nrupper-1+nr;
+ }
+ nrlower <<= 1;
+ nrupper <<= 1;
+ }
+ }
+
+ // IO functions
+
+ private var byteout:ByteArray;
+ private var bytenew:int = 0;
+ private var bytepos:int = 7;
+
+ private function writeBits(bs:BitString):void
+ {
+ var value:int = bs.val;
+ var posval:int = bs.len-1;
+ while ( posval >= 0 ) {
+ if (value & uint(1 << posval) ) {
+ bytenew |= uint(1 << bytepos);
+ }
+ posval--;
+ bytepos--;
+ if (bytepos < 0) {
+ if (bytenew == 0xFF) {
+ writeByte(0xFF);
+ writeByte(0);
+ }
+ else {
+ writeByte(bytenew);
+ }
+ bytepos=7;
+ bytenew=0;
+ }
+ }
+ }
+
+ private function writeByte(value:int):void
+ {
+ byteout.writeByte(value);
+ }
+
+ private function writeWord(value:int):void
+ {
+ writeByte((value>>8)&0xFF);
+ writeByte((value )&0xFF);
+ }
+
+ // DCT & quantization core
+
+ private function fDCTQuant(data:Array, fdtbl:Array):Array
+ {
+ var tmp0:Number, tmp1:Number, tmp2:Number, tmp3:Number, tmp4:Number, tmp5:Number, tmp6:Number, tmp7:Number;
+ var tmp10:Number, tmp11:Number, tmp12:Number, tmp13:Number;
+ var z1:Number, z2:Number, z3:Number, z4:Number, z5:Number, z11:Number, z13:Number;
+ var i:int;
+ /* Pass 1: process rows. */
+ var dataOff:int=0;
+ for (i=0; i<8; i++) {
+ tmp0 = data[dataOff+0] + data[dataOff+7];
+ tmp7 = data[dataOff+0] - data[dataOff+7];
+ tmp1 = data[dataOff+1] + data[dataOff+6];
+ tmp6 = data[dataOff+1] - data[dataOff+6];
+ tmp2 = data[dataOff+2] + data[dataOff+5];
+ tmp5 = data[dataOff+2] - data[dataOff+5];
+ tmp3 = data[dataOff+3] + data[dataOff+4];
+ tmp4 = data[dataOff+3] - data[dataOff+4];
+
+ /* Even part */
+ tmp10 = tmp0 + tmp3; /* phase 2 */
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ data[dataOff+0] = tmp10 + tmp11; /* phase 3 */
+ data[dataOff+4] = tmp10 - tmp11;
+
+ z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */
+ data[dataOff+2] = tmp13 + z1; /* phase 5 */
+ data[dataOff+6] = tmp13 - z1;
+
+ /* Odd part */
+ tmp10 = tmp4 + tmp5; /* phase 2 */
+ tmp11 = tmp5 + tmp6;
+ tmp12 = tmp6 + tmp7;
+
+ /* The rotator is modified from fig 4-8 to avoid extra negations. */
+ z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */
+ z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */
+ z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */
+ z3 = tmp11 * 0.707106781; /* c4 */
+
+ z11 = tmp7 + z3; /* phase 5 */
+ z13 = tmp7 - z3;
+
+ data[dataOff+5] = z13 + z2; /* phase 6 */
+ data[dataOff+3] = z13 - z2;
+ data[dataOff+1] = z11 + z4;
+ data[dataOff+7] = z11 - z4;
+
+ dataOff += 8; /* advance pointer to next row */
+ }
+
+ /* Pass 2: process columns. */
+ dataOff = 0;
+ for (i=0; i<8; i++) {
+ tmp0 = data[dataOff+ 0] + data[dataOff+56];
+ tmp7 = data[dataOff+ 0] - data[dataOff+56];
+ tmp1 = data[dataOff+ 8] + data[dataOff+48];
+ tmp6 = data[dataOff+ 8] - data[dataOff+48];
+ tmp2 = data[dataOff+16] + data[dataOff+40];
+ tmp5 = data[dataOff+16] - data[dataOff+40];
+ tmp3 = data[dataOff+24] + data[dataOff+32];
+ tmp4 = data[dataOff+24] - data[dataOff+32];
+
+ /* Even part */
+ tmp10 = tmp0 + tmp3; /* phase 2 */
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ data[dataOff+ 0] = tmp10 + tmp11; /* phase 3 */
+ data[dataOff+32] = tmp10 - tmp11;
+
+ z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */
+ data[dataOff+16] = tmp13 + z1; /* phase 5 */
+ data[dataOff+48] = tmp13 - z1;
+
+ /* Odd part */
+ tmp10 = tmp4 + tmp5; /* phase 2 */
+ tmp11 = tmp5 + tmp6;
+ tmp12 = tmp6 + tmp7;
+
+ /* The rotator is modified from fig 4-8 to avoid extra negations. */
+ z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */
+ z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */
+ z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */
+ z3 = tmp11 * 0.707106781; /* c4 */
+
+ z11 = tmp7 + z3; /* phase 5 */
+ z13 = tmp7 - z3;
+
+ data[dataOff+40] = z13 + z2; /* phase 6 */
+ data[dataOff+24] = z13 - z2;
+ data[dataOff+ 8] = z11 + z4;
+ data[dataOff+56] = z11 - z4;
+
+ dataOff++; /* advance pointer to next column */
+ }
+
+ // Quantize/descale the coefficients
+ for (i=0; i<64; i++) {
+ // Apply the quantization and scaling factor & Round to nearest integer
+ data[i] = Math.round((data[i]*fdtbl[i]));
+ }
+ return data;
+ }
+
+ // Chunk writing
+
+ private function writeAPP0():void
+ {
+ writeWord(0xFFE0); // marker
+ writeWord(16); // length
+ writeByte(0x4A); // J
+ writeByte(0x46); // F
+ writeByte(0x49); // I
+ writeByte(0x46); // F
+ writeByte(0); // = "JFIF",'\0'
+ writeByte(1); // versionhi
+ writeByte(1); // versionlo
+ writeByte(0); // xyunits
+ writeWord(1); // xdensity
+ writeWord(1); // ydensity
+ writeByte(0); // thumbnwidth
+ writeByte(0); // thumbnheight
+ }
+
+ private function writeSOF0(width:int, height:int):void
+ {
+ writeWord(0xFFC0); // marker
+ writeWord(17); // length, truecolor YUV JPG
+ writeByte(8); // precision
+ writeWord(height);
+ writeWord(width);
+ writeByte(3); // nrofcomponents
+ writeByte(1); // IdY
+ writeByte(0x11); // HVY
+ writeByte(0); // QTY
+ writeByte(2); // IdU
+ writeByte(0x11); // HVU
+ writeByte(1); // QTU
+ writeByte(3); // IdV
+ writeByte(0x11); // HVV
+ writeByte(1); // QTV
+ }
+
+ private function writeDQT():void
+ {
+ writeWord(0xFFDB); // marker
+ writeWord(132); // length
+ writeByte(0);
+ var i:int;
+ for (i=0; i<64; i++) {
+ writeByte(YTable[i]);
+ }
+ writeByte(1);
+ for (i=0; i<64; i++) {
+ writeByte(UVTable[i]);
+ }
+ }
+
+ private function writeDHT():void
+ {
+ writeWord(0xFFC4); // marker
+ writeWord(0x01A2); // length
+ var i:int;
+
+ writeByte(0); // HTYDCinfo
+ for (i=0; i<16; i++) {
+ writeByte(std_dc_luminance_nrcodes[i+1]);
+ }
+ for (i=0; i<=11; i++) {
+ writeByte(std_dc_luminance_values[i]);
+ }
+
+ writeByte(0x10); // HTYACinfo
+ for (i=0; i<16; i++) {
+ writeByte(std_ac_luminance_nrcodes[i+1]);
+ }
+ for (i=0; i<=161; i++) {
+ writeByte(std_ac_luminance_values[i]);
+ }
+
+ writeByte(1); // HTUDCinfo
+ for (i=0; i<16; i++) {
+ writeByte(std_dc_chrominance_nrcodes[i+1]);
+ }
+ for (i=0; i<=11; i++) {
+ writeByte(std_dc_chrominance_values[i]);
+ }
+
+ writeByte(0x11); // HTUACinfo
+ for (i=0; i<16; i++) {
+ writeByte(std_ac_chrominance_nrcodes[i+1]);
+ }
+ for (i=0; i<=161; i++) {
+ writeByte(std_ac_chrominance_values[i]);
+ }
+ }
+
+ private function writeSOS():void
+ {
+ writeWord(0xFFDA); // marker
+ writeWord(12); // length
+ writeByte(3); // nrofcomponents
+ writeByte(1); // IdY
+ writeByte(0); // HTY
+ writeByte(2); // IdU
+ writeByte(0x11); // HTU
+ writeByte(3); // IdV
+ writeByte(0x11); // HTV
+ writeByte(0); // Ss
+ writeByte(0x3f); // Se
+ writeByte(0); // Bf
+ }
+
+ // Core processing
+ private var DU:Array = new Array(64);
+
+ private function processDU(CDU:Array, fdtbl:Array, DC:Number, HTDC:Array, HTAC:Array):Number
+ {
+ var EOB:BitString = HTAC[0x00];
+ var M16zeroes:BitString = HTAC[0xF0];
+ var i:int;
+
+ var DU_DCT:Array = fDCTQuant(CDU, fdtbl);
+ //ZigZag reorder
+ for (i=0;i<64;i++) {
+ DU[ZigZag[i]]=DU_DCT[i];
+ }
+ var Diff:int = DU[0] - DC; DC = DU[0];
+ //Encode DC
+ if (Diff==0) {
+ writeBits(HTDC[0]); // Diff might be 0
+ } else {
+ writeBits(HTDC[category[32767+Diff]]);
+ writeBits(bitcode[32767+Diff]);
+ }
+ //Encode ACs
+ var end0pos:int = 63;
+ for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {
+ };
+ //end0pos = first element in reverse order !=0
+ if ( end0pos == 0) {
+ writeBits(EOB);
+ return DC;
+ }
+ i = 1;
+ while ( i <= end0pos ) {
+ var startpos:int = i;
+ for (; (DU[i]==0) && (i<=end0pos); i++) {
+ }
+ var nrzeroes:int = i-startpos;
+ if ( nrzeroes >= 16 ) {
+ for (var nrmarker:int=1; nrmarker <= nrzeroes/16; nrmarker++) {
+ writeBits(M16zeroes);
+ }
+ nrzeroes = int(nrzeroes&0xF);
+ }
+ writeBits(HTAC[nrzeroes*16+category[32767+DU[i]]]);
+ writeBits(bitcode[32767+DU[i]]);
+ i++;
+ }
+ if ( end0pos != 63 ) {
+ writeBits(EOB);
+ }
+ return DC;
+ }
+
+ private var YDU:Array = new Array(64);
+ private var UDU:Array = new Array(64);
+ private var VDU:Array = new Array(64);
+
+ private function RGB2YUV(img:BitmapData, xpos:int, ypos:int):void
+ {
+ var pos:int=0;
+ for (var y:int=0; y<8; y++) {
+ for (var x:int=0; x<8; x++) {
+ var P:uint = img.getPixel32(xpos+x,ypos+y);
+ var R:Number = Number((P>>16)&0xFF);
+ var G:Number = Number((P>> 8)&0xFF);
+ var B:Number = Number((P )&0xFF);
+ YDU[pos]=((( 0.29900)*R+( 0.58700)*G+( 0.11400)*B))-128;
+ UDU[pos]=(((-0.16874)*R+(-0.33126)*G+( 0.50000)*B));
+ VDU[pos]=((( 0.50000)*R+(-0.41869)*G+(-0.08131)*B));
+ pos++;
+ }
+ }
+ }
+
+ /**
+ * Constructor for JPEGEncoder class
+ *
+ * @param quality The quality level between 1 and 100 that detrmines the
+ * level of compression used in the generated JPEG
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function JPGEncoder(quality:Number = 50)
+ {
+ if (quality <= 0) {
+ quality = 1;
+ }
+ if (quality > 100) {
+ quality = 100;
+ }
+ var sf:int = 0;
+ if (quality < 50) {
+ sf = int(5000 / quality);
+ } else {
+ sf = int(200 - quality*2);
+ }
+ // Create tables
+ initHuffmanTbl();
+ initCategoryNumber();
+ initQuantTables(sf);
+ }
+
+ /**
+ * Created a JPEG image from the specified BitmapData
+ *
+ * @param image The BitmapData that will be converted into the JPEG format.
+ * @return a ByteArray representing the JPEG encoded image data.
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function encode(image:BitmapData):ByteArray
+ {
+ // Initialize bit writer
+ byteout = new ByteArray();
+ bytenew=0;
+ bytepos=7;
+
+ // Add JPEG headers
+ writeWord(0xFFD8); // SOI
+ writeAPP0();
+ writeDQT();
+ writeSOF0(image.width,image.height);
+ writeDHT();
+ writeSOS();
+
+
+ // Encode 8x8 macroblocks
+ var DCY:Number=0;
+ var DCU:Number=0;
+ var DCV:Number=0;
+ bytenew=0;
+ bytepos=7;
+ for (var ypos:int=0; ypos<image.height; ypos+=8) {
+ for (var xpos:int=0; xpos<image.width; xpos+=8) {
+ RGB2YUV(image, xpos, ypos);
+ DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
+ DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
+ DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT);
+ }
+ }
+
+ // Do the bit alignment of the EOI marker
+ if ( bytepos >= 0 ) {
+ var fillbits:BitString = new BitString();
+ fillbits.len = bytepos+1;
+ fillbits.val = (1<<(bytepos+1))-1;
+ writeBits(fillbits);
+ }
+
+ writeWord(0xFFD9); //EOI
+ return byteout;
+ }
+ }
+}
diff --git a/vendors/uploadify/com/adobe/images/PNGEncoder.as b/vendors/uploadify/com/adobe/images/PNGEncoder.as new file mode 100644 index 000000000..83c95f629 --- /dev/null +++ b/vendors/uploadify/com/adobe/images/PNGEncoder.as @@ -0,0 +1,141 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package com.adobe.images
+{
+ import flash.geom.*;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.utils.ByteArray;
+
+ /**
+ * Class that converts BitmapData into a valid PNG
+ */
+ public class PNGEncoder
+ {
+ /**
+ * Created a PNG image from the specified BitmapData
+ *
+ * @param image The BitmapData that will be converted into the PNG format.
+ * @return a ByteArray representing the PNG encoded image data.
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function encode(img:BitmapData):ByteArray {
+ // Create output byte array
+ var png:ByteArray = new ByteArray();
+ // Write PNG signature
+ png.writeUnsignedInt(0x89504e47);
+ png.writeUnsignedInt(0x0D0A1A0A);
+ // Build IHDR chunk
+ var IHDR:ByteArray = new ByteArray();
+ IHDR.writeInt(img.width);
+ IHDR.writeInt(img.height);
+ IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA
+ IHDR.writeByte(0);
+ writeChunk(png,0x49484452,IHDR);
+ // Build IDAT chunk
+ var IDAT:ByteArray= new ByteArray();
+ for(var i:int=0;i < img.height;i++) {
+ // no filter
+ IDAT.writeByte(0);
+ var p:uint;
+ var j:int;
+ if ( !img.transparent ) {
+ for(j=0;j < img.width;j++) {
+ p = img.getPixel(j,i);
+ IDAT.writeUnsignedInt(
+ uint(((p&0xFFFFFF) << 8)|0xFF));
+ }
+ } else {
+ for(j=0;j < img.width;j++) {
+ p = img.getPixel32(j,i);
+ IDAT.writeUnsignedInt(
+ uint(((p&0xFFFFFF) << 8)|
+ (p>>>24)));
+ }
+ }
+ }
+ IDAT.compress();
+ writeChunk(png,0x49444154,IDAT);
+ // Build IEND chunk
+ writeChunk(png,0x49454E44,null);
+ // return PNG
+ return png;
+ }
+
+ private static var crcTable:Array;
+ private static var crcTableComputed:Boolean = false;
+
+ private static function writeChunk(png:ByteArray,
+ type:uint, data:ByteArray):void {
+ if (!crcTableComputed) {
+ crcTableComputed = true;
+ crcTable = [];
+ var c:uint;
+ for (var n:uint = 0; n < 256; n++) {
+ c = n;
+ for (var k:uint = 0; k < 8; k++) {
+ if (c & 1) {
+ c = uint(uint(0xedb88320) ^
+ uint(c >>> 1));
+ } else {
+ c = uint(c >>> 1);
+ }
+ }
+ crcTable[n] = c;
+ }
+ }
+ var len:uint = 0;
+ if (data != null) {
+ len = data.length;
+ }
+ png.writeUnsignedInt(len);
+ var p:uint = png.position;
+ png.writeUnsignedInt(type);
+ if ( data != null ) {
+ png.writeBytes(data);
+ }
+ var e:uint = png.position;
+ png.position = p;
+ c = 0xffffffff;
+ for (var i:int = 0; i < (e-p); i++) {
+ c = uint(crcTable[
+ (c ^ png.readUnsignedByte()) &
+ uint(0xff)] ^ uint(c >>> 8));
+ }
+ c = uint(c^uint(0xffffffff));
+ png.position = e;
+ png.writeUnsignedInt(c);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/DynamicURLLoader.as b/vendors/uploadify/com/adobe/net/DynamicURLLoader.as new file mode 100644 index 000000000..2a9eea1c3 --- /dev/null +++ b/vendors/uploadify/com/adobe/net/DynamicURLLoader.as @@ -0,0 +1,55 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.net
+{
+ import flash.net.URLLoader;
+
+ /**
+ * Class that provides a dynamic implimentation of the URLLoader class.
+ *
+ * This class provides no API implimentations. However, since the class is
+ * declared as dynamic, it can be used in place of URLLoader, and allow
+ * you to dynamically attach properties to it (which URLLoader does not allow).
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public dynamic class DynamicURLLoader extends URLLoader
+ {
+ public function DynamicURLLoader()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/IURIResolver.as b/vendors/uploadify/com/adobe/net/IURIResolver.as new file mode 100644 index 000000000..3610cc2a4 --- /dev/null +++ b/vendors/uploadify/com/adobe/net/IURIResolver.as @@ -0,0 +1,76 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.net
+{
+ /**
+ * The URI class cannot know about DNS aliases, virtual hosts, or
+ * symbolic links that may be involved. The application can provide
+ * an implementation of this interface to resolve the URI before the
+ * URI class makes any comparisons. For example, a web host has
+ * two aliases:
+ *
+ * <p><code>
+ * http://www.site.com/
+ * http://www.site.net/
+ * </code></p>
+ *
+ * <p>The application can provide an implementation that automatically
+ * resolves site.net to site.com before URI compares two URI objects.
+ * Only the application can know and understand the context in which
+ * the URI's are being used.</p>
+ *
+ * <p>Use the URI.resolver accessor to assign a custom resolver to
+ * the URI class. Any resolver specified is global to all instances
+ * of URI.</p>
+ *
+ * <p>URI will call this before performing URI comparisons in the
+ * URI.getRelation() and URI.getCommonParent() functions.
+ *
+ * @see URI.getRelation
+ * @see URI.getCommonParent
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public interface IURIResolver
+ {
+ /**
+ * Implement this method to provide custom URI resolution for
+ * your application.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ function resolve(uri:URI) : URI;
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/MimeTypeMap.as b/vendors/uploadify/com/adobe/net/MimeTypeMap.as new file mode 100644 index 000000000..32e40a4dc --- /dev/null +++ b/vendors/uploadify/com/adobe/net/MimeTypeMap.as @@ -0,0 +1,196 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.net +{ + public class MimeTypeMap + { + private var types:Array = + [["application/andrew-inset","ez"], + ["application/atom+xml","atom"], + ["application/mac-binhex40","hqx"], + ["application/mac-compactpro","cpt"], + ["application/mathml+xml","mathml"], + ["application/msword","doc"], + ["application/octet-stream","bin","dms","lha","lzh","exe","class","so","dll","dmg"], + ["application/oda","oda"], + ["application/ogg","ogg"], + ["application/pdf","pdf"], + ["application/postscript","ai","eps","ps"], + ["application/rdf+xml","rdf"], + ["application/smil","smi","smil"], + ["application/srgs","gram"], + ["application/srgs+xml","grxml"], + ["application/vnd.adobe.apollo-application-installer-package+zip","air"], + ["application/vnd.mif","mif"], + ["application/vnd.mozilla.xul+xml","xul"], + ["application/vnd.ms-excel","xls"], + ["application/vnd.ms-powerpoint","ppt"], + ["application/vnd.rn-realmedia","rm"], + ["application/vnd.wap.wbxml","wbxml"], + ["application/vnd.wap.wmlc","wmlc"], + ["application/vnd.wap.wmlscriptc","wmlsc"], + ["application/voicexml+xml","vxml"], + ["application/x-bcpio","bcpio"], + ["application/x-cdlink","vcd"], + ["application/x-chess-pgn","pgn"], + ["application/x-cpio","cpio"], + ["application/x-csh","csh"], + ["application/x-director","dcr","dir","dxr"], + ["application/x-dvi","dvi"], + ["application/x-futuresplash","spl"], + ["application/x-gtar","gtar"], + ["application/x-hdf","hdf"], + ["application/x-javascript","js"], + ["application/x-koan","skp","skd","skt","skm"], + ["application/x-latex","latex"], + ["application/x-netcdf","nc","cdf"], + ["application/x-sh","sh"], + ["application/x-shar","shar"], + ["application/x-shockwave-flash","swf"], + ["application/x-stuffit","sit"], + ["application/x-sv4cpio","sv4cpio"], + ["application/x-sv4crc","sv4crc"], + ["application/x-tar","tar"], + ["application/x-tcl","tcl"], + ["application/x-tex","tex"], + ["application/x-texinfo","texinfo","texi"], + ["application/x-troff","t","tr","roff"], + ["application/x-troff-man","man"], + ["application/x-troff-me","me"], + ["application/x-troff-ms","ms"], + ["application/x-ustar","ustar"], + ["application/x-wais-source","src"], + ["application/xhtml+xml","xhtml","xht"], + ["application/xml","xml","xsl"], + ["application/xml-dtd","dtd"], + ["application/xslt+xml","xslt"], + ["application/zip","zip"], + ["audio/basic","au","snd"], + ["audio/midi","mid","midi","kar"], + ["audio/mpeg","mp3","mpga","mp2"], + ["audio/x-aiff","aif","aiff","aifc"], + ["audio/x-mpegurl","m3u"], + ["audio/x-pn-realaudio","ram","ra"], + ["audio/x-wav","wav"], + ["chemical/x-pdb","pdb"], + ["chemical/x-xyz","xyz"], + ["image/bmp","bmp"], + ["image/cgm","cgm"], + ["image/gif","gif"], + ["image/ief","ief"], + ["image/jpeg","jpg","jpeg","jpe"], + ["image/png","png"], + ["image/svg+xml","svg"], + ["image/tiff","tiff","tif"], + ["image/vnd.djvu","djvu","djv"], + ["image/vnd.wap.wbmp","wbmp"], + ["image/x-cmu-raster","ras"], + ["image/x-icon","ico"], + ["image/x-portable-anymap","pnm"], + ["image/x-portable-bitmap","pbm"], + ["image/x-portable-graymap","pgm"], + ["image/x-portable-pixmap","ppm"], + ["image/x-rgb","rgb"], + ["image/x-xbitmap","xbm"], + ["image/x-xpixmap","xpm"], + ["image/x-xwindowdump","xwd"], + ["model/iges","igs","iges"], + ["model/mesh","msh","mesh","silo"], + ["model/vrml","wrl","vrml"], + ["text/calendar","ics","ifb"], + ["text/css","css"], + ["text/html","html","htm"], + ["text/plain","txt","asc"], + ["text/richtext","rtx"], + ["text/rtf","rtf"], + ["text/sgml","sgml","sgm"], + ["text/tab-separated-values","tsv"], + ["text/vnd.wap.wml","wml"], + ["text/vnd.wap.wmlscript","wmls"], + ["text/x-setext","etx"], + ["video/mpeg","mpg","mpeg","mpe"], + ["video/quicktime","mov","qt"], + ["video/vnd.mpegurl","m4u","mxu"], + ["video/x-flv","flv"], + ["video/x-msvideo","avi"], + ["video/x-sgi-movie","movie"], + ["x-conference/x-cooltalk","ice"]]; + + /** + * Returns the mimetype for the given extension. + */ + public function getMimeType(extension:String):String + { + extension = extension.toLocaleLowerCase(); + for each (var a:Array in types) + { + for each (var b:String in a) + { + if (b == extension) + { + return a[0]; + } + } + } + return null; + } + + /** + * Returns the prefered extension for the given mimetype. + */ + public function getExtension(mimetype:String):String + { + mimetype = mimetype.toLocaleLowerCase(); + for each (var a:Array in types) + { + if (a[0] == mimetype) + { + return a[1]; + } + } + return null; + } + + /** + * Adds a mimetype to the map. The order of the extensions matters. The most preferred should come first. + */ + public function addMimeType(mimetype:String, extensions:Array):void + { + var newType:Array = [mimetype]; + for each (var a:String in extensions) + { + newType.push(a); + } + types.push(newType); + } + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/URI.as b/vendors/uploadify/com/adobe/net/URI.as new file mode 100644 index 000000000..d43ce9fa2 --- /dev/null +++ b/vendors/uploadify/com/adobe/net/URI.as @@ -0,0 +1,2466 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.net
+{
+ import flash.utils.ByteArray;
+
+ /**
+ * This class implements functions and utilities for working with URI's
+ * (Universal Resource Identifiers). For technical description of the
+ * URI syntax, please see RFC 3986 at http://www.ietf.org/rfc/rfc3986.txt
+ * or do a web search for "rfc 3986".
+ *
+ * <p>The most important aspect of URI's to understand is that URI's
+ * and URL's are not strings. URI's are complex data structures that
+ * encapsulate many pieces of information. The string version of a
+ * URI is the serialized representation of that data structure. This
+ * string serialization is used to provide a human readable
+ * representation and a means to transport the data over the network
+ * where it can then be parsed back into its' component parts.</p>
+ *
+ * <p>URI's fall into one of three categories:
+ * <ul>
+ * <li><scheme>:<scheme-specific-part>#<fragment> (non-hierarchical)</li>
+ * <li><scheme>:<authority><path>?<query>#<fragment> (hierarchical)</li>
+ * <li><path>?<query>#<fragment> (relative hierarchical)</li>
+ * </ul></p>
+ *
+ * <p>The query and fragment parts are optional.</p>
+ *
+ * <p>This class supports both non-hierarchical and hierarchical URI's</p>
+ *
+ * <p>This class is intended to be used "as-is" for the vast majority
+ * of common URI's. However, if your application requires a custom
+ * URI syntax (e.g. custom query syntax or special handling of
+ * non-hierarchical URI's), this class can be fully subclassed. If you
+ * intended to subclass URI, please see the source code for complete
+ * documation on protected members and protected fuctions.</p>
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public class URI
+ {
+ // Here we define which characters must be escaped for each
+ // URI part. The characters that must be escaped for each
+ // part differ depending on what would cause ambiguous parsing.
+ // RFC 3986 sec. 2.4 states that characters should only be
+ // encoded when they would conflict with subcomponent delimiters.
+ // We don't want to over-do the escaping. We only want to escape
+ // the minimum needed to prevent parsing problems.
+
+ // space and % must be escaped in all cases. '%' is the delimiter
+ // for escaped characters.
+ public static const URImustEscape:String = " %";
+
+ // Baseline of what characters must be escaped
+ public static const URIbaselineEscape:String = URImustEscape + ":?#/@";
+
+ // Characters that must be escaped in the part part.
+ public static const URIpathEscape:String = URImustEscape + "?#";
+
+ // Characters that must be escaped in the query part, if setting
+ // the query as a whole string. If the query is set by
+ // name/value, URIqueryPartEscape is used instead.
+ public static const URIqueryEscape:String = URImustEscape + "#";
+
+ // This is what each name/value pair must escape "&=" as well
+ // so they don't conflict with the "param=value¶m2=value2"
+ // syntax.
+ public static const URIqueryPartEscape:String = URImustEscape + "#&=";
+
+ // Non-hierarchical URI's can have query and fragment parts, but
+ // we also want to prevent '/' otherwise it might end up looking
+ // like a hierarchical URI to the parser.
+ public static const URInonHierEscape:String = URImustEscape + "?#/";
+
+ // Baseline uninitialized setting for the URI scheme.
+ public static const UNKNOWN_SCHEME:String = "unknown";
+
+ // The following bitmaps are used for performance enhanced
+ // character escaping.
+
+ // Baseline characters that need to be escaped. Many parts use
+ // this.
+ protected static const URIbaselineExcludedBitmap:URIEncodingBitmap =
+ new URIEncodingBitmap(URIbaselineEscape);
+
+ // Scheme escaping bitmap
+ protected static const URIschemeExcludedBitmap:URIEncodingBitmap =
+ URIbaselineExcludedBitmap;
+
+ // User/pass escaping bitmap
+ protected static const URIuserpassExcludedBitmap:URIEncodingBitmap =
+ URIbaselineExcludedBitmap;
+
+ // Authority escaping bitmap
+ protected static const URIauthorityExcludedBitmap:URIEncodingBitmap =
+ URIbaselineExcludedBitmap;
+
+ // Port escaping bitmap
+ protected static const URIportExludedBitmap:URIEncodingBitmap =
+ URIbaselineExcludedBitmap;
+
+ // Path escaping bitmap
+ protected static const URIpathExcludedBitmap:URIEncodingBitmap =
+ new URIEncodingBitmap(URIpathEscape);
+
+ // Query (whole) escaping bitmap
+ protected static const URIqueryExcludedBitmap:URIEncodingBitmap =
+ new URIEncodingBitmap(URIqueryEscape);
+
+ // Query (individual parts) escaping bitmap
+ protected static const URIqueryPartExcludedBitmap:URIEncodingBitmap =
+ new URIEncodingBitmap(URIqueryPartEscape);
+
+ // Fragments are the last part in the URI. They only need to
+ // escape space, '#', and '%'. Turns out that is what query
+ // uses too.
+ protected static const URIfragmentExcludedBitmap:URIEncodingBitmap =
+ URIqueryExcludedBitmap;
+
+ // Characters that need to be escaped in the non-hierarchical part
+ protected static const URInonHierexcludedBitmap:URIEncodingBitmap =
+ new URIEncodingBitmap(URInonHierEscape);
+
+ // Values used by getRelation()
+ public static const NOT_RELATED:int = 0;
+ public static const CHILD:int = 1;
+ public static const EQUAL:int = 2;
+ public static const PARENT:int = 3;
+
+ //-------------------------------------------------------------------
+ // protected class members
+ //-------------------------------------------------------------------
+ protected var _valid:Boolean = false;
+ protected var _relative:Boolean = false;
+ protected var _scheme:String = "";
+ protected var _authority:String = "";
+ protected var _username:String = "";
+ protected var _password:String = "";
+ protected var _port:String = "";
+ protected var _path:String = "";
+ protected var _query:String = "";
+ protected var _fragment:String = "";
+ protected var _nonHierarchical:String = "";
+ protected static var _resolver:IURIResolver = null;
+
+
+ /**
+ * URI Constructor. If no string is given, this will initialize
+ * this URI object to a blank URI.
+ */
+ public function URI(uri:String = null) : void
+ {
+ if (uri == null)
+ initialize();
+ else
+ constructURI(uri);
+ }
+
+
+ /**
+ * @private
+ * Method that loads the URI from the given string.
+ */
+ protected function constructURI(uri:String) : Boolean
+ {
+ if (!parseURI(uri))
+ _valid = false;
+
+ return isValid();
+ }
+
+
+ /**
+ * @private Private initializiation.
+ */
+ protected function initialize() : void
+ {
+ _valid = false;
+ _relative = false;
+
+ _scheme = UNKNOWN_SCHEME;
+ _authority = "";
+ _username = "";
+ _password = "";
+ _port = "";
+ _path = "";
+ _query = "";
+ _fragment = "";
+
+ _nonHierarchical = "";
+ }
+
+ /**
+ * @private Accessor to explicitly set/get the hierarchical
+ * state of the URI.
+ */
+ protected function set hierState(state:Boolean) : void
+ {
+ if (state)
+ {
+ // Clear the non-hierarchical data
+ _nonHierarchical = "";
+
+ // Also set the state vars while we are at it
+ if (_scheme == "" || _scheme == UNKNOWN_SCHEME)
+ _relative = true;
+ else
+ _relative = false;
+
+ if (_authority.length == 0 && _path.length == 0)
+ _valid = false;
+ else
+ _valid = true;
+ }
+ else
+ {
+ // Clear the hierarchical data
+ _authority = "";
+ _username = "";
+ _password = "";
+ _port = "";
+ _path = "";
+
+ _relative = false;
+
+ if (_scheme == "" || _scheme == UNKNOWN_SCHEME)
+ _valid = false;
+ else
+ _valid = true;
+ }
+ }
+ protected function get hierState() : Boolean
+ {
+ return (_nonHierarchical.length == 0);
+ }
+
+
+ /**
+ * @private Functions that performs some basic consistency validation.
+ */
+ protected function validateURI() : Boolean
+ {
+ // Check the scheme
+ if (isAbsolute())
+ {
+ if (_scheme.length <= 1 || _scheme == UNKNOWN_SCHEME)
+ {
+ // we probably parsed a C:\ type path or no scheme
+ return false;
+ }
+ else if (verifyAlpha(_scheme) == false)
+ return false; // Scheme contains bad characters
+ }
+
+ if (hierState)
+ {
+ if (_path.search('\\') != -1)
+ return false; // local path
+ else if (isRelative() == false && _scheme == UNKNOWN_SCHEME)
+ return false; // It's an absolute URI, but it has a bad scheme
+ }
+ else
+ {
+ if (_nonHierarchical.search('\\') != -1)
+ return false; // some kind of local path
+ }
+
+ // Looks like it's ok.
+ return true;
+ }
+
+
+ /**
+ * @private
+ *
+ * Given a URI in string format, parse that sucker into its basic
+ * components and assign them to this object. A URI is of the form:
+ * <scheme>:<authority><path>?<query>#<fragment>
+ *
+ * For simplicity, we parse the URI in the following order:
+ *
+ * 1. Fragment (anchors)
+ * 2. Query (CGI stuff)
+ * 3. Scheme ("http")
+ * 4. Authority (host name)
+ * 5. Username/Password (if any)
+ * 6. Port (server port if any)
+ * 7. Path (/homepages/mypage.html)
+ *
+ * The reason for this order is to minimize any parsing ambiguities.
+ * Fragments and queries can contain almost anything (they are parts
+ * that can contain custom data with their own syntax). Parsing
+ * them out first removes a large chance of parsing errors. This
+ * method expects well formed URI's, but performing the parse in
+ * this order makes us a little more tolerant of user error.
+ *
+ * REGEXP
+ * Why doesn't this use regular expressions to parse the URI? We
+ * have found that in a real world scenario, URI's are not always
+ * well formed. Sometimes characters that should have been escaped
+ * are not, and those situations would break a regexp pattern. This
+ * function attempts to be smart about what it is parsing based on
+ * location of characters relative to eachother. This function has
+ * been proven through real-world use to parse the vast majority
+ * of URI's correctly.
+ *
+ * NOTE
+ * It is assumed that the string in URI form is escaped. This function
+ * does not escape anything. If you constructed the URI string by
+ * hand, and used this to parse in the URI and still need it escaped,
+ * call forceEscape() on your URI object.
+ *
+ * Parsing Assumptions
+ * This routine assumes that the URI being passed is well formed.
+ * Passing things like local paths, malformed URI's, and the such
+ * will result in parsing errors. This function can handle
+ * - absolute hierarchical (e.g. "http://something.com/index.html),
+ * - relative hierarchical (e.g. "../images/flower.gif"), or
+ * - non-hierarchical URIs (e.g. "mailto:jsmith@fungoo.com").
+ *
+ * Anything else will probably result in a parsing error, or a bogus
+ * URI object.
+ *
+ * Note that non-hierarchical URIs *MUST* have a scheme, otherwise
+ * they will be mistaken for relative URI's.
+ *
+ * If you are not sure what is being passed to you (like manually
+ * entered text from UI), you can construct a blank URI object and
+ * call unknownToURI() passing in the unknown string.
+ *
+ * @return true if successful, false if there was some kind of
+ * parsing error
+ */
+ protected function parseURI(uri:String) : Boolean
+ {
+ var baseURI:String = uri;
+ var index:int, index2:int;
+
+ // Make sure this object is clean before we start. If it was used
+ // before and we are now parsing a new URI, we don't want any stale
+ // info lying around.
+ initialize();
+
+ // Remove any fragments (anchors) from the URI
+ index = baseURI.indexOf("#");
+ if (index != -1)
+ {
+ // Store the fragment piece if any
+ if (baseURI.length > (index + 1)) // +1 is to skip the '#'
+ _fragment = baseURI.substr(index + 1, baseURI.length - (index + 1));
+
+ // Trim off the fragment
+ baseURI = baseURI.substr(0, index);
+ }
+
+ // We need to strip off any CGI parameters (eg '?param=bob')
+ index = baseURI.indexOf("?");
+ if (index != -1)
+ {
+ if (baseURI.length > (index + 1))
+ _query = baseURI.substr(index + 1, baseURI.length - (index + 1)); // +1 is to skip the '?'
+
+ // Trim off the query
+ baseURI = baseURI.substr(0, index);
+ }
+
+ // Now try to find the scheme part
+ index = baseURI.search(':');
+ index2 = baseURI.search('/');
+
+ var containsColon:Boolean = (index != -1);
+ var containsSlash:Boolean = (index2 != -1);
+
+ // This value is indeterminate if "containsColon" is false.
+ // (if there is no colon, does the slash come before or
+ // after said non-existing colon?)
+ var colonBeforeSlash:Boolean = (!containsSlash || index < index2);
+
+ // If it has a colon and it's before the first slash, we will treat
+ // it as a scheme. If a slash is before a colon, there must be a
+ // stray colon in a path or something. In which case, the colon is
+ // not the separator for the scheme. Technically, we could consider
+ // this an error, but since this is not an ambiguous state (we know
+ // 100% that this has no scheme), we will keep going.
+ if (containsColon && colonBeforeSlash)
+ {
+ // We found a scheme
+ _scheme = baseURI.substr(0, index);
+
+ // Normalize the scheme
+ _scheme = _scheme.toLowerCase();
+
+ baseURI = baseURI.substr(index + 1);
+
+ if (baseURI.substr(0, 2) == "//")
+ {
+ // This is a hierarchical URI
+ _nonHierarchical = "";
+
+ // Trim off the "//"
+ baseURI = baseURI.substr(2, baseURI.length - 2);
+ }
+ else
+ {
+ // This is a non-hierarchical URI like "mailto:bob@mail.com"
+ _nonHierarchical = baseURI;
+
+ if ((_valid = validateURI()) == false)
+ initialize(); // Bad URI. Clear it.
+
+ // No more parsing to do for this case
+ return isValid();
+ }
+ }
+ else
+ {
+ // No scheme. We will consider this a relative URI
+ _scheme = "";
+ _relative = true;
+ _nonHierarchical = "";
+ }
+
+ // Ok, what we have left is everything after the <scheme>://
+
+ // Now that we have stripped off any query and fragment parts, we
+ // need to split the authority from the path
+
+ if (isRelative())
+ {
+ // Don't bother looking for the authority. It's a relative URI
+ _authority = "";
+ _port = "";
+ _path = baseURI;
+ }
+ else
+ {
+ // Check for malformed UNC style file://///server/type/path/
+ // By the time we get here, we have already trimmed the "file://"
+ // so baseURI will be ///server/type/path. If baseURI only
+ // has one slash, we leave it alone because that is valid (that
+ // is the case of "file:///path/to/file.txt" where there is no
+ // server - implicit "localhost").
+ if (baseURI.substr(0, 2) == "//")
+ {
+ // Trim all leading slashes
+ while(baseURI.charAt(0) == "/")
+ baseURI = baseURI.substr(1, baseURI.length - 1);
+ }
+
+ index = baseURI.search('/');
+ if (index == -1)
+ {
+ // No path. We must have passed something like "http://something.com"
+ _authority = baseURI;
+ _path = "";
+ }
+ else
+ {
+ _authority = baseURI.substr(0, index);
+ _path = baseURI.substr(index, baseURI.length - index);
+ }
+
+ // Check to see if the URI has any username or password information.
+ // For example: ftp://username:password@server.com
+ index = _authority.search('@');
+ if (index != -1)
+ {
+ // We have a username and possibly a password
+ _username = _authority.substr(0, index);
+
+ // Remove the username/password from the authority
+ _authority = _authority.substr(index + 1); // Skip the '@'
+
+ // Now check to see if the username also has a password
+ index = _username.search(':');
+ if (index != -1)
+ {
+ _password = _username.substring(index + 1, _username.length);
+ _username = _username.substr(0, index);
+ }
+ else
+ _password = "";
+ }
+ else
+ {
+ _username = "";
+ _password = "";
+ }
+
+ // Lastly, check to see if the authorty has a port number.
+ // This is parsed after the username/password to avoid conflicting
+ // with the ':' in the 'username:password' if one exists.
+ index = _authority.search(':');
+ if (index != -1)
+ {
+ _port = _authority.substring(index + 1, _authority.length); // skip the ':'
+ _authority = _authority.substr(0, index);
+ }
+ else
+ {
+ _port = "";
+ }
+
+ // Lastly, normalize the authority. Domain names
+ // are case insensitive.
+ _authority = _authority.toLowerCase();
+ }
+
+ if ((_valid = validateURI()) == false)
+ initialize(); // Bad URI. Clear it
+
+ return isValid();
+ }
+
+
+ /********************************************************************
+ * Copy function.
+ */
+ public function copyURI(uri:URI) : void
+ {
+ this._scheme = uri._scheme;
+ this._authority = uri._authority;
+ this._username = uri._username;
+ this._password = uri._password;
+ this._port = uri._port;
+ this._path = uri._path;
+ this._query = uri._query;
+ this._fragment = uri._fragment;
+ this._nonHierarchical = uri._nonHierarchical;
+
+ this._valid = uri._valid;
+ this._relative = uri._relative;
+ }
+
+
+ /**
+ * @private
+ * Checks if the given string only contains a-z or A-Z.
+ */
+ protected function verifyAlpha(str:String) : Boolean
+ {
+ var pattern:RegExp = /[^a-z]/;
+ var index:int;
+
+ str = str.toLowerCase();
+ index = str.search(pattern);
+
+ if (index == -1)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Is this a valid URI?
+ *
+ * @return true if this object represents a valid URI, false
+ * otherwise.
+ */
+ public function isValid() : Boolean
+ {
+ return this._valid;
+ }
+
+
+ /**
+ * Is this URI an absolute URI? An absolute URI is a complete, fully
+ * qualified reference to a resource. e.g. http://site.com/index.htm
+ * Non-hierarchical URI's are always absolute.
+ */
+ public function isAbsolute() : Boolean
+ {
+ return !this._relative;
+ }
+
+
+ /**
+ * Is this URI a relative URI? Relative URI's do not have a scheme
+ * and only contain a relative path with optional anchor and query
+ * parts. e.g. "../reports/index.htm". Non-hierarchical URI's
+ * will never be relative.
+ */
+ public function isRelative() : Boolean
+ {
+ return this._relative;
+ }
+
+
+ /**
+ * Does this URI point to a resource that is a directory/folder?
+ * The URI specification dictates that any path that ends in a slash
+ * is a directory. This is needed to be able to perform correct path
+ * logic when combining relative URI's with absolute URI's to
+ * obtain the correct absolute URI to a resource.
+ *
+ * @see URI.chdir
+ *
+ * @return true if this URI represents a directory resource, false
+ * if this URI represents a file resource.
+ */
+ public function isDirectory() : Boolean
+ {
+ if (_path.length == 0)
+ return false;
+
+ return (_path.charAt(path.length - 1) == '/');
+ }
+
+
+ /**
+ * Is this URI a hierarchical URI? URI's can be
+ */
+ public function isHierarchical() : Boolean
+ {
+ return hierState;
+ }
+
+
+ /**
+ * The scheme of the URI.
+ */
+ public function get scheme() : String
+ {
+ return URI.unescapeChars(_scheme);
+ }
+ public function set scheme(schemeStr:String) : void
+ {
+ // Normalize the scheme
+ var normalized:String = schemeStr.toLowerCase();
+ _scheme = URI.fastEscapeChars(normalized, URI.URIschemeExcludedBitmap);
+ }
+
+
+ /**
+ * The authority (host) of the URI. Only valid for
+ * hierarchical URI's. If the URI is relative, this will
+ * be an empty string. When setting this value, the string
+ * given is assumed to be unescaped. When retrieving this
+ * value, the resulting string is unescaped.
+ */
+ public function get authority() : String
+ {
+ return URI.unescapeChars(_authority);
+ }
+ public function set authority(authorityStr:String) : void
+ {
+ // Normalize the authority
+ authorityStr = authorityStr.toLowerCase();
+
+ _authority = URI.fastEscapeChars(authorityStr,
+ URI.URIauthorityExcludedBitmap);
+
+ // Only hierarchical URI's can have an authority, make
+ // sure this URI is of the proper format.
+ this.hierState = true;
+ }
+
+
+ /**
+ * The username of the URI. Only valid for hierarchical
+ * URI's. If the URI is relative, this will be an empty
+ * string.
+ *
+ * <p>The URI specification allows for authentication
+ * credentials to be embedded in the URI as such:</p>
+ *
+ * <p>http://user:passwd@host/path/to/file.htm</p>
+ *
+ * <p>When setting this value, the string
+ * given is assumed to be unescaped. When retrieving this
+ * value, the resulting string is unescaped.</p>
+ */
+ public function get username() : String
+ {
+ return URI.unescapeChars(_username);
+ }
+ public function set username(usernameStr:String) : void
+ {
+ _username = URI.fastEscapeChars(usernameStr, URI.URIuserpassExcludedBitmap);
+
+ // Only hierarchical URI's can have a username.
+ this.hierState = true;
+ }
+
+
+ /**
+ * The password of the URI. Similar to username.
+ * @see URI.username
+ */
+ public function get password() : String
+ {
+ return URI.unescapeChars(_password);
+ }
+ public function set password(passwordStr:String) : void
+ {
+ _password = URI.fastEscapeChars(passwordStr,
+ URI.URIuserpassExcludedBitmap);
+
+ // Only hierarchical URI's can have a password.
+ this.hierState = true;
+ }
+
+
+ /**
+ * The host port number. Only valid for hierarchical URI's. If
+ * the URI is relative, this will be an empty string. URI's can
+ * contain the port number of the remote host:
+ *
+ * <p>http://site.com:8080/index.htm</p>
+ */
+ public function get port() : String
+ {
+ return URI.unescapeChars(_port);
+ }
+ public function set port(portStr:String) : void
+ {
+ _port = URI.escapeChars(portStr);
+
+ // Only hierarchical URI's can have a port.
+ this.hierState = true;
+ }
+
+
+ /**
+ * The path portion of the URI. Only valid for hierarchical
+ * URI's. When setting this value, the string
+ * given is assumed to be unescaped. When retrieving this
+ * value, the resulting string is unescaped.
+ *
+ * <p>The path portion can be in one of two formats. 1) an absolute
+ * path, or 2) a relative path. An absolute path starts with a
+ * slash ('/'), a relative path does not.</p>
+ *
+ * <p>An absolute path may look like:</p>
+ * <listing>/full/path/to/my/file.htm</listing>
+ *
+ * <p>A relative path may look like:</p>
+ * <listing>
+ * path/to/my/file.htm
+ * ../images/logo.gif
+ * ../../reports/index.htm
+ * </listing>
+ *
+ * <p>Paths can be absolute or relative. Note that this not the same as
+ * an absolute or relative URI. An absolute URI can only have absolute
+ * paths. For example:</p>
+ *
+ * <listing>http:/site.com/path/to/file.htm</listing>
+ *
+ * <p>This absolute URI has an absolute path of "/path/to/file.htm".</p>
+ *
+ * <p>Relative URI's can have either absolute paths or relative paths.
+ * All of the following relative URI's are valid:</p>
+ *
+ * <listing>
+ * /absolute/path/to/file.htm
+ * path/to/file.htm
+ * ../path/to/file.htm
+ * </listing>
+ */
+ public function get path() : String
+ {
+ return URI.unescapeChars(_path);
+ }
+ public function set path(pathStr:String) : void
+ {
+ this._path = URI.fastEscapeChars(pathStr, URI.URIpathExcludedBitmap);
+
+ if (this._scheme == UNKNOWN_SCHEME)
+ {
+ // We set the path. This is a valid URI now.
+ this._scheme = "";
+ }
+
+ // Only hierarchical URI's can have a path.
+ hierState = true;
+ }
+
+
+ /**
+ * The query (CGI) portion of the URI. This part is valid for
+ * both hierarchical and non-hierarchical URI's.
+ *
+ * <p>This accessor should only be used if a custom query syntax
+ * is used. This URI class supports the common "param=value"
+ * style query syntax via the get/setQueryValue() and
+ * get/setQueryByMap() functions. Those functions should be used
+ * instead if the common syntax is being used.
+ *
+ * <p>The URI RFC does not specify any particular
+ * syntax for the query part of a URI. It is intended to allow
+ * any format that can be agreed upon by the two communicating hosts.
+ * However, most systems have standardized on the typical CGI
+ * format:</p>
+ *
+ * <listing>http://site.com/script.php?param1=value1¶m2=value2</listing>
+ *
+ * <p>This class has specific support for this query syntax</p>
+ *
+ * <p>This common query format is an array of name/value
+ * pairs with its own syntax that is different from the overall URI
+ * syntax. The query has its own escaping logic. For a query part
+ * to be properly escaped and unescaped, it must be split into its
+ * component parts. This accessor escapes/unescapes the entire query
+ * part without regard for it's component parts. This has the
+ * possibliity of leaving the query string in an ambiguious state in
+ * regards to its syntax. If the contents of the query part are
+ * important, it is recommended that get/setQueryValue() or
+ * get/setQueryByMap() are used instead.</p>
+ *
+ * If a different query syntax is being used, a subclass of URI
+ * can be created to handle that specific syntax.
+ *
+ * @see URI.getQueryValue, URI.getQueryByMap
+ */
+ public function get query() : String
+ {
+ return URI.unescapeChars(_query);
+ }
+ public function set query(queryStr:String) : void
+ {
+ _query = URI.fastEscapeChars(queryStr, URI.URIqueryExcludedBitmap);
+
+ // both hierarchical and non-hierarchical URI's can
+ // have a query. Do not set the hierState.
+ }
+
+ /**
+ * Accessor to the raw query data. If you are using a custom query
+ * syntax, this accessor can be used to get and set the query part
+ * directly with no escaping/unescaping. This should ONLY be used
+ * if your application logic is handling custom query logic and
+ * handling the proper escaping of the query part.
+ */
+ public function get queryRaw() : String
+ {
+ return _query;
+ }
+ public function set queryRaw(queryStr:String) : void
+ {
+ _query = queryStr;
+ }
+
+
+ /**
+ * The fragment (anchor) portion of the URI. This is valid for
+ * both hierarchical and non-hierarchical URI's.
+ */
+ public function get fragment() : String
+ {
+ return URI.unescapeChars(_fragment);
+ }
+ public function set fragment(fragmentStr:String) : void
+ {
+ _fragment = URI.fastEscapeChars(fragmentStr, URIfragmentExcludedBitmap);
+
+ // both hierarchical and non-hierarchical URI's can
+ // have a fragment. Do not set the hierState.
+ }
+
+
+ /**
+ * The non-hierarchical part of the URI. For example, if
+ * this URI object represents "mailto:somebody@company.com",
+ * this will contain "somebody@company.com". This is valid only
+ * for non-hierarchical URI's.
+ */
+ public function get nonHierarchical() : String
+ {
+ return URI.unescapeChars(_nonHierarchical);
+ }
+ public function set nonHierarchical(nonHier:String) : void
+ {
+ _nonHierarchical = URI.fastEscapeChars(nonHier, URInonHierexcludedBitmap);
+
+ // This is a non-hierarchical URI.
+ this.hierState = false;
+ }
+
+
+ /**
+ * Quick shorthand accessor to set the parts of this URI.
+ * The given parts are assumed to be in unescaped form. If
+ * the URI is non-hierarchical (e.g. mailto:) you will need
+ * to call SetScheme() and SetNonHierarchical().
+ */
+ public function setParts(schemeStr:String, authorityStr:String,
+ portStr:String, pathStr:String, queryStr:String,
+ fragmentStr:String) : void
+ {
+ this.scheme = schemeStr;
+ this.authority = authorityStr;
+ this.port = portStr;
+ this.path = pathStr;
+ this.query = queryStr;
+ this.fragment = fragmentStr;
+
+ hierState = true;
+ }
+
+
+ /**
+ * URI escapes the given character string. This is similar in function
+ * to the global encodeURIComponent() function in ActionScript, but is
+ * slightly different in regards to which characters get escaped. This
+ * escapes the characters specified in the URIbaselineExluded set (see class
+ * static members). This is needed for this class to work properly.
+ *
+ * <p>If a different set of characters need to be used for the escaping,
+ * you may use fastEscapeChars() and specify a custom URIEncodingBitmap
+ * that contains the characters your application needs escaped.</p>
+ *
+ * <p>Never pass a full URI to this function. A URI can only be properly
+ * escaped/unescaped when split into its component parts (see RFC 3986
+ * section 2.4). This is due to the fact that the URI component separators
+ * could be characters that would normally need to be escaped.</p>
+ *
+ * @param unescaped character string to be escaped.
+ *
+ * @return escaped character string
+ *
+ * @see encodeURIComponent
+ * @see fastEscapeChars
+ */
+ static public function escapeChars(unescaped:String) : String
+ {
+ // This uses the excluded set by default.
+ return fastEscapeChars(unescaped, URI.URIbaselineExcludedBitmap);
+ }
+
+
+ /**
+ * Unescape any URI escaped characters in the given character
+ * string.
+ *
+ * <p>Never pass a full URI to this function. A URI can only be properly
+ * escaped/unescaped when split into its component parts (see RFC 3986
+ * section 2.4). This is due to the fact that the URI component separators
+ * could be characters that would normally need to be escaped.</p>
+ *
+ * @param escaped the escaped string to be unescaped.
+ *
+ * @return unescaped string.
+ */
+ static public function unescapeChars(escaped:String /*, onlyHighASCII:Boolean = false*/) : String
+ {
+ // We can just use the default AS function. It seems to
+ // decode everything correctly
+ var unescaped:String;
+ unescaped = decodeURIComponent(escaped);
+ return unescaped;
+ }
+
+ /**
+ * Performance focused function that escapes the given character
+ * string using the given URIEncodingBitmap as the rule for what
+ * characters need to be escaped. This function is used by this
+ * class and can be used externally to this class to perform
+ * escaping on custom character sets.
+ *
+ * <p>Never pass a full URI to this function. A URI can only be properly
+ * escaped/unescaped when split into its component parts (see RFC 3986
+ * section 2.4). This is due to the fact that the URI component separators
+ * could be characters that would normally need to be escaped.</p>
+ *
+ * @param unescaped the unescaped string to be escaped
+ * @param bitmap the set of characters that need to be escaped
+ *
+ * @return the escaped string.
+ */
+ static public function fastEscapeChars(unescaped:String, bitmap:URIEncodingBitmap) : String
+ {
+ var escaped:String = "";
+ var c:String;
+ var x:int, i:int;
+
+ for (i = 0; i < unescaped.length; i++)
+ {
+ c = unescaped.charAt(i);
+
+ x = bitmap.ShouldEscape(c);
+ if (x)
+ {
+ c = x.toString(16);
+ if (c.length == 1)
+ c = "0" + c;
+
+ c = "%" + c;
+ c = c.toUpperCase();
+ }
+
+ escaped += c;
+ }
+
+ return escaped;
+ }
+
+
+ /**
+ * Is this URI of a particular scheme type? For example,
+ * passing "http" to a URI object that represents the URI
+ * "http://site.com/" would return true.
+ *
+ * @param scheme scheme to check for
+ *
+ * @return true if this URI object is of the given type, false
+ * otherwise.
+ */
+ public function isOfType(scheme:String) : Boolean
+ {
+ // Schemes are never case sensitive. Ignore case.
+ scheme = scheme.toLowerCase();
+ return (this._scheme == scheme);
+ }
+
+
+ /**
+ * Get the value for the specified named in the query part. This
+ * assumes the query part of the URI is in the common
+ * "name1=value1&name2=value2" syntax. Do not call this function
+ * if you are using a custom query syntax.
+ *
+ * @param name name of the query value to get.
+ *
+ * @return the value of the query name, empty string if the
+ * query name does not exist.
+ */
+ public function getQueryValue(name:String) : String
+ {
+ var map:Object;
+ var item:String;
+ var value:String;
+
+ map = getQueryByMap();
+
+ for (item in map)
+ {
+ if (item == name)
+ {
+ value = map[item];
+ return value;
+ }
+ }
+
+ // Didn't find the specified key
+ return new String("");
+ }
+
+
+ /**
+ * Set the given value on the given query name. If the given name
+ * does not exist, it will automatically add this name/value pair
+ * to the query. If null is passed as the value, it will remove
+ * the given item from the query.
+ *
+ * <p>This automatically escapes any characters that may conflict with
+ * the query syntax so that they are "safe" within the query. The
+ * strings passed are assumed to be literal unescaped name and value.</p>
+ *
+ * @param name name of the query value to set
+ * @param value value of the query item to set. If null, this will
+ * force the removal of this item from the query.
+ */
+ public function setQueryValue(name:String, value:String) : void
+ {
+ var map:Object;
+
+ map = getQueryByMap();
+
+ // If the key doesn't exist yet, this will create a new pair in
+ // the map. If it does exist, this will overwrite the previous
+ // value, which is what we want.
+ map[name] = value;
+
+ setQueryByMap(map);
+ }
+
+
+ /**
+ * Get the query of the URI in an Object class that allows for easy
+ * access to the query data via Object accessors. For example:
+ *
+ * <listing>
+ * var query:Object = uri.getQueryByMap();
+ * var value:String = query["param"]; // get a value
+ * query["param2"] = "foo"; // set a new value
+ * </listing>
+ *
+ * @return Object that contains the name/value pairs of the query.
+ *
+ * @see #setQueryByMap
+ * @see #getQueryValue
+ * @see #setQueryValue
+ */
+ public function getQueryByMap() : Object
+ {
+ var queryStr:String;
+ var pair:String;
+ var pairs:Array;
+ var item:Array;
+ var name:String, value:String;
+ var index:int;
+ var map:Object = new Object();
+
+
+ // We need the raw query string, no unescaping.
+ queryStr = this._query;
+
+ pairs = queryStr.split('&');
+ for each (pair in pairs)
+ {
+ if (pair.length == 0)
+ continue;
+
+ item = pair.split('=');
+
+ if (item.length > 0)
+ name = item[0];
+ else
+ continue; // empty array
+
+ if (item.length > 1)
+ value = item[1];
+ else
+ value = "";
+
+ name = queryPartUnescape(name);
+ value = queryPartUnescape(value);
+
+ map[name] = value;
+ }
+
+ return map;
+ }
+
+
+ /**
+ * Set the query part of this URI using the given object as the
+ * content source. Any member of the object that has a value of
+ * null will not be in the resulting query.
+ *
+ * @param map object that contains the name/value pairs as
+ * members of that object.
+ *
+ * @see #getQueryByMap
+ * @see #getQueryValue
+ * @see #setQueryValue
+ */
+ public function setQueryByMap(map:Object) : void
+ {
+ var item:String;
+ var name:String, value:String;
+ var queryStr:String = "";
+ var tmpPair:String;
+ var foo:String;
+
+ for (item in map)
+ {
+ name = item;
+ value = map[item];
+
+ if (value == null)
+ value = "";
+
+ // Need to escape the name/value pair so that they
+ // don't conflict with the query syntax (specifically
+ // '=', '&', and <whitespace>).
+ name = queryPartEscape(name);
+ value = queryPartEscape(value);
+
+ tmpPair = name;
+
+ if (value.length > 0)
+ {
+ tmpPair += "=";
+ tmpPair += value;
+ }
+
+ if (queryStr.length != 0)
+ queryStr += '&'; // Add the separator
+
+ queryStr += tmpPair;
+ }
+
+ // We don't want to escape. We already escaped the
+ // individual name/value pairs. If we escaped the
+ // query string again by assigning it to "query",
+ // we would have double escaping.
+ _query = queryStr;
+ }
+
+
+ /**
+ * Similar to Escape(), except this also escapes characters that
+ * would conflict with the name/value pair query syntax. This is
+ * intended to be called on each individual "name" and "value"
+ * in the query making sure that nothing in the name or value
+ * strings contain characters that would conflict with the query
+ * syntax (e.g. '=' and '&').
+ *
+ * @param unescaped unescaped string that is to be escaped.
+ *
+ * @return escaped string.
+ *
+ * @see #queryUnescape
+ */
+ static public function queryPartEscape(unescaped:String) : String
+ {
+ var escaped:String = unescaped;
+ escaped = URI.fastEscapeChars(unescaped, URI.URIqueryPartExcludedBitmap);
+ return escaped;
+ }
+
+
+ /**
+ * Unescape the individual name/value string pairs.
+ *
+ * @param escaped escaped string to be unescaped
+ *
+ * @return unescaped string
+ *
+ * @see #queryEscape
+ */
+ static public function queryPartUnescape(escaped:String) : String
+ {
+ var unescaped:String = escaped;
+ unescaped = unescapeChars(unescaped);
+ return unescaped;
+ }
+
+ /**
+ * Output this URI as a string. The resulting string is properly
+ * escaped and well formed for machine processing.
+ */
+ public function toString() : String
+ {
+ if (this == null)
+ return "";
+ else
+ return toStringInternal(false);
+ }
+
+ /**
+ * Output the URI as a string that is easily readable by a human.
+ * This outputs the URI with all escape sequences unescaped to
+ * their character representation. This makes the URI easier for
+ * a human to read, but the URI could be completely invalid
+ * because some unescaped characters may now cause ambiguous parsing.
+ * This function should only be used if you want to display a URI to
+ * a user. This function should never be used outside that specific
+ * case.
+ *
+ * @return the URI in string format with all escape sequences
+ * unescaped.
+ *
+ * @see #toString
+ */
+ public function toDisplayString() : String
+ {
+ return toStringInternal(true);
+ }
+
+
+ /**
+ * @private
+ *
+ * The guts of toString()
+ */
+ protected function toStringInternal(forDisplay:Boolean) : String
+ {
+ var uri:String = "";
+ var part:String = "";
+
+ if (isHierarchical() == false)
+ {
+ // non-hierarchical URI
+
+ uri += (forDisplay ? this.scheme : _scheme);
+ uri += ":";
+ uri += (forDisplay ? this.nonHierarchical : _nonHierarchical);
+ }
+ else
+ {
+ // Hierarchical URI
+
+ if (isRelative() == false)
+ {
+ // If it is not a relative URI, then we want the scheme and
+ // authority parts in the string. If it is relative, we
+ // do NOT want this stuff.
+
+ if (_scheme.length != 0)
+ {
+ part = (forDisplay ? this.scheme : _scheme);
+ uri += part + ":";
+ }
+
+ if (_authority.length != 0 || isOfType("file"))
+ {
+ uri += "//";
+
+ // Add on any username/password associated with this
+ // authority
+ if (_username.length != 0)
+ {
+ part = (forDisplay ? this.username : _username);
+ uri += part;
+
+ if (_password.length != 0)
+ {
+ part = (forDisplay ? this.password : _password);
+ uri += ":" + part;
+ }
+
+ uri += "@";
+ }
+
+ // add the authority
+ part = (forDisplay ? this.authority : _authority);
+ uri += part;
+
+ // Tack on the port number, if any
+ if (port.length != 0)
+ uri += ":" + port;
+ }
+ }
+
+ // Tack on the path
+ part = (forDisplay ? this.path : _path);
+ uri += part;
+
+ } // end hierarchical part
+
+ // Both non-hier and hierarchical have query and fragment parts
+
+ // Add on the query and fragment parts
+ if (_query.length != 0)
+ {
+ part = (forDisplay ? this.query : _query);
+ uri += "?" + part;
+ }
+
+ if (fragment.length != 0)
+ {
+ part = (forDisplay ? this.fragment : _fragment);
+ uri += "#" + part;
+ }
+
+ return uri;
+ }
+
+ /**
+ * Forcefully ensure that this URI is properly escaped.
+ *
+ * <p>Sometimes URI's are constructed by hand using strings outside
+ * this class. In those cases, it is unlikely the URI has been
+ * properly escaped. This function forcefully escapes this URI
+ * by unescaping each part and then re-escaping it. If the URI
+ * did not have any escaping, the first unescape will do nothing
+ * and then the re-escape will properly escape everything. If
+ * the URI was already escaped, the unescape and re-escape will
+ * essentally be a no-op. This provides a safe way to make sure
+ * a URI is in the proper escaped form.</p>
+ */
+ public function forceEscape() : void
+ {
+ // The accessors for each of the members will unescape
+ // and then re-escape as we get and assign them.
+
+ // Handle the parts that are common for both hierarchical
+ // and non-hierarchical URI's
+ this.scheme = this.scheme;
+ this.setQueryByMap(this.getQueryByMap());
+ this.fragment = this.fragment;
+
+ if (isHierarchical())
+ {
+ this.authority = this.authority;
+ this.path = this.path;
+ this.port = this.port;
+ this.username = this.username;
+ this.password = this.password;
+ }
+ else
+ {
+ this.nonHierarchical = this.nonHierarchical;
+ }
+ }
+
+
+ /**
+ * Does this URI point to a resource of the given file type?
+ * Given a file extension (or just a file name, this will strip the
+ * extension), check to see if this URI points to a file of that
+ * type.
+ *
+ * @param extension string that contains a file extension with or
+ * without a dot ("html" and ".html" are both valid), or a file
+ * name with an extension (e.g. "index.html").
+ *
+ * @return true if this URI points to a resource with the same file
+ * file extension as the extension provided, false otherwise.
+ */
+ public function isOfFileType(extension:String) : Boolean
+ {
+ var thisExtension:String;
+ var index:int;
+
+ index = extension.lastIndexOf(".");
+ if (index != -1)
+ {
+ // Strip the extension
+ extension = extension.substr(index + 1);
+ }
+ else
+ {
+ // The caller passed something without a dot in it. We
+ // will assume that it is just a plain extension (e.g. "html").
+ // What they passed is exactly what we want
+ }
+
+ thisExtension = getExtension(true);
+
+ if (thisExtension == "")
+ return false;
+
+ // Compare the extensions ignoring case
+ if (compareStr(thisExtension, extension, false) == 0)
+ return true;
+ else
+ return false;
+ }
+
+
+ /**
+ * Get the ".xyz" file extension from the filename in the URI.
+ * For example, if we have the following URI:
+ *
+ * <listing>http://something.com/path/to/my/page.html?form=yes&name=bob#anchor</listing>
+ *
+ * <p>This will return ".html".</p>
+ *
+ * @param minusDot If true, this will strip the dot from the extension.
+ * If true, the above example would have returned "html".
+ *
+ * @return the file extension
+ */
+ public function getExtension(minusDot:Boolean = false) : String
+ {
+ var filename:String = getFilename();
+ var extension:String;
+ var index:int;
+
+ if (filename == "")
+ return String("");
+
+ index = filename.lastIndexOf(".");
+
+ // If it doesn't have an extension, or if it is a "hidden" file,
+ // it doesn't have an extension. Hidden files on unix start with
+ // a dot (e.g. ".login").
+ if (index == -1 || index == 0)
+ return String("");
+
+ extension = filename.substr(index);
+
+ // If the caller does not want the dot, remove it.
+ if (minusDot && extension.charAt(0) == ".")
+ extension = extension.substr(1);
+
+ return extension;
+ }
+
+ /**
+ * Quick function to retrieve the file name off the end of a URI.
+ *
+ * <p>For example, if the URI is:</p>
+ * <listing>http://something.com/some/path/to/my/file.html</listing>
+ * <p>this function will return "file.html".</p>
+ *
+ * @param minusExtension true if the file extension should be stripped
+ *
+ * @return the file name. If this URI is a directory, the return
+ * value will be empty string.
+ */
+ public function getFilename(minusExtension:Boolean = false) : String
+ {
+ if (isDirectory())
+ return String("");
+
+ var pathStr:String = this.path;
+ var filename:String;
+ var index:int;
+
+ // Find the last path separator.
+ index = pathStr.lastIndexOf("/");
+
+ if (index != -1)
+ filename = pathStr.substr(index + 1);
+ else
+ filename = pathStr;
+
+ if (minusExtension)
+ {
+ // The caller has requested that the extension be removed
+ index = filename.lastIndexOf(".");
+
+ if (index != -1)
+ filename = filename.substr(0, index);
+ }
+
+ return filename;
+ }
+
+
+ /**
+ * @private
+ * Helper function to compare strings.
+ *
+ * @return true if the two strings are identical, false otherwise.
+ */
+ static protected function compareStr(str1:String, str2:String,
+ sensitive:Boolean = true) : Boolean
+ {
+ if (sensitive == false)
+ {
+ str1 = str1.toLowerCase();
+ str2 = str2.toLowerCase();
+ }
+
+ return (str1 == str2)
+ }
+
+ /**
+ * Based on the type of this URI (http, ftp, etc.) get
+ * the default port used for that protocol. This is
+ * just intended to be a helper function for the most
+ * common cases.
+ */
+ public function getDefaultPort() : String
+ {
+ if (_scheme == "http")
+ return String("80");
+ else if (_scheme == "ftp")
+ return String("21");
+ else if (_scheme == "file")
+ return String("");
+ else if (_scheme == "sftp")
+ return String("22"); // ssh standard port
+ else
+ {
+ // Don't know the port for this URI type
+ return String("");
+ }
+ }
+
+ /**
+ * @private
+ *
+ * This resolves the given URI if the application has a
+ * resolver interface defined. This function does not
+ * modify the passed in URI and returns a new URI.
+ */
+ static protected function resolve(uri:URI) : URI
+ {
+ var copy:URI = new URI();
+ copy.copyURI(uri);
+
+ if (_resolver != null)
+ {
+ // A resolver class has been registered. Call it.
+ return _resolver.resolve(copy);
+ }
+ else
+ {
+ // No resolver. Nothing to do, but we don't
+ // want to reuse the one passed in.
+ return copy;
+ }
+ }
+
+ /**
+ * Accessor to set and get the resolver object used by all URI
+ * objects to dynamically resolve URI's before comparison.
+ */
+ static public function set resolver(resolver:IURIResolver) : void
+ {
+ _resolver = resolver;
+ }
+ static public function get resolver() : IURIResolver
+ {
+ return _resolver;
+ }
+
+ /**
+ * Given another URI, return this URI object's relation to the one given.
+ * URI's can have 1 of 4 possible relationships. They can be unrelated,
+ * equal, parent, or a child of the given URI.
+ *
+ * @param uri URI to compare this URI object to.
+ * @param caseSensitive true if the URI comparison should be done
+ * taking case into account, false if the comparison should be
+ * performed case insensitive.
+ *
+ * @return URI.NOT_RELATED, URI.CHILD, URI.PARENT, or URI.EQUAL
+ */
+ public function getRelation(uri:URI, caseSensitive:Boolean = true) : int
+ {
+ // Give the app a chance to resolve these URI's before we compare them.
+ var thisURI:URI = URI.resolve(this);
+ var thatURI:URI = URI.resolve(uri);
+
+ if (thisURI.isRelative() || thatURI.isRelative())
+ {
+ // You cannot compare relative URI's due to their lack of context.
+ // You could have two relative URI's that look like:
+ // ../../images/
+ // ../../images/marketing/logo.gif
+ // These may appear related, but you have no overall context
+ // from which to make the comparison. The first URI could be
+ // from one site and the other URI could be from another site.
+ return URI.NOT_RELATED;
+ }
+ else if (thisURI.isHierarchical() == false || thatURI.isHierarchical() == false)
+ {
+ // One or both of the URI's are non-hierarchical.
+ if (((thisURI.isHierarchical() == false) && (thatURI.isHierarchical() == true)) ||
+ ((thisURI.isHierarchical() == true) && (thatURI.isHierarchical() == false)))
+ {
+ // XOR. One is hierarchical and the other is
+ // non-hierarchical. They cannot be compared.
+ return URI.NOT_RELATED;
+ }
+ else
+ {
+ // They are both non-hierarchical
+ if (thisURI.scheme != thatURI.scheme)
+ return URI.NOT_RELATED;
+
+ if (thisURI.nonHierarchical != thatURI.nonHierarchical)
+ return URI.NOT_RELATED;
+
+ // The two non-hierarcical URI's are equal.
+ return URI.EQUAL;
+ }
+ }
+
+ // Ok, this URI and the one we are being compared to are both
+ // absolute hierarchical URI's.
+
+ if (thisURI.scheme != thatURI.scheme)
+ return URI.NOT_RELATED;
+
+ if (thisURI.authority != thatURI.authority)
+ return URI.NOT_RELATED;
+
+ var thisPort:String = thisURI.port;
+ var thatPort:String = thatURI.port;
+
+ // Different ports are considered completely different servers.
+ if (thisPort == "")
+ thisPort = thisURI.getDefaultPort();
+ if (thatPort == "")
+ thatPort = thatURI.getDefaultPort();
+
+ // Check to see if the port is the default port.
+ if (thisPort != thatPort)
+ return URI.NOT_RELATED;
+
+ if (compareStr(thisURI.path, thatURI.path, caseSensitive))
+ return URI.EQUAL;
+
+ // Special case check. If we are here, the scheme, authority,
+ // and port match, and it is not a relative path, but the
+ // paths did not match. There is a special case where we
+ // could have:
+ // http://something.com/
+ // http://something.com
+ // Technically, these are equal. So lets, check for this case.
+ var thisPath:String = thisURI.path;
+ var thatPath:String = thatURI.path;
+
+ if ( (thisPath == "/" || thatPath == "/") &&
+ (thisPath == "" || thatPath == "") )
+ {
+ // We hit the special case. These two are equal.
+ return URI.EQUAL;
+ }
+
+ // Ok, the paths do not match, but one path may be a parent/child
+ // of the other. For example, we may have:
+ // http://something.com/path/to/homepage/
+ // http://something.com/path/to/homepage/images/logo.gif
+ // In this case, the first is a parent of the second (or the second
+ // is a child of the first, depending on which you compare to the
+ // other). To make this comparison, we must split the path into
+ // its component parts (split the string on the '/' path delimiter).
+ // We then compare the
+ var thisParts:Array, thatParts:Array;
+ var thisPart:String, thatPart:String;
+ var i:int;
+
+ thisParts = thisPath.split("/");
+ thatParts = thatPath.split("/");
+
+ if (thisParts.length > thatParts.length)
+ {
+ thatPart = thatParts[thatParts.length - 1];
+ if (thatPart.length > 0)
+ {
+ // if the last part is not empty, the passed URI is
+ // not a directory. There is no way the passed URI
+ // can be a parent.
+ return URI.NOT_RELATED;
+ }
+ else
+ {
+ // Remove the empty trailing part
+ thatParts.pop();
+ }
+
+ // This may be a child of the one passed in
+ for (i = 0; i < thatParts.length; i++)
+ {
+ thisPart = thisParts[i];
+ thatPart = thatParts[i];
+
+ if (compareStr(thisPart, thatPart, caseSensitive) == false)
+ return URI.NOT_RELATED;
+ }
+
+ return URI.CHILD;
+ }
+ else if (thisParts.length < thatParts.length)
+ {
+ thisPart = thisParts[thisParts.length - 1];
+ if (thisPart.length > 0)
+ {
+ // if the last part is not empty, this URI is not a
+ // directory. There is no way this object can be
+ // a parent.
+ return URI.NOT_RELATED;
+ }
+ else
+ {
+ // Remove the empty trailing part
+ thisParts.pop();
+ }
+
+ // This may be the parent of the one passed in
+ for (i = 0; i < thisParts.length; i++)
+ {
+ thisPart = thisParts[i];
+ thatPart = thatParts[i];
+
+ if (compareStr(thisPart, thatPart, caseSensitive) == false)
+ return URI.NOT_RELATED;
+ }
+
+ return URI.PARENT;
+ }
+ else
+ {
+ // Both URI's have the same number of path components, but
+ // it failed the equivelence check above. This means that
+ // the two URI's are not related.
+ return URI.NOT_RELATED;
+ }
+
+ // If we got here, the scheme and authority are the same,
+ // but the paths pointed to two different locations that
+ // were in different parts of the file system tree
+ return URI.NOT_RELATED;
+ }
+
+ /**
+ * Given another URI, return the common parent between this one
+ * and the provided URI.
+ *
+ * @param uri the other URI from which to find a common parent
+ * @para caseSensitive true if this operation should be done
+ * with case sensitive comparisons.
+ *
+ * @return the parent URI if successful, null otherwise.
+ */
+ public function getCommonParent(uri:URI, caseSensitive:Boolean = true) : URI
+ {
+ var thisURI:URI = URI.resolve(this);
+ var thatURI:URI = URI.resolve(uri);
+
+ if(!thisURI.isAbsolute() || !thatURI.isAbsolute() ||
+ thisURI.isHierarchical() == false ||
+ thatURI.isHierarchical() == false)
+ {
+ // Both URI's must be absolute hierarchical for this to
+ // make sense.
+ return null;
+ }
+
+ var relation:int = thisURI.getRelation(thatURI);
+ if (relation == URI.NOT_RELATED)
+ {
+ // The given URI is not related to this one. No
+ // common parent.
+ return null;
+ }
+
+ thisURI.chdir(".");
+ thatURI.chdir(".");
+
+ var strBefore:String, strAfter:String;
+ do
+ {
+ relation = thisURI.getRelation(thatURI, caseSensitive);
+ if(relation == URI.EQUAL || relation == URI.PARENT)
+ break;
+
+ // If strBefore and strAfter end up being the same,
+ // we know we are at the root of the path because
+ // chdir("..") is doing nothing.
+ strBefore = thisURI.toString();
+ thisURI.chdir("..");
+ strAfter = thisURI.toString();
+ }
+ while(strBefore != strAfter);
+
+ return thisURI;
+ }
+
+
+ /**
+ * This function is used to move around in a URI in a way similar
+ * to the 'cd' or 'chdir' commands on Unix. These operations are
+ * completely string based, using the context of the URI to
+ * determine the position within the path. The heuristics used
+ * to determine the action are based off Appendix C in RFC 2396.
+ *
+ * <p>URI paths that end in '/' are considered paths that point to
+ * directories, while paths that do not end in '/' are files. For
+ * example, if you execute chdir("d") on the following URI's:<br/>
+ * 1. http://something.com/a/b/c/ (directory)<br/>
+ * 2. http://something.com/a/b/c (not directory)<br/>
+ * you will get:<br/>
+ * 1. http://something.com/a/b/c/d<br/>
+ * 2. http://something.com/a/b/d<br/></p>
+ *
+ * <p>See RFC 2396, Appendix C for more info.</p>
+ *
+ * @param reference the URI or path to "cd" to.
+ * @param escape true if the passed reference string should be URI
+ * escaped before using it.
+ *
+ * @return true if the chdir was successful, false otherwise.
+ */
+ public function chdir(reference:String, escape:Boolean = false) : Boolean
+ {
+ var uriReference:URI;
+ var ref:String = reference;
+
+ if (escape)
+ ref = URI.escapeChars(reference);
+
+ if (ref == "")
+ {
+ // NOOP
+ return true;
+ }
+ else if (ref.substr(0, 2) == "//")
+ {
+ // Special case. This is an absolute URI but without the scheme.
+ // Take the scheme from this URI and tack it on. This is
+ // intended to make working with chdir() a little more
+ // tolerant.
+ var final:String = this.scheme + ":" + ref;
+
+ return constructURI(final);
+ }
+ else if (ref.charAt(0) == "?")
+ {
+ // A relative URI that is just a query part is essentially
+ // a "./?query". We tack on the "./" here to make the rest
+ // of our logic work.
+ ref = "./" + ref;
+ }
+
+ // Parse the reference passed in as a URI. This way we
+ // get any query and fragments parsed out as well.
+ uriReference = new URI(ref);
+
+ if (uriReference.isAbsolute() ||
+ uriReference.isHierarchical() == false)
+ {
+ // If the URI given is a full URI, it replaces this one.
+ copyURI(uriReference);
+ return true;
+ }
+
+
+ var thisPath:String, thatPath:String;
+ var thisParts:Array, thatParts:Array;
+ var thisIsDir:Boolean = false, thatIsDir:Boolean = false;
+ var thisIsAbs:Boolean = false, thatIsAbs:Boolean = false;
+ var lastIsDotOperation:Boolean = false;
+ var curDir:String;
+ var i:int;
+
+ thisPath = this.path;
+ thatPath = uriReference.path;
+
+ if (thisPath.length > 0)
+ thisParts = thisPath.split("/");
+ else
+ thisParts = new Array();
+
+ if (thatPath.length > 0)
+ thatParts = thatPath.split("/");
+ else
+ thatParts = new Array();
+
+ if (thisParts.length > 0 && thisParts[0] == "")
+ {
+ thisIsAbs = true;
+ thisParts.shift(); // pop the first one off the array
+ }
+ if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "")
+ {
+ thisIsDir = true;
+ thisParts.pop(); // pop the last one off the array
+ }
+
+ if (thatParts.length > 0 && thatParts[0] == "")
+ {
+ thatIsAbs = true;
+ thatParts.shift(); // pop the first one off the array
+ }
+ if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "")
+ {
+ thatIsDir = true;
+ thatParts.pop(); // pop the last one off the array
+ }
+
+ if (thatIsAbs)
+ {
+ // The reference is an absolute path (starts with a slash).
+ // It replaces this path wholesale.
+ this.path = uriReference.path;
+
+ // And it inherits the query and fragment
+ this.queryRaw = uriReference.queryRaw;
+ this.fragment = uriReference.fragment;
+
+ return true;
+ }
+ else if (thatParts.length == 0 && uriReference.query == "")
+ {
+ // The reference must have only been a fragment. Fragments just
+ // get appended to whatever the current path is. We don't want
+ // to overwrite any query that may already exist, so this case
+ // only takes on the new fragment.
+ this.fragment = uriReference.fragment;
+ return true;
+ }
+ else if (thisIsDir == false && thisParts.length > 0)
+ {
+ // This path ends in a file. It goes away no matter what.
+ thisParts.pop();
+ }
+
+ // By default, this assumes the query and fragment of the reference
+ this.queryRaw = uriReference.queryRaw;
+ this.fragment = uriReference.fragment;
+
+ // Append the parts of the path from the passed in reference
+ // to this object's path.
+ thisParts = thisParts.concat(thatParts);
+
+ for(i = 0; i < thisParts.length; i++)
+ {
+ curDir = thisParts[i];
+ lastIsDotOperation = false;
+
+ if (curDir == ".")
+ {
+ thisParts.splice(i, 1);
+ i = i - 1; // account for removing this item
+ lastIsDotOperation = true;
+ }
+ else if (curDir == "..")
+ {
+ if (i >= 1)
+ {
+ if (thisParts[i - 1] == "..")
+ {
+ // If the previous is a "..", we must have skipped
+ // it due to this URI being relative. We can't
+ // collapse leading ".."s in a relative URI, so
+ // do nothing.
+ }
+ else
+ {
+ thisParts.splice(i - 1, 2);
+ i = i - 2; // move back to account for the 2 we removed
+ }
+ }
+ else
+ {
+ // This is the first thing in the path.
+
+ if (isRelative())
+ {
+ // We can't collapse leading ".."s in a relative
+ // path. Do noting.
+ }
+ else
+ {
+ // This is an abnormal case. We have dot-dotted up
+ // past the base of our "file system". This is a
+ // case where we had a /path/like/this.htm and were
+ // given a path to chdir to like this:
+ // ../../../../../../mydir
+ // Obviously, it has too many ".." and will take us
+ // up beyond the top of the URI. However, according
+ // RFC 2396 Appendix C.2, we should try to handle
+ // these abnormal cases appropriately. In this case,
+ // we will do what UNIX command lines do if you are
+ // at the root (/) of the filesystem and execute:
+ // # cd ../../../../../bin
+ // Which will put you in /bin. Essentially, the extra
+ // ".."'s will just get eaten.
+
+ thisParts.splice(i, 1);
+ i = i - 1; // account for the ".." we just removed
+ }
+ }
+
+ lastIsDotOperation = true;
+ }
+ }
+
+ var finalPath:String = "";
+
+ // If the last thing in the path was a "." or "..", then this thing is a
+ // directory. If the last thing isn't a dot-op, then we don't want to
+ // blow away any information about the directory (hence the "|=" binary
+ // assignment).
+ thatIsDir = thatIsDir || lastIsDotOperation;
+
+ // Reconstruct the path with the abs/dir info we have
+ finalPath = joinPath(thisParts, thisIsAbs, thatIsDir);
+
+ // Set the path (automatically escaping it)
+ this.path = finalPath;
+
+ return true;
+ }
+
+ /**
+ * @private
+ * Join an array of path parts back into a URI style path string.
+ * This is used by the various path logic functions to recombine
+ * a path. This is different than the standard Array.join()
+ * function because we need to take into account the starting and
+ * ending path delimiters if this is an absolute path or a
+ * directory.
+ *
+ * @param parts the Array that contains strings of each path part.
+ * @param isAbs true if the given path is absolute
+ * @param isDir true if the given path is a directory
+ *
+ * @return the combined path string.
+ */
+ protected function joinPath(parts:Array, isAbs:Boolean, isDir:Boolean) : String
+ {
+ var pathStr:String = "";
+ var i:int;
+
+ for (i = 0; i < parts.length; i++)
+ {
+ if (pathStr.length > 0)
+ pathStr += "/";
+
+ pathStr += parts[i];
+ }
+
+ // If this path is a directory, tack on the directory delimiter,
+ // but only if the path contains something. Adding this to an
+ // empty path would make it "/", which is an absolute path that
+ // starts at the root.
+ if (isDir && pathStr.length > 0)
+ pathStr += "/";
+
+ if (isAbs)
+ pathStr = "/" + pathStr;
+
+ return pathStr;
+ }
+
+ /**
+ * Given an absolute URI, make this relative URI absolute using
+ * the given URI as a base. This URI instance must be relative
+ * and the base_uri must be absolute.
+ *
+ * @param base_uri URI to use as the base from which to make
+ * this relative URI into an absolute URI.
+ *
+ * @return true if successful, false otherwise.
+ */
+ public function makeAbsoluteURI(base_uri:URI) : Boolean
+ {
+ if (isAbsolute() || base_uri.isRelative())
+ {
+ // This URI needs to be relative, and the base needs to be
+ // absolute otherwise we won't know what to do!
+ return false;
+ }
+
+ // Make a copy of the base URI. We don't want to modify
+ // the passed URI.
+ var base:URI = new URI();
+ base.copyURI(base_uri);
+
+ // ChDir on the base URI. This will preserve any query
+ // and fragment we have.
+ if (base.chdir(toString()) == false)
+ return false;
+
+ // It worked, so copy the base into this one
+ copyURI(base);
+
+ return true;
+ }
+
+
+ /**
+ * Given a URI to use as a base from which this object should be
+ * relative to, convert this object into a relative URI. For example,
+ * if you have:
+ *
+ * <listing>
+ * var uri1:URI = new URI("http://something.com/path/to/some/file.html");
+ * var uri2:URI = new URI("http://something.com/path/to/another/file.html");
+ *
+ * uri1.MakeRelativePath(uri2);</listing>
+ *
+ * <p>uri1 will have a final value of "../some/file.html"</p>
+ *
+ * <p>Note! This function is brute force. If you have two URI's
+ * that are completely unrelated, this will still attempt to make
+ * the relative URI. In that case, you will most likely get a
+ * relative path that looks something like:</p>
+ *
+ * <p>../../../../../../some/path/to/my/file.html</p>
+ *
+ * @param base_uri the URI from which to make this URI relative
+ *
+ * @return true if successful, false if the base_uri and this URI
+ * are not related, of if error.
+ */
+ public function makeRelativeURI(base_uri:URI, caseSensitive:Boolean = true) : Boolean
+ {
+ var base:URI = new URI();
+ base.copyURI(base_uri);
+
+ var thisParts:Array, thatParts:Array;
+ var finalParts:Array = new Array();
+ var thisPart:String, thatPart:String, finalPath:String;
+ var pathStr:String = this.path;
+ var queryStr:String = this.queryRaw;
+ var fragmentStr:String = this.fragment;
+ var i:int;
+ var diff:Boolean = false;
+ var isDir:Boolean = false;
+
+ if (isRelative())
+ {
+ // We're already relative.
+ return true;
+ }
+
+ if (base.isRelative())
+ {
+ // The base is relative. A relative base doesn't make sense.
+ return false;
+ }
+
+
+ if ( (isOfType(base_uri.scheme) == false) ||
+ (this.authority != base_uri.authority) )
+ {
+ // The schemes and/or authorities are different. We can't
+ // make a relative path to something that is completely
+ // unrelated.
+ return false;
+ }
+
+ // Record the state of this URI
+ isDir = isDirectory();
+
+ // We are based of the directory of the given URI. We need to
+ // make sure the URI is pointing to a directory. Changing
+ // directory to "." will remove any file name if the base is
+ // not a directory.
+ base.chdir(".");
+
+ thisParts = pathStr.split("/");
+ thatParts = base.path.split("/");
+
+ if (thisParts.length > 0 && thisParts[0] == "")
+ thisParts.shift();
+
+ if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "")
+ {
+ isDir = true;
+ thisParts.pop();
+ }
+
+ if (thatParts.length > 0 && thatParts[0] == "")
+ thatParts.shift();
+ if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "")
+ thatParts.pop();
+
+
+ // Now that we have the paths split into an array of directories,
+ // we can compare the two paths. We start from the left of side
+ // of the path and start comparing. When we either run out of
+ // directories (one path is longer than the other), or we find
+ // a directory that is different, we stop. The remaining parts
+ // of each path is then used to determine the relative path. For
+ // example, lets say we have:
+ // path we want to make relative: /a/b/c/d/e.txt
+ // path to use as base for relative: /a/b/f/
+ //
+ // This loop will start at the left, and remove directories
+ // until we get a mismatch or run off the end of one of them.
+ // In this example, the result will be:
+ // c/d/e.txt
+ // f
+ //
+ // For every part left over in the base path, we prepend a ".."
+ // to the relative to get the final path:
+ // ../c/d/e.txt
+ while(thatParts.length > 0)
+ {
+ if (thisParts.length == 0)
+ {
+ // we matched all there is to match, we are done.
+ // This is the case where "this" object is a parent
+ // path of the given URI. eg:
+ // this.path = /a/b/ (thisParts)
+ // base.path = /a/b/c/d/e/ (thatParts)
+ break;
+ }
+
+ thisPart = thisParts[0];
+ thatPart = thatParts[0];
+
+ if (compareStr(thisPart, thatPart, caseSensitive))
+ {
+ thisParts.shift();
+ thatParts.shift();
+ }
+ else
+ break;
+ }
+
+ // If there are any path info left from the base URI, that means
+ // **this** object is above the given URI in the file tree. For
+ // each part left over in the given URI, we need to move up one
+ // directory to get where we are.
+ var dotdot:String = "..";
+ for (i = 0; i < thatParts.length; i++)
+ {
+ finalParts.push(dotdot);
+ }
+
+ // Append the parts of this URI to any dot-dot's we have
+ finalParts = finalParts.concat(thisParts);
+
+ // Join the parts back into a path
+ finalPath = joinPath(finalParts, false /* not absolute */, isDir);
+
+ if (finalPath.length == 0)
+ {
+ // The two URI's are exactly the same. The proper relative
+ // path is:
+ finalPath = "./";
+ }
+
+ // Set the parts of the URI, preserving the original query and
+ // fragment parts.
+ setParts("", "", "", finalPath, queryStr, fragmentStr);
+
+ return true;
+ }
+
+ /**
+ * Given a string, convert it to a URI. The string could be a
+ * full URI that is improperly escaped, a malformed URI (e.g.
+ * missing a protocol like "www.something.com"), a relative URI,
+ * or any variation there of.
+ *
+ * <p>The intention of this function is to take anything that a
+ * user might manually enter as a URI/URL and try to determine what
+ * they mean. This function differs from the URI constructor in
+ * that it makes some assumptions to make it easy to import user
+ * entered URI data.</p>
+ *
+ * <p>This function is intended to be a helper function.
+ * It is not all-knowning and will probably make mistakes
+ * when attempting to parse a string of unknown origin. If
+ * your applicaiton is receiving input from the user, your
+ * application should already have a good idea what the user
+ * should be entering, and your application should be
+ * pre-processing the user's input to make sure it is well formed
+ * before passing it to this function.</p>
+ *
+ * <p>It is assumed that the string given to this function is
+ * something the user may have manually entered. Given this,
+ * the URI string is probably unescaped or improperly escaped.
+ * This function will attempt to properly escape the URI by
+ * using forceEscape(). The result is that a toString() call
+ * on a URI that was created from unknownToURI() may not match
+ * the input string due to the difference in escaping.</p>
+ *
+ * @param unknown a potental URI string that should be parsed
+ * and loaded into this object.
+ * @param defaultScheme if it is determined that the passed string
+ * looks like a URI, but it is missing the scheme part, this
+ * string will be used as the missing scheme.
+ *
+ * @return true if the given string was successfully parsed into
+ * a valid URI object, false otherwise.
+ */
+ public function unknownToURI(unknown:String, defaultScheme:String = "http") : Boolean
+ {
+ var temp:String;
+
+ if (unknown.length == 0)
+ {
+ this.initialize();
+ return false;
+ }
+
+ // Some users love the backslash key. Fix it.
+ unknown = unknown.replace(/\\/g, "/");
+
+ // Check for any obviously missing scheme.
+ if (unknown.length >= 2)
+ {
+ temp = unknown.substr(0, 2);
+ if (temp == "//")
+ unknown = defaultScheme + ":" + unknown;
+ }
+
+ if (unknown.length >= 3)
+ {
+ temp = unknown.substr(0, 3);
+ if (temp == "://")
+ unknown = defaultScheme + unknown;
+ }
+
+ // Try parsing it as a normal URI
+ var uri:URI = new URI(unknown);
+
+ if (uri.isHierarchical() == false)
+ {
+ if (uri.scheme == UNKNOWN_SCHEME)
+ {
+ this.initialize();
+ return false;
+ }
+
+ // It's a non-hierarchical URI
+ copyURI(uri);
+ forceEscape();
+ return true;
+ }
+ else if ((uri.scheme != UNKNOWN_SCHEME) &&
+ (uri.scheme.length > 0))
+ {
+ if ( (uri.authority.length > 0) ||
+ (uri.scheme == "file") )
+ {
+ // file://... URI
+ copyURI(uri);
+ forceEscape(); // ensure proper escaping
+ return true;
+ }
+ else if (uri.authority.length == 0 && uri.path.length == 0)
+ {
+ // It's is an incomplete URI (eg "http://")
+
+ setParts(uri.scheme, "", "", "", "", "");
+ return false;
+ }
+ }
+ else
+ {
+ // Possible relative URI. We can only detect relative URI's
+ // that start with "." or "..". If it starts with something
+ // else, the parsing is ambiguous.
+ var path:String = uri.path;
+
+ if (path == ".." || path == "." ||
+ (path.length >= 3 && path.substr(0, 3) == "../") ||
+ (path.length >= 2 && path.substr(0, 2) == "./") )
+ {
+ // This is a relative URI.
+ copyURI(uri);
+ forceEscape();
+ return true;
+ }
+ }
+
+ // Ok, it looks like we are just a normal URI missing the scheme. Tack
+ // on the scheme.
+ uri = new URI(defaultScheme + "://" + unknown);
+
+ // Check to see if we are good now
+ if (uri.scheme.length > 0 && uri.authority.length > 0)
+ {
+ // It was just missing the scheme.
+ copyURI(uri);
+ forceEscape(); // Make sure we are properly encoded.
+ return true;
+ }
+
+ // don't know what this is
+ this.initialize();
+ return false;
+ }
+
+ } // end URI class
+} // end package
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/URIEncodingBitmap.as b/vendors/uploadify/com/adobe/net/URIEncodingBitmap.as new file mode 100644 index 000000000..d786b33fa --- /dev/null +++ b/vendors/uploadify/com/adobe/net/URIEncodingBitmap.as @@ -0,0 +1,139 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.net
+{
+ import flash.utils.ByteArray;
+
+ /**
+ * This class implements an efficient lookup table for URI
+ * character escaping. This class is only needed if you
+ * create a derived class of URI to handle custom URI
+ * syntax. This class is used internally by URI.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0*
+ */
+ public class URIEncodingBitmap extends ByteArray
+ {
+ /**
+ * Constructor. Creates an encoding bitmap using the given
+ * string of characters as the set of characters that need
+ * to be URI escaped.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public function URIEncodingBitmap(charsToEscape:String) : void
+ {
+ var i:int;
+ var data:ByteArray = new ByteArray();
+
+ // Initialize our 128 bits (16 bytes) to zero
+ for (i = 0; i < 16; i++)
+ this.writeByte(0);
+
+ data.writeUTFBytes(charsToEscape);
+ data.position = 0;
+
+ while (data.bytesAvailable)
+ {
+ var c:int = data.readByte();
+
+ if (c > 0x7f)
+ continue; // only escape low bytes
+
+ var enc:int;
+ this.position = (c >> 3);
+ enc = this.readByte();
+ enc |= 1 << (c & 0x7);
+ this.position = (c >> 3);
+ this.writeByte(enc);
+ }
+ }
+
+ /**
+ * Based on the data table contained in this object, check
+ * if the given character should be escaped.
+ *
+ * @param char the character to be escaped. Only the first
+ * character in the string is used. Any other characters
+ * are ignored.
+ *
+ * @return the integer value of the raw UTF8 character. For
+ * example, if '%' is given, the return value is 37 (0x25).
+ * If the character given does not need to be escaped, the
+ * return value is zero.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public function ShouldEscape(char:String) : int
+ {
+ var data:ByteArray = new ByteArray();
+ var c:int, mask:int;
+
+ // write the character into a ByteArray so
+ // we can pull it out as a raw byte value.
+ data.writeUTFBytes(char);
+ data.position = 0;
+ c = data.readByte();
+
+ if (c & 0x80)
+ {
+ // don't escape high byte characters. It can make international
+ // URI's unreadable. We just want to escape characters that would
+ // make URI syntax ambiguous.
+ return 0;
+ }
+ else if ((c < 0x1f) || (c == 0x7f))
+ {
+ // control characters must be escaped.
+ return c;
+ }
+
+ this.position = (c >> 3);
+ mask = this.readByte();
+
+ if (mask & (1 << (c & 0x7)))
+ {
+ // we need to escape this, return the numeric value
+ // of the character
+ return c;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/net/proxies/RFC2817Socket.as b/vendors/uploadify/com/adobe/net/proxies/RFC2817Socket.as new file mode 100644 index 000000000..e73e9e7df --- /dev/null +++ b/vendors/uploadify/com/adobe/net/proxies/RFC2817Socket.as @@ -0,0 +1,198 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package com.adobe.net.proxies
+{
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.events.ProgressEvent;
+ import flash.net.Socket;
+
+ /**
+ * This class allows TCP socket connections through HTTP proxies in accordance with
+ * RFC 2817:
+ *
+ * ftp://ftp.rfc-editor.org/in-notes/rfc2817.txt
+ *
+ * It can also be used to make direct connections to a destination, as well. If you
+ * pass the host and port into the constructor, no proxy will be used. You can also
+ * call connect, passing in the host and the port, and if you didn't set the proxy
+ * info, a direct connection will be made. A proxy is only used after you have called
+ * the setProxyInfo function.
+ *
+ * The connection to and negotiation with the proxy is completely hidden. All the
+ * same events are thrown whether you are using a proxy or not, and the data you
+ * receive from the target server will look exact as it would if you were connected
+ * to it directly rather than through a proxy.
+ *
+ * @author Christian Cantrell
+ *
+ **/
+ public class RFC2817Socket
+ extends Socket
+ {
+ private var proxyHost:String = null;
+ private var host:String = null;
+ private var proxyPort:int = 0;
+ private var port:int = 0;
+ private var deferredEventHandlers:Object = new Object();
+ private var buffer:String = new String();
+
+ /**
+ * Construct a new RFC2817Socket object. If you pass in the host and the port,
+ * no proxy will be used. If you want to use a proxy, instantiate with no
+ * arguments, call setProxyInfo, then call connect.
+ **/
+ public function RFC2817Socket(host:String = null, port:int = 0)
+ {
+ super(host, port);
+ }
+
+ /**
+ * Set the proxy host and port number. Your connection will only proxied if
+ * this function has been called.
+ **/
+ public function setProxyInfo(host:String, port:int):void
+ {
+ this.proxyHost = host;
+ this.proxyPort = port;
+
+ var deferredSocketDataHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA];
+ var deferredConnectHandler:Object = this.deferredEventHandlers[Event.CONNECT];
+
+ if (deferredSocketDataHandler != null)
+ {
+ super.removeEventListener(ProgressEvent.SOCKET_DATA, deferredSocketDataHandler.listener, deferredSocketDataHandler.useCapture);
+ }
+
+ if (deferredConnectHandler != null)
+ {
+ super.removeEventListener(Event.CONNECT, deferredConnectHandler.listener, deferredConnectHandler.useCapture);
+ }
+ }
+
+ /**
+ * Connect to the specified host over the specified port. If you want your
+ * connection proxied, call the setProxyInfo function first.
+ **/
+ public override function connect(host:String, port:int):void
+ {
+ if (this.proxyHost == null)
+ {
+ this.redirectConnectEvent();
+ this.redirectSocketDataEvent();
+ super.connect(host, port);
+ }
+ else
+ {
+ this.host = host;
+ this.port = port;
+ super.addEventListener(Event.CONNECT, this.onConnect);
+ super.addEventListener(ProgressEvent.SOCKET_DATA, this.onSocketData);
+ super.connect(this.proxyHost, this.proxyPort);
+ }
+ }
+
+ private function onConnect(event:Event):void
+ {
+ this.writeUTFBytes("CONNECT "+this.host+":"+this.port+" HTTP/1.1\n\n");
+ this.flush();
+ this.redirectConnectEvent();
+ }
+
+ private function onSocketData(event:ProgressEvent):void
+ {
+ while (this.bytesAvailable != 0)
+ {
+ this.buffer += this.readUTFBytes(1);
+ if (this.buffer.search(/\r?\n\r?\n$/) != -1)
+ {
+ this.checkResponse(event);
+ break;
+ }
+ }
+ }
+
+ private function checkResponse(event:ProgressEvent):void
+ {
+ var responseCode:String = this.buffer.substr(this.buffer.indexOf(" ")+1, 3);
+
+ if (responseCode.search(/^2/) == -1)
+ {
+ var ioError:IOErrorEvent = new IOErrorEvent(IOErrorEvent.IO_ERROR);
+ ioError.text = "Error connecting to the proxy ["+this.proxyHost+"] on port ["+this.proxyPort+"]: " + this.buffer;
+ this.dispatchEvent(ioError);
+ }
+ else
+ {
+ this.redirectSocketDataEvent();
+ this.dispatchEvent(new Event(Event.CONNECT));
+ if (this.bytesAvailable > 0)
+ {
+ this.dispatchEvent(event);
+ }
+ }
+ this.buffer = null;
+ }
+
+ private function redirectConnectEvent():void
+ {
+ super.removeEventListener(Event.CONNECT, onConnect);
+ var deferredEventHandler:Object = this.deferredEventHandlers[Event.CONNECT];
+ if (deferredEventHandler != null)
+ {
+ super.addEventListener(Event.CONNECT, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference);
+ }
+ }
+
+ private function redirectSocketDataEvent():void
+ {
+ super.removeEventListener(ProgressEvent.SOCKET_DATA, onSocketData);
+ var deferredEventHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA];
+ if (deferredEventHandler != null)
+ {
+ super.addEventListener(ProgressEvent.SOCKET_DATA, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference);
+ }
+ }
+
+ public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int=0.0, useWeakReference:Boolean=false):void
+ {
+ if (type == Event.CONNECT || type == ProgressEvent.SOCKET_DATA)
+ {
+ this.deferredEventHandlers[type] = {listener:listener,useCapture:useCapture, priority:priority, useWeakReference:useWeakReference};
+ }
+ else
+ {
+ super.addEventListener(type, listener, useCapture, priority, useWeakReference);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/Database.as b/vendors/uploadify/com/adobe/protocols/dict/Database.as new file mode 100644 index 000000000..0ddeef53c --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/Database.as @@ -0,0 +1,34 @@ +package com.adobe.protocols.dict
+{
+ public class Database
+ {
+ private var _name:String;
+ private var _description:String;
+
+ public function Database(name:String, description:String)
+ {
+ this._name = name;
+ this._description = description;
+ }
+
+ public function set name(name:String):void
+ {
+ this._name = name;
+ }
+
+ public function get name():String
+ {
+ return this._name;
+ }
+
+ public function set description(description:String):void
+ {
+ this._description = description;
+ }
+
+ public function get description():String
+ {
+ return this._description;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/Definition.as b/vendors/uploadify/com/adobe/protocols/dict/Definition.as new file mode 100644 index 000000000..934a330e8 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/Definition.as @@ -0,0 +1,39 @@ +package com.adobe.protocols.dict
+{
+ public class Definition
+ {
+ private var _definition:String;
+ private var _database:String;
+ private var _term:String;
+
+ public function set definition(definition:String):void
+ {
+ this._definition = definition;
+ }
+
+ public function get definition():String
+ {
+ return this._definition;
+ }
+
+ public function set database(database:String):void
+ {
+ this._database = database;
+ }
+
+ public function get database():String
+ {
+ return this._database;
+ }
+
+ public function set term(term:String):void
+ {
+ this._term = term;
+ }
+
+ public function get term():String
+ {
+ return this._term;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/Dict.as b/vendors/uploadify/com/adobe/protocols/dict/Dict.as new file mode 100644 index 000000000..07d2530cf --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/Dict.as @@ -0,0 +1,328 @@ +package com.adobe.protocols.dict
+{
+ import com.adobe.protocols.dict.events.*;
+ import com.adobe.protocols.dict.util.*;
+
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.ProgressEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.net.Socket;
+ import mx.rpc.http.HTTPService;
+ import mx.rpc.events.ResultEvent;
+ import mx.rpc.events.FaultEvent;
+ import flash.xml.XMLNode;
+ import mx.utils.StringUtil;
+
+ public class Dict
+ extends EventDispatcher
+ {
+ // Event type names.
+ public static var CONNECTED:String = "connected";
+ public static var DISCONNECTED:String = "disconnected";
+ public static var IO_ERROR:String = IOErrorEvent.IO_ERROR;
+ public static var ERROR:String = "error";
+ public static var SERVERS:String = "servers";
+ public static var DATABASES:String = "databases";
+ public static var MATCH_STRATEGIES:String = "matchStrategies";
+ public static var DEFINITION:String = "definition";
+ public static var DEFINITION_HEADER:String = "definitionHeader";
+ public static var MATCH:String = "match";
+ public static var NO_MATCH:String = "noMatch";
+
+ public static var FIRST_MATCH:uint = 0;
+ public static var ALL_DATABASES:uint = 1;
+
+ private var socket:SocketHelper;
+
+ private var dbShortList:Boolean;
+
+ public function Dict()
+ {
+ this.socket = new SocketHelper();
+ this.socket.addEventListener(Event.CONNECT, connected);
+ this.socket.addEventListener(Event.CLOSE, disconnected);
+ this.socket.addEventListener(SocketHelper.COMPLETE_RESPONSE, incomingData);
+ this.socket.addEventListener(IOErrorEvent.IO_ERROR, ioError);
+ this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
+ }
+
+ public function connect(server:String, port:uint = 2628):void
+ {
+ if (this.socket.connected)
+ {
+ this.socket.close();
+ }
+ this.socket.connect(server, port);
+ }
+
+ public function connectThroughProxy(proxyServer:String,
+ proxyPort:int,
+ server:String,
+ port:uint = 2628):void
+ {
+ if (this.socket.connected)
+ {
+ this.socket.close();
+ }
+ this.socket.setProxyInfo(proxyServer, proxyPort);
+ this.socket.connect(server, port);
+ }
+
+ public function disconnect():void
+ {
+ this.socket.close();
+ this.disconnected(null);
+ }
+
+ public function getServers():void
+ {
+ var http:HTTPService = new HTTPService();
+ http.url = "http://luetzschena-stahmeln.de/dictd/xmllist.php";
+ http.addEventListener(ResultEvent.RESULT, incomingServerXML);
+ http.addEventListener(FaultEvent.FAULT, httpError);
+ http.resultFormat = HTTPService.RESULT_FORMAT_E4X;
+ http.send();
+ }
+
+ public function getDatabases(shortList:Boolean=true):void
+ {
+ this.dbShortList = shortList;
+ this.socket.writeUTFBytes("show db\r\n");
+ this.socket.flush();
+ }
+
+ public function getMatchStrategies():void
+ {
+ this.socket.writeUTFBytes("show strat\r\n");
+ this.socket.flush();
+ }
+
+ public function match(database:String, term:String, scope:String="prefix"):void
+ {
+ this.socket.writeUTFBytes("match " + database + " " + scope + " \"" + term + "\"\r\n");
+ this.socket.flush();
+ }
+
+ public function define(database:String, term:String):void
+ {
+ this.socket.writeUTFBytes("define " + database + " \"" + term + "\"\r\n");
+ this.socket.flush();
+ }
+
+ public function lookup(term:String, scope:uint):void
+ {
+ var flag:String;
+ if (scope == Dict.ALL_DATABASES)
+ {
+ flag = "*";
+ }
+ else if (scope == Dict.FIRST_MATCH)
+ {
+ flag = "!";
+ }
+ this.socket.writeUTFBytes("define " + flag + " \"" + term + "\"\r\n");
+ this.socket.flush();
+ }
+
+ //// Private functions ////
+
+ private function connected(event:Event):void
+ {
+ // Wait to dispatch an event until we get the 220 response.
+ }
+
+ private function disconnected(event:Event):void
+ {
+ dispatchEvent(new DisconnectedEvent());
+ }
+
+ private function incomingServerXML(event:ResultEvent):void
+ {
+ var dictd:Namespace = new Namespace("http://www.luetzschena-stahmeln.de/dictd/");
+ var result:XML = event.result as XML;
+ var server:String, description:String;
+ var servers:Array = new Array();
+ for each (var serverNode:XML in result.dictd::server)
+ {
+ server = serverNode.dictd::dictdurl;
+ description = serverNode.dictd::description;
+ if (StringUtil.trim(server).length != 0 &&
+ StringUtil.trim(description).length != 0)
+ {
+ var dServer:DictionaryServer = new DictionaryServer();
+ dServer.server = server.replace("dict://", "");
+ dServer.description = description;
+ servers.push(dServer);
+ }
+ }
+ var dEvent:DictionaryServerEvent = new DictionaryServerEvent();
+ dEvent.servers = servers;
+ dispatchEvent(dEvent);
+ }
+
+ private function incomingData(event:CompleteResponseEvent):void
+ {
+ var rawResponse:String = event.response;
+ var response:Response = this.parseRawResponse(rawResponse);
+ var responseCode:uint = response.code;
+ if (responseCode == 552) // no matches
+ {
+ throwNoMatchEvent(response);
+ }
+ else if (responseCode >= 400 && responseCode <= 599) // error
+ {
+ throwErrorEvent(response);
+ }
+ else if (responseCode == 220) // successful connection
+ {
+ dispatchEvent(new ConnectedEvent());
+ }
+ else if (responseCode == 110) // databases are being returned
+ {
+ throwDatabasesEvent(response);
+ }
+ else if (responseCode == 111) // matches strategies
+ {
+ throwMatchStrategiesEvent(response);
+ }
+ else if (responseCode == 152) // matches
+ {
+ throwMatchEvent(response);
+ }
+ else if (responseCode == 150)
+ {
+ throwDefinitionHeaderEvent(response);
+ }
+ else if (responseCode == 151)
+ {
+ throwDefinitionEvent(response);
+ }
+ }
+
+ private function ioError(event:IOErrorEvent):void
+ {
+ dispatchEvent(event);
+ }
+
+ private function httpError(event:FaultEvent):void
+ {
+ trace("httpError!");
+ }
+
+ private function securityError(event:SecurityErrorEvent):void
+ {
+ trace("security error!");
+ trace(event.text);
+ }
+
+ // Dispatch new events.
+
+ private function throwDatabasesEvent(response:Response):void
+ {
+ var databases:Array = new Array();
+ var responseArray:Array = response.body.split("\r\n");
+ for each (var line:String in responseArray)
+ {
+ var name:String = line.substring(0, line.indexOf(" "));
+ if (name == "--exit--")
+ {
+ if (this.dbShortList)
+ {
+ break;
+ }
+ continue;
+ }
+ var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
+ databases.push(new Database(name, description));
+ }
+ var event:DatabaseEvent = new DatabaseEvent();
+ event.databases = databases;
+ dispatchEvent(event);
+ }
+
+ private function throwMatchStrategiesEvent(response:Response):void
+ {
+ var strategies:Array = new Array();
+ var responseArray:Array = response.body.split("\r\n");
+ for each (var line:String in responseArray)
+ {
+ var name:String = line.substring(0, line.indexOf(" "));
+ var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
+ strategies.push(new MatchStrategy(name, description));
+ }
+ var event:MatchStrategiesEvent = new MatchStrategiesEvent();
+ event.strategies = strategies;
+ dispatchEvent(event);
+ }
+
+ private function throwMatchEvent(response:Response):void
+ {
+ var matches:Array = new Array();
+ var responseArray:Array = response.body.split("\r\n");
+ for each (var line:String in responseArray)
+ {
+ var match:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
+ matches.push(match);
+ }
+ var event:MatchEvent = new MatchEvent();
+ event.matches = matches;
+ dispatchEvent(event);
+ }
+
+ private function throwErrorEvent(response:Response):void
+ {
+ var event:ErrorEvent = new ErrorEvent();
+ event.code = response.code;
+ event.message = response.headerText;
+ dispatchEvent(event);
+ }
+
+ private function throwNoMatchEvent(response:Response):void
+ {
+ dispatchEvent(new NoMatchEvent());
+ }
+
+ private function throwDefinitionHeaderEvent(response:Response):void
+ {
+ var event:DefinitionHeaderEvent = new DefinitionHeaderEvent();
+ event.definitionCount = uint(response.headerText.substring(0, response.headerText.indexOf(" ")));
+ dispatchEvent(event);
+ }
+
+ private function throwDefinitionEvent(response:Response):void
+ {
+ var event:DefinitionEvent = new DefinitionEvent();
+ var def:Definition = new Definition();
+ var headerText:String = response.headerText;
+ var tokens:Array = headerText.match(/"[^"]+"/g);
+ def.term = String(tokens[0]).replace(/"/g, "");
+ def.database = String(tokens[1]).replace(/"/g, "");
+ def.definition = response.body;
+ event.definition = def;
+ dispatchEvent(event);
+ }
+
+ private function parseRawResponse(rawResponse:String):Response
+ {
+ var response:Response = new Response();
+ var fullHeader:String;
+ if (rawResponse.indexOf("\r\n") != -1)
+ {
+ fullHeader = rawResponse.substring(0, rawResponse.indexOf("\r\n"));
+ }
+ else
+ {
+ fullHeader = rawResponse;
+ }
+ var responseCodeMatch:Array = fullHeader.match(/^\d{3}/);
+ response.code = uint(responseCodeMatch[0]);
+ response.headerText = fullHeader.substring(fullHeader.indexOf(" ")+1, fullHeader.length);
+ var body:String = rawResponse.substring(rawResponse.indexOf("\r\n")+2, rawResponse.length);
+ body = body.replace(/\r\n\.\./, "\r\n.");
+ response.body = body;
+ return response;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/DictionaryServer.as b/vendors/uploadify/com/adobe/protocols/dict/DictionaryServer.as new file mode 100644 index 000000000..422b603e0 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/DictionaryServer.as @@ -0,0 +1,28 @@ +package com.adobe.protocols.dict
+{
+ public class DictionaryServer
+ {
+ private var _server:String;
+ private var _description:String;
+
+ public function set server(server:String):void
+ {
+ this._server = server;
+ }
+
+ public function get server():String
+ {
+ return this._server;
+ }
+
+ public function set description(description:String):void
+ {
+ this._description = description;
+ }
+
+ public function get description():String
+ {
+ return this._description;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/MatchStrategy.as b/vendors/uploadify/com/adobe/protocols/dict/MatchStrategy.as new file mode 100644 index 000000000..1e17da32e --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/MatchStrategy.as @@ -0,0 +1,34 @@ +package com.adobe.protocols.dict
+{
+ public class MatchStrategy
+ {
+ private var _name:String;
+ private var _description:String;
+
+ public function MatchStrategy(name:String, description:String)
+ {
+ this._name = name;
+ this._description = description;
+ }
+
+ public function set name(name:String):void
+ {
+ this._name = name;
+ }
+
+ public function get name():String
+ {
+ return this._name;
+ }
+
+ public function set description(description:String):void
+ {
+ this._description = description;
+ }
+
+ public function get description():String
+ {
+ return this._description;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/Response.as b/vendors/uploadify/com/adobe/protocols/dict/Response.as new file mode 100644 index 000000000..619a8e903 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/Response.as @@ -0,0 +1,39 @@ +package com.adobe.protocols.dict
+{
+ public class Response
+ {
+ private var _code:uint;
+ private var _headerText:String;
+ private var _body:String;
+
+ public function set code(code:uint):void
+ {
+ this._code = code;
+ }
+
+ public function set headerText(headerText:String):void
+ {
+ this._headerText = headerText;
+ }
+
+ public function set body(body:String):void
+ {
+ this._body = body;
+ }
+
+ public function get code():uint
+ {
+ return this._code;
+ }
+
+ public function get headerText():String
+ {
+ return this._headerText;
+ }
+
+ public function get body():String
+ {
+ return this._body;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/ConnectedEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/ConnectedEvent.as new file mode 100644 index 000000000..c4a414521 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/ConnectedEvent.as @@ -0,0 +1,14 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class ConnectedEvent extends Event
+ {
+ public function ConnectedEvent()
+ {
+ super(Dict.CONNECTED);
+ }
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/DatabaseEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/DatabaseEvent.as new file mode 100644 index 000000000..fdd2cc1eb --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/DatabaseEvent.as @@ -0,0 +1,26 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class DatabaseEvent
+ extends Event
+ {
+ private var _databases:Array;
+
+ public function DatabaseEvent()
+ {
+ super(Dict.DATABASES);
+ }
+
+ public function set databases(databases:Array):void
+ {
+ this._databases = databases;
+ }
+
+ public function get databases():Array
+ {
+ return this._databases;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionEvent.as new file mode 100644 index 000000000..8107173e6 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionEvent.as @@ -0,0 +1,27 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+ import com.adobe.protocols.dict.Definition;
+
+ public class DefinitionEvent
+ extends Event
+ {
+ private var _definition:Definition;
+
+ public function DefinitionEvent()
+ {
+ super(Dict.DEFINITION);
+ }
+
+ public function set definition(definition:Definition):void
+ {
+ this._definition = definition;
+ }
+
+ public function get definition():Definition
+ {
+ return this._definition;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as new file mode 100644 index 000000000..e77c402ae --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as @@ -0,0 +1,26 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class DefinitionHeaderEvent
+ extends Event
+ {
+ private var _definitionCount:uint;
+
+ public function DefinitionHeaderEvent()
+ {
+ super(Dict.DEFINITION_HEADER);
+ }
+
+ public function set definitionCount(definitionCount:uint):void
+ {
+ this._definitionCount = definitionCount;
+ }
+
+ public function get definitionCount():uint
+ {
+ return this._definitionCount;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/DictionaryServerEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/DictionaryServerEvent.as new file mode 100644 index 000000000..9b406e95c --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/DictionaryServerEvent.as @@ -0,0 +1,26 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class DictionaryServerEvent
+ extends Event
+ {
+ private var _servers:Array;
+
+ public function DictionaryServerEvent()
+ {
+ super(Dict.SERVERS);
+ }
+
+ public function set servers(servers:Array):void
+ {
+ this._servers = servers;
+ }
+
+ public function get servers():Array
+ {
+ return this._servers;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/DisconnectedEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/DisconnectedEvent.as new file mode 100644 index 000000000..485b3edac --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/DisconnectedEvent.as @@ -0,0 +1,14 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class DisconnectedEvent extends Event
+ {
+ public function DisconnectedEvent()
+ {
+ super(Dict.DISCONNECTED);
+ }
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/ErrorEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/ErrorEvent.as new file mode 100644 index 000000000..9e5fc7ad2 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/ErrorEvent.as @@ -0,0 +1,37 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class ErrorEvent
+ extends Event
+ {
+ private var _code:uint;
+ private var _message:String;
+
+ public function ErrorEvent()
+ {
+ super(Dict.ERROR);
+ }
+
+ public function set code(code:uint):void
+ {
+ this._code = code;
+ }
+
+ public function set message(message:String):void
+ {
+ this._message = message;
+ }
+
+ public function get code():uint
+ {
+ return this._code;
+ }
+
+ public function get message():String
+ {
+ return this._message;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/MatchEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/MatchEvent.as new file mode 100644 index 000000000..65b868851 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/MatchEvent.as @@ -0,0 +1,26 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class MatchEvent
+ extends Event
+ {
+ private var _matches:Array;
+
+ public function MatchEvent()
+ {
+ super(Dict.MATCH);
+ }
+
+ public function set matches(matches:Array):void
+ {
+ this._matches = matches;
+ }
+
+ public function get matches():Array
+ {
+ return this._matches;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/MatchStrategiesEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/MatchStrategiesEvent.as new file mode 100644 index 000000000..75b76f889 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/MatchStrategiesEvent.as @@ -0,0 +1,26 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class MatchStrategiesEvent
+ extends Event
+ {
+ private var _strategies:Array;
+
+ public function MatchStrategiesEvent()
+ {
+ super(Dict.MATCH_STRATEGIES);
+ }
+
+ public function set strategies(strategies:Array):void
+ {
+ this._strategies = strategies;
+ }
+
+ public function get strategies():Array
+ {
+ return this._strategies;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/events/NoMatchEvent.as b/vendors/uploadify/com/adobe/protocols/dict/events/NoMatchEvent.as new file mode 100644 index 000000000..894d1ae2c --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/events/NoMatchEvent.as @@ -0,0 +1,14 @@ +package com.adobe.protocols.dict.events
+{
+ import flash.events.Event;
+ import com.adobe.protocols.dict.Dict;
+
+ public class NoMatchEvent
+ extends Event
+ {
+ public function NoMatchEvent()
+ {
+ super(Dict.NO_MATCH);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/util/CompleteResponseEvent.as b/vendors/uploadify/com/adobe/protocols/dict/util/CompleteResponseEvent.as new file mode 100644 index 000000000..fc552f1b3 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/util/CompleteResponseEvent.as @@ -0,0 +1,25 @@ +package com.adobe.protocols.dict.util
+{
+ import flash.events.Event;
+
+ public class CompleteResponseEvent
+ extends Event
+ {
+ private var _response:String;
+
+ public function CompleteResponseEvent()
+ {
+ super(SocketHelper.COMPLETE_RESPONSE);
+ }
+
+ public function set response(response:String):void
+ {
+ this._response = response;
+ }
+
+ public function get response():String
+ {
+ return this._response;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/protocols/dict/util/SocketHelper.as b/vendors/uploadify/com/adobe/protocols/dict/util/SocketHelper.as new file mode 100644 index 000000000..feb494b31 --- /dev/null +++ b/vendors/uploadify/com/adobe/protocols/dict/util/SocketHelper.as @@ -0,0 +1,49 @@ +package com.adobe.protocols.dict.util
+{
+ import com.adobe.net.proxies.RFC2817Socket;
+ import flash.events.ProgressEvent;
+
+ public class SocketHelper
+ extends RFC2817Socket
+ {
+ private var terminator:String = "\r\n.\r\n";
+ private var buffer:String;
+ public static var COMPLETE_RESPONSE:String = "completeResponse";
+
+ public function SocketHelper()
+ {
+ super();
+ buffer = new String();
+ addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
+ }
+
+ private function incomingData(event:ProgressEvent):void
+ {
+ buffer += readUTFBytes(bytesAvailable);
+ buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
+ var codeStr:String = buffer.substring(0, 3);
+ if (!isNaN(parseInt(codeStr)))
+ {
+ var code:uint = uint(codeStr);
+ if (code == 150 || code >= 200)
+ {
+ buffer = buffer.replace("\r\n", this.terminator);
+ }
+ }
+
+ while (buffer.indexOf(this.terminator) != -1)
+ {
+ var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
+ buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
+ throwResponseEvent(chunk);
+ }
+ }
+
+ private function throwResponseEvent(response:String):void
+ {
+ var responseEvent:CompleteResponseEvent = new CompleteResponseEvent();
+ responseEvent.response = response;
+ dispatchEvent(responseEvent);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/serialization/json/JSON.as b/vendors/uploadify/com/adobe/serialization/json/JSON.as new file mode 100644 index 000000000..bfee6d90c --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSON.as @@ -0,0 +1,85 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ /**
+ * This class provides encoding and decoding of the JSON format.
+ *
+ * Example usage:
+ * <code>
+ * // create a JSON string from an internal object
+ * JSON.encode( myObject );
+ *
+ * // read a JSON string into an internal object
+ * var myObject:Object = JSON.decode( jsonString );
+ * </code>
+ */
+ public class JSON {
+
+
+ /**
+ * Encodes a object into a JSON string.
+ *
+ * @param o The object to create a JSON string for
+ * @return the JSON string representing o
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function encode( o:Object ):String {
+
+ var encoder:JSONEncoder = new JSONEncoder( o );
+ return encoder.getString();
+
+ }
+
+ /**
+ * Decodes a JSON string into a native object.
+ *
+ * @param s The JSON string representing the object
+ * @return A native object as specified by s
+ * @throw JSONParseError
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function decode( s:String ):* {
+
+ var decoder:JSONDecoder = new JSONDecoder( s )
+ return decoder.getValue();
+
+ }
+
+ }
+
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONDecoder.as b/vendors/uploadify/com/adobe/serialization/json/JSONDecoder.as new file mode 100644 index 000000000..82ade196a --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONDecoder.as @@ -0,0 +1,221 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ public class JSONDecoder {
+
+ /** The value that will get parsed from the JSON string */
+ private var value:*;
+
+ /** The tokenizer designated to read the JSON string */
+ private var tokenizer:JSONTokenizer;
+
+ /** The current token from the tokenizer */
+ private var token:JSONToken;
+
+ /**
+ * Constructs a new JSONDecoder to parse a JSON string
+ * into a native object.
+ *
+ * @param s The JSON string to be converted
+ * into a native object
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function JSONDecoder( s:String ) {
+
+ tokenizer = new JSONTokenizer( s );
+
+ nextToken();
+ value = parseValue();
+ }
+
+ /**
+ * Gets the internal object that was created by parsing
+ * the JSON string passed to the constructor.
+ *
+ * @return The internal object representation of the JSON
+ * string that was passed to the constructor
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function getValue():* {
+ return value;
+ }
+
+ /**
+ * Returns the next token from the tokenzier reading
+ * the JSON string
+ */
+ private function nextToken():JSONToken {
+ return token = tokenizer.getNextToken();
+ }
+
+ /**
+ * Attempt to parse an array
+ */
+ private function parseArray():Array {
+ // create an array internally that we're going to attempt
+ // to parse from the tokenizer
+ var a:Array = new Array();
+
+ // grab the next token from the tokenizer to move
+ // past the opening [
+ nextToken();
+
+ // check to see if we have an empty array
+ if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
+ // we're done reading the array, so return it
+ return a;
+ }
+
+ // deal with elements of the array, and use an "infinite"
+ // loop because we could have any amount of elements
+ while ( true ) {
+ // read in the value and add it to the array
+ a.push ( parseValue() );
+
+ // after the value there should be a ] or a ,
+ nextToken();
+
+ if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
+ // we're done reading the array, so return it
+ return a;
+ } else if ( token.type == JSONTokenType.COMMA ) {
+ // move past the comma and read another value
+ nextToken();
+ } else {
+ tokenizer.parseError( "Expecting ] or , but found " + token.value );
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Attempt to parse an object
+ */
+ private function parseObject():Object {
+ // create the object internally that we're going to
+ // attempt to parse from the tokenizer
+ var o:Object = new Object();
+
+ // store the string part of an object member so
+ // that we can assign it a value in the object
+ var key:String
+
+ // grab the next token from the tokenizer
+ nextToken();
+
+ // check to see if we have an empty object
+ if ( token.type == JSONTokenType.RIGHT_BRACE ) {
+ // we're done reading the object, so return it
+ return o;
+ }
+
+ // deal with members of the object, and use an "infinite"
+ // loop because we could have any amount of members
+ while ( true ) {
+
+ if ( token.type == JSONTokenType.STRING ) {
+ // the string value we read is the key for the object
+ key = String( token.value );
+
+ // move past the string to see what's next
+ nextToken();
+
+ // after the string there should be a :
+ if ( token.type == JSONTokenType.COLON ) {
+
+ // move past the : and read/assign a value for the key
+ nextToken();
+ o[key] = parseValue();
+
+ // move past the value to see what's next
+ nextToken();
+
+ // after the value there's either a } or a ,
+ if ( token.type == JSONTokenType.RIGHT_BRACE ) {
+ // // we're done reading the object, so return it
+ return o;
+
+ } else if ( token.type == JSONTokenType.COMMA ) {
+ // skip past the comma and read another member
+ nextToken();
+ } else {
+ tokenizer.parseError( "Expecting } or , but found " + token.value );
+ }
+ } else {
+ tokenizer.parseError( "Expecting : but found " + token.value );
+ }
+ } else {
+ tokenizer.parseError( "Expecting string but found " + token.value );
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Attempt to parse a value
+ */
+ private function parseValue():Object
+ {
+ // Catch errors when the input stream ends abruptly
+ if ( token == null )
+ {
+ tokenizer.parseError( "Unexpected end of input" );
+ }
+
+ switch ( token.type ) {
+ case JSONTokenType.LEFT_BRACE:
+ return parseObject();
+
+ case JSONTokenType.LEFT_BRACKET:
+ return parseArray();
+
+ case JSONTokenType.STRING:
+ case JSONTokenType.NUMBER:
+ case JSONTokenType.TRUE:
+ case JSONTokenType.FALSE:
+ case JSONTokenType.NULL:
+ return token.value;
+
+ default:
+ tokenizer.parseError( "Unexpected " + token.value );
+
+ }
+ return null;
+ }
+ }
+}
diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONEncoder.as b/vendors/uploadify/com/adobe/serialization/json/JSONEncoder.as new file mode 100644 index 000000000..44469d053 --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONEncoder.as @@ -0,0 +1,299 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json
+{
+
+ import flash.utils.describeType;
+
+ public class JSONEncoder {
+
+ /** The string that is going to represent the object we're encoding */
+ private var jsonString:String;
+
+ /**
+ * Creates a new JSONEncoder.
+ *
+ * @param o The object to encode as a JSON string
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function JSONEncoder( value:* ) {
+ jsonString = convertToString( value );
+
+ }
+
+ /**
+ * Gets the JSON string from the encoder.
+ *
+ * @return The JSON string representation of the object
+ * that was passed to the constructor
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function getString():String {
+ return jsonString;
+ }
+
+ /**
+ * Converts a value to it's JSON string equivalent.
+ *
+ * @param value The value to convert. Could be any
+ * type (object, number, array, etc)
+ */
+ private function convertToString( value:* ):String {
+
+ // determine what value is and convert it based on it's type
+ if ( value is String ) {
+
+ // escape the string so it's formatted correctly
+ return escapeString( value as String );
+
+ } else if ( value is Number ) {
+
+ // only encode numbers that finate
+ return isFinite( value as Number) ? value.toString() : "null";
+
+ } else if ( value is Boolean ) {
+
+ // convert boolean to string easily
+ return value ? "true" : "false";
+
+ } else if ( value is Array ) {
+
+ // call the helper method to convert an array
+ return arrayToString( value as Array );
+
+ } else if ( value is Object && value != null ) {
+
+ // call the helper method to convert an object
+ return objectToString( value );
+ }
+ return "null";
+ }
+
+ /**
+ * Escapes a string accoding to the JSON specification.
+ *
+ * @param str The string to be escaped
+ * @return The string with escaped special characters
+ * according to the JSON specification
+ */
+ private function escapeString( str:String ):String {
+ // create a string to store the string's jsonstring value
+ var s:String = "";
+ // current character in the string we're processing
+ var ch:String;
+ // store the length in a local variable to reduce lookups
+ var len:Number = str.length;
+
+ // loop over all of the characters in the string
+ for ( var i:int = 0; i < len; i++ ) {
+
+ // examine the character to determine if we have to escape it
+ ch = str.charAt( i );
+ switch ( ch ) {
+
+ case '"': // quotation mark
+ s += "\\\"";
+ break;
+
+ //case '/': // solidus
+ // s += "\\/";
+ // break;
+
+ case '\\': // reverse solidus
+ s += "\\\\";
+ break;
+
+ case '\b': // bell
+ s += "\\b";
+ break;
+
+ case '\f': // form feed
+ s += "\\f";
+ break;
+
+ case '\n': // newline
+ s += "\\n";
+ break;
+
+ case '\r': // carriage return
+ s += "\\r";
+ break;
+
+ case '\t': // horizontal tab
+ s += "\\t";
+ break;
+
+ default: // everything else
+
+ // check for a control character and escape as unicode
+ if ( ch < ' ' ) {
+ // get the hex digit(s) of the character (either 1 or 2 digits)
+ var hexCode:String = ch.charCodeAt( 0 ).toString( 16 );
+
+ // ensure that there are 4 digits by adjusting
+ // the # of zeros accordingly.
+ var zeroPad:String = hexCode.length == 2 ? "00" : "000";
+
+ // create the unicode escape sequence with 4 hex digits
+ s += "\\u" + zeroPad + hexCode;
+ } else {
+
+ // no need to do any special encoding, just pass-through
+ s += ch;
+
+ }
+ } // end switch
+
+ } // end for loop
+
+ return "\"" + s + "\"";
+ }
+
+ /**
+ * Converts an array to it's JSON string equivalent
+ *
+ * @param a The array to convert
+ * @return The JSON string representation of <code>a</code>
+ */
+ private function arrayToString( a:Array ):String {
+ // create a string to store the array's jsonstring value
+ var s:String = "";
+
+ // loop over the elements in the array and add their converted
+ // values to the string
+ for ( var i:int = 0; i < a.length; i++ ) {
+ // when the length is 0 we're adding the first element so
+ // no comma is necessary
+ if ( s.length > 0 ) {
+ // we've already added an element, so add the comma separator
+ s += ","
+ }
+
+ // convert the value to a string
+ s += convertToString( a[i] );
+ }
+
+ // KNOWN ISSUE: In ActionScript, Arrays can also be associative
+ // objects and you can put anything in them, ie:
+ // myArray["foo"] = "bar";
+ //
+ // These properties aren't picked up in the for loop above because
+ // the properties don't correspond to indexes. However, we're
+ // sort of out luck because the JSON specification doesn't allow
+ // these types of array properties.
+ //
+ // So, if the array was also used as an associative object, there
+ // may be some values in the array that don't get properly encoded.
+ //
+ // A possible solution is to instead encode the Array as an Object
+ // but then it won't get decoded correctly (and won't be an
+ // Array instance)
+
+ // close the array and return it's string value
+ return "[" + s + "]";
+ }
+
+ /**
+ * Converts an object to it's JSON string equivalent
+ *
+ * @param o The object to convert
+ * @return The JSON string representation of <code>o</code>
+ */
+ private function objectToString( o:Object ):String
+ {
+ // create a string to store the object's jsonstring value
+ var s:String = "";
+
+ // determine if o is a class instance or a plain object
+ var classInfo:XML = describeType( o );
+ if ( classInfo.@name.toString() == "Object" )
+ {
+ // the value of o[key] in the loop below - store this
+ // as a variable so we don't have to keep looking up o[key]
+ // when testing for valid values to convert
+ var value:Object;
+
+ // loop over the keys in the object and add their converted
+ // values to the string
+ for ( var key:String in o )
+ {
+ // assign value to a variable for quick lookup
+ value = o[key];
+
+ // don't add function's to the JSON string
+ if ( value is Function )
+ {
+ // skip this key and try another
+ continue;
+ }
+
+ // when the length is 0 we're adding the first item so
+ // no comma is necessary
+ if ( s.length > 0 ) {
+ // we've already added an item, so add the comma separator
+ s += ","
+ }
+
+ s += escapeString( key ) + ":" + convertToString( value );
+ }
+ }
+ else // o is a class instance
+ {
+ // Loop over all of the variables and accessors in the class and
+ // serialize them along with their values.
+ for each ( var v:XML in classInfo..*.( name() == "variable" || name() == "accessor" ) )
+ {
+ // When the length is 0 we're adding the first item so
+ // no comma is necessary
+ if ( s.length > 0 ) {
+ // We've already added an item, so add the comma separator
+ s += ","
+ }
+
+ s += escapeString( v.@name.toString() ) + ":"
+ + convertToString( o[ v.@name ] );
+ }
+
+ }
+
+ return "{" + s + "}";
+ }
+
+
+ }
+
+}
diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONParseError.as b/vendors/uploadify/com/adobe/serialization/json/JSONParseError.as new file mode 100644 index 000000000..5aec1e3b0 --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONParseError.as @@ -0,0 +1,87 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ /**
+ *
+ *
+ */
+ public class JSONParseError extends Error {
+
+ /** The location in the string where the error occurred */
+ private var _location:int;
+
+ /** The string in which the parse error occurred */
+ private var _text:String;
+
+ /**
+ * Constructs a new JSONParseError.
+ *
+ * @param message The error message that occured during parsing
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
+ super( message );
+ name = "JSONParseError";
+ _location = location;
+ _text = text;
+ }
+
+ /**
+ * Provides read-only access to the location variable.
+ *
+ * @return The location in the string where the error occurred
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function get location():int {
+ return _location;
+ }
+
+ /**
+ * Provides read-only access to the text variable.
+ *
+ * @return The string in which the error occurred
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function get text():String {
+ return _text;
+ }
+ }
+
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONToken.as b/vendors/uploadify/com/adobe/serialization/json/JSONToken.as new file mode 100644 index 000000000..258d63c8a --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONToken.as @@ -0,0 +1,104 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ public class JSONToken {
+
+ private var _type:int;
+ private var _value:Object;
+
+ /**
+ * Creates a new JSONToken with a specific token type and value.
+ *
+ * @param type The JSONTokenType of the token
+ * @param value The value of the token
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
+ _type = type;
+ _value = value;
+ }
+
+ /**
+ * Returns the type of the token.
+ *
+ * @see com.adobe.serialization.json.JSONTokenType
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function get type():int {
+ return _type;
+ }
+
+ /**
+ * Sets the type of the token.
+ *
+ * @see com.adobe.serialization.json.JSONTokenType
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function set type( value:int ):void {
+ _type = value;
+ }
+
+ /**
+ * Gets the value of the token
+ *
+ * @see com.adobe.serialization.json.JSONTokenType
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function get value():Object {
+ return _value;
+ }
+
+ /**
+ * Sets the value of the token
+ *
+ * @see com.adobe.serialization.json.JSONTokenType
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public function set value ( v:Object ):void {
+ _value = v;
+ }
+
+ }
+
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONTokenType.as b/vendors/uploadify/com/adobe/serialization/json/JSONTokenType.as new file mode 100644 index 000000000..fceb3f030 --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONTokenType.as @@ -0,0 +1,67 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ /**
+ * Class containing constant values for the different types
+ * of tokens in a JSON encoded string.
+ */
+ public class JSONTokenType {
+
+ public static const UNKNOWN:int = -1;
+
+ public static const COMMA:int = 0;
+
+ public static const LEFT_BRACE:int = 1;
+
+ public static const RIGHT_BRACE:int = 2;
+
+ public static const LEFT_BRACKET:int = 3;
+
+ public static const RIGHT_BRACKET:int = 4;
+
+ public static const COLON:int = 6;
+
+ public static const TRUE:int = 7;
+
+ public static const FALSE:int = 8;
+
+ public static const NULL:int = 9;
+
+ public static const STRING:int = 10;
+
+ public static const NUMBER:int = 11;
+
+ }
+
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/serialization/json/JSONTokenizer.as b/vendors/uploadify/com/adobe/serialization/json/JSONTokenizer.as new file mode 100644 index 000000000..dc36bfcdd --- /dev/null +++ b/vendors/uploadify/com/adobe/serialization/json/JSONTokenizer.as @@ -0,0 +1,583 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.serialization.json {
+
+ public class JSONTokenizer {
+
+ /** The object that will get parsed from the JSON string */
+ private var obj:Object;
+
+ /** The JSON string to be parsed */
+ private var jsonString:String;
+
+ /** The current parsing location in the JSON string */
+ private var loc:int;
+
+ /** The current character in the JSON string during parsing */
+ private var ch:String;
+
+ /**
+ * Constructs a new JSONDecoder to parse a JSON string
+ * into a native object.
+ *
+ * @param s The JSON string to be converted
+ * into a native object
+ */
+ public function JSONTokenizer( s:String ) {
+ jsonString = s;
+ loc = 0;
+
+ // prime the pump by getting the first character
+ nextChar();
+ }
+
+ /**
+ * Gets the next token in the input sting and advances
+ * the character to the next character after the token
+ */
+ public function getNextToken():JSONToken {
+ var token:JSONToken = new JSONToken();
+
+ // skip any whitespace / comments since the last
+ // token was read
+ skipIgnored();
+
+ // examine the new character and see what we have...
+ switch ( ch ) {
+
+ case '{':
+ token.type = JSONTokenType.LEFT_BRACE;
+ token.value = '{';
+ nextChar();
+ break
+
+ case '}':
+ token.type = JSONTokenType.RIGHT_BRACE;
+ token.value = '}';
+ nextChar();
+ break
+
+ case '[':
+ token.type = JSONTokenType.LEFT_BRACKET;
+ token.value = '[';
+ nextChar();
+ break
+
+ case ']':
+ token.type = JSONTokenType.RIGHT_BRACKET;
+ token.value = ']';
+ nextChar();
+ break
+
+ case ',':
+ token.type = JSONTokenType.COMMA;
+ token.value = ',';
+ nextChar();
+ break
+
+ case ':':
+ token.type = JSONTokenType.COLON;
+ token.value = ':';
+ nextChar();
+ break;
+
+ case 't': // attempt to read true
+ var possibleTrue:String = "t" + nextChar() + nextChar() + nextChar();
+
+ if ( possibleTrue == "true" ) {
+ token.type = JSONTokenType.TRUE;
+ token.value = true;
+ nextChar();
+ } else {
+ parseError( "Expecting 'true' but found " + possibleTrue );
+ }
+
+ break;
+
+ case 'f': // attempt to read false
+ var possibleFalse:String = "f" + nextChar() + nextChar() + nextChar() + nextChar();
+
+ if ( possibleFalse == "false" ) {
+ token.type = JSONTokenType.FALSE;
+ token.value = false;
+ nextChar();
+ } else {
+ parseError( "Expecting 'false' but found " + possibleFalse );
+ }
+
+ break;
+
+ case 'n': // attempt to read null
+
+ var possibleNull:String = "n" + nextChar() + nextChar() + nextChar();
+
+ if ( possibleNull == "null" ) {
+ token.type = JSONTokenType.NULL;
+ token.value = null;
+ nextChar();
+ } else {
+ parseError( "Expecting 'null' but found " + possibleNull );
+ }
+
+ break;
+
+ case '"': // the start of a string
+ token = readString();
+ break;
+
+ default:
+ // see if we can read a number
+ if ( isDigit( ch ) || ch == '-' ) {
+ token = readNumber();
+ } else if ( ch == '' ) {
+ // check for reading past the end of the string
+ return null;
+ } else {
+ // not sure what was in the input string - it's not
+ // anything we expected
+ parseError( "Unexpected " + ch + " encountered" );
+ }
+ }
+
+ return token;
+ }
+
+ /**
+ * Attempts to read a string from the input string. Places
+ * the character location at the first character after the
+ * string. It is assumed that ch is " before this method is called.
+ *
+ * @return the JSONToken with the string value if a string could
+ * be read. Throws an error otherwise.
+ */
+ private function readString():JSONToken {
+ // the token for the string we'll try to read
+ var token:JSONToken = new JSONToken();
+ token.type = JSONTokenType.STRING;
+
+ // the string to store the string we'll try to read
+ var string:String = "";
+
+ // advance past the first "
+ nextChar();
+
+ while ( ch != '"' && ch != '' ) {
+
+ // unescape the escape sequences in the string
+ if ( ch == '\\' ) {
+
+ // get the next character so we know what
+ // to unescape
+ nextChar();
+
+ switch ( ch ) {
+
+ case '"': // quotation mark
+ string += '"';
+ break;
+
+ case '/': // solidus
+ string += "/";
+ break;
+
+ case '\\': // reverse solidus
+ string += '\\';
+ break;
+
+ case 'b': // bell
+ string += '\b';
+ break;
+
+ case 'f': // form feed
+ string += '\f';
+ break;
+
+ case 'n': // newline
+ string += '\n';
+ break;
+
+ case 'r': // carriage return
+ string += '\r';
+ break;
+
+ case 't': // horizontal tab
+ string += '\t'
+ break;
+
+ case 'u':
+ // convert a unicode escape sequence
+ // to it's character value - expecting
+ // 4 hex digits
+
+ // save the characters as a string we'll convert to an int
+ var hexValue:String = "";
+
+ // try to find 4 hex characters
+ for ( var i:int = 0; i < 4; i++ ) {
+ // get the next character and determine
+ // if it's a valid hex digit or not
+ if ( !isHexDigit( nextChar() ) ) {
+ parseError( " Excepted a hex digit, but found: " + ch );
+ }
+ // valid, add it to the value
+ hexValue += ch;
+ }
+
+ // convert hexValue to an integer, and use that
+ // integrer value to create a character to add
+ // to our string.
+ string += String.fromCharCode( parseInt( hexValue, 16 ) );
+
+ break;
+
+ default:
+ // couldn't unescape the sequence, so just
+ // pass it through
+ string += '\\' + ch;
+
+ }
+
+ } else {
+ // didn't have to unescape, so add the character to the string
+ string += ch;
+
+ }
+
+ // move to the next character
+ nextChar();
+
+ }
+
+ // we read past the end of the string without closing it, which
+ // is a parse error
+ if ( ch == '' ) {
+ parseError( "Unterminated string literal" );
+ }
+
+ // move past the closing " in the input string
+ nextChar();
+
+ // attach to the string to the token so we can return it
+ token.value = string;
+
+ return token;
+ }
+
+ /**
+ * Attempts to read a number from the input string. Places
+ * the character location at the first character after the
+ * number.
+ *
+ * @return The JSONToken with the number value if a number could
+ * be read. Throws an error otherwise.
+ */
+ private function readNumber():JSONToken {
+ // the token for the number we'll try to read
+ var token:JSONToken = new JSONToken();
+ token.type = JSONTokenType.NUMBER;
+
+ // the string to accumulate the number characters
+ // into that we'll convert to a number at the end
+ var input:String = "";
+
+ // check for a negative number
+ if ( ch == '-' ) {
+ input += '-';
+ nextChar();
+ }
+
+ // the number must start with a digit
+ if ( !isDigit( ch ) )
+ {
+ parseError( "Expecting a digit" );
+ }
+
+ // 0 can only be the first digit if it
+ // is followed by a decimal point
+ if ( ch == '0' )
+ {
+ input += ch;
+ nextChar();
+
+ // make sure no other digits come after 0
+ if ( isDigit( ch ) )
+ {
+ parseError( "A digit cannot immediately follow 0" );
+ }
+// Commented out - this should only be available when "strict" is false
+// // unless we have 0x which starts a hex number\
+// else if ( ch == 'x' )
+// {
+// // include the x in the input
+// input += ch;
+// nextChar();
+//
+// // need at least one hex digit after 0x to
+// // be valid
+// if ( isHexDigit( ch ) )
+// {
+// input += ch;
+// nextChar();
+// }
+// else
+// {
+// parseError( "Number in hex format require at least one hex digit after \"0x\"" );
+// }
+//
+// // consume all of the hex values
+// while ( isHexDigit( ch ) )
+// {
+// input += ch;
+// nextChar();
+// }
+// }
+ }
+ else
+ {
+ // read numbers while we can
+ while ( isDigit( ch ) ) {
+ input += ch;
+ nextChar();
+ }
+ }
+
+ // check for a decimal value
+ if ( ch == '.' ) {
+ input += '.';
+ nextChar();
+
+ // after the decimal there has to be a digit
+ if ( !isDigit( ch ) )
+ {
+ parseError( "Expecting a digit" );
+ }
+
+ // read more numbers to get the decimal value
+ while ( isDigit( ch ) ) {
+ input += ch;
+ nextChar();
+ }
+ }
+
+ // check for scientific notation
+ if ( ch == 'e' || ch == 'E' )
+ {
+ input += "e"
+ nextChar();
+ // check for sign
+ if ( ch == '+' || ch == '-' )
+ {
+ input += ch;
+ nextChar();
+ }
+
+ // require at least one number for the exponent
+ // in this case
+ if ( !isDigit( ch ) )
+ {
+ parseError( "Scientific notation number needs exponent value" );
+ }
+
+ // read in the exponent
+ while ( isDigit( ch ) )
+ {
+ input += ch;
+ nextChar();
+ }
+ }
+
+ // convert the string to a number value
+ var num:Number = Number( input );
+
+ if ( isFinite( num ) && !isNaN( num ) ) {
+ token.value = num;
+ return token;
+ } else {
+ parseError( "Number " + num + " is not valid!" );
+ }
+ return null;
+ }
+
+ /**
+ * Reads the next character in the input
+ * string and advances the character location.
+ *
+ * @return The next character in the input string, or
+ * null if we've read past the end.
+ */
+ private function nextChar():String {
+ return ch = jsonString.charAt( loc++ );
+ }
+
+ /**
+ * Advances the character location past any
+ * sort of white space and comments
+ */
+ private function skipIgnored():void
+ {
+ var originalLoc:int;
+
+ // keep trying to skip whitespace and comments as long
+ // as we keep advancing past the original location
+ do
+ {
+ originalLoc = loc;
+ skipWhite();
+ skipComments();
+ }
+ while ( originalLoc != loc );
+ }
+
+ /**
+ * Skips comments in the input string, either
+ * single-line or multi-line. Advances the character
+ * to the first position after the end of the comment.
+ */
+ private function skipComments():void {
+ if ( ch == '/' ) {
+ // Advance past the first / to find out what type of comment
+ nextChar();
+ switch ( ch ) {
+ case '/': // single-line comment, read through end of line
+
+ // Loop over the characters until we find
+ // a newline or until there's no more characters left
+ do {
+ nextChar();
+ } while ( ch != '\n' && ch != '' )
+
+ // move past the \n
+ nextChar();
+
+ break;
+
+ case '*': // multi-line comment, read until closing */
+
+ // move past the opening *
+ nextChar();
+
+ // try to find a trailing */
+ while ( true ) {
+ if ( ch == '*' ) {
+ // check to see if we have a closing /
+ nextChar();
+ if ( ch == '/') {
+ // move past the end of the closing */
+ nextChar();
+ break;
+ }
+ } else {
+ // move along, looking if the next character is a *
+ nextChar();
+ }
+
+ // when we're here we've read past the end of
+ // the string without finding a closing */, so error
+ if ( ch == '' ) {
+ parseError( "Multi-line comment not closed" );
+ }
+ }
+
+ break;
+
+ // Can't match a comment after a /, so it's a parsing error
+ default:
+ parseError( "Unexpected " + ch + " encountered (expecting '/' or '*' )" );
+ }
+ }
+
+ }
+
+
+ /**
+ * Skip any whitespace in the input string and advances
+ * the character to the first character after any possible
+ * whitespace.
+ */
+ private function skipWhite():void {
+
+ // As long as there are spaces in the input
+ // stream, advance the current location pointer
+ // past them
+ while ( isWhiteSpace( ch ) ) {
+ nextChar();
+ }
+
+ }
+
+ /**
+ * Determines if a character is whitespace or not.
+ *
+ * @return True if the character passed in is a whitespace
+ * character
+ */
+ private function isWhiteSpace( ch:String ):Boolean {
+ return ( ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' );
+ }
+
+ /**
+ * Determines if a character is a digit [0-9].
+ *
+ * @return True if the character passed in is a digit
+ */
+ private function isDigit( ch:String ):Boolean {
+ return ( ch >= '0' && ch <= '9' );
+ }
+
+ /**
+ * Determines if a character is a digit [0-9].
+ *
+ * @return True if the character passed in is a digit
+ */
+ private function isHexDigit( ch:String ):Boolean {
+ // get the uppercase value of ch so we only have
+ // to compare the value between 'A' and 'F'
+ var uc:String = ch.toUpperCase();
+
+ // a hex digit is a digit of A-F, inclusive ( using
+ // our uppercase constraint )
+ return ( isDigit( ch ) || ( uc >= 'A' && uc <= 'F' ) );
+ }
+
+ /**
+ * Raises a parsing error with a specified message, tacking
+ * on the error location and the original string.
+ *
+ * @param message The message indicating why the error occurred
+ */
+ public function parseError( message:String ):void {
+ throw new JSONParseError( message, loc, jsonString );
+ }
+ }
+
+}
diff --git a/vendors/uploadify/com/adobe/utils/ArrayUtil.as b/vendors/uploadify/com/adobe/utils/ArrayUtil.as new file mode 100644 index 000000000..e65612004 --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/ArrayUtil.as @@ -0,0 +1,187 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.utils
+{
+
+ /**
+ * Class that contains static utility methods for manipulating and working
+ * with Arrays.
+ *
+ * Note that all APIs assume that they are working with well formed arrays.
+ * i.e. they will only manipulate indexed values.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public class ArrayUtil
+ {
+
+ /**
+ * Determines whether the specified array contains the specified value.
+ *
+ * @param arr The array that will be checked for the specified value.
+ *
+ * @param value The object which will be searched for within the array
+ *
+ * @return True if the array contains the value, False if it does not.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function arrayContainsValue(arr:Array, value:Object):Boolean
+ {
+ return (arr.indexOf(value) != -1);
+ }
+
+ /**
+ * Remove all instances of the specified value from the array,
+ *
+ * @param arr The array from which the value will be removed
+ *
+ * @param value The object that will be removed from the array.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function removeValueFromArray(arr:Array, value:Object):void
+ {
+ var len:uint = arr.length;
+
+ for(var i:Number = len; i > -1; i--)
+ {
+ if(arr[i] === value)
+ {
+ arr.splice(i, 1);
+ }
+ }
+ }
+
+ /**
+ * Create a new array that only contains unique instances of objects
+ * in the specified array.
+ *
+ * Basically, this can be used to remove duplication object instances
+ * from an array
+ *
+ * @param arr The array which contains the values that will be used to
+ * create the new array that contains no duplicate values.
+ *
+ * @return A new array which only contains unique items from the specified
+ * array.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function createUniqueCopy(a:Array):Array
+ {
+ var newArray:Array = new Array();
+
+ var len:Number = a.length;
+ var item:Object;
+
+ for (var i:uint = 0; i < len; ++i)
+ {
+ item = a[i];
+
+ if(ArrayUtil.arrayContainsValue(newArray, item))
+ {
+ continue;
+ }
+
+ newArray.push(item);
+ }
+
+ return newArray;
+ }
+
+ /**
+ * Creates a copy of the specified array.
+ *
+ * Note that the array returned is a new array but the items within the
+ * array are not copies of the items in the original array (but rather
+ * references to the same items)
+ *
+ * @param arr The array that will be copies
+ *
+ * @return A new array which contains the same items as the array passed
+ * in.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function copyArray(arr:Array):Array
+ {
+ return arr.slice();
+ }
+
+ /**
+ * Compares two arrays and returns a boolean indicating whether the arrays
+ * contain the same values at the same indexes.
+ *
+ * @param arr1 The first array that will be compared to the second.
+ *
+ * @param arr2 The second array that will be compared to the first.
+ *
+ * @return True if the arrays contains the same values at the same indexes.
+ False if they do not.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean
+ {
+ if(arr1.length != arr2.length)
+ {
+ return false;
+ }
+
+ var len:Number = arr1.length;
+
+ for(var i:Number = 0; i < len; i++)
+ {
+ if(arr1[i] !== arr2[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/vendors/uploadify/com/adobe/utils/DateUtil.as b/vendors/uploadify/com/adobe/utils/DateUtil.as new file mode 100644 index 000000000..a49fe433e --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/DateUtil.as @@ -0,0 +1,699 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + import mx.formatters.DateBase; + + /** + * Class that contains static utility methods for manipulating and working + * with Dates. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public class DateUtil + { + + /** + * Returns the English Short Month name (3 letters) for the Month that + * the Date represents. + * + * @param d The Date instance whose month will be used to retrieve the + * short month name. + * + * @return An English 3 Letter Month abbreviation. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_MONTH + */ + public static function getShortMonthName(d:Date):String + { + return DateBase.monthNamesShort[d.getMonth()]; + } + + /** + * Returns the index of the month that the short month name string + * represents. + * + * @param m The 3 letter abbreviation representing a short month name. + * + * @param Optional parameter indicating whether the search should be case + * sensitive + * + * @return A int that represents that month represented by the specifed + * short name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_MONTH + */ + public static function getShortMonthIndex(m:String):int + { + return DateBase.monthNamesShort.indexOf(m); + } + + /** + * Returns the English full Month name for the Month that + * the Date represents. + * + * @param d The Date instance whose month will be used to retrieve the + * full month name. + * + * @return An English full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_MONTH + */ + public static function getFullMonthName(d:Date):String + { + return DateBase.monthNamesLong[d.getMonth()]; + } + + /** + * Returns the index of the month that the full month name string + * represents. + * + * @param m A full month name. + * + * @return A int that represents that month represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_MONTH + */ + public static function getFullMonthIndex(m:String):int + { + return DateBase.monthNamesLong.indexOf(m); + } + + /** + * Returns the English Short Day name (3 letters) for the day that + * the Date represents. + * + * @param d The Date instance whose day will be used to retrieve the + * short day name. + * + * @return An English 3 Letter day abbreviation. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_DAY + */ + public static function getShortDayName(d:Date):String + { + return DateBase.dayNamesShort[d.getDay()]; + } + + /** + * Returns the index of the day that the short day name string + * represents. + * + * @param m A short day name. + * + * @return A int that represents that short day represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_DAY + */ + public static function getShortDayIndex(d:String):int + { + return DateBase.dayNamesShort.indexOf(d); + } + + /** + * Returns the English full day name for the day that + * the Date represents. + * + * @param d The Date instance whose day will be used to retrieve the + * full day name. + * + * @return An English full day name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_DAY + */ + public static function getFullDayName(d:Date):String + { + return DateBase.dayNamesLong[d.getDay()]; + } + + /** + * Returns the index of the day that the full day name string + * represents. + * + * @param m A full day name. + * + * @return A int that represents that full day represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_DAY + */ + public static function getFullDayIndex(d:String):int + { + return DateBase.dayNamesLong.indexOf(d); + } + + /** + * Returns a two digit representation of the year represented by the + * specified date. + * + * @param d The Date instance whose year will be used to generate a two + * digit string representation of the year. + * + * @return A string that contains a 2 digit representation of the year. + * Single digits will be padded with 0. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getShortYear(d:Date):String + { + var dStr:String = String(d.getFullYear()); + + if(dStr.length < 3) + { + return dStr; + } + + return (dStr.substr(dStr.length - 2)); + } + + /** + * Compares two dates and returns an integer depending on their relationship. + * + * Returns -1 if d1 is greater than d2. + * Returns 1 if d2 is greater than d1. + * Returns 0 if both dates are equal. + * + * @param d1 The date that will be compared to the second date. + * @param d2 The date that will be compared to the first date. + * + * @return An int indicating how the two dates compare. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function compareDates(d1:Date, d2:Date):int + { + var d1ms:Number = d1.getTime(); + var d2ms:Number = d2.getTime(); + + if(d1ms > d2ms) + { + return -1; + } + else if(d1ms < d2ms) + { + return 1; + } + else + { + return 0; + } + } + + /** + * Returns a short hour (0 - 12) represented by the specified date. + * + * If the hour is less than 12 (0 - 11 AM) then the hour will be returned. + * + * If the hour is greater than 12 (12 - 23 PM) then the hour minus 12 + * will be returned. + * + * @param d1 The Date from which to generate the short hour + * + * @return An int between 0 and 13 ( 1 - 12 ) representing the short hour. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getShortHour(d:Date):int + { + var h:int = d.hours; + + if(h == 0 || h == 12) + { + return 12; + } + else if(h > 12) + { + return h - 12; + } + else + { + return h; + } + } + + /** + * Returns a string indicating whether the date represents a time in the + * ante meridiem (AM) or post meridiem (PM). + * + * If the hour is less than 12 then "AM" will be returned. + * + * If the hour is greater than 12 then "PM" will be returned. + * + * @param d1 The Date from which to generate the 12 hour clock indicator. + * + * @return A String ("AM" or "PM") indicating which half of the day the + * hour represents. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getAMPM(d:Date):String + { + return (d.hours > 11)? "PM" : "AM"; + } + + /** + * Parses dates that conform to RFC822 into Date objects. This method also + * supports four-digit years (not supported in RFC822), but two-digit years + * (referring to the 20th century) are fine, too. + * + * This function is useful for parsing RSS .91, .92, and 2.0 dates. + * + * @param str + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://asg.web.cmu.edu/rfc/rfc822.html + */ + public static function parseRFC822(str:String):Date + { + var finalDate:Date; + try + { + var dateParts:Array = str.split(" "); + var day:String = null; + + if (dateParts[0].search(/\d/) == -1) + { + day = dateParts.shift().replace(/\W/, ""); + } + + var date:Number = Number(dateParts.shift()); + var month:Number = Number(DateUtil.getShortMonthIndex(dateParts.shift())); + var year:Number = Number(dateParts.shift()); + var timeParts:Array = dateParts.shift().split(":"); + var hour:Number = int(timeParts.shift()); + var minute:Number = int(timeParts.shift()); + var second:Number = (timeParts.length > 0) ? int(timeParts.shift()): 0; + + var milliseconds:Number = Date.UTC(year, month, date, hour, minute, second, 0); + + var timezone:String = dateParts.shift(); + var offset:Number = 0; + + if (timezone.search(/\d/) == -1) + { + switch(timezone) + { + case "UT": + offset = 0; + break; + case "UTC": + offset = 0; + break; + case "GMT": + offset = 0; + break; + case "EST": + offset = (-5 * 3600000); + break; + case "EDT": + offset = (-4 * 3600000); + break; + case "CST": + offset = (-6 * 3600000); + break; + case "CDT": + offset = (-5 * 3600000); + break; + case "MST": + offset = (-7 * 3600000); + break; + case "MDT": + offset = (-6 * 3600000); + break; + case "PST": + offset = (-8 * 3600000); + break; + case "PDT": + offset = (-7 * 3600000); + break; + case "Z": + offset = 0; + break; + case "A": + offset = (-1 * 3600000); + break; + case "M": + offset = (-12 * 3600000); + break; + case "N": + offset = (1 * 3600000); + break; + case "Y": + offset = (12 * 3600000); + break; + default: + offset = 0; + } + } + else + { + var multiplier:Number = 1; + var oHours:Number = 0; + var oMinutes:Number = 0; + if (timezone.length != 4) + { + if (timezone.charAt(0) == "-") + { + multiplier = -1; + } + timezone = timezone.substr(1, 4); + } + oHours = Number(timezone.substr(0, 2)); + oMinutes = Number(timezone.substr(2, 2)); + offset = (((oHours * 3600000) + (oMinutes * 60000)) * multiplier); + } + + finalDate = new Date(milliseconds - offset); + + if (finalDate.toString() == "Invalid Date") + { + throw new Error("This date does not conform to RFC822."); + } + } + catch (e:Error) + { + var eStr:String = "Unable to parse the string [" +str+ "] into a date. "; + eStr += "The internal error was: " + e.toString(); + throw new Error(eStr); + } + return finalDate; + } + + /** + * Returns a date string formatted according to RFC822. + * + * @param d + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://asg.web.cmu.edu/rfc/rfc822.html + */ + public static function toRFC822(d:Date):String + { + var date:Number = d.getUTCDate(); + var hours:Number = d.getUTCHours(); + var minutes:Number = d.getUTCMinutes(); + var seconds:Number = d.getUTCSeconds(); + var sb:String = new String(); + sb += DateBase.dayNamesShort[d.getUTCDay()]; + sb += ", "; + + if (date < 10) + { + sb += "0"; + } + sb += date; + sb += " "; + //sb += DateUtil.SHORT_MONTH[d.getUTCMonth()]; + sb += DateBase.monthNamesShort[d.getUTCMonth()]; + sb += " "; + sb += d.getUTCFullYear(); + sb += " "; + if (hours < 10) + { + sb += "0"; + } + sb += hours; + sb += ":"; + if (minutes < 10) + { + sb += "0"; + } + sb += minutes; + sb += ":"; + if (seconds < 10) + { + sb += "0"; + } + sb += seconds; + sb += " GMT"; + return sb; + } + + /** + * Parses dates that conform to the W3C Date-time Format into Date objects. + * + * This function is useful for parsing RSS 1.0 and Atom 1.0 dates. + * + * @param str + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://www.w3.org/TR/NOTE-datetime + */ + public static function parseW3CDTF(str:String):Date + { + var finalDate:Date; + try + { + var dateStr:String = str.substring(0, str.indexOf("T")); + var timeStr:String = str.substring(str.indexOf("T")+1, str.length); + var dateArr:Array = dateStr.split("-"); + var year:Number = Number(dateArr.shift()); + var month:Number = Number(dateArr.shift()); + var date:Number = Number(dateArr.shift()); + + var multiplier:Number; + var offsetHours:Number; + var offsetMinutes:Number; + var offsetStr:String; + + if (timeStr.indexOf("Z") != -1) + { + multiplier = 1; + offsetHours = 0; + offsetMinutes = 0; + timeStr = timeStr.replace("Z", ""); + } + else if (timeStr.indexOf("+") != -1) + { + multiplier = 1; + offsetStr = timeStr.substring(timeStr.indexOf("+")+1, timeStr.length); + offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":"))); + offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length)); + timeStr = timeStr.substring(0, timeStr.indexOf("+")); + } + else // offset is - + { + multiplier = -1; + offsetStr = timeStr.substring(timeStr.indexOf("-")+1, timeStr.length); + offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":"))); + offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length)); + timeStr = timeStr.substring(0, timeStr.indexOf("-")); + } + var timeArr:Array = timeStr.split(":"); + var hour:Number = Number(timeArr.shift()); + var minutes:Number = Number(timeArr.shift()); + var secondsArr:Array = (timeArr.length > 0) ? String(timeArr.shift()).split(".") : null; + var seconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0; + var milliseconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0; + var utc:Number = Date.UTC(year, month-1, date, hour, minutes, seconds, milliseconds); + var offset:Number = (((offsetHours * 3600000) + (offsetMinutes * 60000)) * multiplier); + finalDate = new Date(utc - offset); + + if (finalDate.toString() == "Invalid Date") + { + throw new Error("This date does not conform to W3CDTF."); + } + } + catch (e:Error) + { + var eStr:String = "Unable to parse the string [" +str+ "] into a date. "; + eStr += "The internal error was: " + e.toString(); + throw new Error(eStr); + } + return finalDate; + } + + /** + * Returns a date string formatted according to W3CDTF. + * + * @param d + * @param includeMilliseconds Determines whether to include the + * milliseconds value (if any) in the formatted string. + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://www.w3.org/TR/NOTE-datetime + */ + public static function toW3CDTF(d:Date,includeMilliseconds:Boolean=false):String + { + var date:Number = d.getUTCDate(); + var month:Number = d.getUTCMonth(); + var hours:Number = d.getUTCHours(); + var minutes:Number = d.getUTCMinutes(); + var seconds:Number = d.getUTCSeconds(); + var milliseconds:Number = d.getUTCMilliseconds(); + var sb:String = new String(); + + sb += d.getUTCFullYear(); + sb += "-"; + + //thanks to "dom" who sent in a fix for the line below + if (month + 1 < 10) + { + sb += "0"; + } + sb += month + 1; + sb += "-"; + if (date < 10) + { + sb += "0"; + } + sb += date; + sb += "T"; + if (hours < 10) + { + sb += "0"; + } + sb += hours; + sb += ":"; + if (minutes < 10) + { + sb += "0"; + } + sb += minutes; + sb += ":"; + if (seconds < 10) + { + sb += "0"; + } + sb += seconds; + if (includeMilliseconds && milliseconds > 0) + { + sb += "."; + sb += milliseconds; + } + sb += "-00:00"; + return sb; + } + + /** + * Converts a date into just after midnight. + */ + public static function makeMorning(d:Date):Date + { + var d:Date = new Date(d.time); + d.hours = 0; + d.minutes = 0; + d.seconds = 0; + d.milliseconds = 0; + return d; + } + + /** + * Converts a date into just befor midnight. + */ + public static function makeNight(d:Date):Date + { + var d:Date = new Date(d.time); + d.hours = 23; + d.minutes = 59; + d.seconds = 59; + d.milliseconds = 999; + return d; + } + + /** + * Sort of converts a date into UTC. + */ + public static function getUTCDate(d:Date):Date + { + var nd:Date = new Date(); + var offset:Number = d.getTimezoneOffset() * 60 * 1000; + nd.setTime(d.getTime() + offset); + return nd; + } + } +} diff --git a/vendors/uploadify/com/adobe/utils/DictionaryUtil.as b/vendors/uploadify/com/adobe/utils/DictionaryUtil.as new file mode 100644 index 000000000..9552ef494 --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/DictionaryUtil.as @@ -0,0 +1,87 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + import flash.utils.Dictionary; + + public class DictionaryUtil + { + + /** + * Returns an Array of all keys within the specified dictionary. + * + * @param d The Dictionary instance whose keys will be returned. + * + * @return Array of keys contained within the Dictionary + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getKeys(d:Dictionary):Array + { + var a:Array = new Array(); + + for (var key:Object in d) + { + a.push(key); + } + + return a; + } + + /** + * Returns an Array of all values within the specified dictionary. + * + * @param d The Dictionary instance whose values will be returned. + * + * @return Array of values contained within the Dictionary + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getValues(d:Dictionary):Array + { + var a:Array = new Array(); + + for each (var value:Object in d) + { + a.push(value); + } + + return a; + } + + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/utils/IntUtil.as b/vendors/uploadify/com/adobe/utils/IntUtil.as new file mode 100644 index 000000000..8c812fe08 --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/IntUtil.as @@ -0,0 +1,99 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package com.adobe.utils {
+
+ import flash.utils.Endian;
+
+ /**
+ * Contains reusable methods for operations pertaining
+ * to int values.
+ */
+ public class IntUtil {
+
+ /**
+ * Rotates x left n bits
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function rol ( x:int, n:int ):int {
+ return ( x << n ) | ( x >>> ( 32 - n ) );
+ }
+
+ /**
+ * Rotates x right n bits
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function ror ( x:int, n:int ):uint {
+ var nn:int = 32 - n;
+ return ( x << nn ) | ( x >>> ( 32 - nn ) );
+ }
+
+ /** String for quick lookup of a hex character based on index */
+ private static var hexChars:String = "0123456789abcdef";
+
+ /**
+ * Outputs the hex value of a int, allowing the developer to specify
+ * the endinaness in the process. Hex output is lowercase.
+ *
+ * @param n The int value to output as hex
+ * @param bigEndian Flag to output the int as big or little endian
+ * @return A string of length 8 corresponding to the
+ * hex representation of n ( minus the leading "0x" )
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function toHex( n:int, bigEndian:Boolean = false ):String {
+ var s:String = "";
+
+ if ( bigEndian ) {
+ for ( var i:int = 0; i < 4; i++ ) {
+ s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF )
+ + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF );
+ }
+ } else {
+ for ( var x:int = 0; x < 4; x++ ) {
+ s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF )
+ + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF );
+ }
+ }
+
+ return s;
+ }
+ }
+
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/utils/NumberFormatter.as b/vendors/uploadify/com/adobe/utils/NumberFormatter.as new file mode 100644 index 000000000..6fe12e145 --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/NumberFormatter.as @@ -0,0 +1,74 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.utils
+{
+
+ /**
+ * Class that contains static utility methods for formatting Numbers
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ *
+ * @see #mx.formatters.NumberFormatter
+ */
+ public class NumberFormatter
+ {
+
+ /**
+ * Formats a number to include a leading zero if it is a single digit
+ * between -1 and 10.
+ *
+ * @param n The number that will be formatted
+ *
+ * @return A string with single digits between -1 and 10 padded with a
+ * leading zero.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ * @tiptext
+ */
+ public static function addLeadingZero(n:Number):String
+ {
+ var out:String = String(n);
+
+ if(n < 10 && n > -1)
+ {
+ out = "0" + out;
+ }
+
+ return out;
+ }
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/utils/StringUtil.as b/vendors/uploadify/com/adobe/utils/StringUtil.as new file mode 100644 index 000000000..6aa1979fd --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/StringUtil.as @@ -0,0 +1,270 @@ +/* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + + /** + * Class that contains static utility methods for manipulating Strings. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public class StringUtil + { + + + /** + * Does a case insensitive compare or two strings and returns true if + * they are equal. + * + * @param s1 The first string to compare. + * + * @param s2 The second string to compare. + * + * @returns A boolean value indicating whether the strings' values are + * equal in a case sensitive compare. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function stringsAreEqual(s1:String, s2:String, + caseSensitive:Boolean):Boolean + { + if(caseSensitive) + { + return (s1 == s2); + } + else + { + return (s1.toUpperCase() == s2.toUpperCase()); + } + } + + /** + * Removes whitespace from the front and the end of the specified + * string. + * + * @param input The String whose beginning and ending whitespace will + * will be removed. + * + * @returns A String with whitespace removed from the begining and end + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function trim(input:String):String + { + return StringUtil.ltrim(StringUtil.rtrim(input)); + } + + /** + * Removes whitespace from the front of the specified string. + * + * @param input The String whose beginning whitespace will will be removed. + * + * @returns A String with whitespace removed from the begining + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function ltrim(input:String):String + { + var size:Number = input.length; + for(var i:Number = 0; i < size; i++) + { + if(input.charCodeAt(i) > 32) + { + return input.substring(i); + } + } + return ""; + } + + /** + * Removes whitespace from the end of the specified string. + * + * @param input The String whose ending whitespace will will be removed. + * + * @returns A String with whitespace removed from the end + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function rtrim(input:String):String + { + var size:Number = input.length; + for(var i:Number = size; i > 0; i--) + { + if(input.charCodeAt(i - 1) > 32) + { + return input.substring(0, i); + } + } + + return ""; + } + + /** + * Determines whether the specified string begins with the spcified prefix. + * + * @param input The string that the prefix will be checked against. + * + * @param prefix The prefix that will be tested against the string. + * + * @returns True if the string starts with the prefix, false if it does not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function beginsWith(input:String, prefix:String):Boolean + { + return (prefix == input.substring(0, prefix.length)); + } + + /** + * Determines whether the specified string ends with the spcified suffix. + * + * @param input The string that the suffic will be checked against. + * + * @param prefix The suffic that will be tested against the string. + * + * @returns True if the string ends with the suffix, false if it does not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function endsWith(input:String, suffix:String):Boolean + { + return (suffix == input.substring(input.length - suffix.length)); + } + + /** + * Removes all instances of the remove string in the input string. + * + * @param input The string that will be checked for instances of remove + * string + * + * @param remove The string that will be removed from the input string. + * + * @returns A String with the remove string removed. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function remove(input:String, remove:String):String + { + return StringUtil.replace(input, remove, ""); + } + + /** + * Replaces all instances of the replace string in the input string + * with the replaceWith string. + * + * @param input The string that instances of replace string will be + * replaces with removeWith string. + * + * @param replace The string that will be replaced by instances of + * the replaceWith string. + * + * @param replaceWith The string that will replace instances of replace + * string. + * + * @returns A new String with the replace string replaced with the + * replaceWith string. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function replace(input:String, replace:String, replaceWith:String):String + { + //change to StringBuilder + var sb:String = new String(); + var found:Boolean = false; + + var sLen:Number = input.length; + var rLen:Number = replace.length; + + for (var i:Number = 0; i < sLen; i++) + { + if(input.charAt(i) == replace.charAt(0)) + { + found = true; + for(var j:Number = 0; j < rLen; j++) + { + if(!(input.charAt(i + j) == replace.charAt(j))) + { + found = false; + break; + } + } + + if(found) + { + sb += replaceWith; + i = i + (rLen - 1); + continue; + } + } + sb += input.charAt(i); + } + //TODO : if the string is not found, should we return the original + //string? + return sb; + } + + /** + * Specifies whether the specified string is either non-null, or contains + * characters (i.e. length is greater that 0) + * + * @param s The string which is being checked for a value + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function stringHasValue(s:String):Boolean + { + //todo: this needs a unit test + return (s != null && s.length > 0); + } + } +}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/utils/XMLUtil.as b/vendors/uploadify/com/adobe/utils/XMLUtil.as new file mode 100644 index 000000000..24fce00fa --- /dev/null +++ b/vendors/uploadify/com/adobe/utils/XMLUtil.as @@ -0,0 +1,168 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.utils
+{
+
+ public class XMLUtil
+ {
+ /**
+ * Constant representing a text node type returned from XML.nodeKind.
+ *
+ * @see XML.nodeKind()
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static const TEXT:String = "text";
+
+ /**
+ * Constant representing a comment node type returned from XML.nodeKind.
+ *
+ * @see XML.nodeKind()
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static const COMMENT:String = "comment";
+
+ /**
+ * Constant representing a processing instruction type returned from XML.nodeKind.
+ *
+ * @see XML.nodeKind()
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static const PROCESSING_INSTRUCTION:String = "processing-instruction";
+
+ /**
+ * Constant representing an attribute type returned from XML.nodeKind.
+ *
+ * @see XML.nodeKind()
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static const ATTRIBUTE:String = "attribute";
+
+ /**
+ * Constant representing a element type returned from XML.nodeKind.
+ *
+ * @see XML.nodeKind()
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static const ELEMENT:String = "element";
+
+ /**
+ * Checks whether the specified string is valid and well formed XML.
+ *
+ * @param data The string that is being checked to see if it is valid XML.
+ *
+ * @return A Boolean value indicating whether the specified string is
+ * valid XML.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static function isValidXML(data:String):Boolean
+ {
+ var xml:XML;
+
+ try
+ {
+ xml = new XML(data);
+ }
+ catch(e:Error)
+ {
+ return false;
+ }
+
+ if(xml.nodeKind() != XMLUtil.ELEMENT)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the next sibling of the specified node relative to the node's parent.
+ *
+ * @param x The node whose next sibling will be returned.
+ *
+ * @return The next sibling of the node. null if the node does not have
+ * a sibling after it, or if the node has no parent.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static function getNextSibling(x:XML):XML
+ {
+ return XMLUtil.getSiblingByIndex(x, 1);
+ }
+
+ /**
+ * Returns the sibling before the specified node relative to the node's parent.
+ *
+ * @param x The node whose sibling before it will be returned.
+ *
+ * @return The sibling before the node. null if the node does not have
+ * a sibling before it, or if the node has no parent.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public static function getPreviousSibling(x:XML):XML
+ {
+ return XMLUtil.getSiblingByIndex(x, -1);
+ }
+
+ protected static function getSiblingByIndex(x:XML, count:int):XML
+ {
+ var out:XML;
+
+ try
+ {
+ out = x.parent().children()[x.childIndex() + count];
+ }
+ catch(e:Error)
+ {
+ return null;
+ }
+
+ return out;
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/webapis/ServiceBase.as b/vendors/uploadify/com/adobe/webapis/ServiceBase.as new file mode 100644 index 000000000..7080287c0 --- /dev/null +++ b/vendors/uploadify/com/adobe/webapis/ServiceBase.as @@ -0,0 +1,48 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+package com.adobe.webapis
+{
+ import flash.events.EventDispatcher;
+
+ /**
+ * Base class for remote service classes.
+ */
+ public class ServiceBase extends EventDispatcher
+ {
+ public function ServiceBase()
+ {
+ }
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/webapis/URLLoaderBase.as b/vendors/uploadify/com/adobe/webapis/URLLoaderBase.as new file mode 100644 index 000000000..fc0085c45 --- /dev/null +++ b/vendors/uploadify/com/adobe/webapis/URLLoaderBase.as @@ -0,0 +1,108 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package com.adobe.webapis
+{
+ import flash.events.IOErrorEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.events.ProgressEvent;
+
+ import com.adobe.net.DynamicURLLoader;
+
+ /**
+ * Dispatched when data is
+ * received as the download operation progresses.
+ *
+ * @eventType flash.events.ProgressEvent.PROGRESS
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ [Event(name="progress", type="flash.events.ProgressEvent")]
+
+ /**
+ * Dispatched if a call to the server results in a fatal
+ * error that terminates the download.
+ *
+ * @eventType flash.events.IOErrorEvent.IO_ERROR
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ [Event(name="ioError", type="flash.events.IOErrorEvent")]
+
+ /**
+ * A securityError event occurs if a call attempts to
+ * load data from a server outside the security sandbox.
+ *
+ * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ [Event(name="securityError", type="flash.events.SecurityErrorEvent")]
+
+ /**
+ * Base class for services that utilize URLLoader
+ * to communicate with remote APIs / Services.
+ *
+ * @langversion ActionScript 3.0
+ * @playerversion Flash 9.0
+ */
+ public class URLLoaderBase extends ServiceBase
+ {
+ protected function getURLLoader():DynamicURLLoader
+ {
+ var loader:DynamicURLLoader = new DynamicURLLoader();
+ loader.addEventListener("progress", onProgress);
+ loader.addEventListener("ioError", onIOError);
+ loader.addEventListener("securityError", onSecurityError);
+
+ return loader;
+ }
+
+ private function onIOError(event:IOErrorEvent):void
+ {
+ dispatchEvent(event);
+ }
+
+ private function onSecurityError(event:SecurityErrorEvent):void
+ {
+ dispatchEvent(event);
+ }
+
+ private function onProgress(event:ProgressEvent):void
+ {
+ dispatchEvent(event);
+ }
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/com/adobe/webapis/events/ServiceEvent.as b/vendors/uploadify/com/adobe/webapis/events/ServiceEvent.as new file mode 100644 index 000000000..d1aaf3d44 --- /dev/null +++ b/vendors/uploadify/com/adobe/webapis/events/ServiceEvent.as @@ -0,0 +1,75 @@ +/*
+ Copyright (c) 2008, Adobe Systems Incorporated
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Adobe Systems Incorporated nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+package com.adobe.webapis.events
+{
+
+ import flash.events.Event;
+
+ /**
+ * Event class that contains data loaded from remote services.
+ *
+ * @author Mike Chambers
+ */
+ public class ServiceEvent extends Event
+ {
+ private var _data:Object = new Object();;
+
+ /**
+ * Constructor for ServiceEvent class.
+ *
+ * @param type The type of event that the instance represents.
+ */
+ public function ServiceEvent(type:String, bubbles:Boolean = false,
+ cancelable:Boolean=false)
+ {
+ super(type, bubbles, cancelable);
+ }
+
+ /**
+ * This object contains data loaded in response
+ * to remote service calls, and properties associated with that call.
+ */
+ public function get data():Object
+ {
+ return _data;
+ }
+
+ public function set data(d:Object):void
+ {
+ _data = d;
+ }
+
+
+ }
+}
\ No newline at end of file diff --git a/vendors/uploadify/example/_notes/dwsync.xml b/vendors/uploadify/example/_notes/dwsync.xml new file mode 100644 index 000000000..36ecaa56e --- /dev/null +++ b/vendors/uploadify/example/_notes/dwsync.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="index.php" server="ftp.uploadify.com/www.uploadify.com/" local="128911652226450000" remote="128911651800000000" />
+<file name="cancel.png" server="ftp.uploadify.com/www.uploadify.com/" local="128794107540000000" remote="128911638000000000" />
+</dwsync>
\ No newline at end of file diff --git a/vendors/uploadify/example/cancel.png b/vendors/uploadify/example/cancel.png Binary files differnew file mode 100644 index 000000000..1c062ae5d --- /dev/null +++ b/vendors/uploadify/example/cancel.png diff --git a/vendors/uploadify/example/css/_notes/dwsync.xml b/vendors/uploadify/example/css/_notes/dwsync.xml new file mode 100644 index 000000000..049ffa596 --- /dev/null +++ b/vendors/uploadify/example/css/_notes/dwsync.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="default.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911634053800000" remote="128911633800000000" />
+<file name="uploadify.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911650121540000" remote="128911650000000000" />
+</dwsync>
\ No newline at end of file diff --git a/vendors/uploadify/example/css/default.css b/vendors/uploadify/example/css/default.css new file mode 100644 index 000000000..ec5902d47 --- /dev/null +++ b/vendors/uploadify/example/css/default.css @@ -0,0 +1,10 @@ +body {
+ font: 12px/16px Arial, Helvetica, sans-serif;
+}
+#fileQueue {
+ width: 400px;
+ height: 300px;
+ overflow: auto;
+ border: 1px solid #E5E5E5;
+ margin-bottom: 10px;
+}
\ No newline at end of file diff --git a/vendors/uploadify/example/css/uploadify.css b/vendors/uploadify/example/css/uploadify.css new file mode 100644 index 000000000..0cf8c0eaf --- /dev/null +++ b/vendors/uploadify/example/css/uploadify.css @@ -0,0 +1,53 @@ +/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+.uploadifyQueueItem {
+ font: 11px Verdana, Geneva, sans-serif;
+ border: 2px solid #E5E5E5;
+ background-color: #F5F5F5;
+ margin-top: 5px;
+ padding: 10px;
+ width: 350px;
+}
+.uploadifyError {
+ border: 2px solid #FBCBBC !important;
+ background-color: #FDE5DD !important;
+}
+.uploadifyQueueItem .cancel {
+ float: right;
+}
+.uploadifyProgress {
+ background-color: #FFFFFF;
+ border-top: 1px solid #808080;
+ border-left: 1px solid #808080;
+ border-right: 1px solid #C5C5C5;
+ border-bottom: 1px solid #C5C5C5;
+ margin-top: 10px;
+ width: 100%;
+}
+.uploadifyProgressBar {
+ background-color: #0099FF;
+ width: 1px;
+ height: 3px;
+}
\ No newline at end of file diff --git a/vendors/uploadify/example/index.php b/vendors/uploadify/example/index.php new file mode 100644 index 000000000..769d11c61 --- /dev/null +++ b/vendors/uploadify/example/index.php @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Uploadify Example Script</title>
+<link href="/example/css/default.css" rel="stylesheet" type="text/css" />
+<link href="/example/css/uploadify.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="/example/scripts/jquery-1.3.2.min.js"></script>
+<script type="text/javascript" src="/example/scripts/swfobject.js"></script>
+<script type="text/javascript" src="/example/scripts/jquery.uploadify.v2.1.0.min.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#uploadify").uploadify({
+ 'uploader' : 'scripts/uploadify.swf',
+ 'script' : 'scripts/uploadify.php',
+ 'cancelImg' : 'cancel.png',
+ 'folder' : 'uploads',
+ 'queueID' : 'fileQueue',
+ 'auto' : true,
+ 'multi' : true
+ });
+});
+</script>
+</head>
+
+<body>
+<div id="fileQueue"></div>
+<input type="file" name="uploadify" id="uploadify" />
+<p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p>
+</body>
+</html>
diff --git a/vendors/uploadify/example/scripts/_notes/dwsync.xml b/vendors/uploadify/example/scripts/_notes/dwsync.xml new file mode 100644 index 000000000..13ca04347 --- /dev/null +++ b/vendors/uploadify/example/scripts/_notes/dwsync.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="check.php" server="ftp.uploadify.com/www.uploadify.com/" local="128870002502195719" remote="128911633200000000" />
+<file name="expressInstall.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128886114740000000" remote="128911633200000000" />
+<file name="jquery-1.3.2.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128799223180000000" remote="128911633200000000" />
+<file name="jquery.uploadify.v2.0.0.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128911646622270000" remote="128911646400000000" />
+<file name="uploadify.php" server="ftp.uploadify.com/www.uploadify.com/" local="128907148701750000" remote="128911633200000000" />
+<file name="uploadify.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128911508403330000" remote="128911633200000000" />
+<file name="swfobject.js" server="ftp.uploadify.com/www.uploadify.com/" local="128892320400000000" remote="128911637400000000" />
+</dwsync>
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/check.php b/vendors/uploadify/example/scripts/check.php new file mode 100644 index 000000000..d7dc57177 --- /dev/null +++ b/vendors/uploadify/example/scripts/check.php @@ -0,0 +1,35 @@ +<?php
+/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+$fileArray = array();
+foreach ($_POST as $key => $value) {
+ if ($key != 'folder') {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
+ $fileArray[$key] = $value;
+ }
+ }
+}
+echo json_encode($fileArray);
+?>
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/expressInstall.swf b/vendors/uploadify/example/scripts/expressInstall.swf Binary files differnew file mode 100644 index 000000000..0fbf8fca9 --- /dev/null +++ b/vendors/uploadify/example/scripts/expressInstall.swf diff --git a/vendors/uploadify/example/scripts/jquery-1.3.2.min.js b/vendors/uploadify/example/scripts/jquery-1.3.2.min.js new file mode 100644 index 000000000..b1ae21d8b --- /dev/null +++ b/vendors/uploadify/example/scripts/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js b/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js new file mode 100644 index 000000000..04592ffec --- /dev/null +++ b/vendors/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js @@ -0,0 +1,26 @@ +/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)};
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/swfobject.js b/vendors/uploadify/example/scripts/swfobject.js new file mode 100644 index 000000000..8eafe9dd8 --- /dev/null +++ b/vendors/uploadify/example/scripts/swfobject.js @@ -0,0 +1,4 @@ +/* SWFObject v2.2 <http://code.google.com/p/swfobject/> + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/uploadify.php b/vendors/uploadify/example/scripts/uploadify.php new file mode 100644 index 000000000..8bf14a672 --- /dev/null +++ b/vendors/uploadify/example/scripts/uploadify.php @@ -0,0 +1,46 @@ +<?php
+/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+if (!empty($_FILES)) {
+ $tempFile = $_FILES['Filedata']['tmp_name'];
+ $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
+ $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
+
+ // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
+ // $fileTypes = str_replace(';','|',$fileTypes);
+ // $typesArray = split('\|',$fileTypes);
+ // $fileParts = pathinfo($_FILES['Filedata']['name']);
+
+ // if (in_array($fileParts['extension'],$typesArray)) {
+ // Uncomment the following line if you want to make the directory if it doesn't exist
+ // mkdir(str_replace('//','/',$targetPath), 0755, true);
+
+ move_uploaded_file($tempFile,$targetFile);
+ echo "1";
+ // } else {
+ // echo 'Invalid file type.';
+ // }
+}
+?>
\ No newline at end of file diff --git a/vendors/uploadify/example/scripts/uploadify.swf b/vendors/uploadify/example/scripts/uploadify.swf Binary files differnew file mode 100644 index 000000000..4d27952f5 --- /dev/null +++ b/vendors/uploadify/example/scripts/uploadify.swf diff --git a/vendors/uploadify/expressInstall.swf b/vendors/uploadify/expressInstall.swf Binary files differnew file mode 100644 index 000000000..0fbf8fca9 --- /dev/null +++ b/vendors/uploadify/expressInstall.swf diff --git a/vendors/uploadify/jquery-1.3.2.min.js b/vendors/uploadify/jquery-1.3.2.min.js new file mode 100644 index 000000000..b1ae21d8b --- /dev/null +++ b/vendors/uploadify/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/vendors/uploadify/jquery.uploadify.v2.1.0.js b/vendors/uploadify/jquery.uploadify.v2.1.0.js new file mode 100644 index 000000000..9a78cd32d --- /dev/null +++ b/vendors/uploadify/jquery.uploadify.v2.1.0.js @@ -0,0 +1,258 @@ +/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+if(jQuery)(
+ function(jQuery){
+ jQuery.extend(jQuery.fn,{
+ uploadify:function(options) {
+ jQuery(this).each(function(){
+ settings = jQuery.extend({
+ id : jQuery(this).attr('id'), // The ID of the object being Uploadified
+ uploader : 'uploadify.swf', // The path to the uploadify swf file
+ script : 'uploadify.php', // The path to the uploadify backend upload script
+ expressInstall : null, // The path to the express install swf file
+ folder : '', // The path to the upload folder
+ height : 30, // The height of the flash button
+ width : 110, // The width of the flash button
+ cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container
+ wmode : 'opaque', // The wmode of the flash file
+ scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains
+ fileDataName : 'Filedata', // The name of the file collection object in the backend upload script
+ method : 'POST', // The method for sending variables to the backend upload script
+ queueSizeLimit : 999, // The maximum size of the file queue
+ simUploadLimit : 1, // The number of simultaneous uploads allowed
+ queueID : false, // The optional ID of the queue container
+ displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item
+ onInit : function() {}, // Function to run when uploadify is initialized
+ onSelect : function() {}, // Function to run when a file is selected
+ onQueueFull : function() {}, // Function to run when the queue reaches capacity
+ onCheck : function() {}, // Function to run when script checks for duplicate files on the server
+ onCancel : function() {}, // Function to run when an item is cleared from the queue
+ onError : function() {}, // Function to run when an upload item returns an error
+ onProgress : function() {}, // Function to run each time the upload progress is updated
+ onComplete : function() {}, // Function to run when an upload is completed
+ onAllComplete : function() {} // Functino to run when all uploads are completed
+ }, options);
+ var pagePath = location.pathname;
+ pagePath = pagePath.split('/');
+ pagePath.pop();
+ pagePath = pagePath.join('/') + '/';
+ var data = {};
+ data.uploadifyID = settings.id;
+ data.pagepath = pagePath;
+ if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
+ if (settings.buttonText) data.buttonText = escape(settings.buttonText);
+ if (settings.rollover) data.rollover = true;
+ data.script = settings.script;
+ data.folder = escape(settings.folder);
+ if (settings.scriptData) {
+ var scriptDataString = '';
+ for (var name in settings.scriptData) {
+ scriptDataString += '&' + name + '=' + settings.scriptData[name];
+ }
+ data.scriptData = escape(scriptDataString.substr(1));
+ }
+ data.width = settings.width;
+ data.height = settings.height;
+ data.wmode = settings.wmode;
+ data.method = settings.method;
+ data.queueSizeLimit = settings.queueSizeLimit;
+ data.simUploadLimit = settings.simUploadLimit;
+ if (settings.hideButton) data.hideButton = true;
+ if (settings.fileDesc) data.fileDesc = settings.fileDesc;
+ if (settings.fileExt) data.fileExt = settings.fileExt;
+ if (settings.multi) data.multi = true;
+ if (settings.auto) data.auto = true;
+ if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit;
+ if (settings.checkScript) data.checkScript = settings.checkScript;
+ if (settings.fileDataName) data.fileDataName = settings.fileDataName;
+ if (settings.queueID) data.queueID = settings.queueID;
+ if (settings.onInit() !== false) {
+ jQuery(this).css('display','none');
+ jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');
+ 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});
+ if (settings.queueID == false) {
+ jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');
+ }
+ }
+ if (typeof(settings.onOpen) == 'function') {
+ jQuery(this).bind("uploadifyOpen", settings.onOpen);
+ }
+ jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {
+ if (event.data.action(event, ID, fileObj) !== false) {
+ var byteSize = Math.round(fileObj.size / 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];
+ }
+ if (fileObj.name.length > 20) {
+ fileName = fileObj.name.substr(0,20) + '...';
+ } else {
+ fileName = fileObj.name;
+ }
+ queue = '#' + jQuery(this).attr('id') + 'Queue';
+ if (event.data.queueID) {
+ queue = '#' + event.data.queueID;
+ }
+ jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\
+ <div class="cancel">\
+ <a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>\
+ </div>\
+ <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\
+ <div class="uploadifyProgress">\
+ <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
+ </div>\
+ </div>');
+ }
+ });
+ if (typeof(settings.onSelectOnce) == 'function') {
+ jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce);
+ }
+ jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) {
+ if (event.data.action(event, queueSizeLimit) !== false) {
+ alert('The queue is full. The max size is ' + queueSizeLimit + '.');
+ }
+ });
+ jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {
+ var postData = new Object();
+ postData = fileQueueObj;
+ postData.folder = pagePath + folder;
+ if (single) {
+ for (var ID in fileQueueObj) {
+ var singleFileID = ID;
+ }
+ }
+ jQuery.post(checkScript, postData, function(data) {
+ for(var key in data) {
+ if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) {
+ var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
+ if (!replaceFile) {
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true);
+ }
+ }
+ }
+ if (single) {
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);
+ } else {
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);
+ }
+ }, "json");
+ });
+ jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) {
+ if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
+ var fadeSpeed = (clearFast == true) ? 0 : 250;
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });
+ }
+ });
+ if (typeof(settings.onClearQueue) == 'function') {
+ jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue);
+ }
+ var errorArray = [];
+ jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {
+ if (event.data.action(event, ID, fileObj, errorObj) !== false) {
+ var fileArray = new Array(ID, fileObj, errorObj);
+ errorArray.push(fileArray);
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error");
+ jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
+ }
+ });
+ jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) {
+ if (event.data.action(event, ID, fileObj, data) !== false) {
+ jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%');
+ if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
+ if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
+ if (event.data.toDisplay == null) displayData = ' ';
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData);
+ }
+ });
+ jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {
+ if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed');
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()});
+ }
+ });
+ if (typeof(settings.onAllComplete) == 'function') {
+ jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) {
+ if (event.data.action(event, uploadObj) !== false) {
+ errorArray = [];
+ }
+ });
+ }
+ });
+ },
+ uploadifySettings:function(settingName, settingValue, resetObject) {
+ var returnValue = false;
+ jQuery(this).each(function() {
+ if (settingName == 'scriptData' && settingValue != null) {
+ if (resetObject) {
+ var scriptData = settingValue;
+ } else {
+ var scriptData = jQuery.extend(settings.scriptData, settingValue);
+ }
+ var scriptDataString = '';
+ for (var name in scriptData) {
+ scriptDataString += '&' + name + '=' + escape(scriptData[name]);
+ }
+ settingValue = scriptDataString.substr(1);
+ }
+ returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
+ });
+ if (settingValue == null) {
+ if (settingName == 'scriptData') {
+ var returnSplit = unescape(returnValue).split('&');
+ var returnObj = new Object();
+ for (var i = 0; i < returnSplit.length; i++) {
+ var iSplit = returnSplit[i].split('=');
+ returnObj[iSplit[0]] = iSplit[1];
+ }
+ returnValue = returnObj;
+ }
+ return returnValue;
+ }
+ },
+ uploadifyUpload:function(ID) {
+ jQuery(this).each(function() {
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false);
+ });
+ },
+ uploadifyCancel:function(ID) {
+ jQuery(this).each(function() {
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false);
+ });
+ },
+ uploadifyClearQueue:function() {
+ jQuery(this).each(function() {
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);
+ });
+ }
+ })
+})(jQuery);
\ No newline at end of file diff --git a/vendors/uploadify/jquery.uploadify.v2.1.0.min.js b/vendors/uploadify/jquery.uploadify.v2.1.0.min.js new file mode 100644 index 000000000..04592ffec --- /dev/null +++ b/vendors/uploadify/jquery.uploadify.v2.1.0.min.js @@ -0,0 +1,26 @@ +/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)};
\ No newline at end of file diff --git a/vendors/uploadify/swfobject.js b/vendors/uploadify/swfobject.js new file mode 100644 index 000000000..8eafe9dd8 --- /dev/null +++ b/vendors/uploadify/swfobject.js @@ -0,0 +1,4 @@ +/* SWFObject v2.2 <http://code.google.com/p/swfobject/> + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
\ No newline at end of file diff --git a/vendors/uploadify/uploadify.allglyphs.swf b/vendors/uploadify/uploadify.allglyphs.swf Binary files differnew file mode 100644 index 000000000..4bad0117c --- /dev/null +++ b/vendors/uploadify/uploadify.allglyphs.swf diff --git a/vendors/uploadify/uploadify.css b/vendors/uploadify/uploadify.css new file mode 100644 index 000000000..0cf8c0eaf --- /dev/null +++ b/vendors/uploadify/uploadify.css @@ -0,0 +1,53 @@ +/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+.uploadifyQueueItem {
+ font: 11px Verdana, Geneva, sans-serif;
+ border: 2px solid #E5E5E5;
+ background-color: #F5F5F5;
+ margin-top: 5px;
+ padding: 10px;
+ width: 350px;
+}
+.uploadifyError {
+ border: 2px solid #FBCBBC !important;
+ background-color: #FDE5DD !important;
+}
+.uploadifyQueueItem .cancel {
+ float: right;
+}
+.uploadifyProgress {
+ background-color: #FFFFFF;
+ border-top: 1px solid #808080;
+ border-left: 1px solid #808080;
+ border-right: 1px solid #C5C5C5;
+ border-bottom: 1px solid #C5C5C5;
+ margin-top: 10px;
+ width: 100%;
+}
+.uploadifyProgressBar {
+ background-color: #0099FF;
+ width: 1px;
+ height: 3px;
+}
\ No newline at end of file diff --git a/vendors/uploadify/uploadify.fla b/vendors/uploadify/uploadify.fla Binary files differnew file mode 100644 index 000000000..c07bbaf38 --- /dev/null +++ b/vendors/uploadify/uploadify.fla diff --git a/vendors/uploadify/uploadify.php b/vendors/uploadify/uploadify.php new file mode 100644 index 000000000..8bf14a672 --- /dev/null +++ b/vendors/uploadify/uploadify.php @@ -0,0 +1,46 @@ +<?php
+/*
+Uploadify v2.1.0
+Release Date: August 24, 2009
+
+Copyright (c) 2009 Ronnie Garcia, Travis Nickels
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+if (!empty($_FILES)) {
+ $tempFile = $_FILES['Filedata']['tmp_name'];
+ $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
+ $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
+
+ // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
+ // $fileTypes = str_replace(';','|',$fileTypes);
+ // $typesArray = split('\|',$fileTypes);
+ // $fileParts = pathinfo($_FILES['Filedata']['name']);
+
+ // if (in_array($fileParts['extension'],$typesArray)) {
+ // Uncomment the following line if you want to make the directory if it doesn't exist
+ // mkdir(str_replace('//','/',$targetPath), 0755, true);
+
+ move_uploaded_file($tempFile,$targetFile);
+ echo "1";
+ // } else {
+ // echo 'Invalid file type.';
+ // }
+}
+?>
\ No newline at end of file diff --git a/vendors/uploadify/uploadify.swf b/vendors/uploadify/uploadify.swf Binary files differnew file mode 100644 index 000000000..0385d9e6e --- /dev/null +++ b/vendors/uploadify/uploadify.swf |