3 * Copyright(c) 2006-2010 Ext JS, Inc.
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.
11 Cookies are loaded only on initialization. The refreshCookies function can be called to update the post_params.
12 The cookies will override any other post params with the same name.
16 if (typeof(SWFUpload) === "function") {
17 SWFUpload.prototype.initSettings = function (oldInitSettings) {
19 if (typeof(oldInitSettings) === "function") {
20 oldInitSettings.call(this);
23 this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
25 }(SWFUpload.prototype.initSettings);
27 // refreshes the post_params and updates SWFUpload. The sendToFlash parameters is optional and defaults to True
28 SWFUpload.prototype.refreshCookies = function (sendToFlash) {
29 if (sendToFlash === undefined) {
32 sendToFlash = !!sendToFlash;
34 // Get the post_params object
35 var postParams = this.settings.post_params;
38 var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
39 for (i = 0; i < caLength; i++) {
43 while (c.charAt(0) === " ") {
44 c = c.substring(1, c.length);
46 eqIndex = c.indexOf("=");
48 name = c.substring(0, eqIndex);
49 value = c.substring(eqIndex + 1);
50 postParams[name] = value;
55 this.setPostParams(postParams);