phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.nextmatch_widget.inc.php,1.1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.nextmatch_widget.inc.php,1.10,1.11
Date: Wed, 16 Oct 2002 10:07:42 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv10588

Modified Files:
        class.nextmatch_widget.inc.php 
Log Message:
- no empty data-line shown, if no data
- added option to disable nextmatch, if total entries <= nextmatch-max and no 
search, filter or cat set


Index: class.nextmatch_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.nextmatch_widget.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.nextmatch_widget.inc.php      1 Oct 2002 18:26:30 -0000       1.10
--- class.nextmatch_widget.inc.php      16 Oct 2002 14:07:14 -0000      1.11
***************
*** 35,40 ****
                {
                        //echo "<p>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']);
--- 35,38 ----
***************
*** 43,49 ****
                        {
                                echo "<p>nextmatch_widget::pre_process($name): 
'$value[get_rows]' is no valid method !!!</p>\n";
!                               return;
                        }
-                       $total = $value['total'] = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        if ($value['start'] > $total)
                        {
--- 41,50 ----
                        {
                                echo "<p>nextmatch_widget::pre_process($name): 
'$value[get_rows]' is no valid method !!!</p>\n";
!                               //return;
!                       }
!                       else
!                       {
!                               $total = $value['total'] = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        }
                        if ($value['start'] > $total)
                        {
***************
*** 51,57 ****
                                $total = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        }
!                       if ($cell['size'])      // template name can be 
supplied either in $value['template'] or the options-field
                        {
!                               $value['template'] = $cell['size'];
                        }
                        if (!is_object($value['template']))
--- 52,59 ----
                                $total = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        }
!                       list($template,$options) = explode(',',$cell['size']);
!                       if ($template)  // template name can be supplied either 
in $value['template'] or the options-field
                        {
!                               $value['template'] = $template;
                        }
                        if (!is_object($value['template']))
***************
*** 59,91 ****
                                $value['template'] = new 
etemplate($value['template'],$tmpl->as_array());
                        }
!                       $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'];
                        $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);
! 
                        $cell['type'] = 'template';
-                       $cell['size'] = $cell['name'];
-                       $cell['obj'] = &$nextmatch;
-                       $cell['name'] = $nextmatch->name;
                        $cell['label'] = $cell['help'] = '';
  
                        $extension_data = $value;
  
--- 61,110 ----
                                $value['template'] = new 
etemplate($value['template'],$tmpl->as_array());
                        }
!                       if ($total < 1)
                        {
!                               $value['template']->data[0]['h2'] = ',1';       
// disable the data row
                        }
                        $max   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
!                       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['label'] = $cell['help'] = '';
  
+                       // save values in persistent extension_data to be able 
use it in post_process
                        $extension_data = $value;
  
***************
*** 98,112 ****
                        $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'] ||
                            $old_value['filter'] != '' && $value['filter'] != 
$old_value['filter'] ||
!                           $old_value['filter2'] != '' && $value['filter2'] != 
$old_value['filter2'])
                        {
                                //echo 
"<p>search='$old_value[search]'->'$value[search]', 
filter='$old_value[filter]'->'$value[filter]', 
filter2='$old_value[filter2]'->'$value[filter2]'<br>";
                                //echo "new filter --> loop</p>";
!                               //_debug_array($old_value);
                                $loop = True;
                        }
--- 117,130 ----
                        $old_value = $extension_data;
  
                        $max   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        $loop = False;
!                       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']))
                        {
                                //echo 
"<p>search='$old_value[search]'->'$value[search]', 
filter='$old_value[filter]'->'$value[filter]', 
filter2='$old_value[filter2]'->'$value[filter2]'<br>";
                                //echo "new filter --> loop</p>";
!                               //echo "value ="; _debug_array($value);
!                               //echo "old_value ="; _debug_array($old_value);
                                $loop = True;
                        }
***************
*** 131,135 ****
                                $loop = True;
                        }
                        return True;
                }
!       }
\ No newline at end of file
--- 149,155 ----
                                $loop = True;
                        }
+                       $value['start'] = $old_value['start'];  // need to be 
set, to be reported back
+                       
                        return True;
                }
!       }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]