From f92aba3918575f30f577542753a2912df5729374 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 29 Jul 2008 12:32:19 +0000 Subject: Add microformats to address book + fix html output + codestyle --- program/steps/addressbook/show.inc | 54 ++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'program/steps/addressbook/show.inc') diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index 75f1e7452..96ee5bb55 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-2007, RoundCube Dev. - Switzerland | + | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -21,50 +21,52 @@ // read contact record -if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) +if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) { $OUTPUT->set_env('cid', $record['ID']); - +} function rcmail_contact_details($attrib) - { +{ global $CONTACTS, $OUTPUT; // check if we have a valid result - if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) - { + if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) { $OUTPUT->show_message('contactnotfound'); return false; } // a specific part is requested - if ($attrib['part']) + if ($attrib['part']) { return Q($record[$attrib['part']]); + } // return the complete address record as table - $out = "\n\n"; + $table = new html_table(array('cols' => 2)); $a_show_cols = array('name', 'firstname', 'surname', 'email'); - foreach ($a_show_cols as $col) - { - if ($col=='email' && !empty($record[$col])) - $value = sprintf( - '%s', - JS_OBJECT_NAME, - JQ($record[$col]), - rcube_label('composeto'), - Q($record[$col])); + $microformats = array('name' => 'fn', 'email' => 'email'); + + foreach ($a_show_cols as $col) { + if ($col == 'email' && !empty($record[$col])) { + $value = html::a(array( + 'href' => 'mailto:' . $record[$col], + 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($record[$col])), + 'title' => rcube_label('composeto'), + 'class' => $microformats[$col], + ), Q($record[$col])); + } + else if (!empty($record[$col])) { + $value = html::span($microformats[$col], Q($record[$col])); + } else - $value = Q($record[$col]); + $value = ''; - $out .= sprintf("\n", - Q(rcube_label($col)), - $value); - } - - $out .= "\n
%s%s
"; - - return $out; + $table->add('title', Q(rcube_label($col))); + $table->add(null, $value); } + + return $table->show($attrib + array('class' => 'vcard')); +} //$OUTPUT->framed = $_framed; -- cgit v1.2.3