Changeset 44
- Timestamp:
- 06/16/09 12:17:10 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/ajax/javascripts/create.js ¶
r43 r44 37 37 } 38 38 39 items = $$("li." + CLASSES.tmIdFrame()); 40 for(var i = 0; i !== items.length; ++i){ 41 items[i].remove(); 42 } 43 39 44 items = $$("li." + CLASSES.commitButton()); 40 45 for(var i = 0; i !== items.length; ++i){ … … 50 55 context.insert({"after" : liT}); 51 56 52 addTopicAsPlayer((constraints ? constraints.associationsConstraints : null), topic.getContent().instanceOfs); 53 var associations = new AssociationContainerC(null, (constraints ? constraints.associationsConstraints : null)); 54 var liA = new Element("li", {"class" : CLASSES.associationContainer()}).update(associations.getFrame()); 55 liT.insert({"after" : liA}); 57 var liA = null; 58 var associations = null; 59 if(constraints && constraints.associationsConstraints && constraints.associationsConstraints.length !== 0){ 60 addTopicAsPlayer((constraints ? constraints.associationsConstraints : null), topic.getContent().instanceOfs); 61 associations = new AssociationContainerC(null, (constraints ? constraints.associationsConstraints : null)); 62 liA = new Element("li", {"class" : CLASSES.associationContainer()}).update(associations.getFrame()); 63 liT.insert({"after" : liA}); 64 } 65 else { 66 liA = liT; 67 } 56 68 57 69 var tmId = new tmIdC(null); … … 61 73 var commitButton = new Element("input", {"type" : "button", "value" : "commit fragment", "style" : "float: right; margin-top: -10px;"}) 62 74 commitButton.observe("click", function(event){ 63 try{64 75 var tPsis = topic.getContent().subjectIdentifiers; 65 var referencedTopics = topic.getReferencedTopics().concat(associations.getReferencedTopics()).without(CURRENT_TOPIC).uniq(); 66 76 var referencedTopics = topic.getReferencedTopics(); 77 if(associations){ 78 referencedTopics = referencedTopics.concat(associations.getReferencedTopics()).without(CURRENT_TOPIC).uniq(); 79 } 80 67 81 function onSuccessHandler(topicStubs){ 68 82 var tsStr = "null"; … … 77 91 var jTopic = "\"topic\":" + topic.toJSON(); 78 92 var jTopicStubs = "\"topicStubs\":" + tsStr; 79 var jAssociations = "\"associations\":" + associations.toJSON().gsub(CURRENT_TOPIC_ESCAPED, tPsis)93 var jAssociations = "\"associations\":" + (associations ? associations.toJSON().gsub(CURRENT_TOPIC_ESCAPED, tPsis) : "null"); 80 94 var jTmId = "\"tmIds\":" + tmId.toJSON(); 81 95 var json = "{" + jTopic + "," + jTopicStubs + "," + jAssociations + "," + jTmId + "}"; 82 alert(json);96 commitFragment(json, function(xhr){ alert("The fragment was committed succesfully!"); }, null); 83 97 } 84 98 85 99 function onErrorHandler(){ 86 // --- currently there is not neede a special handling for errors100 // --- currently there is not needed a special handling for errors 87 101 // --- occurred during this operation 88 102 } 89 103 90 104 getTopicStubs(referencedTopics, onSuccessHandler, onErrorHandler); 91 }catch(err){ alert("test: " + err); }92 105 }); 93 106 var liCB = new Element("li", {"class" : CLASSES.commitButton()}); -
TabularUnified trunk/src/ajax/javascripts/datamodel.js ¶
r43 r44 651 651 return new Array(); 652 652 } 653 654 for(var i = 0; i !== values.length; ++i) 655 values[i] = new Array(values[i]); 653 656 return values; 654 657 }, … … 1487 1490 if(scopes){ 1488 1491 for(var j = 0; j !== scopes.length; ++j){ 1489 if(referencedTopics.indexOf(scopes[j] ) === -1) referencedTopics.push(scopes[j]);1492 if(referencedTopics.indexOf(scopes[j][0]) === -1) referencedTopics.push(scopes[j][0]); 1490 1493 } 1491 1494 } … … 1503 1506 if(scopes){ 1504 1507 for(var j = 0; j !== scopes.length; ++j){ 1505 if(referencedTopics.indexOf(scopes[j] ) === -1) referencedTopics.push(scopes[j]);1508 if(referencedTopics.indexOf(scopes[j][0]) === -1) referencedTopics.push(scopes[j][0]); 1506 1509 } 1507 1510 } … … 2462 2465 if(scopes){ 2463 2466 for(var j = 0; j !== scopes.length; ++j){ 2464 if(referencedTopics.indexOf(scopes[j] ) === -1) referencedTopics.push(scopes[j]);2467 if(referencedTopics.indexOf(scopes[j][0]) === -1) referencedTopics.push(scopes[j][0]); 2465 2468 } 2466 2469 } -
TabularUnified trunk/src/ajax/javascripts/requests.js ¶
r42 r44 90 90 var delta = 100; 91 91 neededTime += delta; 92 if(delta > maxTimeout ){92 if(delta > maxTimeout && psis && psis.length !== 0){ 93 93 alert("From getTopicStubs(): Please check your network-connection - the request timed out!!!"); 94 94 onFailureHandler(); … … 107 107 } 108 108 } 109 110 111 function commitFragment(json, onSuccessHandler, onFailureHandler) 112 { 113 if(!json || !onSuccessHandler) throw "From commitFragment(): json and onSuccessHandler must be set!"; 114 try{ 115 var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler; 116 117 new Ajax.Request(COMMIT_URL, { 118 "method" : "post", 119 "postBody" : json, 120 "onSuccess" : onSuccessHandler, 121 "onFailure" : onFailure}); 122 } 123 catch(err){ 124 alert("From commitFragment(): " + err); 125 } 126 } -
TabularUnified trunk/src/json/json_importer.lisp ¶
r26 r44 392 392 (error "json-importer:get-topicStub-values-from-json-string: 393 393 bad item-specifier found in json-list")))) 394 (unless (or itemIdentities subjectLocators subjectIdentifiers) 395 (error "json-importer:get-topicStub-values-from-json-string: one of the elements 396 itemIdentity, sbjectLocator or subjectIdentifier must be set")) 394 (unless subjectIdentifiers 395 (error "json-importer:get-topicStub-values-from-json-string: the element subjectIdentifiers mus be set!")) 397 396 (unless id 398 397 (error "json-importer:get-topic-valuesStub-from-json-string: the element id must be set")) … … 434 433 (error "json-importer:get-topic-values-from-json-string: 435 434 bad item-specifier found in json-list ~a" (car j-elem))))) 436 (unless (or itemIdentities subjectLocators subjectIdentifiers) 437 (error "json-importer:get-topic-values-from-json-string: one of the elements 438 itemIdentity, sbjectLocator or subjectIdentifier must be set")) 435 (unless subjectIdentifiers 436 (error "json-importer:get-topic-values-from-json-string: the element subjectIdentifiers must be set!")) 439 437 (unless id 440 438 (error "json-importer:get-topic-values-from-json-string: the element id must be set"))
Note: See TracChangeset
for help on using the changeset viewer.