[isidorus-cvs] r67 - in trunk/src: ajax/javascripts json

Lukas Giessmann lgiessmann at common-lisp.net
Thu Jun 25 12:58:44 UTC 2009


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))




More information about the Isidorus-cvs mailing list