mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-20 18:08:02 +02:00
WIP egw_action copy fixes
paste not working
This commit is contained in:
parent
efaa3ae386
commit
b00371c7e1
@ -13,8 +13,8 @@ import {IegwAppLocal} from "../jsapi/egw_global";
|
|||||||
import {egw_getObjectManager} from "./egw_action";
|
import {egw_getObjectManager} from "./egw_action";
|
||||||
|
|
||||||
export class EgwAction {
|
export class EgwAction {
|
||||||
public readonly id: string;
|
public id: string;
|
||||||
private caption: string;
|
public caption: string;
|
||||||
group: number;
|
group: number;
|
||||||
order: number;
|
order: number;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export class EgwAction {
|
|||||||
this.caption = _value;
|
this.caption = _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private iconUrl: string;
|
public iconUrl: string;
|
||||||
|
|
||||||
public set_iconUrl(_value) {
|
public set_iconUrl(_value) {
|
||||||
this.iconUrl = _value;
|
this.iconUrl = _value;
|
||||||
@ -39,7 +39,7 @@ export class EgwAction {
|
|||||||
this.allowOnMultiple = _value
|
this.allowOnMultiple = _value
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly enabled: EgwFnct;
|
public enabled: EgwFnct;
|
||||||
|
|
||||||
public set_enabled(_value) {
|
public set_enabled(_value) {
|
||||||
this.enabled.setValue(_value);
|
this.enabled.setValue(_value);
|
||||||
@ -62,7 +62,7 @@ export class EgwAction {
|
|||||||
readonly parent: EgwAction;
|
readonly parent: EgwAction;
|
||||||
children: EgwAction[] = []; //i guess
|
children: EgwAction[] = []; //i guess
|
||||||
|
|
||||||
private readonly onExecute = new EgwFnct(this, null, []);
|
public onExecute = new EgwFnct(this, null, []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to either a confirmation prompt, or TRUE to indicate that this action
|
* Set to either a confirmation prompt, or TRUE to indicate that this action
|
||||||
@ -382,7 +382,7 @@ export class EgwAction {
|
|||||||
* @param _target egwActionObject object, gets called for every object in _senders
|
* @param _target egwActionObject object, gets called for every object in _senders
|
||||||
* @returns boolean true if none has disableClass, false otherwise
|
* @returns boolean true if none has disableClass, false otherwise
|
||||||
*/
|
*/
|
||||||
private not_disableClass(_action: EgwAction, _senders: any, _target: any) {
|
public not_disableClass(_action: EgwAction, _senders: any, _target: any) {
|
||||||
if (_target.iface.getDOMNode()) {
|
if (_target.iface.getDOMNode()) {
|
||||||
return !(_target.iface.getDOMNode()).classList.contains(_action.data.disableClass);
|
return !(_target.iface.getDOMNode()).classList.contains(_action.data.disableClass);
|
||||||
} else if (_target.id) {
|
} else if (_target.id) {
|
||||||
@ -404,7 +404,7 @@ export class EgwAction {
|
|||||||
* @returns boolean true if none has disableClass, false otherwise
|
* @returns boolean true if none has disableClass, false otherwise
|
||||||
*/
|
*/
|
||||||
//TODO senders is never used in function body??
|
//TODO senders is never used in function body??
|
||||||
private enableClass(_action: EgwAction, _senders: any[], _target: any) {
|
public enableClass(_action: EgwAction, _senders: any[], _target: any) {
|
||||||
if (typeof _target == 'undefined') {
|
if (typeof _target == 'undefined') {
|
||||||
return false;
|
return false;
|
||||||
} else if (_target.iface.getDOMNode()) {
|
} else if (_target.iface.getDOMNode()) {
|
||||||
@ -428,7 +428,7 @@ export class EgwAction {
|
|||||||
* @param _target egwActionObject object, gets called for every object in _senders
|
* @param _target egwActionObject object, gets called for every object in _senders
|
||||||
* @returns boolean true if _target.id matches _action.data.enableId
|
* @returns boolean true if _target.id matches _action.data.enableId
|
||||||
*/
|
*/
|
||||||
private enableId(_action: EgwAction, _senders: any[], _target: any) {
|
public enableId(_action: EgwAction, _senders: any[], _target: any) {
|
||||||
if (typeof _action.data.enableId == 'string') {
|
if (typeof _action.data.enableId == 'string') {
|
||||||
_action.data.enableId = new RegExp(_action.data.enableId);
|
_action.data.enableId = new RegExp(_action.data.enableId);
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ export class EgwAction {
|
|||||||
* @param {type} _target
|
* @param {type} _target
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
private _check_confirm_mass_selections(_senders, _target) {
|
public _check_confirm_mass_selections(_senders, _target) {
|
||||||
const obj_manager: any = egw_getObjectManager(this.getManager().parent.id, false);
|
const obj_manager: any = egw_getObjectManager(this.getManager().parent.id, false);
|
||||||
if (!obj_manager) {
|
if (!obj_manager) {
|
||||||
return false;
|
return false;
|
||||||
@ -529,7 +529,7 @@ export class EgwAction {
|
|||||||
/**
|
/**
|
||||||
* Check to see if action needs to be confirmed by user before we do it
|
* Check to see if action needs to be confirmed by user before we do it
|
||||||
*/
|
*/
|
||||||
private _check_confirm(_senders, _target) {
|
public _check_confirm(_senders, _target) {
|
||||||
// check if actions needs to be confirmed first
|
// check if actions needs to be confirmed first
|
||||||
if (this.data && (this.data.confirm || this.data.confirm_multiple) &&
|
if (this.data && (this.data.confirm || this.data.confirm_multiple) &&
|
||||||
this.onExecute.functionToPerform != window.nm_action && typeof window.Et2Dialog != 'undefined') // let old eTemplate run its own confirmation from nextmatch_action.js
|
this.onExecute.functionToPerform != window.nm_action && typeof window.Et2Dialog != 'undefined') // let old eTemplate run its own confirmation from nextmatch_action.js
|
||||||
@ -572,7 +572,7 @@ export class EgwAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private updateAction(_data: Object) {
|
public updateAction(_data: Object) {
|
||||||
egwActionStoreJSON(_data, this, "data")
|
egwActionStoreJSON(_data, this, "data")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,6 +690,14 @@ export class EgwAction {
|
|||||||
set_hint(hint: string) {
|
set_hint(hint: string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public clone():EgwAction{
|
||||||
|
const clone:EgwAction = Object.assign(Object.create(Object.getPrototypeOf(this)), this)
|
||||||
|
clone.onExecute = this.onExecute.clone()
|
||||||
|
if(this.enabled){
|
||||||
|
clone.enabled = this.enabled.clone()
|
||||||
|
}
|
||||||
|
return clone
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -697,9 +697,9 @@ export class EgwPopupActionImplementation implements EgwActionImplementation {
|
|||||||
//replace jQuery with spread operator
|
//replace jQuery with spread operator
|
||||||
// set the Prototype of the copy set_onExecute is not available otherwise
|
// set the Prototype of the copy set_onExecute is not available otherwise
|
||||||
//TODO is this a valid/elegant way to do this??? give egwAction a methode clone -- make abstract parent class
|
//TODO is this a valid/elegant way to do this??? give egwAction a methode clone -- make abstract parent class
|
||||||
let drop_clone = {...drop[k].actionObj};
|
let drop_clone = drop[k].actionObj.clone()//Object.assign(Object.create(Object.getPrototypeOf(drop[k].actionObj)), drop[k].actionObj) //{...drop[k].actionObj};
|
||||||
//warning This method is really slow
|
//warning This method is really slow
|
||||||
Object.setPrototypeOf(drop_clone, EgwAction.prototype)
|
//Object.setPrototypeOf(drop_clone, EgwAction.prototype)
|
||||||
let parent = paste_action.parent === drop_clone.parent ? paste_action : (paste_action.getActionById(drop_clone.parent.id) || paste_action);
|
let parent = paste_action.parent === drop_clone.parent ? paste_action : (paste_action.getActionById(drop_clone.parent.id) || paste_action);
|
||||||
drop_clone.parent = parent;
|
drop_clone.parent = parent;
|
||||||
drop_clone.onExecute = new EgwFnct(this, null, []);
|
drop_clone.onExecute = new EgwFnct(this, null, []);
|
||||||
|
@ -297,6 +297,9 @@ export class EgwFnct
|
|||||||
this.isDefault = false
|
this.isDefault = false
|
||||||
this.setValue(_default)
|
this.setValue(_default)
|
||||||
}
|
}
|
||||||
|
public clone():EgwFnct{
|
||||||
|
return new EgwFnct(this.context,this.functionToPerform || this.value, this.acceptedTypes);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns true iff there is a function to perform and is not default
|
* @returns true iff there is a function to perform and is not default
|
||||||
|
@ -1130,7 +1130,7 @@ export class filemanagerAPP extends EgwApp
|
|||||||
};
|
};
|
||||||
for(let i = 0; i < actions.length; i++)
|
for(let i = 0; i < actions.length; i++)
|
||||||
{
|
{
|
||||||
_action.getActionById(actions[i].id).onExecute = jQuery.extend(true, {}, _action.onExecute);
|
_action.getActionById(actions[i].id).onExecute = _action.onExecute.clone();
|
||||||
|
|
||||||
_action.getActionById(actions[i].id).set_onExecute(paste_exec);
|
_action.getActionById(actions[i].id).set_onExecute(paste_exec);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user