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
if (typeof window == "undefined") {
13
if (typeof window == "undefined") {
12
	dojo.raise("attempt to use adobe svg hostenv when no window object");
14
	dojo.raise("attempt to use adobe svg hostenv when no window object");
13
}
15
}
14
dojo.debug = function () {
16
dojo.debug = function () {
15
	if (!djConfig.isDebug) {
17
	if (!djConfig.isDebug) {
16
		return;
18
		return;
17
	}
19
	}
18
	var args = arguments;
20
	var args = arguments;
19
	var isJUM = dj_global["jum"];
21
	var isJUM = dj_global["jum"];
20
	var s = isJUM ? "" : "DEBUG: ";
22
	var s = isJUM ? "" : "DEBUG: ";
21
	for (var i = 0; i < args.length; ++i) {
23
	for (var i = 0; i < args.length; ++i) {
22
		s += args[i];
24
		s += args[i];
23
	}
25
	}
24
	if (isJUM) {
26
	if (isJUM) {
25
		jum.debug(s);
27
		jum.debug(s);
26
	} else {
28
	} else {
27
		dojo.hostenv.println(s);
29
		dojo.hostenv.println(s);
28
	}
30
	}
29
};
31
};
30
dojo.render.name = navigator.appName;
32
dojo.render.name = navigator.appName;
31
dojo.render.ver = parseFloat(navigator.appVersion, 10);
33
dojo.render.ver = parseFloat(navigator.appVersion, 10);
32
switch (navigator.platform) {
34
switch (navigator.platform) {
33
  case "MacOS":
35
  case "MacOS":
34
	dojo.render.os.osx = true;
36
	dojo.render.os.osx = true;
35
	break;
37
	break;
36
  case "Linux":
38
  case "Linux":
37
	dojo.render.os.linux = true;
39
	dojo.render.os.linux = true;
38
	break;
40
	break;
39
  case "Windows":
41
  case "Windows":
40
	dojo.render.os.win = true;
42
	dojo.render.os.win = true;
41
	break;
43
	break;
42
  default:
44
  default:
43
	dojo.render.os.linux = true;
45
	dojo.render.os.linux = true;
44
	break;
46
	break;
45
}
47
}
46
dojo.render.svg.capable = true;
48
dojo.render.svg.capable = true;
47
dojo.render.svg.support.builtin = true;
49
dojo.render.svg.support.builtin = true;
48
dojo.render.svg.moz = ((navigator.userAgent.indexOf("Gecko") >= 0) && (!((navigator.appVersion.indexOf("Konqueror") >= 0) || (navigator.appVersion.indexOf("Safari") >= 0))));
50
dojo.render.svg.moz = ((navigator.userAgent.indexOf("Gecko") >= 0) && (!((navigator.appVersion.indexOf("Konqueror") >= 0) || (navigator.appVersion.indexOf("Safari") >= 0))));
49
dojo.render.svg.adobe = (window.parseXML != null);
51
dojo.render.svg.adobe = (window.parseXML != null);
50
dojo.hostenv.startPackage("dojo.hostenv");
52
dojo.hostenv.startPackage("dojo.hostenv");
51
dojo.hostenv.println = function (s) {
53
dojo.hostenv.println = function (s) {
52
	try {
54
	try {
53
		var ti = document.createElement("text");
55
		var ti = document.createElement("text");
54
		ti.setAttribute("x", "50");
56
		ti.setAttribute("x", "50");
55
		ti.setAttribute("y", (25 + 15 * document.getElementsByTagName("text").length));
57
		ti.setAttribute("y", (25 + 15 * document.getElementsByTagName("text").length));
56
		ti.appendChild(document.createTextNode(s));
58
		ti.appendChild(document.createTextNode(s));
57
		document.documentElement.appendChild(ti);
59
		document.documentElement.appendChild(ti);
58
	}
60
	}
59
	catch (e) {
61
	catch (e) {
60
	}
62
	}
61
};
63
};
62
dojo.hostenv.name_ = "svg";
64
dojo.hostenv.name_ = "svg";
63
dojo.hostenv.setModulePrefix = function (module, prefix) {
65
dojo.hostenv.setModulePrefix = function (module, prefix) {
64
};
66
};
65
dojo.hostenv.getModulePrefix = function (module) {
67
dojo.hostenv.getModulePrefix = function (module) {
66
};
68
};
67
dojo.hostenv.getTextStack = [];
69
dojo.hostenv.getTextStack = [];
68
dojo.hostenv.loadUriStack = [];
70
dojo.hostenv.loadUriStack = [];
69
dojo.hostenv.loadedUris = [];
71
dojo.hostenv.loadedUris = [];
70
dojo.hostenv.modules_ = {};
72
dojo.hostenv.modules_ = {};
71
dojo.hostenv.modulesLoadedFired = false;
73
dojo.hostenv.modulesLoadedFired = false;
72
dojo.hostenv.modulesLoadedListeners = [];
74
dojo.hostenv.modulesLoadedListeners = [];
73
dojo.hostenv.getText = function (uri, cb, data) {
75
dojo.hostenv.getText = function (uri, cb, data) {
74
	if (!cb) {
76
	if (!cb) {
75
		var cb = function (result) {
77
		var cb = function (result) {
76
			window.alert(result);
78
			window.alert(result);
77
		};
79
		};
78
	}
80
	}
79
	if (!data) {
81
	if (!data) {
80
		window.getUrl(uri, cb);
82
		window.getUrl(uri, cb);
81
	} else {
83
	} else {
82
		window.postUrl(uri, data, cb);
84
		window.postUrl(uri, data, cb);
83
	}
85
	}
84
};
86
};
85
dojo.hostenv.getLibaryScriptUri = function () {
87
dojo.hostenv.getLibaryScriptUri = function () {
86
};
88
};
87
dojo.hostenv.loadUri = function (uri) {
89
dojo.hostenv.loadUri = function (uri) {
88
};
90
};
89
dojo.hostenv.loadUriAndCheck = function (uri, module) {
91
dojo.hostenv.loadUriAndCheck = function (uri, module) {
90
};
92
};
91
dojo.hostenv.loadModule = function (moduleName) {
93
dojo.hostenv.loadModule = function (moduleName) {
92
	var a = moduleName.split(".");
94
	var a = moduleName.split(".");
93
	var currentObj = window;
95
	var currentObj = window;
94
	var s = [];
96
	var s = [];
95
	for (var i = 0; i < a.length; i++) {
97
	for (var i = 0; i < a.length; i++) {
96
		if (a[i] == "*") {
98
		if (a[i] == "*") {
97
			continue;
99
			continue;
98
		}
100
		}
99
		s.push(a[i]);
101
		s.push(a[i]);
100
		if (!currentObj[a[i]]) {
102
		if (!currentObj[a[i]]) {
101
			dojo.raise("dojo.require('" + moduleName + "'): module does not exist.");
103
			dojo.raise("dojo.require('" + moduleName + "'): module does not exist.");
102
		} else {
104
		} else {
103
			currentObj = currentObj[a[i]];
105
			currentObj = currentObj[a[i]];
104
		}
106
		}
105
	}
107
	}
106
	return;
108
	return;
107
};
109
};
108
dojo.hostenv.startPackage = function (moduleName) {
110
dojo.hostenv.startPackage = function (moduleName) {
109
	var a = moduleName.split(".");
111
	var a = moduleName.split(".");
110
	var currentObj = window;
112
	var currentObj = window;
111
	var s = [];
113
	var s = [];
112
	for (var i = 0; i < a.length; i++) {
114
	for (var i = 0; i < a.length; i++) {
113
		if (a[i] == "*") {
115
		if (a[i] == "*") {
114
			continue;
116
			continue;
115
		}
117
		}
116
		s.push(a[i]);
118
		s.push(a[i]);
117
		if (!currentObj[a[i]]) {
119
		if (!currentObj[a[i]]) {
118
			currentObj[a[i]] = {};
120
			currentObj[a[i]] = {};
119
		}
121
		}
120
		currentObj = currentObj[a[i]];
122
		currentObj = currentObj[a[i]];
121
	}
123
	}
122
	return;
124
	return;
123
};
125
};
124
if (window.parseXML) {
126
if (window.parseXML) {
125
	window.XMLSerialzer = function () {
127
	window.XMLSerialzer = function () {
126
		function nodeToString(n, a) {
128
		function nodeToString(n, a) {
127
			function fixText(s) {
129
			function fixText(s) {
128
				return String(s).replace(/\&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;");
130
				return String(s).replace(/\&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;");
129
			}
131
			}
130
			function fixAttribute(s) {
132
			function fixAttribute(s) {
131
				return fixText(s).replace(/\"/g, "&quot;");
133
				return fixText(s).replace(/\"/g, "&quot;");
132
			}
134
			}
133
			switch (n.nodeType) {
135
			switch (n.nodeType) {
134
			  case 1:
136
			  case 1:
135
				var name = n.nodeName;
137
				var name = n.nodeName;
136
				a.push("<" + name);
138
				a.push("<" + name);
137
				for (var i = 0; i < n.attributes.length; i++) {
139
				for (var i = 0; i < n.attributes.length; i++) {
138
					if (n.attributes.item(i).specified) {
140
					if (n.attributes.item(i).specified) {
139
						a.push(" " + n.attributes.item(i).nodeName.toLowerCase() + "=\"" + fixAttribute(n.attributes.item(i).nodeValue) + "\"");
141
						a.push(" " + n.attributes.item(i).nodeName.toLowerCase() + "=\"" + fixAttribute(n.attributes.item(i).nodeValue) + "\"");
140
					}
142
					}
141
				}
143
				}
142
				if (n.canHaveChildren || n.hasChildNodes()) {
144
				if (n.canHaveChildren || n.hasChildNodes()) {
143
					a.push(">");
145
					a.push(">");
144
					for (var i = 0; i < n.childNodes.length; i++) {
146
					for (var i = 0; i < n.childNodes.length; i++) {
145
						nodeToString(n.childNodes.item(i), a);
147
						nodeToString(n.childNodes.item(i), a);
146
					}
148
					}
147
					a.push("</" + name + ">\n");
149
					a.push("</" + name + ">\n");
148
				} else {
150
				} else {
149
					a.push(" />\n");
151
					a.push(" />\n");
150
				}
152
				}
151
				break;
153
				break;
152
			  case 3:
154
			  case 3:
153
				a.push(fixText(n.nodeValue));
155
				a.push(fixText(n.nodeValue));
154
				break;
156
				break;
155
			  case 4:
157
			  case 4:
156
				a.push("<![CDA" + "TA[\n" + n.nodeValue + "\n]" + "]>");
158
				a.push("<![CDA" + "TA[\n" + n.nodeValue + "\n]" + "]>");
157
				break;
159
				break;
158
			  case 7:
160
			  case 7:
159
				a.push(n.nodeValue);
161
				a.push(n.nodeValue);
160
				if (/(^<\?xml)|(^<\!DOCTYPE)/.test(n.nodeValue)) {
162
				if (/(^<\?xml)|(^<\!DOCTYPE)/.test(n.nodeValue)) {
161
					a.push("\n");
163
					a.push("\n");
162
				}
164
				}
163
				break;
165
				break;
164
			  case 8:
166
			  case 8:
165
				a.push("<!-- " + n.nodeValue + " -->\n");
167
				a.push("<!-- " + n.nodeValue + " -->\n");
166
				break;
168
				break;
167
			  case 9:
169
			  case 9:
168
			  case 11:
170
			  case 11:
169
				for (var i = 0; i < n.childNodes.length; i++) {
171
				for (var i = 0; i < n.childNodes.length; i++) {
170
					nodeToString(n.childNodes.item(i), a);
172
					nodeToString(n.childNodes.item(i), a);
171
				}
173
				}
172
				break;
174
				break;
173
			  default:
175
			  default:
174
				a.push("<!--\nNot Supported:\n\n" + "nodeType: " + n.nodeType + "\nnodeName: " + n.nodeName + "\n-->");
176
				a.push("<!--\nNot Supported:\n\n" + "nodeType: " + n.nodeType + "\nnodeName: " + n.nodeName + "\n-->");
175
			}
177
			}
176
		}
178
		}
177
		this.serializeToString = function (node) {
179
		this.serializeToString = function (node) {
178
			var a = [];
180
			var a = [];
179
			nodeToString(node, a);
181
			nodeToString(node, a);
180
			return a.join("");
182
			return a.join("");
181
		};
183
		};
182
	};
184
	};
183
	window.DOMParser = function () {
185
	window.DOMParser = function () {
184
		this.parseFromString = function (s) {
186
		this.parseFromString = function (s) {
185
			return parseXML(s, window.document);
187
			return parseXML(s, window.document);
186
		};
188
		};
187
	};
189
	};
188
	window.XMLHttpRequest = function () {
190
	window.XMLHttpRequest = function () {
189
		var uri = null;
191
		var uri = null;
190
		var method = "POST";
192
		var method = "POST";
191
		var isAsync = true;
193
		var isAsync = true;
192
		var cb = function (d) {
194
		var cb = function (d) {
193
			this.responseText = d.content;
195
			this.responseText = d.content;
194
			try {
196
			try {
195
				this.responseXML = parseXML(this.responseText, window.document);
197
				this.responseXML = parseXML(this.responseText, window.document);
196
			}
198
			}
197
			catch (e) {
199
			catch (e) {
198
			}
200
			}
199
			this.status = "200";
201
			this.status = "200";
200
			this.statusText = "OK";
202
			this.statusText = "OK";
201
			if (!d.success) {
203
			if (!d.success) {
202
				this.status = "500";
204
				this.status = "500";
203
				this.statusText = "Internal Server Error";
205
				this.statusText = "Internal Server Error";
204
			}
206
			}
205
			this.onload();
207
			this.onload();
206
			this.onreadystatechange();
208
			this.onreadystatechange();
207
		};
209
		};
208
		this.onload = function () {
210
		this.onload = function () {
209
		};
211
		};
210
		this.readyState = 4;
212
		this.readyState = 4;
211
		this.onreadystatechange = function () {
213
		this.onreadystatechange = function () {
212
		};
214
		};
213
		this.status = 0;
215
		this.status = 0;
214
		this.statusText = "";
216
		this.statusText = "";
215
		this.responseBody = null;
217
		this.responseBody = null;
216
		this.responseStream = null;
218
		this.responseStream = null;
217
		this.responseXML = null;
219
		this.responseXML = null;
218
		this.responseText = null;
220
		this.responseText = null;
219
		this.abort = function () {
221
		this.abort = function () {
220
			return;
222
			return;
221
		};
223
		};
222
		this.getAllResponseHeaders = function () {
224
		this.getAllResponseHeaders = function () {
223
			return [];
225
			return [];
224
		};
226
		};
225
		this.getResponseHeader = function (n) {
227
		this.getResponseHeader = function (n) {
226
			return null;
228
			return null;
227
		};
229
		};
228
		this.setRequestHeader = function (nm, val) {
230
		this.setRequestHeader = function (nm, val) {
229
		};
231
		};
230
		this.open = function (meth, url, async) {
232
		this.open = function (meth, url, async) {
231
			method = meth;
233
			method = meth;
232
			uri = url;
234
			uri = url;
233
		};
235
		};
234
		this.send = function (data) {
236
		this.send = function (data) {
235
			var d = data || null;
237
			var d = data || null;
236
			if (method == "GET") {
238
			if (method == "GET") {
237
				getURL(uri, cb);
239
				getURL(uri, cb);
238
			} else {
240
			} else {
239
				postURL(uri, data, cb);
241
				postURL(uri, data, cb);
240
			}
242
			}
241
		};
243
		};
242
	};
244
	};
243
}
245
}
244
dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug");
246
dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug");
245
 
247