Get edit dialog name popup working in et2

This commit is contained in:
Nathan Gray 2013-06-19 19:02:41 +00:00
parent eaa0cb6fa0
commit d189b005df
2 changed files with 26 additions and 6 deletions

View File

@ -2011,6 +2011,8 @@ class addressbook_ui extends addressbook_bo
{
// only set fileas-options if other then email changed
$ret['fileas_options'] = array_values($this->fileas_options($values));
// Full options for et2
$ret['fileas_sel_options'] = $this->fileas_options($values);
// if name, firstname or org changed and at least 2 are specified, check for doublicates
if (in_array($name, array('n_given', 'n_family', 'org_name')) &&

View File

@ -102,16 +102,30 @@ function getElement(form,pattern)
function check_value(input, own_id)
{
var values = egw_json_getFormValues(input.form).exec; // todo use eT2 method, if running under et2
if(typeof values == 'undefined' && typeof etemplate2 != 'undefined') {
var template = etemplate2.getByApplication('addressbook')[0];
values = template.getValues(template.widgetContainer);
}
if (input.name.match(/n_/))
{
var value = '';
if (values.n_prefix) value += values.n_prefix+" ";
if (values.n_given) value += values.n_given+" ";
if (values.n_middle) value += values.n_middle+" ";
if (values.n_family) value += values.n_family+" ";
if (values.n_suffix) value += values.n_suffix;
var name = document.getElementById("exec[n_fn]");
name.value = "";
if (values.n_prefix) name.value += values.n_prefix+" ";
if (values.n_given) name.value += values.n_given+" ";
if (values.n_middle) name.value += values.n_middle+" ";
if (values.n_family) name.value += values.n_family+" ";
if (values.n_suffix) name.value += values.n_suffix;
if(name == null && template)
{
name = template.widgetContainer.getWidgetById('n_fn');
name.set_value(value);
}
else
{
name.value = value;
}
}
var req = new egw_json_request('addressbook.addressbook_ui.ajax_check_values', [values, input.name, own_id]);
req.sendRequest(true, function(data) {
@ -133,6 +147,10 @@ function check_value(input, own_id)
selbox.options[i].text = data.fileas_options[i];
}
}
else
{
template.widgetContainer.getWidgetById('fileas_type').set_select_options(data.fileas_sel_options);
}
}
});
}