isidorus-cvs
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- 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
- 1037 discussions
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
Author: lgiessmann
Date: Fri Jun 26 10:10:52 2009
New Revision: 72
Log:
ajax-client: fixed a bug with safari by minimizing frames. instead of minimizing they were hidden without any chance to display them! Currentyl the client is able to be used with all functions in firefox, opera and safari - with IE it is not useable and will take a while until this will change
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 Fri Jun 26 10:10:52 2009
@@ -3888,7 +3888,7 @@
myself.__table__.insert({"bottom" : tr});
var trCtrl = new Element("tr", {"class" : CLASSES.showHiddenRows()});
- trCtrl.insert({"top" : new Element("td", {"class" : CLASSES.clickable()}).update("»")});
+ trCtrl.insert({"top" : new Element("td", {"class" : CLASSES.clickable()}).update("»")});
myself.__table__.insert({"top" : trCtrl});
trCtrl.hide();
trCtrl.observe("click", function(){
1
0
Author: lgiessmann
Date: Fri Jun 26 09:58:31 2009
New Revision: 71
Log:
ajax-client: fixed a bug with safari -> the commit button wasn't displayed by safari, this was caused by the attribute "margin: -21px;" currently the owner-div owns a "padding: 21px" attribute
Modified:
trunk/src/ajax/css/frame.css
trunk/src/ajax/css/main.css
trunk/src/ajax/javascripts/create.js
Modified: trunk/src/ajax/css/frame.css
==============================================================================
--- trunk/src/ajax/css/frame.css (original)
+++ trunk/src/ajax/css/frame.css Fri Jun 26 09:58:31 2009
@@ -37,6 +37,5 @@
}
input[value="commit fragment"] {
- margin-top: -20px;
float: right;
}
\ 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 Fri Jun 26 09:58:31 2009
@@ -23,6 +23,7 @@
border-right: 1px solid #d1d1d3;
border-bottom: 1px solid #d1d1d3;
margin-top: -21px;
+ padding-bottom: 21px;
}
h1 {
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Fri Jun 26 09:58:31 2009
@@ -144,6 +144,7 @@
}
getTopicStubs(referencedTopics, onSuccessHandler, onErrorHandler);
});
+
var liCB = new Element("li", {"class" : CLASSES.commitButton()});
liCB.update(commitButton);
liTm.insert({"after" : liCB});
1
0

