fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13135] more on controller


From: Sigurd Nes
Subject: [Fmsystem-commits] [13135] more on controller
Date: Mon, 04 May 2015 18:12:37 +0000

Revision: 13135
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13135
Author:   sigurdne
Date:     2015-05-04 18:12:35 +0000 (Mon, 04 May 2015)
Log Message:
-----------
more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.uicomponent.inc.php
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/component.xsl
    trunk/property/inc/class.bolookup.inc.php
    trunk/property/inc/class.uilookup.inc.php
    trunk/property/templates/base/entity.xsl

Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php      2015-05-04 14:30:49 UTC 
(rev 13134)
+++ trunk/controller/inc/class.uicomponent.inc.php      2015-05-04 18:12:35 UTC 
(rev 13135)
@@ -98,6 +98,7 @@
 
 
                        $component_type = 
'';//phpgwapi_cache::session_get('controller', 'component_type');
+                       $sort_key = array();
                        if(!$component_type)
                        {
                                $this->soadmin_entity   = 
CreateObject('property.soadmin_entity');
@@ -112,14 +113,23 @@
 
                                                
if($category['enable_controller'])
                                                {
+                                                       $sort_arr = explode(' 
', $category['name']);
                                                        $component_type[] = 
array
                                                        (
                                                                'id' => 
$category['location_id'],
-                                                               'name'=> 
"{$entry['name']}::{$category['name']}"
+                                                               'name'=> 
"{$entry['name']}::{$category['name']}",
+                                                               'sort_key' => 
trim($sort_arr[0])
                                                        );
                                                }
                                        }
                                }
+                               // Obtain a list of columns
+                               foreach ($component_type as $key => $row)
+                               {
+                                       $id[$key]  = $row['sort_key'];
+                               }
+
+                               array_multisort($id,SORT_ASC, SORT_STRING, 
$component_type);
                                array_unshift($component_type, array('id' => 
'', 'name' => lang('select value')));
 //                             phpgwapi_cache::session_set('controller', 
'component_type', $component_type);
                        }
@@ -255,62 +265,62 @@
                                ),
                                array(
                                        'key'            => '1',
-                                       'label'          => lang('jan'),
+                                       'label'          => lang('month 1'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '2',
-                                       'label'          => lang('feb'),
+                                       'label'          => lang('month 2'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '3',
-                                       'label'          => lang('mar'),
+                                       'label'          => lang('month 3'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '4',
-                                       'label'          => lang('apr'),
+                                       'label'          => lang('month 4'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '5',
-                                       'label'          => lang('may'),
+                                       'label'          => lang('month 5'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '6',
-                                       'label'          => lang('june'),
+                                       'label'          => lang('month 6'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '7',
-                                       'label'          => lang('july'),
+                                       'label'          => lang('month 7'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '8',
-                                       'label'          => lang('aug'),
+                                       'label'          => lang('month 8'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '9',
-                                       'label'          => lang('sept'),
+                                       'label'          => lang('month 9'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '10',
-                                       'label'          => lang('oct'),
+                                       'label'          => lang('month 10'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '11',
-                                       'label'          => lang('nov'),
+                                       'label'          => lang('month 11'),
                                        'sortable'       => true,
                                ),
                                array(
                                        'key'            => '12',
-                                       'label'          => lang('dec'),
+                                       'label'          => lang('month 12'),
                                        'sortable'       => true,
                                ),
                        );
@@ -340,6 +350,7 @@
                        $to_date_ts = 
execMethod('controller.uicalendar.get_end_date_year_ts',$year);
 
                        $components = 
execMethod('property.soentity.read',array('location_id' => $location_id, 
'district_id' => $district_id, 'allrows' => true));
+                       $total_records = count($components);
                        $all_components = array();
                        $components_with_calendar_array = array();
 //                     _debug_array($components);
@@ -637,11 +648,11 @@
                                $data_set[] = $row;
                        }
                        $fields = $this->get_fields();
-
+                       $class = '';
                        $tbody = '';
                        foreach($data_set as $row_data )
                        {
-                               $tbody .= '<tr>';
+                               $tbody .= "<tr {$class}>";
                                foreach($fields as $field )
                                {
                                        $tbody .= '<td>';
@@ -649,6 +660,8 @@
                                        $tbody .= '</td>';
                                }
                                $tbody .= '</tr>';
+                               $class = $class ? '' : 'class="alt"';
+
                        }
 
                        $result = array
@@ -679,6 +692,7 @@
                                }
                        }
                        $result['time_sum'][0] = $sum_year;
+                       $result['total_records'] = $total_records;
 
                        return $result;
                }

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2015-05-04 14:30:49 UTC (rev 
13134)
+++ trunk/controller/setup/phpgw_no.lang        2015-05-04 18:12:35 UTC (rev 
13135)
@@ -23,6 +23,8 @@
 Choose_building_type   controller      no      Velg byggtype
 Choose_building_category       controller      no      Velg byggkategori
 Choose_district        controller      no      Velg distrikt
+district       controller      no      Distrikt
+user   controller      no      Bruker
 Choose_part_of_town    controller      no      Velg bydel
 DATATABLE_MSG_EMPTY    controller      no      Ingen data
 DATATABLE_MSG_ERROR    controller      no      Datafeil

Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl       2015-05-04 14:30:49 UTC 
(rev 13134)
+++ trunk/controller/templates/base/component.xsl       2015-05-04 18:12:35 UTC 
(rev 13135)
@@ -145,8 +145,34 @@
 </xsl:template>
 
 <xsl:template match="datatable">
-       <div id="paginator"/>
-       <div id="datatable-container"/>
+<style>
+#components {
+    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+    width: 100%;
+    border-collapse: collapse;
+}
+
+#components td, #components th {
+    font-size: 1em;
+    border: 1px solid #98bf21;
+    padding: 3px 7px 2px 7px;
+}
+
+#components th {
+    font-size: 1.1em;
+    text-align: left;
+    padding-top: 5px;
+    padding-bottom: 4px;
+    background-color: green;
+    color: #ffffff;
+}
+
+#components tr.alt td {
+    color: #000000;
+    background-color: #EAF2D3;
+}
+</style>
+
        <xsl:call-template name="datasource-definition" />
 </xsl:template>
 
@@ -169,6 +195,7 @@
                                                $("#tbody").html(data.tbody);
                                                var time_sum = data.time_sum;
 
+                                               
$("#total_records").html(data.total_records);
                                                $("#sum_text").html('Sum');
                                                $("#month0").html(time_sum[0]);
                                                $("#month1").html(time_sum[1]);
@@ -190,10 +217,10 @@
                };
 ]]>
        </script>
