3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
10 This plug in automatically gets all the cookies for this site and adds them to the post_params.
\r
11 Cookies are loaded only on initialization. The refreshCookies function can be called to update the post_params.
\r
12 The cookies will override any other post params with the same name.
\r
16 if (typeof(SWFUpload) === "function") {
\r
17 SWFUpload.prototype.initSettings = function (oldInitSettings) {
\r
18 return function () {
\r
19 if (typeof(oldInitSettings) === "function") {
\r
20 oldInitSettings.call(this);
\r
23 this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
\r
25 }(SWFUpload.prototype.initSettings);
\r
27 // refreshes the post_params and updates SWFUpload. The sendToFlash parameters is optional and defaults to True
\r
28 SWFUpload.prototype.refreshCookies = function (sendToFlash) {
\r
29 if (sendToFlash === undefined) {
\r
32 sendToFlash = !!sendToFlash;
\r
34 // Get the post_params object
\r
35 var postParams = this.settings.post_params;
\r
38 var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
\r
39 for (i = 0; i < caLength; i++) {
\r
43 while (c.charAt(0) === " ") {
\r
44 c = c.substring(1, c.length);
\r
46 eqIndex = c.indexOf("=");
\r
48 name = c.substring(0, eqIndex);
\r
49 value = c.substring(eqIndex + 1);
\r
50 postParams[name] = value;
\r
55 this.setPostParams(postParams);
\r