? .buildpath
? .git
? .project
? .settings
? field/flickrfield.module-edit
Index: flickr.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flickr/flickr.css,v
retrieving revision 1.4
diff -u -b -u -p -r1.4 flickr.css
--- flickr.css	24 Mar 2008 19:56:09 -0000	1.4
+++ flickr.css	21 Mar 2009 22:12:02 -0000
@@ -37,3 +37,9 @@
 .flickr-photoset-title {}
 
 .flickr-photoset-count {}
+
+/** Override for Drupal's default block, 95% width textfields on node forms. */
+.node-form .flickrfield_flickrid {
+  display: inline;
+  width: auto;
+}
Index: field/flickrfield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flickr/field/flickrfield.module,v
retrieving revision 1.4.2.1
diff -u -b -u -p -r1.4.2.1 flickrfield.module
--- field/flickrfield.module	30 Jan 2009 10:39:01 -0000	1.4.2.1
+++ field/flickrfield.module	21 Mar 2009 22:12:02 -0000
@@ -34,6 +34,10 @@ function flickrfield_field_info() {
       'label' => 'Flickr Photo',
       'description' => t('Store Flickr Photo or Photoset ids and display the photos in nodes and views.'),
     ),
+    'flickrfield_photoset' => array(
+      'label' => 'Flickr photo set',
+      'description' => t('Field for storing a reference to a Flickr photo set.'),
+    )
   );
 }
 
@@ -43,11 +47,18 @@ function flickrfield_field_info() {
 function flickrfield_field_settings($op, $field) {
   switch ($op) {
     case 'database columns':
+      if ($field['type'] == 'flickrfield') {
       $columns = array(
         'id' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
         'type' => array('type' => 'varchar', 'length' => 10, 'not null' => FALSE, 'sortable' => TRUE),
         'nsid' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
       );
+      }
+      else if ($field['type'] == 'flickrfield_photoset') {
+        $columns = array(
+          'flickrid' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
+        );
+      }
       return $columns;
   }
 }
@@ -65,6 +76,14 @@ function flickrfield_widget_info() {
         'default value' => CONTENT_CALLBACK_DEFAULT,
       ),
     ),
+    'flickrfield_flickrid' => array(
+      'label' => 'Flickr Id',
+      'field types' => array('flickrfield_photoset'),
+      'multiple values' => CONTENT_HANDLE_CORE,
+      'callbacks' => array(
+        'default value' => CONTENT_CALLBACK_DEFAULT,
+      ),
+    )
   );
 }
 
@@ -75,6 +94,11 @@ function flickrfield_elements() {
       '#columns' => array('type', 'id', 'uid'),
       '#process' => array('flickrfield_process'),
     ),
+    'flickrfield_flickrid' => array(
+      '#input' => TRUE,
+      '#columns' => array('flickrid'),
+      '#process' => array('flickrfield_flickrid_process'),
+    )
   );
 }
 
@@ -111,11 +135,30 @@ function flickrfield_process($element, $
   return $element;
 }
 
