? dev.patch
? libraries-level2.patch
? local-time-and-tests.patch
? local_time_1.patch
? local_time_working.patch
Index: clock.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.module,v
retrieving revision 1.9.2.12
diff -u -p -r1.9.2.12 clock.module
--- clock.module	24 May 2010 23:14:27 -0000	1.9.2.12
+++ clock.module	26 May 2010 10:04:43 -0000
@@ -67,18 +67,20 @@ function clock_block($op = 'list', $delt
 
     case 'configure':
 
-      // Libraries API integration level 1.
+      // Libraries API integration level 2.
       if (!file_exists('sites/all/libraries/jquerytimers/jquery.timers.js') && !file_exists(conf_path() . '/libraries/jquerytimers/jquery.timers.js')) {
         if (file_exists(drupal_get_path('module', 'clock') . '/jquery.timers.js')) {
-          drupal_set_message('Please place the <a href="http://plugins.jquery.com/project/timers">jQuery Timers library</a> in a dedicated <em>jquerytimers</em> directory inside the <em>libraries</em> directory in your <em>sites</em> directory. The file should then be located at e.g. <em>sites/all/libraries/jquerytimers/jquery.timers.js</em>. Clock module will continue to function if you leave the jQuery Timers library in the clock module directory as of now, but the next version of Clock will not. Therefore you are strongly advised to make this change now to ensure seamless future upgrades.', 'warning');
-
+          drupal_set_message('Please place the <a href="http://plugins.jquery.com/project/timers">jQuery Timers library</a> in a dedicated <em>jquerytimers</em> directory inside the <em>libraries</em> directory in your <em>sites</em> directory. The file should then be located at e.g. <em>sites/all/libraries/jquerytimers/jquery.timers.js</em>. Clock module will not function otherwise', 'error');
+          $error = TRUE;
         }
         else {
           drupal_set_message('You have not obtained the <a href="http://plugins.jquery.com/project/timers">jQuery Timers library</a> that is required for Clock module to function properly. Please visit the <a href="http://plugins.jquery.com/project/timers">jQuery Timers project page</a> and download version 1.2.0 from there. Then place it as it is in a in a dedicated <em>jquerytimers</em> directory inside the <em>libraries</em> directory in your <em>sites</em> directory and rename it to <em>jquery.timers.js</em>. The file should then be located at e.g. <em>sites/all/libraries/jquerytimers/jquery.timers.js</em>.', 'error');
+          $error = TRUE;
         }
       }
       if (!module_exists('libraries')) {
-        drupal_set_message('You currently have not installed the <a href="http://drupal.org/project/libraries">Libraries API</a> module. Please download the latest version (if you haven\'t already) and install it. Currently, Clock module works fine without Libraries API, but the next version of Clock and all future releases will depend on it. Therefore you are strongly advised to make this change now to ensure seamless future upgrades.', 'warning');
+        drupal_set_message('You currently have not installed the <a href="http://drupal.org/project/libraries">Libraries API</a> module. Please download the latest version (if you haven\'t already) and install it. Clock module will not function without Libraries API.', 'error');
+        $error = TRUE;
       }
 
       drupal_add_js(drupal_get_path('module', 'clock') . '/clock.js');
@@ -170,6 +172,11 @@ function clock_block($op = 'list', $delt
         '#default_value' => variable_get('clock_js', '1'),
       );
 
+      // Libraries API integration level 2.
+      if ($error == TRUE) {
+        $form = array();
+      }
+
       return $form;
 
     case 'save':
@@ -308,18 +315,8 @@ function theme_clock($timezone, $date_fo
       'date_format' => $date_format,
     ), 'setting');
 
-
-    // Libraries API integration level 1
-    if (file_exists(conf_path() . '/libraries/jquerytimers/jquery.timers.js')) {
-      drupal_add_js(conf_path() . '/libraries/jquerytimers/jquery.timers.js');
-    }
-    elseif (file_exists('sites/all/libraries/jquerytimers/jquery.timers.js')) {
-      drupal_add_js('sites/all/libraries/jquerytimers/jquery.timers.js');
-    }
-    elseif (file_exists(drupal_get_path('module', 'clock') . '/jquery.timers.js')) {
-      drupal_add_js(drupal_get_path('module', 'clock') . '/jquery.timers.js');
-    }
-
+    // Add the JavaScript.
+    drupal_add_js(libraries_get_path('jquerytimers') . '/jquery.timers.js');
     drupal_add_js(drupal_get_path('module', 'clock') . '/clock.js');
   }
 
