fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6673] property: use session values for pagination


From: Sigurd Nes
Subject: [Fmsystem-commits] [6673] property: use session values for pagination
Date: Wed, 15 Dec 2010 12:58:04 +0000

Revision: 6673
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6673
Author:   sigurdne
Date:     2010-12-15 12:58:04 +0000 (Wed, 15 Dec 2010)
Log Message:
-----------
property: use session values for pagination

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2010-12-15 11:17:08 UTC (rev 
6672)
+++ trunk/property/inc/class.borequest.inc.php  2010-12-15 12:58:04 UTC (rev 
6673)
@@ -75,41 +75,42 @@
                        $status_id      = phpgw::get_var('status_id');
                        $allrows        = phpgw::get_var('allrows', 'bool');
                        $this->p_num                    = 
phpgw::get_var('p_num');
-                       if ($start)
+
+
+                       if(isset($_POST['start']) || isset($_GET['start']))
                        {
-                               $this->start=$start;
+                               $this->start = $start;
                        }
-                       else
+                       if(isset($_POST['query']) || isset($_GET['query']))
                        {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
                                $this->query = $query;
                        }
-                       if(isset($filter))
+                       if(isset($_POST['filter']) || isset($_GET['filter']))
                        {
                                $this->filter = $filter;
                        }
-                       if(isset($sort))
+                       if(isset($_POST['sort']) || isset($_GET['sort']))
                        {
                                $this->sort = $sort;
                        }
-                       if(isset($order))
+                       if(isset($_POST['order']) || isset($_GET['order']))
                        {
                                $this->order = $order;
                        }
-                       if(isset($cat_id))
+                       if(isset($_POST['cat_id']) || isset($_GET['cat_id']))
                        {
                                $this->cat_id = $cat_id;
                        }
-                       if(isset($status_id))
+                       if(isset($_POST['status_id']) || 
isset($_GET['status_id']))
                        {
-                               $this->status_id = $status_id;
+                               $this->status_id = $district_id;
                        }
-                       if(isset($allrows))
+                       if(isset($_POST['criteria_id']) || 
isset($_GET['criteria_id']))
                        {
+                               $this->criteria_id = $criteria_id;
+                       }
+                       if($allrows)
+                       {
                                $this->allrows = $allrows;
                        }
                }
@@ -133,7 +134,6 @@
                        $this->order    = $data['order'];
                        $this->cat_id   = $data['cat_id'];
                        $this->status_id        = $data['status_id'];
-                       $this->allrows          = $data['allrows'];
                }
 
                function 
