### Eclipse Workspace Patch 1.0
#P vcard
Index: INSTALL.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vcard/INSTALL.txt,v
retrieving revision 1.6
diff -u -r1.6 INSTALL.txt
--- INSTALL.txt	24 Oct 2009 05:38:41 -0000	1.6
+++ INSTALL.txt	29 Oct 2009 11:10:04 -0000
@@ -4,28 +4,24 @@
 
 1) Install Contact_Vcard_Build from PEAR:
    $ pear install Contact_Vcard_Build
+   
+   For more information on how to install PEAR and PEAR packages see
+   http://pear.php.net/manual/en/installation.php
+   http://pear.php.net/manual/en/guide.users.commandline.cli.php
 
-2) Enable vcard module on administer->modules
+2) Enable vcard module on Administer » Configuration and modules » Modules
+   (?q=admin/config/modules)
 
-3) Configure the profile field mappings on Administer->Site configuration->vCard (?q=admin/settings/vcard)
+3) Add some profile fields for use with vCard on Administer » Configuration and modules » People and permissions » Profiles
+   (?q=admin/config/people/profile)
 
-4) Configure the permissions on Administer->User management->Permissions (?q=admin/user/permissions)
+4) Configure the profile field mappings on Administer » Configuration and modules » People and permissions » vCard
+   (?q=admin/config/people/vcard)
 
-5) To enable hCard support in your theme, you can invoke theme_vcard($user) directly.
-   eg, add the following to your theme template.php and your user page details will be formatted as a vcard.
+5) Configure the permissions on Administer » Configuration and modules » People and permissions » Permissions
+   (?q=admin/config/people/permissions)
 
-   <?php
-   /**
-    * Override of theme_user_profile()
-    */
-   function yourtheme_user_profile($account) {
-     if (module_exists("vcard")) {
-       return theme("vcard", $account);
-     }
-     else {
-       return drupal_render($account->content);
-     }
-   }
-   ?>
+5) To enable hCard support go to Administer » Configuration and modules » People and permissions » vCard
+   (?q=admin/config/people/vcard) and enabled the desired options.
 
-   For additional information on themeing read the handbook pages http://drupal.org/theme-guide.
\ No newline at end of file
+6) To change the appearance of the hCard copy the file vcard.tpl.php to your theme's folder and modify it to your likings.
Index: vcard.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vcard/vcard.admin.inc,v
retrieving revision 1.3
diff -u -r1.3 vcard.admin.inc
--- vcard.admin.inc	27 Oct 2009 18:10:05 -0000	1.3
+++ vcard.admin.inc	29 Oct 2009 11:10:04 -0000
@@ -13,6 +13,23 @@
   if (!_vcard_init()) {
     drupal_set_message(t('The PEAR package Contact_Vcard_Build (required by vcard.module) has not been installed properly, please read INSTALL.txt.'), 'warning');
   }
+  $form['display_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Display Options'),
+    '#markup' => t('To enable the display of hCard in Nodes, go to the !link administration section, choose the desired node type and alter the display settings.', array('!link' => l(t('Content types'), 'admin/structure/types'))),
+  );
+  $form['display_options']['vcard_profile_download'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display vCard download link on profile page'),
+    '#description' => t('The <a href="http://en.wikipedia.org/wiki/VCard">vCard</a> is a file format standard for electronic business cards.'),
+    '#default_value' => variable_get('vcard_profile_download', TRUE),
+  );
+  $form['display_options']['vcard_profile_hcard'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display hCard on profile page'),
+    '#description' => t('The <a href="http://en.wikipedia.org/wiki/Hcard">hCard</a> microformat is a 1:1 representation of vCard.'),
+    '#default_value' => variable_get('vcard_profile_hcard', FALSE),
+  );
 
   $options = array('' => t('<Select a property>'));
   $options = $options + _vcard_properties();
Index: vcard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vcard/vcard.module,v
retrieving revision 1.23
diff -u -r1.23 vcard.module
--- vcard.module	27 Oct 2009 18:10:05 -0000	1.23
+++ vcard.module	29 Oct 2009 11:10:04 -0000
@@ -13,6 +13,11 @@
  * on a user's profile page via themeable function.
  */
 
+define('VCARD_NODE_DISPLAY_NONE', 0);
+define('VCARD_NODE_DISPLAY_TEASER', 1);
+define('VCARD_NODE_DISPLAY_FULL', 2);
+define('VCARD_NODE_DISPLAY_ALL', 3);
+
 /**
  * Implement hook_requirements().
  */
