fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13848] fixing datatable and forms


From: Saul
Subject: [Fmsystem-commits] [13848] fixing datatable and forms
Date: Fri, 04 Sep 2015 00:19:43 +0000

Revision: 13848
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13848
Author:   psaul
Date:     2015-09-04 00:19:42 +0000 (Fri, 04 Sep 2015)
Log Message:
-----------
fixing datatable and forms

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.soapplication.inc.php
    branches/dev-syncromind/booking/inc/class.socommon.inc.php
    branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
    branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
    branches/dev-syncromind/booking/inc/class.uicompleted_reservation.inc.php
    
branches/dev-syncromind/booking/inc/class.uicompleted_reservation_export.inc.php
    branches/dev-syncromind/booking/inc/class.uidocument.inc.php
    branches/dev-syncromind/booking/inc/class.uipermission.inc.php
    branches/dev-syncromind/booking/inc/class.uipermission_season.inc.php
    branches/dev-syncromind/booking/inc/class.uiresource.inc.php
    branches/dev-syncromind/booking/inc/class.uiseason.inc.php
    branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php
    branches/dev-syncromind/booking/templates/base/application.xsl

Modified: branches/dev-syncromind/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soapplication.inc.php     
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.soapplication.inc.php     
2015-09-04 00:19:42 UTC (rev 13848)
@@ -8,7 +8,7 @@
                        parent::__construct('bb_application', 
                                array(
                                        'id'            => array('type' => 
'int'),
-                    'id_string' => array('type' => 'string', 'required' => 
false, 'default' => '0', 'query' => true),
+                                        'id_string' => array('type' => 
'string', 'required' => false, 'default' => '0', 'query' => true),
                                        'active'        => array('type' => 
'int'),
                                        'display_in_dashboard' => array('type' 
=> 'int'),
                                        'type'          => array('type' => 
'string'),
@@ -40,7 +40,7 @@
                                                        'column'        => 
'name'
                                        )),
                                        'description'   => array('type' => 
'string', 'query' => true, 'required' => true),
-                    'equipment'        => array('type' => 'string', 'query' => 
true, 'required' => false),
+                                        'equipment'    => array('type' => 
'string', 'query' => true, 'required' => false),
                                        'contact_name'  => array('type' => 
'string', 'query' => true, 'required'=> true),
                                        'contact_email' => array('type' => 
'string', 'required'=> true, 'sf_validator' => 
createObject('booking.sfValidatorEmail', array(), array('invalid' => '%field% 
is invalid'))),
                                        'contact_phone' => array('type' => 
'string'),

Modified: branches/dev-syncromind/booking/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.socommon.inc.php  2015-09-03 
16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.socommon.inc.php  2015-09-04 
00:19:42 UTC (rev 13848)
@@ -433,8 +433,9 @@
                                }
                        }
                        
-//                echo($condition);exit();
                        $base_sql = "SELECT $cols FROM $this->table_name $joins 
WHERE $condition $order ";
+//                        echo $base_sql;
+//                        exit();
                         
                        if ($results) 
                        {

Modified: branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2015-09-04 00:19:42 UTC (rev 13848)
@@ -34,7 +34,7 @@
                                                                  
'building_id', 'building_name', 
                                                                  'season_id', 
'season_name', 
                                              'organization_id', 
'organization_name', 
-                                             'shortname', 'from_', 'to_', 
'active');
+                                             'organization_shortname', 
'from_', 'to_', 'active');
                }
                
                public function index()
