Author: lgiessmann Date: Sat Jul 4 10:36:21 2009 New Revision: 86
Log: ajax-client: fixed a problem that occurred with firefox after committing an edit or created fragment by changing the occurrent-type, so the datatyp does'nt changed to the corresponding occurrent-type
Modified: trunk/src/ajax/javascripts/constants.js trunk/src/ajax/javascripts/datamodel.js
Modified: trunk/src/ajax/javascripts/constants.js ============================================================================== --- trunk/src/ajax/javascripts/constants.js (original) +++ trunk/src/ajax/javascripts/constants.js Sat Jul 4 10:36:21 2009 @@ -11,7 +11,7 @@
// --- Some constants fot the http connections via the XMLHttpRequest-Object -var HOST_PREF = /*"http://143.93.190.237:8000/%22;*/ "http://localhost:8000/"; // of the form "http://(.+)/" +var HOST_PREF = "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/";
Modified: trunk/src/ajax/javascripts/datamodel.js ============================================================================== --- trunk/src/ajax/javascripts/datamodel.js (original) +++ trunk/src/ajax/javascripts/datamodel.js Sat Jul 4 10:36:21 2009 @@ -1816,7 +1816,17 @@ 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" : 70}); + + var dataType = null; + if(types && types.length !== 0){ + for(var i = 0; occurrenceTypes && i !== occurrenceTypes.length; ++i){ + if(occurrenceTypes[i].occurrenceType.indexOf(types[0]) !== -1){ + dataType = occurrenceTypes[i].datatypeConstraint; + break; + } + } + } + makeResource(this, contents, constraint, dataType, cssTitle, {"rows" : 5, "cols" : 70});
this.getFrame().observe("dblclick", function(event){ dblClickHandler(owner, event); @@ -4056,7 +4066,8 @@ } if(foundIdx !== -1 && constraints[foundIdx].datatypeConstraint){ var dc = constraints[foundIdx].datatypeConstraint; - myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"readonly" : "readonly", "value" : dc}); + myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"readonly" : "readonly"}); + myself.__datatype__.__frames__[0].getFrame().select("input")[0].setValue(dc); } else { myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"value" : ""});