diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 7503b1b17d..8dfcad092a 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -34,59 +34,78 @@ function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl) { //echo "

nextmatch_widget.pre_process: value = "; _debug_array($value); - // save values in persistent extension_data to be able use it in post_process - //$extension_data = $value; list($app,$class,$method) = explode('.',$value['get_rows']); $obj = CreateObject($app.'.'.$class); if (!is_object($obj)) { echo "

nextmatch_widget::pre_process($name): '$value[get_rows]' is no valid method !!!

\n"; - return; + //return; + } + else + { + $total = $value['total'] = $obj->$method($value,$value['rows'],$readonlys['rows']); } - $total = $value['total'] = $obj->$method($value,$value['rows'],$readonlys['rows']); if ($value['start'] > $total) { $value['start'] = 0; $total = $obj->$method($value,$value['rows'],$readonlys['rows']); } - if ($cell['size']) // template name can be supplied either in $value['template'] or the options-field + list($template,$options) = explode(',',$cell['size']); + if ($template) // template name can be supplied either in $value['template'] or the options-field { - $value['template'] = $cell['size']; + $value['template'] = $template; } if (!is_object($value['template'])) { $value['template'] = new etemplate($value['template'],$tmpl->as_array()); } - $nextmatch = new etemplate('etemplate.nextmatch_widget'); - - if ($value['no_cat']) + if ($total < 1) { - $nextmatch->disable_cells('cat_id'); + $value['template']->data[0]['h2'] = ',1'; // disable the data row } - if ($value['no_filter']) - { - $nextmatch->disable_cells('filter'); - } - if ($value['no_filter2']) - { - $nextmatch->disable_cells('filter2'); - } - $start = $value['start']; $max = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; - $end = $start+$max > $total ? $total : $start+$max; - $value['range'] = (1+$start) . ' - ' . $end; - $nextmatch->set_cell_attribute('first','readonly',$start <= 0); - $nextmatch->set_cell_attribute('left', 'readonly',$start <= 0); - $nextmatch->set_cell_attribute('right','readonly',$start+$max >= $total); - $nextmatch->set_cell_attribute('last', 'readonly',$start+$max >= $total); + if ($total <= $max && $options && $value['search'] == '' && + ($value['no_cat'] || !$value['cat_id']) && + ($value['no_filter'] || !$value['filter'] || $value['filter'] == 'none') && + ($value['no_filter2'] || !$value['filter2'] || $value['filter2'] == 'none')) + { // disable whole nextmatch line if no scrolling necessary + $cell['size'] = $cell['name'].'[rows]'; + $cell['obj'] = &$value['template']; + $cell['name'] = $value['template']->name; + } + else + { + $nextmatch = new etemplate('etemplate.nextmatch_widget'); + if ($value['no_cat']) + { + $nextmatch->disable_cells('cat_id'); + } + if ($value['no_filter']) + { + $nextmatch->disable_cells('filter'); + } + if ($value['no_filter2']) + { + $nextmatch->disable_cells('filter2'); + } + $start = $value['start']; + $end = $start+$max > $total ? $total : $start+$max; + $value['range'] = $total ? (1+$start) . ' - ' . $end : '0'; + $nextmatch->set_cell_attribute('first','readonly',$start <= 0); + $nextmatch->set_cell_attribute('left', 'readonly',$start <= 0); + $nextmatch->set_cell_attribute('right','readonly',$start+$max >= $total); + $nextmatch->set_cell_attribute('last', 'readonly',$start+$max >= $total); + + $cell['size'] = $cell['name']; + $cell['obj'] = &$nextmatch; + $cell['name'] = $nextmatch->name; + } $cell['type'] = 'template'; - $cell['size'] = $cell['name']; - $cell['obj'] = &$nextmatch; - $cell['name'] = $nextmatch->name; $cell['label'] = $cell['help'] = ''; + // save values in persistent extension_data to be able use it in post_process $extension_data = $value; return False; // NO extra Label @@ -97,17 +116,16 @@ //echo "

nextmatch_widget.post_process: value = "; _debug_array($value); $old_value = $extension_data; - $value['start'] = $old_value['start']; // need to be set, to be reported back $max = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; - $loop = False; - if ($value['start_search'] || $value['cat_id'] != $old_value['cat_id'] || + if (is_array($value) && ($value['start_search'] || $value['cat_id'] != $old_value['cat_id'] || $old_value['filter'] != '' && $value['filter'] != $old_value['filter'] || - $old_value['filter2'] != '' && $value['filter2'] != $old_value['filter2']) + $old_value['filter2'] != '' && $value['filter2'] != $old_value['filter2'])) { //echo "

search='$old_value[search]'->'$value[search]', filter='$old_value[filter]'->'$value[filter]', filter2='$old_value[filter2]'->'$value[filter2]'
"; //echo "new filter --> loop

"; - //_debug_array($old_value); + //echo "value ="; _debug_array($value); + //echo "old_value ="; _debug_array($old_value); $loop = True; } elseif ($value['first']) @@ -130,6 +148,8 @@ $value['start'] = (int) (($old_value['total']-2) / $max) * $max; $loop = True; } + $value['start'] = $old_value['start']; // need to be set, to be reported back + return True; } - } \ No newline at end of file + } diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index 6b24ecf9cd..9a35fba366 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -108,7 +108,12 @@ function get_rows($query,&$rows,&$readonlys) { //echo "

uiinfolog.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]')

