[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14916] Merge 14910:14915 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14916] Merge 14910:14915 from trunk |
Date: |
Tue, 12 Apr 2016 10:32:16 +0000 |
Revision: 14916
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14916
Author: sigurdne
Date: 2016-04-12 10:32:15 +0000 (Tue, 12 Apr 2016)
Log Message:
-----------
Merge 14910:14915 from trunk
Modified Paths:
--------------
branches/Version-2_0-branch/bim/inc/class.sovfs.inc.php
branches/Version-2_0-branch/helpdesk/inc/class.uitts.inc.php
branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
branches/Version-2_0-branch/property/inc/class.bofiles.inc.php
branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
branches/Version-2_0-branch/property/inc/class.uientity.inc.php
branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
branches/Version-2_0-branch/property/inc/class.uirequest.inc.php
branches/Version-2_0-branch/property/inc/class.uis_agreement.inc.php
branches/Version-2_0-branch/property/inc/class.uitenant_claim.inc.php
branches/Version-2_0-branch/property/inc/class.uitts.inc.php
branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
Property Changed:
----------------
branches/Version-2_0-branch/
Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/dev-syncromind:13653
/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
+ /branches/dev-syncromind:13653
/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
Modified: branches/Version-2_0-branch/bim/inc/class.sovfs.inc.php
===================================================================
--- branches/Version-2_0-branch/bim/inc/class.sovfs.inc.php 2016-04-12
10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/bim/inc/class.sovfs.inc.php 2016-04-12
10:32:15 UTC (rev 14916)
@@ -209,8 +209,6 @@
$errorString = $errorString .
"filename:$this->filename \n";
throw new
InvalidArgumentException($errorString);
}
- $file = array();
- $file['file_action'][0] = $this->filename;
if($this->subModule)
{
$path = "/$this->subModule/";
@@ -219,7 +217,32 @@
{
$path = "/";
}
- $recieve = $this->bofiles->delete_file($path, $file);
+
+ $file =
"{$this->bofiles->fakebase}{$path}{$this->filename}";
+
+ if ($this->bofiles->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => array(RELATIVE_NONE)
+ )))
+ {
+ $this->bofiles->vfs->override_acl = 1;
+
+ if (!$this->bofiles->vfs->rm(array(
+ 'string' => $file,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+ $recieve['error'][] = array('msg' =>
lang('failed to delete file') . ' :' . $this->bofiles->fakebase . $path .
$this->filename);
+ }
+ else
+ {
+ $recieve['message'][] = array('msg' =>
lang('file deleted') . ' :' . $this->bofiles->fakebase . $path .
$this->filename);
+ }
+ $this->bofiles->vfs->override_acl = 0;
+ }
+
if($recieve['message'])
{
$result = $recieve['message'][0]["msg"];
Modified: branches/Version-2_0-branch/helpdesk/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/helpdesk/inc/class.uitts.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/helpdesk/inc/class.uitts.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -1903,7 +1903,7 @@
if(isset($values['file_attach']) &&
is_array($values['file_attach']))
{
// $bofiles =
CreateObject('helpdesk.bofiles' '/helpdesk');
- $attachments =
$bofiles->get_attachments("/{$id}/", $values['file_attach']);
+ $attachments =
$bofiles->get_attachments($values['file_attach']);
$attachment_log = ' ' .
lang('attachments') . ' : ' . implode(', ',$values['file_attach']);
}
if
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server'])
@@ -2090,22 +2090,13 @@
);
- $link_to_files =
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'');
-
$link_view_file =
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
for($z=0; $z<count($ticket['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="'.$link_to_files.'/'.$ticket['files'][$z]['directory'].'/'.$ticket['files'][$z]['file_name'].'"
target="_blank" title="'.lang('click to view file').'"
style="cursor:help">'.$ticket['files'][$z]['name'].'</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="'.$link_view_file.'&file_name='.$ticket['files'][$z]['file_name'].'"
target="_blank" title="'.lang('click to view
file').'">'.$ticket['files'][$z]['name'].'</a>';
- }
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]"
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to delete
file').'">';
- $content_files[$z]['attach_file'] = '<input
type="checkbox" name="values[file_attach][]"
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to attach
file').'">';
+ $content_files[$z]['file_name'] = '<a
href="'.$link_view_file.'&file_id='.$ticket['files'][$z]['file_id'].'"
target="_blank" title="'.lang('click to view
file').'">'.$ticket['files'][$z]['name'].'</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]"
value="'.$ticket['files'][$z]['file_id'].'" title="'.lang('Check to delete
file').'">';
+ $content_files[$z]['attach_file'] = '<input
type="checkbox" name="values[file_attach][]"
value="'.$ticket['files'][$z]['file_id'].'" title="'.lang('Check to attach
file').'">';
}
$datavalues[2] = array
@@ -2301,8 +2292,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'helpdesk.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
}
- $bofiles =
CreateObject('property.bofiles','/helpdesk');
- $bofiles->view_file('fmticket');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
protected function _generate_tabs($history='')
Modified: branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -755,6 +755,48 @@
}
/*
+ * get file info by id
+ *
+ * @return Array of file information.
+ */
+ function get_info( $file_id )
+ {
+ $file_id = (int) $file_id;
+ $query = $GLOBALS['phpgw']->db->query("SELECT
directory, name FROM phpgw_vfs WHERE file_id={$file_id}", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $directory = $GLOBALS['phpgw']->db->f('directory');
+ $name = $GLOBALS['phpgw']->db->f('name');
+
+ $file = "{$directory}/{$name}";
+
+ $ls_array = $this->ls(array(
+ 'string' => $file,
+ 'relatives' => array(RELATIVE_NONE),
+ 'checksubdirs' => false,
+ 'nofiles' => true
+ ));
+
+ return isset($ls_array[0]) && $ls_array[0] ?
$ls_array[0] : array();
+ }
+
+ /*
+ * get file by id
+ *
+ * @return Array of file information and file content
+ */
+ function get($file_id)
+ {
+ $file_info = $this->get_info( $file_id );
+
+ $file_info['content'] = $this->read(array(
+ 'string' =>
"{$file_info['directory']}/{$file_info['name']}",
+ 'relatives' => array(RELATIVE_NONE)
+ )
+ );
+
+ return $file_info;
+ }
+ /*
* See vfs_shared
*/
function read($data)
Modified: branches/Version-2_0-branch/property/inc/class.bofiles.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bofiles.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.bofiles.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -150,17 +150,24 @@
*
* @return array Array with result on the
action(failed/success) for each file
*/
- function delete_file( $path, $values )
+ function delete_file($path, $values )
{
$receipt = array();
- foreach ($values['file_action'] as $file_name)
+ foreach ($values['file_action'] as $file_id)
{
- $file_name = html_entity_decode($file_name);
- $file_name =
$this->strip_entities_from_name($file_name);
+ $file_info = $this->vfs->get_info($file_id);
- $file = "{$this->fakebase}{$path}{$file_name}";
+ $check_path = trim("{$this->fakebase}{$path}",
"/");
+ $file =
"{$file_info['directory']}/{$file_info['name']}";
+
+ if($check_path != trim($file_info['directory'],
"/"))
+ {
+ phpgwapi_cache::message_set( "deleting
file from wrong location", 'error');
+ return false;
+ }
+
if ($this->vfs->file_exists(array(
'string' => $file,
'relatives' =>
array(RELATIVE_NONE)
@@ -175,11 +182,11 @@
)
)))
{
- $receipt['error'][] =
array('msg' => lang('failed to delete file') . ' :' . $this->fakebase . $path .
$file_name);
+
phpgwapi_cache::message_set(lang('failed to delete file') . ' :' .$file,
'error');
}
else
{
- $receipt['message'][] =
array('msg' => lang('file deleted') . ' :' . $this->fakebase . $path .
$file_name);
+
phpgwapi_cache::message_set(lang('file deleted') . ' :' . $file, 'message');
}
$this->vfs->override_acl = 0;
}
@@ -190,6 +197,52 @@
/**
* View File - echo (or download) to browser.
*
+ * @param intenger $file_id
+ *
+ * @return null
+ */
+ function get_file( $file_id, $jasper = false )
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+
+ if (!$jasper)
+ {
+ $this->vfs->override_acl = 1;
+
+ $document = $this->vfs->get($file_id);
+
+ $this->vfs->override_acl = 0;
+ $browser = CreateObject('phpgwapi.browser');
+ $browser->content_header($document['name'],
$document['mime_type'], $document['size']);
+ echo $document['content'];
+ }
+ else //Execute the jasper report
+ {
+ $output_type = 'PDF';
+ $file_info = $this->vfs->get_info($file_id);
+ $file =
"{$file_info['directory']}/{$file_info['name']}";
+
+ $report_source = "{$this->rootdir}{$file}";
+ $jasper_wrapper =
CreateObject('phpgwapi.jasper_wrapper');
+ try
+ {
+ $jasper_wrapper->execute('',
$output_type, $report_source);
+ }
+ catch (Exception $e)
+ {
+ $error = $e->getMessage();
+ //FIXME Do something clever with the
error
+ echo "<H1>{$error}</H1>";
+ }
+ }
+ }
+
+ /**
+ * View File - echo (or download) to browser.
+ *
* @param string $type part of path where to look for files
* @param string $file optional filename
*
@@ -269,34 +322,28 @@
*
* @return array Array with filecontent
*/
- function get_attachments( $path, $values )
+ function get_attachments( $values )
{
- $mime_magic = createObject('phpgwapi.mime_magic');
$attachments = array();
- foreach ($values as $file_name)
+ foreach ($values as $file_id)
{
- $file_name =
$this->strip_entities_from_name($file_name);
- $file = "{$this->fakebase}{$path}{$file_name}";
+ $file_info = $this->vfs->get_info($file_id);
- if ($this->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' =>
array(RELATIVE_NONE))))
- {
- $mime =
$mime_magic->filename2mime($file_name);
+ $file =
"{$file_info['directory']}/{$file_info['name']}";
- $attachments[] = array
- (
- 'file' =>
"{$GLOBALS['phpgw_info']['server']['files_dir']}{$file}",
- 'name' => $file_name,
- 'type' => $mime
- );
- }
+ $attachments[] = array
+ (
+ 'file' =>
"{$GLOBALS['phpgw_info']['server']['files_dir']}{$file}",
+ 'name' => $file_info['name'],
+ 'type' => $file_info['mime_type']
+ );
}
return $attachments;
}
- function strip_entities_from_name($file_name)
+ function strip_entities_from_name( $file_name )
{
- return str_replace(array('(',
')','−−'),array('(', ')', '--'), $file_name);
+ return str_replace(array('(', ')',
'−−'), array('(', ')',
+ '--'), $file_name);
}
}
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -172,8 +172,7 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('agreement');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
private function _get_Filters()
@@ -1427,8 +1426,8 @@
for ($z = 0; $z < count($agreement['files']); $z++)
{
- $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_name=' . $agreement['files'][$z]['file_name'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$agreement['files'][$z]['name'] . '</a>';
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$agreement['files'][$z]['name'] . '" title="' . lang('Check to delete file') .
'">';
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $agreement['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$agreement['files'][$z]['name'] . '</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$agreement['files'][$z]['file_id'] . '" title="' . lang('Check to delete file')
. '">';
}
$myColumnDefs2 = array
@@ -2232,14 +2231,7 @@
for ($z = 0; $z < count($agreement['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $agreement['files'][$z]['directory'] . '/' .
$agreement['files'][$z]['file_name'] . '" target="_blank" title="' .
lang('click to view file') . '">' . $agreement['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$agreement['files'][$z]['file_name'] . '" target="_blank" title="' .
lang('click to view file') . '">' . $agreement['files'][$z]['name'] . '</a>';
- }
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $agreement['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$agreement['files'][$z]['name'] . '</a>';
}
$myColumnDefs2 = array
Modified:
branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -681,8 +681,8 @@
{
$values[] = array
(
- 'file_name' => "<a
href='{$link_view_file}&file_name={$_entry['name']}' target='_blank'
title='{$lang_view}'>{$_entry['name']}</a>",
- 'delete_file' => "<input
type='checkbox' name='file_action[]' value='{$_entry['name']}'
title='$lang_delete'>",
+ 'file_name' => "<a
href='{$link_view_file}&file_id={$_entry['file_id']}' target='_blank'
title='{$lang_view}'>{$_entry['name']}</a>",
+ 'delete_file' => "<input
type='checkbox' name='file_action[]' value='{$_entry['file_id']}'
title='$lang_delete'>",
);
}
@@ -792,9 +792,7 @@
{
return lang('no access');
}
-
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('condition_survey');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
/**
@@ -815,7 +813,7 @@
if (isset($_POST['file_action']) &&
is_array($_POST['file_action']))
{
-
$bofiles->delete_file("/condition_survey/{$id}/", array('file_action' =>
$_POST['file_action']));
+
$bofiles->delete_file("/condition_survey/{$id}/",array('file_action' =>
$_POST['file_action']));
}
$file_name = str_replace(' ', '_',
$_FILES['file']['name']);
Modified: branches/Version-2_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uientity.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uientity.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -277,13 +277,13 @@
$bofiles = CreateObject('property.bofiles');
if (isset($values['file_action']) &&
is_array($values['file_action']))
{
-
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
+
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/" ,$values);
}
if (isset($values['file_jasperaction']) &&
is_array($values['file_jasperaction']))
{
$values['file_action'] =
$values['file_jasperaction'];
-
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
+
$bofiles->delete_file("{$this->category_dir}/{$loc1}/{$id}/" ,$values);
}
$files = array();
@@ -953,8 +953,8 @@
{
$content_files[] = array
(
- 'file_name' => '<a href="' .
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . '&file_name=' .
urlencode($_entry['name']) . '" target="_blank" title="' . lang('click to view
file') . '">' . $_entry['name'] . '</a>',
- 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['name'] . '"
title="' . lang('Check to delete file') . '">'
+ 'file_name' => '<a href="' .
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . '&file_id=' .
$_entry['file_id'] . '" target="_blank" title="' . lang('click to view file') .
'">' . $_entry['name'] . '</a>',
+ 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to delete file') . '">'
);
}
@@ -1051,17 +1051,11 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $file_name = urldecode(phpgw::get_var('file_name'));
- $loc1 = phpgw::get_var('loc1', 'string', 'REQUEST',
'dummy');
- if ($this->type_app[$this->type] == 'catch')
- {
- $loc1 = 'dummy';
- }
- $id = phpgw::get_var('id', 'int');
+ $file_id = phpgw::get_var('file_id', 'int');
$jasper = phpgw::get_var('jasper', 'bool');
$bofiles = CreateObject('property.bofiles');
- $bofiles->view_file("{$this->category_dir}/{$loc1}",
'', $jasper);
+ $bofiles->get_file($file_id, $jasper);
}
function index()
Modified: branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -160,8 +160,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop',
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('project');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
function columns()
@@ -1835,8 +1834,6 @@
'id' => $id
);
- $link_to_files =
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] :
'');
-
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
$_files = $this->bo->get_files($id);
@@ -1847,15 +1844,8 @@
$content_files = array();
foreach ($_files as $_file)
{
- if ($link_to_files)
- {
- $content_files[$z]['file_name'] = "<a
href='{$link_to_files}/{$_file['directory']}/{$_file['file_name']}'
target=\"_blank\" title='{$lang_view_file}'>{$_file['name']}</a>";
- }
- else
- {
- $content_files[$z]['file_name'] = "<a
href=\"{$link_view_file}&file_name={$_file['file_name']}\"
target=\"_blank\" title=\"{$lang_view_file}\">{$_file['name']}</a>";
- }
- $content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\"
title=\"{$lang_delete_file}\">";
+ $content_files[$z]['file_name'] = "<a
href=\"{$link_view_file}&file_id={$_file['file_id']}\" target=\"_blank\"
title=\"{$lang_view_file}\">{$_file['name']}</a>";
+ $content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['file_id']}\"
title=\"{$lang_delete_file}\">";
$z++;
}
Modified: branches/Version-2_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uirequest.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uirequest.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -580,10 +580,7 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $location_code = phpgw::get_var('location_code');
-
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('request');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
function download()
@@ -1316,7 +1313,6 @@
'id' => $id
);
- $link_to_files =
$this->config->config_data['files_url'];
$j = count($values['files']);
for ($i = 0; $i < $j; $i++)
@@ -1351,15 +1347,8 @@
for ($z = 0; $z < count($values['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') . '"
>';
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $values['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$values['files'][$z]['name'] . '</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') .
'" >';
}
$datatable_def[] = array
Modified: branches/Version-2_0-branch/property/inc/class.uis_agreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uis_agreement.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uis_agreement.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -174,8 +174,7 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('service_agreement');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
private function _get_Filters()
@@ -977,7 +976,6 @@
phpgwapi_jquery::load_widget('core');
// $active_tab = phpgw::get_var('tab',
'string', 'REQUEST', 'general');
- $config = CreateObject('phpgwapi.config', 'property');
$boalarm = CreateObject('property.boalarm');
$get_items = false;
@@ -1083,8 +1081,6 @@
'id' => $id
);
- $config->read();
- $link_to_files = $config->config_data['files_url'];
$j = count($values['files']);
for ($i = 0; $i < $j; $i++)
@@ -1302,15 +1298,8 @@
for ($z = 0; $z < count($values['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') .
'">';
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $values['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$values['files'][$z]['name'] . '</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') .
'">';
}
$myColumnDefs2 = array
@@ -2247,7 +2236,6 @@
}
$s_agreement_id = phpgw::get_var('id'); // in case of
bigint
- $config = CreateObject('phpgwapi.config', 'property');
$tabs = array();
$tabs['general'] = array('label' => lang('general'),
'link' => '#general');
@@ -2326,10 +2314,6 @@
'id' => $s_agreement_id
);
-
- $config->read();
- $link_to_files = $config->config_data['files_url'];
-
$j = count($s_agreement['files']);
for ($i = 0; $i < $j; $i++)
{
@@ -2450,14 +2434,7 @@
for ($z = 0; $z < count($s_agreement['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $s_agreement['files'][$z]['directory'] . '/' .
$s_agreement['files'][$z]['file_name'] . '" target="_blank" title="' .
lang('click to view file') . '">' . $s_agreement['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$s_agreement['files'][$z]['file_name'] . '" target="_blank" title="' .
lang('click to view file') . '">' . $s_agreement['files'][$z]['name'] . '</a>';
- }
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $s_agreement['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$s_agreement['files'][$z]['name'] . '</a>';
}
$myColumnDefs2 = array
Modified: branches/Version-2_0-branch/property/inc/class.uitenant_claim.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitenant_claim.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uitenant_claim.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -108,8 +108,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop',
'perm' => PHPGW_ACL_READ,
'acl_location' => $this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('tenant_claim');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
private function _get_filter_tenant()
@@ -751,8 +750,6 @@
'id' => $claim_id
);
- $link_to_files =
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] :
'');
-
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
$_files = $this->bo->get_files($claim_id);
@@ -763,15 +760,8 @@
$content_files = array();
foreach ($_files as $_file)
{
- if ($link_to_files)
- {
- $content_files[$z]['file_name'] = "<a
href='{$link_to_files}/{$_file['directory']}/{$_file['file_name']}'
target=\"_blank\" title='{$lang_view_file}'>{$_file['name']}</a>";
- }
- else
- {
- $content_files[$z]['file_name'] = "<a
href=\"{$link_view_file}&file_name={$_file['file_name']}\"
target=\"_blank\" title=\"{$lang_view_file}\">{$_file['name']}</a>";
- }
- $content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\"
title=\"{$lang_delete_file}\">";
+ $content_files[$z]['file_name'] = "<a
href=\"{$link_view_file}&file_id={$_file['file_id']}\" target=\"_blank\"
title=\"{$lang_view_file}\">{$_file['name']}</a>";
+ $content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['file_id']}\"
title=\"{$lang_delete_file}\">";
$z++;
}
Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -1467,10 +1467,8 @@
$link_file_data = array
(
'menuaction' => 'property.uitts.view_file',
- 'id' => $id
);
- $link_to_files =
isset($this->bo->config->config_data['files_url']) ?
$this->bo->config->config_data['files_url'] : '';
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
$values = $this->bo->read_single($id);
@@ -1481,9 +1479,9 @@
{
$content_files[] = array
(
- 'file_name' => '<a href="' .
$link_view_file . '&file_name=' . $_entry['name'] . '" target="_blank"
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
- 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['name'] . '"
title="' . lang('Check to delete file') . '">',
- 'attach_file' => '<input
type="checkbox" name="values[file_attach][]" value="' . $_entry['name'] . '"
title="' . lang('Check to attach file') . '">'
+ 'file_name' => '<a href="' .
$link_view_file . '&file_id=' . $_entry['file_id'] . '" target="_blank"
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
+ 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to delete file') . '">',
+ 'attach_file' => '<input
type="checkbox" name="values[file_attach][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to attach file') . '">'
);
}
@@ -2103,8 +2101,13 @@
if (isset($values['file_attach']) &&
is_array($values['file_attach']))
{
$bofiles =
CreateObject('property.bofiles');
- $attachments =
$bofiles->get_attachments("/fmticket/{$id}/", $values['file_attach']);
- $attachment_log = ' ' .
lang('attachments') . ' : ' . implode(', ', $values['file_attach']);
+ $attachments =
$bofiles->get_attachments($values['file_attach']);
+ $_attachment_log = array();
+ foreach ($attachments as $_attachment)
+ {
+ $_attachment_log[] =
$_attachment['name'];
+ }
+ $attachment_log = ' ' .
lang('attachments') . ' : ' . implode(', ', $_attachment_log);
}
if (isset($values['send_order_format']) &&
$values['send_order_format'] == 'pdf')
@@ -2340,22 +2343,14 @@
)
);
- $link_to_files =
(isset($this->bo->config->config_data['files_url']) ?
$this->bo->config->config_data['files_url'] : '');
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
for ($z = 0; $z < count($ticket['files']); $z++)
{
- if ($link_to_files != '')
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $ticket['files'][$z]['directory'] . '/' .
$ticket['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $ticket['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$ticket['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $ticket['files'][$z]['name'] . '</a>';
- }
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$ticket['files'][$z]['name'] . '" title="' . lang('Check to delete file') .
'">';
- $content_files[$z]['attach_file'] = '<input
type="checkbox" name="values[file_attach][]" value="' .
$ticket['files'][$z]['name'] . '" title="' . lang('Check to attach file') .
'">';
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $ticket['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$ticket['files'][$z]['name'] . '</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') .
'">';
+ $content_files[$z]['attach_file'] = '<input
type="checkbox" name="values[file_attach][]" value="' .
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to attach file') .
'">';
}
@@ -2665,8 +2660,7 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('fmticket');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
protected function _generate_tabs( $history = '' )
Modified: branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -1433,9 +1433,15 @@
if (isset($values['file_action']) &&
is_array($values['file_action']))
{
$bofiles =
CreateObject('property.bofiles');
- $attachments =
$bofiles->get_attachments("/project/{$project['project_id']}/",
$values['file_action']['project']);
- $attachments =
array_merge($attachments,
$bofiles->get_attachments("/workorder/{$workorder_id}/",
$values['file_action']['workorder']));
- $attachment_log =
lang('attachments') . ': ' . implode(', ', $values['file_action']['project']) .
', ' . implode(', ', $values['file_action']['workorder']);
+ $attachments =
$bofiles->get_attachments($values['file_action']['project']);
+ $attachments =
array_merge($attachments,
$bofiles->get_attachments($values['file_action']['workorder']));
+ $_attachment_log = array();
+ foreach ($attachments as
$_attachment)
+ {
+ $_attachment_log[] =
$_attachment['name'];
+ }
+
+ $attachment_log =
lang('attachments') . ': ' . implode(', ', $_attachment_log);
}
if ($send_as_pdf)
@@ -1614,7 +1620,6 @@
);
$content_files = array();
- $link_to_files =
(isset($this->config->config_data['files_url']) ?
$this->config->config_data['files_url'] : '');
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
$files = $workorder['files'] ? $workorder['files'] :
array();
@@ -1623,15 +1628,8 @@
for ($z = 0; $z < count($files); $z++)
{
- if ($link_to_files)
- {
- $content_files[$z]['file_name'] = "<a
href='{$link_to_files}/{$files[$z]['directory']}/{$files[$z]['file_name']}
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
- }
- else
- {
- $content_files[$z]['file_name'] = "<a
href='{$link_view_file}&file_name={$files[$z]['file_name']}'
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
- }
- $content_files[$z]['select_file'] = "<input
type='checkbox' name='values[file_action][workorder][]'
value='{$files[$z]['name']}' title='{$lang_select_file}'>";
+ $content_files[$z]['file_name'] = "<a
href='{$link_view_file}&file_id={$files[$z]['file_id']}' target='_blank'
title='{$lang_view_file}'>{$files[$z]['name']}</a>";
+ $content_files[$z]['select_file'] = "<input
type='checkbox' name='values[file_action][workorder][]'
value='{$files[$z]['file_id']}' title='{$lang_select_file}'>";
}
$project_link_file_data = array
@@ -1647,15 +1645,8 @@
$i = $z;
for ($z = 0; $z < count($files); $z++)
{
- if ($link_to_files)
- {
- $content_files[$i]['file_name'] = "<a
href='{$link_to_files}/{$files[$z]['directory']}/{$files[$z]['file_name']}
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
- }
- else
- {
- $content_files[$i]['file_name'] = "<a
href='{$link_view_file}&file_name={$files[$z]['file_name']}'
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
- }
- $content_files[$i]['select_file'] = "<input
type='checkbox' name='values[file_action][project][]'
value='{$files[$z]['name']}' title='{$lang_select_file}'>";
+ $content_files[$i]['file_name'] = "<a
href='{$link_view_file}&file_id={$files[$z]['file_id']}' target='_blank'
title='{$lang_view_file}'>{$files[$z]['name']}</a>";
+ $content_files[$i]['select_file'] = "<input
type='checkbox' name='values[file_action][project][]'
value='{$files[$z]['file_id']}' title='{$lang_select_file}'>";
$i ++;
}
Modified: branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -153,8 +153,7 @@
'perm' => 1,
'acl_location' => $this->acl_location));
}
- $bofiles = CreateObject('property.bofiles');
- $bofiles->view_file('workorder');
+ ExecMethod('property.bofiles.get_file',
phpgw::get_var('file_id', 'int'));
}
function columns()
@@ -1651,22 +1650,13 @@
)
);
- $link_to_files =
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] :
'');
-
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
$link_file_data);
$content_files = array();
for ($z = 0; $z < count($values['files']); $z++)
{
- if ($link_to_files)
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- else
- {
- $content_files[$z]['file_name'] = '<a
href="' . $link_view_file . '&file_name=' .
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
- }
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') .
'">';
+ $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $values['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$values['files'][$z]['name'] . '</a>';
+ $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') .
'">';
}
$files_def = array
Modified: branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -658,6 +658,7 @@
private function _get_tableDef_document( $mode, $contract_id,
$permission = false )
{
+ $tabletools_documents = array();
$tabletools_documents[] = array
(
'my_name' => 'view',
Modified: branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
2016-04-12 10:30:11 UTC (rev 14915)
+++ branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
2016-04-12 10:32:15 UTC (rev 14916)
@@ -730,6 +730,36 @@
);
$tabs['documents'] = array('label' =>
lang('Documents'), 'link' => '#documents');
+ $tabletools_documents = array();
+ $tabletools_documents[] = array
+ (
+ 'my_name' => 'view',
+ 'text' => lang('show'),
+ 'action' => self::link(array(
+ 'menuaction' => 'rental.uidocument.view'
+ )),
+ 'parameters' => json_encode(array('parameter'
=> array(array('name' => 'id',
+ 'source' => 'id'))))
+ );
+ if ($mode == 'edit')
+ {
+ $tabletools_documents[] = array
+ (
+ 'my_name' => 'delete',
+ 'text' => lang('remove'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'rental.uidocument.delete',
+ 'phpgw_return_as' =>
'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'id',
+
'source' => 'id')))) . ";
+ removeDocument(oArgs,
parameters);
+ "
+ );
+ }
+
$datatable_def[] = array
(
'container' => 'datatable-container_1',
@@ -741,6 +771,7 @@
array('key' => 'type', 'label'
=> lang('type'), 'sortable' => true),
array('key' => 'name', 'label'
=> lang('name'), 'sortable' => true)
),
+ 'tabletools' => $tabletools_documents,
'config' => array(
array('disableFilter' => true),
array('disablePagination' =>
true)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14916] Merge 14910:14915 from trunk,
Sigurd Nes <=