Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/swfobject_api/README.txt,v
retrieving revision 1.1
diff -u -r1.1 README.txt
--- README.txt	25 Jan 2007 17:45:36 -0000	1.1
+++ README.txt	9 May 2007 06:11:16 -0000
@@ -1,22 +1,26 @@
+$Id$
+
 SWFObject_api Module
 
 Description
 -------------------------------------
-This module makes it easier to add flash content to sites
-
+This module makes it easier to add flash content to sites.
 
 Installation
 -------------------------------------
  1) Please module into modules directory
  2) Download SWFObject library from:
- http://blog.deconcept.com/swfobject/#download
- 3) Place swfobject.js file into modules/swfobject_api/
- 4) Activate module in admin/build/modules
+      http://blog.deconcept.com/swfobject/#download
+ 3) Place the swfobject.js file into modules/swfobject_api/
+ 4) Place the expressinstall.swf file into modules/swfobject_api/
+ 5) Activate module in admin/build/modules
+ 6) Configure the module via admin/settings/swfobject_api
  
  Usage
  ------------------------------------
  Adding flash to your theme is as simple as:
-   
+
    $url = "myflashfile.swf"; //path to flash file
-   $params = array('width' => 100, 'height' => 100 );
-   print theme("swfobject_api", $url, $params); 
\ No newline at end of file
+   $params = array('width' => 100, 'height' => 100);
+   $variables = array('foo' => 'bar');
+   print theme("swfobject_api", $url, $params, $variables);
Index: swfobject_api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/swfobject_api/swfobject_api.module,v
retrieving revision 1.2
diff -u -r1.2 swfobject_api.module
--- swfobject_api.module	25 Jan 2007 17:38:38 -0000	1.2
+++ swfobject_api.module	9 May 2007 06:11:16 -0000
@@ -1,93 +1,137 @@
 <?php 
+// $Id$
 
 /* Please see the README.txt file for more information on this module */
 
-
-/** 
- *  hook_help
+/**
+ * Implementation of hook_help().
  */
