Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.storage.browser");
13
dojo.provide("dojo.storage.browser");
12
dojo.require("dojo.storage");
14
dojo.require("dojo.storage");
13
dojo.require("dojo.flash");
15
dojo.require("dojo.flash");
14
dojo.require("dojo.json");
16
dojo.require("dojo.json");
15
dojo.require("dojo.uri.*");
17
dojo.require("dojo.uri.*");
16
dojo.storage.browser.FileStorageProvider = function () {
18
dojo.storage.browser.FileStorageProvider = function () {
17
};
19
};
18
dojo.inherits(dojo.storage.browser.FileStorageProvider, dojo.storage);
20
dojo.inherits(dojo.storage.browser.FileStorageProvider, dojo.storage);
19
dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME = "__dojoAllKeys";
21
dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME = "__dojoAllKeys";
20
dojo.storage.browser.FileStorageProvider._APPLET_ID = "__dojoFileJavaObj";
22
dojo.storage.browser.FileStorageProvider._APPLET_ID = "__dojoFileJavaObj";
21
dojo.lang.extend(dojo.storage.browser.FileStorageProvider, {namespace:"default", initialized:false, _available:null, _statusHandler:null, _keyIndex:new Array(), initialize:function () {
23
dojo.lang.extend(dojo.storage.browser.FileStorageProvider, {namespace:"default", initialized:false, _available:null, _statusHandler:null, _keyIndex:new Array(), initialize:function () {
22
	if (djConfig["disableFileStorage"] == true) {
24
	if (djConfig["disableFileStorage"] == true) {
23
		return;
25
		return;
24
	}
26
	}
25
	this._loadKeyIndex();
27
	this._loadKeyIndex();
26
	this.initialized = true;
28
	this.initialized = true;
27
	dojo.storage.manager.loaded();
29
	dojo.storage.manager.loaded();
28
}, isAvailable:function () {
30
}, isAvailable:function () {
29
	this._available = false;
31
	this._available = false;
30
	var protocol = window.location.protocol;
32
	var protocol = window.location.protocol;
31
	if (protocol.indexOf("file") != -1 || protocol.indexOf("chrome") != -1) {
33
	if (protocol.indexOf("file") != -1 || protocol.indexOf("chrome") != -1) {
32
		this._available = this._isAvailableXPCOM();
34
		this._available = this._isAvailableXPCOM();
33
		if (this._available == false) {
35
		if (this._available == false) {
34
			this._available = this._isAvailableActiveX();
36
			this._available = this._isAvailableActiveX();
35
		}
37
		}
36
	}
38
	}
37
	return this._available;
39
	return this._available;
38
}, put:function (key, value, resultsHandler) {
40
}, put:function (key, value, resultsHandler) {
39
	if (this.isValidKey(key) == false) {
41
	if (this.isValidKey(key) == false) {
40
		dojo.raise("Invalid key given: " + key);
42
		dojo.raise("Invalid key given: " + key);
41
	}
43
	}
42
	this._statusHandler = resultsHandler;
44
	this._statusHandler = resultsHandler;
43
	try {
45
	try {
44
		this._save(key, value);
46
		this._save(key, value);
45
		resultsHandler.call(null, dojo.storage.SUCCESS, key);
47
		resultsHandler.call(null, dojo.storage.SUCCESS, key);
46
	}
48
	}
47
	catch (e) {
49
	catch (e) {
48
		this._statusHandler.call(null, dojo.storage.FAILED, key, e.toString());
50
		this._statusHandler.call(null, dojo.storage.FAILED, key, e.toString());
49
	}
51
	}
50
}, get:function (key) {
52
}, get:function (key) {
51
	if (this.isValidKey(key) == false) {
53
	if (this.isValidKey(key) == false) {
52
		dojo.raise("Invalid key given: " + key);
54
		dojo.raise("Invalid key given: " + key);
53
	}
55
	}
54
	var results = this._load(key);
56
	var results = this._load(key);
55
	return results;
57
	return results;
56
}, getKeys:function () {
58
}, getKeys:function () {
57
	return this._keyIndex;
59
	return this._keyIndex;
58
}, hasKey:function (key) {
60
}, hasKey:function (key) {
59
	if (this.isValidKey(key) == false) {
61
	if (this.isValidKey(key) == false) {
60
		dojo.raise("Invalid key given: " + key);
62
		dojo.raise("Invalid key given: " + key);
61
	}
63
	}
62
	this._loadKeyIndex();
64
	this._loadKeyIndex();
63
	var exists = false;
65
	var exists = false;
64
	for (var i = 0; i < this._keyIndex.length; i++) {
66
	for (var i = 0; i < this._keyIndex.length; i++) {
65
		if (this._keyIndex[i] == key) {
67
		if (this._keyIndex[i] == key) {
66
			exists = true;
68
			exists = true;
67
		}
69
		}
68
	}
70
	}
69
	return exists;
71
	return exists;
70
}, clear:function () {
72
}, clear:function () {
71
	this._loadKeyIndex();
73
	this._loadKeyIndex();
72
	var keyIndex = new Array();
74
	var keyIndex = new Array();
73
	for (var i = 0; i < this._keyIndex.length; i++) {
75
	for (var i = 0; i < this._keyIndex.length; i++) {
74
		keyIndex[keyIndex.length] = new String(this._keyIndex[i]);
76
		keyIndex[keyIndex.length] = new String(this._keyIndex[i]);
75
	}
77
	}
76
	for (var i = 0; i < keyIndex.length; i++) {
78
	for (var i = 0; i < keyIndex.length; i++) {
77
		this.remove(keyIndex[i]);
79
		this.remove(keyIndex[i]);
78
	}
80
	}
79
}, remove:function (key) {
81
}, remove:function (key) {
80
	if (this.isValidKey(key) == false) {
82
	if (this.isValidKey(key) == false) {
81
		dojo.raise("Invalid key given: " + key);
83
		dojo.raise("Invalid key given: " + key);
82
	}
84
	}
83
	this._loadKeyIndex();
85
	this._loadKeyIndex();
84
	for (var i = 0; i < this._keyIndex.length; i++) {
86
	for (var i = 0; i < this._keyIndex.length; i++) {
85
		if (this._keyIndex[i] == key) {
87
		if (this._keyIndex[i] == key) {
86
			this._keyIndex.splice(i, 1);
88
			this._keyIndex.splice(i, 1);
87
			break;
89
			break;
88
		}
90
		}
89
	}
91
	}
90
	this._save(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME, this._keyIndex, false);
92
	this._save(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME, this._keyIndex, false);
91
	var fullPath = this._getPagePath() + key + ".txt";
93
	var fullPath = this._getPagePath() + key + ".txt";
92
	if (this._isAvailableXPCOM()) {
94
	if (this._isAvailableXPCOM()) {
93
		this._removeXPCOM(fullPath);
95
		this._removeXPCOM(fullPath);
94
	} else {
96
	} else {
95
		if (this._isAvailableActiveX()) {
97
		if (this._isAvailableActiveX()) {
96
			this._removeActiveX(fullPath);
98
			this._removeActiveX(fullPath);
97
		}
99
		}
98
	}
100
	}
99
}, isPermanent:function () {
101
}, isPermanent:function () {
100
	return true;
102
	return true;
101
}, getMaximumSize:function () {
103
}, getMaximumSize:function () {
102
	return dojo.storage.SIZE_NO_LIMIT;
104
	return dojo.storage.SIZE_NO_LIMIT;
103
}, hasSettingsUI:function () {
105
}, hasSettingsUI:function () {
104
	return false;
106
	return false;
105
}, showSettingsUI:function () {
107
}, showSettingsUI:function () {
106
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
108
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
107
}, hideSettingsUI:function () {
109
}, hideSettingsUI:function () {
108
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
110
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
109
}, getType:function () {
111
}, getType:function () {
110
	return "dojo.storage.browser.FileStorageProvider";
112
	return "dojo.storage.browser.FileStorageProvider";
111
}, _save:function (key, value, updateKeyIndex) {
113
}, _save:function (key, value, updateKeyIndex) {
112
	if (typeof updateKeyIndex == "undefined") {
114
	if (typeof updateKeyIndex == "undefined") {
113
		updateKeyIndex = true;
115
		updateKeyIndex = true;
114
	}
116
	}
115
	if (dojo.lang.isString(value) == false) {
117
	if (dojo.lang.isString(value) == false) {
116
		value = dojo.json.serialize(value);
118
		value = dojo.json.serialize(value);
117
		value = "/* JavaScript */\n" + value + "\n\n";
119
		value = "/* JavaScript */\n" + value + "\n\n";
118
	}
120
	}
119
	var fullPath = this._getPagePath() + key + ".txt";
121
	var fullPath = this._getPagePath() + key + ".txt";
120
	if (this._isAvailableXPCOM()) {
122
	if (this._isAvailableXPCOM()) {
121
		this._saveFileXPCOM(fullPath, value);
123
		this._saveFileXPCOM(fullPath, value);
122
	} else {
124
	} else {
123
		if (this._isAvailableActiveX()) {
125
		if (this._isAvailableActiveX()) {
124
			this._saveFileActiveX(fullPath, value);
126
			this._saveFileActiveX(fullPath, value);
125
		}
127
		}
126
	}
128
	}
127
	if (updateKeyIndex) {
129
	if (updateKeyIndex) {
128
		this._updateKeyIndex(key);
130
		this._updateKeyIndex(key);
129
	}
131
	}
130
}, _load:function (key) {
132
}, _load:function (key) {
131
	var fullPath = this._getPagePath() + key + ".txt";
133
	var fullPath = this._getPagePath() + key + ".txt";
132
	var results = null;
134
	var results = null;
133
	if (this._isAvailableXPCOM()) {
135
	if (this._isAvailableXPCOM()) {
134
		results = this._loadFileXPCOM(fullPath);
136
		results = this._loadFileXPCOM(fullPath);
135
	} else {
137
	} else {
136
		if (this._isAvailableActiveX()) {
138
		if (this._isAvailableActiveX()) {
137
			results = this._loadFileActiveX(fullPath);
139
			results = this._loadFileActiveX(fullPath);
138
		} else {
140
		} else {
139
			if (this._isAvailableJava()) {
141
			if (this._isAvailableJava()) {
140
				results = this._loadFileJava(fullPath);
142
				results = this._loadFileJava(fullPath);
141
			}
143
			}
142
		}
144
		}
143
	}
145
	}
144
	if (results == null) {
146
	if (results == null) {
145
		return null;
147
		return null;
146
	}
148
	}
147
	if (!dojo.lang.isUndefined(results) && results != null && /^\/\* JavaScript \*\//.test(results)) {
149
	if (!dojo.lang.isUndefined(results) && results != null && /^\/\* JavaScript \*\//.test(results)) {
148
		results = dojo.json.evalJson(results);
150
		results = dojo.json.evalJson(results);
149
	}
151
	}
150
	return results;
152
	return results;
151
}, _updateKeyIndex:function (key) {
153
}, _updateKeyIndex:function (key) {
152
	this._loadKeyIndex();
154
	this._loadKeyIndex();
153
	var alreadyAdded = false;
155
	var alreadyAdded = false;
154
	for (var i = 0; i < this._keyIndex.length; i++) {
156
	for (var i = 0; i < this._keyIndex.length; i++) {
155
		if (this._keyIndex[i] == key) {
157
		if (this._keyIndex[i] == key) {
156
			alreadyAdded = true;
158
			alreadyAdded = true;
157
			break;
159
			break;
158
		}
160
		}
159
	}
161
	}
160
	if (alreadyAdded == false) {
162
	if (alreadyAdded == false) {
161
		this._keyIndex[this._keyIndex.length] = key;
163
		this._keyIndex[this._keyIndex.length] = key;
162
	}
164
	}
163
	this._save(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME, this._keyIndex, false);
165
	this._save(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME, this._keyIndex, false);
164
}, _loadKeyIndex:function () {
166
}, _loadKeyIndex:function () {
165
	var indexContents = this._load(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME);
167
	var indexContents = this._load(dojo.storage.browser.FileStorageProvider._KEY_INDEX_FILENAME);
166
	if (indexContents == null) {
168
	if (indexContents == null) {
167
		this._keyIndex = new Array();
169
		this._keyIndex = new Array();
168
	} else {
170
	} else {
169
		this._keyIndex = indexContents;
171
		this._keyIndex = indexContents;
170
	}
172
	}
171
}, _saveFileXPCOM:function (filename, value) {
173
}, _saveFileXPCOM:function (filename, value) {
172
	try {
174
	try {
173
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
175
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
174
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
176
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
175
		f.initWithPath(filename);
177
		f.initWithPath(filename);
176
		var ouputStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
178
		var ouputStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
177
		ouputStream.init(f, 32 | 4 | 8, 256 + 128, null);
179
		ouputStream.init(f, 32 | 4 | 8, 256 + 128, null);
178
		ouputStream.write(value, value.length);
180
		ouputStream.write(value, value.length);
179
		ouputStream.close();
181
		ouputStream.close();
180
	}
182
	}
181
	catch (e) {
183
	catch (e) {
182
		var msg = e.toString();
184
		var msg = e.toString();
183
		if (e.name && e.message) {
185
		if (e.name && e.message) {
184
			msg = e.name + ": " + e.message;
186
			msg = e.name + ": " + e.message;
185
		}
187
		}
186
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileXPCOM(): " + msg);
188
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileXPCOM(): " + msg);
187
	}
189
	}
188
}, _loadFileXPCOM:function (filename) {
190
}, _loadFileXPCOM:function (filename) {
189
	try {
191
	try {
190
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
192
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
191
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
193
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
192
		f.initWithPath(filename);
194
		f.initWithPath(filename);
193
		if (f.exists() == false) {
195
		if (f.exists() == false) {
194
			return null;
196
			return null;
195
		}
197
		}
196
		var inp = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
198
		var inp = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
197
		inp.init(f, 1, 4, null);
199
		inp.init(f, 1, 4, null);
198
		var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
200
		var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
199
		inputStream.init(inp);
201
		inputStream.init(inp);
200
		var results = inputStream.read(inputStream.available());
202
		var results = inputStream.read(inputStream.available());
201
		return results;
203
		return results;
202
	}
204
	}
203
	catch (e) {
205
	catch (e) {
204
		var msg = e.toString();
206
		var msg = e.toString();
205
		if (e.name && e.message) {
207
		if (e.name && e.message) {
206
			msg = e.name + ": " + e.message;
208
			msg = e.name + ": " + e.message;
207
		}
209
		}
208
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileXPCOM(): " + msg);
210
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileXPCOM(): " + msg);
209
	}
211
	}
210
	return null;
212
	return null;
211
}, _saveFileActiveX:function (filename, value) {
213
}, _saveFileActiveX:function (filename, value) {
212
	try {
214
	try {
213
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
215
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
214
		var f = fileSystem.OpenTextFile(filename, 2, true);
216
		var f = fileSystem.OpenTextFile(filename, 2, true);
215
		f.Write(value);
217
		f.Write(value);
216
		f.Close();
218
		f.Close();
217
	}
219
	}
218
	catch (e) {
220
	catch (e) {
219
		var msg = e.toString();
221
		var msg = e.toString();
220
		if (e.name && e.message) {
222
		if (e.name && e.message) {
221
			msg = e.name + ": " + e.message;
223
			msg = e.name + ": " + e.message;
222
		}
224
		}
223
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileActiveX(): " + msg);
225
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileActiveX(): " + msg);
224
	}
226
	}
225
}, _loadFileActiveX:function (filename) {
227
}, _loadFileActiveX:function (filename) {
226
	try {
228
	try {
227
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
229
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
228
		if (fileSystem.FileExists(filename) == false) {
230
		if (fileSystem.FileExists(filename) == false) {
229
			return null;
231
			return null;
230
		}
232
		}
231
		var f = fileSystem.OpenTextFile(filename, 1);
233
		var f = fileSystem.OpenTextFile(filename, 1);
232
		var results = f.ReadAll();
234
		var results = f.ReadAll();
233
		f.Close();
235
		f.Close();
234
		return results;
236
		return results;
235
	}
237
	}
236
	catch (e) {
238
	catch (e) {
237
		var msg = e.toString();
239
		var msg = e.toString();
238
		if (e.name && e.message) {
240
		if (e.name && e.message) {
239
			msg = e.name + ": " + e.message;
241
			msg = e.name + ": " + e.message;
240
		}
242
		}
241
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileActiveX(): " + msg);
243
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileActiveX(): " + msg);
242
	}
244
	}
243
}, _saveFileJava:function (filename, value) {
245
}, _saveFileJava:function (filename, value) {
244
	try {
246
	try {
245
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
247
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
246
		applet.save(filename, value);
248
		applet.save(filename, value);
247
	}
249
	}
248
	catch (e) {
250
	catch (e) {
249
		var msg = e.toString();
251
		var msg = e.toString();
250
		if (e.name && e.message) {
252
		if (e.name && e.message) {
251
			msg = e.name + ": " + e.message;
253
			msg = e.name + ": " + e.message;
252
		}
254
		}
253
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileJava(): " + msg);
255
		dojo.raise("dojo.storage.browser.FileStorageProvider._saveFileJava(): " + msg);
254
	}
256
	}
255
}, _loadFileJava:function (filename) {
257
}, _loadFileJava:function (filename) {
256
	try {
258
	try {
257
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
259
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
258
		var results = applet.load(filename);
260
		var results = applet.load(filename);
259
		return results;
261
		return results;
260
	}
262
	}
261
	catch (e) {
263
	catch (e) {
262
		var msg = e.toString();
264
		var msg = e.toString();
263
		if (e.name && e.message) {
265
		if (e.name && e.message) {
264
			msg = e.name + ": " + e.message;
266
			msg = e.name + ": " + e.message;
265
		}
267
		}
266
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileJava(): " + msg);
268
		dojo.raise("dojo.storage.browser.FileStorageProvider._loadFileJava(): " + msg);
267
	}
269
	}
268
}, _isAvailableActiveX:function () {
270
}, _isAvailableActiveX:function () {
269
	try {
271
	try {
270
		if (window.ActiveXObject) {
272
		if (window.ActiveXObject) {
271
			var fileSystem = new window.ActiveXObject("Scripting.FileSystemObject");
273
			var fileSystem = new window.ActiveXObject("Scripting.FileSystemObject");
272
			return true;
274
			return true;
273
		}
275
		}
274
	}
276
	}
275
	catch (e) {
277
	catch (e) {
276
		dojo.debug(e);
278
		dojo.debug(e);
277
	}
279
	}
278
	return false;
280
	return false;
279
}, _isAvailableXPCOM:function () {
281
}, _isAvailableXPCOM:function () {
280
	try {
282
	try {
281
		if (window.Components) {
283
		if (window.Components) {
282
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
284
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
283
			Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
285
			Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
284
			return true;
286
			return true;
285
		}
287
		}
286
	}
288
	}
287
	catch (e) {
289
	catch (e) {
288
		dojo.debug(e);
290
		dojo.debug(e);
289
	}
291
	}
290
	return false;
292
	return false;
291
}, _isAvailableJava:function () {
293
}, _isAvailableJava:function () {
292
	try {
294
	try {
293
		if (dojo.render.html.safari == true || dojo.render.html.opera == true()) {
295
		if (dojo.render.html.safari == true || dojo.render.html.opera == true()) {
294
			if (navigator.javaEnabled() == true) {
296
			if (navigator.javaEnabled() == true) {
295
				return true;
297
				return true;
296
			}
298
			}
297
		}
299
		}
298
	}
300
	}
299
	catch (e) {
301
	catch (e) {
300
		dojo.debug(e);
302
		dojo.debug(e);
301
	}
303
	}
302
	return false;
304
	return false;
303
}, _getPagePath:function () {
305
}, _getPagePath:function () {
304
	var path = window.location.pathname;
306
	var path = window.location.pathname;
305
	if (/\.html?$/i.test(path)) {
307
	if (/\.html?$/i.test(path)) {
306
		path = path.replace(/(?:\/|\\)?[^\.\/\\]*\.html?$/, "");
308
		path = path.replace(/(?:\/|\\)?[^\.\/\\]*\.html?$/, "");
307
	}
309
	}
308
	if (/^\/?[a-z]+\:/i.test(path)) {
310
	if (/^\/?[a-z]+\:/i.test(path)) {
309
		path = path.replace(/^\/?/, "");
311
		path = path.replace(/^\/?/, "");
310
		path = path.replace(/\//g, "\\");
312
		path = path.replace(/\//g, "\\");
311
	} else {
313
	} else {
312
		if (/^[\/\\]{2,3}[^\/]/.test(path)) {
314
		if (/^[\/\\]{2,3}[^\/]/.test(path)) {
313
			path = path.replace(/^[\/\\]{2,3}/, "");
315
			path = path.replace(/^[\/\\]{2,3}/, "");
314
			path = path.replace(/\//g, "\\");
316
			path = path.replace(/\//g, "\\");
315
			path = "\\\\" + path;
317
			path = "\\\\" + path;
316
		}
318
		}
317
	}
319
	}
318
	if (/\/$/.test(path) == false && /\\$/.test(path) == false) {
320
	if (/\/$/.test(path) == false && /\\$/.test(path) == false) {
319
		if (/\//.test(path)) {
321
		if (/\//.test(path)) {
320
			path += "/";
322
			path += "/";
321
		} else {
323
		} else {
322
			path += "\\";
324
			path += "\\";
323
		}
325
		}
324
	}
326
	}
325
	path = unescape(path);
327
	path = unescape(path);
326
	return path;
328
	return path;
327
}, _removeXPCOM:function (filename) {
329
}, _removeXPCOM:function (filename) {
328
	try {
330
	try {
329
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
331
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
330
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
332
		var f = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
331
		f.initWithPath(filename);
333
		f.initWithPath(filename);
332
		if (f.exists() == false || f.isDirectory()) {
334
		if (f.exists() == false || f.isDirectory()) {
333
			return;
335
			return;
334
		}
336
		}
335
		if (f.isFile()) {
337
		if (f.isFile()) {
336
			f.remove(false);
338
			f.remove(false);
337
		}
339
		}
338
	}
340
	}
339
	catch (e) {
341
	catch (e) {
340
		dojo.raise("dojo.storage.browser.FileStorageProvider.remove(): " + e.toString());
342
		dojo.raise("dojo.storage.browser.FileStorageProvider.remove(): " + e.toString());
341
	}
343
	}
342
}, _removeActiveX:function (filename) {
344
}, _removeActiveX:function (filename) {
343
	try {
345
	try {
344
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
346
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
345
		fileSystem.DeleteFile(filename);
347
		fileSystem.DeleteFile(filename);
346
	}
348
	}
347
	catch (e) {
349
	catch (e) {
348
		dojo.raise("dojo.storage.browser.FileStorageProvider.remove(): " + e.toString());
350
		dojo.raise("dojo.storage.browser.FileStorageProvider.remove(): " + e.toString());
349
	}
351
	}
350
}, _removeJava:function (filename) {
352
}, _removeJava:function (filename) {
351
	try {
353
	try {
352
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
354
		var applet = dojo.byId(dojo.storage.browser.FileStorageProvider._APPLET_ID);
353
		applet.remove(filename);
355
		applet.remove(filename);
354
	}
356
	}
355
	catch (e) {
357
	catch (e) {
356
		var msg = e.toString();
358
		var msg = e.toString();
357
		if (e.name && e.message) {
359
		if (e.name && e.message) {
358
			msg = e.name + ": " + e.message;
360
			msg = e.name + ": " + e.message;
359
		}
361
		}
360
		dojo.raise("dojo.storage.browser.FileStorageProvider._removeJava(): " + msg);
362
		dojo.raise("dojo.storage.browser.FileStorageProvider._removeJava(): " + msg);
361
	}
363
	}
362
}, _writeApplet:function () {
364
}, _writeApplet:function () {
363
	var archive = dojo.uri.moduleUri("dojo", "../DojoFileStorageProvider.jar").toString();
365
	var archive = dojo.uri.moduleUri("dojo", "../DojoFileStorageProvider.jar").toString();
364
	var tag = "<applet " + "id='" + dojo.storage.browser.FileStorageProvider._APPLET_ID + "' " + "style='position: absolute; top: -500px; left: -500px; width: 1px; height: 1px;' " + "code='DojoFileStorageProvider.class' " + "archive='" + archive + "' " + "width='1' " + "height='1' " + ">" + "</applet>";
366
	var tag = "<applet " + "id='" + dojo.storage.browser.FileStorageProvider._APPLET_ID + "' " + "style='position: absolute; top: -500px; left: -500px; width: 1px; height: 1px;' " + "code='DojoFileStorageProvider.class' " + "archive='" + archive + "' " + "width='1' " + "height='1' " + ">" + "</applet>";
365
	document.writeln(tag);
367
	document.writeln(tag);
366
}});
368
}});
367
dojo.storage.browser.WhatWGStorageProvider = function () {
369
dojo.storage.browser.WhatWGStorageProvider = function () {
368
};
370
};
369
dojo.inherits(dojo.storage.browser.WhatWGStorageProvider, dojo.storage);
371
dojo.inherits(dojo.storage.browser.WhatWGStorageProvider, dojo.storage);
370
dojo.lang.extend(dojo.storage.browser.WhatWGStorageProvider, {namespace:"default", initialized:false, _domain:null, _available:null, _statusHandler:null, initialize:function () {
372
dojo.lang.extend(dojo.storage.browser.WhatWGStorageProvider, {namespace:"default", initialized:false, _domain:null, _available:null, _statusHandler:null, initialize:function () {
371
	if (djConfig["disableWhatWGStorage"] == true) {
373
	if (djConfig["disableWhatWGStorage"] == true) {
372
		return;
374
		return;
373
	}
375
	}
374
	this._domain = location.hostname;
376
	this._domain = location.hostname;
375
	this.initialized = true;
377
	this.initialized = true;
376
	dojo.storage.manager.loaded();
378
	dojo.storage.manager.loaded();
377
}, isAvailable:function () {
379
}, isAvailable:function () {
378
	try {
380
	try {
379
		var myStorage = globalStorage[location.hostname];
381
		var myStorage = globalStorage[location.hostname];
380
	}
382
	}
381
	catch (e) {
383
	catch (e) {
382
		this._available = false;
384
		this._available = false;
383
		return this._available;
385
		return this._available;
384
	}
386
	}
385
	this._available = true;
387
	this._available = true;
386
	return this._available;
388
	return this._available;
387
}, put:function (key, value, resultsHandler) {
389
}, put:function (key, value, resultsHandler) {
388
	if (this.isValidKey(key) == false) {
390
	if (this.isValidKey(key) == false) {
389
		dojo.raise("Invalid key given: " + key);
391
		dojo.raise("Invalid key given: " + key);
390
	}
392
	}
391
	this._statusHandler = resultsHandler;
393
	this._statusHandler = resultsHandler;
392
	if (dojo.lang.isString(value)) {
394
	if (dojo.lang.isString(value)) {
393
		value = "string:" + value;
395
		value = "string:" + value;
394
	} else {
396
	} else {
395
		value = dojo.json.serialize(value);
397
		value = dojo.json.serialize(value);
396
	}
398
	}
397
	window.addEventListener("storage", function (evt) {
399
	window.addEventListener("storage", function (evt) {
398
		resultsHandler.call(null, dojo.storage.SUCCESS, key);
400
		resultsHandler.call(null, dojo.storage.SUCCESS, key);
399
	}, false);
401
	}, false);
400
	try {
402
	try {
401
		var myStorage = globalStorage[this._domain];
403
		var myStorage = globalStorage[this._domain];
402
		myStorage.setItem(key, value);
404
		myStorage.setItem(key, value);
403
	}
405
	}
404
	catch (e) {
406
	catch (e) {
405
		this._statusHandler.call(null, dojo.storage.FAILED, key, e.toString());
407
		this._statusHandler.call(null, dojo.storage.FAILED, key, e.toString());
406
	}
408
	}
407
}, get:function (key) {
409
}, get:function (key) {
408
	if (this.isValidKey(key) == false) {
410
	if (this.isValidKey(key) == false) {
409
		dojo.raise("Invalid key given: " + key);
411
		dojo.raise("Invalid key given: " + key);
410
	}
412
	}
411
	var myStorage = globalStorage[this._domain];
413
	var myStorage = globalStorage[this._domain];
412
	var results = myStorage.getItem(key);
414
	var results = myStorage.getItem(key);
413
	if (results == null) {
415
	if (results == null) {
414
		return null;
416
		return null;
415
	}
417
	}
416
	results = results.value;
418
	results = results.value;
417
	if (!dojo.lang.isUndefined(results) && results != null && /^string:/.test(results)) {
419
	if (!dojo.lang.isUndefined(results) && results != null && /^string:/.test(results)) {
418
		results = results.substring("string:".length);
420
		results = results.substring("string:".length);
419
	} else {
421
	} else {
420
		results = dojo.json.evalJson(results);
422
		results = dojo.json.evalJson(results);
421
	}
423
	}
422
	return results;
424
	return results;
423
}, getKeys:function () {
425
}, getKeys:function () {
424
	var myStorage = globalStorage[this._domain];
426
	var myStorage = globalStorage[this._domain];
425
	var keysArray = new Array();
427
	var keysArray = new Array();
426
	for (i = 0; i < myStorage.length; i++) {
428
	for (i = 0; i < myStorage.length; i++) {
427
		keysArray[i] = myStorage.key(i);
429
		keysArray[i] = myStorage.key(i);
428
	}
430
	}
429
	return keysArray;
431
	return keysArray;
430
}, clear:function () {
432
}, clear:function () {
431
	var myStorage = globalStorage[this._domain];
433
	var myStorage = globalStorage[this._domain];
432
	var keys = new Array();
434
	var keys = new Array();
433
	for (var i = 0; i < myStorage.length; i++) {
435
	for (var i = 0; i < myStorage.length; i++) {
434
		keys[keys.length] = myStorage.key(i);
436
		keys[keys.length] = myStorage.key(i);
435
	}
437
	}
436
	for (var i = 0; i < keys.length; i++) {
438
	for (var i = 0; i < keys.length; i++) {
437
		myStorage.removeItem(keys[i]);
439
		myStorage.removeItem(keys[i]);
438
	}
440
	}
439
}, remove:function (key) {
441
}, remove:function (key) {
440
	var myStorage = globalStorage[this._domain];
442
	var myStorage = globalStorage[this._domain];
441
	myStorage.removeItem(key);
443
	myStorage.removeItem(key);
442
}, isPermanent:function () {
444
}, isPermanent:function () {
443
	return true;
445
	return true;
444
}, getMaximumSize:function () {
446
}, getMaximumSize:function () {
445
	return dojo.storage.SIZE_NO_LIMIT;
447
	return dojo.storage.SIZE_NO_LIMIT;
446
}, hasSettingsUI:function () {
448
}, hasSettingsUI:function () {
447
	return false;
449
	return false;
448
}, showSettingsUI:function () {
450
}, showSettingsUI:function () {
449
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
451
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
450
}, hideSettingsUI:function () {
452
}, hideSettingsUI:function () {
451
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
453
	dojo.raise(this.getType() + " does not support a storage settings user-interface");
452
}, getType:function () {
454
}, getType:function () {
453
	return "dojo.storage.browser.WhatWGProvider";
455
	return "dojo.storage.browser.WhatWGProvider";
454
}});
456
}});
455
dojo.storage.browser.FlashStorageProvider = function () {
457
dojo.storage.browser.FlashStorageProvider = function () {
456
};
458
};
457
dojo.inherits(dojo.storage.browser.FlashStorageProvider, dojo.storage);
459
dojo.inherits(dojo.storage.browser.FlashStorageProvider, dojo.storage);
458
dojo.lang.extend(dojo.storage.browser.FlashStorageProvider, {namespace:"default", initialized:false, _available:null, _statusHandler:null, initialize:function () {
460
dojo.lang.extend(dojo.storage.browser.FlashStorageProvider, {namespace:"default", initialized:false, _available:null, _statusHandler:null, initialize:function () {
459
	if (djConfig["disableFlashStorage"] == true) {
461
	if (djConfig["disableFlashStorage"] == true) {
460
		return;
462
		return;
461
	}
463
	}
462
	var loadedListener = function () {
464
	var loadedListener = function () {
463
		dojo.storage._flashLoaded();
465
		dojo.storage._flashLoaded();
464
	};
466
	};
465
	dojo.flash.addLoadedListener(loadedListener);
467
	dojo.flash.addLoadedListener(loadedListener);
466
	var swfloc6 = dojo.uri.moduleUri("dojo", "../Storage_version6.swf").toString();
468
	var swfloc6 = dojo.uri.moduleUri("dojo", "../Storage_version6.swf").toString();
467
	var swfloc8 = dojo.uri.moduleUri("dojo", "../Storage_version8.swf").toString();
469
	var swfloc8 = dojo.uri.moduleUri("dojo", "../Storage_version8.swf").toString();
468
	dojo.flash.setSwf({flash6:swfloc6, flash8:swfloc8, visible:false});
470
	dojo.flash.setSwf({flash6:swfloc6, flash8:swfloc8, visible:false});
469
}, isAvailable:function () {
471
}, isAvailable:function () {
470
	if (djConfig["disableFlashStorage"] == true) {
472
	if (djConfig["disableFlashStorage"] == true) {
471
		this._available = false;
473
		this._available = false;
472
	} else {
474
	} else {
473
		this._available = true;
475
		this._available = true;
474
	}
476
	}
475
	return this._available;
477
	return this._available;
476
}, put:function (key, value, resultsHandler) {
478
}, put:function (key, value, resultsHandler) {
477
	if (this.isValidKey(key) == false) {
479
	if (this.isValidKey(key) == false) {
478
		dojo.raise("Invalid key given: " + key);
480
		dojo.raise("Invalid key given: " + key);
479
	}
481
	}
480
	this._statusHandler = resultsHandler;
482
	this._statusHandler = resultsHandler;
481
	if (dojo.lang.isString(value)) {
483
	if (dojo.lang.isString(value)) {
482
		value = "string:" + value;
484
		value = "string:" + value;
483
	} else {
485
	} else {
484
		value = dojo.json.serialize(value);
486
		value = dojo.json.serialize(value);
485
	}
487
	}
486
	dojo.flash.comm.put(key, value, this.namespace);
488
	dojo.flash.comm.put(key, value, this.namespace);
487
}, get:function (key) {
489
}, get:function (key) {
488
	if (this.isValidKey(key) == false) {
490
	if (this.isValidKey(key) == false) {
489
		dojo.raise("Invalid key given: " + key);
491
		dojo.raise("Invalid key given: " + key);
490
	}
492
	}
491
	var results = dojo.flash.comm.get(key, this.namespace);
493
	var results = dojo.flash.comm.get(key, this.namespace);
492
	if (results == "") {
494
	if (results == "") {
493
		return null;
495
		return null;
494
	}
496
	}
495
	if (!dojo.lang.isUndefined(results) && results != null && /^string:/.test(results)) {
497
	if (!dojo.lang.isUndefined(results) && results != null && /^string:/.test(results)) {
496
		results = results.substring("string:".length);
498
		results = results.substring("string:".length);
497
	} else {
499
	} else {
498
		results = dojo.json.evalJson(results);
500
		results = dojo.json.evalJson(results);
499
	}
501
	}
500
	return results;
502
	return results;
501
}, getKeys:function () {
503
}, getKeys:function () {
502
	var results = dojo.flash.comm.getKeys(this.namespace);
504
	var results = dojo.flash.comm.getKeys(this.namespace);
503
	if (results == "") {
505
	if (results == "") {
504
		return [];
506
		return [];
505
	}
507
	}
506
	return results.split(",");
508
	return results.split(",");
507
}, clear:function () {
509
}, clear:function () {
508
	dojo.flash.comm.clear(this.namespace);
510
	dojo.flash.comm.clear(this.namespace);
509
}, remove:function (key) {
511
}, remove:function (key) {
510
	dojo.unimplemented("dojo.storage.browser.FlashStorageProvider.remove");
512
	dojo.unimplemented("dojo.storage.browser.FlashStorageProvider.remove");
511
}, isPermanent:function () {
513
}, isPermanent:function () {
512
	return true;
514
	return true;
513
}, getMaximumSize:function () {
515
}, getMaximumSize:function () {
514
	return dojo.storage.SIZE_NO_LIMIT;
516
	return dojo.storage.SIZE_NO_LIMIT;
515
}, hasSettingsUI:function () {
517
}, hasSettingsUI:function () {
516
	return true;
518
	return true;
517
}, showSettingsUI:function () {
519
}, showSettingsUI:function () {
518
	dojo.flash.comm.showSettings();
520
	dojo.flash.comm.showSettings();
519
	dojo.flash.obj.setVisible(true);
521
	dojo.flash.obj.setVisible(true);
520
	dojo.flash.obj.center();
522
	dojo.flash.obj.center();
521
}, hideSettingsUI:function () {
523
}, hideSettingsUI:function () {
522
	dojo.flash.obj.setVisible(false);
524
	dojo.flash.obj.setVisible(false);
523
	if (dojo.storage.onHideSettingsUI != null && !dojo.lang.isUndefined(dojo.storage.onHideSettingsUI)) {
525
	if (dojo.storage.onHideSettingsUI != null && !dojo.lang.isUndefined(dojo.storage.onHideSettingsUI)) {
524
		dojo.storage.onHideSettingsUI.call(null);
526
		dojo.storage.onHideSettingsUI.call(null);
525
	}
527
	}
526
}, getType:function () {
528
}, getType:function () {
527
	return "dojo.storage.browser.FlashStorageProvider";
529
	return "dojo.storage.browser.FlashStorageProvider";
528
}, _flashLoaded:function () {
530
}, _flashLoaded:function () {
529
	this._initialized = true;
531
	this._initialized = true;
530
	dojo.storage.manager.loaded();
532
	dojo.storage.manager.loaded();
531
}, _onStatus:function (statusResult, key) {
533
}, _onStatus:function (statusResult, key) {
532
	var ds = dojo.storage;
534
	var ds = dojo.storage;
533
	var dfo = dojo.flash.obj;
535
	var dfo = dojo.flash.obj;
534
	if (statusResult == ds.PENDING) {
536
	if (statusResult == ds.PENDING) {
535
		dfo.center();
537
		dfo.center();
536
		dfo.setVisible(true);
538
		dfo.setVisible(true);
537
	} else {
539
	} else {
538
		dfo.setVisible(false);
540
		dfo.setVisible(false);
539
	}
541
	}
540
	if ((!dj_undef("_statusHandler", ds)) && (ds._statusHandler != null)) {
542
	if ((!dj_undef("_statusHandler", ds)) && (ds._statusHandler != null)) {
541
		ds._statusHandler.call(null, statusResult, key);
543
		ds._statusHandler.call(null, statusResult, key);
542
	}
544
	}
543
}});
545
}});
544
dojo.storage.manager.register("dojo.storage.browser.FileStorageProvider", new dojo.storage.browser.FileStorageProvider());
546
dojo.storage.manager.register("dojo.storage.browser.FileStorageProvider", new dojo.storage.browser.FileStorageProvider());
545
dojo.storage.manager.register("dojo.storage.browser.WhatWGStorageProvider", new dojo.storage.browser.WhatWGStorageProvider());
547
dojo.storage.manager.register("dojo.storage.browser.WhatWGStorageProvider", new dojo.storage.browser.WhatWGStorageProvider());
546
dojo.storage.manager.register("dojo.storage.browser.FlashStorageProvider", new dojo.storage.browser.FlashStorageProvider());
548
dojo.storage.manager.register("dojo.storage.browser.FlashStorageProvider", new dojo.storage.browser.FlashStorageProvider());
547
dojo.storage.manager.initialize();
549
dojo.storage.manager.initialize();
548
 
550