select_degree_list($degree_value='',$degreedefault_type='')
@@ -278,7 +278,7 @@
                        for ($i=0; $i<count($request); $i++)
                        {
                                $request[$i]['coordinator'] = 
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
-                               $request[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
+                               $request[$i]['start_date'] = 
$GLOBALS['phpgw']->common->show_date($request[$i]['start_date'],$dateformat);
                                if($cols_extra)
                                {
                                        
$location_data=$this->solocation->read_single($request[$i]['location_code']);

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2010-12-15 11:17:08 UTC (rev 
6672)
+++ trunk/property/inc/class.sorequest.inc.php  2010-12-15 12:58:04 UTC (rev 
6673)
@@ -193,12 +193,12 @@
                        $uicols['descr'][]              = lang('Request');
                        $uicols['statustext'][]         = lang('Request ID');
 
-                       $cols.= ",$entity_table.entry_date";
-                       $cols_return[]                  = 'entry_date';
+                       $cols.= ",$entity_table.start_date";
+                       $cols_return[]                  = 'start_date';
                        $uicols['input_type'][]         = 'text';
-                       $uicols['name'][]               = 'entry_date';
-                       $uicols['descr'][]              = lang('entry date');
-                       $uicols['statustext'][]         = lang('Request entry 
date');
+                       $uicols['name'][]               = 'start_date';
+                       $uicols['descr'][]              = lang('start date');
+                       $uicols['statustext'][]         = lang('Request start 
date');
 
                        $cols.= ",$entity_table.title as title";
                        $cols_return[]                  = 'title';
@@ -249,7 +249,7 @@
                        }
                        else
                        {
-                               $ordermethod = ' order by fm_request.id ASC';
+                               $ordermethod = ' order by fm_request.id DESC';
                        }
 
                        $where = 'WHERE';
@@ -570,18 +570,17 @@
                                $address = 
$this->db->db_addslashes($request['location_name']);
                        }
 
-                       $request['descr'] = 
$this->db->db_addslashes($request['descr']);
-                       $request['name'] = 
$this->db->db_addslashes($request['name']);
-                       $request['title'] = 
$this->db->db_addslashes($request['title']);
+//                     $request['name'] = 
$this->db->db_addslashes($request['name']);
 
                        $value_set = array
                        (
+                               'title'                                 => 
$this->db->db_addslashes($request['title']),
                                'status'                                => 
$request['status'],
                                'category'                              => 
$request['cat_id'],
                                'start_date'                    => 
$request['start_date'],
                                'end_date'                              => 
$request['end_date'],
                                'coordinator'                   => 
$request['coordinator'],
-                               'descr'                                 => 
$request['descr'],
+                               'descr'                                 => 
$this->db->db_addslashes($request['descr']),
                                'budget'                                => 
(int)$request['budget'],
                                'location_code'                 => 
$request['location_code'],
                                'address'                               => 
$address,

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2010-12-15 11:17:08 UTC (rev 
6672)
+++ trunk/property/inc/class.uirequest.inc.php  2010-12-15 12:58:04 UTC (rev 
6673)
@@ -145,8 +145,12 @@
                                $lookup = true;
                        }
 
+                       $this->save_sessiondata();
+
+                       $dry_run = false;
+
                        if( phpgw::get_var('phpgw_return_as') != 'json' )
-                        {
+                       {
 
                                if(!$lookup)
                                {
@@ -157,11 +161,11 @@
                                        (
                                                'menuaction'                    
=> 'property.uirequest.index',
                                                                        
'lookup'    => $lookup,
-                                                                       
'cat_id'        => $this->cat_id,
-                                                                       
'filter'        => $this->filter,
-                                                                       
'status_id'     => $this->status_id,
+                                       //                              
'cat_id'        => $this->cat_id,
+                                       //                              
'filter'        => $this->filter,
+                                       //                              
'status_id'     => $this->status_id,
                                                                        
'project_id'    => $project_id,
-                                                                       'query' 
        => $this->query,
+                                       //                              'query' 
        => $this->query,
                                                                        'p_num' 
        => $this->p_num,
                                        ));
                                $datatable['config']['allow_allrows'] = true;
@@ -170,10 +174,10 @@
                                                                                
."p_num: '{$this->p_num}',"
                                                                                
                ."query:'{$this->query}',"
                                                                                
."lookup:'{$lookup}',"
-                                                                               
                        ."project_id:'{$project_id}',"
-                                                                               
."filter:'{$this->filter}',"
-                                                                               
."status_id:'{$this->status_id}',"
-                                                                               
."cat_id:'{$this->cat_id}'";
+                                                                               
                        ."project_id:'{$project_id}'";
+                                                       //                      
  ."filter:'{$this->filter}',"
+                                                       //                      
  ."status_id:'{$this->status_id}',"
+                                                       //                      
  ."cat_id:'{$this->cat_id}'";
 
                                $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True));
                                $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
@@ -192,12 +196,12 @@
                                                'action'        => 
$GLOBALS['phpgw']->link('/index.php',
                                                                array(
                                                                        
'menuaction'            => 'property.uirequest.index',
-                                                                       
'lookup'                        => $lookup,
-                                                                       
'cat_id'        => $this->cat_id,
-                                                                       
'filter'        => $this->filter,
-                                                                       
'status_id'     => $this->status_id,
-                                                                       
'project_id'    => $project_id,
-                                                                       'query' 
        => $this->query
+                                                                       
'lookup'                => $lookup,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       
'filter'                        => $this->filter,
+                                                                       
'status_id'                     => $this->status_id,
+                                                                       
'project_id'            => $project_id,
+                                                                       'query' 
                        => $this->query
                                                                )
                                                        ),
                                                'fields'        => array(
@@ -310,10 +314,11 @@
                                {
                                        
unset($datatable['actions']['form'][0]['fields']['field'][4]);
                                }
+                               $dry_run = true;
                        }
 
                        $request_list = array();
-                       $request_list = $this->bo->read(array('project_id' => 
1,'allrows'=>$this->allrows));
+                       $request_list = $this->bo->read(array('project_id' => 
1,'allrows'=>$this->allrows, 'dry_run' => $dry_run));
                        $uicols = $this->bo->uicols;
 
                        $j=0;
@@ -499,7 +504,7 @@
                                        
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
                                        
$datatable['headers']['header'][$i]['sortable']                 = false;
 
-                                       if($uicols['name'][$i]=='request_id' || 
$uicols['name'][$i]=='budget' ||  $uicols['name'][$i]=='score')
+                                       if($uicols['name'][$i]=='request_id' || 
$uicols['name'][$i]=='budget' ||  $uicols['name'][$i]=='score' ||  
$uicols['name'][$i]=='start_date')
                                        {
                                                
$datatable['headers']['header'][$i]['sortable']         = true;
                                                
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
@@ -544,21 +549,22 @@
                        $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
 
+                       if($dry_run)
+                       {
+                                       
$datatable['pagination']['records_returned'] = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];           
         
+                       }
+                       else
+                       {
+                               $datatable['pagination']['records_returned']= 
count($entity_list);
+                       }
+
+
+
                        $appname                                        = 
lang('request');
                        $function_msg                           = lang('list 
request');
 
                        if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                           //avoid ,in the last page, reformate paginator when 
records are lower than records_returned
-                               if(count($request_list) <= 
$datatable['pagination']['records_limit'])
-                               {
-                                       
$datatable['pagination']['records_returned']= count($request_list);
-                               }
-                               else
-                               {
-                                       
$datatable['pagination']['records_returned']= 
$datatable['pagination']['records_limit'];
-                               }
-
                            $datatable['sorting']['currentPage']        = 1;
                            $datatable['sorting']['order']      = 'request_id'; 
// name key Column in myColumnDef
                            $datatable['sorting']['sort']       = 'asc'; // ASC 
/ DESC
@@ -566,24 +572,11 @@
                    else
                    {
                                $datatable['sorting']['currentPage']    = 
phpgw::get_var('currentPage');
-                           $datatable['pagination']['records_returned']= 
phpgw::get_var('recordsReturned', 'int');
                            $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // name of column of Database
                            $datatable['sorting']['sort']       = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                    }
 
-                       phpgwapi_yui::load_widget('dragdrop');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('menu');
-                       phpgwapi_yui::load_widget('connection');
-                       //// cramirez: necesary for include a partucular js
-                       phpgwapi_yui::load_widget('loader');
-                       //cramirez: necesary for use opener . Avoid error JS
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('paginator');
-                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
-                       phpgwapi_yui::load_widget('animation');
 
-
 //-- BEGIN----------------------------- JSON CODE 
------------------------------
 
                //values for Pagination
@@ -599,20 +592,23 @@
                        );
 
                                // values for datatable
-                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
                                foreach( $datatable['rows']['row'] as $row )
                                {
                                        $json_row = array();
                                        foreach( $row['column'] as $column)
                                        {
+
                                                if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
                                                {
                                                        
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                                                }
-                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               else 
if(isset($column['format']) && $column['format']== "link")
                                                {
                                                  $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
-                                               }else
+                                               }
+                                               else
                                                {
                                                  $json_row[$column['name']] = 
$column['value'];
                                                }
@@ -636,6 +632,17 @@
                        $datatable['json_data'] = json_encode($json);
 //-------------------- JSON CODE ----------------------
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
 
                        // Prepare template variables and process XSLT
                        $template_vars = array();
@@ -660,9 +667,6 @@
 
                        // Prepare YUI Library
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'request.index', 'property' );
-
-                       //$this->save_sessiondata();
-
                }
 
 




reply via email to

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