mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Addressbook: Add selectbox for addressbook to Add distribution list dialog
This commit is contained in:
parent
82215f292d
commit
d89b92f27b
@ -527,18 +527,19 @@ var AddressbookApp = /** @class */ (function (_super) {
|
|||||||
*/
|
*/
|
||||||
AddressbookApp.prototype._add_new_list_prompt = function (owner, contacts) {
|
AddressbookApp.prototype._add_new_list_prompt = function (owner, contacts) {
|
||||||
var lists = this.et2.getWidgetById('filter2');
|
var lists = this.et2.getWidgetById('filter2');
|
||||||
et2_dialog.show_prompt(function (button, name) {
|
var owner_options = this.et2.getArrayMgr('sel_options').getEntry('filter') || {};
|
||||||
|
var callback = function (button, values) {
|
||||||
if (button == et2_dialog.OK_BUTTON) {
|
if (button == et2_dialog.OK_BUTTON) {
|
||||||
egw.json('addressbook.addressbook_ui.ajax_set_list', [0, name, owner, contacts], function (result) {
|
egw.json('addressbook.addressbook_ui.ajax_set_list', [0, values.name, values.owner, contacts], function (result) {
|
||||||
if (typeof result == 'object')
|
if (typeof result == 'object')
|
||||||
return; // This response not for us
|
return; // This response not for us
|
||||||
// Update list
|
// Update list
|
||||||
if (result) {
|
if (result) {
|
||||||
lists.options.select_options.unshift({ value: result, label: name });
|
lists.options.select_options.unshift({ value: result, label: values.name });
|
||||||
lists.set_select_options(lists.options.select_options);
|
lists.set_select_options(lists.options.select_options);
|
||||||
// Set to new list so they can see it easily
|
// Set to new list so they can see it easily
|
||||||
lists.set_value(result);
|
lists.set_value(result);
|
||||||
// Call cahnge event manually after setting the value
|
// Call change event manually after setting the value
|
||||||
// Not sure why our selectbox does not trigger change event
|
// Not sure why our selectbox does not trigger change event
|
||||||
jQuery(lists.node).change();
|
jQuery(lists.node).change();
|
||||||
}
|
}
|
||||||
@ -547,12 +548,28 @@ var AddressbookApp = /** @class */ (function (_super) {
|
|||||||
var dist_lists = null;
|
var dist_lists = null;
|
||||||
if (addressbook_actions && (dist_lists = addressbook_actions.getActionById('to_list'))) {
|
if (addressbook_actions && (dist_lists = addressbook_actions.getActionById('to_list'))) {
|
||||||
var id = 'to_list_' + result;
|
var id = 'to_list_' + result;
|
||||||
var action = dist_lists.addAction('popup', id, name);
|
var action = dist_lists.addAction('popup', id, values.name);
|
||||||
action.updateAction({ group: 1 });
|
action.updateAction({ group: 1 });
|
||||||
}
|
}
|
||||||
}).sendRequest(true);
|
}).sendRequest(true);
|
||||||
}
|
}
|
||||||
}, this.egw.lang('Name for the distribution list'), this.egw.lang('Add a new list'));
|
};
|
||||||
|
var dialog = et2_createWidget("dialog", {
|
||||||
|
callback: callback,
|
||||||
|
title: this.egw.lang('Add a new list'),
|
||||||
|
buttons: et2_dialog.BUTTONS_OK_CANCEL,
|
||||||
|
value: {
|
||||||
|
content: {
|
||||||
|
owner: owner
|
||||||
|
},
|
||||||
|
sel_options: {
|
||||||
|
owner: owner_options
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: egw.webserverUrl + '/addressbook/templates/default/add_list_dialog.xet',
|
||||||
|
class: "et2_prompt",
|
||||||
|
minWidth: 400
|
||||||
|
}, this.et2);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Rename the current distribution list selected in the nextmatch filter2
|
* Rename the current distribution list selected in the nextmatch filter2
|
||||||
|
@ -626,24 +626,24 @@ class AddressbookApp extends EgwApp
|
|||||||
*/
|
*/
|
||||||
_add_new_list_prompt(owner, contacts)
|
_add_new_list_prompt(owner, contacts)
|
||||||
{
|
{
|
||||||
var lists = this.et2.getWidgetById('filter2');
|
var lists = <et2_selectbox><unknown>this.et2.getWidgetById('filter2');
|
||||||
et2_dialog.show_prompt(
|
let owner_options = this.et2.getArrayMgr('sel_options').getEntry('filter') || {};
|
||||||
function(button, name) {
|
let callback = function(button, values) {
|
||||||
if(button == et2_dialog.OK_BUTTON)
|
if(button == et2_dialog.OK_BUTTON)
|
||||||
{
|
{
|
||||||
egw.json('addressbook.addressbook_ui.ajax_set_list',[0, name, owner, contacts],
|
egw.json('addressbook.addressbook_ui.ajax_set_list',[0, values.name, values.owner, contacts],
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
if(typeof result == 'object') return; // This response not for us
|
if(typeof result == 'object') return; // This response not for us
|
||||||
// Update list
|
// Update list
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
lists.options.select_options.unshift({value:result,label:name});
|
lists.options.select_options.unshift({value:result,label:values.name});
|
||||||
lists.set_select_options(lists.options.select_options);
|
lists.set_select_options(lists.options.select_options);
|
||||||
|
|
||||||
// Set to new list so they can see it easily
|
// Set to new list so they can see it easily
|
||||||
lists.set_value(result);
|
lists.set_value(result);
|
||||||
// Call cahnge event manually after setting the value
|
// Call change event manually after setting the value
|
||||||
// Not sure why our selectbox does not trigger change event
|
// Not sure why our selectbox does not trigger change event
|
||||||
jQuery(lists.node).change();
|
jQuery(lists.node).change();
|
||||||
}
|
}
|
||||||
@ -656,17 +656,32 @@ class AddressbookApp extends EgwApp
|
|||||||
var action = dist_lists.addAction(
|
var action = dist_lists.addAction(
|
||||||
'popup',
|
'popup',
|
||||||
id,
|
id,
|
||||||
name
|
values.name
|
||||||
);
|
);
|
||||||
action.updateAction({group: 1});
|
action.updateAction({group: 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).sendRequest(true);
|
).sendRequest(true);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
let dialog = et2_createWidget("dialog", {
|
||||||
|
callback: callback,
|
||||||
|
title: this.egw.lang('Add a new list'),
|
||||||
|
buttons: et2_dialog.BUTTONS_OK_CANCEL,
|
||||||
|
value: {
|
||||||
|
content: {
|
||||||
|
owner: owner
|
||||||
},
|
},
|
||||||
this.egw.lang('Name for the distribution list'),
|
sel_options: {
|
||||||
this.egw.lang('Add a new list')
|
owner: owner_options
|
||||||
);
|
}
|
||||||
|
},
|
||||||
|
template: egw.webserverUrl + '/addressbook/templates/default/add_list_dialog.xet',
|
||||||
|
class: "et2_prompt",
|
||||||
|
minWidth: 400
|
||||||
|
}, this.et2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
23
addressbook/templates/default/add_list_dialog.xet
Normal file
23
addressbook/templates/default/add_list_dialog.xet
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?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="addressbook.add_list_dialog" template="" lang="" group="0" version="">
|
||||||
|
<grid>
|
||||||
|
<columns>
|
||||||
|
<column/>
|
||||||
|
<column/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<description value="Name for the distribution list"/>
|
||||||
|
<textbox id="name"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<description value="Addressbook"/>
|
||||||
|
<select id="owner"/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
Loading…
Reference in New Issue
Block a user