diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-12-31 13:58:29 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-12-31 13:58:29 +0100 |
commit | f5d2eef55c89b7f1a5549704705c25fd7f0c0185 (patch) | |
tree | cadb85945d32237ea37d50ad0b8d400d6b19d2e2 /program/steps/addressbook | |
parent | ddc161721cdec783d58b43a265854b4eac388c13 (diff) |
More CS fixes, replace global $CONFIG usage with $RCMAIL->config->get()
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r-- | program/steps/addressbook/copy.inc | 5 | ||||
-rw-r--r-- | program/steps/addressbook/delete.inc | 5 | ||||
-rw-r--r-- | program/steps/addressbook/edit.inc | 35 | ||||
-rw-r--r-- | program/steps/addressbook/export.inc | 84 | ||||
-rw-r--r-- | program/steps/addressbook/func.inc | 49 | ||||
-rw-r--r-- | program/steps/addressbook/import.inc | 314 | ||||
-rw-r--r-- | program/steps/addressbook/mailto.inc | 21 | ||||
-rw-r--r-- | program/steps/addressbook/show.inc | 20 | ||||
-rw-r--r-- | program/steps/addressbook/undo.inc | 8 |
9 files changed, 267 insertions, 274 deletions
diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc index 9af22ec35..9114cb1fd 100644 --- a/program/steps/addressbook/copy.inc +++ b/program/steps/addressbook/copy.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/copy.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2007, The Roundcube Dev Team | + | Copyright (C) 2007-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -32,8 +32,7 @@ $success = 0; $errormsg = 'copyerror'; $maxnum = $RCMAIL->config->get('max_group_members', 0); -foreach ($cids as $source => $cid) -{ +foreach ($cids as $source => $cid) { // Something wrong, target not specified if (!strlen($target)) { break; diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc index b2aac8a71..3d57d7074 100644 --- a/program/steps/addressbook/delete.inc +++ b/program/steps/addressbook/delete.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/delete.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2009, The Roundcube Dev Team | + | Copyright (C) 2005-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -30,8 +30,7 @@ $delcnt = 0; $undo_time = $RCMAIL->config->get('undo_timeout', 0); $RCMAIL->session->remove('contact_undo'); -foreach ($cids as $source => $cid) -{ +foreach ($cids as $source => $cid) { $CONTACTS = rcmail_contact_source($source); if ($CONTACTS->readonly) { diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index f7f0c7100..3bbbfccdf 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -59,6 +59,25 @@ else { $SOURCE_ID = $source; rcmail_set_sourcename($CONTACTS); + +$OUTPUT->add_handlers(array( + 'contactedithead' => 'rcmail_contact_edithead', + 'contacteditform' => 'rcmail_contact_editform', + 'contactphoto' => 'rcmail_contact_photo', + 'photouploadform' => 'rcmail_upload_photo_form', + 'sourceselector' => 'rcmail_source_selector', + 'filedroparea' => 'rcmail_photo_drop_area', +)); + +if ($RCMAIL->action == 'add' && $OUTPUT->template_exists('contactadd')) { + $OUTPUT->send('contactadd'); +} + +// this will be executed if no template for addcontact exists +$OUTPUT->send('contactedit'); + + + function rcmail_get_edit_record() { global $RCMAIL, $CONTACTS; @@ -289,19 +308,3 @@ function rcmail_photo_drop_area($attrib) $OUTPUT->set_env('filedrop', array('action' => 'upload-photo', 'fieldname' => '_photo', 'single' => 1, 'filter' => '^image/.+')); } } - - -$OUTPUT->add_handlers(array( - 'contactedithead' => 'rcmail_contact_edithead', - 'contacteditform' => 'rcmail_contact_editform', - 'contactphoto' => 'rcmail_contact_photo', - 'photouploadform' => 'rcmail_upload_photo_form', - 'sourceselector' => 'rcmail_source_selector', - 'filedroparea' => 'rcmail_photo_drop_area', -)); - -if ($RCMAIL->action == 'add' && $OUTPUT->template_exists('contactadd')) - $OUTPUT->send('contactadd'); - -// this will be executed if no template for addcontact exists -$OUTPUT->send('contactedit'); diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc index c112f08a3..2b45e5cd1 100644 --- a/program/steps/addressbook/export.inc +++ b/program/steps/addressbook/export.inc @@ -6,7 +6,7 @@ | | | This file is part of the Roundcube Webmail client | | Copyright (C) 2008-2013, The Roundcube Dev Team | - | Copyright (C) 2011, Kolab Systems AG | + | Copyright (C) 2011-2013, Kolab Systems AG | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -21,49 +21,8 @@ +-----------------------------------------------------------------------+ */ - -/** - * Copy contact record properties into a vcard object - */ -function prepare_for_export(&$record, $source = null) -{ - $groups = $source && $source->groups && $source->export_groups ? $source->get_record_groups($record['ID']) : null; - - if (empty($record['vcard'])) { - $vcard = new rcube_vcard(); - if ($source) { - $vcard->extend_fieldmap($source->vcard_map); - } - $vcard->load($record['vcard']); - $vcard->reset(); - - foreach ($record as $key => $values) { - list($field, $section) = explode(':', $key); - foreach ((array)$values as $value) { - if (is_array($value) || @strlen($value)) { - $vcard->set($field, $value, strtoupper($section)); - } - } - } - - // append group names - if ($groups) { - $vcard->set('groups', join(',', $groups), null); - } - - $record['vcard'] = $vcard->export(true); - } - // patch categories to alread existing vcard block - else if ($record['vcard'] && !empty($groups) && !strpos($record['vcard'], 'CATEGORIES:')) { - $vgroups = 'CATEGORIES:' . rcube_vcard::vcard_quote(join(',', $groups)); - $record['vcard'] = str_replace('END:VCARD', $vgroups . rcube_vcard::$eol . 'END:VCARD', $record['vcard']); - } -} - - // Use search result -if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) -{ +if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) { $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); $search = (array)$_SESSION['search'][$_REQUEST['_search']]; $records = array(); @@ -153,3 +112,42 @@ while ($result && ($row = $result->next())) { } exit; + + +/** + * Copy contact record properties into a vcard object + */ +function prepare_for_export(&$record, $source = null) +{ + $groups = $source && $source->groups && $source->export_groups ? $source->get_record_groups($record['ID']) : null; + + if (empty($record['vcard'])) { + $vcard = new rcube_vcard(); + if ($source) { + $vcard->extend_fieldmap($source->vcard_map); + } + $vcard->load($record['vcard']); + $vcard->reset(); + + foreach ($record as $key => $values) { + list($field, $section) = explode(':', $key); + foreach ((array)$values as $value) { + if (is_array($value) || @strlen($value)) { + $vcard->set($field, $value, strtoupper($section)); + } + } + } + + // append group names + if ($groups) { + $vcard->set('groups', join(',', $groups), null); + } + + $record['vcard'] = $vcard->export(true); + } + // patch categories to alread existing vcard block + else if ($record['vcard'] && !empty($groups) && !strpos($record['vcard'], 'CATEGORIES:')) { + $vgroups = 'CATEGORIES:' . rcube_vcard::vcard_quote(join(',', $groups)); + $record['vcard'] = str_replace('END:VCARD', $vgroups . rcube_vcard::$eol . 'END:VCARD', $record['vcard']); + } +} diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 8be721c0b..b33396baf 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -109,6 +109,31 @@ if ($undo = $_SESSION['contact_undo']) { $RCMAIL->session->remove('contact_undo'); } +// register UI objects +$OUTPUT->add_handlers(array( + 'directorylist' => 'rcmail_directory_list', +// 'groupslist' => 'rcmail_contact_groups', + 'addresslist' => 'rcmail_contacts_list', + 'addresslisttitle' => 'rcmail_contacts_list_title', + 'addressframe' => 'rcmail_contact_frame', + 'recordscountdisplay' => 'rcmail_rowcount_display', + 'searchform' => array($OUTPUT, 'search_form') +)); + +// register action aliases +$RCMAIL->register_action_map(array( + 'add' => 'edit.inc', + 'group-create' => 'groups.inc', + 'group-rename' => 'groups.inc', + 'group-delete' => 'groups.inc', + 'group-addmembers' => 'groups.inc', + 'group-delmembers' => 'groups.inc', + 'search-create' => 'search.inc', + 'search-delete' => 'search.inc', +)); + + + // instantiate a contacts object according to the given source function rcmail_contact_source($source=null, $init_env=false, $writable=false) { @@ -895,27 +920,3 @@ function rcmail_get_cids($filter = null) return $filter !== null ? $result[$filter] : $result; } - - -// register UI objects -$OUTPUT->add_handlers(array( - 'directorylist' => 'rcmail_directory_list', -// 'groupslist' => 'rcmail_contact_groups', - 'addresslist' => 'rcmail_contacts_list', - 'addresslisttitle' => 'rcmail_contacts_list_title', - 'addressframe' => 'rcmail_contact_frame', - 'recordscountdisplay' => 'rcmail_rowcount_display', - 'searchform' => array($OUTPUT, 'search_form') -)); - -// register action aliases -$RCMAIL->register_action_map(array( - 'add' => 'edit.inc', - 'group-create' => 'groups.inc', - 'group-rename' => 'groups.inc', - 'group-delete' => 'groups.inc', - 'group-addmembers' => 'groups.inc', - 'group-delmembers' => 'groups.inc', - 'search-create' => 'search.inc', - 'search-delete' => 'search.inc', -)); diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 600ba8301..33e473242 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -20,164 +20,6 @@ +-----------------------------------------------------------------------+ */ -/** - * Handler function to display the import/upload form - */ -function rcmail_import_form($attrib) -{ - global $RCMAIL, $OUTPUT; - - $target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC); - - $attrib += array('id' => "rcmImportForm"); - - $writable_books = $RCMAIL->get_address_sources(true, true); - - $upload = new html_inputfield(array( - 'type' => 'file', - 'name' => '_file[]', - 'id' => 'rcmimportfile', - 'size' => 40, - 'multiple' => 'multiple', - )); - $form = html::p(null, html::label('rcmimportfile', $RCMAIL->gettext('importfromfile')) . $upload->show()); - $table = new html_table(array('cols' => 2)); - - // addressbook selector - if (count($writable_books) > 1) { - $select = new html_select(array('name' => '_target', 'id' => 'rcmimporttarget', 'is_escaped' => true)); - - foreach ($writable_books as $book) { - $select->add($book['name'], $book['id']); - } - - $table->add('title', html::label('rcmimporttarget', $RCMAIL->gettext('importtarget'))); - $table->add(null, $select->show($target)); - } - else { - $abook = new html_hiddenfield(array('name' => '_target', 'value' => key($writable_books))); - $form .= $abook->show(); - } - - // selector for group import options - if (count($writable_books) >= 1 || $writable_books[0]->groups) { - $select = new html_select(array('name' => '_groups', 'id' => 'rcmimportgroups', 'is_escaped' => true)); - $select->add($RCMAIL->gettext('none'), '0'); - $select->add($RCMAIL->gettext('importgroupsall'), '1'); - $select->add($RCMAIL->gettext('importgroupsexisting'), '2'); - - $table->add('title', html::label('rcmimportgroups', $RCMAIL->gettext('importgroups'))); - $table->add(null, $select->show(rcube_utils::get_input_value('_groups', rcube_utils::INPUT_GPC))); - } - - // checkbox to replace the entire address book - $check_replace = new html_checkbox(array('name' => '_replace', 'value' => 1, 'id' => 'rcmimportreplace')); - $table->add('title', html::label('rcmimportreplace', $RCMAIL->gettext('importreplace'))); - $table->add(null, $check_replace->show(rcube_utils::get_input_value('_replace', rcube_utils::INPUT_GPC))); - - $form .= $table->show(array('id' => null) + $attrib); - - $OUTPUT->set_env('writable_source', !empty($writable_books)); - $OUTPUT->add_label('selectimportfile','importwait'); - $OUTPUT->add_gui_object('importform', $attrib['id']); - - $out = html::p(null, rcube::Q($RCMAIL->gettext('importdesc'), 'show')) - . $OUTPUT->form_tag(array( - 'action' => $RCMAIL->url('import'), - 'method' => 'post', - 'enctype' => 'multipart/form-data') + $attrib, - $form); - - return $out; -} - - -/** - * Render the confirmation page for the import process - */ -function rcmail_import_confirm($attrib) -{ - global $IMPORT_STATS, $RCMAIL; - - $vars = get_object_vars($IMPORT_STATS); - $vars['names'] = $vars['skipped_names'] = ''; - - $content = html::p(null, $RCMAIL->gettext(array( - 'name' => 'importconfirm', - 'nr' => $IMPORT_STATS->inserted, - 'vars' => $vars, - )) . ($IMPORT_STATS->names ? ':' : '.')); - - if ($IMPORT_STATS->names) { - $content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->names))); - } - - if ($IMPORT_STATS->skipped) { - $content .= html::p(null, $RCMAIL->gettext(array( - 'name' => 'importconfirmskipped', - 'nr' => $IMPORT_STATS->skipped, - 'vars' => $vars, - )) . ':') - . html::p('em', join(', ', array_map('Q', $IMPORT_STATS->skipped_names))); - } - - return html::div($attrib, $content); -} - - -/** - * Create navigation buttons for the current import step - */ -function rcmail_import_buttons($attrib) -{ - global $IMPORT_STATS, $OUTPUT; - - $target = rcube_utils::get_input_value('_target', rcube_utils::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', 'prop' => $target, 'label' => 'done') + $attrib); - } - else { - $out = $OUTPUT->button(array('command' => 'list', 'label' => 'cancel') + $attrib); - $out .= ' '; - $attrib['class'] = trim($attrib['class'] . ' mainaction'); - $out .= $OUTPUT->button(array('command' => 'import', 'label' => 'import') + $attrib); - } - - return $out; -} - - -/** - * Returns the matching group id. If group doesn't exist, it'll be created if allowed. - */ -function rcmail_import_group_id($group_name, $CONTACTS, $create, &$import_groups) -{ - $group_id = 0; - foreach ($import_groups as $key => $group) { - if (strtolower($group['name']) == strtolower($group_name)) { - $group_id = $group['ID']; - break; - } - } - - // create a new group - if (!$group_id && $create) { - $new_group = $CONTACTS->create_group($group_name); - if (!$new_group['ID']) - $new_group['ID'] = $new_group['id']; - $import_groups[] = $new_group; - $group_id = $new_group['ID']; - } - - return $group_id; -} - - /** The import process **/ $importstep = 'rcmail_import_form'; @@ -343,3 +185,159 @@ $OUTPUT->add_handlers(array( // render page $OUTPUT->send('importcontacts'); + + + +/** + * Handler function to display the import/upload form + */ +function rcmail_import_form($attrib) +{ + global $RCMAIL, $OUTPUT; + + $target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC); + + $attrib += array('id' => "rcmImportForm"); + + $writable_books = $RCMAIL->get_address_sources(true, true); + + $upload = new html_inputfield(array( + 'type' => 'file', + 'name' => '_file[]', + 'id' => 'rcmimportfile', + 'size' => 40, + 'multiple' => 'multiple', + )); + $form = html::p(null, html::label('rcmimportfile', $RCMAIL->gettext('importfromfile')) . $upload->show()); + $table = new html_table(array('cols' => 2)); + + // addressbook selector + if (count($writable_books) > 1) { + $select = new html_select(array('name' => '_target', 'id' => 'rcmimporttarget', 'is_escaped' => true)); + + foreach ($writable_books as $book) { + $select->add($book['name'], $book['id']); + } + + $table->add('title', html::label('rcmimporttarget', $RCMAIL->gettext('importtarget'))); + $table->add(null, $select->show($target)); + } + else { + $abook = new html_hiddenfield(array('name' => '_target', 'value' => key($writable_books))); + $form .= $abook->show(); + } + + // selector for group import options + if (count($writable_books) >= 1 || $writable_books[0]->groups) { + $select = new html_select(array('name' => '_groups', 'id' => 'rcmimportgroups', 'is_escaped' => true)); + $select->add($RCMAIL->gettext('none'), '0'); + $select->add($RCMAIL->gettext('importgroupsall'), '1'); + $select->add($RCMAIL->gettext('importgroupsexisting'), '2'); + + $table->add('title', html::label('rcmimportgroups', $RCMAIL->gettext('importgroups'))); + $table->add(null, $select->show(rcube_utils::get_input_value('_groups', rcube_utils::INPUT_GPC))); + } + + // checkbox to replace the entire address book + $check_replace = new html_checkbox(array('name' => '_replace', 'value' => 1, 'id' => 'rcmimportreplace')); + $table->add('title', html::label('rcmimportreplace', $RCMAIL->gettext('importreplace'))); + $table->add(null, $check_replace->show(rcube_utils::get_input_value('_replace', rcube_utils::INPUT_GPC))); + + $form .= $table->show(array('id' => null) + $attrib); + + $OUTPUT->set_env('writable_source', !empty($writable_books)); + $OUTPUT->add_label('selectimportfile','importwait'); + $OUTPUT->add_gui_object('importform', $attrib['id']); + + $out = html::p(null, rcube::Q($RCMAIL->gettext('importdesc'), 'show')) + . $OUTPUT->form_tag(array( + 'action' => $RCMAIL->url('import'), + 'method' => 'post', + 'enctype' => 'multipart/form-data') + $attrib, + $form); + + return $out; +} + +/** + * Render the confirmation page for the import process + */ +function rcmail_import_confirm($attrib) +{ + global $IMPORT_STATS, $RCMAIL; + + $vars = get_object_vars($IMPORT_STATS); + $vars['names'] = $vars['skipped_names'] = ''; + + $content = html::p(null, $RCMAIL->gettext(array( + 'name' => 'importconfirm', + 'nr' => $IMPORT_STATS->inserted, + 'vars' => $vars, + )) . ($IMPORT_STATS->names ? ':' : '.')); + + if ($IMPORT_STATS->names) { + $content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->names))); + } + + if ($IMPORT_STATS->skipped) { + $content .= html::p(null, $RCMAIL->gettext(array( + 'name' => 'importconfirmskipped', + 'nr' => $IMPORT_STATS->skipped, + 'vars' => $vars, + )) . ':') + . html::p('em', join(', ', array_map('Q', $IMPORT_STATS->skipped_names))); + } + + return html::div($attrib, $content); +} + +/** + * Create navigation buttons for the current import step + */ +function rcmail_import_buttons($attrib) +{ + global $IMPORT_STATS, $OUTPUT; + + $target = rcube_utils::get_input_value('_target', rcube_utils::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', 'prop' => $target, 'label' => 'done') + $attrib); + } + else { + $out = $OUTPUT->button(array('command' => 'list', 'label' => 'cancel') + $attrib); + $out .= ' '; + $attrib['class'] = trim($attrib['class'] . ' mainaction'); + $out .= $OUTPUT->button(array('command' => 'import', 'label' => 'import') + $attrib); + } + + return $out; +} + +/** + * Returns the matching group id. If group doesn't exist, it'll be created if allowed. + */ +function rcmail_import_group_id($group_name, $CONTACTS, $create, &$import_groups) +{ + $group_id = 0; + foreach ($import_groups as $key => $group) { + if (strtolower($group['name']) == strtolower($group_name)) { + $group_id = $group['ID']; + break; + } + } + + // create a new group + if (!$group_id && $create) { + $new_group = $CONTACTS->create_group($group_name); + if (!$new_group['ID']) + $new_group['ID'] = $new_group['id']; + $import_groups[] = $new_group; + $group_id = $new_group['ID']; + } + + return $group_id; +} diff --git a/program/steps/addressbook/mailto.inc b/program/steps/addressbook/mailto.inc index 7116e55b7..f5ff20bc0 100644 --- a/program/steps/addressbook/mailto.inc +++ b/program/steps/addressbook/mailto.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/mailto.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2007, The Roundcube Dev Team | + | Copyright (C) 2007-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -19,24 +19,21 @@ +-----------------------------------------------------------------------+ */ -$cids = rcmail_get_cids(); -$mailto = array(); +$cids = rcmail_get_cids(); +$mailto = array(); $recipients = null; -foreach ($cids as $source => $cid) -{ +foreach ($cids as $source => $cid) { $CONTACTS = $RCMAIL->get_address_book($source); - if ($CONTACTS->ready) - { + if ($CONTACTS->ready) { $CONTACTS->set_page(1); $CONTACTS->set_pagesize(count($cid) + 2); // +2 to skip counting query $recipients = $CONTACTS->search($CONTACTS->primary_key, $cid, 0, true, true, 'email'); } } -if (!empty($_REQUEST['_gid']) && isset($_REQUEST['_source'])) -{ +if (!empty($_REQUEST['_gid']) && isset($_REQUEST['_source'])) { $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); $CONTACTS = $RCMAIL->get_address_book($source); @@ -55,16 +52,14 @@ if (!empty($_REQUEST['_gid']) && isset($_REQUEST['_source'])) } } -if ($recipients) -{ +if ($recipients) { while (is_object($recipients) && ($rec = $recipients->iterate())) { $emails = $CONTACTS->get_col_values('email', $rec, true); $mailto[] = format_email_recipient($emails[0], $rec['name']); } } -if (!empty($mailto)) -{ +if (!empty($mailto)) { $mailto_str = join(', ', $mailto); $mailto_id = substr(md5($mailto_str), 0, 16); $_SESSION['mailto'][$mailto_id] = urlencode($mailto_str); diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index e6a515bd6..f4224a3e2 100644 --- a/program/steps/addressbook/show.inc +++ b/program/steps/addressbook/show.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/show.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2012, The Roundcube Dev Team | + | Copyright (C) 2005-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -38,6 +38,15 @@ if ($cid && ($record = $CONTACTS->get_record($cid, true))) { // get address book name (for display) rcmail_set_sourcename($CONTACTS); +$OUTPUT->add_handlers(array( + 'contacthead' => 'rcmail_contact_head', + 'contactdetails' => 'rcmail_contact_details', + 'contactphoto' => 'rcmail_contact_photo', +)); + +$OUTPUT->send('contact'); + + function rcmail_contact_head($attrib) { @@ -183,12 +192,3 @@ function rcmail_contact_record_groups($contact_id) return $form_start . html::tag('fieldset', 'contactfieldgroup contactgroups', $table->show()) . $form_end; } - - -$OUTPUT->add_handlers(array( - 'contacthead' => 'rcmail_contact_head', - 'contactdetails' => 'rcmail_contact_details', - 'contactphoto' => 'rcmail_contact_photo', -)); - -$OUTPUT->send('contact'); diff --git a/program/steps/addressbook/undo.inc b/program/steps/addressbook/undo.inc index c23bd1cb6..ec3feb9c0 100644 --- a/program/steps/addressbook/undo.inc +++ b/program/steps/addressbook/undo.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/undo.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2011, Kolab Systems AG | + | Copyright (C) 2011-2013, Kolab Systems AG | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -20,14 +20,14 @@ */ // process ajax requests only -if (!$OUTPUT->ajax_call) +if (!$OUTPUT->ajax_call) { return; +} $undo = $_SESSION['contact_undo']; $delcnt = 0; -foreach ((array)$undo['data'] as $source => $cid) -{ +foreach ((array)$undo['data'] as $source => $cid) { $CONTACTS = rcmail_contact_source($source); $plugin = $RCMAIL->plugins->exec_hook('contact_undelete', array( |