Index: swfobject_api.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/swfobject_api/swfobject_api.install,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 swfobject_api.install
--- swfobject_api.install	14 Aug 2007 01:55:46 -0000	1.1.2.1
+++ swfobject_api.install	1 Oct 2008 14:32:43 -0000
@@ -1,14 +1,55 @@
 <?php
-
 // $Id: swfobject_api.install,v 1.1.2.1 2007/08/14 01:55:46 arthuregg Exp $
 
-// swfobject.install
+/**
+ * @file
+ * Install file for SWFObject API module.
+ */
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function swfobject_api_uninstall() {
+  variable_del('swfoa_express');
+  variable_del('swfoa_version');
+}
+
+/**
+ * Implementation of hook_requirements().
+ *
+ * TODO: We could probably check the swfobject file's version here too, similar
+ * to how the jQuery_update 5.x module checks version of jQuery.
+ */
+function swfobject_api_requirements($phase) {
+  $requirements = array();
+  $t = get_t();
+
+  if (!(file_exists(drupal_get_path('module', 'swfobject_api') . "/swfobject.js"))) {
+    $error_message = $t("Please download the swfobject package from !url and place the required files in the swfobject module directory. See README.txt for more info.",
+      array('!url' => l('http://code.google.com/p/swfobject/', 'http://code.google.com/p/swfobject/'))
+    );
 
-function swfobject_api_install() {
+    // we need to explicitly set the message when installing the module,
+    // because drupal_check_module() in install.inc doesn't print out
+    // warning messages, and we prefer to tell the user what's wrong.
+    if ($phase == 'install') {
+      drupal_set_message($error_message, 'warning');
+    }
 
- // 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');
- }
+    $requirements['swfobject_api'] = array(
+      'title' => $t('SWFObject API'),
+      'description' => $error_message,
+      'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
+      'value' => $t('Copy swfobject.js'),
+    );
+  }
+  elseif ($phase == 'runtime') {
+    $requirements['swfobject_api'] = array(
+      'title' => $t('SWFObject API'),
+      'severity' => REQUIREMENT_OK,
+      'value' => $t('Installed correctly'),
+    );
+  }
 
-}
\ No newline at end of file
+  return $requirements;
+}
