1 | //+----------------------------------------------------------------------------- |
---|
2 | //+ Isidorus |
---|
3 | //+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann |
---|
4 | //+ |
---|
5 | //+ Isidorus is freely distributable under the LGPL license. |
---|
6 | //+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both |
---|
7 | //+ are distributed under the MIT license. |
---|
8 | //+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and |
---|
9 | //+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt |
---|
10 | //+----------------------------------------------------------------------------- |
---|
11 | |
---|
12 | |
---|
13 | // --- Some constants fot the http connections via the XMLHttpRequest-Object |
---|
14 | var HOST_PREF = getHostPref(); |
---|
15 | var GET_PREFIX = HOST_PREF + "json/get/"; |
---|
16 | var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/"; |
---|
17 | var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/"; |
---|
18 | var TMCL_INSTANCE_URL = HOST_PREF + "json/tmcl/instance/"; |
---|
19 | var COMMIT_URL = HOST_PREF + "json/commit/"; |
---|
20 | var ALL_PSIS_URL = HOST_PREF + "json/psis/"; |
---|
21 | var TYPE_PSIS_URL = HOST_PREF + "json/tmcl/types/"; |
---|
22 | var INSTANCE_PSIS_URL = HOST_PREF + "json/tmcl/instances/"; |
---|
23 | var OWN_URL = HOST_PREF + "isidorus"; |
---|
24 | var SUMMARY_URL = HOST_PREF + "json/summary"; |
---|
25 | var TM_OVERVIEW = HOST_PREF + "json/tmcl/overview/"; |
---|
26 | var TIMEOUT = 20000; // const TIMEOUT = 10000 --> "const" doesn't work under IE |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | // --- A kind of enum for the the different pages with an attribute and a value |
---|
31 | var PAGES = {"home" : "home", "search" : "searchTopic", "edit" : "editTopic", "create" : "createTopic", "current" : ""}; |
---|
32 | |
---|
33 | var ANY_URI = "http://www.w3.org/2001/XMLSchema#anyURI"; |
---|
34 | var STRING = "http://www.w3.org/2001/XMLSchema#string"; |
---|
35 | var CURRENT_TOPIC = "**current-topic**"; |
---|
36 | var CURRENT_TOPIC_ESCAPED = "\\*\\*current-topic\\*\\*"; |
---|
37 | var INIT_DATE = ["If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT"]; |
---|
38 | var MAX_INT = "MAX_INT"; |
---|
39 | var MMAX_INT = "*"; |
---|
40 | |
---|
41 | |
---|
42 | // --- Contains most css classes used in this project |
---|
43 | // --- There should be called only the function to be sure to don't override |
---|
44 | // --- the original values. |
---|
45 | var CLASSES = {"page" : function(){ return "page"; }, |
---|
46 | "subPage" : function(){ return "subPage"; }, |
---|
47 | "content" : function(){ return "content"; }, |
---|
48 | "textrowWithRemoveButton" : function(){ return "textrowWithRemoveButton"; }, |
---|
49 | "textrowWithoutRemoveButton" : function(){ return "textrowWithoutRemoveButton"; }, |
---|
50 | "selectrowWithRemoveButton" : function(){ return "selectrowWithRemoveButton"; }, |
---|
51 | "selectrowWithoutRemoveButton" : function(){ return "selectrowWithoutRemoveButton"; }, |
---|
52 | "clickable" : function(){ return "clickable"; }, |
---|
53 | "error" : function(){ return "errorMessage" }, |
---|
54 | "fragmentFrame" : function(){ return "fragmentFrame"; }, |
---|
55 | "topicFrame" : function(){ return "topicFrame"; }, |
---|
56 | "topicIdFrame" : function(){ return "topicIdFrame"; }, |
---|
57 | "content" : function(){ return "content"; }, |
---|
58 | "description" : function(){ return "description"; }, |
---|
59 | "instanceOfFrame" : function(){ return "instanceOfFrame"; }, |
---|
60 | "itemIdentityFrame" : function(){ return "itemIdentityFrame"; }, |
---|
61 | "subjectLocatorFrame" : function(){ return "subjectLocatorFrame"; }, |
---|
62 | "subjectIdentifierFrame" : function(){ return "subjectIdentifierFrame"; }, |
---|
63 | "nameContainer" : function(){ return "nameContainer"; }, |
---|
64 | "nameFrame" : function(){ return "nameFrame"; }, |
---|
65 | "controlColumn" : function(){ return "controlColumn"; }, |
---|
66 | "showHiddenRows" : function(){ return "showHiddenRows"; }, |
---|
67 | "typeFrame" : function(){ return "typeFrame"; }, |
---|
68 | "scopeFrame" : function(){ return "scopeFrame"; }, |
---|
69 | "scopeContainer" : function(){ return "scopeContainer"; }, |
---|
70 | "valueFrame" : function(){ return "valueFrame"; }, |
---|
71 | "variantFrame" : function(){ return "variantFrame"; }, |
---|
72 | "variantContainer" : function(){ return "variantContainer"; }, |
---|
73 | "datatypeFrame" : function(){ return "datatypeFrame"; }, |
---|
74 | "occurrenceContainer" : function(){ return "occurrenceContainer"; }, |
---|
75 | "occurrenceFrame" : function(){ return "occurrenceFrame"; }, |
---|
76 | "associationContainer" : function(){ return "associationContainer"; }, |
---|
77 | "associationFrame" : function(){ return "associationFrame"; }, |
---|
78 | "roleContainer" : function(){ return "roleContainer"; }, |
---|
79 | "roleFrame" : function(){ return "roleFrame"; }, |
---|
80 | "playerFrame" : function(){ return "playerFrame"; }, |
---|
81 | "commitButton" : function(){ return "commitButton"; }, |
---|
82 | "tmIdFrame" : function(){ return "tmIdFrame"; }, |
---|
83 | "load" : function(){ return "loadFrame"; }, |
---|
84 | "ajaxLoader" : function(){ return "ajaxLoader"; }, |
---|
85 | "editFrame" : function(){ return "editFrame"; }, |
---|
86 | "disabled" : function(){ return "disabled"; }, |
---|
87 | "node" : function(){ return "treeNode"; }, |
---|
88 | "tree" : function(){ return "tree"; }, |
---|
89 | "treeView" : function(){ return "treeView"; }, |
---|
90 | "instances" : function(){ return "instances"; }, |
---|
91 | "subtypes" : function(){ return "subtypes"; }, |
---|
92 | "topicPsis" : function(){ return "topicPsis"; } |
---|
93 | }; |
---|
94 | |
---|
95 | |
---|
96 | // --- returns the current host prefix as string, so the user/admin needn't |
---|
97 | // --- setting it manually |
---|
98 | function getHostPref(){ |
---|
99 | var splitter = "/"; |
---|
100 | var splitterRate = 3; |
---|
101 | var fullUrl = window.location.href; |
---|
102 | var urlFragments = fullUrl.split("/"); |
---|
103 | var hostPref = ""; |
---|
104 | for(var i = 0; i !== splitterRate; ++i){ |
---|
105 | hostPref += urlFragments[i]; |
---|
106 | hostPref += "/"; |
---|
107 | } |
---|
108 | return hostPref; |
---|
109 | } |
---|