- Change zoom auto level to better suit projects a day or two long

- Reset start/end dates when changing data
This commit is contained in:
Nathan Gray 2014-08-18 23:09:18 +00:00
parent b89c654d37
commit ed861b33f3

View File

@ -229,11 +229,15 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
set_value: function(value) {
if(this.gantt == null) return false;
this.gantt.clearAll();
// Ensure proper format, no extras
var safe_value = {
data: value.data || [],
links: value.links || []
};
this.gantt.config.start_date = null;
this.gantt.config.end_date = null;
this.gantt.parse(safe_value);
// Set some things from the value
@ -341,8 +345,8 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
{
level = 3;
}
// More than 3 days
else if (difference > 259200)
// More than 1 day
else if (difference > 86400)
{
level = 2;
}
@ -505,11 +509,12 @@ var et2_gantt = et2_valueWidget.extend([et2_IResizeable,et2_IInput],
// Bind AJAX for dynamic expansion
// TODO: This could be improved
this.gantt.attachEvent("onTaskOpened", function(id, item) {
var task = this.getTask(id);
// Node children are already there & displayed
var value = gantt_widget.getInstanceManager().getValues(gantt_widget.getInstanceManager().widgetContainer);
var request = gantt_widget.egw().json(gantt_widget.options.autoload,
[id,value],
[id,value,task.parent||false],
function(data) {
this.parse(data);
},
@ -732,7 +737,7 @@ et2_register_widget(et2_gantt, ["gantt"]);
$j(function() {
// Set icon to match application
gantt.templates.grid_file = function(item) {
if(!item.pe_app || !egw.image(item.pe_icon)) return "<div class='gantt_tree_icon gantt_file'></div>";
if(!item.pe_icon || !egw.image(item.pe_icon)) return "<div class='gantt_tree_icon gantt_file'></div>";
return "<div class='gantt_tree_icon' style='background-image: url(\"" + egw.image(item.pe_icon) + "\");'/></div>";
}