[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16102] Backport diff from Syncromind to trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16102] Backport diff from Syncromind to trunk |
Date: |
Sun, 18 Dec 2016 20:52:39 +0000 (UTC) |
Revision: 16102
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16102
Author: sigurdne
Date: 2016-12-18 20:52:38 +0000 (Sun, 18 Dec 2016)
Log Message:
-----------
Backport diff from Syncromind to trunk
Modified Paths:
--------------
trunk/phpgwapi/inc/class.vfs_shared.inc.php
trunk/phpgwapi/inc/class.vfs_sql.inc.php
trunk/phpgwapi/setup/setup.inc.php
trunk/phpgwapi/setup/tables_current.inc.php
trunk/phpgwapi/setup/tables_update.inc.php
trunk/property/inc/class.bogeneric_document.inc.php
trunk/property/inc/class.sogeneric_document.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.uigeneric_document.inc.php
trunk/property/inc/class.uiimport_components.inc.php
trunk/property/inc/import/class.import_component_files.inc.php
trunk/property/js/portico/generic_document.edit.js
trunk/property/js/portico/import_components.js
trunk/property/templates/base/condition_survey.xsl
trunk/property/templates/base/import_components.xsl
trunk/property/templates/base/multi_upload_file.xsl
trunk/rental/setup/setup.inc.php
Property Changed:
----------------
trunk/
trunk/booking/
trunk/bookingfrontend/
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-15891
/branches/stavangerkommune:12743-12875,12986
+ /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-16101
/branches/stavangerkommune:12743-12875,12986
Property changes on: trunk/booking
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/dev-syncromind-2/booking:14933-15891
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
+ /branches/dev-syncromind-2/booking:14933-16101
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
Property changes on: trunk/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/dev-syncromind-2/bookingfrontend:14933-15891
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
+ /branches/dev-syncromind-2/bookingfrontend:14933-16101
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
Modified: trunk/phpgwapi/inc/class.vfs_shared.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.vfs_shared.inc.php 2016-12-18 20:20:04 UTC (rev
16101)
+++ trunk/phpgwapi/inc/class.vfs_shared.inc.php 2016-12-18 20:52:38 UTC (rev
16102)
@@ -1105,7 +1105,9 @@
$data = array ();
}
- $string = preg_replace ("/'/", "/\'/", $data['string']);
+ //$string = preg_replace ("/'/", "/\'/",
$data['string']);
+ $string =
$GLOBALS['phpgw']->db->db_addslashes($data['string']);
+
return $string;
}
Modified: trunk/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.vfs_sql.inc.php 2016-12-18 20:20:04 UTC (rev
16101)
+++ trunk/phpgwapi/inc/class.vfs_sql.inc.php 2016-12-18 20:52:38 UTC (rev
16102)
@@ -1999,7 +1999,7 @@
{
if($this->file_actions)
{
- $new_name =
$t->fake_leading_dirs .'/'.$file_id.'_#' .$t->fake_name_clean;
+ $new_name =
$t->fake_leading_dirs .'/'.$file_id.'_#' .$t->fake_name;
$t2 =
$this->path_parts(array(
'string' => $new_name,
@@ -2015,7 +2015,7 @@
. "
directory='{$t2->fake_leading_dirs_clean}',"
. "
name='{$t2->fake_name_clean}'"
. " WHERE
owner_id='{$this->working_id}' AND directory='{$t->fake_leading_dirs_clean}'"
- . " AND
name='{$t->fake_name_clean}'", __LINE__, __FILE__);
+ . " AND
name='{$GLOBALS['phpgw']->db->db_addslashes($t->fake_name_clean)}'", __LINE__,
__FILE__);
$t = $t2;
}
Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php 2016-12-18 20:20:04 UTC (rev 16101)
+++ trunk/phpgwapi/setup/setup.inc.php 2016-12-18 20:52:38 UTC (rev 16102)
@@ -12,7 +12,7 @@
// Basic information about this app
$setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi';
- $setup_info['phpgwapi']['version'] = '0.9.17.552';
+ $setup_info['phpgwapi']['version'] = '0.9.17.553';
$setup_info['phpgwapi']['versions']['current_header'] = '1.31';
$setup_info['phpgwapi']['versions']['system'] = '2.0';
$setup_info['phpgwapi']['enable'] = 3;
Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2016-12-18 20:20:04 UTC (rev
16101)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2016-12-18 20:52:38 UTC (rev
16102)
@@ -291,6 +291,7 @@
'version' => array('type' =>
'varchar','precision' => 30,'nullable' => False,'default' => '0.0.0.0'),
'content' => array('type' => 'text','nullable'
=> True),
'external_id' => array('type' =>
'int','precision' => 8,'nullable' => True),
+ 'md5_sum' => array('type' =>
'varchar','precision' => '64','nullable' => True),
),
'pk' => array('file_id'),
'fk' => array(),
Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php 2016-12-18 20:20:04 UTC (rev
16101)
+++ trunk/phpgwapi/setup/tables_update.inc.php 2016-12-18 20:52:38 UTC (rev
16102)
@@ -3428,3 +3428,31 @@
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
}
+
+ $test[] = '0.9.17.552';
+ /**
+ * Alter column definition
+ * @return string the new version number
+ */
+ function phpgwapi_upgrade0_9_17_552()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $metadata =
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('phpgw_vfs');
+
+ if(empty($metadata['md5_sum']))
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_vfs','md5_sum', array(
+ 'type' => 'varchar',
+ 'precision' => 64,
+ 'nullable' => true
+ ));
+
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['phpgwapi']['currentver'] =
'0.9.17.553';
+ return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+ }
+ }
Modified: trunk/property/inc/class.bogeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.bogeneric_document.inc.php 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/inc/class.bogeneric_document.inc.php 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -61,9 +61,9 @@
return json_decode($values);
}
- function get_file_relations( $location_id, $file_id )
+ function get_file_relations( $file_id, $location_id )
{
- $values = $this->so->get_file_relations($location_id,
$file_id);
+ $values = $this->so->get_file_relations($file_id,
$location_id);
return $values;
}
@@ -87,10 +87,10 @@
return $receipt;
}
- function save_file_relations( $items = array(), $location_id,
$file_id )
+ function save_file_relations( $add, $delete, $location_id,
$file_id )
{
- $receipt = $this->so->save_file_relations( $items,
$location_id, $file_id );
+ $receipt = $this->so->save_file_relations( $add,
$delete, $location_id, $file_id );
return $receipt;
}
Modified: trunk/property/inc/class.sogeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric_document.inc.php 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/inc/class.sogeneric_document.inc.php 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -167,9 +167,14 @@
return $values;
}
- public function get_file_relations($location_id, $file_id)
+ public function get_file_relations($file_id, $location_id =
null)
{
- $filtermethod = "WHERE location_id = {$location_id} AND
file_id = {$file_id}";
+ if ($location_id)
+ {
+ $filtermethod = "WHERE location_id =
{$location_id} AND file_id = {$file_id}";
+ } else {
+ $filtermethod = "WHERE file_id = {$file_id}";
+ }
$sql = "SELECT * FROM phpgw_vfs_file_relation " ."
{$filtermethod} ";
$this->db->query($sql, __LINE__, __FILE__);
@@ -188,18 +193,24 @@
return $values;
}
- function save_file_relations( $items = array(), $location_id,
$file_id )
+ function save_file_relations( $add, $delete, $location_id,
$file_id )
{
$this->db->transaction_begin();
- $this->db->query("DELETE FROM phpgw_vfs_file_relation
WHERE file_id = {$file_id} AND location_id = {$location_id}", __LINE__,
__FILE__);
-
+ if (count($delete))
+ {
+ foreach($delete as $item)
+ {
+ $this->db->query("DELETE FROM
phpgw_vfs_file_relation WHERE location_item_id = {$item} AND file_id =
{$file_id} AND location_id = {$location_id}", __LINE__, __FILE__);
+ }
+ }
+
$date_format =
phpgwapi_datetime::date_array(date('Y-m-d'));
$date = mktime(2, 0, 0, $date_format['month'],
$date_format['day'], $date_format['year']);
- if (count($items))
+ if (count($add))
{
- foreach($items as $item)
+ foreach($add as $item)
{
$values_insert = array
(
@@ -235,11 +246,11 @@
$values_insert = array
(
'file_id' => $file_id,
- 'metadata' => json_encode($data)
+ 'metadata' => "'" . json_encode($data) . "'"
);
$result = $this->db->query("INSERT INTO
phpgw_vfs_filedata (" . implode(',', array_keys($values_insert)) . ') VALUES ('
- .
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__,
__FILE__);
+ . implode(",", array_values($values_insert)) .
')', __LINE__, __FILE__);
if ($result)
{
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2016-12-18 20:20:04 UTC (rev
16101)
+++ trunk/property/inc/class.soinvoice.inc.php 2016-12-18 20:52:38 UTC (rev
16102)
@@ -2857,4 +2857,4 @@
$this->db->transaction_commit();
return $_last_line_id;
}
- }
\ No newline at end of file
+ }
Modified: trunk/property/inc/class.uigeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric_document.inc.php 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/inc/class.uigeneric_document.inc.php 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -119,7 +119,7 @@
self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.dataTables.editable.js');
$categories = $this->_get_categories();
-
+
$data = array(
'datatable_name' => lang('generic document'),
'form' => array(
@@ -228,7 +228,7 @@
'parameters' => json_encode($parameters)
);
}
-
+
self::render_template_xsl('datatable_jquery', $data);
}
@@ -259,13 +259,13 @@
{
return $values;
}
-
+
foreach($values as &$item)
- {
+ {
$item['name'] = '<a
href="'.self::link(array('menuaction' =>
'property.uigeneric_document.view_file', 'file_id' =>
$item['id'])).'">'.$item['name'].'</a>';
$item['link'] = self::link(array('menuaction'
=> 'property.uigeneric_document.view', 'id' => $item['id']));
}
-
+
$result_data = array('results' => $values);
$result_data['total_records'] =
$this->bo->total_records;
@@ -284,12 +284,11 @@
{
$type_id = 1;
}
-
+
$search = phpgw::get_var('search');
$order = phpgw::get_var('order');
$draw = phpgw::get_var('draw', 'int');
$columns = phpgw::get_var('columns');
- $mode = phpgw::get_var('mode');
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
@@ -301,16 +300,16 @@
'type_id' => $type_id,
'district_id' => phpgw::get_var('district_id',
'int', 'REQUEST', 0),
'part_of_town_id' =>
phpgw::get_var('part_of_town_id', 'int', 'REQUEST', 0),
- 'allrows' => phpgw::get_var('length', 'int') ==
-1
+ 'allrows' => ($only_related) ? 1 :
(phpgw::get_var('length', 'int') == -1)
);
-
+
$solocation = CreateObject('property.solocation');
$locations = $solocation->read($params);
$location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
if ($file_id)
{
- $relation_values =
$this->bo->get_file_relations($location_id, $file_id);
+ $relation_values =
$this->bo->get_file_relations($file_id, $location_id);
}
$values_location_item_id = array();
if (count($relation_values))
@@ -320,32 +319,23 @@
$values_location_item_id[] =
$item['location_item_id'];
}
}
-
+
$values = array();
foreach($locations as $item)
{
- if($mode == 'edit')
- {
- $checked = in_array($item['id'],
$values_location_item_id) ? ' checked="checked"' : '';
- $relate = "<input value='{$item['id']}'
class='components mychecks' type='checkbox'{$checked}>";
+ $checked = in_array($item['id'],
$values_location_item_id) ? 'checked="checked"' : '';
+ $hidden = ($checked) ? '<input type="hidden"
class="locations_related" value="'.$item['id'].'">' : '';
- }
- else
- {
- $relate = in_array($item['id'],
$values_location_item_id) ? 'X' : '';
- $checked = $relate;
- }
-
if ($only_related && empty($checked))
{
continue;
}
-
+
$values[] = array(
'location_code' => '<a
href="'.self::link(array('menuaction' => 'property.uilocation.view',
'location_code' => $item['location_code'])).'">'.$item['location_code'].'</a>',
'loc1_name' => $item['loc1_name'],
- 'relate' => $relate
- );
+ 'relate' => '<input
value="'.$item['id'].'" class="locations mychecks" type="checkbox"
'.$checked.'>'.$hidden
+ );
}
$result_data = array('results' => $values);
@@ -355,7 +345,7 @@
return $this->jquery_results($result_data);
}
-
+
public function view()
{
if (!$this->acl_read)
@@ -383,7 +373,7 @@
public function edit( $values = array(), $mode = 'edit' )
{
$id = isset($values['id']) && $values['id'] ?
$values['id'] : phpgw::get_var('id', 'int');
-
+
if (!$this->acl_add && !$this->acl_edit)
{
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uigeneric_document.view',
@@ -415,23 +405,23 @@
{
if (!$values)
{
- $values = (array)
$this->bo->read_single($id);
- $values['report_date'] =
($values['report_date']) ? date($this->dateFormat, $values['report_date']) :
'';
+ $values = (array)
$this->bo->read_single($id);
+ $values['report_date'] =
($values['report_date']) ? date($this->dateFormat, $values['report_date']) : '';
}
$values['id'] = $id;
}
-
+
$categories = $this->_get_categories($values['cat_id']);
self::message_set($this->receipt);
-
+
$datatable_def = array();
-
+
if ($id)
{
$tabs['relations'] = array('label' =>
lang('Components'), 'link' => '#relations');
$tabs['locations'] = array('label' =>
lang('Locations'), 'link' => '#locations');
-
+
$related_def = array
(
array('key' => 'id', 'label' =>
lang('id'), 'sortable' => false, 'resizeable' => true),
@@ -441,14 +431,14 @@
$values_location = $this->get_location_filter();
$entity_group =
execMethod('property.bogeneric.get_list', array('type' => 'entity_group',
'add_empty' => true));
- $type_filter =
execMethod('property.soadmin_location.read', array());
+ $type_filter =
execMethod('property.soadmin_location.read', array());
$category_filter =
$this->get_categories_for_type();
-
+
$district_filter =
$this->bocommon->select_district_list('filter');
array_unshift($district_filter, array('id' =>
'', 'name' => lang('no district')));
-
+
$part_of_town_filter =
$this->get_part_of_town();
-
+
$tabletools[] = array
(
'my_name' => 'relate',
@@ -470,11 +460,11 @@
(
'container' => 'datatable-container_0',
'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uigeneric_document.get_componentes',
- 'id' => $id,
'location_id' => $values_location[0]['id'], 'mode' => $mode, 'phpgw_return_as'
=> 'json'))),
+ 'id' => $id,
'location_id' => $values_location[0]['id'], 'phpgw_return_as' => 'json'))),
'ColumnDefs' => $related_def,
'tabletools' => ($mode == 'edit') ?
$tabletools : array()
);
-
+
$related_def2 = array
(
array('key' => 'location_code', 'label'
=> lang('location'), 'sortable' => true, 'resizeable' => true),
@@ -482,7 +472,7 @@
//array('key' => 'location_id', 'label'
=> lang('location id'), 'sortable' => false, 'resizeable' => true, 'hidden' =>
true),
array('key' => 'relate', 'label' =>
lang('related'), 'sortable' => false, 'resizeable' => true),
);
-
+
$tabletools2[] = array
(
'my_name' => 'relate_locations',
@@ -497,19 +487,19 @@
setRelationsLocations(oArgs);
"
);
-
+
$datatable_def[] = array
(
'container' => 'datatable-container_1',
- 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uigeneric_document.get_locations_for_type', 'id' => $id, 'mode' =>
$mode, 'phpgw_return_as' => 'json'))),
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uigeneric_document.get_locations_for_type', 'id' => $id,
'phpgw_return_as' => 'json'))),
'ColumnDefs' => $related_def2,
'tabletools' => ($mode == 'edit') ?
$tabletools2 : array()
- );
+ );
}
-
+
$vfs = CreateObject('phpgwapi.vfs');
$file_info = $vfs->get_info($id);
-
+
$data = array
(
'datatable_def' => $datatable_def,
@@ -523,12 +513,12 @@
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
'location_filter' => array('options' =>
$values_location),
'entity_group_filter' => array('options' =>
$entity_group),
-
+
'type_filter' => array('options' =>
$type_filter),
'category_filter' => array('options' =>
$category_filter),
'district_filter' => array('options' =>
$district_filter),
'part_of_town_filter' => array('options' =>
$part_of_town_filter),
-
+
'link_controller_example' =>
self::link(array('menuaction' => 'controller.uicomponent.index'))
);
@@ -559,7 +549,7 @@
{
$type_id = 1;
}
-
+
$categories =
$this->bocommon->select_category_list(array
('format' => 'filter',
'selected' => '',
@@ -571,7 +561,7 @@
return $categories;
}
-
+
public function get_part_of_town()
{
$district_id = phpgw::get_var('district_id', 'int');
@@ -580,11 +570,11 @@
return $values;
}
-
+
public function get_location_filter()
{
$entity_group_id = phpgw::get_var('entity_group_id',
'int');
-
+
$location_filter =
phpgwapi_cache::session_get('property', "location_filter_{$entity_group_id}");
if (!$location_filter)
@@ -670,8 +660,8 @@
return;
}
}
-
- if ($receipt['message'])
+
+ if ($receipt['message'])
{
phpgwapi_cache::message_set($receipt['message'], 'message');
} else {
@@ -695,20 +685,19 @@
{
return;
}
-
+
$file_id = phpgw::get_var('id', 'int');
$location_id = phpgw::get_var('location_id', 'int');
$search = phpgw::get_var('search');
- $mode = phpgw::get_var('mode');
$draw = phpgw::get_var('draw', 'int');
$only_related = phpgw::get_var('only_related',
'boolean');
-
+
$soentity = CreateObject('property.soentity');
$_components = $soentity->read( array(
'start' => phpgw::get_var('start', 'int', 'REQUEST', 0),
'results' => phpgw::get_var('length', 'int', 'REQUEST', 0),
'query' => $search['value'],
- 'allrows' => phpgw::get_var('length', 'int') == -1,
+ 'allrows' => ($only_related) ? 1 : (phpgw::get_var('length',
'int') == -1),
'filter_entity_group' => 0,
'location_id' => $location_id,
'filter_item' => array()
@@ -716,7 +705,7 @@
if ($file_id)
{
- $relation_values =
$this->bo->get_file_relations($location_id, $file_id);
+ $relation_values =
$this->bo->get_file_relations($file_id, $location_id );
}
$values_location_item_id = array();
if (count($relation_values))
@@ -726,34 +715,25 @@
$values_location_item_id[] =
$item['location_item_id'];
}
}
-
+
$values = array();
foreach($_components as $item)
{
- if($mode == 'edit')
- {
- $checked = in_array($item['id'],
$values_location_item_id) ? ' checked="checked"' : '';
- $relate = "<input value='{$item['id']}'
class='components mychecks' type='checkbox'{$checked}>";
+ $checked = in_array($item['id'],
$values_location_item_id) ? 'checked="checked"' : '';
+ $hidden = ($checked) ? '<input type="hidden"
class="components_related" value="'.$item['id'].'">' : '';
- }
- else
- {
- $relate = in_array($item['id'],
$values_location_item_id) ? 'X' : '';
- $checked = $relate;
- }
-
if ($only_related && empty($checked))
{
continue;
}
-
+
$values[] = array(
'id' => '<a
href="'.self::link(array('menuaction' => 'property.uientity.view',
'location_id' => $location_id, 'id' => $item['id'])).'">'.$item['id'].'</a>',
'name' => $item['benevnelse'],
- 'relate' => $relate
+ 'relate' => '<input
value="'.$item['id'].'" class="components mychecks" type="checkbox"
'.$checked.'>'.$hidden,
);
}
-
+
$result_data = array('results' => $values);
$result_data['total_records'] = ($only_related) ?
count($values_location_item_id) : $soentity->total_records;
@@ -762,23 +742,27 @@
return $this->jquery_results($result_data);
}
-
+
public function save_file_relations()
{
$receipt = array();
-
+
$type_id = phpgw::get_var('type_id', 'int');
$location_id = phpgw::get_var('location_id', 'int');
$file_id = phpgw::get_var('file_id', 'int');
- $items = phpgw::get_var('items');
-
+ $items = phpgw::get_var('items', 'array', 'REQUEST',
array());
+ $related = phpgw::get_var('related', 'array',
'REQUEST', array());
+
+ $add = array_diff($items, $related);
+ $delete = array_diff($related, $items);
+
if (empty($location_id))
{
$location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
}
-
- $result = $this->bo->save_file_relations( $items,
$location_id, $file_id );
-
+
+ $result = $this->bo->save_file_relations( $add,
$delete, $location_id, $file_id );
+
if ($result)
{
$receipt['message'][] = array('msg' =>
lang('Records has been added'));
@@ -787,11 +771,11 @@
{
$receipt['error'][] = array('msg' =>
lang('Nothing changed'));
}
-
+
return $receipt;
}
-
+
/**
* Dowloads a single file to the browser
*
@@ -827,9 +811,9 @@
throw new Exception('Failed to upload
file !');
}
}
-
+
$bofiles = CreateObject('property.bofiles');
-
+
$file_name = str_replace(' ', '_',
$_FILES['file']['name']);
if ($file_name)
@@ -851,19 +835,19 @@
throw new Exception('failed to
create directory');
}
$bofiles->vfs->override_acl = 1;
-
+
$file_id = $bofiles->vfs->cp3(array(
'from' =>
$_FILES['file']['tmp_name'],
'to' => $to_file,
'id' => $id,
'relatives' =>
array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL)));
$bofiles->vfs->override_acl = 0;
-
+
if (empty($file_id))
- {
+ {
throw new Exception('Failed to
upload file !');
- }
-
+ }
+
return $file_id;
//}
} else {
Modified: trunk/property/inc/class.uiimport_components.inc.php
===================================================================
--- trunk/property/inc/class.uiimport_components.inc.php 2016-12-18
20:20:04 UTC (rev 16101)
+++ trunk/property/inc/class.uiimport_components.inc.php 2016-12-18
20:52:38 UTC (rev 16102)
@@ -118,22 +118,24 @@
return chr(65 + $index);
}
}
-
+
public function import_component_files()
{
- /*$location_code =
phpgwapi_cache::session_get('property', 'location_code');
- $id = phpgwapi_cache::session_get('property',
'location_item_id');
- $attrib_name_componentID =
phpgwapi_cache::session_get('property', 'attrib_name_componentID');*/
-
$location_code = phpgw::get_var('location_code');
$id = phpgw::get_var('location_item_id');
$attrib_name_componentID =
phpgw::get_var('attribute_name_component_id');
+ $preview = phpgw::get_var('preview');
+ $with_components =
phpgw::get_var('with_components_check');
- if (!$attrib_name_componentID)
+ /*if ($_FILES['file']['tmp_name'])
{
- $receipt['error'][] = array('msg' =>
lang('Choose attribute name for Component ID'));
- return $receipt;
- }
+ if (!$attrib_name_componentID)
+ {
+ $receipt['error'][] = array('msg' =>
lang('Choose attribute name for Component ID'));
+ return $receipt;
+ }
+ }*/
+
if (!$location_code)
{
$receipt['error'][] = array('msg' =>
lang('Choose Location'));
@@ -141,8 +143,20 @@
}
$import_component_files = new import_component_files();
- $receipt = $import_component_files->add_files($id,
$location_code, $attrib_name_componentID);
+ if ($preview)
+ {
+ $receipt = $import_component_files->preview();
+ return $receipt;
+ }
+
+ if ($with_components)
+ {
+ $receipt =
$import_component_files->add_files_components_location($id, $location_code,
$attrib_name_componentID);
+ } else {
+ $receipt =
$import_component_files->add_files_location($id, $location_code);
+ }
+
return $receipt;
}
Modified: trunk/property/inc/import/class.import_component_files.inc.php
===================================================================
--- trunk/property/inc/import/class.import_component_files.inc.php
2016-12-18 20:20:04 UTC (rev 16101)
+++ trunk/property/inc/import/class.import_component_files.inc.php
2016-12-18 20:52:38 UTC (rev 16102)
@@ -1,7 +1,9 @@
<?php
-
+
class import_component_files
{
+ private $receipt = array();
+
public function __construct()
{
$this->acl = & $GLOBALS['phpgw']->acl;
@@ -9,8 +11,11 @@
$this->fakebase = '/temp_files_components';
$this->path_upload_dir =
$GLOBALS['phpgw_info']['server']['files_dir'].$this->fakebase.'/';
-
- $this->latest_uploads = array();
+
+ $this->last_files_added = array();
+ $this->list_component_id = array();
+ $this->paths_from_file = array();
+ $this->paths_empty = array();
}
public function get_path_upload_dir()
@@ -50,7 +55,7 @@
private function _valid_row($row)
{
- if (empty($row[0]) && empty($row[(count($row)-1)]))
+ if (empty($row[(count($row)-1)]))
{
return false;
}
@@ -65,7 +70,7 @@
private function _get_files_by_component($id, $location_id)
{
- $sql = "SELECT a.location_id, a.location_item_id,
b.file_id, b.name FROM phpgw_vfs_file_relation a INNER JOIN phpgw_vfs b "
+ $sql = "SELECT a.location_id, a.location_item_id,
b.file_id, b.name, b.md5_sum FROM phpgw_vfs_file_relation a INNER JOIN
phpgw_vfs b "
. " ON a.file_id = b.file_id WHERE
a.location_item_id = '{$id}' AND a.location_id = '{$location_id}'"
. " AND b.mime_type != 'Directory' AND
b.mime_type != 'journal' AND b.mime_type != 'journal-deleted'";
@@ -76,16 +81,16 @@
while ($this->db->next_record())
{
$healthy = $this->db->f('file_id').'_#';
- $values[] = trim(str_replace($healthy, '',
$this->db->f('name')));
+ $values[] =
$this->db->f('md5_sum').'_'.trim(str_replace($healthy, '',
$this->db->f('name')));
}
return $values;
}
- private function _search_in_latest_uploads($file)
+ private function _search_in_last_files_added($file_data)
{
- $file_name = str_replace(' ', '_', $file);
- $file_id = array_search($file_name,
$this->latest_uploads);
+ $val_md5sum = $file_data['val_md5sum'];
+ $file_id = array_search($val_md5sum,
$this->last_files_added);
if ($file_id)
{
return $file_id;
@@ -94,54 +99,418 @@
return false;
}
- private function _search_file_in_db($file)
- {
- $file_name = str_replace(' ', '_', $file);
+ public function add_files_location($id, $location_code)
+ {
+ @set_time_limit(5 * 60);
- $sql = "SELECT file_id, name FROM phpgw_vfs "
- . " WHERE name LIKE '%{$file_name}'"
- . " AND mime_type != 'Directory' AND
mime_type != 'journal' AND mime_type != 'journal-deleted'";
+ $message = array();
+
+ $uploaded_files =
phpgwapi_cache::session_get('property', 'import_data');
+ $this->paths_from_file =
phpgwapi_cache::session_get('property', 'paths_from_file');
+
+ $count_new_relations = 0;
+ $count_relations_existing = 0;
+ $count_new_files = 0;
+
//print_r($this->paths_from_file).'<br>'.print_r($uploaded_files); die;
+ $component = array('id' => $id, 'location_id' =>
$GLOBALS['phpgw']->locations->get_id('property',
'.location.'.count(explode('-', $location_code))));
- $this->db->query($sql, __LINE__, __FILE__);
+ $files_in_component =
$this->_get_files_by_component($component['id'], $component['location_id']);
- $value = array();
+ foreach ($uploaded_files as $file_data)
+ {
+ if (in_array(str_replace(' ', '_',
$file_data['val_md5sum']), $files_in_component))
+ {
+ $count_relations_existing++;
+ continue;
+ }
- if ($this->db->next_record())
+ $this->db->transaction_begin();
+ try
+ {
+ $this->db->Exception_On_Error = true;
+
+ $file = $file_data['file'];
+
+ $file_id =
$this->_search_in_last_files_added($file_data);
+ if (!$file_id)
+ {
+ $file_id =
$this->_save_file($file_data);
+ if (!$file_id)
+ {
+ throw new
Exception("failed to copy file '{$file_data['path_file']}'");
+ }
+ unlink($file_data['path_file']);
+ $count_new_files++;
+ }
+
+ $result =
$this->_save_file_relation($component['id'], $component['location_id'],
$file_id);
+ if (!$result)
+ {
+ $message['error'][] =
array('msg' => "failed to save relation. File: '{$file}'");
+ } else {
+ $count_new_relations++;
+ }
+
+ $this->db->Exception_On_Error = false;
+ }
+ catch (Exception $e)
+ {
+ if ($e)
+ {
+ $this->db->transaction_abort();
+ if ($e->getMessage())
+ {
+ $message['error'][] =
array('msg' => $e->getMessage());
+ }
+ continue;
+ }
+ }
+ $this->db->transaction_commit();
+ }
+
+ if ($count_new_files)
{
- $value['file_id'] = $this->db->f('file_id');
- $value['name'] = $this->db->f('name');
+ $message['message'][] = array('msg' => lang('%1
files copy successfully', $count_new_files));
+ } else {
+ $message['message'][] = array('msg' => lang('%1
files copy', $count_new_files));
}
+ if ($count_new_relations)
+ {
+ $message['message'][] = array('msg' => lang('%1
relations saved successfully', $count_new_relations));
+ } else {
+ $message['message'][] = array('msg' =>
lang('any relation has been saved'));
+ }
+ if ($count_relations_existing)
+ {
+ $message['message'][] = array('msg' => lang('%1
relations existing', $count_relations_existing));
+ }
+
+ return $message;
+ }
+
+ private function _compare_names(&$component_files,
$uploaded_files)
+ {
+ if (count($component_files))
+ {
+ foreach ($component_files as &$files)
+ {
+ foreach ($files as &$file_data)
+ {
+ foreach ($uploaded_files as
$file)
+ {
+ if
(strtolower($file['file']) == strtolower($file_data['file']))
+ {
+ if
($file['path_file_string'])
+ {
+ $pos =
stripos($file['path_file_string'], $file_data['path_file_string']);
+ if
($pos !== false)
+ {
+
$file_data['path_file'] = $file['path_file'];
+
$file_data['val_md5sum'] = $file['val_md5sum'];
+ }
+ } else {
+
$file_data['path_file'] = $file['path_file'];
+
$file_data['val_md5sum'] = $file['val_md5sum'];
+ }
+ }
+ }
+ if
(!empty($file_data['val_md5sum']))
+ {
+
$this->paths_from_file[$file_data['val_md5sum']][] = $file_data['path'];
+ } else {
+
$this->paths_empty[$file_data['path_file_string']] =
$file_data['path'].'/'.$file_data['file'];
+ }
+ }
+ }
+ } else {
+ foreach ($uploaded_files as $file)
+ {
+ if (!empty($file['val_md5sum']))
+ {
+
$this->paths_from_file[$file['val_md5sum']][] = dirname($file['path_file']);
+ } else {
+ $this->paths_empty[] =
$file['path_file'];
+ }
+ }
+ $component_files = $uploaded_files;
+ }
+ }
+
+ private function _un_zip($file, $dir)
+ {
+ @set_time_limit(5 * 60);
- return $value['file_id'];
+ $zip = new ZipArchive;
+ if ($zip->open($file) === TRUE)
+ {
+ for($i = 0; $i < $zip->numFiles; $i++)
+ {
+ $file_name = str_replace('..', '.',
iconv("CP850", "UTF-8", $zip->getNameIndex($i)));
+ $copy_to = $dir.'/'.$file_name;
+ if (!is_dir(dirname($copy_to)))
+ {
+ mkdir(dirname($copy_to), 0777,
true);
+ }
+
copy("zip://".$file."#".$zip->getNameIndex($i), "{$copy_to}");
+ }
+ $zip->close();
+
+ return true;
+ } else {
+ $this->receipt['error'][] = array('msg' =>
lang('Failed opening file %1', $file));
+ return false;
+ }
}
- public function add_files($id, $location_code,
$attrib_name_componentID)
+ private function _un_rar($file, $dir)
+ {
+ @set_time_limit(5 * 60);
+
+ $archive = RarArchive::open($file);
+ if ($archive === FALSE)
+ {
+ $this->receipt['error'][] = array('msg' =>
lang('Failed opening file %1', $file));
+ return false;
+ }
+
+ $entries = $archive->getEntries();
+ foreach ($entries as $entry)
+ {
+ $file_name = str_replace('..', '.',
$entry->getName());
+ $copy_to = $dir.'/'.$file_name;
+ if (!is_dir(dirname($copy_to)))
+ {
+ mkdir(dirname($copy_to), 0777, true);
+ }
+ copy("rar://".$file."#".$entry->getName(),
"{$copy_to}");
+ }
+ $archive->close();
+
+ return true;
+ }
+
+ private function _uncompresed_file($path_file)
{
- $exceldata =
$this->_getexceldata($_FILES['file']['tmp_name'], true);
- $component_files = array();
- $message = array();
+ $info = pathinfo($path_file);
+ $path_dir = $this->path_upload_dir.$info['filename'];
+ $result = true;
- foreach ($exceldata as $row)
+ if (!in_array($info['extension'], array('zip', 'rar')))
{
+ $this->receipt['error'][] = array('msg' =>
lang('The file extension should be zip or rar'));
+ return false;
+ }
+
+ if (is_dir($path_dir))
+ {
+ exec("rm -Rf '{$path_dir}'", $ret);
+ }
+ mkdir($path_dir, 0777, true);
+
+ if ($info['extension'] == 'zip')
+ {
+ $result = $this->_un_zip($path_file, $path_dir);
+ }
+ else if ($info['extension'] == 'rar')
+ {
+ $result = $this->_un_rar($path_file, $path_dir);
+ }
+
+ return $result;
+ }
+
+ private function _get_uploaded_files()
+ {
+ $compressed_file =
phpgw::get_var('compressed_file_check');
+ $compressed_file_name =
phpgw::get_var('compressed_file_name');
+
+ $list_files = array();
+
+ if ($compressed_file)
+ {
+ $path_file =
$this->path_upload_dir.$compressed_file_name;
+
+ if (!is_file($path_file))
+ {
+ $this->receipt['error'][] = array('msg'
=> lang('File %1 not exist', $path_file));
+ return;
+ }
+
+ if (!$this->_uncompresed_file($path_file))
+ {
+ return false;
+ }
+
+ $info = pathinfo($path_file);
+ $path_dir =
$this->path_upload_dir.$info['filename'];
+
+ if (!is_dir($path_dir))
+ {
+ $this->receipt['error'][] = array('msg'
=> lang('Directory %1 not exist', $path_dir));
+ return;
+ }
+
+ $list_files =
$this->_get_dir_contents($path_dir);
+ }
+ else {
+ $list_files =
$this->_get_files($this->path_upload_dir);
+ }
+
+ if (!count($list_files))
+ {
+ $this->receipt['error'][] = array('msg' =>
lang("no exist files to import"));
+ }
+
+ return $list_files;
+ }
+
+ private function _get_files($dir, $results = array())
+ {
+ $content = scandir($dir);
+
+ $output = array();
+ foreach($content as $key => $value)
+ {
+ $path = realpath($dir.'/'.$value);
+ if(is_file($path))
+ {
+ unset($output);
+ exec('md5sum "'.$path.'" 2>&1',
$output, $ret);
+ if ($ret)
+ {
+ $val_md5sum = '';
+ } else {
+ $val_md5sum =
trim(strstr($output[0], ' ', true)).' '.$value;
+ }
+ $results[] = array('file'=>$value,
+ 'val_md5sum'=>$val_md5sum,
+ 'path_file'=>$path);
+ }
+ }
+
+ return $results;
+ }
+
+ private function _get_dir_contents($dir, &$results = array())
+ {
+ $content = scandir($dir);
+ $patrones = array('(\\/)', '(\\\\)', '(")');
+ $sustituciones = array('_', '_', '_');
+
+ $output = array();
+ foreach($content as $key => $value)
+ {
+ $path = realpath($dir.'/'.$value);
+ if(is_file($path))
+ {
+ unset($output);
+ exec('md5sum "'.$path.'" 2>&1',
$output, $ret);
+ if ($ret)
+ {
+ $val_md5sum = '';
+ } else {
+ $val_md5sum =
trim(strstr($output[0], ' ', true)).' '.$value;
+ }
+ $results[] = array('file'=>$value,
+ 'val_md5sum'=>$val_md5sum,
+
'path_file_string'=>preg_replace($patrones, $sustituciones, $path),
+ 'path_file'=>$path);
+ }
+ else if($value != "." && $value != "..")
+ {
+ $this->_get_dir_contents($path,
$results);
+ }
+ }
+
+ return $results;
+ }
+
+ public function get_relations ()
+ {
+ $exceldata =
$this->_getexceldata($_FILES['file']['tmp_name'], false);
+ $component_files = array();
+
+ if ($this->receipt['error'])
+ {
+ return $this->receipt;
+ }
+
+ $patrones = array('(\\/)', '(\\\\)', '(")');
+ $sustituciones = array('_', '_', '_');
+ $patrones_2 = array('(\\/)', '(")');
+ $sustituciones_2 = array('_', '_');
+ foreach ($exceldata as $k => $row)
+ {
if (!$this->_valid_row($row))
{
continue;
}
- $array_path = explode("\\",
$row[(count($row)-1)]);
+ $path = $row[(count($row)-2)];
+ $path_file = str_replace('..', '.',
$row[(count($row)-1)]);
+ $array_path = explode("\\", $path_file);
$component_files[$row[0]][] = array(
'name' => $row[1],
'desription' => $row[2],
- 'file' =>
$array_path[count($array_path)-1]
+ 'file' =>
$array_path[count($array_path)-1],
+ 'path' => preg_replace($patrones_2,
$sustituciones_2, $path),
+ 'path_file_string' =>
preg_replace($patrones, $sustituciones, $path_file),
+ 'row' => ($k + 1)
);
}
+
+ return $component_files;
+ }
+
+ public function preview ()
+ {
+ $with_components =
phpgw::get_var('with_components_check');
+
+ $uploaded_files = $this->_get_uploaded_files();
+
+ if ($with_components)
+ {
+ $relations = $this->get_relations();
+ $this->_compare_names($relations,
$uploaded_files);
+ } else {
+ $relations = array();
+ $this->_compare_names($relations,
$uploaded_files);
+ }
- $count_new_relations = 0;
+ phpgwapi_cache::session_set('property',
'paths_from_file', $this->paths_from_file);
+ phpgwapi_cache::session_set('property', 'import_data',
$relations);
+
+ $message['message'][] = array('msg' => lang('%1 files
prepare to copy', count($this->paths_from_file)));
+
+ if (count($this->paths_empty))
+ {
+ $message['error'][] = array('msg' => lang('%1
files not exist in the temporary folder', count($this->paths_empty)));
+
+ foreach($this->paths_empty as $c => $v)
+ {
+ $message['error'][] = array('msg' =>
lang("file not exist: %1", $v));
+ }
+ }
+
+ return $message;
+ }
+
+ public function add_files_components_location($id,
$location_code, $attrib_name_componentID)
+ {
+ @set_time_limit(5 * 60);
+
+ $message = array();
+
+ $component_files =
phpgwapi_cache::session_get('property', 'import_data');
+ $this->paths_from_file =
phpgwapi_cache::session_get('property', 'paths_from_file');
+
+ $count_new_relations = 0;
$count_relations_existing = 0;
$count_new_files = 0;
- $count_files_existing = 0;
-
+ //$count_files_not_existing = 0;
+ $files_not_existing = array();
+
foreach ($component_files as $k => $files)
{
if (empty($k))
@@ -161,7 +530,7 @@
foreach ($files as $file_data)
{
- if (in_array(str_replace(' ', '_',
$file_data['file']), $files_in_component))
+ if (in_array(str_replace(' ', '_',
$file_data['val_md5sum']), $files_in_component))
{
$count_relations_existing++;
continue;
@@ -174,27 +543,22 @@
$file = $file_data['file'];
- $file_id =
$this->_search_in_latest_uploads($file);
- if (!$file_id)
+ $file_id =
$this->_search_in_last_files_added($file_data);
+ if (!$file_id)
{
- $file_id =
$this->_search_file_in_db($file);
- if ($file_id)
+ if
(!is_file($file_data['path_file']))
{
- throw new
Exception("file '{$file}' exist in DB. Component: '{$k}'");
-
$count_files_existing++;
- }
-
- if
(!is_file($this->path_upload_dir.$file))
- {
- throw new
Exception("file '{$file}' does not exist in folder temporary. Component:
'{$k}'");
+
//$count_files_not_existing++;
+
$files_not_existing[] = ($file_data['path_file']) ? $file_data['path_file'] :
$file_data['path'].'/'.$file_data['file'];
+ throw new
Exception();
}
$file_id =
$this->_save_file($file_data);
if (!$file_id)
{
- throw new
Exception("failed to copy file '{$file}'. Component: '{$k}'");
+ throw new
Exception("failed to copy file: '{$file_data['path_file']}'. Component:
'{$k}'");
}
-
unlink($this->path_upload_dir.$file);
+
unlink($file_data['path_file']);
$count_new_files++;
}
@@ -212,8 +576,11 @@
{
if ($e)
{
-
$this->db->transaction_abort();
- $message['error'][] =
array('msg' => $e->getMessage());
+
$this->db->transaction_abort();
+ if ($e->getMessage())
+ {
+
$message['error'][] = array('msg' => $e->getMessage());
+ }
continue;
}
}
@@ -224,111 +591,44 @@
if ($count_new_files)
{
$message['message'][] = array('msg' => lang('%1
files copy successfully', $count_new_files));
+ } else {
+ $message['message'][] = array('msg' => lang('%1
files copy', $count_new_files));
}
- if ($count_relations_existing)
- {
- $message['message'][] = array('msg' => lang('%1
relations existing', $count_relations_existing));
- }
if ($count_new_relations)
{
$message['message'][] = array('msg' => lang('%1
relations saved successfully', $count_new_relations));
+ } else {
+ $message['message'][] = array('msg' =>
lang('any relation has been saved'));
}
- if ($count_files_existing)
+ if ($count_relations_existing)
{
- $message['message'][] = array('msg' => lang('%1
files already exist and were rejected', $count_files_existing));
+ $message['message'][] = array('msg' => lang('%1
relations existing', $count_relations_existing));
}
- return $message;
- }
-
-
- /*public function add_files($id, $location_code,
$attrib_name_componentID)
- {
- $exceldata =
$this->_getexceldata($_FILES['file']['tmp_name'], true);
- $component_files = array();
- $message = array();
-
- foreach ($exceldata as $row)
+ if (count($files_not_existing))
{
- if (!$this->_valid_row($row))
- {
- continue;
- }
-
- $array_path = explode("\\",
$row[(count($row)-1)]);
-
- $component_files[$row[0]][] = array(
- 'name' => $row[1],
- 'desription' => $row[2],
- 'file' =>
$array_path[count($array_path)-1]
- );
+ $message['error'][] = array('msg' => lang('%1
files not exist in the temporary folder', count($files_not_existing)));
}
-
- $this->db->transaction_begin();
- try
+ if (count($files_not_existing))
{
- $this->db->Exception_On_Error = true;
-
- $count = 0;
- foreach ($component_files as $k => $files)
+ foreach($files_not_existing as $c => $v)
{
- if (empty($k))
- {
- $component = array('id' => $id,
'location_id' => $GLOBALS['phpgw']->locations->get_id('property',
'.location.'.count(explode('-', $location_code))));
- }
- else {
- $component =
$this->_get_component($k, $attrib_name_componentID, $location_code);
- if( empty($component['id']) ||
empty($component['location_id']))
- {
- throw new
Exception("component {$k} does not exist");
- }
- }
-
- foreach($files as $file_data)
- {
- $file = $file_data['file'];
-
- if
(!is_file($this->path_upload_dir.$file))
- {
- throw new
Exception("the file {$file} does not exist, component: {$k}");
- }
-
- $file_id =
$this->_save_file($file_data);
- if (!$file_id)
- {
- throw new
Exception("failed to save file {$file}, component: {$k}");
- }
-
- $result =
$this->_save_file_relation($component['id'], $component['location_id'],
$file_id);
- if (!$result)
- {
- throw new
Exception("failed to save relation, file: {$file}, component: {$k}");
- }
- $count++;
- }
+ $message['error'][] = array('msg' =>
lang("file not exist: %1", $v));
}
- $this->db->Exception_On_Error = false;
}
- catch (Exception $e)
- {
- if ($e)
- {
- $this->db->transaction_abort();
- $message['error'][] = array('msg' =>
$e->getMessage());
- return $message;
- }
- }
-
- $this->db->transaction_commit();
- $message['message'][] = array('msg' => lang('%1 files
saved successfully', $count));
return $message;
- }*/
+ }
private function _get_component( $query,
$attrib_name_componentID, $location_code)
{
+ if (array_key_exists($query, $this->list_component_id))
+ {
+ return $this->list_component_id[$query];
+ }
+
$location_code_values = explode('-', $location_code);
$loc1 = $location_code_values[0];
@@ -348,20 +648,29 @@
$values['id'] = $this->db->f('id');
$values['location_id'] =
$this->db->f('location_id');
}
+
+ if ($values['id'])
+ {
+ $this->list_component_id[$query] = $values;
+ }
return $values;
}
-
private function _save_file( $file_data )
{
$metadata = array();
+
+ //$tmp_file = $file_data['file'];
- $tmp_file = $file_data['file'];
+ $val_md5sum = $file_data['val_md5sum'];
+ $path_file = $file_data['path_file'];
+
+ $md5_sum = trim(strstr($val_md5sum, ' ', true));
$bofiles = CreateObject('property.bofiles');
- $file_name = str_replace(' ', '_', $tmp_file);
+ $file_name = str_replace(' ', '_',
trim(strstr($val_md5sum, ' ')));
$to_file = $bofiles->fakebase . '/generic_document/'
.$file_name;
@@ -373,30 +682,43 @@
$bofiles->vfs->override_acl = 1;
$file_id = $bofiles->vfs->cp3(array(
- 'from' =>
$this->path_upload_dir.$tmp_file,
+ 'from' => $path_file,
'to' => $to_file,
'id' => '',
'relatives' => array(RELATIVE_NONE |
VFS_REAL, RELATIVE_ALL)));
$bofiles->vfs->override_acl = 0;
- if ($file_id)
+ if (empty($file_id))
{
- $this->latest_uploads[$file_id] = $file_name;
-
- $metadata['report_date'] =
phpgwapi_datetime::date_to_timestamp(date('Y-m-d'));
- $metadata['title'] = $file_data['name'];
- $metadata['descr'] = $file_data['desription'];
-
- $values_insert = array
- (
- 'file_id' => $file_id,
- 'metadata' => json_encode($metadata)
- );
+ return false;
+ }
+
+ $this->last_files_added[$file_id] = $val_md5sum;
- $this->db->query("INSERT INTO
phpgw_vfs_filedata (" . implode(',', array_keys($values_insert)) . ') VALUES ('
- .
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__,
__FILE__);
+ $this->db->query("UPDATE phpgw_vfs SET
md5_sum='{$md5_sum}'"
+ . " WHERE file_id='{$file_id}'", __LINE__,
__FILE__);
+
+ if (count($this->paths_from_file[$val_md5sum]))
+ {
+ $paths =
array_values(array_unique($this->paths_from_file[$val_md5sum]));
+ } else {
+ $paths = array();
}
-
+
+ $metadata['report_date'] =
phpgwapi_datetime::date_to_timestamp(date('Y-m-d'));
+ $metadata['title'] = $file_data['name'];
+ $metadata['descr'] = $file_data['desription'];
+ $metadata['path'] = $paths;
+
+ $values_insert = array
+ (
+ 'file_id' => $file_id,
+ 'metadata' => "'" . json_encode($metadata) . "'"
+ );
+
+ $this->db->query("INSERT INTO phpgw_vfs_filedata (" .
implode(',', array_keys($values_insert)) . ') VALUES ('
+ . implode(",", array_values($values_insert)) .
')', __LINE__, __FILE__);
+
return $file_id;
}
Modified: trunk/property/js/portico/generic_document.edit.js
===================================================================
--- trunk/property/js/portico/generic_document.edit.js 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/js/portico/generic_document.edit.js 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -103,6 +103,7 @@
function setRelationsComponents(oArgs)
{
var values = {};
+ var related = {};
var select_check = $('.components');
select_check.each(function (i, obj)
@@ -113,11 +114,17 @@
}
});
+ var select_related = $('.components_related');
+ select_related.each(function (i, obj)
+ {
+ related[obj.value] = obj.value;
+ });
+
oArgs['location_id'] = $('#location_id').val();
oArgs['file_id'] = $('#id').val();
var requestUrl = phpGWLink('index.php', oArgs);
- var data = {"items": values};
+ var data = {"items":values, "related":related};
JqueryPortico.execute_ajax(requestUrl, function (result)
{
JqueryPortico.show_message(0, result);
@@ -129,6 +136,7 @@
function setRelationsLocations(oArgs)
{
var values = {};
+ var related = {};
var select_check = $('.locations');
select_check.each(function (i, obj)
@@ -139,11 +147,17 @@
}
});
+ var select_related = $('.locations_related');
+ select_related.each(function (i, obj)
+ {
+ related[obj.value] = obj.value;
+ });
+
oArgs['type_id'] = $('#type_id').val();
oArgs['file_id'] = $('#id').val();
var requestUrl = phpGWLink('index.php', oArgs);
- var data = {"items": values};
+ var data = {"items":values, "related":related};
JqueryPortico.execute_ajax(requestUrl, function (result)
{
JqueryPortico.show_message(1, result);
Modified: trunk/property/js/portico/import_components.js
===================================================================
--- trunk/property/js/portico/import_components.js 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/js/portico/import_components.js 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -5,7 +5,8 @@
$('.processing-sheet').hide();
$('.processing-start-line').hide();
$('.processing-columns').hide();
- $('.processing-import-relations').hide();
+ //$('.processing-import-relations').hide();
+ $('.processing-relations').hide();
$('.processing-save').hide();
$('.get-profile').hide();
@@ -94,43 +95,121 @@
);
});
- $('#import_components_files').on('click', function ()
+ $('#relations_step_1').on('click', function ()
{
+ if ($('input:radio[name=with_components_check]:checked').val()
== 1)
+ {
+ if ($('#excel_files').val() == '')
+ {
+ alert('no file selected');
+ return false;
+ }
+ }
+
+ $('#responsiveTabsRelations').responsiveTabs('activate', 1);
+ });
+
+ $('#relations_step_2').on('click', function ()
+ {
var oArgs = {menuaction:
'property.uiimport_components.import_component_files'};
var requestUrl = phpGWLink('index.php', oArgs, true);
- if ($('#excel_files').val() === '')
+ if ($('#location_item_id').val() === '')
{
- alert('no file selected');
+ alert('Choose Location');
return false;
+ }
+
+ if ($('input:radio[name=compressed_file_check]:checked').val()
== 1 && $('#compressed_file_name').val() == '')
+ {
+ alert('Enter the name of the compressed file');
+ return false;
}
- if ($('#location_item_id').val() === '')
+ var form = document.forms.namedItem("form_files");
+ var form_data = new FormData(form);
+
+ if ($('input:radio[name=with_components_check]:checked').val()
== 1)
{
- alert('Choose Location');
+ if ($('#excel_files').val() == '')
+ {
+ alert('no file selected');
+ return false;
+ }
+ var file_data = $('#excel_files').prop('files')[0];
+ form_data.append('file', file_data);
+ }
+
+ if (isSendingData())
+ {
return false;
- }
+ }
+ //form_data.append('attribute_name_component_id',
$('#attribute_name_component_id').val());
+ form_data.append('location_code', $('#location_code').val());
+ form_data.append('location_item_id',
$('#location_item_id').val());
+ form_data.append('compressed_file_check',
$('input:radio[name=compressed_file_check]:checked').val());
+ form_data.append('with_components_check',
$('input:radio[name=with_components_check]:checked').val());
+ form_data.append('compressed_file_name',
$('#compressed_file_name').val());
+ form_data.append('preview', 1);
+
+ $('.processing-relations').show();
+
+ $.ajax({
+ url: requestUrl,
+ cache: false,
+ contentType: false,
+ processData: false,
+ data: form_data,
+ type: 'post',
+ dataType: 'json'
+ })
+ .done(function(result) {
+ JqueryPortico.show_message(5, result);
+ $('#responsiveTabsRelations').responsiveTabs('enable',
2);
+
$('#responsiveTabsRelations').responsiveTabs('activate', 2);
+ $('#message4').empty();
+ //$('#import_components_files').prop('disabled', true);
+ })
+ .fail(function() {
+ alert( "error" );
+ })
+ .always(function() {
+ statusSend = false;
+ $('.processing-relations').hide();
+ });
+ });
- if ($('#attribute_name_component_id').val() === '')
+ $('#save_relations').on('click', function ()
+ {
+ var oArgs = {menuaction:
'property.uiimport_components.import_component_files'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ /*if ($('#excel_files').val() === '')
{
- alert('Choose attribute name for Component ID');
+ alert('no file selected');
return false;
- }
+ }*/
+ if ($('#location_item_id').val() === '')
+ {
+ alert('Choose Location');
+ return false;
+ }
+
if (isSendingData())
{
return false;
}
var form = document.forms.namedItem("form_files");
- var file_data = $('#excel_files').prop('files')[0];
var form_data = new FormData(form);
- form_data.append('file', file_data);
+
form_data.append('attribute_name_component_id',
$('#attribute_name_component_id').val());
form_data.append('location_code', $('#location_code').val());
form_data.append('location_item_id',
$('#location_item_id').val());
+ form_data.append('with_components_check',
$('input:radio[name=with_components_check]:checked').val());
- $('.processing-import-relations').show();
+ $('.processing-relations').show();
$.ajax({
url: requestUrl,
@@ -139,14 +218,18 @@
processData: false,
data: form_data,
type: 'post',
- dataType: 'json',
- success: function (result)
- {
- statusSend = false;
- $('.processing-import-relations').hide();
- JqueryPortico.show_message(4, result);
-
//$('#import_components_files').prop('disabled', true);
- }
+ dataType: 'json'
+ })
+ .done(function(result) {
+ JqueryPortico.show_message(4, result);
+ //$('#import_components_files').prop('disabled', true);
+ })
+ .fail(function() {
+ alert( "error" );
+ })
+ .always(function() {
+ statusSend = false;
+ $('.processing-relations').hide();
});
});
@@ -548,7 +631,7 @@
{
$('#profile_selected').empty();
$('#profile_selected').append($("#profile_list
option:selected").text());
- $('#cod_profile_selected').val($('#profile_selected').val());
+ $('#cod_profile_selected').val($("#profile_list").val());
if ($('#profile_list').val())
{
Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/templates/base/condition_survey.xsl 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -2,332 +2,264 @@
<!-- add / edit -->
<xsl:template match="data" xmlns:php="http://php.net/xsl">
- <div class="content">
- <xsl:call-template name="jquery_phpgw_i18n"/>
+ <xsl:call-template name="jquery_phpgw_i18n"/>
- <div id="survey_edit_tabview">
+ <div id="survey_edit_tabview">
- <h1>
- <xsl:value-of select="php:function('lang',
'condition survey')" />
- </h1>
+ <h1>
+ <xsl:value-of select="php:function('lang', 'condition
survey')" />
+ </h1>
- <xsl:variable name="action_url">
- <xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:property.uicondition_survey.save')" />
- </xsl:variable>
+ <xsl:variable name="action_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', 'menuaction:property.uicondition_survey.save')" />
+ </xsl:variable>
- <xsl:value-of select="validator"/>
+ <xsl:value-of select="validator"/>
- <form name="form" class="pure-form pure-form-aligned"
id="form" action="{$action_url}" method="post" ENCTYPE="multipart/form-data">
+ <form name="form" class="pure-form pure-form-aligned" id="form"
action="{$action_url}" method="post" ENCTYPE="multipart/form-data">
- <dl>
- <xsl:choose>
- <xsl:when test="msgbox_data !=
''">
- <dt>
-
<xsl:call-template name="msgbox"/>
- </dt>
- </xsl:when>
- </xsl:choose>
- </dl>
+ <dl>
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <dt>
+ <xsl:call-template
name="msgbox"/>
+ </dt>
+ </xsl:when>
+ </xsl:choose>
+ </dl>
- <div id="tab-content">
+ <div id="tab-content">
- <xsl:value-of
disable-output-escaping="yes" select="tabs"/>
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
- <div id="generic">
+ <div id="generic">
- <fieldset>
- <xsl:choose>
- <xsl:when
test="survey/id!=''">
- <div
class="pure-control-group">
-
<label>
-
<xsl:value-of select="php:function('lang', 'id')" />
-
</label>
-
<xsl:value-of select="survey/id"/>
-
<input type="hidden" name="id" value="{survey/id}"/>
+ <fieldset>
+ <xsl:choose>
+ <xsl:when
test="survey/id!=''">
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'id')" />
+ </label>
+
<xsl:value-of select="survey/id"/>
+ <input
type="hidden" name="id" value="{survey/id}"/>
- </div>
- </xsl:when>
- </xsl:choose>
+ </div>
+ </xsl:when>
+ </xsl:choose>
- <xsl:choose>
- <xsl:when
test="location_data2!=''">
-
<xsl:choose>
-
<xsl:when test="editable = 1">
-
<xsl:call-template name="location_form2"/>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:call-template name="location_view2"/>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:when>
- </xsl:choose>
-
- <div
class="pure-control-group">
- <label
for="name">
-
<xsl:value-of select="php:function('lang', 'name')" />
- </label>
+ <xsl:choose>
+ <xsl:when
test="location_data2!=''">
<xsl:choose>
<xsl:when test="editable = 1">
-
<input id="title" name='values[title]' type="text" value="{survey/title}">
-
<xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-error-msg">
-
<xsl:value-of select="php:function('lang', 'Please enter a
title !')"/>
-
</xsl:attribute>
-
</input>
+
<xsl:call-template name="location_form2"/>
</xsl:when>
<xsl:otherwise>
-
<xsl:value-of select="survey/title" />
+
<xsl:call-template name="location_view2"/>
</xsl:otherwise>
</xsl:choose>
- </div>
+ </xsl:when>
+ </xsl:choose>
- <div
class="pure-control-group" >
- <label
for="name">
-
<xsl:value-of select="php:function('lang', 'description')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<textarea id="descr" rows="6" style="width:40%; resize:none;"
name="values[descr]">
-
<xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-error-msg">
-
<xsl:value-of select="php:function('lang', 'Please enter a
description !')"/>
-
</xsl:attribute>
-
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
-
</textarea>
-
</xsl:when>
-
<xsl:otherwise>
+ <div class="pure-control-group">
+ <label for="name">
+ <xsl:value-of
select="php:function('lang', 'name')" />
+ </label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <input
id="title" name='values[title]' type="text" value="{survey/title}">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'Please enter a title !')"/>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/title" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ <div class="pure-control-group"
>
+ <label for="name">
+ <xsl:value-of
select="php:function('lang', 'description')" />
+ </label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+
<textarea id="descr" rows="6" style="width:40%; resize:none;"
name="values[descr]">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'Please enter a description
!')"/>
+
</xsl:attribute>
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
-
</xsl:otherwise>
- </xsl:choose>
- </div>
+
</textarea>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
- <div
class="pure-control-group">
- <label
for="category">
-
<xsl:value-of select="php:function('lang', 'category')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<select id="cat_id" name="values[cat_id]">
-
<xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-error-msg">
-
<xsl:value-of select="php:function('lang', 'Please enter a
category !')"/>
-
</xsl:attribute>
-
<xsl:apply-templates select="categories/options"/>
-
</select>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:for-each select="categories/options">
-
<xsl:if test="selected = 'selected' or selected = 1">
-
<xsl:value-of disable-output-escaping="yes" select="name"/>
-
</xsl:if>
-
</xsl:for-each>
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div
class="pure-control-group">
- <label
for="multiplier">
-
<xsl:value-of select="php:function('lang', 'multiplier')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<input id="multiplier" name='values[multiplier]' type="text"
value="{survey/multiplier}">
-
<xsl:attribute name="data-validation">
-
<xsl:text>number</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-allowing">
-
<xsl:text>float</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-error-msg">
-
<xsl:value-of select="php:function('lang', 'Please enter a
multiplier !')"/>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:value-of select="survey/multiplier"/>
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div
class="pure-control-group">
- <label
for="date">
-
<xsl:value-of select="php:function('lang', 'date')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<input id="report_date" name='values[report_date]' type="text"
value="{survey/report_date}"
-
data-validation="date" data-validation-format="dd/mm/yyyy"/>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:value-of select="survey/report_date"/>
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div
class="pure-control-group">
- <label
for="status">
-
<xsl:value-of select="php:function('lang', 'status')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<select id="status_id" name="values[status_id]">
-
<xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
-
</xsl:attribute>
-
<xsl:attribute name="data-validation-error-msg">
-
<xsl:value-of select="php:function('lang', 'Please enter a
status !')"/>
-
</xsl:attribute>
-
<xsl:apply-templates select="status_list/options"/>
-
</select>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:for-each select="status_list/options">
-
<xsl:if test="selected = 'selected' or selected = 1">
-
<xsl:value-of disable-output-escaping="yes" select="name"/>
-
</xsl:if>
-
</xsl:for-each>
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div
class="pure-control-group">
- <label
for="coordinator">
-
<xsl:value-of select="lang_coordinator" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<!--div class="autocomplete"-->
-
<input type="hidden" id="coordinator_id" name="values[coordinator_id]"
value="{survey/coordinator_id}"/>
-
<input type="text" id="coordinator_name" name="values[coordinator_name]"
value="{survey/coordinator_name}">
-
</input>
-
<div id="coordinator_container"/>
-
<!--/div-->
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:value-of select="survey/coordinator_name" />
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div
class="pure-control-group">
- <label
for="vendor">
-
<xsl:value-of select="php:function('lang', 'vendor')" />
- </label>
- <xsl:choose>
-
<xsl:when test="editable = 1">
-
<!--div class="autocomplete"-->
-
<input type="hidden" id="vendor_id" name="values[vendor_id]"
value="{survey/vendor_id}"/>
-
<input type="text" id="vendor_name" name="values[vendor_name]"
value="{survey/vendor_name}">
-
</input>
-
<div id="vendor_container"/>
-
<!--/div-->
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:value-of select="survey/vendor_name" />
-
</xsl:otherwise>
- </xsl:choose>
- </div>
-
-
- </fieldset>
- </div>
-
- <div id="documents">
- <script type="text/javascript">
-
- var survey_id =
'<xsl:value-of select='survey/id'/>';
- var multi_upload_parans
= <xsl:value-of select="multi_upload_parans"/>;
-
-
this.show_related_requests = function()
- {
- var oArgs =
{menuaction:'property.uirequest.index', nonavbar:1,
condition_survey_id:survey_id};
- var requestUrl =
phpGWLink('index.php', oArgs);
-
TINY.box.show({iframe:requestUrl,
boxid:'frameless',width:screen.width*.9,height:screen.height*.5,fixed:false,maskid:'darkmask',maskopacity:40,
mask:true, animate:true, close: true});
- }
- </script>
-
<div class="pure-control-group">
-
- <label>
- <xsl:value-of
select="php:function('lang', 'files')"/>
+ <label for="category">
+ <xsl:value-of
select="php:function('lang', 'category')" />
</label>
- <!--div
style="clear:both;" id="datatable-container_0"></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>
<xsl:choose>
<xsl:when
test="editable = 1">
-
<xsl:call-template name="file_upload"/>
+ <select
id="cat_id" name="values[cat_id]">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'Please enter a category
!')"/>
+
</xsl:attribute>
+
<xsl:apply-templates select="categories/options"/>
+
</select>
</xsl:when>
+ <xsl:otherwise>
+
<xsl:for-each select="categories/options">
+
<xsl:if test="selected = 'selected' or selected = 1">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</xsl:if>
+
</xsl:for-each>
+ </xsl:otherwise>
</xsl:choose>
</div>
- </div>
- <div id="request">
+
<div class="pure-control-group">
- <label>
- <a
href="javascript:show_related_requests();">
-
<xsl:attribute name="title">
-
<xsl:value-of select="php:function('lang', 'details')"/>
-
</xsl:attribute>
-
<xsl:value-of select="php:function('lang', 'details')"/>
- </a>
+ <label for="multiplier">
+ <xsl:value-of
select="php:function('lang', 'multiplier')" />
</label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <input
id="multiplier" name='values[multiplier]' type="text"
value="{survey/multiplier}">
+
<xsl:attribute name="data-validation">
+
<xsl:text>number</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-allowing">
+
<xsl:text>float</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'Please enter a multiplier
!')"/>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/multiplier"/>
+ </xsl:otherwise>
+ </xsl:choose>
</div>
+
<div class="pure-control-group">
- <label>
- <xsl:variable
name="lang_new_request">
-
<xsl:value-of select="php:function('lang', 'new record')" />
- </xsl:variable>
- <a
href="javascript:document.load_new_request_form.submit();">
-
<xsl:attribute name="title">
-
<xsl:value-of select="$lang_new_request"/>
-
</xsl:attribute>
-
<xsl:value-of select="$lang_new_request"/>
- </a>
+ <label for="date">
+ <xsl:value-of
select="php:function('lang', 'date')" />
</label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <input
id="report_date" name='values[report_date]' type="text"
value="{survey/report_date}"
+
data-validation="date" data-validation-format="dd/mm/yyyy"/>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/report_date"/>
+ </xsl:otherwise>
+ </xsl:choose>
</div>
+
<div class="pure-control-group">
+ <label for="status">
+ <xsl:value-of
select="php:function('lang', 'status')" />
+ </label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <select
id="status_id" name="values[status_id]">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'Please enter a status !')"/>
+
</xsl:attribute>
+
<xsl:apply-templates select="status_list/options"/>
+
</select>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:for-each select="status_list/options">
+
<xsl:if test="selected = 'selected' or selected = 1">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</xsl:if>
+
</xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
- <label>
- <xsl:value-of
select="php:function('lang', 'request')"/>
+ <div class="pure-control-group">
+ <label
for="coordinator">
+ <xsl:value-of
select="lang_coordinator" />
</label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <!--div
class="autocomplete"-->
+ <input
type="hidden" id="coordinator_id" name="values[coordinator_id]"
value="{survey/coordinator_id}"/>
+ <input
type="text" id="coordinator_name" name="values[coordinator_name]"
value="{survey/coordinator_name}">
+ </input>
+ <div
id="coordinator_container"/>
+
<!--/div-->
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/coordinator_name" />
+ </xsl:otherwise>
+ </xsl:choose>
</div>
- <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>
- </div>
- <div id="summation">
+
<div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'summation')"/>
+ <label for="vendor">
+ <xsl:value-of
select="php:function('lang', 'vendor')" />
</label>
+ <xsl:choose>
+ <xsl:when
test="editable = 1">
+ <!--div
class="autocomplete"-->
+ <input
type="hidden" id="vendor_id" name="values[vendor_id]"
value="{survey/vendor_id}"/>
+ <input
type="text" id="vendor_name" name="values[vendor_name]"
value="{survey/vendor_name}">
+ </input>
+ <div
id="vendor_container"/>
+
<!--/div-->
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="survey/vendor_name" />
+ </xsl:otherwise>
+ </xsl:choose>
</div>
- <!--div style="clear:both;"
id="datatable-container_2"></div-->
+
+
+ </fieldset>
+ </div>
+
+ <div id="documents">
+ <script type="text/javascript">
+
+ var survey_id = '<xsl:value-of
select='survey/id'/>';
+ var multi_upload_parans =
<xsl:value-of select="multi_upload_parans"/>;
+
+ this.show_related_requests =
function()
+ {
+ var oArgs =
{menuaction:'property.uirequest.index', nonavbar:1,
condition_survey_id:survey_id};
+ var requestUrl =
phpGWLink('index.php', oArgs);
+
TINY.box.show({iframe:requestUrl,
boxid:'frameless',width:screen.width*.9,height:screen.height*.5,fixed:false,maskid:'darkmask',maskopacity:40,
mask:true, animate:true, close: true});
+ }
+ </script>
+
+ <div class="pure-control-group">
+
+ <label>
+ <xsl:value-of
select="php:function('lang', 'files')"/>
+ </label>
+ <!--div style="clear:both;"
id="datatable-container_0"></div-->
<xsl:for-each
select="datatable_def">
- <xsl:if test="container
= 'datatable-container_2'">
+ <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' />
@@ -337,91 +269,157 @@
</xsl:call-template>
</xsl:if>
</xsl:for-each>
-
- </div>
- <div id="import">
<xsl:choose>
<xsl:when
test="editable = 1">
- <div
class="pure-control-group">
- <label>
-
<xsl:value-of select="php:function('lang', 'upload file')"/>
- </label>
- <input
type="file" name="import_file" size="40">
-
<xsl:attribute name="title">
-
<xsl:value-of select="php:function('lang', 'Select file to upload')"/>
-
</xsl:attribute>
- </input>
- </div>
+
<xsl:call-template name="file_upload"/>
</xsl:when>
</xsl:choose>
</div>
</div>
- <div class="form-buttons">
- <xsl:variable name="lang_cancel">
- <xsl:value-of
select="php:function('lang', 'cancel')" />
- </xsl:variable>
+ <div id="request">
+ <div class="pure-control-group">
+ <label>
+ <a
href="javascript:show_related_requests();">
+ <xsl:attribute
name="title">
+
<xsl:value-of select="php:function('lang', 'details')"/>
+ </xsl:attribute>
+ <xsl:value-of
select="php:function('lang', 'details')"/>
+ </a>
+ </label>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:variable
name="lang_new_request">
+ <xsl:value-of
select="php:function('lang', 'new record')" />
+ </xsl:variable>
+ <a
href="javascript:document.load_new_request_form.submit();">
+ <xsl:attribute
name="title">
+
<xsl:value-of select="$lang_new_request"/>
+ </xsl:attribute>
+ <xsl:value-of
select="$lang_new_request"/>
+ </a>
+ </label>
+ </div>
+ <div class="pure-control-group">
+
+ <label>
+ <xsl:value-of
select="php:function('lang', 'request')"/>
+ </label>
+ </div>
+ <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>
+ </div>
+ <div id="summation">
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'summation')"/>
+ </label>
+ </div>
+ <!--div style="clear:both;"
id="datatable-container_2"></div-->
+ <xsl:for-each select="datatable_def">
+ <xsl:if test="container =
'datatable-container_2'">
+ <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>
+
+ </div>
+ <div id="import">
<xsl:choose>
<xsl:when test="editable = 1">
- <xsl:variable
name="lang_save">
- <xsl:value-of
select="php:function('lang', 'save')" />
- </xsl:variable>
- <input type="submit"
class="pure-button pure-button-primary" name="save_project"
value="{$lang_save}" title = "{$lang_save}" />
- <input
class="pure-button pure-button-primary" type="button" name="cancelButton" id
='cancelButton' value="{$lang_cancel}" title = "{$lang_cancel}"
onClick="document.cancel_form.submit();"/>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'upload file')"/>
+ </label>
+ <input
type="file" name="import_file" size="40">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'Select file to upload')"/>
+
</xsl:attribute>
+ </input>
+ </div>
</xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_edit">
- <xsl:value-of
select="php:function('lang', 'edit')" />
- </xsl:variable>
- <xsl:variable
name="lang_new_survey">
- <xsl:value-of
select="php:function('lang', 'new')" />
- </xsl:variable>
- <input type="button"
class="pure-button pure-button-primary" name="edit_survey" value="{$lang_edit}"
title = "{$lang_edit}" onClick="document.load_edit_form.submit();"/>
- <input type="button"
class="pure-button pure-button-primary" name="new_survey"
value="{$lang_new_survey}" title = "{$lang_new_survey}"
onClick="document.new_form.submit();"/>
- <input
class="pure-button pure-button-primary" type="button" name="cancelButton" id
='cancelButton' value="{$lang_cancel}" title = "{$lang_cancel}"
onClick="document.cancel_form.submit();"/>
- </xsl:otherwise>
</xsl:choose>
</div>
- </form>
- </div>
+ </div>
+ <div class="proplist-col">
+ <xsl:variable name="lang_cancel">
+ <xsl:value-of
select="php:function('lang', 'cancel')" />
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="editable = 1">
+ <xsl:variable name="lang_save">
+ <xsl:value-of
select="php:function('lang', 'save')" />
+ </xsl:variable>
+ <input type="submit"
class="pure-button pure-button-primary" name="save_project"
value="{$lang_save}" title = "{$lang_save}" />
+ <input class="pure-button
pure-button-primary" type="button" name="cancelButton" id ='cancelButton'
value="{$lang_cancel}" title = "{$lang_cancel}"
onClick="document.cancel_form.submit();"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="lang_edit">
+ <xsl:value-of
select="php:function('lang', 'edit')" />
+ </xsl:variable>
+ <xsl:variable
name="lang_new_survey">
+ <xsl:value-of
select="php:function('lang', 'new')" />
+ </xsl:variable>
+ <input type="button"
class="pure-button pure-button-primary" name="edit_survey" value="{$lang_edit}"
title = "{$lang_edit}" onClick="document.load_edit_form.submit();"/>
+ <input type="button"
class="pure-button pure-button-primary" name="new_survey"
value="{$lang_new_survey}" title = "{$lang_new_survey}"
onClick="document.new_form.submit();"/>
+ <input class="pure-button
pure-button-primary" type="button" name="cancelButton" id ='cancelButton'
value="{$lang_cancel}" title = "{$lang_cancel}"
onClick="document.cancel_form.submit();"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
- <xsl:variable name="cancel_url">
- <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', 'menuaction:property.uicondition_survey.index')" />
- </xsl:variable>
+ <xsl:variable name="cancel_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', 'menuaction:property.uicondition_survey.index')" />
+ </xsl:variable>
- <form name="cancel_form" id="cancel_form"
action="{$cancel_url}" method="post">
- </form>
- <xsl:variable name="new_url">
- <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', 'menuaction:property.uicondition_survey.add')" />
- </xsl:variable>
- <form name="new_form" id="new_form" action="{$new_url}"
method="post">
- </form>
+ <form name="cancel_form" id="cancel_form" action="{$cancel_url}"
method="post">
+ </form>
+ <xsl:variable name="new_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', 'menuaction:property.uicondition_survey.add')" />
+ </xsl:variable>
+ <form name="new_form" id="new_form" action="{$new_url}" method="post">
+ </form>
- <xsl:variable name="edit_params">
- <xsl:text>menuaction:property.uicondition_survey.edit,
id:</xsl:text>
- <xsl:value-of select="survey/id" />
- </xsl:variable>
- <xsl:variable name="edit_url">
- <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', $edit_params )" />
- </xsl:variable>
+ <xsl:variable name="edit_params">
+ <xsl:text>menuaction:property.uicondition_survey.edit,
id:</xsl:text>
+ <xsl:value-of select="survey/id" />
+ </xsl:variable>
+ <xsl:variable name="edit_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', $edit_params )" />
+ </xsl:variable>
- <form name="load_edit_form" id="load_edit_form"
action="{$edit_url}" method="post">
- </form>
+ <form name="load_edit_form" id="load_edit_form" action="{$edit_url}"
method="post">
+ </form>
- <xsl:variable name="new_request_params">
- <xsl:text>menuaction:property.uirequest.edit,
location_code:</xsl:text>
- <xsl:value-of select="survey/location_code" />
- <xsl:text>,origin:.project.condition_survey,
origin_id:</xsl:text>
- <xsl:value-of select="survey/id" />
- </xsl:variable>
+ <xsl:variable name="new_request_params">
+ <xsl:text>menuaction:property.uirequest.edit,
location_code:</xsl:text>
+ <xsl:value-of select="survey/location_code" />
+ <xsl:text>,origin:.project.condition_survey,
origin_id:</xsl:text>
+ <xsl:value-of select="survey/id" />
+ </xsl:variable>
- <xsl:variable name="new_request_url">
- <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', $new_request_params )" />
- </xsl:variable>
+ <xsl:variable name="new_request_url">
+ <xsl:value-of select="php:function('get_phpgw_link',
'/index.php', $new_request_params )" />
+ </xsl:variable>
- <form name="load_new_request_form" id="load_new_request_form"
action="{$new_request_url}" method="post">
- </form>
- </div>
+ <form name="load_new_request_form" id="load_new_request_form"
action="{$new_request_url}" method="post">
+ </form>
</xsl:template>
Modified: trunk/property/templates/base/import_components.xsl
===================================================================
--- trunk/property/templates/base/import_components.xsl 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/templates/base/import_components.xsl 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -243,26 +243,89 @@
<input type="hidden"
id="location_code" name="location_code" value=""></input>
<input type="hidden"
id="location_item_id" name="location_item_id" value=""></input>
</div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'upload file')"/>
- </label>
- <input type="file"
id="excel_files" name="excel_files" size="40">
- </input>
- </div>
- <div class="pure-control-group">
- <label></label>
- <input type="button"
id="import_components_files" name="import_components" size="40">
- <xsl:attribute
name="value">
-
<xsl:value-of select="php:function('lang', 'Start import')"/>
- </xsl:attribute>
- </input>
- <img
src="{image_loader}" class="processing-import-relations"
align="absmiddle"></img>
- </div>
- <div class="pure-control-group">
- <div id="message4"
class="message"></div>
- </div>
+
+ <div
id="responsiveTabsRelations">
+ <ul>
+ <li><a
href="#tab-components"><xsl:value-of select="php:function('lang',
'Components')"/></a></li>
+ <li><a
href="#tab-files"><xsl:value-of select="php:function('lang',
'Files')"/></a></li>
+ <li><a
href="#tab-preview"><xsl:value-of select="php:function('lang',
'Preview')"/></a></li>
+ </ul>
+ <div
id="tab-components">
+ <div
class="pure-control-group">
+ <div
class="pure-custom">
+
<div class="pure-control-group">
+
<label><xsl:value-of select="php:function('lang', 'without
components')" /></label>
+
<input type="radio" value="0" name="with_components_check"
checked="true" />
+
</div>
+
<div class="pure-control-group">
+
<label><xsl:value-of select="php:function('lang', 'with components')"
/></label>
+
<input type="radio" value="1" name="with_components_check" />
+
<input type="file" id="excel_files" name="excel_files"
size="40"></input>
+
</div>
+ </div>
+ </div>
+ <div
class="pure-control-group">
+
<label></label>
+ <input
type="button" id="relations_step_1" name="relations_step_1" size="40">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('lang', 'Continue')"/>
+
</xsl:attribute>
+ </input>
+ <img
src="{image_loader}" class="processing-relations" align="absmiddle"></img>
+ </div>
+ </div>
+ <div id="tab-files">
+ <div
class="pure-control-group">
+ <div
class="pure-custom">
+
<div class="pure-control-group">
+
<label><xsl:value-of select="php:function('lang', 'Uncompressed')"
/></label>
+
<input type="radio" value="0" name="compressed_file_check"
checked="true" />
+
</div>
+
<div class="pure-control-group">
+
<label><xsl:value-of select="php:function('lang', 'Compressed')"
/></label>
+
<input type="radio" value="1" name="compressed_file_check" />
+
<input type="text" value="" id="compressed_file_name"
name="compressed_file_name" >
+
<xsl:attribute name="placeholder">
+
<xsl:value-of select="php:function('lang', 'File
name')"/>
+
</xsl:attribute>
+
</input> (zip, rar)
+
</div>
+ </div>
+ </div>
+ <div
class="pure-control-group">
+
<label></label>
+ <input
type="button" id="relations_step_2" name="relations_step_2" size="40">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('lang', 'Continue')"/>
+
</xsl:attribute>
+ </input>
+ <img
src="{image_loader}" class="processing-relations" align="absmiddle"></img>
+ </div>
+ </div>
+ <div id="tab-preview">
+ <div
class="pure-control-group">
+ <label
for="vendor">
+
<xsl:value-of select="php:function('lang', 'Messages')" />
+ </label>
+ <div
class="pure-custom">
+
<div id="message5" class="message"></div>
+ </div>
+ </div>
+ <div
class="pure-control-group">
+
<label></label>
+ <input
type="button" id="save_relations" name="save_relations" size="40">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('lang', 'Save')"/>
+
</xsl:attribute>
+
</input>
+ <img
src="{image_loader}" class="processing-relations" align="absmiddle"></img>
+ </div>
+ <div
class="pure-control-group">
+
<label></label>
+ <div
id="message4" class="message"></div>
+ </div>
+ </div>
+ </div>
</form>
</div>
@@ -273,6 +336,11 @@
startCollapsed: 'accordion',
disabled: [1,2,3]
});
+
+ $('#responsiveTabsRelations').responsiveTabs({
+ startCollapsed: 'accordion',
+ disabled: [2]
+ });
</script>
</xsl:template>
Modified: trunk/property/templates/base/multi_upload_file.xsl
===================================================================
--- trunk/property/templates/base/multi_upload_file.xsl 2016-12-18 20:20:04 UTC
(rev 16101)
+++ trunk/property/templates/base/multi_upload_file.xsl 2016-12-18 20:52:38 UTC
(rev 16102)
@@ -96,6 +96,7 @@
//xhrFields: {withCredentials: true},
url: '<xsl:value-of
select="multi_upload_action"/>',
limitConcurrentUploads: 4,
+ maxChunkSize: 10000000000
//acceptFileTypes: /(\.|\/)(png|pdf)$/i
});
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-12-18 20:20:04 UTC (rev 16101)
+++ trunk/rental/setup/setup.inc.php 2016-12-18 20:52:38 UTC (rev 16102)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module identifier
- $setup_info['rental']['version'] = '0.1.0.31'; // Current module version
+ $setup_info['rental']['version'] = '0.1.0.32'; // Current module version
$setup_info['rental']['app_order'] = 51; // (?)
$setup_info['rental']['tables'] = array(
'rental_party', // All contract participants, tenants etc.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16102] Backport diff from Syncromind to trunk,
sigurdne <=