mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-15 19:24:21 +02:00
allow "app.<appname>.<method>" in link registry and use it to open CRM view
This commit is contained in:
@ -300,42 +300,6 @@ var EgwApp = /** @class */ (function () {
|
||||
var id_app = _senders[0].id.split('::');
|
||||
egw.open(id_app[1], this.appname);
|
||||
};
|
||||
/**
|
||||
* Open a CRM view for a contact
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
* @param _contact_id default: use contact_id from data of _senders[0].id
|
||||
*/
|
||||
EgwApp.prototype.openCRMview = function (_action, _senders) {
|
||||
var contact_id = _senders;
|
||||
if (typeof _senders === 'object') {
|
||||
var data = egw.dataGetUIDdata(_senders[0].id);
|
||||
contact_id = data.data.contact_id;
|
||||
}
|
||||
if (typeof contact_id !== 'undefined') {
|
||||
var crm_list_1 = egw.preference('crm_list', 'addressbook');
|
||||
if (!crm_list_1 || crm_list_1 === '~edit~')
|
||||
crm_list_1 = 'infolog';
|
||||
var open_1 = function (_title) {
|
||||
var title = _title || this.egw.link_title('addressbook', contact_id, open_1);
|
||||
if (title) {
|
||||
this.egw.openTab(contact_id, 'addressbook', 'view', {
|
||||
crm_list: crm_list_1
|
||||
}, {
|
||||
displayName: title,
|
||||
icon: this.egw.link('/api/avatar.php', {
|
||||
contact_id: contact_id,
|
||||
etag: (new Date).valueOf() / 86400 | 0 // cache for a day, better then no invalidation
|
||||
}),
|
||||
refreshCallback: 'app.addressbook.view_refresh',
|
||||
id: contact_id + '-' + crm_list_1
|
||||
});
|
||||
}
|
||||
}.bind(this);
|
||||
open_1();
|
||||
}
|
||||
};
|
||||
EgwApp.prototype._do_action = function (action_id, selected) {
|
||||
};
|
||||
/**
|
||||
|
@ -436,47 +436,6 @@ export abstract class EgwApp
|
||||
egw.open(id_app[1], this.appname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a CRM view for a contact
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
* @param _contact_id default: use contact_id from data of _senders[0].id
|
||||
*/
|
||||
openCRMview(_action, _senders)
|
||||
{
|
||||
let contact_id = _senders;
|
||||
if (typeof _senders === 'object')
|
||||
{
|
||||
let data = egw.dataGetUIDdata(_senders[0].id);
|
||||
contact_id = data.data.contact_id;
|
||||
}
|
||||
if (typeof contact_id !== 'undefined')
|
||||
{
|
||||
let crm_list = egw.preference('crm_list', 'addressbook');
|
||||
if (!crm_list || crm_list === '~edit~') crm_list = 'infolog';
|
||||
let open = function(_title)
|
||||
{
|
||||
let title = _title || this.egw.link_title('addressbook', contact_id, open);
|
||||
if (title)
|
||||
{
|
||||
this.egw.openTab(contact_id,'addressbook', 'view', {
|
||||
crm_list: crm_list
|
||||
}, {
|
||||
displayName: title,
|
||||
icon: this.egw.link('/api/avatar.php', {
|
||||
contact_id: contact_id,
|
||||
etag: (new Date).valueOf()/86400|0 // cache for a day, better then no invalidation
|
||||
}),
|
||||
refreshCallback: 'app.addressbook.view_refresh',
|
||||
id: contact_id + '-'+crm_list
|
||||
});
|
||||
}
|
||||
}.bind(this);
|
||||
open();
|
||||
}
|
||||
}
|
||||
|
||||
_do_action(action_id : string, selected : [])
|
||||
{
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
{
|
||||
self.includeJS('/'+parts[1]+'/js/app.js', function ()
|
||||
{
|
||||
resolve(self.apply(_func, args));
|
||||
resolve(self.applyFunc(_func, args));
|
||||
}, self, self.webserverUrl);
|
||||
});
|
||||
}
|
||||
|
@ -187,7 +187,8 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
||||
// Copy, not get a reference, or we'll change the registry
|
||||
params = jQuery.extend({},app_registry[type]);
|
||||
}
|
||||
else if (typeof app_registry[type] === 'string' && app_registry[type].indexOf('javascript:') === 0)
|
||||
else if (typeof app_registry[type] === 'string' &&
|
||||
(app_registry[type].substr(0, 11) === 'javascript:' || app_registry[type].substr(0, 4) === 'app.'))
|
||||
{
|
||||
// JavaScript, just pass it on
|
||||
url = app_registry[type];
|
||||
@ -214,11 +215,16 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
||||
}
|
||||
popup = app_registry[type+'_popup'];
|
||||
}
|
||||
if(url.indexOf('javascript:') === 0)
|
||||
if (url.substr(0, 11) === 'javascript:')
|
||||
{
|
||||
// Add parameters into javascript
|
||||
url = 'javascript:var params = '+ JSON.stringify(params) + '; '+ url.substr(11);
|
||||
}
|
||||
// app.<appname>.<method>: call app method direct with parameter object as first parameter
|
||||
else if (url.substr(0, 4) === 'app.')
|
||||
{
|
||||
return this.callFunc(url, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = this.link(url, params);
|
||||
|
Reference in New Issue
Block a user