Commit 28c7e60d authored by Project Open's avatar Project Open

- Created unique IDs for buttons

- preferenceStore is now a singleton for the case that it is shared
  with the BudgetTree or other Ext portlets
parent 444a4673
......@@ -123,9 +123,9 @@ function launchGanttEditor(debug){
/* ***********************************************************************
* Config Menu
*********************************************************************** */
var configMenu = Ext.create('PO.view.menu.ConfigMenu', {
debug: getDebug('configMenu'),
id: 'configMenu',
var configMenuGanttEditor = Ext.create('PO.view.menu.ConfigMenu', {
debug: getDebug('configMenuGanttEditor'),
id: 'configMenuGanttEditor',
senchaPreferenceStore: senchaPreferenceStore,
items: [
/* {
......@@ -181,30 +181,30 @@ function launchGanttEditor(debug){
bodyPadding: 0
},
tbar: [
{ icon: gifPath+'lock.png', tooltip: 'Read-only - you can not save changes', id: 'buttonLock', disabled: true},
{ icon: gifPath+'disk.png', tooltip: '<nobr>Save the project to the &#93;po&#91; backend</nobr>', id: 'buttonSave', disabled: true},
// { icon: gifPath+'arrow_refresh.png', tooltip: 'Reload project data from ]po[ backend, discarding changes', id: 'buttonReload'},
{ icon: gifPath+'arrow_out.png', tooltip: 'Maximize the editor &nbsp;', id: 'buttonMaximize'},
{ icon: gifPath+'arrow_in.png', tooltip: 'Restore default editor size &nbsp;', id: 'buttonMinimize', hidden: true},
{ icon: gifPath+'lock.png', tooltip: 'Read-only - you can not save changes', id: 'buttonLockGantt', disabled: true},
{ icon: gifPath+'disk.png', tooltip: '<nobr>Save the project to the &#93;po&#91; backend</nobr>', id: 'buttonSaveGantt', disabled: true},
// { icon: gifPath+'arrow_refresh.png', tooltip: 'Reload project data from ]po[ backend, discarding changes', id: 'buttonReloadGantt'},
{ icon: gifPath+'arrow_out.png', tooltip: 'Maximize the editor &nbsp;', id: 'buttonMaximizeGantt'},
{ icon: gifPath+'arrow_in.png', tooltip: 'Restore default editor size &nbsp;', id: 'buttonMinimizeGantt', hidden: true},
{ xtype: 'tbseparator' },
{ icon: gifPath+'add.png', tooltip: 'Add a new task', id: 'buttonAdd'},
{ icon: gifPath+'delete.png', tooltip: 'Delete a task', id: 'buttonDelete'},
{ icon: gifPath+'add.png', tooltip: 'Add a new task', id: 'buttonAddGantt'},
{ icon: gifPath+'delete.png', tooltip: 'Delete a task', id: 'buttonDeleteGantt'},
{ xtype: 'tbseparator' },
// Event captured and handled by GanttTreePanelController
{ icon: gifPath+'arrow_left.png', tooltip: 'Reduce Indent', id: 'buttonReduceIndent'},
{ icon: gifPath+'arrow_left.png', tooltip: 'Reduce Indent', id: 'buttonReduceIndentGantt'},
// Event captured and handled by GanttTreePanelController
{ icon: gifPath+'arrow_right.png', tooltip: 'Increase Indent', id: 'buttonIncreaseIndent'},
{ icon: gifPath+'arrow_right.png', tooltip: 'Increase Indent', id: 'buttonIncreaseIndentGantt'},
{ xtype: 'tbseparator'},
{ icon: gifPath+'link_add.png', tooltip: 'Add dependency', id: 'buttonAddDependency', hidden: true},
{ icon: gifPath+'link_break.png', tooltip: 'Break dependency', id: 'buttonBreakDependency', hidden: true},
{ icon: gifPath+'link_add.png', tooltip: 'Add dependency', id: 'buttonAddDependencyGantt', hidden: true},
{ icon: gifPath+'link_break.png', tooltip: 'Break dependency', id: 'buttonBreakDependencyGantt', hidden: true},
'->',
{ icon: gifPath+'resultset_previous.png', tooltip: 'Zoom in time axis', id: 'buttonZoomLeft'},
{ icon: gifPath+'zoom_in.png', tooltip: 'Zoom in time axis', id: 'buttonZoomIn'},
{ icon: gifPath+'zoom.png', tooltip: 'Center', id: 'buttonZoomCenter'},
{ icon: gifPath+'zoom_out.png', tooltip: 'Zoom out of time axis', id: 'buttonZoomOut'},
{ icon: gifPath+'resultset_next.png', tooltip: 'Zoom in time axis', id: 'buttonZoomRight'},
{ icon: gifPath+'resultset_previous.png', tooltip: 'Zoom in time axis', id: 'buttonZoomLeftGantt'},
{ icon: gifPath+'zoom_in.png', tooltip: 'Zoom in time axis', id: 'buttonZoomInGantt'},
{ icon: gifPath+'zoom.png', tooltip: 'Center', id: 'buttonZoomCenterGantt'},
{ icon: gifPath+'zoom_out.png', tooltip: 'Zoom out of time axis', id: 'buttonZoomOutGantt'},
{ icon: gifPath+'resultset_next.png', tooltip: 'Zoom in time axis', id: 'buttonZoomRightGantt'},
'->',
{ text: 'Configuration', icon: gifPath+'wrench.png', menu: configMenu},
{ text: 'Configuration', icon: gifPath+'wrench.png', menu: configMenuGanttEditor},
{ text: 'Help', icon: gifPath+'help.png', menu: helpMenu}
//,{ text: 'This is Beta!', icon: gifPath+'bug.png', menu: alphaMenu}
]
......@@ -289,7 +289,7 @@ function launchGanttEditor(debug){
// Controller for handling configuration options
var ganttConfigController = Ext.create('GanttEditor.controller.GanttConfigController', {
debug: getDebug('ganttConfigController'),
configMenu: configMenu,
configMenuGanttEditor: configMenuGanttEditor,
senchaPreferenceStore: senchaPreferenceStore,
ganttBarPanel: ganttBarPanel
});
......@@ -334,26 +334,27 @@ function launchGanttEditor(debug){
ganttBarPanel.ganttSchedulingController = ganttSchedulingController;
ganttSchedulingController.init(this).onLaunch(this);
dependencyPropertyPanel.ganttSchedulingController = ganttSchedulingController;
// Create a warning if there are no tasks in the project
var numTasks = 0;
taskTreeStore.tree.root.eachChild(function() { numTasks = numTasks + 1; });
if (0 == numTasks) {
Ext.Msg.show({
title: 'No tasks created yet',
msg: 'Please click on the <img src="/intranet/images/navbar_default/add.png"> button above<br>in order to add a first task to your project.',
height: 120, width: 400,
buttons: Ext.Msg.OK,
icon: Ext.Msg.INFO,
modal: false
});
};
// Create a warning if there are no tasks in the project
setTimeout(function() {
var numTasks = 0;
taskTreeStore.tree.root.eachChild(function() { numTasks = numTasks + 1; });
if (0 == numTasks) {
Ext.Msg.show({
title: 'No tasks created yet',
msg: 'Please click on the <img src="/intranet/images/navbar_default/add.png"> button above<br>in order to add a first task to your project.',
height: 120, width: 400,
buttons: Ext.Msg.OK,
icon: Ext.Msg.INFO,
modal: false
});
};
}, 2);
// Work around Chrome bug showing a 15px white space between GanttBarPanel DIV and SVG:
setTimeout(function() {
var svgStyle = document.getElementById("ganttBarPanel").firstChild.style;
svgStyle.minHeight = "0px";
svgStyle.minHeight = "0px";
}, 1);
};
......@@ -389,7 +390,6 @@ Ext.onReady(function() {
*********************************************************************** */
var taskTreeStore = Ext.create('PO.store.timesheet.TaskTreeStore');
var senchaPreferenceStore = Ext.create('PO.store.user.SenchaPreferenceStore');
var taskStatusStore = Ext.create('PO.store.timesheet.TaskStatusStore');
var taskMaterialStore = Ext.create('PO.store.timesheet.TaskMaterialStore');
var taskCostCenterStore = Ext.create('PO.store.timesheet.TaskCostCenterStore');
......@@ -398,6 +398,13 @@ Ext.onReady(function() {
var groupStore = Ext.create('PO.store.group.GroupStore', {storeId: 'groupStore'});
var absenceAssignmentStore = Ext.create('GanttEditor.store.AbsenceAssignmentStore', {storeId: 'absenceAssignmentStore'});
var senchaPreferenceStore = Ext.StoreManager.get('senchaPreferenceStore');
if (!senchaPreferenceStore) {
senchaPreferenceStore = Ext.create('PO.store.user.SenchaPreferenceStore');
} else {
senchaPreferenceStore.loaded = true;
}
// Store Coodinator starts app after all stores have been loaded:
var coordinator = Ext.create('PO.controller.StoreLoadCoordinator', {
debug: getDebug('storeLoadCoordinator'),
......@@ -472,7 +479,8 @@ Ext.onReady(function() {
});
// User preferences
senchaPreferenceStore.load({callback: function(r, op, success) { if (!success) PO.Utilities.reportStoreError("UserPreferenceStore", op); }});
if (!senchaPreferenceStore.loaded)
senchaPreferenceStore.load({callback: function(r, op, success) { if (!success) PO.Utilities.reportStoreError("UserPreferenceStore", op); }});
// User store - load last, because this can take some while. Load only Employees.
......
......@@ -32,13 +32,13 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
// Listen to button press events
this.control({
'#buttonReload': { click: this.onButtonReload },
'#buttonSave': { click: this.onButtonSave },
'#buttonMaximize': { click: this.onButtonMaximize },
'#buttonMinimize': { click: this.onButtonMinimize },
'#buttonAddDependency': { click: this.onButton },
'#buttonBreakDependency': { click: this.onButton },
'#buttonSettings': { click: this.onButton },
'#buttonReloadGantt': { click: this.onButtonReload },
'#buttonSaveGantt': { click: this.onButtonSave },
'#buttonMaximizeGantt': { click: this.onButtonMaximize },
'#buttonMinimizeGantt': { click: this.onButtonMinimize },
'#buttonAddDependencyGantt': { click: this.onButton },
'#buttonBreakDependencyGantt': { click: this.onButton },
'#buttonSettingsGantt': { click: this.onButton },
scope: me.ganttTreePanel
});
......@@ -60,9 +60,9 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
me.taskTreeStore.on({'update': me.onTaskTreeStoreUpdate, 'scope': this});
// write_project_p is a global variable defined in gantt-editor.adp
var buttonSave = Ext.getCmp('buttonSave');
var buttonSave = Ext.getCmp('buttonSaveGantt');
me.buttonSave = buttonSave;
var buttonLock = Ext.getCmp('buttonLock');
var buttonLock = Ext.getCmp('buttonLockGantt');
if (1 == write_project_p) {
buttonSave.show();
buttonLock.hide();
......@@ -98,7 +98,7 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
onButtonReload: function() {
var me = this;
if (me.debug) console.log('GanttButtonController.ButtonReload');
// var buttonSave = Ext.getCmp('buttonSave');
// var buttonSave = Ext.getCmp('buttonSaveGantt');
me.buttonSave.setDisabled(true);
},
......@@ -160,7 +160,7 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
}
});
// Now block the "Save" button, unless some data are changed.
// var buttonSave = Ext.getCmp('buttonSave');
// var buttonSave = Ext.getCmp('buttonSaveGantt');
me.buttonSave.setDisabled(true);
if (me.debug) console.log('GanttButtonController.ButtonSave: Finished');
},
......@@ -197,7 +197,7 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
*/
// Enable the Save button
// var buttonSave = Ext.getCmp('buttonSave');
// var buttonSave = Ext.getCmp('buttonSaveGantt');
me.buttonSave.setDisabled(false); // Allow to "save" changes
// ToDo: This isn't always the case...
......@@ -210,8 +210,8 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
*/
onButtonMaximize: function() {
var me = this;
var buttonMaximize = Ext.getCmp('buttonMaximize');
var buttonMinimize = Ext.getCmp('buttonMinimize');
var buttonMaximize = Ext.getCmp('buttonMaximizeGantt');
var buttonMinimize = Ext.getCmp('buttonMinimizeGantt');
buttonMaximize.setVisible(false);
buttonMinimize.setVisible(true);
me.resizeController.onSwitchToFullScreen();
......@@ -219,8 +219,8 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
onButtonMinimize: function() {
var me = this;
var buttonMaximize = Ext.getCmp('buttonMaximize');
var buttonMinimize = Ext.getCmp('buttonMinimize');
var buttonMaximize = Ext.getCmp('buttonMaximizeGantt');
var buttonMinimize = Ext.getCmp('buttonMinimizeGantt');
buttonMaximize.setVisible(true);
buttonMinimize.setVisible(false);
me.resizeController.onSwitchBackFromFullScreen();
......@@ -232,7 +232,7 @@ Ext.define('GanttEditor.controller.GanttButtonController', {
onTreePanelSelectionChange: function(view, records) {
var me = this;
if (me.debug) console.log('GanttButtonController.onTreePanelSelectionChange');
var buttonDelete = Ext.getCmp('buttonDelete');
var buttonDelete = Ext.getCmp('buttonDeleteGantt');
if (1 == records.length) { // Exactly one record enabled
var record = records[0];
......
......@@ -20,14 +20,14 @@ Ext.define('GanttEditor.controller.GanttConfigController', {
debug: false,
senchaPreferenceStore: null, // preferences
configMenu: null,
configMenuGanttEditor: null,
ganttBarPanel: null,
init: function() {
var me = this;
if (me.debug) console.log('GanttEditor.controller.GanttConfigController.init: Starting');
me.configMenu.on({
me.configMenuGanttEditor.on({
'click': me.onConfigClick,
'scope': this
});
......
......@@ -108,7 +108,7 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
if (dirty) {
me.ganttBarPanel.needsRedraw = true; // Force a redraw
var buttonSave = Ext.getCmp('buttonSave');
var buttonSave = Ext.getCmp('buttonSaveGantt');
buttonSave.setDisabled(false); // Enable "Save" button
}
......
......@@ -29,10 +29,10 @@ Ext.define('GanttEditor.controller.GanttTreePanelController', {
'itemcollapse': this.onItemCollapse,
'itemexpand': this.onItemExpand
},
'#buttonReduceIndent': { click: this.onButtonReduceIndent},
'#buttonIncreaseIndent': { click: this.onButtonIncreaseIndent},
'#buttonAdd': { click: this.onButtonAdd},
'#buttonDelete': { click: this.onButtonDelete},
'#buttonReduceIndentGantt': { click: this.onButtonReduceIndent},
'#buttonIncreaseIndentGantt': { click: this.onButtonIncreaseIndent},
'#buttonAddGantt': { click: this.onButtonAdd},
'#buttonDeleteGantt': { click: this.onButtonDelete},
// Redraw GanttBars after changing the configuration
'#config_menu_show_project_dependencies': { click: this.redrawGanttBarPanel},
......@@ -392,7 +392,7 @@ Ext.define('GanttEditor.controller.GanttTreePanelController', {
// Finish off
me.getGanttBarPanel().needsRedraw = true; // Force delayed redraw
var buttonSave = Ext.getCmp('buttonSave');
var buttonSave = Ext.getCmp('buttonSaveGantt');
buttonSave.setDisabled(false); // Enable "Save" button
},
......
......@@ -52,11 +52,11 @@ Ext.define('GanttEditor.controller.GanttZoomController', {
// Catch events from three zoom buttons
me.control({
'#buttonZoomIn': { click: me.onButtonZoomIn },
'#buttonZoomOut': { click: me.onButtonZoomOut },
'#buttonZoomCenter': { click: me.onButtonZoomCenter },
'#buttonZoomLeft': { click: me.onButtonZoomLeft },
'#buttonZoomRight': { click: me.onButtonZoomRight }
'#buttonZoomInGantt': { click: me.onButtonZoomIn },
'#buttonZoomOutGantt': { click: me.onButtonZoomOut },
'#buttonZoomCenterGantt': { click: me.onButtonZoomCenter },
'#buttonZoomLeftGantt': { click: me.onButtonZoomLeft },
'#buttonZoomRightGantt': { click: me.onButtonZoomRight }
});
// Catch scroll events
......
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