@@ -43,9 +43,11 @@
                                return $this->query();
                        }
                        self::add_javascript('booking', 'booking', 
'allocation_list.js');
-                       self::add_javascript('booking', 'booking', 
'datatable.js');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('paginator');
+//                     self::add_javascript('booking', 'booking', 
'datatable.js');
+//                     phpgwapi_yui::load_widget('datatable');
+//                     phpgwapi_yui::load_widget('paginator');
+                        phpgwapi_jquery::load_widget('menu');
+                        phpgwapi_jquery::load_widget('autocomplete');
                         $build_id = phpgw::get_var('buildings', 'int', 
'REQUEST', null);
                        $data = array(
                                'form' => array(
@@ -104,9 +106,8 @@
                                                        'formatter' => 
'JqueryPortico.formatLink'
                                                ),
                                                array(
-                                                       'key' => 'shortname',
-                                                       'label' => 
lang('Organization shortname'),
-                                                        'sortable' => false
+                                                       'key' => 
'organization_shortname',
+                                                       'label' => 
lang('Organization shortname')
                                                ),
                                                array(
                                                        'key' => 
'building_name',

Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-09-04 00:19:42 UTC (rev 13848)
@@ -420,6 +420,8 @@
                        );
 
                        $applications = $this->bo->so->read($params);
+//                        var_dump($params);
+//                        exit();
 
                        foreach($applications['results'] as &$application)
                        {

Modified: 
branches/dev-syncromind/booking/inc/class.uicompleted_reservation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uicompleted_reservation.inc.php   
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uicompleted_reservation.inc.php   
2015-09-04 00:19:42 UTC (rev 13848)
@@ -113,9 +113,9 @@
                         phpgwapi_jquery::load_widget('datepicker');
                        
                        self::add_javascript('booking', 'booking', 
'completed_reservation.js');
-                       self::add_javascript('booking', 'booking', 
'datatable.js');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('paginator');
+//                     self::add_javascript('booking', 'booking', 
'datatable.js');
+//                     phpgwapi_yui::load_widget('datatable');
+//                     phpgwapi_yui::load_widget('paginator');
                        $data = array(
                                'form' => array(
                                        'toolbar' => array(
@@ -179,6 +179,7 @@
                                                array(
                                                        'key' => 'event_id',
                                                        'label' => lang('Event 
id'),
+                                                        'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'description',
@@ -195,6 +196,7 @@
                                                array(
                                                        'key' => 'contact_name',
                                                        'label' => 
lang('Contact'),
+                                                        'sortable' => false
                                                ),
                                                array(
                                                        'key' => 
'customer_type',
@@ -307,24 +309,14 @@
                                        $filters[$field] = 
phpgw::get_var("filter_$field");
                                }
                        }
+                       
+                        $filter_to = phpgw::get_var('to', 'string', 'REQUEST', 
null);
 
-//                     $to = strtotime(phpgw::get_var('filter_to', 'string', 
'REQUEST', null));
-//                     $filter_to = date("Y-m-d",$to);
-//
-//                     if ($filter_to) {
-//                             $filters['where'][] = "%%table%%".sprintf(".to_ 
<= '%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
-//                     }
-//                        
-//                        echo 'xxx ' . $filter_to;
-//                        exit();
-                        
-                        $filter_to = phpgw::get_var('filter_to', 'string', 
'REQUEST', null);
                        if ($filter_to) {
-                               $filters['where'][] = "%%table%%".sprintf(".to_ 
<= '%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
+                            $filter_to2  = split("/", $filter_to);
+                            $filter_to = $filter_to2[1] . "/" . $filter_to2[0] 
. "/" . $filter_to2[2];
+                            $filters['where'][] = "%%table%%".sprintf(".to_ <= 
'%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
                        }
-//                        
-//                        echo $filter_to;
-//                        exit();
 
                        if ( 
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && // admin users 
should have access to all buildings
                             
!$this->bo->has_role(booking_sopermission::ROLE_MANAGER) ) { // users with the 
booking role admin should have access to all buildings

Modified: 
branches/dev-syncromind/booking/inc/class.uicompleted_reservation_export.inc.php
===================================================================
--- 
branches/dev-syncromind/booking/inc/class.uicompleted_reservation_export.inc.php
    2015-09-03 16:45:01 UTC (rev 13847)
+++ 
branches/dev-syncromind/booking/inc/class.uicompleted_reservation_export.inc.php
    2015-09-04 00:19:42 UTC (rev 13848)
@@ -212,7 +212,80 @@
         public function query() //index_json
                {
                        $this->db = $GLOBALS['phpgw']->db;
-                       $exports = $this->bo->read();
+                        
+                        
+                        $search = phpgw::get_var('search');
+                        $order = phpgw::get_var('order');
+                        $columns = phpgw::get_var('columns');
+            
+                       $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+                       $results = phpgw::get_var('length', 'int', 'REQUEST', 
null);
+                       $query = $search['value'];
+                       $sort = $columns[$order[0]['column']]['data'];
+                       $dir = $order[0]['dir'];
+                        
+                        
+                        switch($sort)
+                       {
+                               case 'building_id':
+                                       $_sort = array('building_id','id');
+                                       break;
+                               case 'season_id':
+                                       $_sort = array('season_id','id');
+                                       break;
+                               case 'from_':
+                                       $_sort = array('from_','id');
+                                       break;
+                               case 'to_':
+                                       $_sort = array('to_','id');
+                                       break;
+                               case 'created_on':
+                                       $_sort = array('created_on','id');
+                                       break;
+                                case 'created_by_name':
+                                       $_sort = array('created_on','id');
+                                       break;
+                                case 'total_items':
+                                       $_sort = array('created_on','id');
+                                       break;
+                                case 'total_cost':
+                                       $_sort = array('created_on','id');
+                                       break;
+                               default:
+                                       $_sort = $sort;
+                                       break;
+                       }
+                        
+                        $filters = array();
+                       foreach($this->bo->so->get_field_defs() as $field => 
$params) {
+                               if(phpgw::get_var("filter_$field")) {
+                                       $filters[$field] = 
phpgw::get_var("filter_$field");
+                               }
+                       }
+                        $filter_to = phpgw::get_var('to', 'string', 'REQUEST', 
null);
+
+                       if ($filter_to) {
+                            $filter_to2  = split("/", $filter_to);
+                            $filter_to = $filter_to2[1] . "/" . $filter_to2[0] 
. "/" . $filter_to2[2];
+                            $filters['where'][] = "%%table%%".sprintf(".to_ <= 
'%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
+                       }
+                        
+
+                        
+                        
+                        
+                        $params = array(
+                               'start' => $start,
+                               'results' => $results,
+                               'query' => $query,
+                               'sort'  => $_sort,
+                               'dir'   => $dir,
+                               'filters' => $filters
+                       );
+                        
+                        
+
+                       $exports = $this->bo->so->read($params);
                        array_walk($exports["results"], array($this, 
"_add_links"), $this->module.".uicompleted_reservation_export.show");
 
                        foreach($exports["results"] as &$export) {

Modified: branches/dev-syncromind/booking/inc/class.uidocument.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uidocument.inc.php        
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uidocument.inc.php        
2015-09-04 00:19:42 UTC (rev 13848)
@@ -1,8 +1,8 @@
 <?php
        phpgw::import_class('booking.uicommon');
 
-        phpgw::import_class('booking.uidocument_building');
-       phpgw::import_class('booking.uipermission_building');
+//        phpgw::import_class('booking.uidocument_building');
+//     phpgw::import_class('booking.uipermission_building');
        
 //     phpgw::import_class('phpgwapi.uicommon_jquery');
     

Modified: branches/dev-syncromind/booking/inc/class.uipermission.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uipermission.inc.php      
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uipermission.inc.php      
2015-09-04 00:19:42 UTC (rev 13848)
@@ -2,8 +2,8 @@
        phpgw::import_class('booking.uicommon');
        phpgw::import_class('booking.account_ui_utils');
     
-    phpgw::import_class('booking.uidocument_building');
-       phpgw::import_class('booking.uipermission_building');
+//    phpgw::import_class('booking.uidocument_building');
+//     phpgw::import_class('booking.uipermission_building');
        
 //     phpgw::import_class('phpgwapi.uicommon_jquery');
 

Modified: branches/dev-syncromind/booking/inc/class.uipermission_season.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uipermission_season.inc.php       
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uipermission_season.inc.php       
2015-09-04 00:19:42 UTC (rev 13848)
@@ -6,7 +6,7 @@
                public function __construct()
                {
                        parent::__construct();
-                       self::set_active_menu('booking::seasons::permissions');
+                       
self::set_active_menu('booking::buildings::seasons::permissions');
                }
                
                protected function get_parent_pathway(array $forDocumentData)

Modified: branches/dev-syncromind/booking/inc/class.uiresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiresource.inc.php        
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uiresource.inc.php        
2015-09-04 00:19:42 UTC (rev 13848)
@@ -30,7 +30,7 @@
                        $this->bo = CreateObject('booking.boresource');
                        $this->activity_bo = CreateObject('booking.boactivity');
                        $this->fields = array('name', 'building_id', 
'building_name','description','activity_id', 'active', 'type', 'sort', 
'organizations_ids');
-                       self::set_active_menu('booking::resources');
+                       self::set_active_menu('booking::buildings::resources');
                }
                
                public function index()

Modified: branches/dev-syncromind/booking/inc/class.uiseason.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiseason.inc.php  2015-09-03 
16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uiseason.inc.php  2015-09-04 
00:19:42 UTC (rev 13848)
@@ -84,7 +84,8 @@
                                                ),
                                                array(
                                                        'key' => 
'resource_list',
-                                                       'label' => 
lang('Resources')
+                                                       'label' => 
lang('Resources'),
+                                                        'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'officer_name',

Modified: branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php  
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/inc/class.uisystem_message.inc.php  
2015-09-04 00:19:42 UTC (rev 13848)
@@ -192,50 +192,50 @@
             $order = phpgw::get_var('order');
             $columns = phpgw::get_var('columns');
             
-                       $params = array(
-                               'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
-                               'results' => phpgw::get_var('length', 'int', 
'REQUEST', null),
-                               'query' => $search['value'],
-                               'sort'  => 
$columns[$order[0]['column']]['data'],
-                               'dir'   => $order[0]['dir'],
-                               'filters' => $filters
-                       );
+            $params = array(
+                    'start' => phpgw::get_var('start', 'int', 'REQUEST', 0),
+                    'results' => phpgw::get_var('length', 'int', 'REQUEST', 
null),
+                    'query'    => $search['value'],
+                    'sort'     => $columns[$order[0]['column']]['data'],
+                    'dir'      => $order[0]['dir'],
+                    'filters' => $filters
+            );
 
-                       $system_messages = $this->bo->so->read($params);
-                       array_walk($system_messages["results"], array($this, 
"_add_links"), "booking.uisystem_message.show");
+            $system_messages = $this->bo->so->read($params);
+            array_walk($system_messages["results"], array($this, 
"_add_links"), "booking.uisystem_message.show");
 
 
-                       foreach($system_messages['results'] as &$system_message)
-                       {
-                               $building_case_officers_data =  array(); 
-                               $building_case_officers =  array(); 
-                               $sql = "SELECT account_id, account_lid, 
account_firstname, account_lastname FROM phpgw_accounts WHERE account_id IN 
(SELECT subject_id FROM bb_permission WHERE 
object_id=".$system_message['building_id']." AND role='case_officer')";
-                               $this->db->query($sql);
-                               while ($record = 
array_shift($this->db->resultSet)) {
-                                        $building_case_officers_data[] = 
array('account_id' => $record['account_id'], 'account_lid' => 
$record['account_lid'],'account_name' => $record['account_firstname']." 
".$record['account_lastname']);
-                                        $building_case_officers[] = 
$record['account_id'];
-                               }
+            foreach($system_messages['results'] as &$system_message)
+            {
+                    $building_case_officers_data =  array(); 
+                    $building_case_officers =  array(); 
+                    $sql = "SELECT account_id, account_lid, account_firstname, 
account_lastname FROM phpgw_accounts WHERE account_id IN (SELECT subject_id 
FROM bb_permission WHERE object_id=".$system_message['building_id']." AND 
role='case_officer')";
+                    $this->db->query($sql);
+                    while ($record = array_shift($this->db->resultSet)) {
+                             $building_case_officers_data[] = 
array('account_id' => $record['account_id'], 'account_lid' => 
$record['account_lid'],'account_name' => $record['account_firstname']." 
".$record['account_lastname']);
+                             $building_case_officers[] = $record['account_id'];
+                    }
 
-                               $system_message['created'] = 
pretty_timestamp($system_message['created']);
-                               $system_message['type'] = 
lang($system_message['type']);
-                               $system_message['status'] = 
lang($system_message['status']);
-                               $system_message['modified'] = '';
-                               $system_message['activity_name'] = '';
-                               $system_message['contact_name'] = 
$system_message['name'];
-                               $system_message['case_officer_name'] = 
$for_case_officer_id;
-                               $system_message['what'] = 
$system_message['title'];
-                               if (strstr($system_message['what'],"%")){
-                                       $search = array('%2C','%C3%85', 
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
-                                       $replace = array 
(',','Å','å','Ø','ø','Æ','æ');
-                                       $system_message['what'] = 
str_replace($search, $replace, $system_message['what']);
-                               }
+                    $system_message['created'] = 
pretty_timestamp($system_message['created']);
+                    $system_message['type'] = lang($system_message['type']);
+                    $system_message['status'] = 
lang($system_message['status']);
+                    $system_message['modified'] = '';
+                    $system_message['activity_name'] = '';
+                    $system_message['contact_name'] = $system_message['name'];
+                    $system_message['case_officer_name'] = 
$for_case_officer_id;
+                    $system_message['what'] = $system_message['title'];
+                    if (strstr($system_message['what'],"%")){
+                            $search = array('%2C','%C3%85', '%C3%A5', 
'%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
+                            $replace = array (',','Å','å','Ø','ø','Æ','æ');
+                            $system_message['what'] = str_replace($search, 
$replace, $system_message['what']);
+                    }
 
-                               while($case_officer = 
array_shift($building_case_officers_data)) {
-                                       if 
($system_message['case_officer_name'] = $case_officer['account_id'])
-                                               
$system_message['case_officer_name'] = $case_officer['account_name'];
-                               }
-                       }
-                       return $this->jquery_results($system_messages);
+                    while($case_officer = 
array_shift($building_case_officers_data)) {
+                            if ($system_message['case_officer_name'] = 
$case_officer['account_id'])
+                                    $system_message['case_officer_name'] = 
$case_officer['account_name'];
+                    }
+            }
+            return $this->jquery_results($system_messages);
         }
 
         public function index_json()

Modified: branches/dev-syncromind/booking/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application.xsl      
2015-09-03 16:45:01 UTC (rev 13847)
+++ branches/dev-syncromind/booking/templates/base/application.xsl      
2015-09-04 00:19:42 UTC (rev 13848)
@@ -524,7 +524,6 @@
                     }
                 });
             }
-            console.log(associatedBody);
             <![CDATA[
                 var associatedTable = '<table 
class="'+associatedTableClass+'"><thead><tr>'+associatedHead+'</tr></thead><tbody><tr>'+associatedBody+'</tr></tbody></table>';
             ]]>
@@ -543,7 +542,6 @@
                url3 += 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=resource::'+
 resources; 
 
        ]]>
-        console.log(url3);
        var colDefs = [{key: 'name', label: lang['Document'], formatter: 
YAHOO.booking.formatLink}];
     YAHOO.booking.inlineTableHelper('regulation_documents', url3, colDefs);
        if (resourceIds) {
@@ -551,7 +549,6 @@
            var url = 
'index.php?menuaction=booking.uiresource.index&sort=name&phpgw_return_as=json&' 
+ resourceIds;
            var url2 = 
'index.php?menuaction=booking.uiapplication.associated&sort=from_&dir=asc&phpgw_return_as=json&filter_application_id='+app_id;
                ]]>
-                console.log(url);
            var colDefs = [{key: 'name', label: lang['Resources'], formatter: 
YAHOO.booking.formatLink}, {key: 'type', label: lang['Resource Type']}];
            YAHOO.booking.inlineTableHelper('resources_container', url, 
colDefs);
                if (currentuser == 1) {




reply via email to

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