[eGroupWare-svn] r55839 - in /trunk/timesheet: inc/class.timesheet_ui.inc.php js/app.js templates/default/index.xet

[email protected]
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: nathangray
Date: Mon Apr 25 23:21:40 2016
New Revision: 55839

URL: http://svn.stylite.de/viewvc/egroupware?rev=55839&view=rev
Log:
- Keep custom timespan start & end dates matching selected named range
- If all (or no end date) show until today, instead of a week

Modified:
    trunk/timesheet/inc/class.timesheet_ui.inc.php
    trunk/timesheet/js/app.js
    trunk/timesheet/templates/default/index.xet

Modified: trunk/timesheet/inc/class.timesheet_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/timesheet/inc/class.timesheet_ui.inc.php?rev=55839&r1=55838&r2=55839&view=diff
==============================================================================
--- trunk/timesheet/inc/class.timesheet_ui.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_ui.inc.php Mon Apr 25 23:21:40 2016
@@ -467,6 +467,7 @@
 		$this->show_sums = false;
 		if ($query_in['filter'])
 		{
+			$query_in['enddate'] = $query_in['enddate'] ? $query_in['enddate'] : time();
 			$date_filter = $this->date_filter($query_in['filter'],$query_in['startdate'],$query_in['enddate']);
 
 			if ($query_in['startdate'])
@@ -651,6 +652,15 @@
 					$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.common::show_date($query['enddate']+12*60*60,$df,false);
 				}
 			}
+		}
+		// Update start / end dates for custom
+		if($query_in['filter'] != 'custom')
+		{
+			egw_json_response::get()->call(
+				'app.timesheet.update_timespan',
+				egw_time::to($query['startdate'] ? $query['startdate'] : now() ,egw_time::ET2),
+				$query['filter'] ? egw_time::to($query['enddate'], egw_time::ET2) : null
+			);
 		}
 		$total = parent::get_rows($query,$rows,$readonlys);
 

Modified: trunk/timesheet/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/timesheet/js/app.js?rev=55839&r1=55838&r2=55839&view=diff
==============================================================================
--- trunk/timesheet/js/app.js (original)
+++ trunk/timesheet/js/app.js Mon Apr 25 23:21:40 2016
@@ -77,10 +77,11 @@
 		{
 			dates.set_disabled(filter.value !== "custom");
 			if (filter.value == "custom")
-			{
+			{				
 				jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
 			}
 		}
+		return true;
 	},
 
 	/**
@@ -124,6 +125,27 @@
 	},
 
 	/**
+	 * Update custom filter timespan, without triggering a change
+	 */
+	update_timespan: function(start, end)
+	{
+		if(this && this.et2)
+		{
+			var nm = this.et2.getWidgetById('nm');
+			if(nm)
+			{
+				// Toggle update_in_progress to avoid another request
+				nm.update_in_progress = true;
+				this.et2.getWidgetById('startdate').set_value(start);
+				this.et2.getWidgetById('enddate').set_value(end);
+				nm.activeFilters.startdate = start;
+				nm.activeFilters.enddate = end;
+				nm.update_in_progress = false;
+			}
+		}
+	},
+
+	/**
 	 * Get title in order to set it as document title
 	 * @returns {string}
 	 */

Modified: trunk/timesheet/templates/default/index.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/timesheet/templates/default/index.xet?rev=55839&r1=55838&r2=55839&view=diff
==============================================================================
--- trunk/timesheet/templates/default/index.xet (original)
+++ trunk/timesheet/templates/default/index.xet Mon Apr 25 23:21:40 2016
@@ -7,7 +7,7 @@
 			<description value="Start"/>
 			<date id="startdate" onchange="widget.getParent().getWidgetById('enddate').set_min(widget.getValue());return true;"/>
 			<description value="End"/>
-			<date statustext="Leave it empty for a full week" id="enddate"  onchange="widget.getParent().getWidgetById('startdate').set_max(widget.getValue());return true;"/>
+			<date id="enddate"  onchange="widget.getParent().getWidgetById('startdate').set_max(widget.getValue());return true;"/>
 		</hbox>
 	</template>
 	<template id="timesheet.index.add" template="" lang="" group="0" version="1.7.001">


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.