mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Changes to file merge
- Remove accidentally committed debug - Make URL into web-accessable URL - Add clickable link placeholder - Format custom field date/times according to user preference - Add rel_path placeholder, includes path+name relative to current directory
This commit is contained in:
parent
92e3a83be1
commit
019bfb1c93
@ -36,13 +36,22 @@ class filemanager_merge extends bo_merge
|
|||||||
*/
|
*/
|
||||||
protected $bo = null;
|
protected $bo = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current directory - affects how files are named
|
||||||
|
*/
|
||||||
|
protected $dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct($_dir = '')
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
if($_dir)
|
||||||
|
{
|
||||||
|
$this->dir = $_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,6 +88,7 @@ class filemanager_merge extends bo_merge
|
|||||||
$file['name'] = egw_vfs::basename($id);
|
$file['name'] = egw_vfs::basename($id);
|
||||||
$file['dir'] = egw_vfs::decodePath(egw_vfs::dirname($id));
|
$file['dir'] = egw_vfs::decodePath(egw_vfs::dirname($id));
|
||||||
$file['path'] = $id;
|
$file['path'] = $id;
|
||||||
|
$file['rel_path'] = str_replace($this->dir.'/', '', $id);
|
||||||
$file['hsize'] = egw_vfs::hsize($file['size']);
|
$file['hsize'] = egw_vfs::hsize($file['size']);
|
||||||
$file['mime'] = egw_vfs::mime_content_type($id);
|
$file['mime'] = egw_vfs::mime_content_type($id);
|
||||||
$file['gid'] *= -1; // our widgets use negative gid's
|
$file['gid'] *= -1; // our widgets use negative gid's
|
||||||
@ -92,17 +102,28 @@ class filemanager_merge extends bo_merge
|
|||||||
}
|
}
|
||||||
$extra = egw_vfs::getExtraInfo($id);
|
$extra = egw_vfs::getExtraInfo($id);
|
||||||
|
|
||||||
// Convert to human friendly values
|
// Custom fields
|
||||||
if($content && strpos($content, '#') !== 0)
|
if($content && strpos($content, '#') !== 0)
|
||||||
{
|
{
|
||||||
|
// Expand link-to custom fields
|
||||||
$this->cf_link_to_expand($file, $content, $info);
|
$this->cf_link_to_expand($file, $content, $info);
|
||||||
}
|
|
||||||
|
foreach(config::get_customfields('filemanager') as $name => $field)
|
||||||
|
{
|
||||||
|
// Set any missing custom fields, or the marker will stay
|
||||||
|
if(!$file['#'.$name])
|
||||||
|
{
|
||||||
|
$file['#'.$name] = '';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Set any missing custom fields, or the marker will stay
|
// Format date cfs per user preferences
|
||||||
foreach(config::get_customfields('filemanager') as $name => $field)
|
if($field['type'] == 'date' || $field['type'] == 'date-time')
|
||||||
{
|
{
|
||||||
if(!$file['#'.$name]) $file['#'.$name] = '';
|
$file['#'.$name] = egw_time::to($file['#'.$name]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
/* Not applicable to filemanager
|
/* Not applicable to filemanager
|
||||||
@ -114,6 +135,15 @@ class filemanager_merge extends bo_merge
|
|||||||
$file["links/{$app}"] = $this->get_links('filemanager',$id, $app);
|
$file["links/{$app}"] = $this->get_links('filemanager',$id, $app);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
$link = egw_link::mime_open($file['url'], $file['mime']);
|
||||||
|
// Prepend site
|
||||||
|
if ($link{0} == '/')
|
||||||
|
{
|
||||||
|
$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
|
||||||
|
($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
|
||||||
|
}
|
||||||
|
$file['link'] = html::a_href(html::htmlspecialchars($file['name']), $link);
|
||||||
|
$file['url'] = $link;
|
||||||
|
|
||||||
// Add markers
|
// Add markers
|
||||||
foreach($file as $key => &$value)
|
foreach($file as $key => &$value)
|
||||||
@ -140,8 +170,10 @@ class filemanager_merge extends bo_merge
|
|||||||
$n = 0;
|
$n = 0;
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'name' => 'name',
|
'name' => 'name',
|
||||||
'path' => 'path',
|
'path' => 'Absolute path',
|
||||||
|
'rel_path' => 'Path relative to current directory',
|
||||||
'url' => 'url',
|
'url' => 'url',
|
||||||
|
'link' => 'Clickable link to file',
|
||||||
'comment' => 'comment',
|
'comment' => 'comment',
|
||||||
'mtime' => 'modified',
|
'mtime' => 'modified',
|
||||||
'ctime' => 'created',
|
'ctime' => 'created',
|
||||||
|
@ -737,7 +737,7 @@ function force_download(_action, _senders)
|
|||||||
return $ret." egw_vfs::symlink('$to','$path')";
|
return $ret." egw_vfs::symlink('$to','$path')";
|
||||||
case 'document':
|
case 'document':
|
||||||
if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document'];
|
if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document'];
|
||||||
$document_merge = new filemanager_merge();
|
$document_merge = new filemanager_merge(egw_vfs::decodePath($dir));
|
||||||
$msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']);
|
$msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']);
|
||||||
$failed = count($selected);
|
$failed = count($selected);
|
||||||
return false;
|
return false;
|
||||||
@ -1244,12 +1244,8 @@ function force_download(_action, _senders)
|
|||||||
'align' => 'right',
|
'align' => 'right',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
echo 'HERE';
|
|
||||||
_debug_array($path);
|
|
||||||
_debug_array($content);
|
|
||||||
if (($extra_tabs = egw_vfs::getExtraInfo($path,$content)))
|
if (($extra_tabs = egw_vfs::getExtraInfo($path,$content)))
|
||||||
{
|
{
|
||||||
_debug_array($extra_tabs);
|
|
||||||
$tabs =& $tpl->get_widget_by_name('tabs=general|perms|eacl|preview|custom');
|
$tabs =& $tpl->get_widget_by_name('tabs=general|perms|eacl|preview|custom');
|
||||||
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
|
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user