2013-08-21 17:25:42 +02:00
|
|
|
/**
|
|
|
|
* EGroupware - Timesheet - Javascript UI
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @package timesheet
|
|
|
|
* @author Hadi Nategh <hn-AT-stylite.de>
|
|
|
|
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* UI for timesheet
|
|
|
|
*
|
|
|
|
* @augments AppJS
|
|
|
|
*/
|
2013-11-04 21:54:23 +01:00
|
|
|
app.classes.timesheet = AppJS.extend(
|
2013-08-21 17:25:42 +02:00
|
|
|
{
|
|
|
|
appname: 'timesheet',
|
|
|
|
/**
|
|
|
|
* et2 widget container
|
|
|
|
*/
|
|
|
|
et2: null,
|
|
|
|
/**
|
|
|
|
* path widget
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @memberOf app.timesheet
|
|
|
|
*/
|
|
|
|
init: function()
|
|
|
|
{
|
|
|
|
// call parent
|
|
|
|
this._super.apply(this, arguments);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
|
|
|
destroy: function()
|
|
|
|
{
|
|
|
|
delete this.et2;
|
|
|
|
// call parent
|
|
|
|
this._super.apply(this, arguments);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is called when the etemplate2 object is loaded
|
|
|
|
* and ready. If you must store a reference to the et2 object,
|
|
|
|
* make sure to clean it up in destroy().
|
|
|
|
*
|
|
|
|
* @param et2 etemplate2 Newly ready object
|
|
|
|
*/
|
|
|
|
et2_ready: function(et2)
|
|
|
|
{
|
|
|
|
// call parent
|
|
|
|
this._super.apply(this, arguments);
|
2013-08-22 09:30:01 +02:00
|
|
|
|
2013-08-21 17:25:42 +02:00
|
|
|
if (typeof et2.templates['timesheet.index'] != "undefined")
|
|
|
|
{
|
2013-08-27 12:46:42 +02:00
|
|
|
this.filter_change();
|
2014-06-04 21:29:35 +02:00
|
|
|
this.filter2_change();
|
2013-08-21 17:25:42 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2013-08-27 12:46:42 +02:00
|
|
|
filter_change: function()
|
2013-08-21 17:25:42 +02:00
|
|
|
{
|
2013-08-22 09:30:01 +02:00
|
|
|
var filter = this.et2.getWidgetById('filter');
|
|
|
|
var dates = this.et2.getWidgetById('timesheet.index.dates');
|
|
|
|
|
|
|
|
if (filter && dates)
|
2013-08-21 17:25:42 +02:00
|
|
|
{
|
2013-08-22 09:30:01 +02:00
|
|
|
dates.set_disabled(filter.value !== "custom");
|
2013-08-21 17:25:42 +02:00
|
|
|
}
|
|
|
|
},
|
2014-06-04 21:29:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* show or hide the details of rows by selecting the filter2 option
|
|
|
|
* either 'all' for details or 'no_description' for no details
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
filter2_change: function()
|
|
|
|
{
|
|
|
|
var nm = this.et2.getWidgetById('nm');
|
|
|
|
var filter2 = this.et2.getWidgetById('filter2');
|
|
|
|
|
|
|
|
if (nm && filter2)
|
|
|
|
{
|
|
|
|
egw.css("#timesheet-index span.timesheet_titleDetails","font-weight:" + (filter2.getValue() == '1' ? "bold;" : "normal;"));
|
|
|
|
// Show / hide descriptions
|
|
|
|
egw.css(".et2_label.ts_description","display:" + (filter2.getValue() == '1' ? "block;" : "none;"));
|
|
|
|
}
|
|
|
|
},
|
2013-08-21 17:25:42 +02:00
|
|
|
});
|