alecpl
2012-01-01 1c029b9c7c67c9603e9044b65c843300dd73ecb8
program/steps/addressbook/show.inc
@@ -19,11 +19,22 @@
*/
// Get contact ID and source ID from request
$cids   = rcmail_get_cids();
$source = key($cids);
$cid    = array_shift($cids[$source]);
// Initialize addressbook source
$CONTACTS  = rcmail_contact_source($source, true);
$SOURCE_ID = $source;
// read contact record
if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) {
if ($cid && ($record = $CONTACTS->get_record($cid, true))) {
    $OUTPUT->set_env('cid', $record['ID']);
}
// get address book name (for display)
rcmail_set_sourcename($CONTACTS);
// return raw photo of the given contact
if ($RCMAIL->action == 'photo') {
@@ -41,7 +52,7 @@
        if (!preg_match('![^a-z0-9/=+-]!i', $data))
            $data = base64_decode($data, true);
    }
    header('Content-Type: ' . rc_image_content_type($data));
    echo $data ? $data : file_get_contents('program/blank.gif');
    exit;
@@ -90,21 +101,26 @@
    $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
    $form = array(
        'info' => array(
            'name'    => rcube_label('contactproperties'),
        'contact' => array(
            'name'    => rcube_label('properties'),
            'content' => array(
              'gender' => array('size' => $i_size),
              'maidenname' => array('size' => $i_size),
              'email' => array('size' => $i_size, 'render_func' => 'rcmail_render_email_value'),
              'phone' => array('size' => $i_size),
              'address' => array(),
              'birthday' => array('size' => $i_size),
              'anniversary' => array('size' => $i_size),
              'website' => array('size' => $i_size, 'render_func' => 'rcmail_render_url_value'),
              'im' => array('size' => $i_size),
              'manager' => array('size' => $i_size),
              'assistant' => array('size' => $i_size),
              'spouse' => array('size' => $i_size),
            ),
        ),
        'personal' => array(
            'name'    => rcube_label('personalinfo'),
            'content' => array(
                'gender' => array('size' => $i_size),
                'maidenname' => array('size' => $i_size),
                'birthday' => array('size' => $i_size),
                'anniversary' => array('size' => $i_size),
                'manager' => array('size' => $i_size),
                'assistant' => array('size' => $i_size),
                'spouse' => array('size' => $i_size),
            ),
        ),
    );
@@ -142,7 +158,7 @@
function rcmail_render_url_value($url, $col)
{
    $prefix = preg_match('![htfps]+://!', $url) ? '' : 'http://';
    $prefix = preg_match('!^(http|ftp)s?://!', $url) ? '' : 'http://';
    return html::a(array(
        'href' => $prefix . $url,
        'target' => '_blank',
@@ -185,14 +201,16 @@
    $form_end = '</form>';
    $RCMAIL->output->add_gui_object('editform', 'form');
    return $form_start . $table->show() . $form_end;
    $RCMAIL->output->add_label('addingmember', 'removingmember');
    return $form_start . html::tag('fieldset', 'contactfieldgroup contactgroups', $table->show()) . $form_end;
}
//$OUTPUT->framed = $_framed;
$OUTPUT->add_handler('contacthead', 'rcmail_contact_head');
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
$OUTPUT->add_handler('contactphoto', 'rcmail_contact_photo');
$OUTPUT->add_handlers(array(
    'contacthead'    => 'rcmail_contact_head',
    'contactdetails' => 'rcmail_contact_details',
    'contactphoto'   => 'rcmail_contact_photo',
));
$OUTPUT->send('contact');