source: branches/gdl-frontend/src/ajax/javascripts/constants.js

Last change on this file was 351, checked in by lgiessmann, 14 years ago

Isidorus-UI: fixed ticket #96 => set the timeout to 30 seconds to avoid time-out errors; removed the setting of the exteranl-default-format in isidorus.asd, since it should be set explcitly by the end user

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