[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16589] Stable: Merge 16585:16588 from trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16589] Stable: Merge 16585:16588 from trunk |
Date: |
Tue, 18 Apr 2017 06:59:13 -0400 (EDT) |
Revision: 16589
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16589
Author: sigurdne
Date: 2017-04-18 06:59:12 -0400 (Tue, 18 Apr 2017)
Log Message:
-----------
Stable: Merge 16585:16588 from trunk
Modified Paths:
--------------
branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
branches/Version-2_0-branch/property/inc/class.menu.inc.php
branches/Version-2_0-branch/property/inc/class.uitts.inc.php
branches/Version-2_0-branch/property/js/portico/tts.report.js
branches/Version-2_0-branch/property/setup/default_records.inc.php
branches/Version-2_0-branch/property/setup/setup.inc.php
branches/Version-2_0-branch/property/setup/tables_current.inc.php
branches/Version-2_0-branch/property/setup/tables_update.inc.php
branches/Version-2_0-branch/property/templates/base/tts_report.xsl
Added Paths:
-----------
branches/Version-2_0-branch/phpgwapi/js/jquery/print/
branches/Version-2_0-branch/property/inc/class.boreport.inc.php
branches/Version-2_0-branch/property/inc/class.soreport.inc.php
branches/Version-2_0-branch/property/inc/class.uireport.inc.php
branches/Version-2_0-branch/property/js/portico/report.edit.js
branches/Version-2_0-branch/property/js/portico/report.index.js
branches/Version-2_0-branch/property/templates/base/report.xsl
Property Changed:
----------------
branches/Version-2_0-branch/
branches/Version-2_0-branch/booking/
branches/Version-2_0-branch/bookingfrontend/
Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch 2017-04-18 10:59:12 UTC (rev 16589)
Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
/branches/dev-syncromind:13653
-/branches/dev-syncromind-2:14933-16394
+/branches/dev-syncromind-2:14933-16587
/branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588
\ No newline at end of property
Index: branches/Version-2_0-branch/booking
===================================================================
--- branches/Version-2_0-branch/booking 2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/booking 2017-04-18 10:59:12 UTC (rev 16589)
Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
-/branches/dev-syncromind-2/booking:14933-16394
+/branches/dev-syncromind-2/booking:14933-16587
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
-/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584
\ No newline at end of property
+/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584,16586-16588
\ No newline at end of property
Index: branches/Version-2_0-branch/bookingfrontend
===================================================================
--- branches/Version-2_0-branch/bookingfrontend 2017-04-18 10:54:53 UTC (rev
16588)
+++ branches/Version-2_0-branch/bookingfrontend 2017-04-18 10:59:12 UTC (rev
16589)
Property changes on: branches/Version-2_0-branch/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
-/branches/dev-syncromind-2/bookingfrontend:14933-16394
+/branches/dev-syncromind-2/bookingfrontend:14933-16587
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
-/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402
\ No newline at end of property
+/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402,16586-16588
\ No newline at end of property
Modified: branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -210,6 +210,14 @@
break;
+ case 'print':
+ $load = array
+ (
+ "print/jQuery.print"
+ );
+
+ break;
+
case 'file-upload':
$load = array
(
Copied: branches/Version-2_0-branch/property/inc/class.boreport.inc.php (from
rev 16588, trunk/property/inc/class.boreport.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boreport.inc.php
(rev 0)
+++ branches/Version-2_0-branch/property/inc/class.boreport.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,143 @@
+<?php
+ /**
+ * phpGroupWare - property: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id: class.boreport.inc.php 14913 2016-04-27 12:27:37Z
sigurdne $
+ */
+
+ class property_boreport
+ {
+ private $so;
+ var $public_functions = array
+ (
+ 'read' => true,
+ 'get_views' => true
+ );
+
+ public function __construct()
+ {
+ $this->so = CreateObject('property.soreport');
+ $this->bocommon = CreateObject('property.bocommon');
+ }
+
+ function read_single( $id = '' )
+ {
+ $report = $this->so->read_single($id);
+
+ return $report;
+ }
+
+ public function read($data = array())
+ {
+ $values = $this->so->read($data);
+ $this->total_records_reports =
$this->so->total_records_reports;
+
+ return $values;
+ }
+
+ public function read_to_export($id)
+ {
+ $values = $this->so->read_to_export($id);
+
+ return $values;
+ }
+
+ function get_views()
+ {
+ $values = $this->so->get_views();
+
+ return $values;
+ }
+
+ function get_datasets()
+ {
+ $values = $this->so->get_datasets();
+
+ return $values;
+ }
+
+ function get_columns($id)
+ {
+ $values = $this->so->get_columns($id);
+
+ return $values;
+ }
+
+ function read_single_dataset( $dataset_id = '' )
+ {
+ $dataset = $this->so->read_single_dataset($dataset_id);
+
+ return $dataset;
+ }
+
+ function read_dataset( $params = array() )
+ {
+ $dataset = $this->so->read_dataset($params);
+ $this->total_records_dataset =
$this->so->total_records_dataset;
+
+ return $dataset;
+ }
+
+ function save( $values )
+ {
+ if ($values['id'])
+ {
+ $receipt = $this->so->update($values);
+ }
+ else
+ {
+ $receipt = $this->so->add($values);
+ }
+
+ return $receipt;
+ }
+
+ function delete( $id )
+ {
+ $receipt = $this->so->delete($id);
+ return $receipt;
+ }
+
+ function save_dataset( $values )
+ {
+ if ($values['id'])
+ {
+ $receipt = $this->so->update_dataset($values);
+ }
+ else
+ {
+ $receipt = $this->so->add_dataset($values);
+ }
+
+ return $receipt;
+ }
+
+ function delete_dataset( $id )
+ {
+ $receipt = $this->so->delete_dataset($id);
+ return $receipt;
+ }
+
+ }
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.menu.inc.php 2017-04-18
10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/inc/class.menu.inc.php 2017-04-18
10:59:12 UTC (rev 16589)
@@ -923,6 +923,16 @@
}
+ if ($acl->check('.report', PHPGW_ACL_READ, 'property'))
+ {
+ $menus['navigation']['report'] = array
+ (
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uireport.index')),
+ 'text' => lang('report'),
+ 'image' => array('property', 'report')
+ );
+ }
+
if ($acl->check('.ticket.order', PHPGW_ACL_ADD,
'property'))
{
$menus['navigation']['helpdesk']['children']['order_template'] = array
Copied: branches/Version-2_0-branch/property/inc/class.soreport.inc.php (from
rev 16588, trunk/property/inc/class.soreport.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soreport.inc.php
(rev 0)
+++ branches/Version-2_0-branch/property/inc/class.soreport.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,491 @@
+<?php
+ /**
+ * phpGroupWare - property: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id: class.soreport.inc.php 14913 2016-04-27 12:27:37Z
sigurdne $
+ */
+
+ class property_soreport
+ {
+
+ function __construct()
+ {
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->join = & $this->db->join;
+ $this->left_join = & $this->db->left_join;
+ $this->like = & $this->db->like;
+ $this->total_records = 0;
+ }
+
+ function read_single ( $id, $values = array() )
+ {
+ $id = (int)$id;
+ $sql = "SELECT * FROM fm_view_dataset_report WHERE id =
{$id}";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $values = array();
+ if ($this->db->next_record())
+ {
+ $values = array
+ (
+ 'id' => $this->db->f('id'),
+ 'dataset_id' =>
$this->db->f('dataset_id'),
+ 'report_name' =>
$this->db->f('report_name'),
+ 'report_definition' =>
$this->db->f('report_definition')
+ );
+ }
+
+ return $values;
+ }
+
+ public function read($data)
+ {
+ $start = isset($data['start']) && $data['start'] ?
$data['start'] : 0;
+ $query = isset($data['query']) ? $data['query'] : '';
+ $sort = isset($data['sort']) && $data['sort'] ?
$data['sort'] : 'DESC';
+ $order = isset($data['order']) ? $data['order'] : '';
+ $allrows = isset($data['allrows']) ? $data['allrows'] :
'';
+ $dataset_id = isset($data['dataset_id']) ?
$data['dataset_id'] : '';
+ $results = isset($data['results']) && $data['results']
? (int)$data['results'] : 0;
+
+ if ($order)
+ {
+ $ordermethod = " ORDER BY $order $sort";
+ }
+ else
+ {
+ $ordermethod = " ORDER BY a.id DESC";
+ }
+
+ $where = 'WHERE';
+
+ if ($dataset_id > 0)
+ {
+ $filtermethod .= " $where
a.dataset_id={$dataset_id}";
+ $where = 'AND';
+ }
+
+ if ($query)
+ {
+ $query = $this->db->db_addslashes($query);
+ $querymethod = " $where ( b.dataset_name
{$this->like} '%$query%' OR a.report_name {$this->like} '%$query%')";
+ }
+
+ $sql = "SELECT a.id, a.report_name, b.dataset_name"
+ . " FROM fm_view_dataset_report a {$this->join}
fm_view_dataset b ON a.dataset_id = b.id"
+ . " {$filtermethod} {$querymethod}";
+
+ $sql_count = 'SELECT count(fm_view_dataset_report.id)
AS cnt FROM fm_view_dataset_report';
+ $this->db->query($sql_count, __LINE__, __FILE__);
+ $this->db->next_record();
+ $this->total_records_reports = $this->db->f('cnt');
+
+ if (!$allrows)
+ {
+ $this->db->limit_query($sql . $ordermethod,
$start, __LINE__, __FILE__, $results);
+ }
+ else
+ {
+ $this->db->query($sql . $ordermethod, __LINE__,
__FILE__);
+ }
+
+ $values = array();
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' => $this->db->f('id'),
+ 'report_name' =>
$this->db->f('report_name'),
+ 'dataset_name' =>
$this->db->f('dataset_name')
+ );
+ }
+
+ return $values;
+ }
+
+ public function get_views()
+ {
+ $sql = "SELECT table_name as name
+ FROM information_schema.tables
+ WHERE table_schema = current_schema()
+ AND table_type = 'VIEW'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $values = array();
+
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'name' => $this->db->f('name')
+ );
+ }
+
+ return $values;
+ }
+
+ public function get_datasets()
+ {
+ $sql = "SELECT * FROM fm_view_dataset";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $values = array();
+
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' => $this->db->f('id'),
+ 'name' => $this->db->f('dataset_name')
+ );
+ }
+
+ return $values;
+ }
+
+ public function get_columns($id)
+ {
+ $dataset = $this->read_single_dataset($id);
+
+ $sql = "SELECT column_name, data_type
+ FROM information_schema.columns
+ WHERE table_name = '".$dataset['view_name']."'
+ ORDER BY ordinal_position";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $values = array();
+
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'name' => $this->db->f('column_name'),
+ 'type' => $this->db->f('data_type')
+ );
+ }
+
+ return $values;
+ }
+
+ function read_to_export ( $id )
+ {
+ $id = (int)$id;
+
+ $definition = $this->read_single($id);
+ $dataset =
$this->read_single_dataset($definition['dataset_id']);
+
+ $jsonB = json_decode($definition['report_definition'],
true);
+
+ $columns = implode(',', $jsonB['group']);
+ $agregates = array();
+ foreach ($jsonB['aggregate'] as $c => $v)
+ {
+ $agregates[] =
$jsonB['cbo_aggregate'][$v]."(".$v.") AS ".$jsonB['txt_aggregate'][$v];
+ }
+ $func_agregates = implode(',', $agregates);
+ $order = '';
+ if (count($jsonB['order']))
+ {
+ $order = ' ORDER BY '.implode(',',
$jsonB['order']);
+ }
+
+ $sql = "SELECT ".$columns.",".$func_agregates." FROM
".$dataset['view_name']." GROUP BY ".$columns.$order;
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $resultado = array_merge(array_values($jsonB['group']),
array_values($jsonB['txt_aggregate']));
+
+ $values = array();
+ while ($this->db->next_record())
+ {
+ $value = array();
+ foreach ($resultado as $column)
+ {
+ $value[$column] = $this->db->f($column);
+ }
+ $values[] = $value;
+ }
+
+ return $values;
+ }
+
+ function read_single_dataset ( $id, $values = array() )
+ {
+ $id = (int)$id;
+ $sql = "SELECT * FROM fm_view_dataset WHERE id = {$id}";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $values = array();
+ if ($this->db->next_record())
+ {
+ $values = array
+ (
+ 'id' => $this->db->f('id'),
+ 'view_name' =>
$this->db->f('view_name'),
+ 'dataset_name' =>
$this->db->f('dataset_name')
+ );
+ }
+
+ return $values;
+ }
+
+ function read_dataset ( $data )
+ {
+ $start = isset($data['start']) && $data['start'] ?
$data['start'] : 0;
+ $query = isset($data['query']) ? $data['query'] : '';
+ $sort = isset($data['sort']) && $data['sort'] ?
$data['sort'] : 'DESC';
+ $order = isset($data['order']) ? $data['order'] : '';
+ $allrows = isset($data['allrows']) ? $data['allrows'] :
'';
+ $results = isset($data['results']) && $data['results']
? (int)$data['results'] : 0;
+
+ if ($order)
+ {
+ $ordermethod = " ORDER BY $order $sort";
+ }
+ else
+ {
+ $ordermethod = " ORDER BY id DESC";
+ }
+
+ $where = 'HAVING';
+
+ /*if ($dimb_id > 0)
+ {
+ $filtermethod .= " $where
fm_budget.ecodimb={$dimb_id}";
+ $where = 'AND';
+ }*/
+
+ if ($query)
+ {
+ $query = $this->db->db_addslashes($query);
+ $querymethod = " $where ( a.dataset_name
{$this->like} '%$query%')";
+ }
+
+ $sql = "SELECT a.id, a.view_name, a.dataset_name,
count(b.id) AS n_reports
+ FROM fm_view_dataset a LEFT
JOIN fm_view_dataset_report b ON a.id = b.dataset_id
+ GROUP BY a.id, a.view_name,
a.dataset_name"
+ . " {$querymethod}";
+
+ $sql_count = 'SELECT count(fm_view_dataset.id) AS cnt
FROM fm_view_dataset';
+ $this->db->query($sql_count, __LINE__, __FILE__);
+ $this->db->next_record();
+ $this->total_records_dataset = $this->db->f('cnt');
+
+ if (!$allrows)
+ {
+ $this->db->limit_query($sql . $ordermethod,
$start, __LINE__, __FILE__, $results);
+ }
+ else
+ {
+ $this->db->query($sql . $ordermethod, __LINE__,
__FILE__);
+ }
+
+ $values = array();
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' => $this->db->f('id'),
+ 'view_name' =>
$this->db->f('view_name'),
+ 'dataset_name' =>
$this->db->f('dataset_name'),
+ 'n_reports' => $this->db->f('n_reports')
+ );
+ }
+
+ return $values;
+ }
+
+ function add ( $data )
+ {
+ $receipt = array();
+ $values_insert = array
+ (
+ 'dataset_id' => $data['dataset_id'],
+ 'report_name' => $data['report_name'],
+ 'report_definition' =>
json_encode($data['report_definition']),
+ 'owner_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'entry_date' => time()
+ );
+
+ $this->db->transaction_begin();
+
+ $this->db->query("INSERT INTO fm_view_dataset_report ("
. implode(',', array_keys($values_insert)) . ') VALUES ('
+ .
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__,
__FILE__);
+
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been saved'));
+ $receipt['id'] =
$this->db->get_last_insert_id('fm_view_dataset_report', 'id');
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been saved'));
+ }
+
+ return $receipt;
+ }
+
+ function update ( $data )
+ {
+ $receipt = array();
+
+ $value_set = array
+ (
+ 'dataset_id' => $data['dataset_id'],
+ 'report_name' => $data['report_name'],
+ 'report_definition' =>
json_encode($data['report_definition']),
+ 'owner_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'entry_date' => time()
+ );
+
+ $value_set = $this->db->validate_update($value_set);
+
+ $this->db->transaction_begin();
+
+ $this->db->query("UPDATE fm_view_dataset_report SET
{$value_set} WHERE id='" . $data['id'] . "'", __LINE__, __FILE__);
+
+ $receipt['id'] = $data['id'];
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been updated'));
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been updated'));
+ }
+
+ return $receipt;
+ }
+
+ function delete ( $id )
+ {
+ $id = (int)$id;
+ $receipt = array();
+
+ $this->db->transaction_begin();
+
+ $this->db->query("DELETE FROM fm_view_dataset WHERE id
='{$id}'", __LINE__, __FILE__);
+ $this->db->query("DELETE FROM fm_view_dataset_report
WHERE dataset_id ='{$id}'", __LINE__, __FILE__);
+
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been deleted'));
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been deleted'));
+ }
+
+ return $receipt;
+ }
+
+ function add_dataset ( $data )
+ {
+ $receipt = array();
+ $values_insert = array
+ (
+ 'view_name' => $data['view_name'],
+ 'dataset_name' =>
$this->db->db_addslashes($data['dataset_name']),
+ 'owner_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'entry_date' => time()
+ );
+
+ $this->db->transaction_begin();
+
+ $this->db->query("INSERT INTO fm_view_dataset (" .
implode(',', array_keys($values_insert)) . ') VALUES ('
+ .
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__,
__FILE__);
+
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been saved'));
+ $receipt['id'] =
$this->db->get_last_insert_id('fm_view_dataset', 'id');
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been saved'));
+ }
+
+ return $receipt;
+ }
+
+ function update_dataset ( $data )
+ {
+ $receipt = array();
+
+ $value_set = array
+ (
+ 'view_name' => $data['view_name'],
+ 'dataset_name' =>
$this->db->db_addslashes($data['dataset_name']),
+ 'owner_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'entry_date' => time()
+ );
+
+ $value_set = $this->db->validate_update($value_set);
+
+ $this->db->transaction_begin();
+
+ $this->db->query("UPDATE fm_view_dataset SET
{$value_set} WHERE id='" . $data['id'] . "'", __LINE__, __FILE__);
+
+ $receipt['id'] = $data['id'];
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been updated'));
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been updated'));
+ }
+
+ return $receipt;
+ }
+
+ function delete_dataset ( $id )
+ {
+ $id = (int)$id;
+ $receipt = array();
+
+ $this->db->transaction_begin();
+
+ $this->db->query("DELETE FROM fm_view_dataset_report
WHERE dataset_id ='{$id}'", __LINE__, __FILE__);
+ $this->db->query("DELETE FROM fm_view_dataset WHERE id
='{$id}'", __LINE__, __FILE__);
+
+ if ($this->db->transaction_commit())
+ {
+ $receipt['message'][] = array('msg' =>
lang('dataset has been deleted'));
+ }
+ else
+ {
+ $receipt['error'][] = array('msg' =>
lang('dataset has not been deleted'));
+ }
+
+ return $receipt;
+ }
+
+ }
\ No newline at end of file
Copied: branches/Version-2_0-branch/property/inc/class.uireport.inc.php (from
rev 16588, trunk/property/inc/class.uireport.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uireport.inc.php
(rev 0)
+++ branches/Version-2_0-branch/property/inc/class.uireport.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,685 @@
+<?php
+ /**
+ * phpGroupWare - property: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage logistic
+ * @version $Id: class.uireport.inc.php 14913 2017-03-10 12:27:37Z
sigurdne $
+ */
+ phpgw::import_class('phpgwapi.uicommon_jquery');
+ phpgw::import_class('phpgwapi.jquery');
+
+ class property_uireport extends phpgwapi_uicommon_jquery
+ {
+ private $receipt = array();
+
+ public $public_functions = array(
+ 'query' => true,
+ 'query_dataset' => true,
+ 'index' => true,
+ 'view' => true,
+ 'add' => true,
+ 'edit' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'add_dataset' => true,
+ 'edit_dataset' => true,
+ 'save_dataset' => true,
+ 'delete_dataset' => true,
+ 'get_columns' => true,
+ 'download' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ //$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+ $this->bo = CreateObject('property.boreport', true);
+ $this->bocommon = & $this->bo->bocommon;
+ $this->acl = & $GLOBALS['phpgw']->acl;
+ }
+
+ public function download()
+ {
+ $id = phpgw::get_var('id', 'int');
+
+ $list = $this->bo->read_to_export($id);
+
+ $names = array_keys($list[0]);
+
+ $this->bocommon->download($list, $names, $names);
+ }
+
+ private function _get_filters()
+ {
+ $views = $this->bo->get_datasets();
+ foreach ($views as $view)
+ {
+ $list[] = array('id' => $view['id'], 'name' =>
$view['name']);
+ }
+
+ $default_value = array('id' => '', 'name' =>
lang('Select'));
+ array_unshift($list, $default_value);
+
+ return $list;
+ }
+
+ /**
+ * Prepare UI
+ * @return void
+ */
+ public function index()
+ {
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ if (phpgw::get_var('dataset'))
+ {
+ return $this->query_dataset();
+ }
+
+ return $this->query();
+ }
+
+ $appname = lang('report generator');
+ //$function_msg = lang('report generator');
+
+ $filters = $this->_get_filters();
+
+ $tabletools = array();
+
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' => 'id',
+ 'source' => 'id'
+ )
+ )
+ );
+
+ $tabletools[] = array
+ (
+ 'my_name' => 'add',
+ 'text' => lang('new'),
+ 'type' => 'custom',
+ 'className' => 'add',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'property.uireport.add'
+ )) . ";
+ newReport(oArgs);
+ "
+ );
+
+ $tabletools[] = array
+ (
+ 'my_name' => 'edit',
+ 'text' => lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' => 'property.uireport.edit'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $tabletools[] = array
+ (
+ 'my_name' => 'delete',
+ 'text' => lang('delete'),
+ 'confirm_msg' => lang('do you really want to
delete this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' =>
'property.uireport.delete', 'phpgw_return_as' => 'json'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $tabletools[] = array
+ (
+ 'my_name' => 'export',
+ 'text' => lang('download'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+
'menuaction' => 'property.uireport.download',
+
'export' => true,
+
'allrows' => true
+ )) . ";
+
+ download(oArgs);"
+ );
+
+ $related_def = array
+ (
+ array('key' => 'id', 'label' => lang('ID'),
'sortable' => true, 'resizeable' => true, 'hidden' => true),
+ array('key' => 'report_name', 'label' =>
lang('name'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'dataset_name', 'label' =>
lang('dataset'), 'sortable' => true, 'resizeable' => true)
+ );
+
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_0',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'property.uireport.index',
+ 'phpgw_return_as' => 'json'))),
+ 'ColumnDefs' => $related_def,
+ 'tabletools' => $tabletools,
+ 'config' => array(
+ array('singleSelect' => true)
+ )
+ );
+
+ $related_def_views = array
+ (
+ array('key' => 'id', 'label' => lang('ID'),
'sortable' => true, 'resizeable' => true, 'hidden' => true),
+ array('key' => 'dataset_name', 'label' =>
lang('name'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'view_name', 'label' =>
lang('view'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'n_reports', 'label' =>
lang('number of reports'), 'sortable' => true, 'resizeable' => true)
+ );
+
+ $tabletools_views[] = array
+ (
+ 'my_name' => 'add',
+ 'text' => lang('new'),
+ 'type' => 'custom',
+ 'className' => 'add',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'property.uireport.add_dataset'
+ )) . ";
+ newDataset(oArgs);
+ "
+ );
+
+ $tabletools_views[] = array
+ (
+ 'my_name' => 'edit',
+ 'text' => lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' =>
'property.uireport.edit_dataset'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $tabletools_views[] = array
+ (
+ 'my_name' => 'delete',
+ 'text' => lang('delete'),
+ 'confirm_msg' => lang('do you really want to
delete this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' =>
'property.uireport.delete_dataset', 'phpgw_return_as' => 'json'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'property.uireport.index',
+ 'dataset' => '1',
'phpgw_return_as' => 'json'))),
+ 'ColumnDefs' => $related_def_views,
+ 'tabletools' => $tabletools_views,
+ 'config' => array(
+ array('singleSelect' => true)
+ )
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname;
+
+ $tabs = array();
+ $tabs['reports'] = array('label' => lang('reports'),
'link' => '#reports');
+ $tabs['views'] = array('label' => lang('datasets'),
'link' => '#views');
+
+ $data = array
+ (
+ 'datatable_def' => $datatable_def,
+ 'list_views' => array('options' => $filters),
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, 'reports')
+ );
+
+ self::add_javascript('property', 'portico',
'report.index.js');
+
+ self::render_template_xsl(array('report',
'datatable_inline'), array('lists' => $data));
+ }
+
+ public function view()
+ {
+ if (!$this->acl_read)
+ {
+ phpgw::no_access();
+ return;
+ }
+ $this->edit(null, $mode = 'view');
+ }
+
+ public function add()
+ {
+ $this->edit();
+ }
+
+ /**
+ * Prepare data for view and edit - depending on mode
+ *
+ * @param array $values populated object in case of retry
+ * @param string $mode edit or view
+ * @param int $id entity id - no id means 'new'
+ *
+ * @return void
+ */
+ public function edit( $values = array(), $mode = 'edit' )
+ {
+ $id = isset($values['id']) && $values['id'] ?
$values['id'] : phpgw::get_var('id', 'int');
+
+ if ($id)
+ {
+ $values = $this->bo->read_single($id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' => "property.uireport.save",
+ 'id' => $id
+ );
+
+ $datasets = $this->bo->get_datasets();
+ foreach ($datasets as $item)
+ {
+ $selected = 0;
+ if ($values['dataset_id'] == $item['id']){
+ $selected = 1;
+ }
+ $list[] = array('id' => $item['id'], 'name' =>
$item['name'], 'selected' => $selected);
+ }
+
+ $default_value = array('id' => '', 'name' =>
lang('Select'));
+ array_unshift($list, $default_value);
+
+ $tabs = array();
+ $tabs['report'] = array('label' => lang('report'),
'link' => '#report');
+ $active_tab = 'report';
+
+ $msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
+
+ $data = array
+ (
+ 'datatable_def' => array(),
+ 'editable' => $mode == 'edit',
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data),
+ 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uireport.index')),
+ 'datasets' => array('options' => $list),
+ 'report_definition' =>
$values['report_definition'],
+ 'report_id' => $values['id'],
+ 'report_name' => $values['report_name'],
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+ 'validator' =>
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'))
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . lang('report generator');
+
+ self::add_javascript('property', 'portico',
'report.edit.js');
+
+ self::render_template_xsl(array('report'), array('edit'
=> $data));
+ }
+
+ private function _populate( $data = array() )
+ {
+ $report_id = phpgw::get_var('report_id');
+ $report_name = phpgw::get_var('report_name');
+ $dataset_id = phpgw::get_var('dataset_id');
+
+ $group = phpgw::get_var('group');
+ $order = phpgw::get_var('order');
+ $aggregate = phpgw::get_var('aggregate');
+ $cbo_aggregate = phpgw::get_var('cbo_aggregate');
+ $txt_aggregate = phpgw::get_var('txt_aggregate');
+
+ $values['id'] = $report_id;
+
+ if (!$report_name)
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please enter a report name !'));
+ }
+
+ if (!$dataset_id)
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please select dataset name !'));
+ }
+
+ if (!count($group))
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please select a columns !'));
+ }
+
+ if (!count($aggregate))
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please select an aggregate expression (count/sum) !'));
+ }
+
+ $values['report_name'] = $report_name;
+ $values['report_definition']['group'] = $group;
+ $values['report_definition']['order'] = $order;
+ $values['report_definition']['aggregate'] = $aggregate;
+ $values['report_definition']['cbo_aggregate'] =
$cbo_aggregate;
+ $values['report_definition']['txt_aggregate'] =
$txt_aggregate;
+ $values['dataset_id'] = $dataset_id;
+
+ return $values;
+ }
+
+ public function save()
+ {
+ if (!$_POST)
+ {
+ return $this->edit();
+ }
+
+ /*
+ * Overrides with incoming data from POST
+ */
+ $values = $this->_populate();
+
+ if ($this->receipt['error'])
+ {
+ $this->edit($values);
+ }
+ else
+ {
+ try
+ {
+ $receipt = $this->bo->save($values);
+ $id = $receipt['id'];
+ }
+ catch (Exception $e)
+ {
+ if ($e)
+ {
+
phpgwapi_cache::message_set($e->getMessage(), 'error');
+ $this->edit($values);
+ return;
+ }
+ }
+
+ self::message_set($receipt);
+
+ self::redirect(array('menuaction' =>
'property.uireport.edit', 'id' => $id));
+ }
+ }
+
+ function delete()
+ {
+ $id = phpgw::get_var('id');
+
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ $receipt = $this->bo->delete($id);
+
+ if ($receipt['message'])
+ {
+ $message =
$receipt['message'][0]['msg'];
+ } else {
+ $message = $receipt['error'][0]['msg'];
+ }
+
+ return $message;
+ }
+ }
+
+
+ public function add_dataset()
+ {
+ $this->edit_dataset();
+ }
+
+ public function edit_dataset( $values = array(), $mode = 'edit'
)
+ {
+ $id = isset($values['id']) && $values['id'] ?
$values['id'] : phpgw::get_var('id', 'int');
+
+ if ($id)
+ {
+ $values = $this->bo->read_single_dataset($id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
"property.uireport.save_dataset",
+ 'id' => $id
+ );
+
+ $views = $this->bo->get_views();
+ foreach ($views as $view)
+ {
+ $selected = 0;
+ if ($values['view_name'] == $view['name']){
+ $selected = 1;
+ }
+ $list[] = array('id' => $view['name'], 'name'
=> $view['name'], 'selected' => $selected);
+ }
+
+ $default_value = array('id' => '', 'name' =>
lang('Select'));
+ array_unshift($list, $default_value);
+
+ $tabs = array();
+ $tabs['report'] = array('label' => lang('dataset'),
'link' => '#report');
+ $active_tab = 'report';
+
+ $msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
+
+ $data = array
+ (
+ 'datatable_def' => array(),
+ 'editable' => $mode == 'edit',
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data),
+ 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uireport.index')),
+ 'views' => array('options' => $list),
+ 'dataset_name' => $values['dataset_name'],
+ 'dataset_id' => isset($values['id']) ?
$values['id'] : '',
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab)
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . lang('report generator');
+
+ self::add_javascript('property', 'portico',
'report.edit.js');
+
+ self::render_template_xsl(array('report'),
array('edit_dataset' => $data));
+ }
+
+ private function _populate_dataset( $data = array() )
+ {
+ $dataset_id = phpgw::get_var('dataset_id');
+ $values = phpgw::get_var('values');
+
+ $values['id'] = $dataset_id;
+
+ if (!$values['view_name'])
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please select a view name !'));
+ }
+
+ if (!$values['dataset_name'])
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Please enter a dataset name !'));
+ }
+
+ return $values;
+ }
+
+ public function save_dataset()
+ {
+ if (!$_POST)
+ {
+ return $this->edit_dataset();
+ }
+
+ /*
+ * Overrides with incoming data from POST
+ */
+ $values = $this->_populate_dataset();
+
+ if ($this->receipt['error'])
+ {
+ $this->edit_dataset($values);
+ }
+ else
+ {
+ try
+ {
+ $receipt =
$this->bo->save_dataset($values);
+ $id = $receipt['id'];
+ }
+ catch (Exception $e)
+ {
+ if ($e)
+ {
+
phpgwapi_cache::message_set($e->getMessage(), 'error');
+ $this->edit_dataset($values);
+ return;
+ }
+ }
+
+ self::message_set($receipt);
+
+ self::redirect(array('menuaction' =>
'property.uireport.edit_dataset', 'id' => $id));
+ }
+ }
+
+ function delete_dataset()
+ {
+ $id = phpgw::get_var('id');
+
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ $receipt = $this->bo->delete_dataset($id);
+
+ if ($receipt['message'])
+ {
+ $message =
$receipt['message'][0]['msg'];
+ } else {
+ $message = $receipt['error'][0]['msg'];
+ }
+
+ return $message;
+ }
+ }
+
+ /**
+ * Fetch data from $this->bo based on parametres
+ * @return array
+ */
+ public function query()
+ {
+ $query = phpgw::get_var('query');
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
+ $export = phpgw::get_var('export', 'bool');
+
+ $dataset_id = phpgw::get_var('dataset_id', 'int');
+
+ $params = array(
+ 'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('length', 'int',
'REQUEST', 0),
+ 'query' => $query ? $query : $search['value'],
+ 'order' =>
$columns[$order[0]['column']]['data'],
+ 'sort' => $order[0]['dir'],
+ 'dir' => $order[0]['dir'],
+ 'dataset_id' => $dataset_id,
+ 'allrows' => phpgw::get_var('length', 'int') ==
-1 || $export,
+ );
+
+ $values = $this->bo->read($params);
+
+ if ($export)
+ {
+ return $values;
+ }
+
+ $result_data = array('results' => $values);
+
+ $result_data['total_records'] =
$this->bo->total_records_reports;
+ $result_data['draw'] = $draw;
+
+ $link_data = array
+ (
+ 'menuaction' => "property.uireport.edit"
+ );
+
+ return $this->jquery_results($result_data);
+ }
+
+ public function query_dataset()
+ {
+ $query = phpgw::get_var('query');
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
+ $export = phpgw::get_var('export', 'bool');
+
+ $params = array(
+ 'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('length', 'int',
'REQUEST', 0),
+ 'query' => $query ? $query : $search['value'],
+ 'order' =>
$columns[$order[0]['column']]['data'],
+ 'sort' => $order[0]['dir'],
+ 'dir' => $order[0]['dir'],
+ 'allrows' => phpgw::get_var('length', 'int') ==
-1 || $export,
+ );
+
+ $values = $this->bo->read_dataset($params);
+
+ if ($export)
+ {
+ return $values;
+ }
+
+ $result_data = array('results' => $values);
+
+ $result_data['total_records'] =
$this->bo->total_records_dataset;
+ $result_data['draw'] = $draw;
+
+ $link_data = array
+ (
+ 'menuaction' => "property.uireport.edit_dataset"
+ );
+
+ return $this->jquery_results($result_data);
+ }
+
+ public function get_columns()
+ {
+ $dataset_id = phpgw::get_var('dataset_id');
+
+ $columns = $this->bo->get_columns($dataset_id);
+
+ return $columns;
+ }
+
+ }
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -1191,6 +1191,7 @@
$GLOBALS['phpgw']->jqcal->add_listener('filter_start_date');
$GLOBALS['phpgw']->jqcal->add_listener('filter_end_date');
phpgwapi_jquery::load_widget('chart');
+ phpgwapi_jquery::load_widget('print');
$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);
Copied: branches/Version-2_0-branch/property/js/portico/report.edit.js (from
rev 16588, trunk/property/js/portico/report.edit.js)
===================================================================
--- branches/Version-2_0-branch/property/js/portico/report.edit.js
(rev 0)
+++ branches/Version-2_0-branch/property/js/portico/report.edit.js
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,134 @@
+$(document).ready(function ()
+{
+ //$('.processing').hide();
+
+ $('#btn_get_columns').click( function()
+ {
+ var oArgs = {menuaction: 'property.uireport.get_columns'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ var data = {"dataset_id": $('#cbo_dataset_id').val()};
+
+ if ($('#cbo_dataset_id').val() == '')
+ {
+ return;
+ }
+
+ $('.processing').show();
+ $.ajax({
+ type: 'GET',
+ url: requestUrl,
+ dataType: 'json',
+ data: data
+ }).always(function () {
+ //$('.processing').hide();
+ }).done(function (result) {
+ //console.log(result);
+ $('#container_columns').empty();
+ $('#container_groups').empty();
+ $('#container_order').empty();
+ $('#container_aggregates').empty();
+
+ build_check_columns(result);
+ if (jsonB !== '')
+ {
+ set_values();
+ }
+ });
+ });
+
+ $('#btn_get_columns').click();
+});
+
+function set_values()
+{
+ $.each(jsonB.group, function(key, value)
+ {
+ $("#c_" + key).prop('checked', true);
+ $("#c_" + key).change();
+ });
+
+ $.each(jsonB.order, function(key, value)
+ {
+ $("#o_" + key).prop('checked', true);
+ });
+
+ $.each(jsonB.aggregate, function(key, value)
+ {
+ $("#a_" + key).prop('checked', true);
+ $("#a_" + key).change();
+ });
+
+ $.each(jsonB.cbo_aggregate, function(key, value)
+ {
+ $("#cbo_" + key).val(value);
+ });
+
+ $.each(jsonB.txt_aggregate, function(key, value)
+ {
+ $("#txt_" + key).val(value);
+ });
+}
+
+function build_check_columns(data)
+{
+ $.each(data, function(key, object)
+ {
+ $('#container_columns').append('<span
style="margin-right:12px;"><input type="checkbox" id="c_'+ object.name +'"
value="'+ object.name +'" onchange="build_check_groups(\''+ object.name
+'\')"/> ' + object.name + '</span>');
+
+ var combo = build_list_aggregates(object.name, object.type);
+ var text = build_text_aggregates(object.name);
+ var check = build_check_aggregates(object.name);
+ var el_1 = '<span style="display:table-row;">'+ check + combo +
text + '</span>';
+ $('#container_aggregates').append(el_1);
+ });
+}
+
+function build_check_groups(name)
+{
+ if ($("#c_" + name).is(":checked"))
+ {
+ var el_1 = '<span style="display:block;"><input onclick="return
false;" onkeydown="return false;" type="checkbox" name="group['+ name +']"
id="g_'+ name +'" value="'+ name +'" checked/>' + name + '</span>';
+ var el_2 = '<span style="display:block;"><input type="checkbox"
name="order['+ name +']" id="o_'+ name +'" value="'+ name +'"/>' + name +
'</span>';
+ $('#container_groups').append(el_1);
+ $('#container_order').append(el_2);
+ }
+ else {
+ $("#g_" + name).parent().remove();
+ $("#o_" + name).parent().remove();
+ }
+}
+
+function build_check_aggregates(name)
+{
+ var el = '<span style="display:table-cell;"><input type="checkbox"
name="aggregate['+ name +']" id="a_'+ name +'" value="'+ name +'"
onchange="enabled_disabled_aggregates(\''+ name +'\')"/>' + name + '</span>';
+ return el;
+}
+
+function build_list_aggregates(name, type)
+{
+ var combo = $("<select></select>");
+ combo.append("<option value='count'>Count</option>");
+ if (type == 'integer')
+ {
+ combo.append("<option value='sum'>Sum</option>");
+ }
+
+ return "<span style='display:table-cell;'><select disabled='true'
id='cbo_" + name + "' name='cbo_aggregate["+ name +"]'>" + $(combo).html() +
"</select></span>";
+}
+
+function build_text_aggregates(name)
+{
+ return "<span style='display:table-cell;'>As <input disabled='true'
data-validation='required' type='text' id='txt_" + name + "'
name='txt_aggregate["+ name +"]'/></span>";
+}
+
+function enabled_disabled_aggregates(name)
+{
+ if ($("#a_" + name).is(":checked"))
+ {
+ $("#cbo_" + name).prop('disabled', false);
+ $("#txt_" + name).prop('disabled', false);
+ } else {
+ $("#cbo_" + name).prop('disabled', true);
+ $("#txt_" + name).prop('disabled', true);
+ }
+}
Copied: branches/Version-2_0-branch/property/js/portico/report.index.js (from
rev 16588, trunk/property/js/portico/report.index.js)
===================================================================
--- branches/Version-2_0-branch/property/js/portico/report.index.js
(rev 0)
+++ branches/Version-2_0-branch/property/js/portico/report.index.js
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,52 @@
+
+$(document).ready(function ()
+{
+ $('#list_dataset').change( function()
+ {
+ paramsTable0['dataset_id'] = $('#list_dataset').val();
+
+ oTable0.fnDraw();
+ });
+
+});
+
+function newReport(oArgs)
+{
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ window.open(requestUrl, '_self');
+};
+
+function newDataset(oArgs)
+{
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ window.open(requestUrl, '_self');
+};
+
+function download(oArgs)
+{
+ var api = $('#datatable-container_0').dataTable().api();
+ var selected = api.rows({selected: true}).data();
+
+ if (selected.length == 0)
+ {
+ alert('None selected');
+ return false;
+ }
+
+ if (!confirm("This will take some time..."))
+ {
+ return false;
+ }
+
+ var requestUrl = '';
+ for (var n = 0; n < selected.length; ++n)
+ {
+ var aData = selected[n];
+ oArgs['id'] = aData['id'];
+
+ requestUrl = phpGWLink('index.php', oArgs);
+ window.open(requestUrl, '_self');
+ }
+}
Modified: branches/Version-2_0-branch/property/js/portico/tts.report.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/tts.report.js
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/js/portico/tts.report.js
2017-04-18 10:59:12 UTC (rev 16589)
@@ -64,4 +64,23 @@
$("#btn_search").trigger( "click" );
+ $('#btn_print').click( function()
+ {
+ var canvas = document.getElementById("chart-area");
+ var src = canvas.toDataURL("image/png");
+
+ $("#content-image").html('');
+
+ var img = $('<img id="dynamic">');
+ img.attr('src', src);
+ img.width(500);
+ img.appendTo('#content-image');
+
+ $("#content-image").print({
+ //Use Global styles
+ globalStyles : false,
+ //Add link with attrbute media=print
+ mediaPrint : true
+ });
+ });
});
Modified: branches/Version-2_0-branch/property/setup/default_records.inc.php
===================================================================
--- branches/Version-2_0-branch/property/setup/default_records.inc.php
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/setup/default_records.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -88,6 +88,7 @@
$GLOBALS['phpgw']->locations->add("{$location}.category",
'Categories', 'property');
}
+ $GLOBALS['phpgw']->locations->add('.report', 'Generic report',
'property', $allow_grant = true);
$GLOBALS['phpgw_setup']->oProc->query("DELETE from phpgw_config WHERE
config_app='property'");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_config
(config_app, config_name, config_value) VALUES ('property','meter_table',
'fm_entity_1_1')");
Modified: branches/Version-2_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/property/setup/setup.inc.php 2017-04-18
10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/setup/setup.inc.php 2017-04-18
10:59:12 UTC (rev 16589)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.710';
+ $setup_info['property']['version'] = '0.9.17.711';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
@@ -214,7 +214,9 @@
'fm_jasper_input',
'fm_custom_menu_items',
'fm_regulations',
- 'fm_generic_history'
+ 'fm_generic_history',
+ 'fm_view_dataset',
+ 'fm_view_dataset_report'
);
/* The hooks this app includes, needed for hooks registration */
Modified: branches/Version-2_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/property/setup/tables_current.inc.php
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/setup/tables_current.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -2848,5 +2848,32 @@
'contact_id' => 'contact_id')),
'ix' => array(),
'uc' => array('contact_id', 'location_code')
+ ),
+ 'fm_view_dataset' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'view_name' => array('type' => 'varchar',
'precision' => 100, 'nullable' => False),
+ 'dataset_name' => array('type' => 'varchar',
'precision' => 100, 'nullable' => False),
+ 'owner_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ 'entry_date' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'fm_view_dataset_report' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'dataset_id' => array('type' => 'int',
'precision' => 4, 'nullable' => False),
+ 'report_name' => array('type' => 'varchar',
'precision' => 100, 'nullable' => False),
+ 'report_definition' => array('type' => 'jsonb',
'nullable' => true),
+ 'owner_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ 'entry_date' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('fm_view_dataset' => array('dataset_id'
=> 'id')),
+ 'ix' => array(),
+ 'uc' => array()
)
);
Modified: branches/Version-2_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/property/setup/tables_update.inc.php
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/setup/tables_update.inc.php
2017-04-18 10:59:12 UTC (rev 16589)
@@ -9457,3 +9457,59 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.709 to 0.9.17.711
+ *
+ */
+ $test[] = '0.9.17.710';
+
+ function property_upgrade0_9_17_710()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $GLOBALS['phpgw']->locations->add('.report', 'Generic report',
'property', $allow_grant = true);
+
+ $metadata =
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_view_dataset');
+
+ if(!$metadata)
+ {
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_view_dataset', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => False),
+ 'view_name' => array('type' =>
'varchar', 'precision' => 100, 'nullable' => False),
+ 'dataset_name' => array('type'
=> 'varchar', 'precision' => 100, 'nullable' => False),
+ 'owner_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ 'entry_date' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_view_dataset_report', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => False),
+ 'dataset_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => False),
+ 'report_name' => array('type'
=> 'varchar', 'precision' => 100, 'nullable' => False),
+ 'report_definition' =>
array('type' => 'jsonb', 'nullable' => true),
+ 'owner_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ 'entry_date' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('fm_view_dataset' =>
array('dataset_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.711';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Copied: branches/Version-2_0-branch/property/templates/base/report.xsl (from
rev 16588, trunk/property/templates/base/report.xsl)
===================================================================
--- branches/Version-2_0-branch/property/templates/base/report.xsl
(rev 0)
+++ branches/Version-2_0-branch/property/templates/base/report.xsl
2017-04-18 10:59:12 UTC (rev 16589)
@@ -0,0 +1,225 @@
+
+<xsl:template match="data">
+ <xsl:choose>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit"/>
+ </xsl:when>
+ <xsl:when test="edit_dataset">
+ <xsl:apply-templates select="edit_dataset"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="lists"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="jquery_phpgw_i18n"/>
+</xsl:template>
+
+<xsl:template match="lists">
+ <div id="document_edit_tabview">
+ <xsl:value-of select="validator"/>
+ <div id="tab-content">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
+ <div id="reports">
+ <form name="form" class="pure-form
pure-form-aligned" id="form" action="" method="post">
+ <div class="pure-control-group">
+ <label for="vendor">
+ <xsl:value-of
select="php:function('lang', 'datasets')" />
+ </label>
+ <select id="list_dataset"
name="list_dataset">
+ <xsl:apply-templates
select="list_views/options"/>
+ </select>
+ </div>
+
+ <xsl:for-each select="datatable_def">
+ <xsl:if test="container =
'datatable-container_0'">
+ <xsl:call-template
name="table_setup">
+ <xsl:with-param
name="container" select ='container'/>
+ <xsl:with-param
name="requestUrl" select ='requestUrl' />
+ <xsl:with-param
name="ColumnDefs" select ='ColumnDefs' />
+ <xsl:with-param
name="tabletools" select ='tabletools' />
+ <xsl:with-param
name="config" select ='config' />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </form>
+ </div>
+
+ <div id="views">
+ <form name="form" class="pure-form
pure-form-aligned" id="form" action="" method="post">
+ <xsl:for-each select="datatable_def">
+ <xsl:if test="container =
'datatable-container_1'">
+ <xsl:call-template
name="table_setup">
+ <xsl:with-param
name="container" select ='container'/>
+ <xsl:with-param
name="requestUrl" select ='requestUrl' />
+ <xsl:with-param
name="ColumnDefs" select ='ColumnDefs' />
+ <xsl:with-param
name="tabletools" select ='tabletools' />
+ <xsl:with-param
name="config" select ='config' />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </form>
+ </div>
+ </div>
+ </div>
+</xsl:template>
+
+
+<xsl:template match="edit">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <dl>
+ <dt>
+ <xsl:call-template name="msgbox"/>
+ </dt>
+ </dl>
+ </xsl:when>
+ </xsl:choose>
+ <script type="text/javascript">
+ var jsonB = <xsl:value-of select="report_definition"/>;
+ </script>
+ <div id="document_edit_tabview">
+
+ <xsl:variable name="form_action">
+ <xsl:value-of select="form_action"/>
+ </xsl:variable>
+ <form name="form" class="pure-form pure-form-aligned" id="form"
action="{$form_action}" method="post">
+ <div id="tab-content">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
+ <div id="report">
+ <input type="hidden" name="report_id"
value="{report_id}"/>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'report name')" />
+ </label>
+ <input type="text"
data-validation="required" name="report_name" value="{report_name}"></input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'dataset')" />
+ </label>
+ <select id="cbo_dataset_id"
name="dataset_id">
+ <xsl:apply-templates
select="datasets/options"/>
+ </select>
+ <input type="button"
class="pure-button pure-button-primary" name="btn_get_columns"
id="btn_get_columns">
+ <xsl:attribute
name="value">
+ <xsl:value-of
select="php:function('lang', 'get columns')" />
+ </xsl:attribute>
+ </input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'Choose columns')" />
+ </label>
+ <div id="container_columns"
class="pure-custom"></div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'Group by')" />
+ </label>
+ <div id="container_groups"
class="pure-custom"></div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'Sort by')" />
+ </label>
+ <div id="container_order"
class="pure-custom"></div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'Count / Sum')" />
+ </label>
+ <div id="container_aggregates"
class="pure-custom"></div>
+ </div>
+ </div>
+ </div>
+ <div class="proplist-col">
+ <input type="submit" class="pure-button
pure-button-primary" name="save" id="btn_save">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'save')" />
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of
select="lang_save_statustext"/>
+ </xsl:attribute>
+ </input>
+ <xsl:variable name="cancel_action">
+ <xsl:value-of select="cancel_action"/>
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="cancel" onclick="location.href='{$cancel_action}'">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'cancel')" />
+ </xsl:attribute>
+ </input>
+ </div>
+ </form>
+ </div>
+</xsl:template>
+
+<xsl:template match="edit_dataset">
+
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <dl>
+ <dt>
+ <xsl:call-template name="msgbox"/>
+ </dt>
+ </dl>
+ </xsl:when>
+ </xsl:choose>
+
+ <div id="document_edit_tabview">
+ <xsl:value-of select="validator"/>
+ <xsl:variable name="form_action">
+ <xsl:value-of select="form_action"/>
+ </xsl:variable>
+ <form name="form" class="pure-form pure-form-aligned" id="form"
action="{$form_action}" method="post">
+ <div id="tab-content">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
+ <div id="report">
+ <input type="hidden" name="dataset_id"
value="{dataset_id}"/>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'view')" />
+ </label>
+ <select
name="values[view_name]">
+ <xsl:apply-templates
select="views/options"/>
+ </select>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'dataset name')" />
+ </label>
+ <input type="text"
name="values[dataset_name]" value="{dataset_name}"></input>
+ </div>
+ </div>
+ </div>
+ <div class="proplist-col">
+ <input type="submit" class="pure-button
pure-button-primary" name="save" id="btn_save">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'save')" />
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of
select="lang_save_statustext"/>
+ </xsl:attribute>
+ </input>
+ <xsl:variable name="cancel_action">
+ <xsl:value-of select="cancel_action"/>
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="cancel" onclick="location.href='{$cancel_action}'">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'cancel')" />
+ </xsl:attribute>
+ </input>
+ </div>
+ </form>
+ </div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected = 'selected' or selected = 1">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:attribute name="title" value="description" />
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
Modified: branches/Version-2_0-branch/property/templates/base/tts_report.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/tts_report.xsl
2017-04-18 10:54:53 UTC (rev 16588)
+++ branches/Version-2_0-branch/property/templates/base/tts_report.xsl
2017-04-18 10:59:12 UTC (rev 16589)
@@ -2,7 +2,11 @@
<!-- $Id$ -->
<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
+ <style type="text/css">
+ .content-image {
+ display: none;
+ }
+ </style>
<form class="pure-form pure-form-aligned" id="form" name="form"
method="post" action="">
<fieldset>
<div class="pure-control-group">
@@ -41,12 +45,18 @@
<xsl:value-of
select="php:function('lang', 'search')"/>
</xsl:attribute>
</input>
+ <input type="button" id="btn_print"
name="btn_print" size="40">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'print')"/>
+ </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" />
+ <canvas style="display:inline-block;"
id="chart-area" ></canvas>
</div>
+ <div id="content-image" class="content-image"></div>
</fieldset>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16589] Stable: Merge 16585:16588 from trunk,
sigurdne <=