mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 20:49:08 +01:00
modifications for the links via the new vfs/links stream wrapper
This commit is contained in:
parent
da4a19b7dc
commit
ea7ea8deb6
File diff suppressed because it is too large
Load Diff
@ -8,19 +8,22 @@
|
||||
* @package etemplate
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
if (!preg_match('/^[a-z0-9_-]+$/i',$_GET['app'])) die('Stop'); // just to prevent someone doing nasty things
|
||||
|
||||
$GLOBALS['egw_info']['flags'] = array(
|
||||
'currentapp' => 'infolog',
|
||||
'currentapp' => $_GET['app'],
|
||||
'noheader' => true,
|
||||
'nonavbar' => true
|
||||
);
|
||||
include ('../../header.inc.php');
|
||||
|
||||
$file = $_GET['image'];
|
||||
$g_srcfile = $GLOBALS['egw_info']['server']['files_dir'] . $file;
|
||||
$g_dstfile = $GLOBALS['egw_info']['server']['temp_dir'] . $file;
|
||||
$g_srcfile = egw_link::vfs_path($_GET['app'],$_GET['id'],$_GET['file']);
|
||||
$g_dstfile = $GLOBALS['egw_info']['server']['temp_dir'] . '/egw-thumbs/'.$_GET['app'].'/'.$_GET['id'].'/'.$_GET['file'];
|
||||
|
||||
// Check for existing thumbnail
|
||||
if(file_exists($g_dstfile) && filemtime($g_dstfile) >= filemtime($g_srcfile)) {
|
||||
header('Content-Type: image/png');
|
||||
readfile($g_dstfile);
|
||||
return;
|
||||
}
|
||||
@ -46,8 +49,12 @@
|
||||
*
|
||||
* @author Nathan Gray
|
||||
*/
|
||||
function get_thumbnail($file, $return_data = true) {
|
||||
$max_width = $max_height = $GLOBALS['egw_info']['server']['link_list_thumbnail'];
|
||||
function get_thumbnail($file, $return_data = true)
|
||||
{
|
||||
global $g_srcfile,$g_dstfile;
|
||||
|
||||
$max_width = $max_height = $GLOBALS['egw_info']['server']['link_list_thumbnail'];
|
||||
|
||||
if($max_width == 0) {
|
||||
// thumbnailing disabled
|
||||
return false;
|
||||
@ -59,28 +66,9 @@
|
||||
// Quality
|
||||
$g_imgcomp=55;
|
||||
|
||||
$g_srcfile = $GLOBALS['egw_info']['server']['files_dir'] . $file;
|
||||
$g_dstfile = $GLOBALS['egw_info']['server']['temp_dir'] . $file;
|
||||
|
||||
$dir_array = explode(DIRECTORY_SEPARATOR, $g_dstfile);
|
||||
array_pop($dir_array);
|
||||
$dest_dir = implode(DIRECTORY_SEPARATOR, $dir_array);
|
||||
@mkdir($dest_dir, 0700, true);
|
||||
|
||||
if(file_exists($g_srcfile)) {
|
||||
$bolink = CreateObject('phpgwapi.bolink');
|
||||
$read = $bolink->vfs->acl_check(array(
|
||||
'string' => $file,
|
||||
'relatives' => array (),
|
||||
'operation' => EGW_ACL_READ
|
||||
));
|
||||
if(!$read) {
|
||||
$im = @imagecreatetruecolor(strlen(lang('access not permitted')) * 7, 20);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 2,5,3, lang('access not permitted'), $text_color);
|
||||
return $return_data ? $im : false;
|
||||
}
|
||||
|
||||
$dst_dir = dirname($g_dstfile);
|
||||
// files dont exist, if you have no access permission
|
||||
if((file_exists($dst_dir) || mkdir($dst_dir, 0700, true)) && file_exists($g_srcfile)) {
|
||||
$g_is=getimagesize($g_srcfile);
|
||||
if($g_is[0] < $max_width && $g_is[1] < $max_height) {
|
||||
$g_iw = $g_is[0];
|
||||
@ -94,10 +82,7 @@
|
||||
}
|
||||
|
||||
// Get mime type
|
||||
$info = $bolink->vfs->ls(array(
|
||||
'string' => $file
|
||||
));
|
||||
list($type, $image_type) = explode('/', $info[0]['mime_type']);
|
||||
list($type, $image_type) = explode('/',egw_vfs::mime_content_type($g_srcfile));
|
||||
if($type != 'image') {
|
||||
return false;
|
||||
}
|
||||
@ -134,9 +119,6 @@
|
||||
imagepng($img_dst, $g_dstfile);
|
||||
return $return_data ? $img_dst : $g_dstfile;
|
||||
} else {
|
||||
if(file_exists($g_dstfile)) {
|
||||
unlink($g_dstfile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,27 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<grid id="etemplate.link_widget.list" template="" lang="" group="" version="0.9.15.003" class="whiteback">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column disabled="!@primary"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="nmr">
|
||||
<description id="${row}[app]"/>
|
||||
<hbox options="0,0">
|
||||
<description options=",@${row}[view]" no_lang="1" id="${row}[title]" statustext="view this linked entry in its application"/>
|
||||
<description class="note_following" no_lang="1" id="${row}[remark]"/>
|
||||
</hbox>
|
||||
<button image="delete.png" label="Unlink" id="unlink[$row_cont[link_id]]" statustext="Remove this link (not the entry itself)"/>
|
||||
<radio options="$row_cont[link_id]" id="primary" statustext="Select a primary contact, to show in the list"/>
|
||||
</row>
|
||||
</rows>
|
||||
<template id="etemplate.link_widget.list" template="" lang="" group="0" version="1.5.001">
|
||||
<grid class="whiteback">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column disabled="!@primary"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="nmr">
|
||||
<vbox>
|
||||
<html id="${row}[mime_icon]"/>
|
||||
<description id="${row}[app]"/>
|
||||
</vbox>
|
||||
<hbox options="0,0">
|
||||
<box no_lang="1">
|
||||
<html id="${row}[thumbnail]"/>
|
||||
<description no_lang="1" id="${row}[title]" options=",@${row}[view],,,$row_cont[target]" statustext="view this linked entry in its application"/>
|
||||
</box>
|
||||
<description no_lang="1" id="${row}[remark]" class="note_following"/>
|
||||
</hbox>
|
||||
<button label="Unlink" id="unlink[$row_cont[link_id]]" image="delete.png" statustext="Remove this link (not the entry itself)"/>
|
||||
<radio id="primary" options="$row_cont[link_id]" statustext="Select a primary contact, to show in the list"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<styles>
|
||||
.whiteback { background: white; }
|
||||
.note_following { font-style: italic; padding-left: 5px; }
|
||||
</styles>
|
||||
</grid>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user