Author: nathangray
Date: Tue Apr 26 21:51:42 2016
New Revision: 55867
URL: http://svn.stylite.de/viewvc/egroupware?rev=55867&view=rev
Log:
Add custom date range filtering to tracker
- Added closed column to tracker list
- Date ranges filters in tracker will apply to the currently selected date column (opened, start, due, closed)
Modified:
trunk/tracker/inc/class.tracker_bo.inc.php
trunk/tracker/inc/class.tracker_ui.inc.php
trunk/tracker/js/app.js
trunk/tracker/templates/default/index.xet
Modified: trunk/tracker/inc/class.tracker_bo.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/tracker/inc/class.tracker_bo.inc.php?rev=55867&r1=55866&r2=55867&view=diff
==============================================================================
--- trunk/tracker/inc/class.tracker_bo.inc.php (original)
+++ trunk/tracker/inc/class.tracker_bo.inc.php Tue Apr 26 21:51:42 2016
@@ -1460,7 +1460,7 @@
{
if($query['filter'])
{
- $query['col_filter'][] = $this->date_filter($query['filter'],$query['startdate'],$query['enddate']);
+ $query['col_filter'][] = $this->date_filter($query['filter'],$query['startdate'],$query['enddate'],$query['order']);
}
return parent::get_rows($query,$rows,$readonlys,$join,$need_full_no_count);
}
@@ -2114,13 +2114,26 @@
/**
* return SQL implementing filtering by date
*
+ * If the currently sorted column is a date, we filter by that date, otherwise
+ * we sort on tr_created
+ *
* @param string $name
* @param int &$start
* @param int &$end
+ * @param string &$column
* @return string
*/
- function date_filter($name,&$start,&$end)
- {
+ function date_filter($name,&$start,&$end, $column = 'tr_created')
+ {
+ if(!$column ||
+ // Just these columns
+ !in_array($column, array('tr_created','tr_startdate','tr_duedate','tr_closed'))
+ // Any date column
+ //!in_array($column, tracker_egw_record::$types['date-time']))
+ )
+ {
+ $column = 'tr_created';
+ }
switch(strtolower($name))
{
case 'overdue':
@@ -2143,7 +2156,7 @@
case 'upcoming':
return "(tr_startdate IS NOT NULL and tr_startdate > {$this->now} )";
}
- return egw_time::sql_filter($name, $start, $end, 'tr_created', $this->date_filters);
+ return egw_time::sql_filter($name, $start, $end, $column, $this->date_filters);
}
/**
Modified: trunk/tracker/inc/class.tracker_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/tracker/inc/class.tracker_ui.inc.php?rev=55867&r1=55866&r2=55867&view=diff
==============================================================================
--- trunk/tracker/inc/class.tracker_ui.inc.php (original)
+++ trunk/tracker/inc/class.tracker_ui.inc.php Tue Apr 26 21:51:42 2016
@@ -1284,11 +1284,13 @@
{
$date_filters[$name] = lang($name);
}
+ $date_filters['custom'] = 'custom';
$content['nm'] = array(
'get_rows' => 'tracker.tracker_ui.get_rows',
'cat_is_select' => 'no_lang',
'filter' => 0, // all
'options-filter' => $date_filters,
+ 'filter_onchange' => "app.tracker.filter_change();",
//'filter_label' => lang('Date filter'),
'filter_no_lang'=> true,
'filter2' => 0, // all
Modified: trunk/tracker/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/tracker/js/app.js?rev=55867&r1=55866&r2=55867&view=diff
==============================================================================
--- trunk/tracker/js/app.js (original)
+++ trunk/tracker/js/app.js Tue Apr 26 21:51:42 2016
@@ -69,6 +69,7 @@
break;
case 'tracker.index':
+ this.filter_change();
if (this.et2.getArrayMgr('content').getEntry('nm[only_tracker]'))
// there's no this.et2.getWidgetById('colfilter[tr_tracker]').hide() and
// jQuery(this.et2.getWidgetById('colfilter[tr_tracker]').getDOMNode()).hide()
@@ -112,6 +113,25 @@
},
/**
+ * Tracker list filter change, used to toggle date fields
+ */
+ filter_change: function()
+ {
+ var filter = this.et2.getWidgetById('filter');
+ var dates = this.et2.getWidgetById('tracker.index.dates');
+
+ if (filter && dates)
+ {
+ dates.set_disabled(filter.value !== "custom");
+ if (filter.value == "custom")
+ {
+ jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
+ }
+ }
+ return true;
+ },
+
+ /**
* Used in escalations on buttons to change filters from a single select to a multi-select
*
* @param {object} _event
Modified: trunk/tracker/templates/default/index.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/tracker/templates/default/index.xet?rev=55867&r1=55866&r2=55867&view=diff
==============================================================================
--- trunk/tracker/templates/default/index.xet (original)
+++ trunk/tracker/templates/default/index.xet Tue Apr 26 21:51:42 2016
@@ -13,6 +13,7 @@
<column width="40%"/>
<column width="135"/>
<column width="135" disabled="@no_tr_startdate_tr_duedate"/>
+ <column width="135"/>
<column width="45"/>
<column width="10%"/>
<column width="10%"/>
@@ -46,6 +47,7 @@
<nextmatch-sortheader label="Start date" id="tr_startdate" sortmode="DESC"/>
<nextmatch-sortheader label="Due date" id="tr_duedate" sortmode="DESC"/>
</vbox>
+ <nextmatch-sortheader label="Closed date" id="tr_closed" sortmode="DESC"/>
<nextmatch-sortheader align="center" label="Priority" id="tr_priority" class="tracker-priority" sortmode="DESC"/>
<vbox>
<nextmatch-filterheader label="Status" id="tr_status" options="All" class="tracker_status_filter"/>
@@ -97,6 +99,7 @@
<date-time id="${row}[tr_startdate]" readonly="true" class="noWrap"/>
<date-time id="${row}[tr_duedate]" readonly="true" class="noWrap $row_cont[overdue_class]"/>
</vbox>
+ <date-time id="${row}[tr_closed]" readonly="true" class="noWrap"/>
<description align="center" id="${row}[prio_label]" class="tracker_indexPrio"/>
<menulist>
<menupopup id="${row}[tr_status]" readonly="true"/>
@@ -127,6 +130,14 @@
</template>
<template id="tracker.index.add" template="" lang="" group="0" version="1.7.001">
<buttononly statustext="Add" id="add" onclick="egw.open('', 'tracker', 'add', {tracker:widget.getRoot().getWidgetById('nm').activeFilters.col_filter.tr_tracker});"/>
+ </template>
+ <template id="tracker.index.dates" template="" lang="" group="0" version="16.1.001" >
+ <hbox>
+ <description value="Start"/>
+ <date id="startdate" onchange="widget.getParent().getWidgetById('enddate').set_min(widget.getValue());return true;"/>
+ <description value="End"/>
+ <date id="enddate" onchange="widget.getParent().getWidgetById('startdate').set_max(widget.getValue());return true;"/>
+ </hbox>
</template>
<template id="tracker.index" template="" lang="" group="0" version="1.9.003">
<grid width="100%" class="tracker-index">
@@ -139,7 +150,7 @@
<html id="css" span="all"/>
</row>
<row>
- <nextmatch id="nm" template="tracker.index.rows" span="all" header_left="tracker.index.add" header_row="tracker.index.queue"/>
+ <nextmatch id="nm" template="tracker.index.rows" span="all" header_left="tracker.index.add" header_row="tracker.index.queue" header_right="tracker.index.dates"/>
</row>
<row disabled="!@nm[selectcols]=/legacy_actions/">
<button label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=tracker.tracker_ui.edit&tracker={$cont[nm][col_filter][tr_tracker]}'),'_blank','dependent=yes,width=700,height=480,scrollbars=yes,status=yes'); return false;"/>
------------------------------------------------------------------------------
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.