fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16395] Backport diff from Syncromind to trunk


From: sigurdne
Subject: [Fmsystem-commits] [16395] Backport diff from Syncromind to trunk
Date: Wed, 1 Mar 2017 01:29:38 -0500 (EST)

Revision: 16395
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16395
Author:   sigurdne
Date:     2017-03-01 01:29:38 -0500 (Wed, 01 Mar 2017)
Log Message:
-----------
Backport diff from Syncromind to trunk

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.jquery.inc.php
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/import/class.import_component_files.inc.php
    trunk/property/setup/phpgw_no.lang

Added Paths:
-----------
    trunk/phpgwapi/js/chart/
    trunk/property/js/portico/tts.report.js
    trunk/property/js/portico/utils.js
    trunk/property/templates/base/tts_report.xsl

Property Changed:
----------------
    trunk/
    trunk/booking/
    trunk/bookingfrontend/

Index: trunk
===================================================================
--- trunk       2017-03-01 06:16:42 UTC (rev 16394)
+++ trunk       2017-03-01 06:29:38 UTC (rev 16395)

Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
 /branches/dev-syncromind:13653
-/branches/dev-syncromind-2:14933-16300
+/branches/dev-syncromind-2:14933-16394
 /branches/stavangerkommune:12743-12875,12986
\ No newline at end of property
Index: trunk/booking
===================================================================
--- trunk/booking       2017-03-01 06:16:42 UTC (rev 16394)
+++ trunk/booking       2017-03-01 06:29:38 UTC (rev 16395)

Property changes on: trunk/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,2 +1,2 ##
-/branches/dev-syncromind-2/booking:14933-16300
+/branches/dev-syncromind-2/booking:14933-16394
 /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
\ No newline at end of property
Index: trunk/bookingfrontend
===================================================================
--- trunk/bookingfrontend       2017-03-01 06:16:42 UTC (rev 16394)
+++ trunk/bookingfrontend       2017-03-01 06:29:38 UTC (rev 16395)

Property changes on: trunk/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
## -1,2 +1,2 ##
-/branches/dev-syncromind-2/bookingfrontend:14933-16300
+/branches/dev-syncromind-2/bookingfrontend:14933-16394
 /branches/stavangerkommune/bookingfrontend:9468-12740,12986
\ No newline at end of property
Modified: trunk/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jquery.inc.php     2017-03-01 06:16:42 UTC (rev 
16394)
+++ trunk/phpgwapi/inc/class.jquery.inc.php     2017-03-01 06:29:38 UTC (rev 
16395)
@@ -202,6 +202,14 @@
                                                
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/contextMenu/jquery.contextMenu.min.css");
                                        break;
                                
+                               case 'chart':
+                                       $load = array
+                                               (
+                                               'chart' => 
array("Chart{$_type}")
+                                       );
+
+                                       break;
+                               
                                case 'file-upload':
                                        $load = array
                                                (

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2017-03-01 06:16:42 UTC (rev 
16394)
+++ trunk/property/inc/class.botts.inc.php      2017-03-01 06:29:38 UTC (rev 
16395)
@@ -556,6 +556,11 @@
                        return $locations;
                }
 
+               function get_data_report( $data = array() )
+               {
+                       return $this->so->get_data_report($data);
+               }
+
                function read( $data = array() )
                {
                        static $category_name = array();

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2017-03-01 06:16:42 UTC (rev 
16394)
+++ trunk/property/inc/class.menu.inc.php       2017-03-01 06:29:38 UTC (rev 
16395)
@@ -910,20 +910,28 @@
                                        'text' => lang('Helpdesk'),
                                        'image' => array('property', 'helpdesk')
                                );
+
+                               $menus['navigation']['helpdesk']['children'] = 
array
+                                       (
+                                       'report' => array
+                                               (
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uitts.report')),
+                                               'text' => lang('report'),
+                                               'image' => array('property', 
'helpdesk')
+                                       )
+                               );
+
                        }
 
                        if ($acl->check('.ticket.order', PHPGW_ACL_ADD, 
'property'))
                        {
-                               $menus['navigation']['helpdesk']['children'] = 
array
-                                       (
-                                       'order_template' => array
+                               
$menus['navigation']['helpdesk']['children']['order_template'] =  array
                                                (
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
                                                        'type' => 
'order_template')),
                                                'text' => lang('order 
template'),
                                                'image' => array('property', 
'helpdesk')
-                                       )
-                               );
+                                       );
                        }
 
                        if 
(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2017-03-01 06:16:42 UTC (rev 
16394)
+++ trunk/property/inc/class.sotts.inc.php      2017-03-01 06:29:38 UTC (rev 
16395)
@@ -110,6 +110,48 @@
                        return $this->db->f('descr', true);
                }
 
