getXMLPart: function(elem, callback)
{
- var path = elem.attr('wl2o:path');
+ var path = elem.attr('x-pointer');
if(!this.xmlParts[path])
this.loadXMLPart(elem, callback);
else
loadXMLPart: function(elem, callback)
{
- var path = elem.attr('wl2o:path');
+ var path = elem.attr('x-pointer');
var self = this;
$.ajax({
data: {
revision: this.get('revision'),
user: this.document.get('user'),
- chunk: path,
- format: 'nl'
+ chunk: path
+ // format: 'nl'
},
success: function(data) {
self.xmlParts[path] = data;
});
},
- putXMLPart: function(elem, data) {
+ putXMLPart: function(elem, data, callback) {
var self = this;
- var path = elem.attr('wl2o:path');
+ var path = elem.attr('x-pointer');
this.xmlParts[path] = data;
- this.set('state', 'unsynced');
+ this.set('state', 'dirty');
/* re-render the changed fragment */
$.ajax({
dataType: 'text; charset=utf-8',
data: {
fragment: data,
- chunk: path,
- format: 'nl'
+ chunk: path
+ // format: 'nl'
},
success: function(htmldata) {
- elem.replaceWith(htmldata);
+ callback(elem, htmldata);
self.set('state', 'dirty');
}
});
revision: this.get('revision'),
user: this.get('user')
},
- complete: this.updateCompleted.bind(this),
+ complete: this.updateCompleted.bind(this)
});
},
mergeCompleted: function(xhr, textStatus) {
console.log(xhr.status, xhr.responseText);
var response = parseXHRResponse(xhr);
- if(response.success)
- {
- if( (response.data.result == 'no-op')
- || (response.data.shared_timestamp == response.data.shared_parent_timestamp))
+
+ if(response.success) {
+
+ if( (response.data.result == 'no-op') ||
+ ( response.data.shared_parent_timestamp
+ && response.data.shared_timestamp
+ && (response.data.shared_timestamp == response.data.shared_parent_timestamp)) )
{
if( (response.data.revision) && (response.data.revision != this.get('revision')) )
{