From: stevetruckstuff Date: Mon, 28 Aug 2006 15:19:09 +0000 (+0000) Subject: Add vCard template X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a88fa97331a17e2b20f214afda33c52c76dd8d1d;p=squirrelmail.git Add vCard template git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11652 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/vcard.php b/src/vcard.php index 8d61d4ea..71c6a557 100644 --- a/src/vcard.php +++ b/src/vcard.php @@ -43,20 +43,11 @@ sqimap_mailbox_select($imapConnection, $mailbox); displayPageHeader($color, 'None'); -echo '
' . "\n" . - ''; - $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); $entity_vcard = getEntity($message,$ent_id); @@ -92,10 +83,9 @@ if ($vcard_nice['version'] == '2.1') { $vcard_nice['email;internet'] = $vcard_nice['email;pref;internet']; } } else { - echo '\n"; + $oTemplate->assign('note', sprintf(_("vCard Version %s is not supported. Some information might not be converted correctly."), htmlspecialchars($vcard_nice['version']))); + $oTemplate->display('note.tpl'); + $vcard_nice['firstname'] = ''; $vcard_nice['lastname'] = ''; } @@ -119,66 +109,37 @@ $ShowValues = array( 'tel;fax' => _("Fax"), 'note' => _("Note")); -echo '
' . - _("Viewing a Business Card") . " - "; - $msg_url = 'read_body.php?mailbox='.urlencode($mailbox). '&startMessage='.urlencode($startMessage). '&passed_id='.urlencode($passed_id); - $msg_url = set_url_var($msg_url, 'ent_id', 0); -echo ''. _("View message") . '' . - '
' . - sprintf(_("vCard Version %s is not supported. Some information might not be converted correctly."), - htmlspecialchars($vcard_nice['version'])) . - "

' . - '' . "\n"; - if (isset($vcard_safe['email;internet'])) { $vcard_safe['email;internet'] = makeComposeLink('src/compose.php?send_to='.urlencode($vcard_safe['email;internet']), $vcard_safe['email;internet']); } if (isset($vcard_safe['url'])) { - $vcard_safe['url'] = '' . + $vcard_safe['url'] = '' . $vcard_safe['url'] . ''; } +$vcard = array(); foreach ($ShowValues as $k => $v) { - if (isset($vcard_safe[$k]) && $vcard_safe[$k]) { - echo "\n"; + if (isset($vcard_safe[$k]) && $vcard_safe[$k]) { + $vcard[$v] = $vcard_safe[$k]; } } -?> -
$v:" . - $vcard_safe[$k] . "
-
-
- - - -
-
-
-
- - -' . - '' . - ' - -
: -rfc822_header; $from_name = $header->getAddr_s('from'); - echo '
' . _("E-mail address") . ':' . - addInput('addaddr[email]', - getEmail(decodeHeader($from_name)), '20'); + $email = getEmail(decodeHeader($from_name)); } -echo '
' . _("Additional info") . ':'; - $opts = array(); if (isset($vcard_nice['url'])) { $opts[$vcard_nice['url']] = _("Web Page"); @@ -211,42 +172,17 @@ if (isset($vcard_nice['note'])) { $opts[$vcard_nice['note']] = _("Note"); } -/* - * If the vcard comes with nothing but name and e-mail address, the user gets - * the chance to type some additional info. If there's more info in the card, - * the user gets to choose what will be added as additional info. - */ -if (count($opts) == 0) { - echo addInput('addaddr[label]', '', '20'); -} else { - echo addSelect('addaddr[label]', $opts, '', TRUE); -} +$oTemplate->assign('view_message_link', $msg_url); +$oTemplate->assign('download_link', $dl); +$oTemplate->assign('vcard', $vcard); -?> -

-assign('nickname', $vcard_nice['firstname'].'-'.$vcard_safe['lastname']); +$oTemplate->assign('firstname', $vcard_safe['firstname']); +$oTemplate->assign('lastname', $vcard_safe['lastname']); +$oTemplate->assign('email', $email); +$oTemplate->assign('info', $opts); -echo addHidden('addaddr[firstname]', $vcard_safe['firstname']) . - addHidden('addaddr[lastname]', $vcard_safe['lastname']) . - addSubmit(_("Add to address book"), 'addaddr[SUBMIT]'); +$oTemplate->display('vcard.tpl'); -?> -
- -
-' . - _("Download this as a file") . ''; -?> -
- -
-
-display('footer.tpl'); -?> +?> \ No newline at end of file diff --git a/templates/default/stylesheet.tpl b/templates/default/stylesheet.tpl index dddc4c7f..6f57fa0b 100644 --- a/templates/default/stylesheet.tpl +++ b/templates/default/stylesheet.tpl @@ -734,3 +734,23 @@ tr.odd { border: 1px solid ; } +#vCard { + text-align: center; +} + +#vCard table { + margin-left: auto; + margin-right: auto; + margin-top: 10px; + margin-bottom: 10px; +} + +#vCard td.fieldName { + text-align: ; + font-weight: bold; + vertical-align: top; +} + +#vCard td.fieldValue { + text-align: ; +} \ No newline at end of file diff --git a/templates/default/vcard.tpl b/templates/default/vcard.tpl new file mode 100644 index 00000000..d89cd426 --- /dev/null +++ b/templates/default/vcard.tpl @@ -0,0 +1,120 @@ + +
+ + + + + + + + + + +
+ - +
+ + $value) { + ?> + + + + + +
+ : + + +
+
+ +
+
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + + + +
+
+ " name="addaddr[SUBMIT]" id="addaddr_SUBMIT_" /> +
+
+
\ No newline at end of file