@@ -130,16 +135,27 @@
  * Adds a vcard icon and link to the user page
  */
 function vcard_user_view(&$account) {
+  $markup = '';
+
   // Check permissions
   if (user_access('have vcard', $account) && vcard_permission_check() && _vcard_init()) {
-    // Attach vCard to profile
-    $account->content['vcard'] = array(
-      '#type' => 'user_profile_item',
-      '#title' => t('vCard'),
-      '#markup' => l(t('Download vcard'), 'user/' . $account->uid . '/vcard', array('absolute' => FALSE, 'html' => TRUE)),
-      '#weight' => 10,
-      '#attributes' => array('class' => 'vcard-link'),
-    );
+    if (variable_get('vcard_profile_hcard', FALSE)) {
+      $markup .= theme('vcard', array('account' => $account));
+    }
+    if (variable_get('vcard_profile_download', TRUE)) {
+      $markup .= '<div class="vcard-download-link">' . l(t('Download vCard'), 'user/' . $account->uid . '/vcard') . '</div>';
+    }
+    if (strlen($markup)) {
+      drupal_add_css(drupal_get_path('module', 'vcard') . '/vcard.css');
+      // Attach vCard to profile
+      $account->content['vcard'] = array(
+        '#type' => 'user_profile_item',
+        '#title' => t('vCard'),
+        '#markup' => $markup,
+        '#weight' => 10,
+        '#attributes' => array('class' => 'vcard'),
+      );
+    }
   }
 }
 
@@ -413,3 +429,56 @@
   $variables['account'] = $account;
   $variables['vcard']   = $vcard_raw;
 }
+
+/**
+ * Implement hook_form_FORM_ID_alter().
+ */
+function vcard_form_node_type_form_alter(&$form, $form_state) {
+  if (isset($form['identity']['type'])) {
+    $form['display']['vcard']['vcard_mode'] = array(
+      '#type' => 'radios',
+      '#title' => t("vCard display settings"),
+      '#default_value' => variable_get('vcard_mode_' . $form['#node_type']->type, VCARD_NODE_DISPLAY_NONE),
+      '#description' => t("Show the hCard representation of the author's vCard."),
+      '#options' => array(
+        VCARD_NODE_DISPLAY_NONE   => t("Do not display the author's hCard"),
+        VCARD_NODE_DISPLAY_TEASER => t("Display the author's hCard in teaser view mode only"),
+        VCARD_NODE_DISPLAY_FULL   => t("Display the author's hCard in full view mode only"),
+        VCARD_NODE_DISPLAY_ALL    => t("Display the author's hCard in both, teaser and full view mode"),
+      ),
+    );
+  }
+}
+
+/**
+ * Check node display settings
+ */
+function vcard_node_display($node, $build_mode) {
+  $display_mode = variable_get('vcard_mode_' . $node->type, VCARD_NODE_DISPLAY_NONE);
+  if ($display_mode == VCARD_NODE_DISPLAY_ALL) {
+    return TRUE;
+  }
+  elseif ($display_mode == VCARD_NODE_DISPLAY_FULL && $build_mode === 'full') {
+    return TRUE;
+  }
+  elseif ($display_mode == VCARD_NODE_DISPLAY_TEASER && $build_mode === 'teaser') {
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
+ * Implement hook_node_view().
+ */
+function vcard_node_view($node, $build_mode) {
+  if (!vcard_node_display($node, $build_mode)) {
+    return;
+  }
+
+  drupal_add_css(drupal_get_path('module', 'vcard') . '/vcard.css');
+  $account = user_load($node->uid);
+  $node->content['vcard'] = array(
+    '#markup' => theme('vcard', array('account' => $account)),
+  );
+}
+
Index: vcard.css
===================================================================
RCS file: vcard.css
diff -N vcard.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ vcard.css	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,8 @@
+.vcard {
+  border:1px solid lightgrey;
+  padding:1em;
+  }
+.vcard .photo {
+  float:left;
+  margin-right:1em;
+  }
\ No newline at end of file
Index: vcard.install
===================================================================
RCS file: vcard.install
diff -N vcard.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ vcard.install	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,18 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Install, update and uninstall functions for the vCard module.
+ */
+
+/**
+ * Implement hook_uninstall().
+ */
+function vcard_uninstall() {
+  // Delete all vcard to profile associations
+  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'vcard_%'");
+  foreach($result as $variable) {
+    variable_del($variable->name);
+  }
+}
