summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js15
-rw-r--r--program/steps/addressbook/save.inc33
2 files changed, 35 insertions, 13 deletions
diff --git a/program/js/app.js b/program/js/app.js
index d26b0d5b4..6a35c596a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -637,7 +637,7 @@ function rcube_webmail()
}
// contacts/identities
else {
- //
+ // reload form
if (props == 'reload') {
form.action += '?_reload=1';
}
@@ -647,7 +647,7 @@ function rcube_webmail()
break;
}
else if (this.task == 'settings' && (this.env.identities_level % 2) == 0 &&
- (input = $("input[name='_email']", form)) && input.length&& !rcube_check_email(input.val())
+ (input = $("input[name='_email']", form)) && input.length && !rcube_check_email(input.val())
) {
alert(this.get_label('noemailwarning'));
input.focus();
@@ -658,6 +658,10 @@ function rcube_webmail()
$('input.placeholder').each(function(){ if (this.value == this._placeholder) this.value = ''; });
}
+ // add selected source (on the list)
+ if (parent.rcmail && parent.rcmail.env.source)
+ form.action = this.add_url(form.action, '_orig_source', parent.rcmail.env.source);
+
form.submit();
}
break;
@@ -3803,6 +3807,13 @@ function rcube_webmail()
add_url = '&_framed=1';
target = window.frames[this.env.contentframe];
this.show_contentframe(true);
+
+ // load dummy content
+ if (!cid) {
+ // unselect selected row(s)
+ this.contact_list.clear_selection();
+ this.enable_command('delete', 'compose', false);
+ }
}
else if (framed)
return false;
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index e1986efeb..a3fdde9f6 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -216,6 +216,8 @@ if (!empty($cid))
// insert a new contact
else {
+ $source = get_input_value('_source', RCUBE_INPUT_GPC);
+
// show notice if existing contacts with same e-mail are found
$existing = false;
foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) {
@@ -226,7 +228,7 @@ else {
}
$plugin = $RCMAIL->plugins->exec_hook('contact_create', array(
- 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
+ 'record' => $a_record, 'source' => $source));
$a_record = $plugin['record'];
// insert record and send response
@@ -235,11 +237,11 @@ else {
else
$insert_id = $plugin['result'];
-
if ($insert_id) {
// add new contact to the specified group
if ($CONTACTS->groups && $CONTACTS->group_id) {
- $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
+ $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array(
+ 'group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
if (!$plugin['abort']) {
if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum))
@@ -249,16 +251,25 @@ else {
}
}
- // add contact row or jump to the page where it should appear
- $CONTACTS->reset();
- $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
+ // Name of the addressbook already selected on the list
+ $orig_source = get_input_value('_orig_source', RCUBE_INPUT_GPC);
+
+ if ((string)$source === (string)$orig_source) {
+ // add contact row or jump to the page where it should appear
+ $CONTACTS->reset();
+ $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
- rcmail_js_contacts_list($result, 'parent.');
- $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id));
+ rcmail_js_contacts_list($result, 'parent.');
+ $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id));
- // update record count display
- $CONTACTS->reset();
- $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text());
+ // update record count display
+ $CONTACTS->reset();
+ $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text());
+ }
+ else {
+ // re-set iframe
+ $OUTPUT->command('parent.show_contentframe');
+ }
// show confirmation
$OUTPUT->show_message('successfullysaved', 'confirmation', null, false);