feature to be able to filter by startdate

This commit is contained in:
Klaus Leithoff 2009-11-10 08:11:41 +00:00
parent 3ea7a80876
commit 0bfb18470d
3 changed files with 31 additions and 3 deletions

View File

@ -119,6 +119,7 @@ class infolog_bo
'open-today' => 'open',
'open-overdue' => 'overdue',
'upcoming' => 'upcoming',
'bydate' => 'startdate',
);
/**

View File

@ -286,6 +286,25 @@ class infolog_ui
*/
function get_rows(&$query,&$rows,&$readonlys)
{
$orginal_colfilter = $query['col_filter'];
if ($query['filter'] == 'bydate')
{
$query['header_left'] = 'infolog.index.dates';
$GLOBALS['egw']->js->set_onload("set_style_by_class('table','custom_hide','visibility','visible');");
if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate > '.$GLOBALS['egw']->db->quote($query['startdate']);
if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate < '.$GLOBALS['egw']->db->quote($query['enddate']);
//unset($query['startdate']);
//unset($query['enddate']);
}
else
{
unset($query['header_left']);
unset($query['startdate']);
unset($query['enddate']);
}
//_debug_array($query);
//_debug_array($query['col_filter']);
//echo "<p>infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])</p>\n";
if (!isset($query['start'])) $query['start'] = 0;
@ -343,6 +362,7 @@ class infolog_ui
$query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields',$columselection));
$infos = $this->bo->search($query);
$query['col_filter'] = $orginal_colfilter;
if (!is_array($infos))
{
$infos = array( );
@ -599,7 +619,6 @@ class infolog_ui
$readonlys['cancel'] = $action != 'sp';
$this->tmpl->read('infolog.index');
if ($colfilter) $values['nm']['col_filter'] = $persist['col_filter'] = $colfilter;
$values['nm']['options-filter'] = $this->filters;
$values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows';
@ -628,10 +647,16 @@ class infolog_ui
}
}
$values['nm']['header_right'] = 'infolog.index.header_right';
if ($extra_app_header)
if ($extra_app_header && $values['nm']['filter']!='bydate')
{
$values['nm']['header_left'] = 'infolog.index.header_left';
}
if ($values['nm']['filter']=='bydate')
{
foreach (array_keys($values['nm']['col_filter']) as $colfk) if (is_int($colfk)) unset($values['nm']['col_filter']);
$values['nm']['header_left'] = 'infolog.index.dates';
$GLOBALS['egw']->js->set_onload("set_style_by_class('table','custom_hide','visibility','visible');");
}
$values['nm']['bottom_too'] = True;
$values['nm']['never_hide'] = isset($this->prefs['never_hide']) ?
$this->prefs['never_hide'] : $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 15;

View File

@ -2,7 +2,7 @@
/**
* eGroupWare - eTemplates for Application infolog
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2009-10-05 10:55
* generated by soetemplate::dump4setup() 2009-11-10 08:57
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package infolog
@ -43,6 +43,8 @@ $templ_data[] = array('name' => 'infolog.edit.project','template' => '','lang' =
$templ_data[] = array('name' => 'infolog.index','template' => '','lang' => '','group' => '0','version' => '1.7.003','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:6:{s:1:"A";s:3:"90%";s:2:"h3";s:2:",1";s:2:"h2";s:6:",!@msg";s:2:"c6";s:7:"noPrint";s:2:"h4";s:7:",!@main";s:2:"h1";s:6:",!@css";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"span";s:3:"all";s:4:"name";s:3:"css";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:5:"align";s:6:"center";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:8:"template";s:4:"name";s:11:"header_left";}s:1:"B";a:2:{s:4:"type";s:8:"template";s:4:"name";s:12:"header_right";}}i:4;a:2:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:4:"main";s:4:"span";s:3:"all";s:4:"name";s:27:"infolog.index.rows-noheader";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:4:{s:4:"type";s:9:"nextmatch";s:4:"size";s:20:"infolog.index.rows,1";s:4:"span";s:3:"all";s:4:"name";s:2:"nm";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:5:{s:4:"type";s:6:"button";s:5:"label";s:3:"Add";s:4:"name";s:9:"add[note]";s:4:"help";s:15:"Add a new Entry";s:7:"onclick";s:245:"window.open(egw::link(\'/index.php\',\'menuaction=infolog.infolog_ui.edit&type=note&action=$cont[action]&action_id=$cont[action_id]&cat_id={$cont[nm][cat_id]}\'),\'_blank\',\'dependent=yes,width=750,height=600,scrollbars=yes,status=yes\'); return false;";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:6:"cancel";s:4:"help";s:17:"Back to main list";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:6;s:4:"cols";i:2;s:4:"size";s:12:"100%,,0,,0,0";}}','size' => '100%,,0,,0,0','style' => '','modified' => '1242996117',);
$templ_data[] = array('name' => 'infolog.index.dates','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:10:{s:4:"type";s:4:"hbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"4";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Start";}i:2;a:2:{s:4:"type";s:4:"date";s:4:"name";s:9:"startdate";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"End";}i:4;a:3:{s:4:"type";s:4:"date";s:4:"name";s:7:"enddate";s:4:"help";s:30:"Leave it empty for a full week";}s:4:"span";s:12:",custom_hide";}}','size' => '','style' => '.custom_hide { visibility: hidden; }','modified' => '1257761831',);
$templ_data[] = array('name' => 'infolog.index.header_left','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:1:{i:0;a:3:{s:4:"type";s:5:"label";s:4:"span";s:16:",headertext bold";s:5:"label";s:7:"InfoLog";}}','size' => ',,0,,0,0','style' => '.bold { font-weight: bold; }','modified' => '1056876864',);
$templ_data[] = array('name' => 'infolog.index.header_right','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:3:{s:4:"type";s:5:"label";s:4:"span";s:11:",headertext";s:5:"label";s:4:"Add:";}i:2;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"task";s:5:"label";s:4:"ToDo";s:4:"name";s:9:"add[task]";s:4:"help";s:14:"Add a new ToDo";s:7:"onclick";s:239:"window.open(egw::link(\'/index.php\',\'menuaction=infolog.infolog_ui.edit&type=task&action=$cont[action]&action_id=$cont[action_id]&cat_id=$cont[cat_id]\'),\'_blank\',\'dependent=yes,width=750,height=600,scrollbars=yes,status=yes\'); return false;";}i:3;a:6:{s:4:"type";s:6:"button";s:4:"size";s:5:"phone";s:5:"label";s:9:"Phonecall";s:4:"name";s:10:"add[phone]";s:4:"help";s:19:"Add a new Phonecall";s:7:"onclick";s:240:"window.open(egw::link(\'/index.php\',\'menuaction=infolog.infolog_ui.edit&type=phone&action=$cont[action]&action_id=$cont[action_id]&cat_id=$cont[cat_id]\'),\'_blank\',\'dependent=yes,width=750,height=600,scrollbars=yes,status=yes\'); return false;";}i:4;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"note";s:5:"label";s:4:"Note";s:4:"name";s:9:"add[note]";s:4:"help";s:14:"Add a new Note";s:7:"onclick";s:239:"window.open(egw::link(\'/index.php\',\'menuaction=infolog.infolog_ui.edit&type=note&action=$cont[action]&action_id=$cont[action_id]&cat_id=$cont[cat_id]\'),\'_blank\',\'dependent=yes,width=750,height=600,scrollbars=yes,status=yes\'); return false;";}}}','size' => ',,0,,0,0','style' => '','modified' => '1253434184',);