diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/js/app.js | 8 | ||||
-rw-r--r-- | program/steps/addressbook/import.inc | 13 | ||||
-rw-r--r-- | skins/default/templates/addressbook.html | 2 |
4 files changed, 15 insertions, 9 deletions
@@ -1,6 +1,7 @@ CHANGELOG RoundCube Webmail =========================== +- Import contacts into the selected address book (by Phil Weir) - Add support for MDB2's 'sqlsrv' driver (#1486395) - Use jQuery-1.4 - Removed problematic browser-caching of messages diff --git a/program/js/app.js b/program/js/app.js index a02df7853..fc24a77d8 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -305,7 +305,7 @@ function rcube_webmail() this.set_page_buttons(); if (this.env.address_sources && this.env.address_sources[this.env.source] && !this.env.address_sources[this.env.source].readonly) - this.enable_command('add', true); + this.enable_command('add', 'import', true); if (this.env.cid) this.enable_command('show', 'edit', true); @@ -313,7 +313,7 @@ function rcube_webmail() if ((this.env.action=='add' || this.env.action=='edit') && this.gui_objects.editform) this.enable_command('save', true); else - this.enable_command('search', 'reset-search', 'moveto', 'import', true); + this.enable_command('search', 'reset-search', 'moveto', true); if (this.contact_list && this.contact_list.rowcount > 0) this.enable_command('export', true); @@ -608,7 +608,7 @@ function rcube_webmail() this.reset_qsearch(); this.list_contacts(props); - this.enable_command('add', (this.env.address_sources && !this.env.address_sources[props].readonly)); + this.enable_command('add', 'import', (this.env.address_sources && !this.env.address_sources[props].readonly)); } break; @@ -1075,7 +1075,7 @@ function rcube_webmail() this.lock_form(this.gui_objects.importform, true); } else - this.goto_url('import'); + this.goto_url('import', (this.env.source ? '_target='+urlencode(this.env.source)+'&' : '')); break; case 'export': diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 1d5b00e1a..ace9ad32d 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -25,11 +25,15 @@ function rcmail_import_form($attrib) { global $RCMAIL, $OUTPUT; + $target = get_input_value('_target', RCUBE_INPUT_GPC); $attrib += array('id' => "rcmImportForm"); + $abook = new html_hiddenfield(array('name' => '_target', 'value' => $target)); + $form = $abook->show(); + $upload = new html_inputfield(array('type' => 'file', 'name' => '_file', 'id' => 'rcmimportfile', 'size' => 40)); - $form = html::p(null, html::label('rcmimportfile', rcube_label('importfromfile')) . html::br() . $upload->show()); + $form .= html::p(null, html::label('rcmimportfile', rcube_label('importfromfile')) . html::br() . $upload->show()); $check_replace = new html_checkbox(array('name' => '_replace', 'value' => 1, 'id' => 'rcmimportreplace')); $form .= html::p(null, $check_replace->show(get_input_value('_replace', RCUBE_INPUT_GPC)) . @@ -74,13 +78,14 @@ function rcmail_import_confirm($attrib) function rcmail_import_buttons($attrib) { global $IMPORT_STATS, $OUTPUT; + $target = get_input_value('_target', RCUBE_INPUT_GPC); $attrib += array('type' => 'input'); unset($attrib['name']); if (is_object($IMPORT_STATS)) { $attrib['class'] = trim($attrib['class'] . ' mainaction'); - $out = $OUTPUT->button(array('command' => 'list', 'label' => 'done') + $attrib); + $out = $OUTPUT->button(array('command' => 'list', 'prop' => $target, 'label' => 'done') + $attrib); } else { $out = $OUTPUT->button(array('command' => 'list', 'label' => 'cancel') + $attrib); @@ -98,9 +103,9 @@ function rcmail_import_buttons($attrib) $importstep = 'rcmail_import_form'; if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name'])) { - $replace = (bool)get_input_value('_replace', RCUBE_INPUT_GPC); - $CONTACTS = $RCMAIL->get_address_book(null, true); + $target = get_input_value('_target', RCUBE_INPUT_GPC); + $CONTACTS = $RCMAIL->get_address_book($target, true); // let rcube_vcard do the hard work :-) $vcards = rcube_vcard::import(file_get_contents($_FILES['_file']['tmp_name'])); diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html index 28bfb8637..fe9019208 100644 --- a/skins/default/templates/addressbook.html +++ b/skins/default/templates/addressbook.html @@ -30,7 +30,7 @@ <roundcube:include file="/includes/header.html" /> <div id="abooktoolbar"> -<roundcube:button command="add" type="link" class="button addcontact" classAct="button addcontact" classSel="button addcontactSel" title="newcontact" content=" " /> +<roundcube:button command="add" type="link" class="buttonPas addcontact" classAct="button addcontact" classSel="button addcontactSel" title="newcontact" content=" " /> <roundcube:button command="compose" type="link" class="buttonPas compose" classAct="button compose" classSel="button composeSel" title="composeto" content=" " /> <roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletecontact" content=" " /> <span class="separator"> </span> |