Commit e2cc260a authored by Tristan Cavelier's avatar Tristan Cavelier

Improve OfficeJS, SlickGrid, Basic Conflict Manager

SlickGrid can now show documents that are in conflict or not,
and Basic Conflict Manager shows the last modify date of revisions.
parent 25b9ca5f
......@@ -17,23 +17,25 @@
window.basic_conflict_solver = {
conflict_object:{},
addRevision: function (revision,content) {
addRevision: function (doc) {
document.querySelector ('#basic_conflict_solver_div #revisions').
innerHTML += '<div class="row-fluid"><div class="span12">'+
'<div><textarea id="'+revision+'">'+content+'</textarea></div>'+
'<div>'+(new Date(doc.last_modified)).toString()+'</div>'+
'<div><textarea id="'+doc.revision+'">'+doc.content+'</textarea></div>'+
'<div><button onclick="'+
//'console.log('+"'"+revision+"'"+');'+
"basic_conflict_solver.keepRevision('"+revision+"');"+
"basic_conflict_solver.keepRevision('"+doc.revision+"');"+
'">Save this one</button></div><hr/>'+
'</div></div>';
},
addRemovedRevision: function (revision) {
addRemovedRevision: function (doc) {
document.querySelector ('#basic_conflict_solver_div #revisions').
innerHTML += '<div class="row-fluid"><div class="span12">'+
'<div>'+(new Date(doc.last_modified)).toString()+'</div>'+
'<div>Removed</div>'+
'<div><button onclick="'+
//'console.log('+"'"+revision+"'"+');'+
"basic_conflict_solver.keepRevision('"+revision+"');"+
"basic_conflict_solver.keepRevision('"+doc.revision+"');"+
'">Save this one</button></div><hr/>'+
'</div></div>';
},
......
......@@ -82,6 +82,8 @@ window.OfficeJS_slickgrid.reload = function () {
array[i].icon = mime.icon;
array[i].app = mime.preferred_application || mime.application;
}
array[i].conflict = array[i].revision_object[
array[i].revision].conflict?'X':'';
// dates
// FIXME : we can have 2012/1/1 12:5
// we should have 2012/01/01 12:05
......@@ -111,6 +113,9 @@ window.OfficeJS_slickgrid.reload = function () {
field:"last_modified",sortable:true});
columns.push({id:"creation_date",name:"Created",
field:"creation_date",sortable:true});
columns.push({id:'on_conflict',name:'',
field:'conflict',sortable:true,
resizable:false,width:24});
grid = new Slick.Grid("#myDocumentList",
document_list,
......
......@@ -228,21 +228,33 @@
revision: rev,
max_retry:3,
success: function (result) {
var doc = {
path:param.conflict_object.path,
content:result.content,
last_modified:result.last_modified,
creation_date:result.creation_date,
revision:rev
};
window.basic_conflict_solver.
conflict_object =
param.conflict_object;
window.basic_conflict_solver.
addRevision(
rev,result.content);
addRevision(doc);
load(rev_list[i],i);
},
error: function (error) {
var doc = {
path:param.conflict_object.path,
last_modified:result.last_modified,
creation_date:result.creation_date,
revision:rev
};
window.basic_conflict_solver.
conflict_object =
param.conflict_object;
if (error.status === 404) {
window.basic_conflict_solver.
addRemovedRevision(rev);
addRemovedRevision(doc);
} else {
console.error (error.message);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment