Commit f9a6cdad authored by Frank Bergmann's avatar Frank Bergmann

- New tasks now start and end at the same day,

  but at 00:00 and 23:59 respectively
- New tasks now by default take 8 hours to complete
parent c8d613d6
......@@ -58,16 +58,16 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
// Listen to any changes in store records
me.taskTreeStore.on({'update': me.onTaskTreeStoreUpdate, 'scope': this});
// write_project_p is a global variable defined in gantt-editor.adp
// write_project_p is a global variable defined in gantt-editor.adp
var buttonSave = Ext.getCmp('buttonSave');
var buttonLock = Ext.getCmp('buttonLock');
if (1 == write_project_p) {
buttonSave.show();
buttonLock.hide();
} else {
buttonSave.hide();
buttonLock.show();
}
if (1 == write_project_p) {
buttonSave.show();
buttonLock.hide();
} else {
buttonSave.hide();
buttonLock.show();
}
return this;
},
......@@ -108,12 +108,12 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
var me = this;
if (me.debug) console.log('GanttButtonController.ButtonSave');
me.taskTreeStore.save({
failure: function(batch, context) {
var msg = batch.proxy.reader.jsonData.message;
if (!msg) msg = 'undefined error';
PO.Utilities.reportError('Server error while saving', msg);
}
});
failure: function(batch, context) {
var msg = batch.proxy.reader.jsonData.message;
if (!msg) msg = 'undefined error';
PO.Utilities.reportError("onButtonSave", 'Server error while saving: '+msg);
}
});
// Now block the "Save" button, unless some data are changed.
var buttonSave = Ext.getCmp('buttonSave');
buttonSave.setDisabled(true);
......@@ -127,31 +127,31 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
var me = this;
if (me.debug) console.log('GanttButtonController.onTaskTreeStoreUpdate');
// Check if read-only and abort in this case
var readOnly = me.senchaPreferenceStore.getPreferenceBoolean('read_only',true);
if (readOnly) {
var cnt = 0;
for (var idx in affectedColumns) {
var col = affectedColumns[idx];
console.log('GanttButtonController.onTaskTreeStoreUpdate: col='+col);
switch (col) {
case "expanded": break;
case "collapsed": break;
default: cnt++;
}
};
// Check if read-only and abort in this case
var readOnly = me.senchaPreferenceStore.getPreferenceBoolean('read_only',true);
if (readOnly) {
var cnt = 0;
for (var idx in affectedColumns) {
var col = affectedColumns[idx];
console.log('GanttButtonController.onTaskTreeStoreUpdate: col='+col);
switch (col) {
case "expanded": break;
case "collapsed": break;
default: cnt++;
}
};
if (cnt > 0) {
me.ganttTreePanelController.readOnlyWarning();
return;
}
}
if (cnt > 0) {
me.ganttTreePanelController.readOnlyWarning();
return;
}
}
// Enable the Save button
// Enable the Save button
var buttonSave = Ext.getCmp('buttonSave');
buttonSave.setDisabled(false); // Allow to "save" changes
// ToDo: This isn't always the case...
// ToDo: This isn't always the case...
me.ganttBarPanel.needsRedraw = true; // Tell the ganttBarPanel to redraw with the next frame
},
......@@ -179,14 +179,14 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
onZoomIn: function() {
var me = this;
alert('GanttButtonController.onZoomIn: ToDo: remove');
alert('GanttButtonController.onZoomIn: ToDo: remove');
if (me.debug) console.log('GanttButtonController.onZoomIn');
this.ganttBarPanel.onZoomIn();
},
onZoomOut: function() {
var me = this;
alert('GanttButtonController.onZoomOut: ToDo: remove');
alert('GanttButtonController.onZoomOut: ToDo: remove');
if (me.debug) console.log('GanttButtonController.onZoomOut');
this.ganttBarPanel.onZoomOut();
},
......
......@@ -259,8 +259,9 @@ Ext.define('GanttEditor.controller.GanttTreePanelController', {
r.set('material_id', ""+default_material_id);
r.set('uom_id', ""+default_uom_id);
r.set('project_name', 'New Task');
r.set('start_date', new Date().toISOString().substring(0,10));
r.set('end_date', new Date(new Date().getTime() + 1000 * 3600 * 24).toISOString().substring(0,10));
r.set('work', ""+8);
r.set('start_date', new Date().toISOString().substring(0,10)+" 00:00:00"); // Indicates start of the day at 00:00:00
r.set('end_date', new Date().toISOString().substring(0,10)+" 23:59:59"); // Same as start_date, but indicates 23:59:59
// Get a server-side object_id for the task
Ext.Ajax.request({
......
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