summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-10 10:39:25 +0200
committerAleksander Machniak <alec@alec.pl>2014-08-10 10:39:56 +0200
commitdddb9dee612e56298869422700aff0fba187a842 (patch)
tree4390219eb1cb0eba480ce2c4942972d9516ac169 /program
parentf5f056e7f213666d9e9556092795b07df8e8354d (diff)
Fix errors when adding/updating contacts in active search (#1490015)
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js6
-rw-r--r--program/steps/addressbook/edit.inc1
-rw-r--r--program/steps/addressbook/save.inc24
-rw-r--r--program/steps/addressbook/show.inc5
4 files changed, 27 insertions, 9 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 1cd09ded6..0a635c0dc 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4688,6 +4688,7 @@ function rcube_webmail()
this.list_contacts = function(src, group, page)
{
var win, folder, url = {},
+ refresh = src === undefined && group === undefined && page === undefined,
target = window;
if (!src)
@@ -4700,7 +4701,7 @@ function rcube_webmail()
page = this.env.current_page = 1;
this.reset_qsearch();
}
- else if (group != this.env.group)
+ else if (!refresh && group != this.env.group)
page = this.env.current_page = 1;
if (this.env.search_id)
@@ -4837,6 +4838,9 @@ function rcube_webmail()
if (this.env.group)
url._gid = this.env.group;
+ if (this.env.search_request)
+ url._search = this.env.search_request;
+
url._action = action;
url._source = this.env.source;
url._cid = cid;
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index 3bbbfccdf..5714457c1 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -253,6 +253,7 @@ function get_form_tags($attrib)
if ($RCMAIL->action == 'edit')
$hiddenfields->add(array('name' => '_source', 'value' => $SOURCE_ID));
$hiddenfields->add(array('name' => '_gid', 'value' => $CONTACTS->group_id));
+ $hiddenfields->add(array('name' => '_search', 'value' => rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC)));
if (($result = $CONTACTS->get_result()) && ($record = $result->first()))
$hiddenfields->add(array('name' => '_cid', 'value' => $record['ID']));
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 94556f96b..e0e38d4d9 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -148,6 +148,15 @@ if (!empty($cid)) {
$result = $plugin['result'];
if ($result) {
+ // show confirmation
+ $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
+
+ // in search mode, just reload the list (#1490015)
+ if ($_REQUEST['_search']) {
+ $OUTPUT->command('parent.command', 'list');
+ $OUTPUT->send('iframe');
+ }
+
// LDAP DN change
if (is_string($result) && strlen($result)>1) {
$newcid = $result;
@@ -168,8 +177,6 @@ if (!empty($cid)) {
// update the changed col in list
$OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source, $record);
- // show confirmation
- $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
$RCMAIL->overwrite_action('show');
}
else {
@@ -228,8 +235,11 @@ else {
$counts = $CONTACTS->count();
}
- if ((string)$source === (string)$orig_source) {
- // add contact row or jump to the page where it should appear
+ // show confirmation
+ $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
+
+ // add contact row to the list
+ if (empty($_REQUEST['_search']) && (string)$source === (string)$orig_source) {
$CONTACTS->reset();
$result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
@@ -240,13 +250,11 @@ else {
$CONTACTS->reset();
$OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text($counts));
}
+ // just refresh the list (#1490015)
else {
- // re-set iframe
- $OUTPUT->command('parent.show_contentframe');
+ $OUTPUT->command('parent.command', 'list');
}
- // show confirmation
- $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
$OUTPUT->send('iframe');
}
else {
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index d4bf2a4cc..2085c38cc 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -32,6 +32,11 @@ $SOURCE_ID = $source;
if ($cid && ($record = $CONTACTS->get_record($cid, true))) {
$OUTPUT->set_env('readonly', $CONTACTS->readonly || $record['readonly']);
$OUTPUT->set_env('cid', $record['ID']);
+
+ // remember current search request ID (if in search mode)
+ if ($search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GET)) {
+ $OUTPUT->set_env('search_request', $search);
+ }
}
// get address book name (for display)