-       <table id="datatable-container" class="display cell-border compact 
responsive no-wrap" width="100%">
+       <table id="components">
                <thead>
                        <tr>
-                               <td>
+                               <td id='total_records'>
                                </td>
                                <td id='sum_text'>
                                </td>

Modified: trunk/property/inc/class.bolookup.inc.php
===================================================================
--- trunk/property/inc/class.bolookup.inc.php   2015-05-04 14:30:49 UTC (rev 
13134)
+++ trunk/property/inc/class.bolookup.inc.php   2015-05-04 18:12:35 UTC (rev 
13135)
@@ -340,8 +340,25 @@
                        return $ns3420;
                }
 
-               function read_phpgw_user()
+               function read_phpgw_user($acl_app = '', $acl_location = '', 
$acl_required ='')
                {
+                       if($acl_app && $acl_location && $acl_required)
+                       {
+                               $users = 
$GLOBALS['phpgw']->acl->get_user_list_right($acl_required, $acl_location, 
$acl_app);
+                               $user_list = array();
+                               foreach($users as $user)
+                               {
+                                       $user_list[] = array
+                                       (
+                                               'id'            => 
$user['account_id'],
+                                               'last_name'     => 
$user['account_lastname'],
+                                               'first_name'    => 
$user['account_firstname'],
+                                       );
+                               }
+                               $this->total_record = count($user_list);
+                               return $user_list;
+                       }
+
                        $phpgw_user = $this->so->read_phpgw_user(array('start' 
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'filter' => $this->filter,'cat_id' => 
$this->cat_id));
                        $this->total_records = $this->so->total_records;

Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php   2015-05-04 14:30:49 UTC (rev 
13134)
+++ trunk/property/inc/class.uilookup.inc.php   2015-05-04 18:12:35 UTC (rev 
13135)
@@ -2331,6 +2331,9 @@
                function phpgw_user()
                {
                        $column = phpgw::get_var('column');
+                       $acl_app = phpgw::get_var('acl_app');
+                       $acl_location = phpgw::get_var('acl_location');
+                       $acl_required = phpgw::get_var('acl_required', 'int');
 
                        if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
@@ -2352,9 +2355,12 @@
                                        ."cat_id:'{$this->cat_id}',"
                                        ."query:'{$this->query}',"
                                        ."filter:'{$this->filter}',"
+                                       ."acl_app:'{$acl_app}',"
+                                       ."acl_location:'{$acl_location}',"
+                                       ."acl_required:'{$acl_required}',"
                                        ."column:'{$column}'";
 
-                               $datatable['actions']['form'] = array
+                                       $datatable['actions']['form'] = array
                                        (
                                                array
                                                (
@@ -2409,7 +2415,7 @@
                        );
 
                        $phpgw_user_list = array();
-                       $phpgw_user_list = $this->bo->read_phpgw_user();
+                       $phpgw_user_list = $this->bo->read_phpgw_user($acl_app, 
$acl_location, $acl_required);
 
                        $content = array();
                        $j=0;

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2015-05-04 14:30:49 UTC (rev 
13134)
+++ trunk/property/templates/base/entity.xsl    2015-05-04 18:12:35 UTC (rev 
13135)
@@ -633,7 +633,7 @@
                                                        <script 
type="text/javascript">
                                                        
lookup_control_responsible = function()
                                                        {
-                                                               var oArgs = 
{menuaction:'property.uilookup.phpgw_user', column:'control_responsible'};
+                                                               var oArgs = 
{menuaction:'property.uilookup.phpgw_user', column:'control_responsible', 
acl_app:'controller', acl_location: '.control', acl_required:4};
                                                                var requestUrl 
= phpGWLink('index.php', oArgs);
                                                                var 
Window1=window.open(requestUrl,"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
                                                        }




reply via email to

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