| | |
| | | |
| | | */ |
| | | |
| | | if ($RCMAIL->action == 'edit') { |
| | | // Get contact ID and source ID from request |
| | | $cids = rcmail_get_cids(); |
| | | $source = key($cids); |
| | | $cid = array_shift($cids[$source]); |
| | | |
| | | if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) |
| | | // Initialize addressbook |
| | | $CONTACTS = rcmail_contact_source($source, true); |
| | | |
| | | // Contact edit |
| | | if ($cid && ($record = $CONTACTS->get_record($cid, true))) { |
| | | $OUTPUT->set_env('cid', $record['ID']); |
| | | } |
| | | |
| | | // adding not allowed here |
| | | if ($CONTACTS->readonly) { |
| | | $OUTPUT->show_message('sourceisreadonly'); |
| | | rcmail_overwrite_action('show'); |
| | | return; |
| | | } |
| | | } |
| | | else { |
| | | $source = get_input_value('_source', RCUBE_INPUT_GPC); |
| | | |
| | | $CONTACTS = $RCMAIL->get_address_book($source); |
| | | |
| | | // find writable addressbook |
| | | if (!$CONTACTS || $CONTACTS->readonly) |
| | | $source = rcmail_default_source(true); |
| | | |
| | | // Initialize addressbook |
| | | $CONTACTS = rcmail_contact_source($source, true); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | $OUTPUT->add_handler('contactedithead', 'rcmail_contact_edithead'); |
| | | $OUTPUT->add_handler('contacteditform', 'rcmail_contact_editform'); |
| | | $OUTPUT->add_handler('contactphoto', 'rcmail_contact_photo'); |
| | | $OUTPUT->add_handler('photouploadform', 'rcmail_upload_photo_form'); |
| | | $OUTPUT->add_handlers(array( |
| | | 'contactedithead' => 'rcmail_contact_edithead', |
| | | 'contacteditform' => 'rcmail_contact_editform', |
| | | 'contactphoto' => 'rcmail_contact_photo', |
| | | 'photouploadform' => 'rcmail_upload_photo_form', |
| | | )); |
| | | |
| | | if (!$CONTACTS->get_result() && $OUTPUT->template_exists('contactadd')) |
| | | if ($RCMAIL->action == 'add' && $OUTPUT->template_exists('contactadd')) |
| | | $OUTPUT->send('contactadd'); |
| | | |
| | | // this will be executed if no template for addcontact exists |