isidorus-cvs
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
June 2009
- 1 participants
- 50 discussions

30 Jun '09
Author: lgiessmann
Date: Tue Jun 30 09:21:53 2009
New Revision: 82
Log:
ajax-client: fixed some info-messages when the client requests something
Modified:
trunk/src/ajax/javascripts/requests.js
trunk/src/rest_interface/set-up-json-interface.lisp
Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js (original)
+++ trunk/src/ajax/javascripts/requests.js Tue Jun 30 09:21:53 2009
@@ -89,12 +89,20 @@
try{
var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler;
var timeFun = setAjaxTimeout(TIMEOUT, TYPE_PSIS_URL);
- onLoad("Requesting all type PSIs");
-
+
var url = ALL_PSIS_URL;
+ var message = "Requesting all type PSIs";
if(what && what.types && what.types === true) url = TYPE_PSIS_URL;
- else if(what && what.instances && what.instances === true) url = INSTANCE_PSIS_URL;
- else if(what && what.all && what.all === true) url = ALL_PSIS_URL;
+ else if(what && what.instances && what.instances === true){
+ url = INSTANCE_PSIS_URL;
+ message = "Requesting all instance PSIs";
+ }
+ else if(what && what.all && what.all === true){
+ url = ALL_PSIS_URL;
+ message = "Requesting all PSIs";
+ }
+
+ onLoad(message);
new Ajax.Request(url, {
"method" : "get",
Modified: trunk/src/rest_interface/set-up-json-interface.lisp
==============================================================================
--- trunk/src/rest_interface/set-up-json-interface.lisp (original)
+++ trunk/src/rest_interface/set-up-json-interface.lisp Tue Jun 30 09:21:53 2009
@@ -19,7 +19,7 @@
(defparameter *json-get-type-tmcl-url* "/json/tmcl/type/?$") ;the json url for getting some tmcl information of a topic treated as a type
(defparameter *json-get-instance-tmcl-url* "/json/tmcl/instance/?$") ;the json url for getting some tmcl information of a topic treated as an instance
(defparameter *json-get-overview* "/json/tmcl/overview/?$") ; returns a json-object representing a tree view
-(defparameter *ajax-user-interface-url* "/isidorus/?$") ;the url to the user interface; if you want to get all topics set start=0&end=nil -> localhost:8000/isidorus
+(defparameter *ajax-user-interface-url* "/isidorus/?$") ;the url to the user interface;
(defparameter *ajax-user-interface-css-prefix* "/css") ;the url to the css files of the user interface
(defparameter *ajax-user-interface-css-directory-path* "ajax/css") ;the directory contains the css files
(defparameter *ajax-user-interface-file-path* "ajax/isidorus.html") ;the file path to the HTML file implements the user interface
1
0
Author: lgiessmann
Date: Tue Jun 30 06:22:06 2009
New Revision: 81
Log:
ajax-client: set the default address to localhost:8000
Modified:
trunk/src/ajax/javascripts/constants.js
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Tue Jun 30 06:22:06 2009
@@ -11,7 +11,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object
-var HOST_PREF = "http://143.93.190.237:8000/"; // "http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = /*"http://143.93.190.237:8000/";*/ "http://localhost:8000/"; // of the form "http://(.+)/"
var GET_PREFIX = HOST_PREF + "json/get/";
var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
1
0

[isidorus-cvs] r80 - in trunk/src: ajax/css ajax/javascripts unit_tests
by Lukas Giessmann 30 Jun '09
by Lukas Giessmann 30 Jun '09
30 Jun '09
Author: lgiessmann
Date: Tue Jun 30 06:16:38 2009
New Revision: 80
Log:
ajax-client: implemented a topic map overview
Modified:
trunk/src/ajax/css/tree.css
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/ajax/javascripts/edit.js
trunk/src/ajax/javascripts/home.js
trunk/src/unit_tests/poems.xtm
Modified: trunk/src/ajax/css/tree.css
==============================================================================
--- trunk/src/ajax/css/tree.css (original)
+++ trunk/src/ajax/css/tree.css Tue Jun 30 06:16:38 2009
@@ -27,18 +27,28 @@
}
ul.topicPsis + span {
+ color: #7090d0;
+ font-size: 0.8em;
margin-left: 20px;
- margin-right: 2px;
}
-ul.topicPsis + span + span{
+ul.topicPsis + span + span + span {
+ color: #7090d0;
+ font-size: 0.8em;
+}
+
+ul.topicPsis + span + span {
+ color: #7090d0;
margin-left: 2px;
+ margin-right: 2px;
}
ul.topicPsis + span.disabled {
+ font-size: 0.8em;
color: #eaeaee;
}
-ul.topicPsis + span + span.disabled {
+ul.topicPsis + span + span + span.disabled {
+ font-size: 0.8em;
color: #eaeaee;
}
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Tue Jun 30 06:16:38 2009
@@ -11,7 +11,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object
-var HOST_PREF = /*"http://143.93.190.237:8000/";*/ "http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = "http://143.93.190.237:8000/"; // "http://localhost:8000/"; // of the form "http://(.+)/"
var GET_PREFIX = HOST_PREF + "json/get/";
var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Tue Jun 30 06:16:38 2009
@@ -43,7 +43,7 @@
liTopicSelect.insert({"bottom" : err});
}
else {
- instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment);
+ instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment, psi);
liTopicSelect.insert({"bottom" : instanceOf.getFrame()});
}
}
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Tue Jun 30 06:16:38 2009
@@ -186,6 +186,18 @@
"enable" : function(){
this.__content__.removeAttribute("disabled");
this.__disabled__ = false;
+ },
+ "select" : function(value){
+ var opts = this.__content__.select("option");
+ for(var i = 0; i !== opts.length; ++i){
+ try{
+ if(opts[i].value === value){
+ opts[i].writeAttribute({"selected" : "selected"});
+ this.__content__.insert({"top" : opts[i]});
+ }
+ else opts[i].removeAttribute("selected");
+ }catch(err){ alert("err [" + i + "]" + err); }
+ }
}});
@@ -243,12 +255,13 @@
// --- Representation of a
-var EditC = Class.create(ContainerC, {"initialize" : function($super, contents, successFun){
+var EditC = Class.create(ContainerC, {"initialize" : function($super, contents, successFun, psi){
$super();
this.__frame__.writeAttribute({"class" : CLASSES.editFrame()});
this.__container__ = new Object();
try{
var row = new SelectrowC(contents, this.__container__, 1, 1);
+ if(psi && psi.length !== 0) row.select(psi);
this.__error__.insert({"before" : row.getFrame()});
}
catch(err){
@@ -274,6 +287,12 @@
clearFragment();
requestConstraints("[" + myself.toJSON() + "]", onSuccessHandler, null)
});
+
+ if(psi && psi.length !== 0) {
+ myself.hideError();
+ clearFragment();
+ requestConstraints("[" + myself.toJSON() + "]", onSuccessHandler, null);
+ }
}
setHandler(this);
@@ -288,12 +307,13 @@
// --- Represents a container for all instanceOf-Psis of a fragment's topic
-var InstanceOfC = Class.create(ContainerC, {"initialize" : function($super, contents, successFun){
+var InstanceOfC = Class.create(ContainerC, {"initialize" : function($super, contents, successFun, psi){
$super();
this.__frame__.writeAttribute({"class" : CLASSES.instanceOfFrame()});
this.__container__ = new Object();
try{
var row = new SelectrowC(contents, this.__container__, 1, -1);
+ if(psi && psi.length !== 0) row.select(psi);
this.__error__.insert({"before" : row.getFrame()});
}
catch(err){
@@ -339,6 +359,12 @@
clearFragment();
requestConstraints(myself.toJSON(true), onSuccessHandler, null, true);
});
+
+ if(psi && psi.length !== 0) {
+ myself.hideError();
+ clearFragment();
+ requestConstraints(myself.toJSON(true), onSuccessHandler, null, true);
+ }
}
setHandler(this);
@@ -2824,7 +2850,7 @@
}
},
"__createFromContent__" : function(contents){
- if(!contents || contents.lenght === 0) return;
+ if(!contents || contents.length === 0) return;
var cContents = contents;
var usedContents = new Array();
Modified: trunk/src/ajax/javascripts/edit.js
==============================================================================
--- trunk/src/ajax/javascripts/edit.js (original)
+++ trunk/src/ajax/javascripts/edit.js Tue Jun 30 06:16:38 2009
@@ -53,7 +53,8 @@
liTopicSelect.insert({"bottom" : err});
}
else {
- edit = new EditC(json.flatten().sort(), innerMakeFragment);
+ if(!psi || psi.strip().lenght === 0) psi = null;
+ edit = new EditC(json.flatten().sort(), innerMakeFragment, psi);
liTopicSelect.insert({"bottom" : edit.getFrame()});
}
}
Modified: trunk/src/ajax/javascripts/home.js
==============================================================================
--- trunk/src/ajax/javascripts/home.js (original)
+++ trunk/src/ajax/javascripts/home.js Tue Jun 30 06:16:38 2009
@@ -42,6 +42,7 @@
}
+// --- Represents a list of trees.
var TreeViewC = Class.create({"initialize" : function(contents){
if(!contents) throw "From NodeC(): content must be set!";
try {
@@ -60,6 +61,7 @@
}});
+// --- Represents the root of a tree of nodes and contain all tree's nodes.
var TreeC = Class.create({"initialize" : function(content){
if(!content) throw "From NodeC(): content must be set!";
try {
@@ -75,17 +77,49 @@
}});
+// --- Represents a tree node with a topic as a list of psis,
+// --- an edit and a create button. Furter the node can contain
+// --- more nodes as listings of instances and subtypes of the
+// --- current node's topic.
var NodeC = Class.create({"initialize" : function(content){
if(!content) throw "From NodeC(): content must be set!";
try {
this.__frame__ = new Element("li", {"class" : CLASSES.node()});
+ this.__isMinimized__ = false;
+
+ function setClickHandler(myself){
+ myself.__frame__.observe("click", function(event){
+ if(myself.__isMinimized__ === false){
+ if(myself.__instances__) myself.__instances__.hide();
+ if(myself.__subtypes__) myself.__subtypes__.hide();
+ myself.__frame__.setStyle({"color" : "#ff7f00"});
+ myself.__isMinimized__ = true;
+ }
+ else {
+ if(myself.__instances__) myself.__instances__.show();
+ if(myself.__subtypes__) myself.__subtypes__.show();
+ myself.__frame__.setStyle({"color" : "inherit"});
+ myself.__isMinimized__ = false;
+ }
+ Event.stop(event);
+ });
+ }
+ setClickHandler(this);
+
+ if((content.instances && content.instances.length !== 0) || (content.subtypes && content.subtypes.length !== 0)) {
+ this.getFrame().setStyle({"cursor" : "pointer"});
+ }
+ else {
+ this.getFrame().setStyle({"cursor" : "text"});
+ }
+
this.__topic__ = new Element("ul", {"class" : CLASSES.topicPsis()});
- this.__frame__.update(this.__topic__);
+ this.__frame__.insert({"bottom" : this.__topic__});
for(var i = 0; content.topic && i !== content.topic.length; ++i){
var tLi = new Element("li").update(content.topic[i]);
this.__topic__.insert({"bottom" : tLi});
}
-
+
this.__edit__ = new Element("span", {"class" : CLASSES.clickable()}).update("edit");
this.__create__ = new Element("span", {"class" : CLASSES.clickable()}).update("create");
if(content.isType !== true){
@@ -93,9 +127,10 @@
}
else {
this.__create__.observe("click", function(event){
- alert("create");
+ setNaviClasses($(PAGES.create));
+ makePage(PAGES.create, content.topic[0]);
+ Event.stop(event);
});
- // TODO: define a handler
}
if(content.isInstance !== true){
@@ -103,14 +138,15 @@
}
else {
this.__edit__.observe("click", function(event){
- alert("edit");
+ setNaviClasses($(PAGES.edit));
+ makePage(PAGES.edit, content.topic[0]);
+ Event.stop(event);
});
- // TODO: define a handler
}
- this.__frame__.update(this.__topic__);
this.__frame__.insert({"bottom" : this.__edit__});
- this.__frame__.insert({"bottom" : "|"});
+ this.__frame__.insert({"bottom" : "<span>|</span>"});
this.__frame__.insert({"bottom" : this.__create__});
+ for(var i = 1; content.topic && i < content.topic.length; ++i) this.__frame__.insert({"bottom" : "<br/><span> </span>"});
this.__instances__ = null;
this.__subtypes__ = null;
Modified: trunk/src/unit_tests/poems.xtm
==============================================================================
--- trunk/src/unit_tests/poems.xtm (original)
+++ trunk/src/unit_tests/poems.xtm Tue Jun 30 06:16:38 2009
@@ -619,6 +619,7 @@
<!-- author -->
<tm:topic id="author">
<tm:subjectIdentifier href="http://some.where/base-psis/author"/>
+ <tm:subjectIdentifier href="http://some.where/base-psis/author-psi"/>
<tm:instanceOf><tm:topicRef href="#topictype"/></tm:instanceOf>
</tm:topic>
1
0

[isidorus-cvs] r79 - in trunk: docs src/ajax src/ajax/css src/ajax/javascripts
by Lukas Giessmann 29 Jun '09
by Lukas Giessmann 29 Jun '09
29 Jun '09
Author: lgiessmann
Date: Mon Jun 29 14:39:18 2009
New Revision: 79
Log:
ajax-client: implemented a skeleton for a topic map overview, currently a css-style and some handlers are missing
Added:
trunk/src/ajax/css/tree.css (contents, props changed)
- copied, changed from r73, /trunk/src/ajax/css/main.css
Modified:
trunk/docs/xtm_json.txt
trunk/src/ajax/css/main.css
trunk/src/ajax/isidorus.html
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/home.js
trunk/src/ajax/javascripts/requests.js
Modified: trunk/docs/xtm_json.txt
==============================================================================
--- trunk/docs/xtm_json.txt (original)
+++ trunk/docs/xtm_json.txt Mon Jun 29 14:39:18 2009
@@ -171,6 +171,27 @@
//+-----------------------------------------------------------------------------
+//+ topic map overview - node
+//+ Contains a list of trees, that represents a topic map by representing
+//+ all valid topics and their super-subtypes and type-instance
+//+ relationships.
+//+-----------------------------------------------------------------------------
+{
+ "topic" : ["psi-1", "psi-2"],
+ "isType" : <boolean>,
+ "isInstance" : <boolean>,
+ "instances" : [ <node> ]
+}
+
+
+//+-----------------------------------------------------------------------------
+//+ topic map overview - treeview
+//+ Contains alist of nodes.
+//+-----------------------------------------------------------------------------
+[ <node>, <node>, <...> ]
+
+
+//+-----------------------------------------------------------------------------
//+ Part 3: TMCL - data model
//+ This part explains how the tmcl-rules/suggestions of isidorus are
//+ sent via HTTP as JSON-data.
Modified: trunk/src/ajax/css/main.css
==============================================================================
--- trunk/src/ajax/css/main.css (original)
+++ trunk/src/ajax/css/main.css Mon Jun 29 14:39:18 2009
@@ -23,7 +23,7 @@
border-right: 1px solid #d1d1d3;
border-bottom: 1px solid #d1d1d3;
margin-top: -21px;
- padding-bottom: 21px;
+ padding-bottom: 60px;
}
h1 {
Copied: trunk/src/ajax/css/tree.css (from r73, /trunk/src/ajax/css/main.css)
==============================================================================
--- /trunk/src/ajax/css/main.css (original)
+++ trunk/src/ajax/css/tree.css Mon Jun 29 14:39:18 2009
@@ -10,57 +10,35 @@
/*----------------------------------------------------------------------------*/
-body {
- width: 1024px;
- margin-left: auto;
- margin-right: auto;
-}
-
-#subPage {
- color: #333377;
- min-height: 800px;
- border-left: 1px solid #d1d1d3;
- border-right: 1px solid #d1d1d3;
- border-bottom: 1px solid #d1d1d3;
- margin-top: -21px;
- padding-bottom: 21px;
+ul.treeView {
+ padding-top: 10px;
+ padding-left: 20px;
+ list-style-type: none;
}
-h1 {
- clear: left;
- margin-left: 10px;
- padding-top: 20px;
-}
-
-.clickable {
- cursor: pointer;
+ul.treeView ul {
+ padding-left: 20px;
+ list-style-type: none;
}
-.clickable:hover{
- color: #ff7f00;
-}
-
-.deselect {
- cursor: pointer;
+ul.topicPsis {
+ float: left;
+ clear: left;
}
-.deselect:hover{
- color: #ff7f00;
+ul.topicPsis + span {
+ margin-left: 20px;
+ margin-right: 2px;
}
-.errorMessage {
- margin: 0.5em;
- color: red;
- font-size: 0.85em;
+ul.topicPsis + span + span{
+ margin-left: 2px;
}
-div.loadFrame {
- padding: 2em;
- color: #ff7f00;
- text-align: center;
+ul.topicPsis + span.disabled {
+ color: #eaeaee;
}
-img.ajaxLoader {
- display: none;
- margin-left: 412px; /* the image has a width of 100px --> 1024/2 - 100 = 412*/
+ul.topicPsis + span + span.disabled {
+ color: #eaeaee;
}
\ No newline at end of file
Modified: trunk/src/ajax/isidorus.html
==============================================================================
--- trunk/src/ajax/isidorus.html (original)
+++ trunk/src/ajax/isidorus.html Mon Jun 29 14:39:18 2009
@@ -20,6 +20,7 @@
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<link rel="stylesheet" type="text/css" href="css/frame.css"/>
<link rel="stylesheet" type="text/css" href="css/navi.css"/>
+ <link rel="stylesheet" type="text/css" href="css/tree.css"/>
<!-- error handling for javascript code -->
<script language="JavaScript" type="text/javascript"> <!--
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Mon Jun 29 14:39:18 2009
@@ -11,7 +11,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object
-var HOST_PREF = "http://143.93.190.237:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = /*"http://143.93.190.237:8000/";*/ "http://localhost:8000/"; // of the form "http://(.+)/"
var GET_PREFIX = HOST_PREF + "json/get/";
var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
@@ -83,5 +83,11 @@
"load" : function(){ return "loadFrame"; },
"ajaxLoader" : function(){ return "ajaxLoader"; },
"editFrame" : function(){ return "editFrame"; },
- "disabled" : function(){ return "disabled"; }
+ "disabled" : function(){ return "disabled"; },
+ "node" : function(){ return "treeNode"; },
+ "tree" : function(){ return "tree"; },
+ "treeView" : function(){ return "treeView"; },
+ "instances" : function(){ return "instances"; },
+ "subtypes" : function(){ return "subtypes"; },
+ "topicPsis" : function(){ return "topicPsis"; }
};
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/home.js
==============================================================================
--- trunk/src/ajax/javascripts/home.js (original)
+++ trunk/src/ajax/javascripts/home.js Mon Jun 29 14:39:18 2009
@@ -16,4 +16,128 @@
var header = new Element("h1").update("Topic Map Overview");
content.insert({"bottom" : header});
$(CLASSES.subPage()).insert({"bottom" : content});
+
+ function successFun(xhr){
+ var json = null;
+ try{
+ json = xhr.responseText.evalJSON();
+ }
+ catch(innrErr){}
+
+ try{
+ if(json === null) {
+ alert("The server's response does not contain any topics!");
+ }
+ else {
+ var treeView = new TreeViewC(json);
+ content.insert({"bottom" : treeView.getFrame()});
+ }
+ }
+ catch(err) {
+ alert("Could not create a Topic Map overview: " + err);
+ }
+ }
+
+ requestTreeView(successFun, null);
}
+
+
+var TreeViewC = Class.create({"initialize" : function(contents){
+ if(!contents) throw "From NodeC(): content must be set!";
+ try {
+ this.__frame__ = new Element("ul", {"class" : CLASSES.treeView()});
+ for(var i = 0; i !== contents.length; ++i){
+ var tLi = new Element("li").update(new TreeC(contents[i]).getFrame());
+ this.__frame__.insert({"bottom" : tLi});
+ }
+ }
+ catch(err){
+ throw "From TreeC(): The following exception was thrown:\n" + err;
+ }
+ },
+ "getFrame" : function(){
+ return this.__frame__;
+ }});
+
+
+var TreeC = Class.create({"initialize" : function(content){
+ if(!content) throw "From NodeC(): content must be set!";
+ try {
+ this.__frame__ = new Element("ul", {"class" : CLASSES.tree()});
+ this.__frame__.update(new NodeC(content).getFrame());
+ }
+ catch(err){
+ throw "From TreeC(): The following exception was thrown:\n" + err;
+ }
+ },
+ "getFrame" : function(){
+ return this.__frame__;
+ }});
+
+
+var NodeC = Class.create({"initialize" : function(content){
+ if(!content) throw "From NodeC(): content must be set!";
+ try {
+ this.__frame__ = new Element("li", {"class" : CLASSES.node()});
+ this.__topic__ = new Element("ul", {"class" : CLASSES.topicPsis()});
+ this.__frame__.update(this.__topic__);
+ for(var i = 0; content.topic && i !== content.topic.length; ++i){
+ var tLi = new Element("li").update(content.topic[i]);
+ this.__topic__.insert({"bottom" : tLi});
+ }
+
+ this.__edit__ = new Element("span", {"class" : CLASSES.clickable()}).update("edit");
+ this.__create__ = new Element("span", {"class" : CLASSES.clickable()}).update("create");
+ if(content.isType !== true){
+ this.__create__.writeAttribute({"class" : CLASSES.disabled()});
+ }
+ else {
+ this.__create__.observe("click", function(event){
+ alert("create");
+ });
+ // TODO: define a handler
+ }
+
+ if(content.isInstance !== true){
+ this.__edit__.writeAttribute({"class" : CLASSES.disabled()});
+ }
+ else {
+ this.__edit__.observe("click", function(event){
+ alert("edit");
+ });
+ // TODO: define a handler
+ }
+ this.__frame__.update(this.__topic__);
+ this.__frame__.insert({"bottom" : this.__edit__});
+ this.__frame__.insert({"bottom" : "|"});
+ this.__frame__.insert({"bottom" : this.__create__});
+
+ this.__instances__ = null;
+ this.__subtypes__ = null;
+
+ if(content.instances && content.instances.length !== 0) {
+ this.__instances__ = new Element("ul", {"class" : CLASSES.instances()});
+ for(var i = 0; i !== content.instances.length; ++i){
+ var entry = new NodeC(content.instances[i]);
+ this.__instances__.insert({"bottom" : entry.getFrame()});
+ }
+ }
+
+ if(content.subtypes && content.subtypes.length !== 0) {
+ this.__subtypes__ = new Element("ul", {"class" : CLASSES.subtypes()});
+ for(var i = 0; i !== content.subtypes.length; ++i){
+ var entry = new NodeC(content.subtypes[i]);
+ this.__subtypes__.insert({"bottom" : entry.getFrame()});
+ }
+ }
+
+ if(this.__instances__) this.__frame__.insert({"bottom" : this.__instances__});
+ if(this.__subtypes__) this.__frame__.insert({"bottom" : this.__subtypes__});
+ }
+ catch(err){
+ throw "From NodeC(): The following exception was thrown:\n" + err;
+ }
+ },
+ "getFrame" : function(){
+ return this.__frame__;
+ }});
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js (original)
+++ trunk/src/ajax/javascripts/requests.js Mon Jun 29 14:39:18 2009
@@ -233,4 +233,27 @@
catch(err){
alert("From requestFragment(): " + err);
}
+}
+
+
+// --- Request a topic map overview object from the server and calls
+// --- onSuccessHandler or OnFailureHandler.
+function requestTreeView(onSuccessHandler, onFailureHandler)
+{
+ if(!onSuccessHandler) throw "From requestTreeView(): onSuccessHandler must be set!";
+
+ try{
+ var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler;
+ var timeFun = setAjaxTimeout(6 * TIMEOUT, COMMIT_URL);
+ onLoad("Requesting a topic map overview from " + TM_OVERVIEW);
+
+ new Ajax.Request(TM_OVERVIEW, {
+ "method" : "get",
+ "requestHeaders" : INIT_DATE,
+ "onSuccess" : createXHRHandler(onSuccessHandler, timeFun),
+ "onFailure" : createXHRHandler(onFailure, timeFun)});
+ }
+ catch(err){
+ alert("From requestFragment(): " + err);
+ }
}
\ No newline at end of file
1
0

[isidorus-cvs] r78 - in trunk/src: ajax/javascripts json rest_interface unit_tests
by Lukas Giessmann 29 Jun '09
by Lukas Giessmann 29 Jun '09
29 Jun '09
Author: lgiessmann
Date: Mon Jun 29 10:24:53 2009
New Revision: 78
Log:
json-server: fixed a bug with topic-, association, role-, name- and occurrence-types; added the RESTful-handler "json/tmcl/overview/?" that returns a json-object representing the topics as a (or more) tree-view(s)
Modified:
trunk/src/ajax/javascripts/constants.js
trunk/src/json/json_tmcl.lisp
trunk/src/json/json_tmcl_validation.lisp
trunk/src/rest_interface/rest-interface.lisp
trunk/src/rest_interface/set-up-json-interface.lisp
trunk/src/unit_tests/poems.xtm
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Mon Jun 29 10:24:53 2009
@@ -22,6 +22,7 @@
var INSTANCE_PSIS_URL = HOST_PREF + "json/tmcl/instances/";
var OWN_URL = HOST_PREF + "isidorus";
var SUMMARY_URL = HOST_PREF + "json/summary"
+var TM_OVERVIEW = "/json/tmcl/overview/";
var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
Modified: trunk/src/json/json_tmcl.lisp
==============================================================================
--- trunk/src/json/json_tmcl.lisp (original)
+++ trunk/src/json/json_tmcl.lisp Mon Jun 29 10:24:53 2009
@@ -18,7 +18,7 @@
topic-psis must contain one item if it is treated as instance other wiese there can be more psis
then the fragment will be treated as an instanceOf all passed psis."
(let ((associationtype (get-item-by-psi *associationtype-psi*))
- (associationtype-constraint (get-item-by-psi *associationtype-constraint-psi*))
+ (associationtype-constraint (is-type-constrained :what *associationtype-constraint-psi*))
(topics nil))
(when (and (not (eql treat-as 'type))
(> (length topic-psis) 1))
@@ -102,9 +102,9 @@
(othertopictype-role (get-item-by-psi *othertopictype-role-psi*))
(otherroletype-role (get-item-by-psi *otherroletype-role-psi*))
(roletype (get-item-by-psi *roletype-psi*))
- (roletype-constraint (get-item-by-psi *roletype-constraint-psi*))
+ (roletype-constraint (is-type-constrained :what *roletype-constraint-psi*))
(topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*)))
+ (topictype-constraint (is-type-constrained)))
(let ((otherrole-constraints
(loop for constraint-topic in constraint-topics
append (let ((players nil)
@@ -233,9 +233,9 @@
(topictype-role (get-item-by-psI *topictype-role-psi*))
(roletype-role (get-item-by-psi *roletype-role-psi*))
(roletype (get-item-by-psi *roletype-psi*))
- (roletype-constraint (get-item-by-psi *roletype-constraint-psi*))
+ (roletype-constraint (is-type-constrained :what *roletype-constraint-psi*))
(topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*)))
+ (topictype-constraint (is-type-constrained)))
(let ((roleplayer-constraints
(loop for constraint-topic in constraint-topics
append (let ((constraint-list
@@ -327,7 +327,7 @@
(roletype-role (get-item-by-psi *roletype-role-psi*))
(constraint-role (get-item-by-psi *constraint-role-psi*))
(roletype (get-item-by-psi *roletype-psi*))
- (roletype-constraint (get-item-by-psi *roletype-constraint-psi*)))
+ (roletype-constraint (is-type-constrained :what *roletype-constraint-psi*)))
(let ((associationrole-constraints
(loop for constraint-topic in constraint-topics
append (let ((constraint-list
@@ -465,7 +465,7 @@
(applies-to (get-item-by-psi *applies-to-psi*))
(topictype-role (get-item-by-psi *topictype-role-psi*))
(topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*)))
+ (topictype-constraint (is-type-constrained)))
(let ((topics
(remove-duplicates
(loop for exclusive-instances-list in exclusive-instances-lists
@@ -536,7 +536,7 @@
(applies-to (get-item-by-psi *applies-to-psi*))
(nametype-role (get-item-by-psi *nametype-role-psi*))
(nametype (get-item-by-psi *nametype-psi*))
- (nametype-constraint (get-item-by-psi *nametype-constraint-psi*)))
+ (nametype-constraint (is-type-constrained :what *nametype-constraint-psi*)))
(let ((topicname-constraints
(remove-if #'null
(loop for constraint-topic in constraint-topics
@@ -603,7 +603,7 @@
(applies-to (get-item-by-psi *applies-to-psi*))
(occurrencetype-role (get-item-by-psi *occurrencetype-role-psi*))
(occurrencetype (get-item-by-psi *occurrencetype-psi*))
- (occurrencetype-constraint (get-item-by-psi *occurrencetype-constraint-psi*)))
+ (occurrencetype-constraint (is-type-constrained :what *occurrencetype-constraint-psi*)))
(let ((topicoccurrence-constraints
(remove-if #'null
(loop for constraint-topic in constraint-topics
@@ -1069,7 +1069,7 @@
"Returns all constraint topics defined for associations if
the passed associationtype-topic."
(let ((akos-and-isas-of-this
- (topictype-p associationtype-topic (get-item-by-psi *associationtype-psi*) (get-item-by-psi *associationtype-constraint-psi*))))
+ (topictype-p associationtype-topic (get-item-by-psi *associationtype-psi*) (is-type-constrained :what *associationtype-constraint-psi*))))
(let ((all-associationrole-constraints nil)
(all-roleplayer-constraints nil)
(all-otherrole-constraints nil))
@@ -1133,3 +1133,159 @@
(map 'list #'(lambda(topic)
(map 'list #'uri (psis topic)))
topics)))
+
+
+(defun tree-view-to-json-string (tree-views)
+ "Returns a full tree-view as json-string."
+ (let ((json-string
+ (concatenate 'string "["
+ (if tree-views
+ (let ((inner-string ""))
+ (loop for tree-view in tree-views
+ do (setf inner-string (concatenate 'string inner-string (node-to-json-string tree-view) ",")))
+ (concatenate 'string (subseq inner-string 0 (- (length inner-string) 1)) "]"))
+ "null"))))
+ json-string))
+
+(defun make-tree-view ()
+ "Returns a list of the form:
+ ((<topictype> (direct-instances) (direc-subtypes)) (<...>));
+ -> direct-instances: (<any-topic> (direct-instances) (direct-subtypes))
+ -> direct-subtypes: (<any-topic> (direct-instances) (direct-subtypes))"
+ (let ((topictype (d:get-item-by-psi json-tmcl-constants::*topictype-psi*))
+ (topictype-constraint (is-type-constrained)))
+ (if topictype-constraint
+ (progn
+ (unless topictype
+ (error "From make-tree-view(): The topictype-constraint \"~a\" exists but the topictype \"~a\" is missing!"
+ json-tmcl-constants::*topictype-constraint-psi*
+ json-tmcl-constants::*topictype-psi*))
+ (list (make-nodes topictype t t)))
+ (let ((tree-roots
+ (get-all-tree-roots)))
+ (let ((tree-list
+ (loop for root in tree-roots
+ collect (let ((l-is-type
+ (handler-case (progn
+ (topictype-p root topictype topictype-constraint)
+ t)
+ (Condition () nil)))
+ (l-is-instance
+ (handler-case (progn
+ (valid-instance-p root)
+ t)
+ (Condition () nil))))
+ (make-nodes root l-is-type l-is-instance)))))
+ tree-list)))))
+
+
+(defun node-to-json-string(node)
+ "Returns a json-object of the form
+ {topic: [<psis>], isType: <bool>, isInstance: <bool>,
+ instances: [<nodes>], subtypes: [<nodes>]}."
+ (let ((topic-psis
+ (concatenate 'string "\"topic\":"
+ (json:encode-json-to-string (map 'list #'d:uri (d:psis (getf node :topic))))))
+ (is-type
+ (concatenate 'string "\"isType\":"
+ (if (getf node :is-type)
+ "true"
+ "false")))
+ (is-instance
+ (concatenate 'string "\"isInstance\":"
+ (if (getf node :is-instance)
+ "true"
+ "false")))
+ (instances
+ (concatenate 'string "\"instances\":"
+ (if (getf node :instances)
+ (let ((inner-string "["))
+ (loop for instance-node in (getf node :instances)
+ do (setf inner-string (concatenate 'string inner-string (node-to-json-string instance-node) ",")))
+ (concatenate 'string (subseq inner-string 0 (- (length inner-string) 1)) "]"))
+ "null")))
+ (subtypes
+ (concatenate 'string "\"subtypes\":"
+ (if (getf node :subtypes)
+ (let ((inner-string "["))
+ (loop for instance-node in (getf node :subtypes)
+ do (setf inner-string (concatenate 'string inner-string (node-to-json-string instance-node) ",")))
+ (concatenate 'string (subseq inner-string 0 (- (length inner-string) 1)) "]"))
+ "null"))))
+ (concatenate 'string "{" topic-psis "," is-type "," is-instance "," instances "," subtypes"}")))
+
+
+(defun make-nodes (topic-instance is-type is-instance)
+ "Creates a li of nodes.
+ A node looks like
+ (:topic <topic> :is-type <bool> :is-instance <bool> :instances <node> :subtypes <nodes>)."
+ (declare (d:TopicC topic-instance))
+ (let ((topictype (d:get-item-by-psi json-tmcl-constants::*topictype-psi*))
+ (topictype-constraint (is-type-constrained)))
+ (let ((isas-of-this
+ (map 'list #'(lambda(z)
+ (let ((l-is-type
+ (handler-case (progn
+ (topictype-p z topictype topictype-constraint)
+ t)
+ (Condition () nil)))
+ (l-is-instance
+ (handler-case (progn
+ (valid-instance-p z)
+ t)
+ (Condition () nil))))
+ (list :topic z :is-type l-is-type :is-instance l-is-instance)))
+ (remove-duplicates
+ (remove-if #'null
+ (remove-if #'(lambda(x) (when (eql topic-instance x)
+ t))
+ (get-direct-instances-of-topic topic-instance))))))
+ (akos-of-this
+ (map 'list #'(lambda(z)
+ (let ((l-is-type
+ (handler-case (progn
+ (topictype-p z topictype topictype-constraint)
+ t)
+ (Condition () nil)))
+ (l-is-instance
+ (handler-case (progn
+ (valid-instance-p z)
+ t)
+ (Condition () nil))))
+ (list :topic z :is-type l-is-type :is-instance l-is-instance)))
+ (remove-duplicates
+ (remove-if #'null
+ (remove-if #'(lambda(x) (when (eql topic-instance x)
+ t))
+ (get-direct-subtypes-of-topic topic-instance)))))))
+ (list :topic topic-instance
+ :is-type is-type
+ :is-instance is-instance
+ :instances (map 'list #'(lambda(x)
+ (make-nodes (getf x :topic) (getf x :is-type) (getf x :is-instance)))
+ isas-of-this)
+ :subtypes (map 'list #'(lambda(x)
+ (make-nodes (getf x :topic) (getf x :is-type) (getf x :is-instance)))
+ akos-of-this)))))
+
+
+(defun get-all-tree-roots ()
+ "Returns all topics that are no instanceOf and no subtype
+ of any other topic."
+ (let ((all-topics
+ (elephant:get-instances-by-class 'd:TopicC)))
+ (remove-if #'null
+ (map 'list #'(lambda(x)
+ (let ((isas-of-x
+ (remove-if #'(lambda(y)
+ (when (eql y x)
+ t))
+ (get-direct-types-of-topic x)))
+ (akos-of-x
+ (remove-if #'(lambda(y)
+ (when (eql y x)
+ t))
+ (get-direct-supertypes-of-topic x))))
+ (unless (or isas-of-x akos-of-x)
+ x)))
+ all-topics))))
\ No newline at end of file
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Mon Jun 29 10:24:53 2009
@@ -36,7 +36,7 @@
(defun topictype-of-p (topic-instance type-instance &optional (topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*))
+ (topictype-constraint (is-type-constrained))
checked-topics)
"Returns a list of all types and supertypes of this topic if this topic is a
valid instance-topic of the type-topic called type-instance. TMCL 4.4.2.
@@ -75,7 +75,7 @@
(defun topictype-p (topic-instance &optional (topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*))
+ (topictype-constraint (is-type-constrained))
(checked-topics nil))
"Returns a list of all instanceOf-topics and all Supertypes of this topic
if this topic is a valid topic (-type). I.e. the passed topic is the
@@ -188,6 +188,26 @@
(remove-if #'null topic-types)))))
+(defun get-direct-instances-of-topic(topic-instance)
+ "Returns the direct instances of the topic as a list.
+ This function only returns the types of the type-instance-relationship -> TMDM 7.2
+ This function was defined for the use in topictype-p and not for a standalone
+ usage."
+ (let ((type-instance (get-item-by-psi *type-instance-psi*))
+ (instance (get-item-by-psi *instance-psi*))
+ (type (get-item-by-psi *type-psi*)))
+ (let ((topic-instances
+ (loop for role in (player-in-roles topic-instance)
+ when (eq type (instance-of role))
+ collect (loop for other-role in (roles (parent role))
+ when (and (not (eq role other-role))
+ (eq type-instance (instance-of (parent role)))
+ (eq instance (instance-of other-role)))
+ return (player other-role)))))
+ (when topic-instances
+ (remove-if #'null topic-instances)))))
+
+
(defun get-direct-supertypes-of-topic(topic-instance)
"Returns the direct supertypes of the topic as a list passed to this function.
This function only returns the types of the supertype-subtype-relationship -> TMDM 7.3.
@@ -204,11 +224,32 @@
(eq supertype-subtype (instance-of (parent role)))
(eq supertype (instance-of other-role)))
collect (player other-role)))))
- (remove-if #'null supertypes))))
+ (when supertypes
+ (remove-if #'null supertypes)))))
+
+
+(defun get-direct-subtypes-of-topic(topic-instance)
+ "Returns the direct subtypes of the topic as a list.
+ This function only returns the types of the supertype-subtype-relationship -> TMDM 7.3.
+ This function was defined for the use in topictype-p and not for a standalone
+ usage."
+ (let ((supertype-subtype (get-item-by-psi *supertype-subtype-psi*))
+ (supertype (get-item-by-psi *supertype-psi*))
+ (subtype (get-item-by-psi *subtype-psi*)))
+ (let ((subtypes
+ (loop for role in (player-in-roles topic-instance)
+ when (eq supertype (instance-of role))
+ append (loop for other-role in (roles (parent role))
+ when (and (not (eq role other-role))
+ (eq supertype-subtype (instance-of (parent role)))
+ (eq subtype (instance-of other-role)))
+ collect (player other-role)))))
+ (when subtypes
+ (remove-if #'null subtypes)))))
(defun list-subtypes (topic-instance &optional (topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*))
+ (topictype-constraint (is-type-constrained))
(checked-topics nil) (valid-subtypes nil))
"Returns all valid subtypes of a topic, e.g.:
nametype-constraint ako constraint .
@@ -241,7 +282,7 @@
(defun list-instances (topic-instance &optional (topictype (get-item-by-psi *topictype-psi*))
- (topictype-constraint (get-item-by-psi *topictype-constraint-psi*)))
+ (topictype-constraint (is-type-constrained)))
"Returns the topic-instance, all subtypes found by the function list-subtypes and all direct
instances for the found subtypes."
(let ((all-subtypes-of-this
@@ -282,7 +323,7 @@
(get-direct-supertypes-of-topic topic-instance))
(psi-of-this (uri (first (psis topic-instance))))
(topictype (d:get-item-by-psi json-tmcl-constants::*topictype-psi*))
- (topictype-constraint (d:get-item-by-psi json-tmcl-constants::*topictype-constraint-psi*))
+ (topictype-constraint (is-type-constrained))
(local-all-checked-topics all-checked-topics)
(local-akos-checked))
@@ -292,7 +333,7 @@
(when (and topictype-constraint
(not topictype))
(error (format nil "From valid-instance-p(): The topic \"~a\" does not exist - please create it or remove the topic \"~a\""
- json-tmcl-constants::*topictype-psi* json-tmcl-constants::*topictype-constraint-psi*)))
+ json-tmcl-constants::*topictype-psi* (d:uri (first (d:psis topictype-constraint))))))
(when (eql topic-instance topictype)
(return-from valid-instance-p (remove-duplicates (append all-checked-topics (list topic-instance)))))
@@ -336,7 +377,7 @@
(let ((all-topics
(elephant:get-instances-by-class 'd:TopicC))
(topictype (get-item-by-psi json-tmcl-constants::*topictype-psi*))
- (topictype-constraint (get-item-by-psi json-tmcl-constants::*topictype-constraint-psi*)))
+ (topictype-constraint (is-type-constrained)))
(let ((all-types
(remove-if #'null
(map 'list #'(lambda(x)
@@ -366,4 +407,17 @@
(valid-instance-p x)
x)
(condition () nil))) all-topics))))
- valid-instances)))
\ No newline at end of file
+ valid-instances)))
+
+
+(defun is-type-constrained (&key (what json-tmcl::*topictype-constraint-psi*))
+ "Returns nil if there is no type-constraint otherwise the instance of the type-constraint."
+ (let ((topictype-constraint (d:get-item-by-psi what)))
+ (when topictype-constraint
+ (let ((ttc
+ (remove-duplicates
+ (remove-if #'null
+ (remove-if #'(lambda(x) (when (eql topictype-constraint x)
+ t))
+ (get-direct-instances-of-topic topictype-constraint))))))
+ ttc))))
\ No newline at end of file
Modified: trunk/src/rest_interface/rest-interface.lisp
==============================================================================
--- trunk/src/rest_interface/rest-interface.lisp (original)
+++ trunk/src/rest_interface/rest-interface.lisp Mon Jun 29 10:24:53 2009
@@ -34,6 +34,7 @@
:*json-get-topic-stub-prefix*
:*json-get-type-tmcl-prefix*
:*json-get-instance-tmcl-prefix*
+ :*json-get-overview*
:*ajax-user-interface-url*
:*ajax-user-interface-file-path*
:*ajax-javascript-directory-path*
Modified: trunk/src/rest_interface/set-up-json-interface.lisp
==============================================================================
--- trunk/src/rest_interface/set-up-json-interface.lisp (original)
+++ trunk/src/rest_interface/set-up-json-interface.lisp Mon Jun 29 10:24:53 2009
@@ -18,6 +18,7 @@
(defparameter *json-get-topic-stub-prefix* "/json/topicstubs/(.+)$") ;the json prefix for getting some topic stub information of a topic
(defparameter *json-get-type-tmcl-url* "/json/tmcl/type/?$") ;the json url for getting some tmcl information of a topic treated as a type
(defparameter *json-get-instance-tmcl-url* "/json/tmcl/instance/?$") ;the json url for getting some tmcl information of a topic treated as an instance
+(defparameter *json-get-overview* "/json/tmcl/overview/?$") ; returns a json-object representing a tree view
(defparameter *ajax-user-interface-url* "/isidorus/?$") ;the url to the user interface; if you want to get all topics set start=0&end=nil -> localhost:8000/isidorus
(defparameter *ajax-user-interface-css-prefix* "/css") ;the url to the css files of the user interface
(defparameter *ajax-user-interface-css-directory-path* "ajax/css") ;the directory contains the css files
@@ -34,6 +35,7 @@
(json-get-topic-stub-prefix *json-get-topic-stub-prefix*)
(json-get-type-tmcl-url *json-get-type-tmcl-url*)
(json-get-instance-tmcl-url *json-get-instance-tmcl-url*)
+ (json-get-overview *json-get-overview*)
(ajax-user-interface-url *ajax-user-interface-url*)
(ajax-user-interface-file-path *ajax-user-interface-file-path*)
(ajax-user-interface-css-prefix *ajax-user-interface-css-prefix*)
@@ -99,6 +101,9 @@
(return-tmcl-info-of-psis 'json-tmcl::instance)))
hunchentoot:*dispatch-table*)
(push
+ (create-regex-dispatcher json-get-overview #'return-overview)
+ hunchentoot:*dispatch-table*)
+ (push
(create-regex-dispatcher json-commit-url #'json-commit)
hunchentoot:*dispatch-table*)
(push
@@ -283,6 +288,19 @@
(format nil "Condition: \"~a\"" err))))))
+(defun return-overview (&optional param)
+ "Returns a json-object representing a topic map overview as a tree(s)"
+ (declare (ignorable param))
+ (handler-case (let ((json-string
+ (json-tmcl::tree-view-to-json-string (json-tmcl::make-tree-view))))
+ (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+ json-string)
+ (Condition (err) (progn
+ (setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
+ (setf (hunchentoot:content-type*) "text")
+ (format nil "Condition: \"~a\"" err)))))
+
+
;; =============================================================================
;; --- some helper functions ---------------------------------------------------
;; =============================================================================
Modified: trunk/src/unit_tests/poems.xtm
==============================================================================
--- trunk/src/unit_tests/poems.xtm (original)
+++ trunk/src/unit_tests/poems.xtm Mon Jun 29 10:24:53 2009
@@ -148,7 +148,7 @@
<!-- the constraint roletype -->
<tm:topic id="constraint-role">
<tm:subjectIdentifier href="http://psi.topicmaps.org/tmcl/constraint-role"/>
- <tm:instanceOf><tm:topicref href="#roletype"/></tm:instanceOf>
+ <tm:instanceOf><tm:topicRef href="#roletype"/></tm:instanceOf>
</tm:topic>
<!-- ===================================================================== -->
@@ -225,7 +225,7 @@
<!-- constraints can be bound to a schema -->
<tm:topic id="schema">
<tm:subjectIdentifier href="http://psi.topicmaps.org/tmcl/schema"/>
- <tm:instanceOf><tm:topicref href="#topictype"/></tm:instanceOf>
+ <tm:instanceOf><tm:topicRef href="#topictype"/></tm:instanceOf>
</tm:topic>
1
0
Author: lgiessmann
Date: Mon Jun 29 05:11:38 2009
New Revision: 77
Log:
json-server: fixed a bug with tmcl-type-validation when there is no topictype or no topictype-constraint or if they isn't either a topictype nor a topictype-constraint
Modified:
trunk/src/json/json_tmcl.lisp
trunk/src/json/json_tmcl_validation.lisp
trunk/src/rest_interface/set-up-json-interface.lisp
Modified: trunk/src/json/json_tmcl.lisp
==============================================================================
--- trunk/src/json/json_tmcl.lisp (original)
+++ trunk/src/json/json_tmcl.lisp Mon Jun 29 05:11:38 2009
@@ -35,7 +35,7 @@
(let ((value
(get-constraints-of-topic topics :treat-as treat-as)))
(concatenate 'string "\"topicConstraints\":" value))))
- (let ((available-associations ;what's with association which have only a associationrole-constraints?
+ (let ((available-associations
(remove-duplicates
(loop for topic in topics
append (get-available-associations-of-topic topic :treat-as treat-as)))))
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Mon Jun 29 05:11:38 2009
@@ -287,7 +287,7 @@
(local-akos-checked))
(when (not topictype-constraint)
- (return-from valid-instance-p topic-instance))
+ (return-from valid-instance-p (list topic-instance)))
(when (and topictype-constraint
(not topictype))
Modified: trunk/src/rest_interface/set-up-json-interface.lisp
==============================================================================
--- trunk/src/rest_interface/set-up-json-interface.lisp (original)
+++ trunk/src/rest_interface/set-up-json-interface.lisp Mon Jun 29 05:11:38 2009
@@ -169,8 +169,8 @@
(let ((external-format (flexi-streams:make-external-format :UTF-8 :eol-style :LF)))
(let ((json-data (hunchentoot:raw-post-data :external-format external-format :force-text t)))
(handler-case (let ((psis
- (json:decode-json-from-string json-data)))
- (let ((tmcl
+ (json:decode-json-from-string json-data)))
+ (let ((tmcl
(json-tmcl:get-constraints-of-fragment psis :treat-as treat-as)))
(if tmcl
(progn
1
0
Author: lgiessmann
Date: Mon Jun 29 04:33:22 2009
New Revision: 76
Log:
ajax-client: fixed a bug that accurrs when there are no valid topic instances or topic types
Modified:
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/ajax/javascripts/edit.js
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Mon Jun 29 04:33:22 2009
@@ -38,10 +38,6 @@
var MMAX_INT = "*";
-// --- some css-styles
-var DISABLED_BACKGROUND_COLOR = {"backgroundColor" : "#eaeaee"};
-
-
// --- Contains most css classes used in this project
// --- There should be called only the function to be sure to don't override
// --- the original values.
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Mon Jun 29 04:33:22 2009
@@ -38,8 +38,14 @@
}
var instanceOf = null;
try{
- instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment);
- liTopicSelect.insert({"bottom" : instanceOf.getFrame()});
+ if(json === null){
+ var err = new Element("div", {"class" : CLASSES.error()}).update("There exist no valid topic types!<br/>Please update the TMCL-model.");
+ liTopicSelect.insert({"bottom" : err});
+ }
+ else {
+ instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment);
+ liTopicSelect.insert({"bottom" : instanceOf.getFrame()});
+ }
}
catch(innerErr){
alert("There occurred an error by creating an InstanceOfC frame, please reload this page!\n\n" + innerErr);
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Mon Jun 29 04:33:22 2009
@@ -4239,88 +4239,4 @@
var tr = newRow(CLASSES.typeFrame(), "Type", new SelectrowC(types, myself.__type__, 1, 1).getFrame());
myself.__table__.insert({"bottom" : tr});
return types;
-}
-
-// --- some helper to enable/disable some table rows
-
-function disableItemIdentity(myself)
-{
- myself.__itemIdentity__.disable();
- myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableItemIdentity(myself)
-{
- myself.__itemIdentity__.enable();
- myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].removeAttribute("style");
-}
-function disableType(myself)
-{
- myself.__type__.__frames__[0].disable();
- myself.__table__.select("tr." + CLASSES.typeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableType(myself)
-{
- myself.__type__.__frames__[0].enable();
- myself.__table__.select("tr." + CLASSES.typeFrame())[0].removeAttribute("style");
-}
-function disableScope(myself){
- myself.__scope__.disable();
- myself.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableScope(myself)
-{
- myself.__scope__.enable();
- myself.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
-}
-function disableValue(myself)
-{
- try{ myself.__value__.__frames__[0].disable(); } catch(err){}
- try{ myself.__value__.writeAttribute({"readonly" : "readonly"}); } catch(err){}
- myself.__table__.select("tr." + CLASSES.valueFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableValue(myself)
-{
- try{ myself.__value__.__frames__[0].enable(); } catch(err){}
- try{ myself.__value__.removeAttribute("readonly"); } catch(err){}
- myself.__table__.select("tr." + CLASSES.valueFrame())[0].removeAttribute("style");
-}
-function disableDatatype(myself)
-{
- myself.__datatype__.__frames__[0].disable();
- myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableDatatype(myself)
-{
- if(myself.__datatypeIsSet__ === false) myself.__datatype__.__frames__[0].enable();
- myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].removeAttribute("style");
-}
-function disableVariants(myself)
-{
- myself.__variants__.disable();
- myself.__table__.select("tr." + CLASSES.variantContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableVariants(myself)
-{
- myself.__variants__.enable();
- myself.__table__.select("tr." + CLASSES.variantContainer())[0].removeAttribute("style");
-}
-function disableRole(myself)
-{
- myself.__roles__.disable();
- myself.__table__.select("tr." + CLASSES.roleContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enableRole(myself)
-{
- myself.__roles__.enable();
- myself.__table__.select("tr." + CLASSES.roleContainer())[0].removeAttribute("style");
-}
-function disablePlayer(myself)
-{
- myself.__player__.__frames__[0].disable();
- myself.__table__.select("tr." + CLASSES.playerFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
-}
-function enablePlayer(myself)
-{
- myself.__player__.__frames__[0].enable();
- myself.__table__.select("tr." + CLASSES.playerFrame())[0].removeAttribute("style");
}
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/edit.js
==============================================================================
--- trunk/src/ajax/javascripts/edit.js (original)
+++ trunk/src/ajax/javascripts/edit.js Mon Jun 29 04:33:22 2009
@@ -48,8 +48,14 @@
var edit = null;
try{
- edit = new EditC(json.flatten().sort(), innerMakeFragment);
- liTopicSelect.insert({"bottom" : edit.getFrame()});
+ if(json === null){
+ var err = new Element("div", {"class" : CLASSES.error()}).update("There exist no valid topic instances!<br/>Please update the TMCL-model or create some new instances.");
+ liTopicSelect.insert({"bottom" : err});
+ }
+ else {
+ edit = new EditC(json.flatten().sort(), innerMakeFragment);
+ liTopicSelect.insert({"bottom" : edit.getFrame()});
+ }
}
catch(err){
alert("There occurred an error by creating an EditC frame, please reload this page!\n\n" + err);
1
0

[isidorus-cvs] r75 - in trunk/src: ajax/css ajax/javascripts unit_tests
by Lukas Giessmann 29 Jun '09
by Lukas Giessmann 29 Jun '09
29 Jun '09
Author: lgiessmann
Date: Mon Jun 29 04:19:47 2009
New Revision: 75
Log:
ajax-client: fixed the "disable/enable" safari-bug
Modified:
trunk/src/ajax/css/frame.css
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/unit_tests/poems.xtm
Modified: trunk/src/ajax/css/frame.css
==============================================================================
--- trunk/src/ajax/css/frame.css (original)
+++ trunk/src/ajax/css/frame.css Mon Jun 29 04:19:47 2009
@@ -8,7 +8,6 @@
/* You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and */
/* in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt. */
/*----------------------------------------------------------------------------*/
-
ul.fragmentFrame {
list-style-type: none;
padding-left: 0px;
@@ -203,12 +202,38 @@
border: 1px solid #ff7f00;
}
+/* === disabled name frame === */
+div.disabled table.nameFrame > tr.itemIdentityFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.nameFrame > tr.typeFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.nameFrame > tr.scopeContainer {
+ background-color: #eaeaee;
+}
+
+div.disabled table.nameFrame > tr.valueFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.nameFrame > tr.variantContainer {
+ background-color: #eaeaee;
+}
+
+
/* === variant frame ======================================================== */
table.nameFrame div.variantFrame {
margin-left: 24px;
}
+table.nameFrame div.disabled {
+ margin-left: 24px;
+}
+
table.nameFrame table.variantFrame {
width: 667px;
margin-top: 2px;
@@ -237,6 +262,23 @@
border: 1px solid #ff7f00;
}
+/* === disabled variant frame === */
+div.disabled table.variantFrame > tr.itemIdentityFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.variantFrame > tr.scopeContainer {
+ background-color: #eaeaee;
+}
+
+div.disabled table.variantFrame > tr.valueFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.variantFrame > tr.datatypeFrame {
+ background-color: #eaeaee;
+}
+
/* === occurrence frame ===================================================== */
table.topicFrame table.occurrenceFrame {
@@ -268,6 +310,31 @@
border: 1px solid #ff7f00;
}
+/* === disabled occurrence frame === */
+div.disabled {
+ background-color: #eaeaee;
+}
+
+div.disabled table.occurrenceFrame > tr.itemIdentityFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.occurrenceFrame > tr.typeFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.occurrenceFrame > tr.scopeContainer {
+ background-color: #eaeaee;
+}
+
+div.disabled table.occurrenceFrame > tr.valueFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.occurrenceFrame > tr.datatypeFrame {
+ background-color: #eaeaee;
+}
+
/* === association container / association frame ============================ */
div.associationContainer {
@@ -313,7 +380,22 @@
background-color: #f6f7f9;
}
+/* === disabled association frame === */
+div.disabled table.associationFrame > tr.itemIdentityFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.associationFrame > tr.typeFrame {
+ background-color: #eaeaee;
+}
+div.disabled table.associationFrame > tr.scopeContainer {
+ background-color: #eaeaee;
+}
+
+div.disabled table.associationFrame > tr.roleContainer {
+ background-color: #eaeaee;
+}
/* === associationrole frame ================================================ */
@@ -342,6 +424,18 @@
background-color: #f6f7f9;
}
+/* === disabled role frame === */
+div.disabled table.roleFrame > tr.itemIdentityFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.roleFrame > tr.typeFrame {
+ background-color: #eaeaee;
+}
+
+div.disabled table.roleFrame > tr.playerFrame {
+ background-color: #eaeaee;
+}
/* === tmId frame ========================================================== */
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Mon Jun 29 04:19:47 2009
@@ -11,8 +11,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object
-var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
-var HOST_PREF = "http://192.168.178.29:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = "http://143.93.190.237:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
var GET_PREFIX = HOST_PREF + "json/get/";
var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
@@ -23,6 +22,7 @@
var INSTANCE_PSIS_URL = HOST_PREF + "json/tmcl/instances/";
var OWN_URL = HOST_PREF + "isidorus";
var SUMMARY_URL = HOST_PREF + "json/summary"
+var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
@@ -85,5 +85,6 @@
"tmIdFrame" : function(){ return "tmIdFrame"; },
"load" : function(){ return "loadFrame"; },
"ajaxLoader" : function(){ return "ajaxLoader"; },
- "editFrame" : function(){ return "editFrame"; }
+ "editFrame" : function(){ return "editFrame"; },
+ "disabled" : function(){ return "disabled"; }
};
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Mon Jun 29 04:19:47 2009
@@ -1225,26 +1225,25 @@
},
"disable" : function(){
this.hideError();
- disableItemIdentity(this);
+ this.__itemIdentity__.disable();
// TODO: scope
- this.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
- disableValue(this);
- disableDatatype(this);
+ this.__value__.writeAttribute({"readonly" : "readonly"});
+ this.__datatype__.__frames__[0].disable();
this.hideRemoveButton();
this.hideAddButton();
- this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
+ this.getFrame().writeAttribute({"class" : CLASSES.disabled()});
this.__disabled__ = true;
},
"enable" : function(){
this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
- enableItemIdentity(this);
+ this.__itemIdentity__.enable();
// TODO: scope
- this.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
- enableValue(this);
- enableDatatype(this);
+ this.__value__.removeAttribute("readonly")
+ this.__datatype__.__frames__[0].enable();
if(this.__owner__.__frames__.length > 1) this.showRemoveButton();
this.showAddButton();
this.getFrame().removeAttribute("style");
+ this.getFrame().writeAttribute({"class" : CLASSES.variantFrame()});
this.__disabled__ = false;
},
"minimize" : function(){
@@ -1474,23 +1473,36 @@
},
"disable" : function(){
this.hideError();
+ this.__itemIdentity__.disable();
+ this.__type__.__frames__[0].disable();
+ this.__scope__.disable();
+ this.__value__.__frames__[0].disable();
+ this.__variants__.disable();
+/*
disableItemIdentity(this);
disableType(this);
disableScope(this);
disableValue(this);
disableVariants(this);
- this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);*/
+ this.getFrame().writeAttribute({"class" : CLASSES.disabled()});
this.getFrame().writeAttribute({"title" : this.__cssTitle__});
this.hideAddButton();
this.__disabled__ = true;
},
"enable" : function(){
+ this.__itemIdentity__.enable();
+ this.__type__.__frames__[0].enable();
+ this.__scope__.enable();
+ this.__value__.__frames__[0].enable();
+ this.__variants__.enable();
+/*
enableItemIdentity(this);
enableType(this);
enableScope(this);
enableValue(this);
- enableVariants(this);
- this.getFrame().removeAttribute("style");
+ enableVariants(this);*/
+ this.getFrame().writeAttribute({"class" : CLASSES.nameFrame()});
this.getFrame().removeAttribute("title");
checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
this.__disabled__ = false;
@@ -1863,24 +1875,25 @@
this.__isMinimized__ = false;
}
},
- "disable" : function(){try{
+ "disable" : function(){
this.hideError();
- disableItemIdentity(this);
- disableType(this);;
- disableScope(this);
- disableValue(this);
- disableDatatype(this);
- this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
+ this.__itemIdentity__.disable();
+ this.__type__.__frames__[0].disable();
+ this.__scope__.disable();
+ this.__value__.writeAttribute({"readonly" : "readonly"});
+ this.__datatype__.__frames__[0].disable();
+ this.getFrame().writeAttribute({"class" : CLASSES.disabled()});
this.getFrame().writeAttribute({"title" : this.__cssTitle__});
this.hideAddButton();
- this.__disabled__ = true;}catch(err){ alert("err: " + err); }
+ this.__disabled__ = true;
},
"enable" : function(){
- enableItemIdentity(this);
- enableType(this);;
- enableScope(this);
- enableValue(this);
- enableDatatype(this);
+ this.__itemIdentity__.enable();
+ this.__type__.__frames__[0].enable();
+ this.__scope__.enable();
+ this.__value__.removeAttribute("readonly");
+ if(this.__datatypeIsSet__ === false) this.__datatype__.__frames__[0].enable();
+ this.getFrame().writeAttribute({"class" : CLASSES.occurrenceFrame()});
this.getFrame().removeAttribute("style");
this.getFrame().removeAttribute("title");
checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
@@ -2514,17 +2527,17 @@
},
"disable" : function(){
this.hideError();
- disableItemIdentity(this);
- disableType(this);
- disablePlayer(this);
- this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
+ this.__itemIdentity__.disable()
+ this.__type__.__frames__[0].disable();
+ this.__player__.__frames__[0].disable();
+ this.getFrame().writeAttribute({"class" : CLASSES.disabled()});
this.__disabled__ = true;
},
"enable" : function(){
- enableItemIdentity(this);
- enableType(this);
- enablePlayer(this);
- this.getFrame().removeAttribute("style");
+ this.__itemIdentity__.enable()
+ this.__type__.__frames__[0].enable();
+ this.__player__.__frames__[0].enable();
+ this.getFrame().writeAttribute({"class" : CLASSES.roleFrame()});
this.__disabled__ = false;
},
"minimize" : function(){
@@ -3619,23 +3632,23 @@
},
"disable" : function(){
this.hideError();
- disableItemIdentity(this);
- disableRole(this);
- disableType(this);
- disableScope(this);
+ this.__itemIdentity__.disable();
+ this.__roles__.disable();
+ this.__type__.__frames__[0].disable();
+ this.__scope__.disable();
this.hideRemoveButton();
this.hideAddButton();
- this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
+ this.getFrame().writeAttribute({"class" : CLASSES.disabled()});
this.__disabled__ = true;
},
"enable" : function(){
- enableItemIdentity(this);
- enableRole(this);
- enableType(this);
- enableScope(this);
+ this.__itemIdentity__.enable();
+ this.__roles__.enable();
+ this.__type__.__frames__[0].enable();
+ this.__scope__.enable();
if(this.__owner__.__frames__.length > 1 || !this.__constraints__ || this.__constraints__.length !== 0) this.showRemoveButton();
if(this.__constraints__ && this.__constraints__.length !== 0) this.showAddButton();
- this.getFrame().removeAttribute("style");
+ this.getFrame().writeAttribute({"class" : CLASSES.associationFrame()});
this.__disabled__ = false;
},
"minimize" : function(){
Modified: trunk/src/unit_tests/poems.xtm
==============================================================================
--- trunk/src/unit_tests/poems.xtm (original)
+++ trunk/src/unit_tests/poems.xtm Mon Jun 29 04:19:47 2009
@@ -16,7 +16,6 @@
<tm:topicRef href="#written"/>
</tm:role>
</tm:association>
-
<!-- end test -->
@@ -2876,7 +2875,7 @@
<tm:association>
<tm:itemIdentity href="written-by-association-shiller-resignation"/>
- <tm:type><tm:topicRef href="#place"/></tm:type>
+ <tm:type><tm:topicRef href="#written-by"/></tm:type>
<tm:scope><tm:topicRef href="#de"/></tm:scope>
<tm:role>
<tm:itemIdentity href="writer-role-schiller"/>
1
0
Author: lgiessmann
Date: Sun Jun 28 13:30:32 2009
New Revision: 74
Log:
ajax-client: fixed a bug with the minimize-handler of all some frames
Modified:
trunk/src/ajax/javascripts/datamodel.js
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Sun Jun 28 13:30:32 2009
@@ -95,7 +95,7 @@
this.__regExpString__ = regexp;
this.__frame__.writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
this.__content__.remove();
- this.__content__ = new Element("input", {"type" : "text", "value" : content, "size" : 40});
+ this.__content__ = new Element("input", {"type" : "text", "value" : content, "size" : 48});
this.__dblClickHandler__ = dblClickHandler;
if(cssTitle && cssTitle.length){
this.__content__.writeAttribute({"title" : cssTitle});
@@ -1132,8 +1132,8 @@
this.__table__ = new Element("table", {"class" : CLASSES.variantFrame()});
this.__frame__.insert({"top" : this.__table__});
this.__owner__ = owner;
- this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandler;
+ this.__isMinimized__ = false;
try{
var itemIdentityContent = null;
@@ -1156,7 +1156,7 @@
this.__table__.insert({"bottom" : newRow(CLASSES.scopeContainer(), "Scope", new Element("div"))});
// --- resource value and datatype
- makeResource(this, contents, null, null, null, {"rows" : 3, "cols" : 40});
+ makeResource(this, contents, null, null, null, {"rows" : 3, "cols" : 55});
this.getFrame().observe("dblclick", function(event){
dblClickHandler(owner, event);
@@ -1236,6 +1236,7 @@
this.__disabled__ = true;
},
"enable" : function(){
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
enableItemIdentity(this);
// TODO: scope
this.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
@@ -1247,10 +1248,21 @@
this.__disabled__ = false;
},
"minimize" : function(){
- var trs = this.__table__.select("tr");
- for(var i = 0; i != trs.length; ++i){
- if(i === 0) trs[i].show();
- else trs[i].hide();
+ if(this.__isMinimized__ === false) {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].show();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].hide();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.datatypeFrame())[0].hide();
+ this.__isMinimized__ = true;
+ }
+ else {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].show();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.datatypeFrame())[0].show();
+ this.__isMinimized__ = false;
}
}});
@@ -1337,6 +1349,7 @@
this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandler;
this.__constraint__ = simpleConstraint;
+ this.__isMinimized__ = false;
try{
var itemIdentityContent = null;
@@ -1440,10 +1453,23 @@
return this.__scope__.isValid();
},
"minimize" : function(){
- var trs = this.__table__.select("tr");
- for(var i = 0; i != trs.length; ++i){
- if(i === 0) trs[i].show();
- else trs[i].hide();
+ if(this.__isMinimized__ === false){
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].show();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].hide();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.variantContainer())[0].hide();
+ this.__isMinimized__ = true;
+ }
+ else {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].show();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.variantContainer())[0].show();
+ this.__isMinimized__ = false;
}
},
"disable" : function(){
@@ -1697,6 +1723,7 @@
this.__constraint__ = constraint;
this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandler;
+ this.__isMinimized__ = false;
try{
var itemIdentityContent = null;
@@ -1751,7 +1778,7 @@
var cssTitle = "No constraint found for this occurrence";
if(noConstraint === false) cssTitle = "min: " + _min + " max: " + _max + " regular expression: " + constraint.regexp;
this.__cssTitle__ = cssTitle;
- makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle, {"rows" : 5, "cols" : 60});
+ makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle, {"rows" : 5, "cols" : 70});
this.getFrame().observe("dblclick", function(event){
dblClickHandler(owner, event);
@@ -1817,10 +1844,23 @@
return this.__scope__.isValid();
},
"minimize" : function(){
- var trs = this.__table__.select("tr");
- for(var i = 0; i != trs.length; ++i){
- if(i === 0) trs[i].show();
- else trs[i].hide();
+ if(this.__isMinimized__ === false){
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].show();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].hide();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.datatypeFrame())[0].hide();
+ this.__isMinimized__ = true;
+ }
+ else {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].show();
+ this.getFrame().select("tr." + CLASSES.valueFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.datatypeFrame())[0].show();
+ this.__isMinimized__ = false;
}
},
"disable" : function(){try{
@@ -2271,6 +2311,7 @@
this.__typeMin__ = typeMin;
this.__parentElem__ = parent;
this.__constraint__ = true; // is needed for checkAddRemoveButtons
+ this.__isMinimized__ = false;
try{
// --- control row + itemIdentity
@@ -2485,6 +2526,22 @@
enablePlayer(this);
this.getFrame().removeAttribute("style");
this.__disabled__ = false;
+ },
+ "minimize" : function(){
+ if(this.__isMinimized__ === false) {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].show();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.playerFrame())[0].hide();
+ this.__isMinimized__ = true;
+ }
+ else {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.playerFrame())[0].show();
+ this.__isMinimized__ = false;
+ }
}});
@@ -3448,6 +3505,7 @@
this.__constraints__ = constraints;
this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandlerF;
+ this.__isMinimized__ = false;
try{
var itemIdentityContent = null;
@@ -3579,6 +3637,24 @@
if(this.__constraints__ && this.__constraints__.length !== 0) this.showAddButton();
this.getFrame().removeAttribute("style");
this.__disabled__ = false;
+ },
+ "minimize" : function(){
+ if(this.__isMinimized__ === false) {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].show();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].hide();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].hide();
+ this.getFrame().select("tr." + CLASSES.roleContainer())[0].hide();
+ this.__isMinimized__ = true;
+ }
+ else {
+ this.getFrame().select("tr." + CLASSES.showHiddenRows())[0].hide();
+ this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.typeFrame())[0].show();
+ this.getFrame().select("tr." + CLASSES.scopeContainer())[0].show();
+ this.getFrame().select("tr." + CLASSES.roleContainer())[0].show();
+ this.__isMinimized__ = false;
+ }
}});
@@ -3702,7 +3778,7 @@
this.__caption__ = new Element("caption", {"class" : CLASSES.clickable()}).update("Topic Map ID");
this.__table__.update(this.__caption__);
var value = contents && contents.length !== 0 ? decodeURI(contents[0]) : "";
- this.__contentrow__ = new Element("input", {"type" : "text", "value" : value, "size" : 40});
+ this.__contentrow__ = new Element("input", {"type" : "text", "value" : value, "size" : 48});
this.__tr__ = new Element("tr", {"class" : CLASSES.tmIdFrame()});
var td =new Element("td", {"class" : CLASSES.content()});
this.__tr__.update(td);
@@ -3882,18 +3958,22 @@
myself.__table__.insert({"top" : trCtrl});
trCtrl.hide();
trCtrl.observe("click", function(){
- var trs = myself.__table__.select("tr");
+ /*var trs = myself.__table__.select("tr");
for(var i = 0; i != trs.length; ++i) trs[i].show();
- trCtrl.hide();
+ trCtrl.hide();*/
+ try{myself.minimize();}catch(err){ alert("err: " + err); }
});
// --- min click-handler
min.observe("click", function(event){
+ /*
var trs = myself.__table__.select("tr");
for(var i = 0; i != trs.length; ++i){
if(i === 0) trs[i].show();
else trs[i].hide();
}
+ */
+ try{myself.minimize();}catch(err){ alert("err: " + err); }
});
}
@@ -3960,7 +4040,7 @@
// --- sets the resource value and datatype of names and occurrences
function makeResource(myself, content, constraints, datatypeConstraint, cssTitle, size)
{
- if(!size) size = {"rows" : 3, "cols" : 40};
+ if(!size) size = {"rows" : 3, "cols" : 60};
var value = "";
var datatype = "";
if(content && content.resourceRef && content.resourceRef.length !== 0){
1
0
Author: lgiessmann
Date: Sun Jun 28 12:35:36 2009
New Revision: 73
Log:
ajax-client: fixed a bug with disabling the datatype frames; fixed a style-bug with disabling frames; added css stylesheets
Modified:
trunk/src/ajax/css/frame.css
trunk/src/ajax/css/main.css
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/ajax/javascripts/requests.js
Modified: trunk/src/ajax/css/frame.css
==============================================================================
--- trunk/src/ajax/css/frame.css (original)
+++ trunk/src/ajax/css/frame.css Sun Jun 28 12:35:36 2009
@@ -11,15 +11,17 @@
ul.fragmentFrame {
list-style-type: none;
+ padding-left: 0px;
}
-caption {
+ul.fragmentFrame table > caption {
font-size: 1.5em;
font-weight: bold;
}
td.controlColumn {
background-color: #eaeaee;
+ width: 13px;
}
tr.showHiddenRows {
@@ -31,11 +33,337 @@
font-size: 1.2em;
}
+li.instanceOfFrame > div {
+ margin-left: 10px;
+}
+
+li.instanceOfFrame > div > input[type="button"]{
+ margin-left: 24px;
+}
+
input[value="generate fragment"] {
margin-top: 10px;
margin-bottom: 10px;
}
+input[value="validate fragment"] {
+ float: right;
+}
+
input[value="commit fragment"] {
+ margin-left: 5px;
float: right;
+}
+
+
+/* === remove/add buttons in any kind of rows =============================== */
+div.textrowWithoutRemoveButton span{
+ display: inline-block;
+ width: 20px;
+ margin-left: 2px;
+ margin-right: 2px;
+ text-align: center;
+}
+
+div.textrowWithRemoveButton span{
+ display: inline-block;
+ width: 20px;
+ margin-left: 2px;
+ margin-right: 2px;
+ text-align: center;
+}
+
+div.selectrowWithoutRemoveButton span{
+ display: inline-block;
+ width: 20px;
+ margin-left: 2px;
+ margin-right: 2px;
+ text-align: center;
+}
+
+div.selectrowWithRemoveButton span{
+ display: inline-block;
+ width: 20px;
+ margin-left: 2px;
+ margin-right: 2px;
+ text-align: center;
+}
+
+input[type="text"] {
+ background-color: #white;
+ border: 1px solid darkgray;
+ margin-bottom: 1px;
+ margin-top: 1px;
+}
+
+input[type="text"][readonly="readonly"] {
+ background-color: #eaeaee;
+ border: 1px solid darkgray;
+ margin-bottom: 1px;
+ margin-top: 1px;
+}
+
+
+div.textrowWithRemoveButton > input[type="text"]{
+ margin-left: 0px;
+ font-weight: normal;
+}
+
+div.textrowWithoutRemoveButton > input[type="text"]{
+ margin-left: 24px;
+ font-weight: normal;
+}
+
+div.selectrowWithRemoveButton > select {
+ margin-left: 0px;
+ font-weight: normal;
+}
+
+div.selectrowWithoutRemoveButton > select {
+ margin-left: 24px;
+ font-weight: normal;
+}
+
+textarea {
+ margin-left: 24px;
+ background-color: white;
+ border: 1px solid darkgray;
+ margin-bottom: 1px;
+ margin-top: 1px;
+}
+
+textarea[readonly="readonly"] {
+ margin-left: 24px;
+ background-color: #eaeaee;
+ border: 1px solid darkgray;
+ margin-bottom: 1px;
+ margin-top: 1px;
+}
+
+
+/* === topic frame ========================================================== */
+table.topicFrame {
+ width: 1022px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+}
+
+table.topicFrame > tr > td.description {
+ width: 163px;
+}
+
+table.topicFrame > tr > td.content {
+ width: 854px;
+}
+
+table.topicFrame > tr.topicIdFrame {
+ background-color: #f6f7f9;
+}
+
+table.topicFrame > tr.subjectLocatorFrame {
+ background-color: #f6f7f9;
+}
+
+table.topicFrame > tr.nameContainer {
+ background-color: #f6f7f9;
+}
+
+table.topicFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+
+/* === name frame =========================================================== */
+table.topicFrame table.nameFrame {
+ width: 851px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ margin-left: 1px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+}
+
+table.topicFrame table.nameFrame td.description {
+ width: 142px;
+}
+
+table.topicFrame table.nameFrame td.content {
+ width: 689px;
+}
+
+table.topicFrame table.nameFrame > tr.typeFrame {
+ background-color: white;
+}
+
+table.topicFrame table.nameFrame > tr.valueFrame {
+ background-color: white;
+}
+
+table.topicFrame table.nameFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+
+/* === variant frame ======================================================== */
+table.nameFrame div.variantFrame {
+ margin-left: 24px;
+}
+
+table.nameFrame table.variantFrame {
+ width: 667px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+}
+
+table.nameFrame table.variantFrame > tr > td.description {
+ width: 142px;
+}
+
+table.nameFrame table.variantFrame > tr > td.content {
+ width: 505px;
+}
+
+table.nameFrame table.variantFrame tr.scopeContainer {
+ background-color: white;
+}
+
+table.nameFrame table.variantFrame tr.datatypeFrame {
+ background-color: white;
+}
+
+table.nameFrame table.variantFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+
+/* === occurrence frame ===================================================== */
+table.topicFrame table.occurrenceFrame {
+ width: 851px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ margin-left: 1px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+}
+
+table.topicFrame table.occurrenceFrame td.description {
+ width: 142px;
+}
+
+table.topicFrame table.occurrenceFrame td.content {
+ width: 689px;
+}
+
+table.topicFrame table.occurrenceFrame > tr.typeFrame {
+ background-color: #f6f7f9;
+}
+
+table.topicFrame table.occurrenceFrame > tr.valueFrame {
+ background-color: #f6f7f9;
+}
+
+table.topicFrame table.occurrenceFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+
+/* === association container / association frame ============================ */
+div.associationContainer {
+ margin-top: 30px;
+}
+
+table.associationContainer {
+ border-collapse: collapse;
+ width: 1022px;
+ border: 1px solid #d1d1d3;
+}
+
+table.associationContainer:hover {
+ border: 1px solid #ff7f00;
+}
+
+table.associationFrame {
+ border-collapse: collapse;
+ margin-left: 1px;
+ margin-top: 1px;
+ margin-bottom: 1px;
+ border: 1px solid #d1d1d3;
+ width: 1018px;
+}
+
+table.associationFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+table.associationFrame > tr > td.description {
+ width: 142px;
+}
+
+table.associationFrame > tr > td.content {
+ width: 853px;
+}
+
+table.associationFrame > tr.itemIdentityFrame {
+ background-color: #f6f7f9;
+}
+
+table.associationFrame > tr.scopeContainer {
+ background-color: #f6f7f9;
+}
+
+
+
+
+/* === associationrole frame ================================================ */
+table.associationFrame table.roleFrame {
+ width: 853px;
+ margin-left: 1px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+}
+
+table.associationFrame table.roleFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+table.associationFrame table.roleFrame > tr > td.description {
+ width: 142px;
+}
+
+table.associationFrame table.roleFrame > tr > td.content {
+ width: 692px;
+}
+
+table.roleFrame > tr.typeFrame {
+ background-color: #f6f7f9;
+}
+
+
+
+/* === tmId frame ========================================================== */
+div.tmIdFrame {
+ margin-top: 30px;
+}
+
+table.tmIdFrame {
+ width: 1023px;
+ border-collapse: collapse;
+ border: 1px solid #d1d1d3;
+ background-color: #f6f7f9;
+}
+
+table.tmIdFrame:hover {
+ border: 1px solid #ff7f00;
+}
+
+li.tmIdFrame {
+ margin-bottom: 10px;
+}
+
+table.tmIdFrame input[type="text"] {
+ margin-left: 12px;
}
\ No newline at end of file
Modified: trunk/src/ajax/css/main.css
==============================================================================
--- trunk/src/ajax/css/main.css (original)
+++ trunk/src/ajax/css/main.css Sun Jun 28 12:35:36 2009
@@ -27,6 +27,7 @@
}
h1 {
+ clear: left;
margin-left: 10px;
padding-top: 20px;
}
@@ -61,5 +62,5 @@
img.ajaxLoader {
display: none;
- margin-left: 412px; /* the image has a width of 100px */
+ margin-left: 412px; /* the image has a width of 100px --> 1024/2 - 100 = 412*/
}
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Sun Jun 28 12:35:36 2009
@@ -12,7 +12,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object
var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
-var HOST_PREF = "http://143.93.190.237:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = "http://192.168.178.29:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
var GET_PREFIX = HOST_PREF + "json/get/";
var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
@@ -37,95 +37,53 @@
var MAX_INT = "MAX_INT";
var MMAX_INT = "*";
+
+// --- some css-styles
+var DISABLED_BACKGROUND_COLOR = {"backgroundColor" : "#eaeaee"};
+
+
// --- Contains most css classes used in this project
// --- There should be called only the function to be sure to don't override
// --- the original values.
-var CLASSES = {"__divPage__" : "page",
- "__divSubPage__" : "subPage",
- "__divContent__" : "content",
- "__divTextrowWithRemoveButton__" : "textrowWithRemoveButton",
- "__divTextrowWithoutRemoveButton__" : "textrowWithoutRemoveButton",
- "__divSelectrowWithRemoveButton__" : "selectrowWithRemoveButton",
- "__divSelectrowWithoutRemoveButton__" : "selectrowWithoutRemoveButton",
- "__spanClickable__" : "clickable",
- "__notVisible__" : "notvisible",
- "__divError__" : "errorMessage",
- "__ulFragmentFrame__" : "fragmentFrame",
- "__tableTopicFrame__" : "topicFrame",
- "__trTopicIdFrame__" : "topicIdFrame",
- "__tdContent__" : "content",
- "__tdDescription__" : "description",
- "__divInstanceOfFrame__" : "instanceOfFrame",
- "__divItemIdentityFrame__" : "itemIdentityFrame",
- "__divSubjectLocatorFrame__" : "subjectLocatorFrame",
- "__divSubjectIdentifierFrame__" : "subjectIdentifierFrame",
- "__divNameContainer__" : "nameContainer",
- "__divNameFrame__" : "nameFrame",
- "__trControlColumn__" : "controlColumn",
- "__trShowHiddenRows__" : "showHiddenRows",
- "__trTypeFrame__" : "typeFrame",
- "__divScopeFrame__" : "scopeFrame",
- "__divScopeContainer__" : "scopeContainer",
- "__divValueFrame__" : "valueFrame",
- "__divVariantFrame__" : "variantFrame",
- "__divVariantContainer__" : "variantContainer",
- "__divDatatypeFrame__" : "datatypeFrame",
- "__divOccurrenceContainer__" : "occurrenceContainer",
- "__divOccurrenceFrame__" : "occurrenceFrame",
- "__divAssociationContainer__" : "associationContainer",
- "__divAssociationFrame__" : "associationFrame",
- "__divRoleContainer__" : "roleContainer",
- "__divRoleFrame__" : "roleFrame",
- "__divPlayerFrame__" : "playerFrame",
- "__spanDeselect__" : "deselect",
- "__divFog__" : "fog",
- "__inputCommitButton__" : "commitButton",
- "__divTmIdFrame__" : "tmIdFrame",
- "__divLoad__" : "loadFrame",
- "__imgAjaxLoader__" : "ajaxLoader",
- "__divEditFrame__" : "editFrame",
-
- "page" : function(){ return this.__divPage__; },
- "subPage" : function(){ return this.__divSubPage__; },
- "content" : function(){ return this.__divContent__; },
- "textrowWithRemoveButton" : function(){ return this.__divTextrowWithRemoveButton__; },
- "textrowWithoutRemoveButton" : function(){ return this.__divTextrowWithoutRemoveButton__; },
- "selectrowWithRemoveButton" : function(){ return this.__divSelectrowWithRemoveButton__; },
- "selectrowWithoutRemoveButton" : function(){ return this.__divSelectrowWithoutRemoveButton__; },
- "clickable" : function(){ return this.__spanClickable__; },
- "notVisible" : function(){ return this.__notVisible__; },
- "error" : function(){ return this.__divError__; }, "fragmentFrame" : function(){ return this.__ulFragmentFrame__; },
- "topicFrame" : function(){ return this.__tableTopicFrame__; },
- "topicIdFrame" : function(){ return this.__trTopicIdFrame__; },
- "content" : function(){ return this.__tdContent__; },
- "description" : function(){ return this.__tdDescription__; },
- "instanceOfFrame" : function(){ return this.__divInstanceOfFrame__; },
- "itemIdentityFrame" : function(){ return this.__divItemIdentityFrame__; },
- "subjectLocatorFrame" : function(){ return this.__divSubjectLocatorFrame__; },
- "subjectIdentifierFrame" : function(){ return this.__divSubjectIdentifierFrame__; },
- "nameContainer" : function(){ return this.__divNameContainer__; },
- "nameFrame" : function(){ return this.__divNameFrame__; },
- "controlColumn" : function(){ return this.__trControlColumn__; },
- "showHiddenRows" : function(){ return this.__trShowHiddenRows__; },
- "typeFrame" : function(){ return this.__trTypeFrame__; },
- "scopeFrame" : function(){ return this.__divScopeFrame__; },
- "scopeContainer" : function(){ return this.__divScopeContainer__; },
- "valueFrame" : function(){ return this.__divValueFrame__; },
- "variantFrame" : function(){ return this.__divVariantFrame__; },
- "variantContainer" : function(){ return this.__divVariantContainer__; },
- "datatypeFrame" : function(){ return this.__divDatatypeFrame__; },
- "occurrenceContainer" : function(){ return this.__divOccurrenceContainer__; },
- "occurrenceFrame" : function(){ return this.__divOccurrenceFrame__; },
- "associationContainer" : function(){ return this.__divAssociationContainer__; },
- "associationFrame" : function(){ return this.__divAssociationFrame__; },
- "roleContainer" : function(){ return this.__divRoleContainer__; },
- "roleFrame" : function(){ return this.__divRoleFrame__; },
- "playerFrame" : function(){ return this.__divPlayerFrame__; },
- "deselect" : function(){ return this.__spanDeselect__; },
- "fog" : function(){ return this.__divFog__; },
- "commitButton" : function(){ return this.__inputCommitButton__; },
- "tmIdFrame" : function(){ return this.__divTmIdFrame__; },
- "load" : function(){ return this.__divLoad__; },
- "ajaxLoader" : function(){ return this.__imgAjaxLoader__; },
- "editFrame" : function(){ return this.__divEditFrame__; }
+var CLASSES = {"page" : function(){ return "page"; },
+ "subPage" : function(){ return "subPage"; },
+ "content" : function(){ return "content"; },
+ "textrowWithRemoveButton" : function(){ return "textrowWithRemoveButton"; },
+ "textrowWithoutRemoveButton" : function(){ return "textrowWithoutRemoveButton"; },
+ "selectrowWithRemoveButton" : function(){ return "selectrowWithRemoveButton"; },
+ "selectrowWithoutRemoveButton" : function(){ return "selectrowWithoutRemoveButton"; },
+ "clickable" : function(){ return "clickable"; },
+ "error" : function(){ return "errorMessage" },
+ "fragmentFrame" : function(){ return "fragmentFrame"; },
+ "topicFrame" : function(){ return "topicFrame"; },
+ "topicIdFrame" : function(){ return "topicIdFrame"; },
+ "content" : function(){ return "content"; },
+ "description" : function(){ return "description"; },
+ "instanceOfFrame" : function(){ return "instanceOfFrame"; },
+ "itemIdentityFrame" : function(){ return "itemIdentityFrame"; },
+ "subjectLocatorFrame" : function(){ return "subjectLocatorFrame"; },
+ "subjectIdentifierFrame" : function(){ return "subjectIdentifierFrame"; },
+ "nameContainer" : function(){ return "nameContainer"; },
+ "nameFrame" : function(){ return "nameFrame"; },
+ "controlColumn" : function(){ return "controlColumn"; },
+ "showHiddenRows" : function(){ return "showHiddenRows"; },
+ "typeFrame" : function(){ return "typeFrame"; },
+ "scopeFrame" : function(){ return "scopeFrame"; },
+ "scopeContainer" : function(){ return "scopeContainer"; },
+ "valueFrame" : function(){ return "valueFrame"; },
+ "variantFrame" : function(){ return "variantFrame"; },
+ "variantContainer" : function(){ return "variantContainer"; },
+ "datatypeFrame" : function(){ return "datatypeFrame"; },
+ "occurrenceContainer" : function(){ return "occurrenceContainer"; },
+ "occurrenceFrame" : function(){ return "occurrenceFrame"; },
+ "associationContainer" : function(){ return "associationContainer"; },
+ "associationFrame" : function(){ return "associationFrame"; },
+ "roleContainer" : function(){ return "roleContainer"; },
+ "roleFrame" : function(){ return "roleFrame"; },
+ "playerFrame" : function(){ return "playerFrame"; },
+ "commitButton" : function(){ return "commitButton"; },
+ "tmIdFrame" : function(){ return "tmIdFrame"; },
+ "load" : function(){ return "loadFrame"; },
+ "ajaxLoader" : function(){ return "ajaxLoader"; },
+ "editFrame" : function(){ return "editFrame"; }
};
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Sun Jun 28 12:35:36 2009
@@ -101,6 +101,17 @@
tmId.isValid();
}
+ var validateButton = new Element("input", {"type" : "button", "value" : "validate fragment"});
+ validateButton.observe("click", function(event){
+ var ret = true;
+ if(topic.isValid() === false) ret = false;
+ if(associations && associations.isValid() === false) ret = false;
+ if(tmId.isValid() === false) ret = false;
+
+ if(ret === true) alert("Fragment is valid!");
+ else alert("Fragment is not valid!");
+ });
+
var commitButton = new Element("input", {"type" : "button", "value" : "commit fragment"})
commitButton.observe("click", function(event){
// --- validates the given data
@@ -146,7 +157,8 @@
});
var liCB = new Element("li", {"class" : CLASSES.commitButton()});
- liCB.update(commitButton);
+ liCB.insert({"top" : validateButton});
+ liCB.insert({"top" : commitButton});
liTm.insert({"after" : liCB});
}
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Sun Jun 28 12:35:36 2009
@@ -95,7 +95,7 @@
this.__regExpString__ = regexp;
this.__frame__.writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
this.__content__.remove();
- this.__content__ = new Element("input", {"type" : "text", "value" : content});
+ this.__content__ = new Element("input", {"type" : "text", "value" : content, "size" : 40});
this.__dblClickHandler__ = dblClickHandler;
if(cssTitle && cssTitle.length){
this.__content__.writeAttribute({"title" : cssTitle});
@@ -1156,7 +1156,7 @@
this.__table__.insert({"bottom" : newRow(CLASSES.scopeContainer(), "Scope", new Element("div"))});
// --- resource value and datatype
- makeResource(this, contents, null, null, null);
+ makeResource(this, contents, null, null, null, {"rows" : 3, "cols" : 40});
this.getFrame().observe("dblclick", function(event){
dblClickHandler(owner, event);
@@ -1225,25 +1225,25 @@
},
"disable" : function(){
this.hideError();
- this.__itemIdentity__.disable();
+ disableItemIdentity(this);
// TODO: scope
- this.__value__.writeAttribute({"readonly" : "readonly"});
- this.__datatype__.__frames__[0].disable();
+ this.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+ disableValue(this);
+ disableDatatype(this);
this.hideRemoveButton();
this.hideAddButton();
- this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
- this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
this.__disabled__ = true;
},
"enable" : function(){
- this.__itemIdentity__.enable();
+ enableItemIdentity(this);
// TODO: scope
- this.__value__.removeAttribute("readonly");
- this.__datatype__.__frames__[0].enable();
+ this.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
+ enableValue(this);
+ enableDatatype(this);
if(this.__owner__.__frames__.length > 1) this.showRemoveButton();
this.showAddButton();
- this.getFrame().setStyle({"backgroundColor" : "inherit"});
- this.getFrame().setStyle({"border" : "none"});
+ this.getFrame().removeAttribute("style");
this.__disabled__ = false;
},
"minimize" : function(){
@@ -1392,11 +1392,9 @@
// --- name element will be shown
function addSecondShowHandler(myself){
myself.__table__.select("tr")[0].observe("click", function(event){
- try{
- for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
- myself.__variants__.__container__.__frames__[i].minimize();
- }
- }catch(tmp){ alert(tmp);}
+ for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
+ myself.__variants__.__container__.__frames__[i].minimize();
+ }
});
}
@@ -1450,25 +1448,23 @@
},
"disable" : function(){
this.hideError();
- this.__itemIdentity__.disable();
- this.__type__.__frames__[0].disable();
- this.__scope__.disable();
- this.__value__.__frames__[0].disable();
- this.__variants__.disable();
- this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
- this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+ disableItemIdentity(this);
+ disableType(this);
+ disableScope(this);
+ disableValue(this);
+ disableVariants(this);
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
this.getFrame().writeAttribute({"title" : this.__cssTitle__});
this.hideAddButton();
this.__disabled__ = true;
},
"enable" : function(){
- this.__itemIdentity__.enable();
- this.__type__.__frames__[0].enable();
- this.__scope__.enable();
- this.__value__.__frames__[0].enable();
- this.__variants__.enable();
- this.getFrame().setStyle({"backgroundColor" : "inherit"});
- this.getFrame().setStyle({"border" : "none"});
+ enableItemIdentity(this);
+ enableType(this);
+ enableScope(this);
+ enableValue(this);
+ enableVariants(this);
+ this.getFrame().removeAttribute("style");
this.getFrame().removeAttribute("title");
checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
this.__disabled__ = false;
@@ -1755,7 +1751,7 @@
var cssTitle = "No constraint found for this occurrence";
if(noConstraint === false) cssTitle = "min: " + _min + " max: " + _max + " regular expression: " + constraint.regexp;
this.__cssTitle__ = cssTitle;
- makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle);
+ makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle, {"rows" : 5, "cols" : 60});
this.getFrame().observe("dblclick", function(event){
dblClickHandler(owner, event);
@@ -1827,27 +1823,25 @@
else trs[i].hide();
}
},
- "disable" : function(){
+ "disable" : function(){try{
this.hideError();
- this.__itemIdentity__.disable();
- this.__type__.__frames__[0].disable();
- this.__scope__.disable();
- this.__value__.writeAttribute({"readonly" : "readonly"});
- this.__datatype__.__frames__[0].disable();
- this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
- this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+ disableItemIdentity(this);
+ disableType(this);;
+ disableScope(this);
+ disableValue(this);
+ disableDatatype(this);
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
this.getFrame().writeAttribute({"title" : this.__cssTitle__});
this.hideAddButton();
- this.__disabled__ = true;
+ this.__disabled__ = true;}catch(err){ alert("err: " + err); }
},
"enable" : function(){
- this.__itemIdentity__.enable();
- this.__type__.__frames__[0].enable();
- this.__scope__.enable();
- this.__value__.removeAttribute("readonly");
- this.__datatype__.__frames__[0].enable();
- this.getFrame().setStyle({"backgroundColor" : "inherit"});
- this.getFrame().setStyle({"border" : "none"});
+ enableItemIdentity(this);
+ enableType(this);;
+ enableScope(this);
+ enableValue(this);
+ enableDatatype(this);
+ this.getFrame().removeAttribute("style");
this.getFrame().removeAttribute("title");
checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
this.__disabled__ = false;
@@ -2479,19 +2473,17 @@
},
"disable" : function(){
this.hideError();
- this.__itemIdentity__.disable();
- this.__type__.__frames__[0].disable();
- this.__player__.__frames__[0].disable();
- this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
- this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+ disableItemIdentity(this);
+ disableType(this);
+ disablePlayer(this);
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
this.__disabled__ = true;
},
"enable" : function(){
- this.__itemIdentity__.enable();
- this.__type__.__frames__[0].enable();
- this.__player__.__frames__[0].enable();
- this.getFrame().setStyle({"backgroundColor" : "inherit"});
- this.getFrame().setStyle({"border" : "none"});
+ enableItemIdentity(this);
+ enableType(this);
+ enablePlayer(this);
+ this.getFrame().removeAttribute("style");
this.__disabled__ = false;
}});
@@ -3569,25 +3561,23 @@
},
"disable" : function(){
this.hideError();
- this.__itemIdentity__.disable();
- this.__roles__.disable();
- this.__type__.__frames__[0].disable();
- this.__scope__.disable();
+ disableItemIdentity(this);
+ disableRole(this);
+ disableType(this);
+ disableScope(this);
this.hideRemoveButton();
this.hideAddButton();
- this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
- this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+ this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
this.__disabled__ = true;
},
"enable" : function(){
- this.__itemIdentity__.enable();
- this.__roles__.enable();
- this.__type__.__frames__[0].enable();
- this.__scope__.enable();
+ enableItemIdentity(this);
+ enableRole(this);
+ enableType(this);
+ enableScope(this);
if(this.__owner__.__frames__.length > 1 || !this.__constraints__ || this.__constraints__.length !== 0) this.showRemoveButton();
if(this.__constraints__ && this.__constraints__.length !== 0) this.showAddButton();
- this.getFrame().setStyle({"backgroundColor" : "inherit"});
- this.getFrame().setStyle({"border" : "none"});
+ this.getFrame().removeAttribute("style");
this.__disabled__ = false;
}});
@@ -3712,7 +3702,7 @@
this.__caption__ = new Element("caption", {"class" : CLASSES.clickable()}).update("Topic Map ID");
this.__table__.update(this.__caption__);
var value = contents && contents.length !== 0 ? decodeURI(contents[0]) : "";
- this.__contentrow__ = new Element("input", {"type" : "text", "value" : value});
+ this.__contentrow__ = new Element("input", {"type" : "text", "value" : value, "size" : 40});
this.__tr__ = new Element("tr", {"class" : CLASSES.tmIdFrame()});
var td =new Element("td", {"class" : CLASSES.content()});
this.__tr__.update(td);
@@ -3968,8 +3958,9 @@
// --- sets the resource value and datatype of names and occurrences
-function makeResource(myself, content, constraints, datatypeConstraint, cssTitle)
+function makeResource(myself, content, constraints, datatypeConstraint, cssTitle, size)
{
+ if(!size) size = {"rows" : 3, "cols" : 40};
var value = "";
var datatype = "";
if(content && content.resourceRef && content.resourceRef.length !== 0){
@@ -3989,18 +3980,20 @@
this.__datatype__.__frames__[0].remove();
this.__datatype__ = new Object();
}catch(err){}
- myself.__value__ = new Element("textarea", {"rows" : 3}).setValue(value);
+ myself.__value__ = new Element("textarea", size).setValue(value);
myself.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Resource Value", myself.__value__)});
if(cssTitle && cssTitle.length !== 0) myself.__value__.writeAttribute({"title" : cssTitle});
// --- datatype
myself.__datatype__ = new Object();
- if(datatypeConstraint && datatypeConstraint.length !== 0){
+ if((datatypeConstraint && datatypeConstraint.length !== 0) || datatype === ANY_URI){
new TextrowC(datatypeConstraint, datatypeConstraint, myself.__datatype__, 1, 1, null);
myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"readonly" : "readonly"});
+ myself.__datatypeIsSet__ = true;
}
else {
new TextrowC(datatype, ".*", myself.__datatype__, 1, 1, null);
+ myself.__datatypeIsSet__ = false;
}
myself.__table__.insert({"bottom" : newRow(CLASSES.datatypeFrame(), "Datatype", myself.__datatype__.__frames__[0].getFrame())});
}
@@ -4153,4 +4146,88 @@
var tr = newRow(CLASSES.typeFrame(), "Type", new SelectrowC(types, myself.__type__, 1, 1).getFrame());
myself.__table__.insert({"bottom" : tr});
return types;
+}
+
+// --- some helper to enable/disable some table rows
+
+function disableItemIdentity(myself)
+{
+ myself.__itemIdentity__.disable();
+ myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableItemIdentity(myself)
+{
+ myself.__itemIdentity__.enable();
+ myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].removeAttribute("style");
+}
+function disableType(myself)
+{
+ myself.__type__.__frames__[0].disable();
+ myself.__table__.select("tr." + CLASSES.typeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableType(myself)
+{
+ myself.__type__.__frames__[0].enable();
+ myself.__table__.select("tr." + CLASSES.typeFrame())[0].removeAttribute("style");
+}
+function disableScope(myself){
+ myself.__scope__.disable();
+ myself.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableScope(myself)
+{
+ myself.__scope__.enable();
+ myself.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
+}
+function disableValue(myself)
+{
+ try{ myself.__value__.__frames__[0].disable(); } catch(err){}
+ try{ myself.__value__.writeAttribute({"readonly" : "readonly"}); } catch(err){}
+ myself.__table__.select("tr." + CLASSES.valueFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableValue(myself)
+{
+ try{ myself.__value__.__frames__[0].enable(); } catch(err){}
+ try{ myself.__value__.removeAttribute("readonly"); } catch(err){}
+ myself.__table__.select("tr." + CLASSES.valueFrame())[0].removeAttribute("style");
+}
+function disableDatatype(myself)
+{
+ myself.__datatype__.__frames__[0].disable();
+ myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableDatatype(myself)
+{
+ if(myself.__datatypeIsSet__ === false) myself.__datatype__.__frames__[0].enable();
+ myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].removeAttribute("style");
+}
+function disableVariants(myself)
+{
+ myself.__variants__.disable();
+ myself.__table__.select("tr." + CLASSES.variantContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableVariants(myself)
+{
+ myself.__variants__.enable();
+ myself.__table__.select("tr." + CLASSES.variantContainer())[0].removeAttribute("style");
+}
+function disableRole(myself)
+{
+ myself.__roles__.disable();
+ myself.__table__.select("tr." + CLASSES.roleContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableRole(myself)
+{
+ myself.__roles__.enable();
+ myself.__table__.select("tr." + CLASSES.roleContainer())[0].removeAttribute("style");
+}
+function disablePlayer(myself)
+{
+ myself.__player__.__frames__[0].disable();
+ myself.__table__.select("tr." + CLASSES.playerFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enablePlayer(myself)
+{
+ myself.__player__.__frames__[0].enable();
+ myself.__table__.select("tr." + CLASSES.playerFrame())[0].removeAttribute("style");
}
\ No newline at end of file
Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js (original)
+++ trunk/src/ajax/javascripts/requests.js Sun Jun 28 12:35:36 2009
@@ -16,6 +16,7 @@
{
return setTimeout(function(){
alert("The AJAX request for \"" + url + "\" timed out. Please check your network connection!");
+ hideLoad();
}, time);
}
1
0