mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
first step to allow for a date-range-filter on ui, allows quicksearch too; not yet available on selected-mail-operations
This commit is contained in:
parent
662e82b897
commit
1a885f29e5
@ -96,7 +96,7 @@ class mail_ui
|
||||
'text' => 'whole message', // lang('whole message')
|
||||
'larger' => 'greater than', // lang('greater than')
|
||||
'smaller' => 'less than', // lang('less than')
|
||||
// 'custom' => 'Selected range',// lang('Selected range')
|
||||
'bydate' => 'Selected date range (with quicksearch)',// lang('Selected date range (with quicksearch)')
|
||||
);
|
||||
|
||||
/**
|
||||
@ -541,6 +541,8 @@ class mail_ui
|
||||
$content[self::$nm_index]['filter2'] = $GLOBALS['egw_info']['user']['preferences']['mail']['ShowDetails'];
|
||||
|
||||
$etpl = new etemplate_new('mail.index');
|
||||
//apply infolog_filter_change javascript method (hide/show of date filter form) over onchange filter
|
||||
$content[self::$nm_index]['cat_id_onchange'] = "app.mail.mail_searchtype_change()";
|
||||
// Start at 2 so auto-added copy+paste actions show up as second group
|
||||
// Needed because there's no 'select all' action to push things down
|
||||
$group=1;
|
||||
@ -1283,7 +1285,6 @@ class mail_ui
|
||||
$mail_ui = new mail_ui(true); // run constructor for current profile
|
||||
if (empty($query['selectedFolder'])) $query['selectedFolder'] = $mail_ui->mail_bo->profileID.self::$delimiter.'INBOX';
|
||||
}
|
||||
|
||||
//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows'].array2string($query['order']).'->'.array2string($query['sort']));
|
||||
//Mail::$debugTimes=true;
|
||||
if (Mail::$debugTimes) $starttime = microtime(true);
|
||||
@ -1322,7 +1323,7 @@ class mail_ui
|
||||
$maxMessages = $query['num_rows'];
|
||||
//error_log(__METHOD__.__LINE__.array2string($query));
|
||||
$sort = ($query['order']=='address'?($toSchema?'toaddress':'fromaddress'):$query['order']);
|
||||
if (!empty($query['search']))
|
||||
if (!empty($query['search'])||($query['cat_id']=='bydate' && (!empty($query['startdate'])||!empty($query['enddate']))))
|
||||
{
|
||||
if (is_null(Mail::$supportsORinQuery) || !isset(Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]))
|
||||
{
|
||||
@ -1332,8 +1333,11 @@ class mail_ui
|
||||
Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]=true;
|
||||
}
|
||||
}
|
||||
//$cutoffdate = egw_time::to('now','ts')-(3600*24*3);//SINCE, enddate
|
||||
//$cutoffdate2 = egw_time::to('now','ts');//-(3600*24*2);//BEFORE, startdate
|
||||
//error_log(__METHOD__.__LINE__.' Startdate:'.$query['startdate'].' Enddate'.$query['enddate']);
|
||||
$cutoffdate = $cutoffdate2 = null;
|
||||
if ($query['startdate']) $cutoffdate = egw_time::to($query['startdate'],'ts');//SINCE, enddate
|
||||
if ($query['enddate']) $cutoffdate2 = egw_time::to($query['enddate'],'ts');//BEFORE, startdate
|
||||
//error_log(__METHOD__.__LINE__.' Startdate:'.$cutoffdate2.' Enddate'.$cutoffdate);
|
||||
$filter = array(
|
||||
'filterName' => (Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')),
|
||||
'type' => ($query['cat_id']?$query['cat_id']:(Mail::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')),
|
||||
@ -1341,6 +1345,17 @@ class mail_ui
|
||||
'status' => 'any',
|
||||
//'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2)
|
||||
);
|
||||
if ($query['enddate']||$query['startdate']) {
|
||||
$filter['range'] = "BETWEEN";
|
||||
if ($cutoffdate) {
|
||||
$filter[(empty($cutoffdate2)?'date':'since')] = date("d-M-Y", $cutoffdate);
|
||||
if (empty($cutoffdate2)) $filter['range'] = "SINCE";
|
||||
}
|
||||
if ($cutoffdate2) {
|
||||
$filter[(empty($cutoffdate)?'date':'before')] = date("d-M-Y", $cutoffdate2);
|
||||
if (empty($cutoffdate)) $filter['range'] = "BEFORE";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,7 +168,6 @@ app.classes.mail = AppJS.extend(
|
||||
var nm = this.et2.getWidgetById(this.nm_index);
|
||||
this.mail_isMainWindow = true;
|
||||
this.mail_disablePreviewArea(true);
|
||||
|
||||
//Get initial folder status
|
||||
this.mail_refreshFolderStatus(undefined,undefined,false);
|
||||
|
||||
@ -184,8 +183,9 @@ app.classes.mail = AppJS.extend(
|
||||
tree_wdg.set_onopenstart(jQuery.proxy(this.openstart_tree, this));
|
||||
tree_wdg.set_onopenend(jQuery.proxy(this.openend_tree, this));
|
||||
}
|
||||
// Show vacation notice on load for the current profile
|
||||
this.mail_callRefreshVacationNotice();
|
||||
// Show vacation notice on load for the current profile (if not called by mail_searchtype_change())
|
||||
var alreadyrefreshed = this.mail_searchtype_change();
|
||||
if (!alreadyrefreshed) this.mail_callRefreshVacationNotice();
|
||||
break;
|
||||
case 'mail.display':
|
||||
var self = this;
|
||||
@ -1213,6 +1213,42 @@ app.classes.mail = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable or disable the date filter
|
||||
*
|
||||
* If the searchtype (cat_id) is set to something that needs dates, we enable the
|
||||
* header_right template. Otherwise, it is disabled.
|
||||
*/
|
||||
mail_searchtype_change: function()
|
||||
{
|
||||
var filter = this.et2.getWidgetById('cat_id');
|
||||
var nm = this.et2.getWidgetById(this.nm_index);
|
||||
var dates = this.et2.getWidgetById('mail.index.datefilter');
|
||||
if(nm && filter)
|
||||
{
|
||||
switch(filter.getValue())
|
||||
{
|
||||
case 'bydate':
|
||||
|
||||
if (filter && dates)
|
||||
{
|
||||
dates.set_disabled(false);
|
||||
if (this.et2.getWidgetById('startdate')) jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
|
||||
}
|
||||
this.mail_callRefreshVacationNotice();
|
||||
return true;
|
||||
default:
|
||||
if (dates)
|
||||
{
|
||||
dates.set_disabled(true);
|
||||
}
|
||||
this.mail_callRefreshVacationNotice();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* mail_refreshFilter2Options, function to call with appropriate data to refresh the filter2 options for the active server
|
||||
*
|
||||
@ -1261,14 +1297,14 @@ app.classes.mail = AppJS.extend(
|
||||
},
|
||||
|
||||
/**
|
||||
* mail_refreshFilterOptions, function to call with appropriate data to refresh the filter options for the active server
|
||||
* mail_refreshCatIdOptions, function to call with appropriate data to refresh the filter options for the active server
|
||||
*
|
||||
* @param {object} _data
|
||||
*
|
||||
*/
|
||||
mail_refreshCatIdOptions: function(_data)
|
||||
{
|
||||
//alert('mail_refreshFilterOptions');
|
||||
//alert('mail_refreshCatIdOptions');
|
||||
if (_data == null) return;
|
||||
if (!this.et2 && !this.checkET2()) return;
|
||||
|
||||
@ -1490,8 +1526,9 @@ app.classes.mail = AppJS.extend(
|
||||
*
|
||||
* @param {boolean} _isPopup
|
||||
*/
|
||||
mail_refreshMessageGrid: function(_isPopup) {
|
||||
mail_refreshMessageGrid: function(_isPopup, _refreshVacationNotice) {
|
||||
if (typeof _isPopup == 'undefined') _isPopup = false;
|
||||
if (typeof _refreshVacationNotice == 'undefined') _refreshVacationNotice = false;
|
||||
var nm;
|
||||
if (_isPopup && !this.mail_isMainWindow)
|
||||
{
|
||||
@ -1501,7 +1538,25 @@ app.classes.mail = AppJS.extend(
|
||||
{
|
||||
nm = this.et2.getWidgetById(this.nm_index);
|
||||
}
|
||||
var dates = this.et2.getWidgetById('mail.index.datefilter');
|
||||
var filter = this.et2.getWidgetById('cat_id');
|
||||
if(nm && filter)
|
||||
{
|
||||
nm.activeFilters["startdate"]=null;
|
||||
nm.activeFilters["enddate"]=null;
|
||||
switch(filter.getValue())
|
||||
{
|
||||
case 'bydate':
|
||||
|
||||
if (filter && dates)
|
||||
{
|
||||
if (this.et2.getWidgetById('startdate') && this.et2.getWidgetById('startdate').get_value()) nm.activeFilters["startdate"] = this.et2.getWidgetById('startdate').date;
|
||||
if (this.et2.getWidgetById('enddate') && this.et2.getWidgetById('enddate').get_value()) nm.activeFilters["enddate"] = this.et2.getWidgetById('enddate').date;
|
||||
}
|
||||
}
|
||||
}
|
||||
nm.applyFilters(); // this should refresh the active folder
|
||||
if (_refreshVacationNotice) this.mail_callRefreshVacationNotice();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -661,6 +661,9 @@ div.mailPreviewHeaders div.mail_extraEmails {
|
||||
#mail-index div#mail-index_mailPreview div#mail-index_mailPreviewHeadersSubject > span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
#mail-index_mail-index-header_right {
|
||||
display: inline-flex;
|
||||
}
|
||||
div.mailPreviewHeaders div.mail_extraEmails.visible,
|
||||
div.mailPreviewHeaders #mail-index_previewAttachmentArea.visible {
|
||||
position: absolute;
|
||||
|
@ -4,7 +4,7 @@
|
||||
<overlay>
|
||||
<template id="mail.index.spliter" height="100%" template="" lang="" group="0" version="1.9.001">
|
||||
<split dock_side="bottomDock" id="mailSplitter" orientation="h">
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" template="mail.index.rows" header_left="mail.index.add" header_right="mail.index.quota"/>
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" template="mail.index.rows" header_left="mail.index.add" header_right="mail.index.header_right"/>
|
||||
<vbox id="mailPreview" width="100%">
|
||||
<hbox width="100%" id="mailPreviewHeadersFrom" class="mailPreviewHeaders">
|
||||
<description value="From"/>
|
||||
@ -70,7 +70,7 @@
|
||||
</split>
|
||||
</template>
|
||||
<template id="mail.index.nospliter" template="" lang="" group="0" version="1.9.001">
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" template="mail.index.rows" header_left="mail.index.add" header_right="mail.index.quota"/>
|
||||
<nextmatch id="nm" onselect="app.mail.mail_preview" template="mail.index.rows" header_left="mail.index.add" header_right="mail.index.header_right"/>
|
||||
</template>
|
||||
<template id="mail.index.rows" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%">
|
||||
@ -120,12 +120,16 @@
|
||||
<template id="mail.index.add" template="" lang="" group="0" version="1.9.001">
|
||||
<buttononly id="button[mailcreate]" onclick="app.mail.mail_compose(false);" label="Compose"/>
|
||||
</template>
|
||||
<template id="mail.index.quota" template="" lang="" group="0" version="1.9.001">
|
||||
<hbox class="mail-index_vacation"><vbox>
|
||||
<template id="mail.index.header_right" template="" lang="" group="0" version="1.9.001">
|
||||
<hbox id="mail.index.vacationnotice" class="mail-index_vacation"><vbox>
|
||||
<description id="nm[vacationnotice]" class="@nm[vacationclass]"/>
|
||||
<description id="nm[vacationrange]" class="@nm[vacationrangeclass]"/></vbox>
|
||||
</hbox>
|
||||
<hbox class="mail-index_quotabox"><progress id="nm[quotainpercent]" label="@nm[quota]" class="@nm[quotaclass]"/></hbox>
|
||||
<hbox id="mail.index.datefilter" class="mail-index_datefilter">
|
||||
<date id="startdate" label="Start" onchange="app.mail.mail_refreshMessageGrid(false,true);"/>
|
||||
<date id="enddate" label="End" onchange="app.mail.mail_refreshMessageGrid(false,true);"/>
|
||||
</hbox>
|
||||
<hbox id="mail.index.quotabox" class="mail-index_quotabox"><progress id="nm[quotainpercent]" label="@nm[quota]" class="@nm[quotaclass]"/></hbox>
|
||||
</template>
|
||||
<template id="mail.index" template="" lang="" group="0" version="1.9.001">
|
||||
<tree autoloading="mail.mail_ui.ajax_foldertree" id="nm[foldertree]" onclick="app.mail.mail_changeFolder" parent_node="mail-tree_target" onopenstart="app.mail.subscription_autoloadingStart" onopenend="app.mail.subscription_autoloadingEnd" highlighting="true"/>
|
||||
|
@ -662,6 +662,9 @@ div.mailPreviewHeaders div.mail_extraEmails {
|
||||
#mail-index div#mail-index_mailPreview div#mail-index_mailPreviewHeadersSubject > span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
#mail-index_mail-index-header_right {
|
||||
display: inline-flex;
|
||||
}
|
||||
div.mailPreviewHeaders div.mail_extraEmails.visible,
|
||||
div.mailPreviewHeaders #mail-index_previewAttachmentArea.visible {
|
||||
position: absolute;
|
||||
|
@ -1255,6 +1255,9 @@ input[type=button] {
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
}
|
||||
#mail-index_mail-index-header_right {
|
||||
display: inline-flex;
|
||||
}
|
||||
#mail-index_mailPreview {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
Loading…
Reference in New Issue
Block a user