Fix missing appname causing share link to reload everything

This commit is contained in:
nathangray 2020-03-06 13:04:52 -07:00
parent 28143ab160
commit 66f197d0b0
2 changed files with 61 additions and 51 deletions

View File

@ -302,7 +302,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, filemanagerAPP.appname);
var that = this;
for (var file in _data.uploaded) {
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) {
@ -513,7 +513,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, filemanagerAPP.appname);
};
/**
* Force download of a file by appending '?download' to it's download url
@ -724,7 +724,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.preference('drop_history', filemanagerAPP.appname));
var action_index = 0;
for (var i = 0; i < 10; i++) {
var path = i < previous_dsts.length ? previous_dsts[i] : '';
@ -806,10 +806,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
}
}
// Remember the target for next time
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
var previous_dsts = jQuery.extend([], egw.preference('drop_history', filemanagerAPP.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.set_preference(filemanagerAPP.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];
@ -976,7 +976,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
*/
filemanagerAPP.prototype._share_link_callback = function (_data) {
if (_data.msg || _data.share_link)
window.egw_refresh(_data.msg, this.appname);
window.egw_refresh(_data.msg, filemanagerAPP.appname);
console.log("_data", _data);
var app = this;
var copy_link_to_clipboard = function (evt) {
@ -1101,6 +1101,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
}
return true;
};
filemanagerAPP.appname = 'filemanager';
return filemanagerAPP;
}(egw_app_1.EgwApp));
exports.filemanagerAPP = filemanagerAPP;

View File

@ -19,7 +19,7 @@ import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
*/
export class filemanagerAPP extends EgwApp
{
static readonly appname: 'filemanager';
static readonly appname = 'filemanager';
/**
* path widget, by template
*/
@ -356,7 +356,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, filemanagerAPP.appname);
let that = this;
for (let file in _data.uploaded)
@ -364,7 +364,13 @@ export class filemanagerAPP extends EgwApp
if(_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
{
let buttons = [
{text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check'},
{
text: this.egw.lang("Yes"),
id: "overwrite",
class: "ui-priority-primary",
"default": true,
image: 'check'
},
{text: this.egw.lang("Rename"), id: "rename", image: 'edit'},
{text: this.egw.lang("Cancel"), id: "cancel"}
];
@ -615,7 +621,7 @@ export class filemanagerAPP extends EgwApp
*/
_do_action_callback(_data)
{
window.egw_refresh(_data.msg, this.appname);
window.egw_refresh(_data.msg, filemanagerAPP.appname);
}
/**
@ -877,7 +883,7 @@ export class filemanagerAPP extends EgwApp
});
// Last 10 folders
let previous_dsts = jQuery.extend([], <any><unknown>egw.preference('drop_history',this.appname));
let previous_dsts = jQuery.extend([], <any><unknown>egw.preference('drop_history', filemanagerAPP.appname));
let action_index = 0;
for (let i = 0; i < 10; i++)
{
@ -977,10 +983,10 @@ export class filemanagerAPP extends EgwApp
}
// Remember the target for next time
let previous_dsts = jQuery.extend([], egw.preference('drop_history',this.appname));
let previous_dsts = jQuery.extend([], egw.preference('drop_history', filemanagerAPP.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.set_preference(filemanagerAPP.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
@ -1181,15 +1187,18 @@ export class filemanagerAPP extends EgwApp
* Share-link callback
* @param {object} _data
*/
_share_link_callback(_data) {
if (_data.msg || _data.share_link) window.egw_refresh(_data.msg, this.appname);
_share_link_callback(_data)
{
if(_data.msg || _data.share_link) window.egw_refresh(_data.msg, filemanagerAPP.appname);
console.log("_data", _data);
let app = this;
let copy_link_to_clipboard = function(evt){
let copy_link_to_clipboard = function (evt)
{
let $target = jQuery(evt.target);
$target.select();
try {
try
{
let successful = document.execCommand('copy');
if(successful)
{