+function flickrfield_flickrid_process($element, $edit, $form_state, $form) {
+  $element['flickrid'] = array(
+    '#type' => 'textfield',
+    '#title' => $element['#title'],
+    '#description' => $element['#description'],
+    '#required' => $element['#required'],
+    '#field_prefix' => t('Flickr ID: '),
+    '#default_value' => !empty($element['#value']['flickrid']) ? $element['#value']['flickrid'] : '',
+    '#size' => 20,
+    '#maxlength' => 20,
+    '#attributes' => array('class' => 'flickrfield_flickrid'),
+  );
+  return $element;
+}
+
 /**
  * Implementation of hook_content_is_empty().
  */
 function flickrfield_content_is_empty($item, $field) {
+  if ($field['type'] == 'flickrfield') {
   return empty($item['id']);
+  } else if ($field['type'] == 'flickrfield_photoset') {
+    return empty($item['flickrid']);
+  }
 }
 
 /**
@@ -123,12 +166,25 @@ function flickrfield_content_is_empty($i
  */
 function flickrfield_field_formatter_info() {
   require_once(drupal_get_path('module', 'flickr') .'/flickr.inc');
-  foreach (flickr_photo_sizes() as $size => $info) {
+  $sizes = flickr_photo_sizes();
+  // Formatters for general Flickr CCK field.
+  foreach ($sizes as $size => $info) {
     $formatters[$size] = array(
       'label' => $info['label'],
       'field types' => array('flickrfield'),
       );
   }
+  // Formatters for Flickr photoset CCK field.
+  $formatters['photoset_flickrcomslideshow'] = array(
+    'label' => 'Embedded Flickr.com flash slideshow',
+    'field types' => array('flickrfield_photoset'),
+  );
+  foreach ($sizes as $size => $info) {
+    $formatters['photoset_primaryphoto_size'. $size] = array(
+      'label' => t('Primary set photo at size "@size"', array('@size' => $info['label'])),
+      'field types' => array('flickrfield_photoset'),
+    );
+  }
   return $formatters;
 }
 
@@ -143,6 +199,11 @@ function flickrfield_theme() {
       'arguments' => array('element'),
       'function' => 'theme_flickrfield_field_formatter',
       );
+    // Theme function for the primary photo formatters of a Flickr photo set.
+    $themes['flickrfield_formatter_photoset_primaryphoto_size'. $size] = array(
+      'arguments' => array('element'),
+      'function' => 'theme_flickrfield_formatter_photoset_primaryphoto',
+    );
   }
   return $themes + array(
     'flickrfield_photo' => array(
@@ -154,6 +215,12 @@ function flickrfield_theme() {
     'flickrfield' => array(
       'arguments' => array('element'),
     ),
+    'flickrfield_flickrid' => array(
+      'arguments' => array('element'),
+    ),
+    'flickrfield_formatter_photoset_flickrcomslideshow' => array(
+      'arguments' => array('element'),
+    )
   );
 }
 
@@ -184,6 +251,37 @@ function theme_flickrfield_field_formatt
 }
 
 /**
+ * Theme a Flickr photo et as the primary photo of that set.
+ */
+function theme_flickrfield_formatter_photoset_primaryphoto($element) {
+  require_once(drupal_get_path('module', 'flickr') .'/flickr.inc');
+  if (empty($element['#item']['flickrid'])) {
+    return;
+  }
+  $size = substr($element['#formatter'], -1);
+  $photo_data = flickr_photoset_get_info($element['#item']['flickrid']);
+  $img = flickr_img($photo_data, $size);
+  $photo_url = flickr_photoset_page_url($photo_data['owner'], $photo_data['id']);
+  $node = $element['#node'];
+  return theme('flickrfield_photoset', $img, $photo_url, $size, $photo_data, $node);
+}
+
+/**
+ * Theme a Flickr photo set as an embedded Flickr.com flash slideshow.
+ */
+function theme_flickrfield_formatter_photoset_flickrcomslideshow($element) {
+  require_once(drupal_get_path('module', 'flickr') .'/flickr.inc');
+  if (empty($element['#item']['flickrid'])) {
+    return;
+  }
+  $set_id = $element['#item']['flickrid'];
+  $src = 'http://www.flickr.com/slideShow/index.gne?set_id='. $set_id;
+  return '<div class="flickr-photoset-slideshow">'
+    .'<iframe align="center" src="' . $src .'" frameBorder="0" width="500" scrolling="no" height="500"></iframe>'
+    .'</div>';
+}
+
+/**
  * Flickrfield photo themes.
  *
  * If we are not on the node, make the photo link back to the node,
@@ -233,3 +331,13 @@ function theme_flickrfield($element) {
   );
   return theme('fieldset', $fieldset);
 }
+
+/**
+ * Theme function for the Flickr ID form element.
+ *
+ * The textfield is already rendered by the textfield theme
+ * and the html output lives in $element['#children'].
+ */
+function theme_flickrfield_flickrid($element) {
+  return $element['#children'];
+}
