mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
Filemanager - Add some actions for merge-print shares into email templates
This commit is contained in:
parent
0538185b36
commit
87c4f0ff9c
@ -429,6 +429,57 @@ class Sharing extends \EGroupware\Api\Sharing
|
|||||||
Vfs::$is_root = false;
|
Vfs::$is_root = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get actions for sharing an entry from filemanager
|
||||||
|
*
|
||||||
|
* @param string $appname
|
||||||
|
* @param int $group Current menu group
|
||||||
|
*/
|
||||||
|
public static function get_actions($appname, $group = 6)
|
||||||
|
{
|
||||||
|
$actions = parent::get_actions('filemanager', $group);
|
||||||
|
|
||||||
|
// This one makes no sense for filemanager
|
||||||
|
unset($actions['share']['children']['shareFiles']);
|
||||||
|
|
||||||
|
// Move these around to mesh nicely if collabora is available
|
||||||
|
$actions['share']['children']['shareReadonlyLink']['group'] = 2;
|
||||||
|
$actions['share']['children']['shareReadonlyLink']['order'] = 22;
|
||||||
|
$actions['share']['children']['shareWritable']['group'] = 3;
|
||||||
|
|
||||||
|
// Add in merge to document
|
||||||
|
if (class_exists($appname.'_merge'))
|
||||||
|
{
|
||||||
|
$documents = call_user_func(array($appname.'_merge', 'document_action'),
|
||||||
|
$GLOBALS['egw_info']['user']['preferences'][$appname]['document_dir'],
|
||||||
|
2, 'Insert in document', 'shareDocument_'
|
||||||
|
);
|
||||||
|
$documents['order'] = 25;
|
||||||
|
|
||||||
|
// Mail only
|
||||||
|
if ($documents['children']['message/rfc822'])
|
||||||
|
{
|
||||||
|
// Just email already filtered out
|
||||||
|
$documents['children'] = $documents['children']['message/rfc822']['children'];
|
||||||
|
}
|
||||||
|
foreach($documents['children'] as $key => &$document)
|
||||||
|
{
|
||||||
|
if(strpos($document['target'],'compose_') === FALSE)
|
||||||
|
{
|
||||||
|
unset($documents['children'][$key]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$document['allowOnMultiple'] = true;
|
||||||
|
$document['onExecute'] = "javaScript:app.$appname.share_merge";
|
||||||
|
}
|
||||||
|
$documents['enabled'] = $documents['enabled'] && (boolean)$documents['children'] && !!($GLOBALS['egw_info']['user']['apps']['stylite']);
|
||||||
|
$actions['share']['children']['shareDocuments'] = $documents;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $actions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate link from share or share-token
|
* Generate link from share or share-token
|
||||||
*
|
*
|
||||||
|
@ -238,6 +238,11 @@ class filemanager_merge extends Api\Storage\Merge
|
|||||||
{
|
{
|
||||||
return $session;
|
return $session;
|
||||||
}
|
}
|
||||||
|
else if (($session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, "$app::$id")) &&
|
||||||
|
substr($session['share_path'], -strlen($path)) === $path)
|
||||||
|
{
|
||||||
|
return $session;
|
||||||
|
}
|
||||||
// Need to create the share here.
|
// Need to create the share here.
|
||||||
// No way to know here if it should be writable, or who it's going to
|
// No way to know here if it should be writable, or who it's going to
|
||||||
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
||||||
|
@ -176,29 +176,6 @@ class filemanager_ui
|
|||||||
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
||||||
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||||
),
|
),
|
||||||
'share' => array(
|
|
||||||
'caption' => lang('Share files'),
|
|
||||||
'icon' => 'filemanager/mail_post_to',
|
|
||||||
'group' => $group,
|
|
||||||
'children' => array(
|
|
||||||
'shareReadonlyLink' => array(
|
|
||||||
'caption' => lang('Readonly Share link'),
|
|
||||||
'group' => 1,
|
|
||||||
'icon' => 'share',
|
|
||||||
'allowOnMultiple' => false,
|
|
||||||
'order' => 11,
|
|
||||||
'onExecute' => 'javaScript:app.filemanager.share_link'
|
|
||||||
),
|
|
||||||
'shareWritableLink' => array(
|
|
||||||
'caption' => lang('Writable Share link'),
|
|
||||||
'group' => 1,
|
|
||||||
'icon' => 'share',
|
|
||||||
'allowOnMultiple' => false,
|
|
||||||
'enableClass' => 'isDir',
|
|
||||||
'order' => 11,
|
|
||||||
'onExecute' => 'javaScript:app.filemanager.share_link'
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
'saveas' => array(
|
'saveas' => array(
|
||||||
'caption' => lang('Save as'),
|
'caption' => lang('Save as'),
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
@ -238,6 +215,7 @@ class filemanager_ui
|
|||||||
'order' => 10,
|
'order' => 10,
|
||||||
'onExecute' => 'javaScript:app.filemanager.copy_link'
|
'onExecute' => 'javaScript:app.filemanager.copy_link'
|
||||||
),
|
),
|
||||||
|
'share' => EGroupware\Api\Vfs\Sharing::get_actions('filemanager', ++$group)['share'],
|
||||||
'documents' => filemanager_merge::document_action(
|
'documents' => filemanager_merge::document_action(
|
||||||
$GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir'],
|
$GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir'],
|
||||||
++$group, 'Insert in document', 'document_',
|
++$group, 'Insert in document', 'document_',
|
||||||
@ -287,17 +265,26 @@ class filemanager_ui
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (isset($GLOBALS['egw_info']['user']['apps']['mail'])) {
|
if (isset($GLOBALS['egw_info']['user']['apps']['mail'])) {
|
||||||
|
$actions['share']['children']['share_mail'] = array(
|
||||||
|
'caption' => lang('Mail'),
|
||||||
|
'icon' => 'mail',
|
||||||
|
'group' => 1,
|
||||||
|
'order' => 0,
|
||||||
|
'allowOnMultiple' => false,
|
||||||
|
);
|
||||||
foreach(Vfs\Sharing::$modes as $mode => $data)
|
foreach(Vfs\Sharing::$modes as $mode => $data)
|
||||||
{
|
{
|
||||||
$actions['share']['children']['mail_'.$mode] = array(
|
$actions['share']['children']['share_mail']['children']['mail_'.$mode] = array(
|
||||||
'caption' => $data['label'],
|
'caption' => $data['label'],
|
||||||
'hint' => $data['title'],
|
'hint' => $data['title'],
|
||||||
|
'icon' => $mode == Vfs\Sharing::ATTACH ?
|
||||||
|
'mail/attach' : 'api/link',
|
||||||
'group' => 2,
|
'group' => 2,
|
||||||
'onExecute' => 'javaScript:app.filemanager.mail',
|
'onExecute' => 'javaScript:app.filemanager.mail',
|
||||||
);
|
);
|
||||||
if ($mode == Vfs\Sharing::ATTACH || $mode == Vfs\Sharing::LINK)
|
if ($mode == Vfs\Sharing::ATTACH || $mode == Vfs\Sharing::LINK)
|
||||||
{
|
{
|
||||||
$actions['share']['children']['mail_'.$mode]['disableClass'] = 'isDir';
|
$actions['share']['children']['share_mail']['children']['mail_'.$mode]['disableClass'] = 'isDir';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,19 +1174,6 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* create a share-link for the given file or directory
|
|
||||||
* @param {object} _action egw actions
|
|
||||||
* @param {object} _senders selected nm row
|
|
||||||
* @returns {Boolean} returns false if not successful
|
|
||||||
*/
|
|
||||||
share_link: function(_action, _senders){
|
|
||||||
var path = this.id2path(_senders[0].id);
|
|
||||||
egw.json('filemanager_ui::ajax_action', [_action.id, path],
|
|
||||||
this._share_link_callback, this, true, this).sendRequest();
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share-link callback
|
* Share-link callback
|
||||||
* @param {object} _data
|
* @param {object} _data
|
||||||
|
Loading…
Reference in New Issue
Block a user