mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
using mime-registry for link-widget "link-list" and "link-string" too
This commit is contained in:
parent
c3fd6f685f
commit
f467572bd4
@ -302,7 +302,7 @@ class link_widget
|
||||
if (!is_array($link['id']))
|
||||
{
|
||||
$value[$row]['view'] = egw_link::view($link['app'],$link['id'],$link);
|
||||
if (!($value[$row]['popup'] = egw_link::is_popup($link['app'],'view')) &&
|
||||
if (!($value[$row]['popup'] = egw_link::is_popup($link['app'],'view',$link)) &&
|
||||
etemplate::$request->output_mode == 2) // we are in a popup
|
||||
{
|
||||
$value[$row]['target'] = '_blank'; // we create a new window as the linked page is no popup
|
||||
@ -490,7 +490,7 @@ class link_widget
|
||||
*/
|
||||
static function link2a_href(array $link,$help='')
|
||||
{
|
||||
if (($popup = egw_link::is_popup($link['app'],'view')))
|
||||
if (($popup = egw_link::is_popup($link['app'], 'view', $link)))
|
||||
{
|
||||
list($w,$h) = explode('x',$popup);
|
||||
$options = ' onclick="window.open(this,this.target,\'width='.(int)$w.',height='.(int)$h.',location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false;"';
|
||||
@ -553,9 +553,9 @@ class link_widget
|
||||
// this may fail, if $extension_data['default'][0] is set on purpose
|
||||
foreach($extension_data['default'] as $k => $v)
|
||||
{
|
||||
if ($v)
|
||||
if ($v)
|
||||
{
|
||||
$defaultData=true;
|
||||
$defaultData=true;
|
||||
if ($k==0 && !empty($value_in['id'])) // we have a valid incomming id, we intend to use that
|
||||
{
|
||||
$defaultData=false;
|
||||
|
@ -877,7 +877,8 @@ class egw_link extends solink
|
||||
{
|
||||
if ($app == self::VFS_APPNAME && !empty($id) && is_array($link))
|
||||
{
|
||||
return egw_vfs::download_url(self::vfs_path($link['app2'],$link['id2'],$link['id'],true));
|
||||
//return egw_vfs::download_url(self::vfs_path($link['app2'],$link['id2'],$link['id'],true));
|
||||
return self::mime_open(self::vfs_path($link['app2'],$link['id2'],$link['id'],true), $link['type']);
|
||||
}
|
||||
if ($app == '' || !is_array($reg = self::$app_register[$app]) || !isset($reg['view']) || !isset($reg['view_id']))
|
||||
{
|
||||
@ -988,11 +989,24 @@ class egw_link extends solink
|
||||
*
|
||||
* @param string $app app-name
|
||||
* @param string $action='view' name of the action, atm. 'view' or 'add'
|
||||
* @param array $link=null link-data for file-attachments
|
||||
* @return boolean|string false if no popup is used or $app is not registered, otherwise string with the prefered popup size (eg. '640x400)
|
||||
*/
|
||||
static function is_popup($app,$action='view')
|
||||
static function is_popup($app, $action='view', $link=null)
|
||||
{
|
||||
return self::get_registry($app,$action.'_popup');
|
||||
$popup = self::get_registry($app,$action.'_popup');
|
||||
|
||||
// for files/attachments check mime-registry
|
||||
if ($app == self::VFS_APPNAME && is_array($link) && !empty($link['type']))
|
||||
{
|
||||
$path = self::vfs_path($link['app2'], $link['id2'], $link['id'], true);
|
||||
if (self::mime_open($path, $link['type'], $p))
|
||||
{
|
||||
$popup = $p;
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__."('$app', '$action', ".array2string($link).') returning '.array2string($popup));
|
||||
return $popup;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user