+               function get_data_report( $data )
+               {
+                       $type = isset($data['type']) && $data['type'] ? 
(int)$data['type'] : 0;
+                       $start_date = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
+                       $end_date = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] :  mktime(23, 59, 59, 
date("n"),date("j"),date("Y"));
+                       $_end_date = $end_date + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
+                       $_start_date = $start_date - 3600 * 8 + 
phpgwapi_datetime::user_timezone();
+
+                       $data_report = array();
+                       if($type ==1)
+                       {
+                               $fields = "count(cat_id) as count_category, 
cat_id";
+                               $groupmethod = " GROUP BY cat_id";
+                       }
+                       else if ($type ==2)
+                       {
+                               $fields = "count(status) as count_status, 
status";
+                               $groupmethod = " GROUP BY status";
+
+                       }
+                       else
+                       {
+                               return array();
+                       }
+
+                       $sql = "SELECT {$fields} FROM fm_tts_tickets WHERE 
fm_tts_tickets.entry_date >= $_start_date AND fm_tts_tickets.entry_date <= 
$_end_date "
+                               . " {$groupmethod}";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       while($this->db->next_record())
+                       {
+                               $data_report[] = array(
+                                       'status'                        => 
$this->db->f('status'),
+                                       'count_status'          => 
$this->db->f('count_status'),
+                                       'cat_id'                        => 
$this->db->f('cat_id'),
+                                       'count_category'        => 
$this->db->f('count_category'),
+                               );
+                       }
+                       return $data_report;
+               }
+
                function read( $data )
                {
                        $start = isset($data['start']) && $data['start'] ? 
(int)$data['start'] : 0;

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2017-03-01 06:16:42 UTC (rev 
16394)
+++ trunk/property/inc/class.uitts.inc.php      2017-03-01 06:29:38 UTC (rev 
16395)
@@ -37,6 +37,8 @@
 
                var $public_functions = array
                        (
+                       'report' => true,
+                       'get_data_report' => true,
                        'index' => true,
                        'view' => true,
                        'add' => true,
@@ -146,7 +148,7 @@
                                'vendor_id' => $this->bo->vendor_id,
                                'district_id' => $this->bo->district_id,
                                'part_of_town_id' => $this->bo->part_of_town_id,
-                               'allrows' => $this->bo->allrows,
+                               //'allrows' => $this->bo->allrows,
                                'start_date' => $this->bo->start_date,
                                'end_date' => $this->bo->end_date,
                                'location_code' => $this->bo->location_code,
@@ -1178,6 +1180,104 @@
                        self::render_template_xsl('datatable_jquery', $data);
                }
                
+               function report()
+               {
+                       if (!$this->acl_read)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       
$GLOBALS['phpgw']->jqcal->add_listener('filter_start_date');
+                       
$GLOBALS['phpgw']->jqcal->add_listener('filter_end_date');
+                       phpgwapi_jquery::load_widget('chart');
+                               
+                       $start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), '01', 
date("Y")), $this->dateFormat);
+                       $end_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"), 
date("Y")), $this->dateFormat);
+                       
+                       $appname = lang('helpdesk');
+                       $function_msg = lang('Report');
+
+                       self::add_javascript('property', 'portico', 
'tts.report.js');
+
+                       $data = array(
+                               'start_date' => $start_date,
+                               'end_date' => $end_date,
+                               'image_loader' => 
$GLOBALS['phpgw']->common->image('property', 'ajax-loader', '.gif', false)
+                       );
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       self::render_template_xsl(array('tts_report'), $data);
+               }
+               
+               function get_data_report()
+               {
+                       $start_date = phpgw::get_var('start_date', 'date');
+                       $end_date = phpgw::get_var('end_date', 'date');
+                       $type = phpgw::get_var('type');
+                       
+                       $params['start_date'] = $start_date;
+                       $params['end_date'] = $end_date;
+                       $params['results'] = -1;
+                       $params['type'] = $type;
+
+                       $values = $this->bo->get_data_report($params);
+                       
+                       $rand = array('0', '1', '2', '3', '4', '5', '6', '7', 
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
+       
+                       $list_categories = 
$this->cats->formatted_xslt_list(array('format' => 'filter',
+                               'selected' => $this->cat_id, 'globals' => true, 
'use_acl' => $this->_category_acl));
+                       
+                       if ($type == 1)
+                       {
+                               $_categories = array();
+                               foreach ($list_categories['cat_list'] as 
$_category)
+                               {
+                                       $color = 
'#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
+                                       $_categories[$_category['cat_id']] = 
array('label'=>$_category['name'], 'count' => 0, 
+                                               'backgroundColor' => $color, 
'hoverBackgroundColor' => $color);
+                               }
+
+                               foreach ($values as $item) 
+                               {
+                                       if ($_categories[$item['cat_id']]) {
+                                               
$_categories[$item['cat_id']]['count'] = (int)$item['count_category'];
+                                       }
+                               }
+
+                               return $_categories;
+                       } 
+                       else {
+                               
+                               $list_status = $this->bo->filter(array('format' 
=> '', 'filter' => $this->status_id, 'default' => 'O'));
+                               if 
(isset($this->bo->config->config_data['tts_lang_open']) && 
$this->bo->config->config_data['tts_lang_open'])
+                               {
+                                       array_unshift($list_status, array('id' 
=> 'O2', 'name' => $this->bo->config->config_data['tts_lang_open']));
+                               }
+
+                               $_status = array();
+                               foreach ($list_status as $_item)
+                               {
+                                       if ($_item['id'] == 'all' || 
$_item['id'] == 'X')
+                                       {
+                                               continue;
+                                       }
+                                       $color = 
'#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
+                                       $_status[$_item['id']] = 
array('label'=>$_item['name'], 'count' => 0, 
+                                               'backgroundColor' => $color, 
'hoverBackgroundColor' => $color);                                 
+                               }
+
+                               foreach ($values as $item) 
+                               {
+                                       if ($_status[$item['status']]) {
+                                               
$_status[$item['status']]['count']  = (int)$item['count_status'];
+                                       }
+                               }
+
+                               return $_status;
+                       }
+               }
+               
                function add()
                {
                        if (!$this->acl_add)

Modified: trunk/property/inc/import/class.import_component_files.inc.php
===================================================================
--- trunk/property/inc/import/class.import_component_files.inc.php      
2017-03-01 06:16:42 UTC (rev 16394)
+++ trunk/property/inc/import/class.import_component_files.inc.php      
2017-03-01 06:29:38 UTC (rev 16395)
@@ -11,8 +11,8 @@
                        $this->db = & $GLOBALS['phpgw']->db;
 
                        $this->fakebase = '/temp_files_components';
-//                     $this->path_upload_dir = 
$GLOBALS['phpgw_info']['server']['files_dir'] . $this->fakebase . '/';
-                       $this->path_upload_dir = 
'/data/portico/temp_files_components/';
+                       $this->path_upload_dir = 
$GLOBALS['phpgw_info']['server']['files_dir'] . $this->fakebase . '/';
+//                     $this->path_upload_dir = 
'/data/portico/temp_files_components/';
 
                        $this->location_code = phpgw::get_var('location_code');
                        $this->location_item_id = 
phpgw::get_var('location_item_id');
@@ -225,6 +225,8 @@
 
                        $this->_delete_all_dir_temp();
 
+                       $this->_delete_all_dir_temp();
+                       
                        return $message;
                }
 
@@ -849,6 +851,8 @@
 
                        $this->_delete_all_dir_temp();
 
+                       $this->_delete_all_dir_temp();
+                       
                        return $message;
                }
 
