Change the hidden upload message

This commit is contained in:
nathangray 2020-03-27 13:40:48 -06:00
parent 93a7166710
commit d3eb2d9b22
4 changed files with 33 additions and 10 deletions

View File

@ -236,12 +236,32 @@ if (file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php'
// Take over upload, change target and conflict strategy
$path = Vfs::concat(self::get_home_dir(), Sharing::HIDDEN_UPLOAD_DIR);
$this->etemplate->setElementAttribute('nm[upload]', 'onFinishOne', "app.filemanager.upload(ev, 1, '$path', 'rename')");
$target = str_replace('\\', '\\\\', __CLASS__);
$this->etemplate->setElementAttribute('nm[upload]', 'onFinishOne', "app.filemanager.upload(ev, 1, '$path', 'rename', '{$target}::ajax_action')");
}
return parent::listview($content, $msg);
}
/**
* Deal with an uploaded file.
* Overridden from the parent to change the message and message type
*
* @param string $action Should be 'upload'
* @param $selected Array of file information
* @param string $dir Target directory
* @param $props
* @param string[] $arr Result
*
* @throws Api\Exception\AssertionFailed
*/
protected static function handle_upload_action(string $action, $selected, $dir, $props, &$arr)
{
parent::handle_upload_action($action, $selected, $dir, $props, $arr);
$arr['msg'] .= "\n" . lang("The uploaded file is only visible to the person sharing these files with you, not to yourself or other people knowing this sharing link.");
$arr['type'] = 'notice';
}
protected function is_hidden_upload_dir($directory)
{
if (!isset($GLOBALS['egw']->sharing)) return false;

View File

@ -295,7 +295,7 @@ class filemanager_ui
$actions['share']['children']['share_mail']['children']['mail_shareUploadDir'] = array(
'caption' => $data['label'],
'hint' => $data['title'],
'icon' => 'upload',
'icon' => 'api/link',
'group' => 3,
'data' => ['share_writable' => $mode],
'enabled' => 'javaScript:app.filemanager.hidden_upload_enabled',

View File

@ -293,9 +293,11 @@ var filemanagerAPP = /** @class */ (function (_super) {
* @param {number} _file_count
* @param {string=} _path where the file is uploaded to, default current directory
* @param {string} _conflict What to do if the file conflicts with one on the server
* @param {string} _target Upload processing target. Sharing classes can override this.
*/
filemanagerAPP.prototype.upload = function (_event, _file_count, _path, _conflict) {
filemanagerAPP.prototype.upload = function (_event, _file_count, _path, _conflict, _target) {
if (_conflict === void 0) { _conflict = "ask"; }
if (_target === void 0) { _target = 'filemanager_ui::ajax_action'; }
if (typeof _path == 'undefined') {
_path = this.get_path();
}
@ -303,7 +305,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
var widget = _event.data;
var value = widget.getValue();
value.conflict = _conflict;
egw.json('filemanager_ui::ajax_action', ['upload', value, _path, _conflict], this._upload_callback, this, true, this).sendRequest();
egw.json(_target, ['upload', value, _path, _conflict], this._upload_callback, this, true, this).sendRequest();
widget.set_value('');
}
};
@ -344,7 +346,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
*/
filemanagerAPP.prototype._upload_callback = function (_data) {
if (_data.msg || _data.uploaded)
window.egw_refresh(_data.msg, this.appname);
window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type);
var that = this;
for (var file in _data.uploaded) {
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) {
@ -561,7 +563,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
* @param _data
*/
filemanagerAPP.prototype._do_action_callback = function (_data) {
window.egw_refresh(_data.msg, this.appname);
window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type);
};
/**
* Force download of a file by appending '?download' to it's download url

View File

@ -336,8 +336,9 @@ export class filemanagerAPP extends EgwApp
* @param {number} _file_count
* @param {string=} _path where the file is uploaded to, default current directory
* @param {string} _conflict What to do if the file conflicts with one on the server
* @param {string} _target Upload processing target. Sharing classes can override this.
*/
upload(_event, _file_count : number, _path? : string, _conflict = "ask")
upload(_event, _file_count : number, _path? : string, _conflict = "ask", _target: string = 'filemanager_ui::ajax_action')
{
if(typeof _path == 'undefined')
{
@ -348,7 +349,7 @@ export class filemanagerAPP extends EgwApp
let widget = _event.data;
let value = widget.getValue();
value.conflict = _conflict;
egw.json('filemanager_ui::ajax_action', ['upload', value, _path, _conflict],
egw.json(_target, ['upload', value, _path, _conflict],
this._upload_callback, this, true, this
).sendRequest();
widget.set_value('');
@ -403,7 +404,7 @@ export class filemanagerAPP extends EgwApp
*/
_upload_callback(_data)
{
if(_data.msg || _data.uploaded) window.egw_refresh(_data.msg, this.appname);
if(_data.msg || _data.uploaded) window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type);
let that = this;
for (let file in _data.uploaded)
@ -668,7 +669,7 @@ export class filemanagerAPP extends EgwApp
*/
_do_action_callback(_data)
{
window.egw_refresh(_data.msg, this.appname);
window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type);
}
/**