mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
* Filemanager: added user-interface to mount WebDAV or SMB shares
This commit is contained in:
parent
7d08ac4936
commit
d596f76d43
@ -83,9 +83,14 @@ class Base
|
||||
*/
|
||||
static function mount($url = null, $path = null, $check_url = null, $persistent_mount = true, $clear_fstab = false)
|
||||
{
|
||||
if(is_null($check_url))
|
||||
if ($check_url === true || !isset($check_url) && strpos($url, '$') === false)
|
||||
{
|
||||
$check_url = strpos($url, '$') === false;
|
||||
$check_url = strtr($url, [
|
||||
'user' => $GLOBALS['egw_info']['user']['account_lid'],
|
||||
'pass' => urlencode($GLOBALS['egw_info']['user']['passwd']),
|
||||
'host' => $GLOBALS['egw_info']['user']['domain'],
|
||||
'home' => str_replace(array('\\\\', '\\'), array('', '/'), $GLOBALS['egw_info']['user']['homedirectory']),
|
||||
]);
|
||||
}
|
||||
|
||||
if(!isset($GLOBALS['egw_info']['server']['vfs_fstab'])) // happens eg. in setup
|
||||
@ -134,7 +139,7 @@ class Base
|
||||
}
|
||||
self::load_wrapper(Vfs::parse_url($url, PHP_URL_SCHEME));
|
||||
|
||||
if($check_url && (!file_exists($url) || opendir($url) === false))
|
||||
if ($check_url && (!file_exists($check_url) || opendir($check_url) === false))
|
||||
{
|
||||
if(self::LOG_LEVEL > 0)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class filemanager_admin extends filemanager_ui
|
||||
);
|
||||
|
||||
/**
|
||||
* Autheticated user is setup config user
|
||||
* Authenticated user is setup config user
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
@ -82,11 +82,11 @@ class filemanager_admin extends filemanager_ui
|
||||
{
|
||||
if (is_array($content))
|
||||
{
|
||||
//_debug_array($content);
|
||||
try
|
||||
{
|
||||
if ($content['sudo'])
|
||||
{
|
||||
$msg = $this->sudo($content['user'],$content['password'],self::$is_setup) ?
|
||||
lang('Root access granted.') : lang('Wrong username or password!');
|
||||
$this->sudo($content['user'], $content['password'], $msg, true, self::$is_setup);
|
||||
$msg_type = Vfs::$is_root ? 'success' : 'error';
|
||||
}
|
||||
elseif ($content['etemplates'] && $GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
@ -106,12 +106,12 @@ class filemanager_admin extends filemanager_ui
|
||||
{
|
||||
if ($content['logout'])
|
||||
{
|
||||
$msg = $this->sudo('','',self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.');
|
||||
$msg_type = !Vfs::$is_root ? 'success' : 'error';
|
||||
$this->sudo('', '', $msg);
|
||||
$msg_type = 'success';
|
||||
}
|
||||
if ($content['mounts']['disable'] || self::$is_setup && $content['mounts']['umount'])
|
||||
if ($content['mounts']['disable'] || Vfs::$is_root && $content['mounts']['umount'])
|
||||
{
|
||||
if (($unmount = $content['mounts']['umount']))
|
||||
if (!empty($content['mounts']['umount']))
|
||||
{
|
||||
$path = @key($content['mounts']['umount']);
|
||||
}
|
||||
@ -119,6 +119,14 @@ class filemanager_admin extends filemanager_ui
|
||||
{
|
||||
$path = @key($content['mounts']['disable']);
|
||||
}
|
||||
// set umounted url for a (changed) remount
|
||||
$mounts = Vfs::mount();
|
||||
$content['mounts']['path'] = $path;
|
||||
$content['mounts']['url'] = Vfs::parse_url($mounts[$path]);
|
||||
if (!empty($content['mounts']['url']['query']))
|
||||
{
|
||||
$content['mounts']['url']['path'] .= '?'.$content['mounts']['url']['query'];
|
||||
}
|
||||
if (!in_array($path, self::$protected_path) && $path != '/')
|
||||
{
|
||||
$msg = Vfs::umount($path) ?
|
||||
@ -131,30 +139,52 @@ class filemanager_admin extends filemanager_ui
|
||||
}
|
||||
}
|
||||
if (($path = $content['mounts']['path']) &&
|
||||
($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount']))
|
||||
($content['mounts']['enable'] || Vfs::$is_root && $content['mounts']['mount']))
|
||||
{
|
||||
$url = str_replace('$path',$path,$content['mounts']['url']);
|
||||
if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path;
|
||||
if (empty($content['mounts']['url']['path']) && $this->versioning)
|
||||
{
|
||||
$content['mounts']['url'] = [
|
||||
'scheme' => Versioning\StreamWrapper::SCHEME,
|
||||
'path' => $path,
|
||||
];
|
||||
}
|
||||
if (empty($content['mounts']['url']['scheme']) || $content['mounts']['url']['scheme'] === 'filesystem' && !self::$is_setup)
|
||||
{
|
||||
throw new Api\Exception\NoPermission();
|
||||
}
|
||||
$url = $content['mounts']['url']['scheme'] . '://';
|
||||
if (in_array($content['mounts']['url']['scheme'], ['smb', 'webdavs', 'vfs']))
|
||||
{
|
||||
if (empty(trim($content['mounts']['url']['user'])))
|
||||
{
|
||||
throw new Api\Exception\WrongUserinput(lang('SMB, WebDAVs and VFS require a username!'));
|
||||
}
|
||||
$url .= $content['mounts']['url']['user'] === '$user' ? '$user' : urlencode(trim($content['mounts']['url']['user']));
|
||||
if (!empty($content['mounts']['url']['pass']))
|
||||
{
|
||||
$url .= ':' . ($content['mounts']['url']['pass'] === '$pass' ? '$pass' : urlencode(trim($content['mounts']['url']['pass'])));
|
||||
}
|
||||
$url .= '@';
|
||||
}
|
||||
$url .= $content['mounts']['url']['host'] ?: 'default';
|
||||
$url .= $content['mounts']['url']['path'] ?: $path;
|
||||
|
||||
if ($content['mounts']['enable'] && !$this->versioning)
|
||||
if (($content['mounts']['enable'] || substr($content['mounts']['url']['scheme'], 0, 8) === 'stylite.') && !$this->versioning)
|
||||
{
|
||||
$msg = lang('Versioning requires <a href="http://www.egroupware.org/products">Stylite EGroupware Enterprise Line (EPL)</a>!');
|
||||
$msg_type = 'info';
|
||||
throw new Api\Exception\WrongUserinput(lang('Versioning requires EGroupware EPL'));
|
||||
}
|
||||
elseif (!Vfs::file_exists($path) || !Vfs::is_dir($path))
|
||||
elseif (!Vfs::file_exists(Vfs::decodePath($path)) || Vfs::file_exists($path) && !Vfs::is_dir($path))
|
||||
{
|
||||
$msg = lang('Path %1 not found or not a directory!',$path);
|
||||
$msg_type = 'error';
|
||||
throw new Api\Exception\WrongUserinput(lang('Path %1 not found or not a directory!', $path));
|
||||
}
|
||||
// dont allow to change mount of /apps or /templates (eg. switching on versioning)
|
||||
// don't allow changing mount of /apps or /templates (eg. switching on versioning)
|
||||
elseif (in_array($path, self::$protected_path))
|
||||
{
|
||||
$msg = lang('Permission denied!');
|
||||
$msg_type = 'error';
|
||||
throw new Api\Exception\NoPermission();
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = Vfs::mount($url,$path) ?
|
||||
$msg = Vfs::mount($url, $path, true) ?
|
||||
lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path);
|
||||
}
|
||||
}
|
||||
@ -202,8 +232,7 @@ class filemanager_admin extends filemanager_ui
|
||||
'path_preg' => '#/\.(attic|versions)/#',
|
||||
) + (!(int)$content['mtime'] ? array() : array(
|
||||
'mtime' => ($content['mtime'] < 0 ? '-' : '+') . (int)$content['mtime'],
|
||||
)), function($path) use (&$deleted, &$errors)
|
||||
{
|
||||
)), function ($path) use (&$deleted, &$errors) {
|
||||
if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) ||
|
||||
!$is_dir && Vfs::unlink($path))
|
||||
{
|
||||
@ -224,16 +253,22 @@ class filemanager_admin extends filemanager_ui
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$msg = $e->getMessage();
|
||||
$msg_type = 'error';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// defaults for deleting of older versions
|
||||
$content['versionedpath'] = '/';
|
||||
$content['mtime'] = 100;
|
||||
}
|
||||
if (true) $content = array(
|
||||
$content = [
|
||||
'versionedpath' => $content['versionedpath'],
|
||||
'mtime' => $content['mtime'],
|
||||
);
|
||||
'mounts' => $content['mounts'],
|
||||
];
|
||||
if ($this->versioning)
|
||||
{
|
||||
// statistical information
|
||||
@ -256,12 +291,12 @@ class filemanager_admin extends filemanager_ui
|
||||
Framework::message($msg, $msg_type);
|
||||
|
||||
$n = 2;
|
||||
$content['mounts'] = array();
|
||||
$content['mounts']['at'] = '@';
|
||||
foreach(Vfs::mount() as $path => $url)
|
||||
{
|
||||
$content['mounts'][$n++] = array(
|
||||
'path' => $path,
|
||||
'url' => preg_replace('#://([^:@/]+):([^@/]+)@#', '://$1:****@', $url),
|
||||
'url' => preg_replace('#://([^:@/]+):((?!\$pass)[^@/]+)@#', '://$1:****@', $url),
|
||||
);
|
||||
$readonlys["disable[$path]"] = !$this->versioning || !Vfs::$is_root ||
|
||||
Vfs::parse_url($url,PHP_URL_SCHEME) != $this->versioning;
|
||||
@ -274,6 +309,23 @@ class filemanager_admin extends filemanager_ui
|
||||
'admins' => lang('Administrators'),
|
||||
'everyone' => lang('Everyone'),
|
||||
);
|
||||
$sel_options['scheme'] = [
|
||||
"webdavs" => "WebDAVs",
|
||||
"smb" => "SMB",
|
||||
"filesystem" => "Filesystem",
|
||||
"sqlfs" => "SQLfs",
|
||||
"links" => "Links",
|
||||
"stylite.versioning" => "Versioning",
|
||||
"stylite.links" => "Links+Versioning",
|
||||
"vfs" => "VFS",
|
||||
];
|
||||
foreach($sel_options['scheme'] as $scheme => $label)
|
||||
{
|
||||
if (!Vfs::load_wrapper($scheme) || !self::$is_setup && $scheme === 'filesystem')
|
||||
{
|
||||
unset($sel_options['scheme'][$scheme]);
|
||||
}
|
||||
}
|
||||
// show [Mount /etemplates] button for admin, if not already mounted and available
|
||||
$readonlys['etemplates'] = !class_exists('\EGroupware\Stylite\Vfs\Merge\StreamWrapper') ||
|
||||
($fs_tab=Vfs::mount($url)) && isset($fs_tab['/etemplates']) ||
|
||||
|
@ -444,31 +444,48 @@ class filemanager_ui
|
||||
/**
|
||||
* Make the current user (vfs) root
|
||||
*
|
||||
* The user/pw is either the setup config user or a specially configured vfs_root user
|
||||
* The user/pw is either the "root_" prefixed setup config user or a specially configured vfs_root user
|
||||
*
|
||||
* @param string $user setup config user to become root or '' to log off as root
|
||||
* @param string $password setup config password to become root
|
||||
* @param string &$msg on return error or success message
|
||||
* @param bool $allow_setup =false true: allow "root_" prefixed setup-config user/pw
|
||||
* @param boolean &$is_setup=null on return true if authenticated user is setup config user, false otherwise
|
||||
* @return boolean true is root user given, false otherwise (including logout / empty $user)
|
||||
*/
|
||||
protected function sudo($user='',$password=null,&$is_setup=null)
|
||||
{
|
||||
if (!$user)
|
||||
protected function sudo($user='', $password='', string &$msg=null, bool $allow_setup=false, &$is_setup=null)
|
||||
{
|
||||
$is_root = $is_setup = false;
|
||||
$msg = null;
|
||||
|
||||
if (!$user)
|
||||
{
|
||||
$msg = lang('Root access stopped.');
|
||||
}
|
||||
// config user & password
|
||||
elseif ($allow_setup && substr($user, 0, 5) === 'root_')
|
||||
{
|
||||
if (!($msg = setup::checkip()))
|
||||
{
|
||||
$is_root = $is_setup = setup::check_auth(substr($user, 5), $password, $GLOBALS['egw_info']['server']['config_user'],
|
||||
$GLOBALS['egw_info']['server']['config_passwd']);
|
||||
}
|
||||
}
|
||||
// or vfs root user from setup >> configuration
|
||||
else
|
||||
{
|
||||
// config user & password
|
||||
$is_setup = Api\Session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash'];
|
||||
// or vfs root user from setup >> configuration
|
||||
$is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] &&
|
||||
$is_root = $GLOBALS['egw_info']['server']['vfs_root_user'] &&
|
||||
in_array($user,preg_split('/, */',$GLOBALS['egw_info']['server']['vfs_root_user'])) &&
|
||||
$GLOBALS['egw']->auth->authenticate($user, $password, 'text');
|
||||
}
|
||||
//error_log(__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".Api\Session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root));
|
||||
if (empty($msg))
|
||||
{
|
||||
$msg = $is_root ? lang('Root access granted.') : lang('Wrong username or password!');
|
||||
}
|
||||
//error_log(__METHOD__."('$user', '$password', $is_setup, '$msg') --> returning ".array2string($is_root));
|
||||
Api\Cache::setSession('filemanager', 'is_setup',$is_setup);
|
||||
Api\Cache::setSession('filemanager', 'is_root',Vfs::$is_root = $is_root);
|
||||
|
||||
return Vfs::$is_root;
|
||||
}
|
||||
|
||||
@ -1187,9 +1204,7 @@ class filemanager_ui
|
||||
// need to check 'setup' button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field
|
||||
if ($button == 'sudo' && Vfs::$is_root || $button == 'setup' && $content['sudo']['user'])
|
||||
{
|
||||
$msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '',$content['sudo']['passwd']) ?
|
||||
lang('Root access granted.') : ($button == 'setup' && $content['sudo']['user'] ?
|
||||
lang('Wrong username or password!') : lang('Root access stopped.'));
|
||||
$this->sudo($button === 'setup' ? $content['sudo']['user'] : '', $content['sudo']['passwd'], $msg);
|
||||
unset($content['sudo']);
|
||||
$content['is_owner'] = Vfs::has_owner_rights($path);
|
||||
}
|
||||
|
@ -27,6 +27,14 @@ exports.filemanagerAPP = void 0;
|
||||
/api/js/jsapi/egw_app.js;
|
||||
*/
|
||||
var egw_app_1 = require("../../api/js/jsapi/egw_app");
|
||||
var etemplate2_1 = require("../../api/js/etemplate/etemplate2");
|
||||
var et2_widget_dialog_1 = require("../../api/js/etemplate/et2_widget_dialog");
|
||||
var et2_widget_file_1 = require("../../api/js/etemplate/et2_widget_file");
|
||||
var et2_widget_button_1 = require("../../api/js/etemplate/et2_widget_button");
|
||||
var et2_extension_nextmatch_controller_1 = require("../../api/js/etemplate/et2_extension_nextmatch_controller");
|
||||
var egw_global_1 = require("../../api/js/jsapi/egw_global");
|
||||
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
|
||||
var et2_widget_textbox_1 = require("../../api/js/etemplate/et2_widget_textbox");
|
||||
/**
|
||||
* UI for filemanager
|
||||
*/
|
||||
@ -55,7 +63,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
_this.remove_prefix = /^filemanager::/;
|
||||
// Loading filemanager in its tab and home causes us problems with
|
||||
// unwanted destruction, so we check for already existing path widgets
|
||||
var lists = etemplate2.getByApplication('home');
|
||||
var lists = etemplate2_1.etemplate2.getByApplication('home');
|
||||
for (var i = 0; i < lists.length; i++) {
|
||||
if (lists[i].app == 'filemanager' && lists[i].widgetContainer.getWidgetById('path')) {
|
||||
_this.path_widget[lists[i].uniqueId] = lists[i].widgetContainer.getWidgetById('path');
|
||||
@ -82,6 +90,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
filemanagerAPP.prototype.et2_ready = function (et2, name) {
|
||||
// call parent
|
||||
_super.prototype.et2_ready.call(this, et2, name);
|
||||
if (name === 'filemanager.admin') {
|
||||
this.changeMountScheme();
|
||||
return;
|
||||
}
|
||||
var path_widget = this.et2.getWidgetById('path');
|
||||
if (path_widget) // do NOT set not found path-widgets, as uploads works on first one only!
|
||||
{
|
||||
@ -108,7 +120,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
delete this.readonly;
|
||||
}
|
||||
if (name == 'filemanager.index') {
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var fe = egw_global_1.egw.link_get_registry('filemanager-editor');
|
||||
var new_widget = this.et2.getWidgetById('new');
|
||||
if (fe && fe["edit"]) {
|
||||
var new_options = this.et2.getArrayMgr('sel_options').getEntry('new');
|
||||
@ -141,7 +153,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
// This has to happen after the parent, changing to tile recreates
|
||||
// nm controller
|
||||
if (typeof state == "object" && state.state && state.state.view) {
|
||||
var et2 = etemplate2.getById('filemanager-index');
|
||||
var et2 = etemplate2_1.etemplate2.getById('filemanager-index');
|
||||
if (et2) {
|
||||
this.et2 = et2.widgetContainer;
|
||||
this.change_view(state.state.view);
|
||||
@ -158,7 +170,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.getState = function () {
|
||||
var state = _super.prototype.getState.call(this);
|
||||
var et2 = etemplate2.getById('filemanager-index');
|
||||
var et2 = etemplate2_1.etemplate2.getById('filemanager-index');
|
||||
if (et2) {
|
||||
var nm = et2.widgetContainer.getWidgetById('nm');
|
||||
state.view = nm.view;
|
||||
@ -229,7 +241,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
content.data.files["filemode"] = params['preset[filemode]'];
|
||||
// always open compose in html mode, as attachment links look a lot nicer in html
|
||||
params["mimeType"] = 'html';
|
||||
return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/, true);
|
||||
return egw_global_1.egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/, true);
|
||||
};
|
||||
/**
|
||||
* Mail files action: open compose with already attached files
|
||||
@ -278,7 +290,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
mail_htmltext: ['<br /><a href="' + _data.share_link + '">' + _data.title + '</a>'],
|
||||
mail_plaintext: ["\n" + _data.share_link]
|
||||
};
|
||||
return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/);
|
||||
return egw_global_1.egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/);
|
||||
};
|
||||
/**
|
||||
* Trigger Upload after each file is uploaded
|
||||
@ -306,7 +318,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
var widget = _event.data;
|
||||
var value = widget.getValue();
|
||||
value.conflict = _conflict;
|
||||
egw.json(_target, ['upload', value, _path, { ui_path: this.egw.window.location.pathname }], this._upload_callback, this, true, this).sendRequest();
|
||||
egw_global_1.egw.json(_target, ['upload', value, _path, { ui_path: this.egw.window.location.pathname }], this._upload_callback, this, true, this).sendRequest();
|
||||
widget.set_value('');
|
||||
}
|
||||
};
|
||||
@ -325,7 +337,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
path = "/apps/" + link.app + "/" + link.id;
|
||||
}
|
||||
var props = widget.getInstanceManager().getValues(widget.getRoot());
|
||||
egw.json('filemanager_ui::ajax_action', [action == 'save_as' ? 'upload' : 'link', widget.getValue(), path, props], function (_data) {
|
||||
egw_global_1.egw.json('filemanager_ui::ajax_action', [action == 'save_as' ? 'upload' : 'link', widget.getValue(), path, props], function (_data) {
|
||||
app.filemanager._upload_callback(_data);
|
||||
// Remove successful after a delay
|
||||
for (var file in _data.uploaded) {
|
||||
@ -364,7 +376,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
];
|
||||
if (_data.uploaded[file].confirm === "is_dir")
|
||||
buttons.shift();
|
||||
var dialog = et2_dialog.show_prompt(function (_button_id, _value) {
|
||||
var dialog = et2_widget_dialog_1.et2_dialog.show_prompt(function (_button_id, _value) {
|
||||
var uploaded = {};
|
||||
uploaded[this.my_data.file] = this.my_data.data;
|
||||
switch (_button_id) {
|
||||
@ -375,13 +387,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
uploaded[this.my_data.file].name = _value;
|
||||
delete uploaded[this.my_data.file].confirm;
|
||||
// send overwrite-confirmation and/or rename request to server
|
||||
egw.json('filemanager_ui::ajax_action', [this.my_data.action, uploaded, this.my_data.path, this.my_data.props], that._upload_callback, that, true, that).sendRequest();
|
||||
egw_global_1.egw.json('filemanager_ui::ajax_action', [this.my_data.action, uploaded, this.my_data.path, this.my_data.props], that._upload_callback, that, true, that).sendRequest();
|
||||
return;
|
||||
case "cancel":
|
||||
// Remove that file from every file widget...
|
||||
that.et2.iterateOver(function (_widget) {
|
||||
_widget.remove_file(this.my_data.data.name);
|
||||
}, this, et2_file);
|
||||
}, this, et2_widget_file_1.et2_file);
|
||||
}
|
||||
}, _data.uploaded[file].confirm === "is_dir" ?
|
||||
this.egw.lang("There's already a directory with that name!") :
|
||||
@ -404,8 +416,8 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.get_clipboard_files = function () {
|
||||
var clipboard_files = [];
|
||||
if (typeof window.localStorage != 'undefined' && typeof egw.getSessionItem('phpgwapi', 'egw_clipboard') != 'undefined') {
|
||||
var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || {
|
||||
if (typeof window.localStorage != 'undefined' && typeof egw_global_1.egw.getSessionItem('phpgwapi', 'egw_clipboard') != 'undefined') {
|
||||
var clipboard = JSON.parse(egw_global_1.egw.getSessionItem('phpgwapi', 'egw_clipboard')) || {
|
||||
type: [],
|
||||
selected: []
|
||||
};
|
||||
@ -439,7 +451,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.clipboard = function (_action, _elems) {
|
||||
this.clipboard_is_cut = _action.id == "cut";
|
||||
var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || {
|
||||
var clipboard = JSON.parse(egw_global_1.egw.getSessionItem('phpgwapi', 'egw_clipboard')) || {
|
||||
type: [],
|
||||
selected: []
|
||||
};
|
||||
@ -464,7 +476,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
clipboard.selected.push({ id: _elems[k].id, data: _elems[k].data });
|
||||
}
|
||||
// Save it in session
|
||||
egw.setSessionItem('phpgwapi', 'egw_clipboard', JSON.stringify(clipboard));
|
||||
egw_global_1.egw.setSessionItem('phpgwapi', 'egw_clipboard', JSON.stringify(clipboard));
|
||||
this.clipboard_tooltips();
|
||||
};
|
||||
/**
|
||||
@ -514,7 +526,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.createdir = function (action, selected) {
|
||||
var self = this;
|
||||
et2_dialog.show_prompt(function (button, dir) {
|
||||
et2_widget_dialog_1.et2_dialog.show_prompt(function (button, dir) {
|
||||
if (button && dir) {
|
||||
var path = self.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false);
|
||||
if (action && action instanceof egwAction) {
|
||||
@ -523,14 +535,14 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
path = paths[0];
|
||||
// check if target is a file --> use it's directory instead
|
||||
if (selected[0].id || path) {
|
||||
var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::' + path);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(selected[0].id || 'filemanager::' + path);
|
||||
if (data && data.data.mime != 'httpd/unix-directory') {
|
||||
path = self.dirname(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
self._do_action('createdir', egw.encodePathComponent(dir), true, path); // true=synchronous request
|
||||
self.change_dir((path == '/' ? '' : path) + '/' + egw.encodePathComponent(dir));
|
||||
self._do_action('createdir', egw_global_1.egw.encodePathComponent(dir), true, path); // true=synchronous request
|
||||
self.change_dir((path == '/' ? '' : path) + '/' + egw_global_1.egw.encodePathComponent(dir));
|
||||
}
|
||||
}, this.egw.lang('New directory'), this.egw.lang('Create directory'));
|
||||
};
|
||||
@ -539,7 +551,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.symlink = function () {
|
||||
var self = this;
|
||||
et2_dialog.show_prompt(function (button, target) {
|
||||
et2_widget_dialog_1.et2_dialog.show_prompt(function (button, target) {
|
||||
if (button && target) {
|
||||
self._do_action('symlink', target);
|
||||
}
|
||||
@ -556,7 +568,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
filemanagerAPP.prototype._do_action = function (_type, _selected, _sync, _path) {
|
||||
if (typeof _path == 'undefined')
|
||||
_path = this.get_path();
|
||||
egw.json('filemanager_ui::ajax_action', [_type, _selected, _path], this._do_action_callback, this, !_sync, this).sendRequest();
|
||||
egw_global_1.egw.json('filemanager_ui::ajax_action', [_type, _selected, _path], this._do_action_callback, this, !_sync, this).sendRequest();
|
||||
};
|
||||
/**
|
||||
* Callback for _do_action ajax call
|
||||
@ -574,10 +586,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.force_download = function (_action, _senders) {
|
||||
for (var i = 0; i < _senders.length; i++) {
|
||||
var data = egw.dataGetUIDdata(_senders[i].id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_senders[i].id);
|
||||
var url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[i].id);
|
||||
if (url[0] == '/')
|
||||
url = egw.link(url);
|
||||
url = egw_global_1.egw.link(url);
|
||||
var a = document.createElement('a');
|
||||
if (typeof a.download == "undefined") {
|
||||
window.location = (url + "?download");
|
||||
@ -644,33 +656,33 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @param {et2_widget} [button_widget] - The widget that's calling
|
||||
*/
|
||||
filemanagerAPP.prototype.change_view = function (view, button_widget) {
|
||||
var et2 = etemplate2.getById('filemanager-index');
|
||||
var et2 = etemplate2_1.etemplate2.getById('filemanager-index');
|
||||
var nm;
|
||||
if (et2 && et2.widgetContainer.getWidgetById('nm')) {
|
||||
nm = et2.widgetContainer.getWidgetById('nm');
|
||||
}
|
||||
if (!nm) {
|
||||
egw.debug('warn', 'Could not find nextmatch to change view');
|
||||
egw_global_1.egw.debug('warn', 'Could not find nextmatch to change view');
|
||||
return;
|
||||
}
|
||||
if (!button_widget) {
|
||||
button_widget = nm.getWidgetById('button[change_view]');
|
||||
}
|
||||
if (button_widget && button_widget.instanceOf(et2_button)) {
|
||||
if (button_widget && button_widget.instanceOf(et2_widget_button_1.et2_button)) {
|
||||
// Switch view based on button icon, since controller can get re-created
|
||||
if (typeof view != 'string') {
|
||||
view = button_widget.options.image.replace('list_', '');
|
||||
}
|
||||
// Toggle button icon to the other view
|
||||
//todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master
|
||||
button_widget.set_image("list_" + (view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW));
|
||||
button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
button_widget.set_image("list_" + (view == et2_extension_nextmatch_controller_1.et2_nextmatch_controller.VIEW_ROW ? et2_extension_nextmatch_controller_1.et2_nextmatch_controller.VIEW_TILE : et2_extension_nextmatch_controller_1.et2_nextmatch_controller.VIEW_ROW));
|
||||
button_widget.set_statustext(view == et2_extension_nextmatch_controller_1.et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
}
|
||||
nm.set_view(view);
|
||||
// Put it into active filters (but don't refresh)
|
||||
nm.activeFilters["view"] = view;
|
||||
// Change template to match
|
||||
var template = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
var template = view == et2_extension_nextmatch_controller_1.et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
nm.set_template(template);
|
||||
// Wait for template to load, then refresh
|
||||
template = nm.getWidgetById(template);
|
||||
@ -687,13 +699,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @param _senders
|
||||
*/
|
||||
filemanagerAPP.prototype.open = function (_action, _senders) {
|
||||
var data = egw.dataGetUIDdata(_senders[0].id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_senders[0].id);
|
||||
var path = this.id2path(_senders[0].id);
|
||||
this.et2 = this.et2 ? this.et2 : etemplate2.getById('filemanager-index').widgetContainer;
|
||||
this.et2 = this.et2 ? this.et2 : etemplate2_1.etemplate2.getById('filemanager-index').widgetContainer;
|
||||
var mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||
// try to get mime widget DOM node out of the row DOM
|
||||
var mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row");
|
||||
var fe = egw_get_file_editor_prefered_mimes();
|
||||
var fe = egw_global_1.egw_get_file_editor_prefered_mimes();
|
||||
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
||||
if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1) {
|
||||
this.change_dir(path, _action.parent.data.nextmatch || this.et2);
|
||||
@ -702,7 +714,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
mime_dom.click();
|
||||
}
|
||||
else if (mime && this.isEditable(_action, _senders) && fe && fe.edit) {
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
egw_global_1.egw.open_link(egw_global_1.egw.link('/index.php', {
|
||||
menuaction: fe.edit.menuaction,
|
||||
path: decodeURIComponent(data.data.download_url)
|
||||
}), '', fe.edit_popup);
|
||||
@ -711,10 +723,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
var url = void 0;
|
||||
// Build ViewerJS url
|
||||
if (data.data.mime.match(/application\/vnd\.oasis\.opendocument/) &&
|
||||
egw.preference('document_doubleclick_action', 'filemanager') == 'collabeditor') {
|
||||
egw_global_1.egw.preference('document_doubleclick_action', 'filemanager') == 'collabeditor') {
|
||||
url = '/ViewerJS/#..' + data.data.download_url;
|
||||
}
|
||||
egw.open({ path: path, type: data.data.mime, download_url: url }, 'file', 'view', null, '_browser');
|
||||
egw_global_1.egw.open({ path: path, type: data.data.mime, download_url: url }, 'file', 'view', null, '_browser');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@ -726,7 +738,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.editprefs = function (_action, _senders) {
|
||||
var path = typeof _senders != 'undefined' ? this.id2path(_senders[0].id) : this.get_path(_action && _action.parent.data.nextmatch.getInstanceManager().uniqueId || false);
|
||||
egw().open_link(egw.link('/index.php', {
|
||||
egw_global_1.egw().open_link(egw_global_1.egw.link('/index.php', {
|
||||
menuaction: 'filemanager.filemanager_ui.file',
|
||||
path: path
|
||||
}), 'fileprefs', '510x425');
|
||||
@ -757,8 +769,8 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
var actions = [];
|
||||
// Current directory
|
||||
var current_dir = this.get_path();
|
||||
var dir = egw.dataGetUIDdata('filemanager::' + current_dir);
|
||||
var path_widget = etemplate2.getById('filemanager-index').widgetContainer.getWidgetById('button[createdir]');
|
||||
var dir = egw_global_1.egw.dataGetUIDdata('filemanager::' + current_dir);
|
||||
var path_widget = etemplate2_1.etemplate2.getById('filemanager-index').widgetContainer.getWidgetById('button[createdir]');
|
||||
actions.push({
|
||||
id: _action.id + '_current', caption: current_dir, path: current_dir,
|
||||
enabled: dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 ||
|
||||
@ -766,7 +778,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
});
|
||||
// Target, if directory
|
||||
var target_dir = this.id2path(_target.id);
|
||||
dir = egw.dataGetUIDdata(_target.id);
|
||||
dir = egw_global_1.egw.dataGetUIDdata(_target.id);
|
||||
actions.push({
|
||||
id: _action.id + '_target',
|
||||
caption: target_dir,
|
||||
@ -775,7 +787,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
(dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 || !dir)
|
||||
});
|
||||
// Last 10 folders
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
var previous_dsts = jQuery.extend([], egw_global_1.egw.preference('drop_history', this.appname));
|
||||
var action_index = 0;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var path = i < previous_dsts.length ? previous_dsts[i] : '';
|
||||
@ -799,13 +811,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
// This injects the clipboard data and calls the original handler
|
||||
var paste_exec = function (action, selected) {
|
||||
// Add in clipboard as a sender
|
||||
var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard'));
|
||||
var clipboard = JSON.parse(egw_global_1.egw.getSessionItem('phpgwapi', 'egw_clipboard'));
|
||||
// Set a flag so apps can tell the difference, if they need to
|
||||
action.set_onExecute(action.parent.onExecute.fnct);
|
||||
action.execute(clipboard.selected, selected[0]);
|
||||
// Clear the clipboard, the files are not there anymore
|
||||
if (action.id.indexOf('move') !== -1) {
|
||||
egw.setSessionItem('phpgwapi', 'egw_clipboard', JSON.stringify({
|
||||
egw_global_1.egw.setSessionItem('phpgwapi', 'egw_clipboard', JSON.stringify({
|
||||
type: [],
|
||||
selected: []
|
||||
}));
|
||||
@ -850,17 +862,17 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
dst = paths[0];
|
||||
// check if target is a file --> use it's directory instead
|
||||
if (_target.id) {
|
||||
var data = egw.dataGetUIDdata(_target.id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_target.id);
|
||||
if (!data || data.data.mime != 'httpd/unix-directory') {
|
||||
dst = this.dirname(dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remember the target for next time
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
var previous_dsts = jQuery.extend([], egw_global_1.egw.preference('drop_history', this.appname));
|
||||
previous_dsts.unshift(dst);
|
||||
previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9);
|
||||
egw.set_preference(this.appname, 'drop_history', previous_dsts);
|
||||
egw_global_1.egw.set_preference(this.appname, 'drop_history', previous_dsts);
|
||||
// Actual action id will be something like file_drop_{move|copy|link}[_other_id],
|
||||
// but we need to send move, copy or link
|
||||
var action_id = _action.id.replace("file_drop_", '').split('_', 1)[0];
|
||||
@ -876,7 +888,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype.filedrop = function (row_uid, files) {
|
||||
var self = this;
|
||||
var data = egw.dataGetUIDdata(row_uid);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(row_uid);
|
||||
files = files || window.event.dataTransfer.files;
|
||||
var path = typeof data != 'undefined' && data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path();
|
||||
var widget = this.et2.getWidgetById('upload');
|
||||
@ -915,7 +927,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
if (_path == path) {
|
||||
var ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload', 'new'];
|
||||
for (var i = 0; i < ids.length; ++i) {
|
||||
var widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]);
|
||||
var widget = etemplate2_1.etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]);
|
||||
if (widget) {
|
||||
widget.set_readonly(_ro);
|
||||
}
|
||||
@ -938,7 +950,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
widget.getRoot().iterateOver(function (widget) {
|
||||
if (widget.id == "path")
|
||||
path_1 = widget;
|
||||
}, null, et2_textbox);
|
||||
}, null, et2_widget_textbox_1.et2_textbox);
|
||||
if (path_1) {
|
||||
path_1.set_value(widget.value.path);
|
||||
}
|
||||
@ -993,13 +1005,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
}
|
||||
else {
|
||||
// This is shown if stylite code is there, but the app is not available
|
||||
et2_dialog.show_dialog(function (_button) {
|
||||
if (_button == et2_dialog.YES_BUTTON)
|
||||
et2_widget_dialog_1.et2_dialog.show_dialog(function (_button) {
|
||||
if (_button == et2_widget_dialog_1.et2_dialog.YES_BUTTON)
|
||||
window.open('http://www.egroupware.org/EPL', '_blank');
|
||||
return true;
|
||||
}, this.egw.lang('this feature is only available in epl version.') + "\n\n" +
|
||||
this.egw.lang('You can use regular upload [+] button to upload files.') + "\n\n" +
|
||||
this.egw.lang('Do you want more information about EPL subscription?'), this.egw.lang('File a file'), undefined, et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE);
|
||||
this.egw.lang('Do you want more information about EPL subscription?'), this.egw.lang('File a file'), undefined, et2_widget_dialog_1.et2_dialog.BUTTONS_YES_NO, et2_widget_dialog_1.et2_dialog.QUESTION_MESSAGE);
|
||||
}
|
||||
};
|
||||
/**
|
||||
@ -1044,15 +1056,15 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
if (successful) {
|
||||
egw.message(app.egw.lang('Share link copied into clipboard'));
|
||||
egw_global_1.egw.message(app.egw.lang('Share link copied into clipboard'));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
egw.message('Failed to copy the link!');
|
||||
egw_global_1.egw.message('Failed to copy the link!');
|
||||
};
|
||||
jQuery("body").on("click", "[name=share_link]", copy_link_to_clipboard);
|
||||
et2_createWidget("dialog", {
|
||||
et2_core_widget_1.et2_createWidget("dialog", {
|
||||
callback: function () {
|
||||
jQuery("body").off("click", "[name=share_link]", copy_link_to_clipboard);
|
||||
return true;
|
||||
@ -1071,7 +1083,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
filemanagerAPP.prototype.hidden_upload_enabled = function (_action, _senders) {
|
||||
if (_senders[0].id == 'nm')
|
||||
return false;
|
||||
var data = egw.dataGetUIDdata(_senders[0].id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_senders[0].id);
|
||||
var readonly = ((data === null || data === void 0 ? void 0 : data.data.class) || '').split(/ +/).indexOf('noEdit') >= 0;
|
||||
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
||||
return (!_senders[0].id || data.data.is_dir && !readonly);
|
||||
@ -1084,8 +1096,8 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @param {egwActionObject[]} _senders The row clicked on
|
||||
*/
|
||||
filemanagerAPP.prototype.view_link = function (_action, _senders) {
|
||||
var id = egw.dataGetUIDdata(_senders[0].id).data.share_id;
|
||||
egw.json('stylite_filemanager::ajax_view_link', [id], this._share_link_callback, this, true, this).sendRequest();
|
||||
var id = egw_global_1.egw.dataGetUIDdata(_senders[0].id).data.share_id;
|
||||
egw_global_1.egw.json('stylite_filemanager::ajax_view_link', [id], this._share_link_callback, this, true, this).sendRequest();
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
@ -1096,10 +1108,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @returns {Boolean} returns false if not successful
|
||||
*/
|
||||
filemanagerAPP.prototype.copy_link = function (_action, _senders) {
|
||||
var data = egw.dataGetUIDdata(_senders[0].id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_senders[0].id);
|
||||
var url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[0].id);
|
||||
if (url[0] == '/')
|
||||
url = egw.link(url);
|
||||
url = egw_global_1.egw.link(url);
|
||||
if (url.substr(0, 4) == 'http' && url.indexOf('://') <= 5) {
|
||||
// it's already a full url
|
||||
}
|
||||
@ -1127,13 +1139,13 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
try {
|
||||
successful = document.execCommand('copy');
|
||||
if (successful) {
|
||||
egw.message(this.egw.lang('WebDav link copied into clipboard'));
|
||||
egw_global_1.egw.message(this.egw.lang('WebDav link copied into clipboard'));
|
||||
window.getSelection().removeAllRanges();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
egw.message('Failed to copy the link!');
|
||||
egw_global_1.egw.message('Failed to copy the link!');
|
||||
elem.remove();
|
||||
return false;
|
||||
}
|
||||
@ -1149,9 +1161,9 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
filemanagerAPP.prototype.isEditable = function (_egwAction, _senders) {
|
||||
if (_senders.length > 1)
|
||||
return false;
|
||||
var data = egw.dataGetUIDdata(_senders[0].id);
|
||||
var data = egw_global_1.egw.dataGetUIDdata(_senders[0].id);
|
||||
var mime = this.et2.getInstanceManager().widgetContainer.getWidgetById('$row');
|
||||
var fe = egw_get_file_editor_prefered_mimes(data.data.mime);
|
||||
var fe = egw_global_1.egw_get_file_editor_prefered_mimes(data.data.mime);
|
||||
if (fe && fe.mime && !fe.mime[data.data.mime])
|
||||
return false;
|
||||
return !!data.data.mime.match(mime.mime_odf_regex);
|
||||
@ -1164,14 +1176,32 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @return {boolean} returns true
|
||||
*/
|
||||
filemanagerAPP.prototype.create_new = function (_action, _selected) {
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var fe = egw_global_1.egw.link_get_registry('filemanager-editor');
|
||||
if (fe && fe["edit"]) {
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
egw_global_1.egw.open_link(egw_global_1.egw.link('/index.php', {
|
||||
menuaction: fe["edit"].menuaction
|
||||
}), '', fe["popup_edit"]);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Mount scheme change --> enable/disable user, pass and host
|
||||
*/
|
||||
filemanagerAPP.prototype.changeMountScheme = function () {
|
||||
var _a;
|
||||
var grid = this.et2.getWidgetById('mounts');
|
||||
var scheme = (_a = grid.getWidgetById('url[scheme]')) === null || _a === void 0 ? void 0 : _a.get_value();
|
||||
['url[user]', 'url[pass]', 'url[host]', 'colon', 'at'].forEach(function (name) {
|
||||
var _a;
|
||||
(_a = grid.getWidgetById(name)) === null || _a === void 0 ? void 0 : _a.set_disabled(scheme !== 'webdavs' && scheme !== 'smb');
|
||||
});
|
||||
if (scheme === 'vfs') {
|
||||
['url[user]', 'at'].forEach(function (name) {
|
||||
var _a;
|
||||
(_a = grid.getWidgetById(name)) === null || _a === void 0 ? void 0 : _a.set_disabled(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
return filemanagerAPP;
|
||||
}(egw_app_1.EgwApp));
|
||||
exports.filemanagerAPP = filemanagerAPP;
|
||||
|
@ -13,6 +13,15 @@
|
||||
*/
|
||||
import {EgwApp} from "../../api/js/jsapi/egw_app";
|
||||
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
|
||||
import {etemplate2} from "../../api/js/etemplate/etemplate2";
|
||||
import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog";
|
||||
import {et2_file} from "../../api/js/etemplate/et2_widget_file";
|
||||
import {et2_button} from "../../api/js/etemplate/et2_widget_button";
|
||||
import {et2_nextmatch_controller} from "../../api/js/etemplate/et2_extension_nextmatch_controller";
|
||||
import {egw, egw_get_file_editor_prefered_mimes} from "../../api/js/jsapi/egw_global";
|
||||
import {et2_createWidget} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
|
||||
import {et2_textbox} from "../../api/js/etemplate/et2_widget_textbox";
|
||||
|
||||
/**
|
||||
* UI for filemanager
|
||||
@ -81,6 +90,12 @@ export class filemanagerAPP extends EgwApp
|
||||
// call parent
|
||||
super.et2_ready(et2, name);
|
||||
|
||||
if (name === 'filemanager.admin')
|
||||
{
|
||||
this.changeMountScheme();
|
||||
return;
|
||||
}
|
||||
|
||||
let path_widget = this.et2.getWidgetById('path');
|
||||
if(path_widget) // do NOT set not found path-widgets, as uploads works on first one only!
|
||||
{
|
||||
@ -1406,5 +1421,25 @@ export class filemanagerAPP extends EgwApp
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mount scheme change --> enable/disable user, pass and host
|
||||
*/
|
||||
changeMountScheme()
|
||||
{
|
||||
const grid = this.et2.getWidgetById('mounts');
|
||||
const scheme = (<et2_selectbox>grid.getWidgetById('url[scheme]'))?.get_value();
|
||||
|
||||
['url[user]', 'url[pass]', 'url[host]', 'colon', 'at'].forEach((name) => {
|
||||
(<et2_textbox>grid.getWidgetById(name))?.set_disabled(scheme !== 'webdavs' && scheme !== 'smb');
|
||||
});
|
||||
if (scheme === 'vfs')
|
||||
{
|
||||
['url[user]', 'at'].forEach((name) => {
|
||||
(<et2_textbox>grid.getWidgetById(name))?.set_disabled(false);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
app.classes.filemanager = filemanagerAPP;
|
||||
|
@ -159,6 +159,7 @@ files from links filemanager de Zeige Dateien aus verknüpften Einträgen
|
||||
files from subdirectories filemanager de Dateien aus Unterverzeichnissen
|
||||
files in this directory filemanager de Dateien in diesem Verzeichnis
|
||||
filesystem check reported no problems. filemanager de Überprüfung des Dateisystems ergab keine Probleme
|
||||
filesystem: mount directory (inside /var/lib/egroupware!) from host filesystem filemanager de Dateisystem: mounted Verzeichnisse (innerhalb von /var/lib/egroupware) vom Dateisystem des Hosts
|
||||
finally delete filemanager de Endgültig löschen
|
||||
finally delete all older versions and deleted files under given directory.\n\nthis can not be undone! filemanager de Ältere Versionen und gelöschte Dateien unter dem angegebenen Verzeichnis endgültig löschen.\n\nDas kann NICHT rückgängig gemacht werden!
|
||||
finally delete this version filemanager de Diese Version endgültig löschen
|
||||
@ -175,6 +176,7 @@ go to your home directory filemanager de Zu Ihrem Heimverzeichnis wechseln
|
||||
go up filemanager de in das übergeordnete Verzeichnis wechseln
|
||||
hidden upload filemanager de Hochladen nicht einsehbar
|
||||
hidden uploads filemanager de Hochladen nicht einsehbar
|
||||
hostname/ip for webdav and smb filemanager de Hostname/IP für WebDAV und SMB
|
||||
id filemanager de ID
|
||||
if you specify a directory (full vfs path) here, %1 displays an action for each document. that action allows to download the specified document with the %1 data inserted. filemanager de Wenn Sie hier ein Verzeichnis angeben (vollständiger Pfad des virtuellen Dateisystems), zeigt %1 einen Befehl für jedes Dokument an. Dieser Befehl erlaubt es, das Dokument mit %1 Daten eingefügt herunterzuladen.
|
||||
if you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. that icon allows to download the specified document with the data inserted. filemanager de Wenn Sie hier ein Dokument angeben (vollständiger Pfad des virtuellen Dateisystems), zeigt %1 ein zusätzliches Dokumentsymbol für jeden Eintrag an. Dieses Symbol erlaubt es, das Dokument mit eingefügten Daten herunterzuladen.
|
||||
@ -211,14 +213,15 @@ no access filemanager de Kein Zugriff
|
||||
no files in this directory. filemanager de Keine Dateien in diesem Verzeichnis
|
||||
no preview available filemanager de Keine Vorschau verfügbar
|
||||
no version history for this file/directory filemanager de Keine Versionshistorie für diese Datei oder dieses Verzeichnis
|
||||
notebookbar filemanager de In Registern
|
||||
noone filemanager de Niemand
|
||||
notebookbar filemanager de In Registern
|
||||
older versions or deleted files filemanager de Ältere Versionen oder gelöschte Dateien
|
||||
only owner can rename or delete the content filemanager de Nur der Besitzer kann den Inhalt umbenennen oder löschen
|
||||
open filemanager de Öffnen
|
||||
open documents with collabora, if permissions are given filemanager de Dokument mit Collabora Online öffnen, falls Rechte vorhanden sind
|
||||
open odt documents with collabeditor filemanager de odt Dokumente mit CollabEditor öffnen
|
||||
operation filemanager de Vorgang
|
||||
password for webdav and smb, use $pass for password of logged in user filemanager de Passwort für WebDAV und SMB, benutzer $pass für das Passwort des angemeldeten Benutzers
|
||||
paste link filemanager de Als Verknüpfung einfügen
|
||||
path %1 not found or not a directory! filemanager de Pfad %1 nicht gefunden oder kein Verzeichnis!
|
||||
percentage filemanager de Prozentual
|
||||
@ -231,6 +234,8 @@ preview %1 filemanager de Vorschau %1
|
||||
preview of %1 filemanager de Vorschau von %1
|
||||
projectmanager filemanager de Projektmanager
|
||||
properties saved. filemanager de Eigenschaften gespeichert
|
||||
protocol to use filemanager de Zu benutzendes Protokoll
|
||||
protocols filemanager de Protokolle
|
||||
quick jump to filemanager de Springe zu
|
||||
read & write access filemanager de Lese- und Schreibzugriff
|
||||
read access only filemanager de Nur Lesezugriff
|
||||
@ -272,6 +277,8 @@ show link "your home directory" in side box menu? filemanager de Möchten Sie de
|
||||
show link "your home directory*" in side box menu?* filemanager de Möchten Sie den Verknüpfung "Ihr Home Verzeichnis" innerhalb des Seitenmenüs angezeigt bekommen?
|
||||
show link to filemanagers basedirectory (/) in side box menu? filemanager de Zeige die Verknüpfung zum Basisverzeichnis (/) des Dateimanagers im Seitenmenü?
|
||||
size filemanager de Größe
|
||||
smb, webdavs and vfs require a username! filemanager de SMB, WebDAVs und VFS benötigen einen Benutzernamen!
|
||||
smb: mount samba of windows fileserver shares filemanager de SMB: mounten von Freigaben eines Samba oder Windows Dateiservern
|
||||
some functionalities require superuser permissions, please login here as filemanager superuser - allowed users are defined in setup. filemanager de Einige Funktionalitäten benötigen Superuser-Rechte. Bitte loggen sie sich hier als Dateimanager Superuser ein (Zulässige Benutzer werden im Setup festgelegt).
|
||||
sqlfs statistics filemanager de sqlFS Statistik
|
||||
start search filemanager de Suche starten
|
||||
@ -302,11 +309,14 @@ upload files filemanager de Dateien hochladen
|
||||
use this tag for addresslabels. put the content, you want to repeat, between two tags. filemanager de Benutzen Sie dieses Symbol für Adressetiketten. Stellen Sie den Inhalt der wiederholt werden soll zwischen 2 Symbole.
|
||||
used space filemanager de Benutzter Platz
|
||||
user color indicator filemanager de Benutzer-Farbe
|
||||
username for webdav and smb, use $user for name of logged in user filemanager de Benutzername für WebDAV und SMB, benutzer $user für den Benutzername des angemeldeten Benutzers
|
||||
users and groups filemanager de Benutzer und Gruppen
|
||||
versioning filemanager de Versionierung
|
||||
versioning requires egroupware epl filemanager de Versionierung benötigt EGroupware EPL
|
||||
vfs mounts and versioning common de VFS einhängen und versionieren
|
||||
view link filemanager de Zeige Link
|
||||
webdav link copied into clipboard filemanager de WebDAV-Link in die Zwischenablage kopiert
|
||||
webdavs: mount egroupware or *cloud shares filemanager de WebDAVs: mounten von EGroupware oder *Cloud Freigaben
|
||||
who should be allowed to finally delete deleted files or old versions of a file: filemanager de Wer soll gelöschte Dateien oder ältere Versionen endgültig löschen dürfen:
|
||||
writable share link filemanager de Beschreibbare Freigabe-Link
|
||||
wrong username or password! filemanager de Falscher Benutzername oder Passwort!
|
||||
|
@ -159,6 +159,7 @@ files from links filemanager en Files from links
|
||||
files from subdirectories filemanager en Files from sub directories
|
||||
files in this directory filemanager en Files in this directory
|
||||
filesystem check reported no problems. filemanager en Filesystem check reported no problems.
|
||||
filesystem: mount directory (inside /var/lib/egroupware!) from host filesystem filemanager en Filesystem: mount directory (inside /var/lib/egroupware!) from host filesystem
|
||||
finally delete filemanager en Finally delete
|
||||
finally delete all older versions and deleted files under given directory.\n\nthis can not be undone! filemanager en Finally delete all older versions and deleted files under given directory.\n\nThis can NOT be undone!
|
||||
finally delete this version filemanager en Finally delete this version
|
||||
@ -175,6 +176,7 @@ go to your home directory filemanager en Go to your home directory
|
||||
go up filemanager en Go up
|
||||
hidden upload filemanager en Hidden upload
|
||||
hidden uploads filemanager en Hidden uploads
|
||||
hostname/ip for webdav and smb filemanager en Hostname/IP for WebDAV and SMB
|
||||
id filemanager en ID
|
||||
if you specify a directory (full vfs path) here, %1 displays an action for each document. that action allows to download the specified document with the %1 data inserted. filemanager en If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the %1 data inserted.
|
||||
if you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. that icon allows to download the specified document with the data inserted. filemanager en If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.
|
||||
@ -219,6 +221,7 @@ open filemanager en Open
|
||||
open documents with collabora, if permissions are given filemanager en open documents with Collabora, if permissions are given
|
||||
open odt documents with collabeditor filemanager en open odt documents with CollabEditor
|
||||
operation filemanager en Operation
|
||||
password for webdav and smb, use $pass for password of logged in user filemanager en Password for WebDAV and SMB, use $pass for password of logged in user
|
||||
paste link filemanager en Paste Link
|
||||
path %1 not found or not a directory! filemanager en Path %1 not found or not a directory!
|
||||
percentage filemanager en Percentage
|
||||
@ -231,6 +234,8 @@ preview %1 filemanager en Preview %1
|
||||
preview of %1 filemanager en Preview of %1
|
||||
projectmanager filemanager en Project Manager
|
||||
properties saved. filemanager en Properties saved.
|
||||
protocol to use filemanager en Protocol to use
|
||||
protocols filemanager en Protocols
|
||||
quick jump to filemanager en Quick jump to
|
||||
read & write access filemanager en Read & write access
|
||||
read access only filemanager en Read access only
|
||||
@ -261,8 +266,8 @@ select file(s) from vfs common en Select file(s) from VFS
|
||||
setting for document merge saved. filemanager en Setting for document merge saved.
|
||||
share files filemanager en Share files
|
||||
share link copied into clipboard filemanager en Share link copied into clipboard
|
||||
shared files filemanager en Shared files
|
||||
share mounted at %1.<br/>please close this tab. filemanager en Share mounted at %1.<br/>Please close this tab.
|
||||
shared files filemanager en Shared files
|
||||
shared with filemanager en Shared with
|
||||
show filemanager en Show
|
||||
show hidden files filemanager en Show hidden files
|
||||
@ -273,6 +278,8 @@ show link "your home directory" in side box menu? filemanager en Show link "Your
|
||||
show link "your home directory*" in side box menu?* filemanager en Show link "Your home directory*" in side box menu?*
|
||||
show link to filemanagers basedirectory (/) in side box menu? filemanager en Show link to File Manager's base directory (/) in side menu?
|
||||
size filemanager en Size
|
||||
smb, webdavs and vfs require a username! filemanager en SMB, WebDAVs and VFS require a username!
|
||||
smb: mount samba of windows fileserver shares filemanager en SMB: mount Samba of Windows fileserver shares
|
||||
some functionalities require superuser permissions, please login here as filemanager superuser - allowed users are defined in setup. filemanager en Some functionalities require superuser permissions, please login here as filemanager superuser - allowed users are defined in setup.
|
||||
sqlfs statistics filemanager en sqlFS Statistics
|
||||
start search filemanager en Start search
|
||||
@ -303,11 +310,14 @@ upload files filemanager en Upload files
|
||||
use this tag for addresslabels. put the content, you want to repeat, between two tags. filemanager en Use this tag for addresslabels. Put the content, you want to repeat, between two tags.
|
||||
used space filemanager en Used space
|
||||
user color indicator filemanager en User color indicator
|
||||
username for webdav and smb, use $user for name of logged in user filemanager en Username for WebDAV and SMB, use $user for name of logged in user
|
||||
users and groups filemanager en Users and groups
|
||||
versioning filemanager en Versioning
|
||||
versioning requires egroupware epl filemanager en Versioning requires EGroupware EPL
|
||||
vfs mounts and versioning common en VFS mounts and versioning
|
||||
view link filemanager en View link
|
||||
webdav link copied into clipboard filemanager en WebDAV link copied into clipboard
|
||||
webdavs: mount egroupware or *cloud shares filemanager en WebDAVs: mount EGroupware or *Cloud shares
|
||||
who should be allowed to finally delete deleted files or old versions of a file: filemanager en Who should be allowed to finally delete deleted files or old versions of a file:
|
||||
writable share link filemanager en Writable Share link
|
||||
wrong username or password! filemanager en Wrong username or password!
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="filemanager.admin" template="" lang="" group="0" version="1.7.001">
|
||||
<groupbox disabled="!@percent_size">
|
||||
@ -40,7 +39,7 @@
|
||||
<column/>
|
||||
<column/>
|
||||
<column disabled="!@@is_root"/>
|
||||
<column disabled="!@@is_setup"/>
|
||||
<column disabled="!@@is_root"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th" part="header">
|
||||
@ -49,9 +48,31 @@
|
||||
<description value="Versioning" align="center"/>
|
||||
<description value="Mount" align="center"/>
|
||||
</row>
|
||||
<row disabled="!@@is_root" part="footer">
|
||||
<textbox id="path" class="inputFullWidth"/>
|
||||
<textbox size="50" blur="stylite.versioning://default/$path" class="inputFullWidth" id="url" statustext="Backend URL to mount"/>
|
||||
<row disabled="!@@is_root" part="footer" valign="bottom">
|
||||
<textbox id="path" size="64"/>
|
||||
<vbox width="100%">
|
||||
<groupbox>
|
||||
<caption label="Protocols"/>
|
||||
<vbox class="filemanager_protocols">
|
||||
<description value="WebDAVs: mount EGroupware or *Cloud shares"/>
|
||||
<description value="SMB: mount Samba of Windows fileserver shares"/>
|
||||
<description value="{Versioning}: {Versioning requires EGroupware EPL}"
|
||||
extra_link_target="_blank" href="https://www.egroupware.org/EPL"/>
|
||||
<description value="Filesystem: mount directory (inside /var/lib/egroupware!) from host filesystem"
|
||||
extra_link_target="_blank" href="https://github.com/EGroupware/egroupware/blob/master/api/src/Vfs/Filesystem/StreamWrapper.php#L20"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
<hbox width="100%">
|
||||
<select id="url[scheme]" statustext="Protocol to use" onchange="app.filemanager.changeMountScheme"/>
|
||||
<description value="://"/>
|
||||
<textbox id="url[user]" blur="user" statustext="Username for WebDAV and SMB, use $user for name of logged in user" size="12"/>
|
||||
<description id="colon" value=":"/>
|
||||
<passwd id="url[pass]" blur="password" statustext="Password for WebDAV and SMB, use $pass for password of logged in user" class="filemanager_password" size="12"/>
|
||||
<description id="at"/>
|
||||
<textbox id="url[host]" blur="host" statustext="Hostname/IP for WebDAV and SMB"/>
|
||||
<textbox id="url[path]" blur="Path and query-parameters, SMB: share and optional path (with slashes!)" size="64"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<button label="Enable" id="enable" statustext="Enable versioning for given mountpoint" class="filemanager_smallButton" align="center"/>
|
||||
<button label="Mount" id="mount" class="filemanager_smallButton" align="center"/>
|
||||
</row>
|
||||
|
@ -102,6 +102,12 @@ table.egwGridView_grid .tile .file_tile {
|
||||
font-size: 90%;
|
||||
margin: 0;
|
||||
}
|
||||
.filemanager_password > input {
|
||||
min-width: 0 !important;
|
||||
}
|
||||
div.filemanager_protocols > *:before {
|
||||
content: "• ";
|
||||
}
|
||||
.filemanager_header {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
|
@ -21,7 +21,6 @@
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Stefan Reinhardt <stefan.reinhardt@pixelegg.de>
|
||||
* @package filemanager
|
||||
* @version $Id$
|
||||
*/
|
||||
/**
|
||||
* EGroupware - CSS Styles used by filemanager app
|
||||
@ -134,6 +133,12 @@ input.displayNone {
|
||||
font-size: 90%;
|
||||
margin: 0;
|
||||
}
|
||||
.filemanager_password > input {
|
||||
min-width: 0 !important;
|
||||
}
|
||||
div.filemanager_protocols > *:before {
|
||||
content: "• ";
|
||||
}
|
||||
.filemanager_header {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Stefan Reinhardt <stefan.reinhardt@pixelegg.de>
|
||||
* @package filemanager
|
||||
* @version $Id$
|
||||
*/
|
||||
/**
|
||||
* EGroupware - CSS Styles used by filemanager app
|
||||
@ -122,6 +121,12 @@ input.displayNone {
|
||||
font-size: 90%;
|
||||
margin: 0;
|
||||
}
|
||||
.filemanager_password > input {
|
||||
min-width: 0 !important;
|
||||
}
|
||||
div.filemanager_protocols > *:before {
|
||||
content: "• ";
|
||||
}
|
||||
.filemanager_header {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
@ -270,6 +275,13 @@ div#filemanager-file_tabs {
|
||||
}
|
||||
div#filemanager-file_tabs span.ui-icon-search {
|
||||
/*.background_color_10_gray;*/
|
||||
-webkit-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
top: 3px;
|
||||
margin-left: 3px;
|
||||
|
@ -9,10 +9,8 @@
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Stefan Reinhardt <stefan.reinhardt@pixelegg.de>
|
||||
* @package filemanager
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
@import (reference) "../../../pixelegg/less/definitions.less";
|
||||
@import (reference) "../../../pixelegg/less/def_mobile.less";
|
||||
@import (less) "../default/app.css";
|
||||
|
Loading…
Reference in New Issue
Block a user