Index: pmgrowl.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pmgrowl/pmgrowl.install,v
retrieving revision 1.2
diff -u -p -r1.2 pmgrowl.install
--- pmgrowl.install	22 May 2009 15:59:59 -0000	1.2
+++ pmgrowl.install	2 Jan 2010 14:16:05 -0000
@@ -5,6 +5,8 @@
  * Database Schema for pmgrowl.module
  */
 
+define('PMGROWL_JGROWL_DL_URL', 'http://www.stanlemon.net/projects/jgrowl.html');
+
 /**
  * Implementation of hook_schema().
  */
@@ -51,3 +53,46 @@ function pmgrowl_uninstall() {
   variable_del('pmgrowl_interval');
   drupal_uninstall_schema('pmgrowl');
 }
+
+/**
+ * Implements hook_requirements().
+ *
+ * Check if the jgrowl library is correctly installed.
+ */
+function pmgrowl_requirements($phase) {
+  $missing_files = array();
+
+  if (!file_exists(drupal_get_path('module', 'pmgrowl') .'/jgrowl/jquery.jgrowl_minimized.js')) {
+    $missing_files[] = drupal_get_path('module', 'pmgrowl') .'/jgrowl/jquery.jgrowl_minimized.js';
+  }
+  if (!file_exists(drupal_get_path('module', 'pmgrowl') .'/jgrowl/jquery.jgrowl.css')) {
+    $missing_files[] = drupal_get_path('module', 'pmgrowl') .'/jgrowl/jquery.jgrowl.css';
+  }
+
+   // Ensure translations don't break at install time
+  $t = get_t();
+
+  $requirements = array();
+  if (!empty($missing_files)) {
+    $requirements['pmgrowl'] = array(
+      'title' => $t('Private Messages Growl'),
+      'description' => $t('One or more required jgrowl files were not found:<br />%missing_files<br />!link', array('%missing_files' => implode('<br />', $missing_files), '!link' => l($t('Jgrowl Download Link'), PMGROWL_JGROWL_DL_URL))),
+      'severity' => REQUIREMENT_ERROR,
+    );
+
+    if ($phase == 'runtime') {
+      $requirements['pmgrowl']['value'] = $t('Not found');
+    }
+  }
+  else {
+    $requirements['pmgrowl'] = array(
+      'title' => $t('Private Messages Growl'),
+      'description' => $t('All required jgrowl files are installed correctly.'),
+      'severity' => REQUIREMENT_OK,
+    );
+    if ($phase == 'runtime') {
+      $requirements['pmgrowl']['value'] = $t('Found');
+    }
+  }
+  return $requirements;
+}
\ No newline at end of file
