Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
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:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
var dj_global = this;
14
var dj_currentContext = this;
15
function dj_undef(name, object) {
16
	return (typeof (object || dj_currentContext)[name] == "undefined");
17
}
18
if (dj_undef("djConfig", this)) {
19
	var djConfig = {};
20
}
21
if (dj_undef("dojo", this)) {
22
	var dojo = {};
23
}
24
dojo.global = function () {
25
	return dj_currentContext;
26
};
27
dojo.locale = djConfig.locale;
1422 alexandre_ 28
dojo.version = {major:0, minor:4, patch:3, flag:"", revision:Number("$Rev: 8617 $".match(/[0-9]+/)[0]), toString:function () {
1318 alexandre_ 29
	with (dojo.version) {
30
		return major + "." + minor + "." + patch + flag + " (" + revision + ")";
31
	}
32
}};
33
dojo.evalProp = function (name, object, create) {
34
	if ((!object) || (!name)) {
35
		return undefined;
36
	}
37
	if (!dj_undef(name, object)) {
38
		return object[name];
39
	}
40
	return (create ? (object[name] = {}) : undefined);
41
};
42
dojo.parseObjPath = function (path, context, create) {
43
	var object = (context || dojo.global());
44
	var names = path.split(".");
45
	var prop = names.pop();
46
	for (var i = 0, l = names.length; i < l && object; i++) {
47
		object = dojo.evalProp(names[i], object, create);
48
	}
49
	return {obj:object, prop:prop};
50
};
51
dojo.evalObjPath = function (path, create) {
52
	if (typeof path != "string") {
53
		return dojo.global();
54
	}
55
	if (path.indexOf(".") == -1) {
56
		return dojo.evalProp(path, dojo.global(), create);
57
	}
58
	var ref = dojo.parseObjPath(path, dojo.global(), create);
59
	if (ref) {
60
		return dojo.evalProp(ref.prop, ref.obj, create);
61
	}
62
	return null;
63
};
64
dojo.errorToString = function (exception) {
65
	if (!dj_undef("message", exception)) {
66
		return exception.message;
67
	} else {
68
		if (!dj_undef("description", exception)) {
69
			return exception.description;
70
		} else {
71
			return exception;
72
		}
73
	}
74
};
75
dojo.raise = function (message, exception) {
76
	if (exception) {
77
		message = message + ": " + dojo.errorToString(exception);
78
	} else {
79
		message = dojo.errorToString(message);
80
	}
81
	try {
82
		if (djConfig.isDebug) {
83
			dojo.hostenv.println("FATAL exception raised: " + message);
84
		}
85
	}
86
	catch (e) {
87
	}
88
	throw exception || Error(message);
89
};
90
dojo.debug = function () {
91
};
92
dojo.debugShallow = function (obj) {
93
};
94
dojo.profile = {start:function () {
95
}, end:function () {
96
}, stop:function () {
97
}, dump:function () {
98
}};
99
function dj_eval(scriptFragment) {
100
	return dj_global.eval ? dj_global.eval(scriptFragment) : eval(scriptFragment);
101
}
102
dojo.unimplemented = function (funcname, extra) {
103
	var message = "'" + funcname + "' not implemented";
104
	if (extra != null) {
105
		message += " " + extra;
106
	}
107
	dojo.raise(message);
108
};
109
dojo.deprecated = function (behaviour, extra, removal) {
110
	var message = "DEPRECATED: " + behaviour;
111
	if (extra) {
112
		message += " " + extra;
113
	}
114
	if (removal) {
115
		message += " -- will be removed in version: " + removal;
116
	}
117
	dojo.debug(message);
118
};
119
dojo.render = (function () {
120
	function vscaffold(prefs, names) {
121
		var tmp = {capable:false, support:{builtin:false, plugin:false}, prefixes:prefs};
122
		for (var i = 0; i < names.length; i++) {
123
			tmp[names[i]] = false;
124
		}
125
		return tmp;
126
	}
127
	return {name:"", ver:dojo.version, os:{win:false, linux:false, osx:false}, html:vscaffold(["html"], ["ie", "opera", "khtml", "safari", "moz"]), svg:vscaffold(["svg"], ["corel", "adobe", "batik"]), vml:vscaffold(["vml"], ["ie"]), swf:vscaffold(["Swf", "Flash", "Mm"], ["mm"]), swt:vscaffold(["Swt"], ["ibm"])};
128
})();
129
dojo.hostenv = (function () {
130
	var config = {isDebug:false, allowQueryConfig:false, baseScriptUri:"", baseRelativePath:"", libraryScriptUri:"", iePreventClobber:false, ieClobberMinimal:true, preventBackButtonFix:true, delayMozLoadingFix:false, searchIds:[], parseWidgets:true};
131
	if (typeof djConfig == "undefined") {
132
		djConfig = config;
133
	} else {
134
		for (var option in config) {
135
			if (typeof djConfig[option] == "undefined") {
136
				djConfig[option] = config[option];
137
			}
138
		}
139
	}
140
	return {name_:"(unset)", version_:"(unset)", getName:function () {
141
		return this.name_;
142
	}, getVersion:function () {
143
		return this.version_;
144
	}, getText:function (uri) {
145
		dojo.unimplemented("getText", "uri=" + uri);
146
	}};
147
})();
148
dojo.hostenv.getBaseScriptUri = function () {
149
	if (djConfig.baseScriptUri.length) {
150
		return djConfig.baseScriptUri;
151
	}
152
	var uri = new String(djConfig.libraryScriptUri || djConfig.baseRelativePath);
153
	if (!uri) {
154
		dojo.raise("Nothing returned by getLibraryScriptUri(): " + uri);
155
	}
156
	var lastslash = uri.lastIndexOf("/");
157
	djConfig.baseScriptUri = djConfig.baseRelativePath;
158
	return djConfig.baseScriptUri;
159
};
160