Author: lgiessmann Date: Sun Jul 17 13:50:32 2011 New Revision: 636
Log: trunk: fixed ticket #117 => the topic id is set in the background with a UUID if a new topic is created, otherwise the existent topic id is used
Modified: trunk/src/ajax/javascripts/datamodel.js
Modified: trunk/src/ajax/javascripts/datamodel.js ============================================================================== --- trunk/src/ajax/javascripts/datamodel.js Sun Jul 17 09:04:35 2011 (r635) +++ trunk/src/ajax/javascripts/datamodel.js Sun Jul 17 13:50:32 2011 (r636) @@ -2218,19 +2218,21 @@ this.__instanceOfs__ = (!instanceOfs || instanceOfs.length === 0 ? null : instanceOfs);
try{ - var topicidContent = null; + //var topicidContent = null; var itemIdentityContent = null; var subjectLocatorContent = null; var subjectIdentifierContent = null; var namesContent = null; var occurrencesContent = null; if(content){ - topicidContent = content.id + this.__topicidContent__ = content.id itemIdentityContent = content.itemIdentities subjectLocatorContent = content.subjectLocators; subjectIdentifierContent = content.subjectIdentifiers; namesContent = content.names; occurrencesContent = content.occurrences; + }else{ + this.__topicidContent__ = new UUID().toString(); } this.__frame__ .writeAttribute({"class" : CLASSES.topicFrame()}); this.__table__ = new Element("table", {"class" : CLASSES.topicFrame()}); @@ -2246,9 +2248,9 @@ setMinimizeHandler(this); // --- topic id - this.__topicid__ = new Object(); - new TextrowC(topicidContent, ".*", this.__topicid__, 1, 1, null); - this.__table__.insert({"bottom" : newRow(CLASSES.topicIdFrame(), "Topic ID", this.__topicid__.__frames__[0].getFrame())}); + //this.__topicid__ = new Object(); + //new TextrowC(topicidContent, ".*", this.__topicid__, 1, 1, null); + //this.__table__.insert({"bottom" : newRow(CLASSES.topicIdFrame(), "Topic ID", this.__topicid__.__frames__[0].getFrame())}); // --- itemIdentity this.__itemIdentity__ = new ItemIdentityC(itemIdentityContent, this); @@ -2286,7 +2288,7 @@ }, "getContent" : function(){ try{ - return {"id" : this.__topicid__.__frames__[0].getContent().strip(), + return {"id" : this.__topicidContent__, "itemIdentities" : this.__itemIdentity__.getContent(true, true), "subjectLocators" : this.__subjectLocator__.getContent(true, true), "subjectIdentifiers" : this.__subjectIdentifier__.getContent(true, true), @@ -2300,7 +2302,7 @@ }, "toJSON" : function(){ try{ - return "{"id":" + this.__topicid__.__frames__[0].getContent().strip().toJSON() + + return "{"id":" + this.__topicidContent__.toJSON() + ","itemIdentities":" + this.__itemIdentity__.toJSON(true, true) + ","subjectLocators":" + this.__subjectLocator__.toJSON(true, true) + ","subjectIdentifiers":" + this.__subjectIdentifier__.toJSON(true, true) + @@ -2314,7 +2316,7 @@ }, "minimize" : function(){ var rows = new Array(); - rows.push(this.getFrame().select("tr." + CLASSES.topicIdFrame())[0], + rows.push(//this.getFrame().select("tr." + CLASSES.topicIdFrame())[0], this.getFrame().select("tr." + CLASSES.itemIdentityFrame())[0], this.getFrame().select("tr." + CLASSES.subjectLocatorFrame())[0], this.getFrame().select("tr." + CLASSES.subjectIdentifierFrame())[0], @@ -2334,13 +2336,13 @@ }, "isValid" : function(){ var ret = true; - if(this.__topicid__.__frames__[0].getContent().strip().length === 0){ - ret = false; - this.__topicid__.__frames__[0].showError("The topic must contain a topic ID!"); - } - else { - this.__topicid__.__frames__[0].hideError(); - } + //if(this.__topicid__.__frames__[0].getContent().strip().length === 0){ + // ret = false; + // this.__topicid__.__frames__[0].showError("The topic must contain a topic ID!"); + //} + //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)!");