\n"; - + $GLOBALS['phpgw']->session->appsession('session_data','infolog',array( + 'search' => $query['search'], + 'start' => $query['start'], + 'filter' => $query['filter'], + 'cat_id' => $query['cat_id'] + )); $ids = $this->bo->search($query['order'],$query['sort'],$query['filter'],$query['cat_id'], $query['search'],$query['action'],$query['action_id'],$query['ordermethod'], $query['start'],$total); @@ -140,9 +145,12 @@ } else { - $data = $values['nm']; - unset($data['rows']); - $GLOBALS['phpgw']->session->appsession('session_data','infolog',$data); + $GLOBALS['phpgw']->session->appsession('session_data','infolog',array( + 'search' => $values['nm']['search'], + 'start' => $values['nm']['start'], + 'filter' => $values['nm']['filter'], + 'cat_id' => $values['nm']['cat_id'] + )); } $action = $action ? $action : $values['action']; $action_id = $action_id ? $action_id : $values['action_id']; @@ -159,7 +167,7 @@ { list($do,$do_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']); list($do_id) = @each($do_id); - //echo "

infolog::index: do='$do/$do_id', referer="; _debug_array($referer); + echo "

infolog::index: do='$do/$do_id', referer="; _debug_array($referer); switch($do) { case 'edit': diff --git a/infolog/setup/etemplates.inc.php b/infolog/setup/etemplates.inc.php index b6c380fe8a..1761b59774 100644 --- a/infolog/setup/etemplates.inc.php +++ b/infolog/setup/etemplates.inc.php @@ -1,5 +1,5 @@ 'infolog.index','template' => '','lang' => '','g $templ_data[] = array('name' => 'infolog.index','template' => '','lang' => '','group' => '0','version' => '0.9.15.002','data' => 'a:6:{i:0;a:2:{s:1:\"A\";s:3:\"90%\";s:2:\"h3\";s:7:\",!@main\";}i:1;a:5:{s:1:\"A\";a:4:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:7:\"InfoLog\";s:4:\"name\";s:9:\"appheader\";}s:1:\"B\";a:3:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:4:\"Add:\";}s:1:\"C\";a:6:{s:4:\"type\";s:6:\"button\";s:4:\"size\";s:4:\"task\";s:5:\"label\";s:4:\"ToDo\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:9:\"add[task]\";s:4:\"help\";s:14:\"Add a new ToDo\";}s:1:\"D\";a:5:{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:1:\"E\";a:5:{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\";}}i:2;a:5:{s:1:\"A\";a:2:{s:4:\"type\";s:5:\"hrule\";s:4:\"span\";s:3:\"all\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"D\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"E\";a:1:{s:4:\"type\";s:5:\"label\";}}i:3;a:5:{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:4:\"rows\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"D\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"E\";a:1:{s:4:\"type\";s:5:\"label\";}}i:4;a:5:{s:1:\"A\";a:4:{s:4:\"type\";s:9:\"nextmatch\";s:4:\"size\";s:18:\"infolog.index.rows\";s:4:\"span\";s:3:\"all\";s:4:\"name\";s:2:\"nm\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"D\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"E\";a:1:{s:4:\"type\";s:5:\"label\";}}i:5;a:5:{s:1:\"A\";a:5:{s:4:\"type\";s:6:\"button\";s:4:\"span\";s:3:\"all\";s:5:\"label\";s:3:\"Add\";s:4:\"name\";s:9:\"add[note]\";s:4:\"help\";s:15:\"Add a new Entry\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"D\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"E\";a:1:{s:4:\"type\";s:5:\"label\";}}}','size' => '100%,,0,,0,0','style' => '.headertext { color: black; font-size: 120%; }','modified' => '1034538966',); -$templ_data[] = array('name' => 'infolog.index','template' => '','lang' => '','group' => '0','version' => '0.9.15.003','data' => 'a:6:{i:0;a:2:{s:1:\"A\";s:3:\"95%\";s:2:\"h3\";s:7:\",!@main\";}i:1;a:3:{s:1:\"A\";a:4:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:7:\"InfoLog\";s:4:\"name\";s:9:\"appheader\";}s:1:\"B\";a:4:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:4:\"Add:\";s:5:\"align\";s:5:\"right\";}s:1:\"C\";a:5:{s:4:\"type\";s:4:\"hbox\";s:4:\"size\";s:1:\"3\";i:1;a:6:{s:4:\"type\";s:6:\"button\";s:4:\"size\";s:4:\"task\";s:5:\"label\";s:4:\"ToDo\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:9:\"add[task]\";s:4:\"help\";s:14:\"Add a new ToDo\";}i:2;a:5:{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\";}i:3;a:5:{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\";}}}i:2;a:3:{s:1:\"A\";a:2:{s:4:\"type\";s:5:\"hrule\";s:4:\"span\";s:3:\"all\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:3;a:3:{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:18:\"infolog.index.rows\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:4;a:3:{s:1:\"A\";a:4:{s:4:\"type\";s:9:\"nextmatch\";s:4:\"size\";s:18:\"infolog.index.rows\";s:4:\"span\";s:3:\"all\";s:4:\"name\";s:2:\"nm\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:5;a:3:{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:4:{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\";}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:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}}','size' => '100%,,0,,0,0','style' => '.headertext { color: black; font-size: 120%; }','modified' => '1034554189',); +$templ_data[] = array('name' => 'infolog.index','template' => '','lang' => '','group' => '0','version' => '0.9.15.003','data' => 'a:6:{i:0;a:2:{s:1:\"A\";s:3:\"95%\";s:2:\"h3\";s:7:\",!@main\";}i:1;a:3:{s:1:\"A\";a:4:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:7:\"InfoLog\";s:4:\"name\";s:9:\"appheader\";}s:1:\"B\";a:4:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:11:\",headertext\";s:5:\"label\";s:4:\"Add:\";s:5:\"align\";s:5:\"right\";}s:1:\"C\";a:5:{s:4:\"type\";s:4:\"hbox\";s:4:\"size\";s:1:\"3\";i:1;a:6:{s:4:\"type\";s:6:\"button\";s:4:\"size\";s:4:\"task\";s:5:\"label\";s:4:\"ToDo\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:9:\"add[task]\";s:4:\"help\";s:14:\"Add a new ToDo\";}i:2;a:5:{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\";}i:3;a:5:{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\";}}}i:2;a:3:{s:1:\"A\";a:2:{s:4:\"type\";s:5:\"hrule\";s:4:\"span\";s:3:\"all\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:3;a:3:{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:18:\"infolog.index.rows\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:4;a:3:{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\";}s:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}i:5;a:3:{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:4:{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\";}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:1:\"C\";a:1:{s:4:\"type\";s:5:\"label\";}}}','size' => '100%,,0,,0,0','style' => '.headertext { color: black; font-size: 120%; }','modified' => '1034772949',); $templ_data[] = array('name' => 'infolog.index.rows','template' => '','lang' => '','group' => '0','version' => '0.9.15.001','data' => 'a:3:{i:0;a:9:{s:1:\"A\";s:2:\"2%\";s:1:\"B\";s:2:\"4%\";s:1:\"D\";s:2:\"8%\";s:1:\"E\";s:2:\"8%\";s:1:\"F\";s:2:\"8%\";s:1:\"G\";s:2:\"3%\";s:1:\"H\";s:2:\"3%\";s:2:\"c1\";s:2:\"th\";s:2:\"c2\";s:3:\"row\";}i:1;a:8:{s:1:\"A\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:4:\"Type\";}s:1:\"B\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:6:\"Status\";}s:1:\"C\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:7:\"Subject\";}s:1:\"D\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:17:\"Startdate Enddate\";}s:1:\"E\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:17:\"Owner Responsible\";}s:1:\"F\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:12:\"last changed\";}s:1:\"G\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:3:\"Sub\";}s:1:\"H\";a:2:{s:4:\"type\";s:5:\"label\";s:5:\"label\";s:6:\"Action\";}}i:2;a:8:{s:1:\"A\";a:4:{s:4:\"type\";s:5:\"image\";s:5:\"label\";s:20:\"$row_cont[info_type]\";s:5:\"align\";s:6:\"center\";s:4:\"name\";s:17:\"${row}[info_type]\";}s:1:\"B\";a:4:{s:4:\"type\";s:5:\"image\";s:5:\"label\";s:22:\"$row_cont[info_status]\";s:5:\"align\";s:6:\"center\";s:4:\"name\";s:19:\"${row}[info_status]\";}s:1:\"C\";a:3:{s:4:\"type\";s:5:\"label\";s:7:\"no_lang\";s:1:\"1\";s:4:\"name\";s:20:\"${row}[info_subject]\";}s:1:\"D\";a:3:{s:4:\"type\";s:4:\"date\";s:4:\"name\";s:22:\"${row}[info_startdate]\";s:8:\"readonly\";s:1:\"1\";}s:1:\"E\";a:4:{s:4:\"type\";s:8:\"template\";s:4:\"size\";s:4:\"$row\";s:4:\"name\";s:5:\"owner\";s:8:\"readonly\";s:1:\"1\";}s:1:\"F\";a:4:{s:4:\"type\";s:14:\"select-account\";s:4:\"size\";s:11:\",accounts,0\";s:4:\"name\";s:25:\"${row}[info_lastmodified]\";s:8:\"readonly\";s:1:\"1\";}s:1:\"G\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"H\";a:5:{s:4:\"type\";s:6:\"button\";s:4:\"size\";s:8:\"edit.gif\";s:5:\"label\";s:4:\"Edit\";s:4:\"name\";s:24:\"edit[$row_cont[info_id]]\";s:4:\"help\";s:14:\"Edit the entry\";}}}','size' => '','style' => '','modified' => '1034352181',); diff --git a/infolog/templates/default/index.xet b/infolog/templates/default/index.xet index 500067f442..7a1cc15b31 100644 --- a/infolog/templates/default/index.xet +++ b/infolog/templates/default/index.xet @@ -67,6 +67,10 @@ + + + + @@ -90,7 +94,7 @@ - +