-function swfobject_api_help($section = 'admin/help#swfobject_api') {
-  $output = '';
+function swfobject_api_help($section) {
   switch ($section) {
-    case 'admin/help#swf_object':
-      return t('This module creates an API for flash content generation in pages based on the swfObject library.');
-    case 'admin/modules#description':
-      return t('This module creates an API for flash content generation in pages based on the swfObject library.');
-   }
-}
-
-/** 
- * hook_nodeapi
- */
-function swfobject_api_nodeapi (&$node, $op) {
-  static $swf_loaded;
-
-  if ($op == "view") {
-  	
-  	// check the body to see if we need to load anything
-    if (strstr($node->body, "new SWFObject")) {	
-     
-	  // load the javascript if it hasn't be loaded before
-	  if (!($swf_loaded)) { 
-	    if ( !(file_exists(drupal_get_path('module','swfobject_api') . "/swfobject.js")) ) {
-	      // display alert if javascript isn't present
-	      drupal_set_message(t("You need to download the swfobject.js file and place it in the swfobject module directory. Please see the README.txt"), 'error');
-	      $swf_loaded = false;
-	    } else {
-	      drupal_add_js(drupal_get_path('module','swfobject_api') . "/swfobject.js");   
-	      $swf_loaded = true;      
-	    }
-	  }     
-    } 
-  }
-}
-
-/**
- * generate javasript code 
- * @$url is a web accessible address
- * @$params is an array of parameters to build the html
- */
-function swfobject_api_create($url, $params = null, $load_js = true) {
-  
-  static $swf_loaded;
-  
-  if (!($load_js)) {
-  	
-    if ( !(file_exists(drupal_get_path('module','swfobject_api') . "/swfobject.js")) ) {
-      // display error if javascript isn't present
-      drupal_set_message(t("You need to download the swfobject.js file and place it in the swfobject module directory. Please see the README.txt"), 'error');
-      $swf_loaded = false;
-    } else {
-      drupal_add_js(drupal_get_path('module','swfobject_api') . "/swfobject.js");   
-      $swf_loaded = true;      
-    }     
-  }
-
-  return theme("swfobject_api", $url, $params);
-}
-
-/*
- * Implementation of theme
- */
-function theme_swfobject_api($url, $params){
-  $width = $params['width'] ? $params['width'] : "100%" ;
-  $height = $params['height'] ? $params['height'] : "100%" ;
-  $message = $params['no_flash'] ? $params['no_flash'] : t('Sorry, you need to install flash to see this content.');
-  
-  $name = str_replace(".swf", "", basename($url));
-  
-  $html  = "<div id='flashcontent_". $name . "'>$message</div>\n";
-  $html .= "<script>var so = new SWFObject('". $url . "', 'movie', '". $width ."','" . $height ."','" . $name . "'); \n"; 
-  
-  if ($params) {
-    foreach ($params as $key => $value) {
-      if (($key != "width") && ($key != "height") && ($key != "no_flash")) {
-        $html .= " so.addParam('$key', '$value'); \n";
-      }
+    case 'admin/help#swfobject_api':
+    case 'admin/settings/swfobject_api':
+      return t('This module creates an API for flash content generation in pages based on the swfObject library. For more information, visit <a href="http://blog.deconcept.com/swfobject/">http://blog.deconcept.com/swfobject/</a>.');
+  }
+}
+
+/**
+ * Implementation of hook_menu().
+ */
+function swfobject_api_menu($may_cache) {
+  $items = array();
+
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/swfobject_api',
+      'title' => t('SWFObject API'),
+      '#description' => t('Configure the SWFObject API.'),
+      'access' => user_access('administer nodes'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'swfobject_api_settings_form'
+    );
+  }
+
+  return $items;
+}
+
+/**
+ * Menu callback: SWFObject API configuration form.
+ */
+function swfobject_api_settings_form() {
+  $settings = _swfobject_api_settings();
+
+  $form = array();
+
+  $form['swfobject_api_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Settings'),
+    '#tree' => TRUE
+  );
+  $form['swfobject_api_settings']['version'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Default minimum version required'),
+    '#description' => t('This value can be overridden via the theme call.'),
+    '#default_value' => $settings['version'],
+    '#required' => TRUE
+  );
+  $form['swfobject_api_settings']['express'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable express install.'),
+    '#description' => t('Express install allows player upgrades without having to leave the site. Only versions 6.0.65 and above are supported.'),
+    '#default_value' => $settings['express']
+  );
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings'));
+
+  return $form;
+}
+
+/**
+ * Process swfobject_api_settings form submission.
+ */
+function swfobject_api_settings_form_submit($form_id, $form_values) {
+  variable_set('swfobject_api_settings', $form_values['swfobject_api_settings']);
+}
+
+/**
+ * Implementation of theme.
+ * 
+ * @param $url
+ *   A web accessible URL.
+ * @param $params
+ *   An associative array of parameters that describe the SWF.
+ * @param $variables
+ *   An associative array of variables to pass through to the SWF.
+ */
+function theme_swfobject_api($url, $params = array(), $variables = array()) {
+  $path = drupal_get_path('module', 'swfobject_api');
+  drupal_add_js($path .'/swfobject.js');
+
+  $settings = _swfobject_api_settings();
+
+  $base_params = array(
+    'width' => '100%',
+    'height' => '100%',
+    'no_flash' => t('Sorry, you need to install flash to see this content.'),
+    'version' => $settings['version'],
+    'bg_color' => '#FFFFFF'
+  );
+  $params = array_merge($base_params, $params);
+  // Express install redirect URL: as per the SWFObject docs, this should
+  // actually be xiRedirectUrl; variable name changed for simplicity.
+  if (isset($param['express_redirect'])) {
+    $redirect = $param['express_redirect'];
+  }
+
+  $name = form_clean_id(str_replace('.swf', '', basename($url)));
+
+  $html  = '<div id="flashcontent-'. $name .'">'. $message ."</div>\n";
+  $html .= "<script>var so = new SWFObject('$url', 'swf-". $name ."', '". $params['width'] ."', '". $params['height'] ."', '". $params['version'] ."', '". $params['bg_color'] ."');\n";
+
+  unset($params['width'], $params['height'], $params['no_flash'], $params['version'], $params['bg_color'], $params['express_redirect']);
+
+  foreach ($params as $key => $value) {
+    $html .= " so.addParam('$key', '$value');\n";
+  }
+  foreach ($variables as $key => $value) {
+    $html .= " so.addVariable('$key', '$value');\n";
+  }
+
+  if ($settings['express']) {
+    $html .= " so.useExpressInstall('". $path ."/expressinstall.swf');\n";
+    if (isset($redirect)) {
+      $html .= " so.setAttribute('xiRedirectUrl', '". $redirect ."');\ns";
     }
   }
-  $html .= " so.write('flashcontent_". $name . "'); \n</script>";
 
- return $html;
-} 
- 
\ No newline at end of file
+  $html .= " so.write('flashcontent-". $name ."');\n</script>";
+
+  return $html;
+}
+
+/**
+ * Retrieve SWFObject API settings variable.
+ */
+function _swfobject_api_settings() {
+  $defaults = array('version' => 6, 'express' => 1);
+  return variable_get('swfobject_api_settings', $defaults);
+}
Index: swfobject_api.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/swfobject_api/swfobject_api.install,v
retrieving revision 1.1
diff -u -r1.1 swfobject_api.install
--- swfobject_api.install	22 Nov 2006 17:23:38 -0000	1.1
+++ swfobject_api.install	9 May 2007 06:11:16 -0000
@@ -1,11 +1,9 @@
 <?php
-// swfobject.install
+// $Id$
 
 function swfobject_api_install() {
-
- // alert the user that they need to download the js file
- if (!(file_exists(drupal_get_path('module','swfobject_api') . "/swfobject.js"))) {
-    drupal_set_message(t("You need to download the swfobject.js file from ". l('http://blog.deconcept.com/swfobject/', 'http://blog.deconcept.com/swfobject/') . " and place it in the swfobject module directory. Please see the README.txt"), 'error');
- }
-
-}
\ No newline at end of file
+  // Alert the user that they need to download the js file.
+  if (!(file_exists(drupal_get_path('module','swfobject_api') .'/swfobject.js'))) {
+    drupal_set_message(t('You need to download the swfobject.js file from '. l('http://blog.deconcept.com/swfobject/', 'http://blog.deconcept.com/swfobject/') .' and place it in the swfobject_api module directory. Please see README.txt for more information.'), 'error');
+  }
+}
Index: swfobject_api.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/swfobject_api/swfobject_api.info,v
retrieving revision 1.1
diff -u -r1.1 swfobject_api.info
--- swfobject_api.info	25 Jan 2007 17:38:38 -0000	1.1
+++ swfobject_api.info	9 May 2007 06:11:16 -0000
@@ -1,3 +1,4 @@
 ; $Id$
 name = SWFObject Module
-description = Implements the SWFObject Library, makes it easy for developers to add flash content
+description = Implements the SWFObject Library, makes it easy for developers to add flash content.
+version = "$Name$"
