mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-31 10:31:31 +01:00
attachments now via symlinks if configured and retrieval to local clients via file:/path
This commit is contained in:
parent
96689fbfca
commit
0146ff46df
@ -17,22 +17,32 @@
|
||||
{
|
||||
var $public_functions = array
|
||||
(
|
||||
'init' => True, // in class soinfolog
|
||||
'read' => True,
|
||||
'write' => True,
|
||||
'delete' => True,
|
||||
'check_access' => True,
|
||||
'readProj' => True,
|
||||
'readAddr' => True,
|
||||
'anzSubs' => True,
|
||||
'readIdArray' => True,
|
||||
'accountInfo' => True, // in class boinfolog (this class)
|
||||
'addr2name' => True
|
||||
'init' => True, // in class soinfolog
|
||||
'read' => True,
|
||||
'write' => True,
|
||||
'delete' => True,
|
||||
'check_access' => True,
|
||||
'readProj' => True,
|
||||
'readAddr' => True,
|
||||
'anzSubs' => True,
|
||||
'readIdArray' => True,
|
||||
'accountInfo' => True, // in class boinfolog (this class)
|
||||
'addr2name' => True,
|
||||
'attach_file' => True,
|
||||
'delete_attached'=> True,
|
||||
'info_attached' => True,
|
||||
'list_attached' => True,
|
||||
'read_attached' => True,
|
||||
'attached_local' => True
|
||||
);
|
||||
var $enums;
|
||||
var $so;
|
||||
var $vfs;
|
||||
var $vfs_basedir='/infolog';
|
||||
var $valid_pathes = array();
|
||||
var $send_file_ips = array();
|
||||
|
||||
function boinfolog( $info_id = 0)
|
||||
function boinfolog( $info_id = 0)
|
||||
{
|
||||
$this->enums = array(
|
||||
'priority' => array (
|
||||
@ -64,6 +74,28 @@
|
||||
));
|
||||
|
||||
$this->so = CreateObject('infolog.soinfolog');
|
||||
$this->vfs = CreateObject('infolog.vfs');
|
||||
|
||||
$this->config = CreateObject('phpgwapi.config');
|
||||
$this->config->read_repository();
|
||||
|
||||
if ($this->config->config_data)
|
||||
{
|
||||
$link_pathes = unserialize($this->config->config_data['link_pathes']);
|
||||
$send_file_ips = unserialize($this->config->config_data['send_file_ips']);
|
||||
/*
|
||||
* config.save_repository is calling addslashes,
|
||||
* while read_repository does not call stripslashes,
|
||||
* so we remove them here manually
|
||||
*/
|
||||
while (list($k,$v) = each($link_pathes)) {
|
||||
$ks = stripslashes($k);
|
||||
$this->link_pathes[$ks] = stripslashes($v);
|
||||
$this->send_file_ips[$ks] = stripslashes($send_file_ips[$k]);
|
||||
}
|
||||
// echo "<p>bo: link_pathes="; _debug_array($this->link_pathes);
|
||||
// echo "<p>bo: send_file_ips="; _debug_array($this->send_file_ips);
|
||||
}
|
||||
|
||||
$this->read( $info_id);
|
||||
}
|
||||
@ -168,13 +200,15 @@
|
||||
$this->addr2name( $this->readAddr( $this->so->data['info_addr_id'] )))
|
||||
{
|
||||
$this->so->data['info_from'] = '';
|
||||
}
|
||||
}
|
||||
return $this->so->data;
|
||||
}
|
||||
|
||||
function delete($info_id)
|
||||
{
|
||||
$this->so->delete($info_id);
|
||||
$this->delete_attached($info_id);
|
||||
|
||||
$this->so->delete($info_id);
|
||||
}
|
||||
|
||||
function write($values)
|
||||
@ -188,18 +222,18 @@
|
||||
$values['owner'] = $this->so->user;
|
||||
}
|
||||
$values['datecreated'] = time(); // is now MODIFICATION-date
|
||||
|
||||
|
||||
if (!$values['subject'])
|
||||
{
|
||||
$values['subject'] = substr($values['des'],0,60).' ...';
|
||||
}
|
||||
}
|
||||
if ($values['addr_id'] && !$values['from'])
|
||||
{
|
||||
$values['from'] = $this->addr2name( $this->readAddr( $values['addr_id'] ));
|
||||
}
|
||||
$this->so->write($values);
|
||||
}
|
||||
|
||||
|
||||
function anzSubs( $info_id )
|
||||
{
|
||||
return $this->so->anzSubs( $info_id );
|
||||
@ -212,4 +246,156 @@
|
||||
$action,$addr_id,$proj_id,$info_id,
|
||||
$ordermethod,$start,$total);
|
||||
}
|
||||
|
||||
|
||||
function vfs_path($info_id,$file='')
|
||||
{
|
||||
return $this->vfs_basedir . '/' . $info_id . ($file ? '/' . $file : '');
|
||||
}
|
||||
|
||||
/*
|
||||
** Put a file to the corrosponding place in the VFS and set the attributes
|
||||
** ACL check is done by the VFS
|
||||
*/
|
||||
function attach_file($info_id,$filepos,$name,$size,$type,$comment='',$full_fname='')
|
||||
{
|
||||
//echo "<p>add_one_file: info_id='$info_id', filepos='$filepos', name='$name', size='$size', type='$type', comment='$comment', full_fname='$full_fname'</p>\n";
|
||||
|
||||
// create the root for attached files in infolog, if it does not exists
|
||||
if (!($this->vfs->file_exists($this->vfs_basedir,array(RELATIVE_ROOT))))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->mkdir($this->vfs_basedir,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
}
|
||||
|
||||
$dir=$this->vfs_path($info_id);
|
||||
if (!($this->vfs->file_exists($dir,array(RELATIVE_ROOT))))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->mkdir($dir,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
}
|
||||
$fname = $this->vfs_path($info_id,$name);
|
||||
$tfname = '';
|
||||
if ($full_fname)
|
||||
{
|
||||
$full_fname = str_replace('\\\\','/',$full_fname); // vfs uses only '/'
|
||||
reset($this->link_pathes);
|
||||
while ((list($valid,$trans) = each($this->link_pathes)) && !$tfname)
|
||||
{ // check case-insensitive for WIN etc.
|
||||
$check = $valid[0] == '\\' || strstr(':',$valid) ? 'eregi' : 'ereg';
|
||||
$valid2 = str_replace('\\','/',$valid);
|
||||
if ($check('^('.$valid2.')(.*)$',$full_fname,$parts) &&
|
||||
ereg($this->send_file_ips[$valid],$ip) && // right IP
|
||||
$this->vfs->file_exists($trans.$parts[2],array(RELATIVE_NONE|VFS_REAL)))
|
||||
{
|
||||
$tfname = $trans.$parts[2];
|
||||
}
|
||||
// echo "<p>add_one_file: full_fname='$full_fname', valid2='$valid2', trans='$trans', check=$check, tfname='$tfname', parts=(x,'${parts[1]}','${parts[2]}')</p>\n";
|
||||
}
|
||||
if ($tfname && !$this->vfs->securitycheck($tfname))
|
||||
{
|
||||
return lang('Invalid filename').': '.$tfname;
|
||||
}
|
||||
}
|
||||
if ($tfname) // file is local
|
||||
{
|
||||
$this->vfs->symlink($tfname,$fname,array(RELATIVE_NONE|VFS_REAL,RELATIVE_ROOT));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->vfs->cp($filepos,$fname,array(RELATIVE_NONE|VFS_REAL,RELATIVE_ROOT));
|
||||
}
|
||||
$this->vfs->set_attributes ($fname, array (RELATIVE_ROOT),
|
||||
array ('mime_type' => $type,
|
||||
'comment' => stripslashes ($comment),
|
||||
'app' => 'infolog'));
|
||||
}
|
||||
|
||||
function delete_attached($info_id,$fname = '')
|
||||
{
|
||||
$file = $this->vfs_path($info_id,$fname);
|
||||
|
||||
if ($this->vfs->file_exists($file,array(RELATIVE_ROOT)))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->delete($file,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function info_attached($info_id,$filename)
|
||||
{
|
||||
$attachments = $this->vfs->ls($this->vfs_path($info_id,$filename),array(REALTIVE_NONE));
|
||||
|
||||
if (!count($attachments) || !$attachments[0]['name'])
|
||||
{
|
||||
return False;
|
||||
}
|
||||
return $attachments[0];
|
||||
}
|
||||
|
||||
function list_attached($info_id)
|
||||
{
|
||||
$attachments = $this->vfs->ls($this->vfs_path($info_id),array(REALTIVE_NONE));
|
||||
|
||||
if (!count($attachments) || !$attachments[0]['name'])
|
||||
{
|
||||
return False;
|
||||
}
|
||||
while (list($keys,$fileinfo) = each($attachments))
|
||||
{
|
||||
$attached[$fileinfo['name']] = $fileinfo['comment'];
|
||||
}
|
||||
return $attached;
|
||||
}
|
||||
|
||||
function is_win_path($path)
|
||||
{
|
||||
return $path[0] == '\\' || strstr($path,':');
|
||||
}
|
||||
|
||||
function read_attached($info_id,$filename)
|
||||
{
|
||||
if (!$info_id || !$filename || !$this->check_access($info_id,PHPGW_ACL_READ))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
return $this->vfs->read($this->vfs_path($info_id,$filename),array(RELATIVE_ROOT));
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if filename should be local availible and if so returns 'file:/path' for HTTP-redirect
|
||||
* else return False
|
||||
*/
|
||||
function attached_local($info_id,$filename,$ip,$win_user)
|
||||
{
|
||||
//echo "<p>attached_local(info_id='$info_id', filename='$filename', ip='$ip', win_user='$win_user', count(send_file_ips)=".count($this->send_file_ips).")</p>\n";
|
||||
|
||||
if (!$info_id || !$filename || !$this->check_access($info_id,PHPGW_ACL_READ) ||
|
||||
!count($this->send_file_ips))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
$link = $this->vfs->readlink ($this->vfs_path($info_id,$filename), array (RELATIVE_ROOT));
|
||||
|
||||
if ($link)
|
||||
{
|
||||
reset($this->link_pathes); $fname = '';
|
||||
while ((list($valid,$trans) = each($this->link_pathes)) && !$fname)
|
||||
{
|
||||
if (!$this->is_win_path($valid) == !$win_user && // valid for this OS
|
||||
eregi('^'.$trans.'(.*)$',$link,$parts) && // right path
|
||||
ereg($this->send_file_ips[$valid],$ip)) // right IP
|
||||
{
|
||||
$fname = $valid . $parts[1];
|
||||
$fname = !$win_user ? str_replace('\\','/',$fname) : str_replace('/','\\',$fname);
|
||||
return 'file:'.($win_user ? '//' : '' ).$fname;
|
||||
}
|
||||
// echo "<p>attached_local: link=$link, valid=$valid, trans='$trans', fname='$fname', parts=(x,'${parts[1]}','${parts[2]}')</p>\n";
|
||||
}
|
||||
}
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,16 @@ class html
|
||||
return $html;
|
||||
}
|
||||
|
||||
function input($name,$value='',$type='',$options='' )
|
||||
{
|
||||
if ($type) $type = "type=$type";
|
||||
|
||||
return "<input $type name=\"$name\" value=\"$value\" $options>\n";
|
||||
}
|
||||
|
||||
function submit_button($name,$lang,$onClick='')
|
||||
{
|
||||
return "<input type=\"submit\" name=\"$name\" value=\"".lang($lang).'"'.
|
||||
($onClick ? " onClick=\"$onClick\"" : '').">\n";
|
||||
return $this->input($name,lang($lang),'submit',$onClick ? "onClick=\"$onClick\"" : '');
|
||||
}
|
||||
|
||||
/*
|
||||
@ -76,12 +82,6 @@ class html
|
||||
return "<input type=\"checkbox\" name=\"$name\" value=\"True\"" .($value ? ' checked' : '') . ">\n";
|
||||
}
|
||||
|
||||
|
||||
function file($name,$value='')
|
||||
{
|
||||
return "<input type=\"file\" name=\"$name\">\n";
|
||||
}
|
||||
|
||||
function form($content,$hidden_vars,$url,$url_vars='',$method='POST')
|
||||
{
|
||||
$html = "<form method=\"$method\" action=\"".$this->link($url,$url_vars)."\">\n";
|
||||
|
@ -24,16 +24,14 @@
|
||||
'delete' => True,
|
||||
'get_file' => True,
|
||||
'add_file' => True,
|
||||
'admin' => True,
|
||||
'preferences' => True
|
||||
);
|
||||
var $icons;
|
||||
var $vfs;
|
||||
var $basedir='/infolog';
|
||||
|
||||
function uiinfolog( )
|
||||
{
|
||||
$this->bo = CreateObject('infolog.boinfolog');
|
||||
$this->vfs = CreateObject('phpgwapi.vfs');
|
||||
|
||||
$this->icons = array(
|
||||
'type' => array(
|
||||
@ -198,16 +196,16 @@
|
||||
}
|
||||
|
||||
// add the links to the files which corrospond to this entry
|
||||
$attachments=$this->vfs->ls($this->basedir.'/'.$info['info_id'].'/',array(REALTIVE_NONE));
|
||||
while (list($keys,$fileinfo) = each($attachments))
|
||||
$attachments = $this->bo->list_attached($info['info_id']);
|
||||
while (list($name,$comment) = @each($attachments))
|
||||
{
|
||||
$links .= isset($links) ? ', ' : '<br>';
|
||||
$links .= $this->html->a_href($fileinfo['name'],'/index.php',
|
||||
$links .= $this->html->a_href($name,'/index.php',
|
||||
$this->menuaction('get_file') + array(
|
||||
'info_id' => $info['info_id'],
|
||||
'filename' => $fileinfo['name'])
|
||||
);
|
||||
if ($fileinfo['comment']) $links .= ' (' . $fileinfo['comment'] . ')';
|
||||
'filename' => $name
|
||||
),'target=_blank');
|
||||
if ($comment) $links .= ' (' . $comment . ')';
|
||||
}
|
||||
|
||||
return array(
|
||||
@ -542,6 +540,7 @@
|
||||
{
|
||||
$info_id=$GLOBALS['HTTP_GET_VARS']['info_id'];
|
||||
$filename=$GLOBALS['HTTP_GET_VARS']['filename'];
|
||||
//echo "<p>get_file: info_id='$info_id', filename='$filename'</p>\n";
|
||||
|
||||
$browser = CreateObject('phpgwapi.browser');
|
||||
|
||||
@ -549,54 +548,24 @@
|
||||
|
||||
if (!$info_id || !$filename || !$this->bo->check_access($info_id,PHPGW_ACL_READ))
|
||||
{
|
||||
Header('Location: ' . $html->link($referer));
|
||||
Header('Location: ' . $this->html->link($referer));
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
$local = $this->bo->attached_local($info_id,$filename,$GLOBALS['HTTP_SERVER_VARS']['REMOTE_ADDR'],$browser->is_windows());
|
||||
|
||||
$fn=$this->basedir.'/'.$info_id.'/'.$filename;
|
||||
$browser->content_header($fn);
|
||||
echo $this->vfs->read($fn,array(RELATIVE_ROOT));
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
** Put a file to the corrosponding place in the VFS and set the attributes
|
||||
** ACL check is done by the VFS
|
||||
*/
|
||||
function add_one_file($info_id,$filepos,$name,$size,$type,$comment='')
|
||||
{
|
||||
//echo "<p>add_one_file: info_id='$info_id', filepos='$filepos', name='$name', size='$size', type='$type', comment='$comment'</p>\n";
|
||||
|
||||
if ($filepos && ($filepos!="none") && $info_id)
|
||||
if ($local)
|
||||
{
|
||||
// create the root for attached files in infolog, if it does not exists
|
||||
if (!($this->vfs->file_exists($this->basedir,array(RELATIVE_ROOT))))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->mkdir($this->basedir,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
}
|
||||
|
||||
if (!$this->vfs->securitycheck($filename))
|
||||
{
|
||||
return lang('Invalid filename');
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir=$this->basedir.'/'.$info_id;
|
||||
if (!($this->vfs->file_exists($dir,array(RELATIVE_ROOT))))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->mkdir($dir,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
}
|
||||
$this->vfs->cp($filepos,$dir.'/'.$name,array(RELATIVE_NONE|VFS_REAL,RELATIVE_ROOT));
|
||||
$this->vfs->set_attributes ($dir.'/'.$name, array (RELATIVE_ROOT),
|
||||
array ('mime_type' => $type,
|
||||
'comment' => stripslashes ($comment),
|
||||
'app' => 'infolog'));
|
||||
}
|
||||
//echo "<p>local: '$local'</p>\n";
|
||||
Header('Location: ' . $local );
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<p>not local: ".$this->bo->vfs_path($info_id,$filename)."</p>\n";
|
||||
$info = $this->bo->info_attached($info_id,$filename);
|
||||
$browser->content_header($filename,$info['mime_type']);
|
||||
echo $this->bo->read_attached($info_id,$filename);
|
||||
}
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -606,7 +575,7 @@
|
||||
{
|
||||
global $upload,$info_id;
|
||||
global $attachfile,$attachfile_name,$attachfile_size,$attachfile_type;
|
||||
global $filecomment;
|
||||
global $filecomment,$full_fname;
|
||||
global $sort,$order,$query,$start,$filter,$cat_id;
|
||||
|
||||
$t = $this->template; $html = $this->html;
|
||||
@ -620,9 +589,10 @@
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if ($upload) {
|
||||
$fileerror = $this->add_one_file($info_id,$attachfile,$attachfile_name,$attachfile_size,$attachfile_type,$filecomment);
|
||||
if ($fileerror!='') $error[]=$fileerror;
|
||||
if ($upload && $attachfile && $attachfile != "none")
|
||||
{
|
||||
$fileerror = $this->bo->attach_file($info_id,$attachfile,$attachfile_name,$attachfile_size,$attachfile_type,$filecomment,$full_fname);
|
||||
if ($fileerror) $error[]=$fileerror;
|
||||
}
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
@ -632,7 +602,7 @@
|
||||
$t->set_var( $this->infoHeaders( ));
|
||||
$t->set_var( $this->formatInfo( $info_id ));
|
||||
$t->set_var( 'hidden_vars',$html->input_hidden(array(
|
||||
'info_id' => $info_id, 'referer' => $referer
|
||||
'info_id' => $info_id, 'referer' => $referer, 'full_fname' => '.' // must not be empty
|
||||
)));
|
||||
|
||||
if (is_array($error))
|
||||
@ -647,7 +617,7 @@
|
||||
$t->set_var('lang_file',lang('attach file').':');
|
||||
$t->set_var('lang_comment',lang('comment').':');
|
||||
|
||||
$t->set_var('submit_button',$html->submit_button('upload','attach file'));
|
||||
$t->set_var('submit_button',$html->submit_button('upload','attach file','this.form.full_fname.value=this.form.attachfile.value'));
|
||||
$t->set_var('cancel_button',$html->form_1button('cancel_button','Done','',$referer));
|
||||
|
||||
$t->pfp('out','info_add_file');
|
||||
@ -663,7 +633,7 @@
|
||||
global $type,$from,$addr,$id_addr,$id_project,$subject,$des,$access;
|
||||
global $pri,$status,$confirm,$info_cat,$id_parent,$responsible;
|
||||
global $attachfile,$attachfile_name,$attachfile_size,$attachfile_type;
|
||||
global $filecomment;
|
||||
global $filecomment,$full_fname;
|
||||
|
||||
$t = $this->template; $html = $this->html;
|
||||
|
||||
@ -780,9 +750,11 @@
|
||||
'responsible' => $responsible
|
||||
));
|
||||
|
||||
// save the attached file
|
||||
$fileerror = $this->add_one_file($this->bo->so->data['info_id'],$attachfile,$attachfile_name,$attachfile_size,$attachfile_type,$filecomment);
|
||||
if ($fileerror!='') $error[]=$fileerror;
|
||||
if ($attachfile && $attachfile != "none") // save the attached file
|
||||
{
|
||||
$fileerror = $this->bo->attach_file($this->bo->so->data['info_id'],$attachfile,$attachfile_name,$attachfile_size,$attachfile_type,$filecomment,$full_fname);
|
||||
if ($fileerror) $error[]=$fileerror;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$query_addr && !$query_project)
|
||||
@ -830,7 +802,8 @@
|
||||
'info_id' => $info_id,
|
||||
'action' => $action,
|
||||
'id_parent' => $id_parent,
|
||||
'referer' => $referer
|
||||
'referer' => $referer,
|
||||
'full_fname' => '.' // must not be empty
|
||||
));
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
@ -953,10 +926,10 @@
|
||||
if (!isset($access)) $access = $this->bo->so->data['info_access'] == 'private';
|
||||
$t->set_var('access_list',$html->checkbox('access',$access));
|
||||
|
||||
$t->set_var('lang_file',lang('attach file').':');
|
||||
$t->set_var('lang_comment',lang('comment').':');
|
||||
$t->set_var(array('lang_file' => lang('attach file').':','file_val' => $full_fname));
|
||||
$t->set_var(array('lang_comment' => lang('comment').':','comment_val' => $filecomment));
|
||||
|
||||
$t->set_var('edit_button',$html->submit_button('save','Save'));
|
||||
$t->set_var('edit_button',$html->submit_button('save','Save','this.form.full_fname.value=this.form.attachfile.value'));
|
||||
|
||||
$t->set_var('cancel_button',$html->form_1button('cancel','Cancel',0,$referer));
|
||||
|
||||
@ -989,23 +962,13 @@
|
||||
}
|
||||
if ($confirm)
|
||||
{
|
||||
$file = $this->basedir.'/'.$info_id; // whole dir
|
||||
|
||||
if (!isset($to_del) || $to_del == '.')
|
||||
{
|
||||
$this->bo->delete($info_id);
|
||||
|
||||
$file = $this->basedir.'/'.$info_id; // whole dir
|
||||
}
|
||||
else
|
||||
{
|
||||
$file .= '/'.$to_del;
|
||||
}
|
||||
if ($this->vfs->file_exists($file,array(RELATIVE_ROOT)))
|
||||
{
|
||||
$this->vfs->override_acl = 1;
|
||||
$this->vfs->delete($file,array(RELATIVE_ROOT));
|
||||
$this->vfs->override_acl = 0;
|
||||
$this->bo->delete_attached($info_id,$to_del);
|
||||
}
|
||||
Header('Location: ' . $html->link($referer,array( 'cd' => 16 )));
|
||||
}
|
||||
@ -1017,15 +980,14 @@
|
||||
$t->set_file(array( 'info_delete' => 'delete.tpl' ));
|
||||
|
||||
// add the links to the files which corrospond to this entry
|
||||
$attachments = $this->vfs->ls($this->basedir.'/'.$info_id.'/',array(REALTIVE_NONE));
|
||||
if (count($attachments) && $attachments[0]['name'])
|
||||
$attachments = $this->bo->list_attached($info_id);
|
||||
if ($attachments)
|
||||
{
|
||||
$to_del = array('.' => lang('entry and all files'));
|
||||
|
||||
while (list($keys,$fileinfo) = each($attachments))
|
||||
while (list($name,$comment) = each($attachments))
|
||||
{
|
||||
$to_del[$fileinfo['name']] = $fileinfo['name'] .
|
||||
($fileinfo['comment'] ? ' ('.$fileinfo['comment'].')' : '');
|
||||
$to_del[$name] = $name . ($comment ? ' ('.$comment.')' : '');
|
||||
}
|
||||
$sbox2 = CreateObject('phpgwapi.sbox2');
|
||||
$t->set_var('to_del',$sbox2->getArrayItem('to_del','.',$to_del,True));
|
||||
@ -1051,6 +1013,68 @@
|
||||
}
|
||||
}
|
||||
|
||||
function admin( )
|
||||
{
|
||||
if ($GLOBALS['HTTP_POST_VARS']['done'])
|
||||
{
|
||||
Header('Location: '.$GLOBALS['phpgw']->link('/admin/index.php'));
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if ($GLOBALS['HTTP_POST_VARS']['save'])
|
||||
{
|
||||
$this->bo->link_pathes = array(); $this->bo->send_file_ips = array();
|
||||
|
||||
while (list($key,$val) = each($GLOBALS['HTTP_POST_VARS']['valid']))
|
||||
{
|
||||
if ($val = stripslashes($val))
|
||||
{
|
||||
$this->bo->link_pathes[$val] = stripslashes($GLOBALS['HTTP_POST_VARS']['trans'][$key]);
|
||||
$this->bo->send_file_ips[$val] = stripslashes($GLOBALS['HTTP_POST_VARS']['ip'][$key]);
|
||||
}
|
||||
}
|
||||
$this->config->config_data = array(
|
||||
'link_pathes' => serialize($this->bo->link_pathes),
|
||||
'send_file_ips' => serialize($this->bo->send_file_ips)
|
||||
);
|
||||
$this->bo->config->save_repository(True);
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$this->template->set_file(array('info_admin' => 'admin.tpl'));
|
||||
|
||||
$this->template->set_var(Array(
|
||||
'title' => lang('InfoLog').' - '.lang('configuration'),
|
||||
'text' => lang('<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients'),
|
||||
'action_url' => $this->html->link('/index.php',$this->menuaction('admin')),
|
||||
'bg_h_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'save_button' => $this->html->submit_button('save','Save'),
|
||||
'done_button' => $this->html->submit_button('done','Done'),
|
||||
'lang_valid' => lang('valid path on clientside<br>eg. \\\\Server\\Share or e:\\'),
|
||||
'lang_trans' => lang('path on (web-)serverside<br>eg. /var/samba/Share'),
|
||||
'lang_ip' => lang('reg. expr. for local IP\'s<br>eg. ^192\\.168\\.1\\.')
|
||||
));
|
||||
$this->template->set_block('info_admin', 'admin_line', 'admin_linehandle');
|
||||
|
||||
$i = 0; @reset($this->bo->link_pathes);
|
||||
do {
|
||||
list($valid,$trans) = @each($this->bo->link_pathes);
|
||||
$this->template->set_var(array(
|
||||
'bg_nm_color' => $this->nextmatchs->alternate_row_color(),
|
||||
'num' => $i+1,
|
||||
'val_valid' => $this->html->input("valid[$i]",$valid),
|
||||
'val_trans' => $this->html->input("trans[$i]",$trans),
|
||||
'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid])
|
||||
));
|
||||
$this->template->parse('admin_linehandle','admin_line',True);
|
||||
++$i;
|
||||
} while ($valid);
|
||||
|
||||
$this->template->pfp('out','info_admin');
|
||||
}
|
||||
|
||||
function preferences( )
|
||||
{
|
||||
global $save;
|
||||
@ -1088,8 +1112,7 @@
|
||||
$vars = Array(
|
||||
'title' => lang('InfoLog preferences'),
|
||||
'text' => ' ',
|
||||
'action_url' => $html->link('/index.php',
|
||||
$this->menuaction('preferences')),
|
||||
'action_url' => $html->link('/index.php',$this->menuaction('preferences')),
|
||||
'bg_h_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'save_button' => $html->submit_button('save','Save')
|
||||
);
|
||||
|
@ -14,7 +14,8 @@
|
||||
// Only Modify the $file and $title variables.....
|
||||
$title = $appname;
|
||||
$file = Array(
|
||||
'CSV-Import' => $phpgw->link('/infolog/csv_import.php')
|
||||
'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'infolog.uiinfolog.admin' )),
|
||||
'CSV-Import' => $GLOBALS['phpgw']->link('/infolog/csv_import.php')
|
||||
);
|
||||
//Do not modify below this line
|
||||
display_section($appname,$title,$file);
|
||||
|
@ -1,5 +1,6 @@
|
||||
%1 records imported infolog de %1 Datensätze importiert
|
||||
%1 records read (not yet imported, you may go back and uncheck test import) infolog de %1 Datensätze gelesen (noch nicht importiert, sie können %2zurück%3 gehen und Test Import ausschalten)
|
||||
<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients infolog de <b>Dateianhänge über Symlinks</b> anstatt sie hochzuladen und Zugriff mit file:/pfad für lokale Benutzer
|
||||
Add a file infolog de Datei anhängen
|
||||
Invalid filename infolog de Ungültiger Dateiname
|
||||
accept infolog de bei Annahme
|
||||
@ -16,6 +17,7 @@ call infolog de anrufen
|
||||
category infolog de Kategorie
|
||||
close infolog de Schließen
|
||||
comment infolog de Kommentar
|
||||
configuration infolog de Konfiguration
|
||||
confirm infolog de Bestätigung
|
||||
csv-fieldname infolog de CSV-Feldname
|
||||
csv-filename infolog de CSV-Dateiname
|
||||
@ -64,6 +66,7 @@ own open infolog de eigene offen
|
||||
own overdue infolog de eigene überfällig
|
||||
own upcoming infolog de eigene zukünftig
|
||||
owner infolog de Erstellt von
|
||||
path on (web-)serverside<br>eg. /var/samba/Share infolog de Pfad auf (Web-)Server<br>zB. /var/samba/Share
|
||||
pattern for search in addressbook infolog de Muster für Suche im Adressbuch
|
||||
pattern for search in projects infolog de Muster für Suche des Projekts
|
||||
phone infolog de Anruf
|
||||
@ -73,6 +76,7 @@ priority infolog de Priorit
|
||||
private infolog de Privat
|
||||
project infolog de Projekt
|
||||
re: infolog de Re:
|
||||
reg. expr. for local IP's<br>eg. ^192\.168\.1\. infolog de reg. Ausdr. für lokale IP's<br>^192\.168\.1\.
|
||||
reject infolog de Absage
|
||||
responsible infolog de Auftrag an
|
||||
search for: infolog de Suchen nach:
|
||||
@ -96,6 +100,7 @@ urgency infolog de Priorit
|
||||
urgent infolog de Dringend
|
||||
use Button to search for Address infolog de Button zum Suchen der Adresse verwenden
|
||||
use Button to search for Project infolog de Button zum Suchen des Projekts verwenden
|
||||
valid path on clientside<br>eg. \\Server\Share or e:\ infolog de gültiger Pfad clientseitig<br>zB. \\Server\Share oder e:\
|
||||
view other subs infolog de andere Teileprojekte anzeigen
|
||||
view subs infolog de Teilprojekte anzeigen
|
||||
will-call infolog de ruft zurück
|
||||
|
@ -1,5 +1,6 @@
|
||||
%1 records imported infolog en %1 records imported
|
||||
%1 records read (not yet imported, you may go back and uncheck test import) infolog en %1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)
|
||||
<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients infolog en <b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients
|
||||
Add a file infolog de Add a file
|
||||
Invalid filename infolog de Invalid filename
|
||||
accept infolog en accept
|
||||
@ -16,6 +17,7 @@ call infolog en call
|
||||
category infolog en Category
|
||||
close infolog de Close
|
||||
comment infolog en Comment
|
||||
configuration infolog de Konfiguration
|
||||
confirm infolog en confirm
|
||||
csv-fieldname infolog en CSV-Fieldname
|
||||
csv-filename infolog en CSV-Filename
|
||||
@ -64,6 +66,7 @@ own open infolog en own open
|
||||
own overdue infolog en own overdue
|
||||
own upcoming infolog en own upcoming
|
||||
owner infolog en Owner
|
||||
path on (web-)serverside<br>eg. /var/samba/Share infolog en path on (web-)serverside<br>eg. /var/samba/Share
|
||||
pattern for search in addressbook infolog en pattern for search in Addressbook
|
||||
pattern for search in projects infolog en pattern for search in Projects
|
||||
phone infolog en Phonecall
|
||||
@ -73,6 +76,7 @@ priority infolog en Priority
|
||||
private infolog en Private
|
||||
project infolog en Project
|
||||
re: infolog en Re:
|
||||
reg. expr. for local IP's<br>eg. ^192\.168\.1\. infolog en reg. expr. for local IP's<br>eg. ^192\.168\.1\.
|
||||
reject infolog en reject
|
||||
responsible infolog en Responsible
|
||||
search for: infolog en Search for:
|
||||
@ -96,6 +100,7 @@ urgency infolog en urgency
|
||||
urgent infolog en urgent
|
||||
use Button to search for Address infolog en use Button to search for Address
|
||||
use Button to search for Project infolog en use Button to search for Project
|
||||
valid path on clientside<br>eg. \\Server\Share or e:\ infolog en valid path on clientside<br>eg. \\Server\Share or e:\
|
||||
view other subs infolog en view other Subs
|
||||
view subs infolog en view Subs
|
||||
will-call infolog en will call
|
||||
|
Loading…
Reference in New Issue
Block a user