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

Lukas Giessmann lgiessmann at common-lisp.net
Wed Jul 1 07:32:59 UTC 2009


Author: lgiessmann
Date: Wed Jul  1 03:32:59 2009
New Revision: 83

Log:
ajax-client: fixed a bug which occured by editing existing topics with more than one PSI - if you selected the placeholder "**current-topic**" the PSIs were transformed to JSON as one long string and not as an array

Modified:
   trunk/src/ajax/javascripts/create.js
   trunk/src/json/json_importer.lisp

Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js	(original)
+++ trunk/src/ajax/javascripts/create.js	Wed Jul  1 03:32:59 2009
@@ -133,6 +133,8 @@
 	
 	// --- if the validation succeeded the fragment will be sent to the server
 	var tPsis = topic.getContent().subjectIdentifiers;
+	if(!tPsis || tPsis.length === 0) tPsis = "null";
+	else tPsis = tPsis.toJSON()
 	var referencedTopics = topic.getReferencedTopics();
 	if(associations){
 	    referencedTopics = referencedTopics.concat(associations.getReferencedTopics()).without(CURRENT_TOPIC).uniq();
@@ -149,7 +151,7 @@
 	    }
 	    var jTopic = "\"topic\":" + topic.toJSON();
 	    var jTopicStubs = "\"topicStubs\":" + tsStr;
-	    var jAssociations = "\"associations\":" + (associations ? associations.toJSON().gsub(CURRENT_TOPIC_ESCAPED, tPsis) : "null");
+	    var jAssociations = "\"associations\":" + (associations ? associations.toJSON().gsub("\\[\"" + CURRENT_TOPIC_ESCAPED + "\"\\]", tPsis) : "null");
 	    var jTmId = "\"tmIds\":" + tmId.toJSON();
 	    var json = "{" + jTopic + "," + jTopicStubs + "," + jAssociations + "," + jTmId + "}";
 	    commitFragment(json, function(xhr){ alert("The fragment was committed succesfully!"); }, null);

Modified: trunk/src/json/json_importer.lisp
==============================================================================
--- trunk/src/json/json_importer.lisp	(original)
+++ trunk/src/json/json_importer.lisp	Wed Jul  1 03:32:59 2009
@@ -217,6 +217,7 @@
 			   'd:PersistentIdC 'd:uri uri)
 		     return (elephant:get-instance-by-value
 			     'd:PersistentIdC 'd:uri uri))))
+	         (format t "psi: ~a~%" psi)
 	     (when psi
 	       (d:identified-construct psi)))))
       (unless top




More information about the Isidorus-cvs mailing list