@@ -1016,4 +1020,4 @@
 
                        return $result;
                }
-       }
\ No newline at end of file
+       }

Copied: trunk/property/js/portico/tts.report.js (from rev 16394, 
branches/dev-syncromind-2/property/js/portico/tts.report.js)
===================================================================
--- trunk/property/js/portico/tts.report.js                             (rev 0)
+++ trunk/property/js/portico/tts.report.js     2017-03-01 06:29:38 UTC (rev 
16395)
@@ -0,0 +1,67 @@
+
+$(document).ready(function ()
+{
+       $('.processing').hide();
+       
+       var config = {
+               type: 'pie',
+               data: {
+                       datasets: [{
+                               data: [],
+                               backgroundColor: [],
+                               hoverBackgroundColor: []
+                       }],
+                       labels: []
+               },
+               options: {
+                       responsive: true
+               }
+       };
+
+       var ctx = document.getElementById("chart-area");
+       var myPieChart = new Chart(ctx, config);
+       
+       $('#btn_search').click( function()
+       {
+               var oArgs = {menuaction: 'property.uitts.get_data_report'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               var data = {"start_date": $('#filter_start_date').val(), 
"end_date": $('#filter_end_date').val(), "type": $('#type').val()};
+
+               var labels = [];
+               var values = [];
+               var backgroundColor = [];
+               var hoverBackgroundColor = [];
+               var datasets = {};
+
+               $('.processing').show();
+               $.ajax({
+                       type: 'GET',
+                       url: requestUrl,
+                       dataType: 'json',
+                       data: data
+               }).always(function () {
+                       $('.processing').hide();
+               }).done(function (result) {
+                       $.each(result, function(key, value) {
+                               labels.push(value.label);
+                               values.push(value.count);
+                               backgroundColor.push(value.backgroundColor);
+                               
hoverBackgroundColor.push(value.hoverBackgroundColor);
+                       });
+
+                       datasets = {
+                               data: values,
+                               backgroundColor: backgroundColor,
+                               hoverBackgroundColor: hoverBackgroundColor
+                       }; 
+
+                       config.data.datasets = [datasets];
+                       config.data.labels = labels;
+
+                       myPieChart.update();
+               });             
+       });
+       
+       $("#btn_search").trigger( "click" );
+
+});

Copied: trunk/property/js/portico/utils.js (from rev 16394, 
branches/dev-syncromind-2/property/js/portico/utils.js)
===================================================================
--- trunk/property/js/portico/utils.js                          (rev 0)
+++ trunk/property/js/portico/utils.js  2017-03-01 06:29:38 UTC (rev 16395)
@@ -0,0 +1,13 @@
+window.chartColors = {
+       red: 'rgb(255, 99, 132)',
+       orange: 'rgb(255, 159, 64)',
+       yellow: 'rgb(255, 205, 86)',
+       green: 'rgb(75, 192, 192)',
+       blue: 'rgb(54, 162, 235)',
+       purple: 'rgb(153, 102, 255)',
+       grey: 'rgb(231,233,237)'
+};
+
+window.randomScalingFactor = function() {
+       return (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 
100);
+}
\ No newline at end of file

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2017-03-01 06:16:42 UTC (rev 16394)
+++ trunk/property/setup/phpgw_no.lang  2017-03-01 06:29:38 UTC (rev 16395)
@@ -2102,4 +2102,5 @@
 attribute name for component id        property        no      Attributtnavn 
for komponent id
 category template      property        no      Kategori mal
 profile        property        no      Profil
-new attribute  property        no      Ny attributt
\ No newline at end of file
+new attribute  property        no      Ny attributt
+report property        no      Rapport
\ No newline at end of file

Copied: trunk/property/templates/base/tts_report.xsl (from rev 16394, 
branches/dev-syncromind-2/property/templates/base/tts_report.xsl)
===================================================================
--- trunk/property/templates/base/tts_report.xsl                                
(rev 0)
+++ trunk/property/templates/base/tts_report.xsl        2017-03-01 06:29:38 UTC 
(rev 16395)
@@ -0,0 +1,53 @@
+
+<!-- $Id$ -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+
+       <form class="pure-form pure-form-aligned" id="form" name="form" 
method="post" action="">
+               <fieldset>
+                       <div class="pure-control-group">
+                               <label>
+                                       <xsl:value-of 
select="php:function('lang', 'from')"/>
+                               </label>
+                               <input type="text" id="filter_start_date" 
name="filter_start_date" size="10" value="{start_date}" readonly="readonly" 
onMouseout="window.status='';return true;">
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of 
select="lang_finnish_date_statustext"/>
+                                       </xsl:attribute>
+                               </input>
+                       </div>
+
+                       <div class="pure-control-group">
+                               <label>
+                                       <xsl:value-of 
select="php:function('lang', 'to')"/>
+                               </label>
+                               <input type="text" id="filter_end_date" 
name="filter_end_date" size="10" value="{end_date}" readonly="readonly" 
onMouseout="window.status='';return true;">
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of 
select="lang_finnish_date_statustext"/>
+                                       </xsl:attribute>
+                               </input>
+                       </div>
+                       
+                       <div class="pure-control-group">
+                               <label>
+                                       <xsl:value-of 
select="php:function('lang', 'type')"/>
+                               </label>
+                               <select id='type' name="type">
+                                       <option value="1"><xsl:value-of 
select="php:function('lang', 'categories')"/></option>
+                                       <option value="2"><xsl:value-of 
select="php:function('lang', 'status')"/></option>
+                               </select>
+
+                               <input type="button" id="btn_search" 
name="btn_search" size="40">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="php:function('lang', 'search')"/>
+                                       </xsl:attribute>
+                               </input>                        
+                               <img src="{image_loader}" class="processing" 
align="absmiddle"></img>   
+                       </div>
+                       
+                       <div id="canvas-holder" style="width:80%; 
display:inline-block;">
+                               <canvas style="display:inline-block;" 
id="chart-area" />
+                       </div>
+               </fieldset>
+       </form>
+
+</xsl:template>




reply via email to

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