[isidorus-cvs] r70 - in trunk/src: ajax/javascripts json rest_interface
by Lukas Giessmann 26 Jun '09
by Lukas Giessmann 26 Jun '09
26 Jun '09
Author: lgiessmann
Date: Fri Jun 26 09:29:12 2009
New Revision: 70
Log:
ajax-client: fixed some bugs that were discovered by using opera; json-server: implemented a new json-handler, this handler returns a topic-psi-list of all valid topic-instances (valid: is oriented only on topic-typing and tmcl - all other constraints are not checked by the server)
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
trunk/src/ajax/javascripts/requests.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
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Fri Jun 26 09:29:12 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 = "192.168.178.21/"; //"http://localhost:8000/";
+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/";
@@ -20,6 +20,7 @@
var COMMIT_URL = HOST_PREF + "json/commit/";
var ALL_PSIS_URL = HOST_PREF + "json/psis/";
var TYPE_PSIS_URL = HOST_PREF + "json/tmcl/types/";
+var INSTANCE_PSIS_URL = HOST_PREF + "json/tmcl/instances/";
var OWN_URL = HOST_PREF + "isidorus";
var SUMMARY_URL = HOST_PREF + "json/summary"
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Fri Jun 26 09:29:12 2009
@@ -46,7 +46,7 @@
}
} //onSuccessHandler
- getPsis(onSuccessHandler, null, true);
+ getPsis(onSuccessHandler, null, {"types" : true});
}catch(err){
alert("From makeCreate(): " + err);
}
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Fri Jun 26 09:29:12 2009
@@ -20,7 +20,7 @@
this.__remove__ = new Element("span", {"class" : CLASSES.clickable()}).update("-");
this.__add__ = new Element("span", {"class" : CLASSES.clickable()}).update("+");
- checkRemoveAddButtons(owner, min, max);
+ checkRemoveAddButtons(owner, min, max, null);
this.__error__ = new Element("div", {"class" : CLASSES.error()});
this.__error__.hide();
@@ -32,7 +32,7 @@
this.__frame__.insert({"bottom" : this.__error__});
this.__disabled__ = false;
- setRemoveAddHandler(this, owner, min, max, function(){
+ setRemoveAddHandler(this, true, owner, min, max, function(){
return new FrameC("", owner, min, max);
});
},
@@ -102,9 +102,9 @@
}
this.__remove__.insert({"after" : this.__content__});
- checkRemoveAddButtons(owner, min, max);
+ checkRemoveAddButtons(owner, min, max, null);
var myself = this;
- setRemoveAddHandler(this, owner, min, max, function(){
+ setRemoveAddHandler(this, true, owner, min, max, function(){
return new TextrowC("", regexp, owner, min, max, cssTitle, dblClickHandler);
});
@@ -138,7 +138,7 @@
},
"enable" : function(){
this.__content__.removeAttribute("readonly");
- checkRemoveAddButtons(this.__owner__, this.__min__, this.__max__);
+ checkRemoveAddButtons(this.__owner__, this.__min__, this.__max__, null);
this.__disabled__ = false;
},
"getRegexp" : function(){
@@ -162,8 +162,8 @@
}
this.__remove__.insert({"after" : this.__content__});
- checkRemoveAddButtons(owner, min, max);
- setRemoveAddHandler(this, owner, min, max, function(){
+ checkRemoveAddButtons(owner, min, max, null);
+ setRemoveAddHandler(this, true, owner, min, max, function(){
return new SelectrowC(contents, owner, min, max);
});
},
@@ -1145,8 +1145,8 @@
// --- control row + itemIdentity
makeControlRow(this, 4, itemIdentityContent);
- checkRemoveAddButtons(owner, 1, -1);
- setRemoveAddHandler(this, owner, 1, -1, function(){
+ checkRemoveAddButtons(owner, 1, -1, null);
+ setRemoveAddHandler(this, true, owner, 1, -1, function(){
return new VariantC(null, owner, dblClickHandler, parent);
});
@@ -1336,6 +1336,7 @@
this.__max__ = max;
this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandler;
+ this.__constraint__ = simpleConstraint;
try{
var itemIdentityContent = null;
@@ -1353,8 +1354,8 @@
// --- control row + ItemIdentity
makeControlRow(this, 5, itemIdentityContent);
- checkRemoveAddButtons(owner, min, max);
- setRemoveAddHandler(this, owner, min, max, function(){
+ checkRemoveAddButtons(owner, min, max, this);
+ setRemoveAddHandler(this, this.__constraint__, owner, min, max, function(){
return new NameC(null, nametypescopes, simpleConstraint, owner, min, max, dblClickHandler);
});
@@ -1469,7 +1470,7 @@
this.getFrame().setStyle({"backgroundColor" : "inherit"});
this.getFrame().setStyle({"border" : "none"});
this.getFrame().removeAttribute("title");
- checkRemoveAddButtons(this.__owner__, 1, this.__max__);
+ checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
this.__disabled__ = false;
}});
@@ -1713,8 +1714,8 @@
// --- control row + itemIdentity
makeControlRow(this, 5, itemIdentityContent);
- checkRemoveAddButtons(owner, 1, max);
- setRemoveAddHandler(this, owner, 1, max, function(){
+ checkRemoveAddButtons(owner, 1, max, this);
+ setRemoveAddHandler(this, this.__constraint__, owner, 1, max, function(){
return new OccurrenceC(null, occurrenceTypes, constraint, uniqueConstraints, owner, min, max, cssTitle, dblClickHandler);
});
@@ -1848,7 +1849,7 @@
this.getFrame().setStyle({"backgroundColor" : "inherit"});
this.getFrame().setStyle({"border" : "none"});
this.getFrame().removeAttribute("title");
- checkRemoveAddButtons(this.__owner__, 1, this.__max__);
+ checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
this.__disabled__ = false;
}});
@@ -2275,12 +2276,13 @@
this.__owner__ = owner;
this.__typeMin__ = typeMin;
this.__parentElem__ = parent;
+ this.__constraint__ = true; // is needed for checkAddRemoveButtons
try{
// --- control row + itemIdentity
makeControlRow(this, 3, itemIdentities); // make control row have to be changed to a separate control row for roles
- checkRemoveAddButtons(owner, 1, -1);
- setRemoveAddHandler(this, owner, 1, -1, function(){ /*do nothing*/ });
+ checkRemoveAddButtons(owner, 1, -1, this);
+ setRemoveAddHandler(this, this.__constraint__, owner, 1, -1, function(){ /*do nothing*/ });
// --- gets the add and remove button
var cTd = this.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].select("td." + CLASSES.controlColumn())[0].select("span." + CLASSES.clickable());
this.__removeButton__ = cTd[1];
@@ -2514,6 +2516,10 @@
}
},
"__orderContentsToRoles__" : function(contents, roleContainer, usedContents, alreadyUsedRoles){
+ if(!roleContainer || roleContainer.length === 0){
+ return {"usedContents" : usedContents, "contents" : contents, "alreadyUsedRoles" : alreadyUsedRoles};
+ }
+
for(var i = 0; i !== contents.length; ++i){
var rType = contents[i].type;
var player = contents[i].topicRef;
@@ -2819,7 +2825,7 @@
this.__makeRolesFromARC__(arc, foundRpcs);
}
// --- creates roles from otherrole-constraints
- for(var i = 0; i !== this.__arContainer__.__frames__.length; ++i){
+ for(var i = 0; this.__arContainer__.__frames__ && i !== this.__arContainer__.__frames__.length; ++i){
this.__makeRolesFromORC__(this.__arContainer__.__frames__[i].getType(), this.__arContainer__.__frames__[i].getPlayer());
}
},
@@ -3465,13 +3471,14 @@
// --- control row + ItemIdentity
makeControlRow(this, 4, itemIdentityContent);
- checkRemoveAddButtons(owner, 1, -1);
- setRemoveAddHandler(this, owner, 1, -1, function(){
+ checkRemoveAddButtons(owner, 1, -1, this);
+ setRemoveAddHandler(this, this.__constraints__, owner, 1, -1, function(){
return new AssociationC(null, constraints, owner);
});
// --- type
- var types = makeTypes(this, typeContent, constraints);
+ var types = makeTypes(this, typeContent, constraints);
+ if(types.flatten().length === 0 || types.flatten()[0].strip().length === 0 || !constraints || constraints.length === 0) this.hideAddButton();
// --- scopes
var currentConstraint = this.getCurrentConstraint();
@@ -3577,8 +3584,8 @@
this.__roles__.enable();
this.__type__.__frames__[0].enable();
this.__scope__.enable();
- if(this.__owner__.__frames__.length > 1) this.showRemoveButton();
- this.showAddButton();
+ 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.__disabled__ = false;
@@ -3605,6 +3612,11 @@
tr.update(td);
this.__table__.insert({"bottom" : tr});
}
+ if(!constraints || constraints.length === 0){
+ for(var i = 0; i !== this.__container__.__frames__.length; ++i){
+ this.__container__.__frames__[i].hideAddButton();
+ }
+ }
if(!this.__container__.__frames__ && constraints && constraints.length !== 0){
var association = new AssociationC(null, constraints, this.__container__);
@@ -3773,7 +3785,7 @@
// --- Helper function for the constructors of all classes
// --- of the type FrameC.
// --- There will be set the remome and add handler.
-function setRemoveAddHandler(myself, owner, min, max, call)
+function setRemoveAddHandler(myself, constraint, owner, min, max, call)
{
myself.__remove__.stopObserving();
myself.__add__.stopObserving();
@@ -3783,12 +3795,12 @@
if(disabled === false){
myself.remove();
owner.__frames__ = owner.__frames__.without(myself);
- if(min >= owner.__frames__.length){
+ if(min >= owner.__frames__.length && constraint){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].hideRemoveButton();
}
}
- if(max > owner.__frames__.length){
+ if((max === -1 || max > owner.__frames__.length) && constraint){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].showAddButton();
}
@@ -3802,12 +3814,12 @@
if(disabled === false){
var newElem = call();
myself.append(newElem.getFrame());
- if(remove === true && min !== -1 && owner.__frames__.length > min){
+ if((remove === true && min !== -1 && owner.__frames__.length > min) || !constraint){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].showRemoveButton();
}
}
- if(max > -1 && max <= owner.__frames__.length){
+ if((max > -1 && max <= owner.__frames__.length) || !constraint){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].hideAddButton();
}
@@ -3818,30 +3830,33 @@
// --- Helper function for the constructors of all classes
-// --- of the type FrameC.
+// --- of the type FrameC and some of the type ContainerC.
// --- There will be checked the visibility of the remove and
// --- add buttons.
-function checkRemoveAddButtons(owner, min, max)
+function checkRemoveAddButtons(owner, min, max, myself)
{
- if(min >= owner.__frames__.length){
+ var constraint = true;
+ if(myself && !myself.__constraint__ && (!myself.__constraints__ || myself.__constraints__.length === 0)) constraint = false;
+
+ if(min >= owner.__frames__.length && constraint === true){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].hideRemoveButton();
}
}
- if(min > -1 && min < owner.__frames__.length){
+ if((min > -1 && min < owner.__frames__.length) || constraint === false){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].showRemoveButton();
}
}
- if(max > -1 && max <= owner.__frames__.length){
+ if((max > -1 && max <= owner.__frames__.length) || constraint === false){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].hideAddButton();
}
}
- if(max === -1 || max > owner.__frames__.length){
+ if((max === -1 || max > owner.__frames__.length) && constraint === true){
for(var i = 0; i != owner.__frames__.length; ++i){
owner.__frames__[i].showAddButton();
}
Modified: trunk/src/ajax/javascripts/edit.js
==============================================================================
--- trunk/src/ajax/javascripts/edit.js (original)
+++ trunk/src/ajax/javascripts/edit.js Fri Jun 26 09:29:12 2009
@@ -55,7 +55,7 @@
alert("There occurred an error by creating an EditC frame, please reload this page!\n\n" + err);
}
}
- getPsis(onSuccessHandler, null, false);
+ getPsis(onSuccessHandler, null, {"instances" : true});
}
catch(err){
alert("From makeEdit(): " + err);
Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js (original)
+++ trunk/src/ajax/javascripts/requests.js Fri Jun 26 09:29:12 2009
@@ -83,7 +83,7 @@
// --- Gets all psis from the server. If typePsis is set to true
// --- there will be requested only TopicType's psis.
-function getPsis(onSuccessHandler, onFailureHandler, typePsis)
+function getPsis(onSuccessHandler, onFailureHandler, what)
{
try{
var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler;
@@ -91,7 +91,9 @@
onLoad("Requesting all type PSIs");
var url = ALL_PSIS_URL;
- if(typePsis === true) url = TYPE_PSIS_URL;
+ 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;
new Ajax.Request(url, {
"method" : "get",
Modified: trunk/src/json/json_tmcl.lisp
==============================================================================
--- trunk/src/json/json_tmcl.lisp (original)
+++ trunk/src/json/json_tmcl.lisp Fri Jun 26 09:29:12 2009
@@ -992,8 +992,7 @@
(remove-duplicates
(if (eql treat-as 'type)
(topictype-p topic-instance)
- (loop for topic in (union (get-direct-types-of-topic topic-instance) (get-direct-supertypes-of-topic topic-instance))
- append (topictype-p topic))))))
+ (valid-instance-p topic-instance)))))
(let ((all-abstract-topictype-constraints nil)
(all-exclusive-instance-constraints nil)
(all-subjectidentifier-constraints nil)
@@ -1104,8 +1103,7 @@
(remove-duplicates
(if (eql treat-as 'type)
(topictype-p topic-instance)
- (loop for topic in (union (get-direct-types-of-topic topic-instance) (get-direct-supertypes-of-topic topic-instance))
- append (topictype-p topic))))))
+ (valid-instance-p topic-instance)))))
(let ((all-available-associationtypes
(remove-duplicates
(loop for possible-player-topic in all-possible-player-topics
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Fri Jun 26 09:29:12 2009
@@ -12,6 +12,7 @@
(:export :get-constraints-of-fragment
:topictype-p
:abstract-p
+ :valid-instance-p
:list-subtypes))
@@ -272,6 +273,64 @@
all-subtypes-of-all-instances)))))))
+(defun valid-instance-p (topic-instance &optional (akos-checked nil) (all-checked-topics nil))
+ "Returns a list of all checked topics or throws an exception if the given
+ topic is not a valid instance of any topictype in elephant."
+ (let ((isas-of-this
+ (get-direct-types-of-topic topic-instance))
+ (akos-of-this
+ (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*))
+ (local-all-checked-topics all-checked-topics)
+ (local-akos-checked))
+
+ (when (not topictype-constraint)
+ (return-from valid-instance-p topic-instance))
+
+ (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*)))
+
+ (when (eql topic-instance topictype)
+ (return-from valid-instance-p (remove-duplicates (append all-checked-topics (list topic-instance)))))
+
+ (unless (or isas-of-this akos-of-this)
+ (error (format nil "The topic \"~a\" is not a valid topic-instance for any topic-type" psi-of-this)))
+
+ (when (find topic-instance akos-checked)
+ (return-from valid-instance-p all-checked-topics))
+
+ (pushnew topic-instance local-all-checked-topics)
+ (pushnew topic-instance local-akos-checked)
+
+ (dolist (isa isas-of-this)
+ (handler-case (let ((topics
+ (topictype-p isa topictype topictype-constraint)))
+ (dolist (top topics)
+ (pushnew top local-all-checked-topics)))
+ (condition (err) (error (format nil "The topic \"~a\" is not a valid topic-instance for any topic-type~%~%~a" psi-of-this err)))))
+
+ (dolist (ako akos-of-this)
+ (when (not (handler-case (let ((topics
+ (topictype-p ako topictype topictype-constraint all-checked-topics)))
+ (dolist (top topics)
+ (pushnew top local-all-checked-topics))
+ (pushnew ako local-akos-checked)
+ topics)
+ (condition () nil)))
+ (handler-case (let ((topics
+ (valid-instance-p ako akos-checked (append all-checked-topics (list ako)))))
+ (dolist (top topics)
+ (pushnew top local-all-checked-topics)
+ (pushnew top local-akos-checked))
+ topics)
+ (condition (err) (error (format nil "The topic \"~a\" is not a valid topic-instance for any topic-type~%~%~a" psi-of-this err))))))
+ local-all-checked-topics))
+
+
(defun return-all-tmcl-types ()
"Returns all topics that are valid tmcl-types"
(let ((all-topics
@@ -282,7 +341,7 @@
(remove-if #'null
(map 'list #'(lambda(x)
(handler-case (progn
- (json-tmcl::topictype-p x topictype topictype-constraint)
+ (topictype-p x topictype topictype-constraint)
x)
(condition () nil))) all-topics))))
(let ((not-abstract-types
@@ -291,4 +350,20 @@
(unless (json-tmcl:abstract-p x)
x))
all-types))))
- not-abstract-types))))
\ No newline at end of file
+ not-abstract-types))))
+
+
+(defun return-all-tmcl-instances ()
+ "Returns all topics that are valid instances of any topic type.
+ The validity is only oriented on the typing of topics, e.g.
+ type-instance or supertype-subtype."
+ (let ((all-topics
+ (elephant:get-instances-by-class 'd:TopicC)))
+ (let ((valid-instances
+ (remove-if #'null
+ (map 'list #'(lambda(x)
+ (handler-case (progn
+ (valid-instance-p x)
+ x)
+ (condition () nil))) all-topics))))
+ valid-instances)))
\ 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 Fri Jun 26 09:29:12 2009
@@ -30,6 +30,7 @@
:*json-get-all-psis*
:*json-get-summary-prefix*
:*json-get-all-type-psis*
+ :*json-get-all-instance-psis*
:*json-get-topic-stub-prefix*
:*json-get-type-tmcl-prefix*
:*json-get-instance-tmcl-prefix*
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 Fri Jun 26 09:29:12 2009
@@ -14,6 +14,7 @@
(defparameter *json-get-all-psis* "/json/psis/?$") ;the url to get all topic psis of isidorus -> localhost:8000/json/psis
(defparameter *json-get-summary-url* "/json/summary/?$") ;the url to get a summary of all topic stored in isidorus; you have to set the GET-parameter "start" for the start index of all topics within elephant and the GET-paramter "end" for the last index of the topic sequence -> http://localhost:8000/json/summary/?start=12&end=13
(defparameter *json-get-all-type-psis* "/json/tmcl/types/?$") ;returns a list of all psis that can be a type
+(defparameter *json-get-all-instance-psis* "/json/tmcl/instances/?$") ;returns a list of all psis that belongs to a valid topic-instance
(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
@@ -29,6 +30,7 @@
(json-commit-url *json-commit-url*)
(json-get-summary-url *json-get-summary-url*)
(json-get-all-type-psis *json-get-all-type-psis*)
+ (json-get-all-instance-psis *json-get-all-instance-psis*)
(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*)
@@ -84,6 +86,9 @@
(create-regex-dispatcher json-get-all-type-psis #'return-all-tmcl-types)
hunchentoot:*dispatch-table*)
(push
+ (create-regex-dispatcher json-get-all-instance-psis #'return-all-tmcl-instances)
+ hunchentoot:*dispatch-table*)
+ (push
(create-regex-dispatcher json-get-type-tmcl-url #'(lambda(&optional param)
(declare (ignorable param))
(return-tmcl-info-of-psis 'json-tmcl::type)))
@@ -104,7 +109,7 @@
;; --- some handlers for the json-rest-interface -------------------------------
;; =============================================================================
(defun return-all-tmcl-types(&optional param)
- "Returns all topics that are valid types -> so they have to be valid to the
+ "Returns all topic-psi that are valid types -> so they have to be valid to the
topictype-constraint (if it exists) and the can't be abstract."
(declare (ignorable param))
(handler-case (let ((topic-types (json-tmcl::return-all-tmcl-types)))
@@ -118,6 +123,23 @@
(setf (hunchentoot:content-type*) "text")
(format nil "Condition: \"~a\"" err)))))
+(defun return-all-tmcl-instances(&optional param)
+ "Returns all topic-psis that are valid instances of any topic type.
+ The validity is only oriented on the typing of topics, e.g.
+ type-instance or supertype-subtype."
+ (declare (ignorable param))
+ (handler-case (let ((topic-instances (json-tmcl::return-all-tmcl-instances)))
+ (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+ (json:encode-json-to-string
+ (map 'list #'(lambda(y)
+ (map 'list #'uri y))
+ (map 'list #'psis topic-instances))))
+ (condition (err) (progn
+ (setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
+ (setf (hunchentoot:content-type*) "text")
+ (format nil "Condition: \"~a\"" err)))))
+
+
(defun return-topic-stub-of-psi(&optional psi)
"Returns a json string of a topic depending on the
passed psi as a topic-stub-construct."
1
0

25 Jun '09
Author: lgiessmann
Date: Thu Jun 25 15:07:40 2009
New Revision: 69
Log:
ajax-client: fixed a bug by creating an association from existing contents. The problem occurred if there were more than one association type available and the existing content is not of the first type in the list - so there were used the constraints of the first type and not of the used type
Modified:
trunk/src/ajax/javascripts/datamodel.js
trunk/src/unit_tests/poems.xtm
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Thu Jun 25 15:07:40 2009
@@ -3442,7 +3442,6 @@
if(!owner) throw "From NameC(): owner must be set but is null";
if(!owner.__frames__) owner.__frames__ = new Array();
owner.__frames__.push(this);
-
this.__frame__.writeAttribute({"class" : CLASSES.associationFrame()});
this.__table__ = new Element("table", {"class" : CLASSES.associationFrame()});
this.__frame__.insert({"top" : this.__table__});
@@ -3451,7 +3450,7 @@
this.__constraints__ = constraints;
this.__owner__ = owner;
this.__dblClickHandler__ = dblClickHandlerF;
-
+
try{
var itemIdentityContent = null;
var typeContent = null;
@@ -3472,7 +3471,7 @@
});
// --- type
- var types = makeTypes(this, typeContent, constraints);
+ var types = makeTypes(this, typeContent, constraints);
// --- scopes
var currentConstraint = this.getCurrentConstraint();
@@ -3480,11 +3479,14 @@
this.__table__.insert({"bottom" : newRow(CLASSES.scopeContainer(), "Scope", this.__scope__.getFrame())});
// --- roles
- var _roleConstraints = _playerConstraints = _otherRoleConstraints = null;
- if(this.__constraints__){
- _roleConstraints = this.__constraints__[0].associationRoleConstraints;
- _playerConstraints = this.__constraints__[0].rolePlayerConstraints;
- _otherRoleConstraints = this.__constraints__[0].otherRoleConstraints;
+ var _roleConstraints = null;
+ var _playerConstraints = null;
+ var _otherRoleConstraints = null;
+ var cc = this.getCurrentConstraint();
+ if(cc){
+ _roleConstraints = cc.associationRoleConstraints;
+ _playerConstraints = cc.rolePlayerConstraints;
+ _otherRoleConstraints = cc.otherRoleConstraints;
}
this.__roles__ = new RoleContainerC(rolesContent, _roleConstraints, _playerConstraints, _otherRoleConstraints, this);
@@ -3505,26 +3507,16 @@
}
},
"resetValues" : function(){
- // --- scope, depends only to the associationtype, roles can be ignored
- // --- finds the scopes depending to the selected type
- var foundIdx = -1;
- for(var i = 0; this.__constraints__ && i != this.__constraints__.length; ++i)
- {
- if(foundIdx !== -1) break;
- for(var j = 0; j != this.__constraints__[i].associationType.length; ++j){
- if(this.__type__.__frames__[0].getContent() === this.__constraints__[i].associationType[j]){
- foundIdx = i;
- break;
- }
- }
- }
- this.__scope__.resetValues(null, (foundIdx === -1 ? null : this.__constraints__[foundIdx].scopeConstraints));
+ var cc = this.getCurrentConstraint();
+ this.__scope__.resetValues(null, (cc ? cc.scopeConstraints : null));
- var _roleConstraints = _playerConstraints = _otherRoleConstraints = null;
- if(foundIdx !== -1){
- _roleConstraints = this.__constraints__[foundIdx].associationRoleConstraints;
- _playerConstraints = this.__constraints__[foundIdx].rolePlayerConstraints;
- _otherRoleConstraints = this.__constraints__[foundIdx].otherRoleConstraints;
+ var _roleConstraints = null;
+ var _playerConstraints = null;
+ var _otherRoleConstraints = null;
+ if(cc){
+ _roleConstraints = cc.associationRoleConstraints;
+ _playerConstraints = cc.rolePlayerConstraints;
+ _otherRoleConstraints = cc.otherRoleConstraints;
}
this.__roles__.resetValues(_roleConstraints, _playerConstraints, _otherRoleConstraints);
},
Modified: trunk/src/unit_tests/poems.xtm
==============================================================================
--- trunk/src/unit_tests/poems.xtm (original)
+++ trunk/src/unit_tests/poems.xtm Thu Jun 25 15:07:40 2009
@@ -1,5 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<tm:topicMap version="2.0" xmlns:tm="http://www.topicmaps.org/xtm/">
+ <!-- test: subtype for the roletype written -->
+ <tm:topic id="sub-written">
+ <tm:subjectIdentifier href="sub-written-psi"/>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#supertype-subtype"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#subtype"/></tm:type>
+ <tm:topicRef href="#sub-written"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#supertype"/></tm:type>
+ <tm:topicRef href="#written"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- end test -->
+
+
<!-- test: defines some scopes constraints for associations of the type "born-in" -->
<tm:topic id="scoped-born-in-constraint-1">
<tm:subjectIdentifier href="http://some.where/constraint-psis/scoped-born-in-constraint-1"/>
@@ -637,6 +657,7 @@
<!-- available scopes -->
<tm:topic id="de">
<tm:subjectIdentifier href="http://some.where/base-psis/de"/>
+ <tm:subjectIdentifier href="http://some.where/base-psis/ger"/>
<tm:instanceOf><tm:topicRef href="#scopetype"/></tm:instanceOf>
</tm:topic>
@@ -924,7 +945,7 @@
</tm:occurrence>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-max"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">2</tm:resourceData>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData>
</tm:occurrence>
<tm:occurrence>
<tm:type><tm:topicRef href="#regexp"/></tm:type>
@@ -2474,6 +2495,7 @@
</tm:topic>
<tm:association>
+ <tm:itemIdentity href="born-in-frankfurt-goethe"/>
<tm:type><tm:topicRef href="#born-in"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#place"/></tm:type>
@@ -2525,7 +2547,7 @@
</tm:name>
<tm:occurrence>
<tm:type><tm:topicRef href="#poem-content"/></tm:type> <!-- must have an occurrence of the type poem-content with the scope de or en -->
- <tm:scope><tm:topicRef href="#de"/></tm:scope>
+ <tm:scope><tm:topicRef href="#en"/></tm:scope>
<tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">Hat der alte Hexenmeister
sich doch einmal wegbegeben!
Und nun sollen seine Geister
@@ -2693,7 +2715,9 @@
</tm:topic>
<tm:association>
+ <tm:itemIdentity href="wirtten-by-zauberlehrling-goethe"/>
<tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
<tm:role>
<tm:type><tm:topicRef href="#writer"/></tm:type>
<tm:topicRef href="#goethe"/>
@@ -2705,7 +2729,9 @@
</tm:association>
<tm:association>
+ <tm:itemIdentity href="wirtten-by-erlkoenig-goethe"/>
<tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
<tm:role>
<tm:type><tm:topicRef href="#writer"/></tm:type>
<tm:topicRef href="#goethe"/>
@@ -2849,12 +2875,16 @@
</tm:topic>
<tm:association>
- <tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:itemIdentity href="written-by-association-shiller-resignation"/>
+ <tm:type><tm:topicRef href="#place"/></tm:type>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
<tm:role>
+ <tm:itemIdentity href="writer-role-schiller"/>
<tm:type><tm:topicRef href="#writer"/></tm:type>
<tm:topicRef href="#schiller"/>
</tm:role>
<tm:role>
+ <tm:itemIdentity href="written-role-resignation"/>
<tm:type><tm:topicRef href="#written"/></tm:type>
<tm:topicRef href="#resignation"/>
</tm:role>
@@ -2889,6 +2919,7 @@
<tm:association>
<tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
<tm:role>
<tm:type><tm:topicRef href="#writer"/></tm:type>
<tm:topicRef href="#eichendorff"/>
1
0

[isidorus-cvs] r68 - in trunk/src: ajax/javascripts json rest_interface
by Lukas Giessmann 25 Jun '09
by Lukas Giessmann 25 Jun '09
25 Jun '09
Author: lgiessmann
Date: Thu Jun 25 14:16:30 2009
New Revision: 68
Log:
ajax-client: fixed a general bug with optional occurrences, currently they are not disabled or minimized, when they own any content; fixed a bug with opera and textarea-values, currently there is used the method setValue instead of using update(<value>) - so in the browsers firefox, opera, safari there are no problems - therefore IE makes a lot of trouble\!
Modified:
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/json/json_tmcl_validation.lisp
trunk/src/rest_interface/set-up-json-interface.lisp
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Thu Jun 25 14:16:30 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://localhost:8000/";
+var HOST_PREF = "192.168.178.21/"; //"http://localhost:8000/";
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/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Thu Jun 25 14:16:30 2009
@@ -1913,9 +1913,11 @@
var _content = null;
if(_contents && _contents.length > k) _content = _contents[k];
var occurrence = new OccurrenceC(_content, constraints[i].occurrenceTypes, constraints[i].constraints[j], constraints[i].uniqueConstraints, this.__containers__[i][j], min === 0 ? 1 : min, max === MMAX_INT ? -1 : max, title, dblClickHandler);
- if(min === 0) occurrence.disable();
+ if(min === 0 && !_content){
+ occurrence.disable();
+ occurrence.minimize();
+ }
this.__error__.insert({"before" : occurrence.getFrame()});
- if(min === 0)occurrence.minimize();
}
}
}
@@ -2199,11 +2201,19 @@
else {
this.__topicid__.__frames__[0].hideError();
}
+ if(this.__subjectIdentifier__.getContent().length === 0){
+ ret = false;
+ this.showError("The topic must contain at least one SubjectIdentifier!<br/>If it is not possible to insert one - please create a subjectidentifier-constraint for this topic (-type)!");
+ }
+ else if(ret === true){
+ this.hideError();
+ }
if(this.__subjectLocator__.isValid() === false) ret = false;
if(this.__subjectIdentifier__.isValid() === false) ret = false;
if(this.__name__.isValid() === false) ret = false;
if(this.__occurrence__.isValid() === false) ret = false;
+
return ret;
},
"getReferencedTopics" : function(){
@@ -2488,8 +2498,8 @@
var RoleContainerC = Class.create(ContainerC, {"initialize" : function($super, contents, associationRoleConstraints, rolePlayerConstraints, otherRoleConstraints, parent){
$super();
this.__frame__.writeAttribute({"class" : CLASSES.roleContainer()});
- this.__arContainer__ = new Object();
- this.__orContainer__ = new Object();
+ this.__arContainer__ = new Object(); this.__arContainer__.__frames__ = new Array();
+ this.__orContainer__ = new Object(); this.__orContainer__.__frames__ = new Array();
this.__associationRoleConstraints__ = associationRoleConstraints;
this.__otherRoleConstraints__ = otherRoleConstraints;
this.__rolePlayerConstraints__ = rolePlayerConstraints;
@@ -2567,7 +2577,7 @@
return {"usedContents" : usedContents, "contents" : contents, "alreadyUsedRoles" : alreadyUsedRoles};
},
"__createAdditionalRolesFromContents__" : function(contents,usedContents, alreadyUsedRoles, isARC){
- var roleContainer = this.__orContainer__.__frames__;
+ var roleContainer = this.__orContainer__.__frames__;
if(isARC === true) roleContainer = this.__arContainer__.__frames__;
if(roleContainer && roleContainer.length !== 0){
@@ -3972,8 +3982,7 @@
this.__datatype__.__frames__[0].remove();
this.__datatype__ = new Object();
}catch(err){}
-
- myself.__value__ = new Element("textarea", {"rows" : 3}).update(value);
+ myself.__value__ = new Element("textarea", {"rows" : 3}).setValue(value);
myself.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Resource Value", myself.__value__)});
if(cssTitle && cssTitle.length !== 0) myself.__value__.writeAttribute({"title" : cssTitle});
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Thu Jun 25 14:16:30 2009
@@ -121,7 +121,7 @@
(not akos-are-topictype)
topictype-constraint)
;(return-from topictype-p nil))
- (error "~a is not a valid -- type for ~a" (uri (first (psis topic-instance))) (uri (first (psis topictype)))))
+ (error "~a is not a valid type for ~a" (uri (first (psis topic-instance))) (uri (first (psis topictype)))))
(loop for isa-of-this in isas-of-this
when (and (not (find isa-of-this current-checked-topics :test #'eq))
@@ -269,4 +269,26 @@
(topictype-of-p x nil)
x)
(condition () nil)))
- all-subtypes-of-all-instances)))))))
\ No newline at end of file
+ all-subtypes-of-all-instances)))))))
+
+
+(defun return-all-tmcl-types ()
+ "Returns all topics that are valid tmcl-types"
+ (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*)))
+ (let ((all-types
+ (remove-if #'null
+ (map 'list #'(lambda(x)
+ (handler-case (progn
+ (json-tmcl::topictype-p x topictype topictype-constraint)
+ x)
+ (condition () nil))) all-topics))))
+ (let ((not-abstract-types
+ (remove-if #'null
+ (map 'list #'(lambda(x)
+ (unless (json-tmcl:abstract-p x)
+ x))
+ all-types))))
+ not-abstract-types))))
\ No newline at end of file
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 Thu Jun 25 14:16:30 2009
@@ -107,28 +107,12 @@
"Returns all topics that are valid types -> so they have to be valid to the
topictype-constraint (if it exists) and the can't be abstract."
(declare (ignorable param))
- (handler-case (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*)))
- (let ((all-types
- (remove-if #'null
- (map 'list #'(lambda(x)
- (handler-case (progn
- (json-tmcl::topictype-p x topictype topictype-constraint)
- x)
- (condition () nil))) all-topics))))
- (let ((not-abstract-types
- (remove-if #'null
- (map 'list #'(lambda(x)
- (unless (json-tmcl:abstract-p x)
- x))
- all-types))))
- (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
- (json:encode-json-to-string
- (map 'list #'(lambda(y)
- (map 'list #'uri y))
- (map 'list #'psis not-abstract-types))))))
+ (handler-case (let ((topic-types (json-tmcl::return-all-tmcl-types)))
+ (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+ (json:encode-json-to-string
+ (map 'list #'(lambda(y)
+ (map 'list #'uri y))
+ (map 'list #'psis topic-types))))
(condition (err) (progn
(setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
(setf (hunchentoot:content-type*) "text")
1
0
Author: lgiessmann
Date: Thu Jun 25 08:58:36 2009
New Revision: 67
Log:
ajax-client: fixed a bug by committing edited fragments - so finally there are used the "real" instanceOf-elements and not the topic itself\!
Modified:
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/json/json_tmcl_validation.lisp
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Thu Jun 25 08:58:36 2009
@@ -70,6 +70,10 @@
for(var i = 0; psis && i !== psis.length; ++i){
instanceOfs.push(new Array(psis[i]));
}
+ if(contents) {
+ if(topicContent) instanceOfs = topicContent.instanceOfs;
+ else instanceOfs = new Array();
+ }
var topic = new TopicC(topicContent, (constraints ? constraints.topicConstraints : null), instanceOfs);
var liT = new Element("li", {"class" : CLASSES.topicFrame()}).update(topic.getFrame());
context.insert({"after" : liT});
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Thu Jun 25 08:58:36 2009
@@ -3465,7 +3465,8 @@
var types = makeTypes(this, typeContent, constraints);
// --- scopes
- this.__scope__ = new ScopeContainerC(scopesContent, this.__constraints__ && this.__constraints__[0].scopeConstraints ? this.__constraints__[0].scopeConstraints : null);
+ var currentConstraint = this.getCurrentConstraint();
+ this.__scope__ = new ScopeContainerC(scopesContent, currentConstraint && currentConstraint.scopeConstraints ? currentConstraint.scopeConstraints : null);
this.__table__.insert({"bottom" : newRow(CLASSES.scopeContainer(), "Scope", this.__scope__.getFrame())});
// --- roles
@@ -3532,7 +3533,29 @@
",\"scopes\":" + this.__scope__.toJSON() +
",\"roles\":" + this.__roles__.toJSON() + "}";
},
+ "getCurrentConstraint" : function(){
+ if(!this.__constraints__ || this.__constraints__.length === 0) return null;
+ var currentConstraint = null;
+ for(var i = 0; i !== this.__constraints__.length; ++i){
+ var aType = this.__constraints__[i].associationType;
+ aType = aType.flatten();
+ if(aType.indexOf(this.__type__.__frames__[0].getContent()) !== -1){
+ currentConstraint = this.__constraints__[i];
+ break;
+ }
+ }
+
+ return currentConstraint;
+ },
"isValid" : function(){
+ if(!this.getCurrentConstraint()){
+ this.showError("No constraints found for this association!");
+ return false;
+ }
+ else {
+ this.hideError();
+ }
+
return this.__roles__.isValid() && this.__scope__.isValid();
},
"disable" : function(){
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Thu Jun 25 08:58:36 2009
@@ -121,7 +121,7 @@
(not akos-are-topictype)
topictype-constraint)
;(return-from topictype-p nil))
- (error "~a is not a valid type for ~a" (uri (first (psis topic-instance))) (uri (first (psis topictype)))))
+ (error "~a is not a valid -- type for ~a" (uri (first (psis topic-instance))) (uri (first (psis topictype)))))
(loop for isa-of-this in isas-of-this
when (and (not (find isa-of-this current-checked-topics :test #'eq))
1
0
Author: lgiessmann
Date: Thu Jun 25 06:49:59 2009
New Revision: 66
Log:
ajax-client: fixed some bugs which occurs by validating scopes; now it is also possible to edit fragments (but not the instanceOf-element) and commit them if they are valid;
Modified:
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Thu Jun 25 06:49:59 2009
@@ -89,6 +89,14 @@
var tmId = new TmIdC(tmContent);
var liTm = new Element("li", {"class" : CLASSES.tmIdFrame()}).update(tmId.getFrame());
liA.insert({"after" : liTm});
+
+ // --- validates the data if there is any content
+ if(contents){
+ topic.isValid();
+ if(associations) associations.isValid();
+ tmId.isValid();
+ }
+
var commitButton = new Element("input", {"type" : "button", "value" : "commit fragment"})
commitButton.observe("click", function(event){
// --- validates the given data
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Thu Jun 25 06:49:59 2009
@@ -3294,9 +3294,6 @@
}
this.__disable__ = false;
},
- "scopeIsValid" : function(){
- return this.__scope__.isValid();
- },
"isValid" : function(){
var ret = true;
var errorStr = "";
@@ -3423,10 +3420,9 @@
}
}
- var scopeValid = this.scopeIsValid();
if(ret === false) this.showError(errorStr);
else this.hideError();
- return ret && scopeIsValid;
+ return ret;
}});
@@ -3537,7 +3533,7 @@
",\"roles\":" + this.__roles__.toJSON() + "}";
},
"isValid" : function(){
- return this.__roles__.isValid();
+ return this.__roles__.isValid() && this.__scope__.isValid();
},
"disable" : function(){
this.hideError();
1
0
Author: lgiessmann
Date: Thu Jun 25 06:23:01 2009
New Revision: 65
Log:
ajax-client: fixed a bug that occurs if an existing association(-type) doesn't match any constraint
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 Thu Jun 25 06:23:01 2009
@@ -2743,7 +2743,6 @@
this.__error__.insert({"before" : role.getFrame()})
}
role.hideAddButton();
-
}
},
"__createFromContent__" : function(contents){
@@ -4096,6 +4095,7 @@
function makeTypes(myself, typeContent, xtypescopes)
{
var types = new Array();
+ var matched = false;
for(var i = 0; xtypescopes && i !== xtypescopes.length; ++i){
var xtype = xtypescopes[i].nameType;
if(!xtype) xtype = xtypescopes[i].occurrenceType;
@@ -4104,11 +4104,14 @@
types.push(xtype[j]);
if(typeContent && typeContent[0] === xtype[j]){
var selected = xtype[j];
+ matched = true;
if(types.length !== 0) types[types.length - 1] = types[0];
types[0] = selected;
}
}
}
+ if(matched === false && typeContent && typeContent.length !== 0) types.unshift(typeContent);
+
if(types.length === 0 && typeContent && typeContent.length !== 0) types = typeContent;
if(!types || types.length === 0) types = new Array("");
myself.__type__ = new Object();
1
0