? bawstats_353027-9.patch
Index: bawstats.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bawstats/bawstats.info,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 bawstats.info
--- bawstats.info	12 Jul 2009 22:02:47 -0000	1.2.2.1
+++ bawstats.info	30 Sep 2009 21:34:21 -0000
@@ -2,3 +2,4 @@
 name = BAWstats
 description = "View web statistics generated by the AWstats tool."
 core = 6.x
+dependencies[] = libraries
\ No newline at end of file
Index: includes/bawstats.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bawstats/includes/bawstats.admin.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 bawstats.admin.inc
--- includes/bawstats.admin.inc	24 Sep 2009 22:50:47 -0000	1.2.2.1
+++ includes/bawstats.admin.inc	30 Sep 2009 21:34:21 -0000
@@ -34,6 +34,7 @@ include(drupal_get_path('module', 'bawst
  */
 
 function bawstats_admin_settings() {
+  include_once './includes/install.inc';
   global $BAW_CONF,$BAW_LIB;
   $form = array();
 
@@ -73,15 +74,17 @@ function bawstats_admin_settings() {
     '#description' => t('Set this value to the directory where the AWStats language files are located (the "lang" directory under the AWstats tree). No trailing slash.'),
     '#weight' => -1
   );
-  $bawstats_path = drupal_get_path('module', 'bawstats');
+  $bawstats_icon = array();
+  $bawstats_icon['path'] = libraries_get_path('bawstats') . '/icon';
+  $bawstats_icon['installed'] = file_exists($bawstats_icon['path']); 
+  $status = array();
+  $status['icon'] = array(
+    'severity' => ($bawstats_icon['installed'] ? REQUIREMENT_OK : REQUIREMENT_ERROR),
+    'value' => $bawstats_icon['installed'] ? t('There is an icon directory at <code>' . $bawstats_icon['path'] . ' </code>.') : t('The AWstats icon directory is not in place. Copy or link the directory <code>wwwroot/icon</code> under the AWstats tree to <code>sites/all/libraries/bawstats/icon</code>.'),
+  );
   $form['bawstats_config']['bawstats_icon'] = array(
-    '#type' => 'textfield',
-    '#title' => t('AWstats icon directory'),
-    '#size' => 40,
-    '#maxlength' => 80,
-    '#default_value' => variable_get('bawstats_icon','/' . $bawstats_path . '/icon'),
-    '#description' => t('Set this value to the URL where AWStats icons can be obtained. Note, as this is used for icon URLs, this must be in web file space.  The default is to copy the icons to a directory called "icon" in the toplevel of the BAWstats module directory') . ' (' . $bawstats_path . '/icon).',
-    '#weight' => 0
+    '#type' => 'markup',
+    '#value' => theme('form_element', array('#title' => 'AWstats icon directory'), theme('status_report', $status)),
   );
   $form['bawstats_settings'] = array(
     '#type' => 'fieldset',
Index: includes/bawstats.config.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bawstats/includes/bawstats.config.inc,v
retrieving revision 1.2
diff -u -p -r1.2 bawstats.config.inc
--- includes/bawstats.config.inc	24 Mar 2008 21:58:17 -0000	1.2
+++ includes/bawstats.config.inc	30 Sep 2009 21:34:21 -0000
@@ -51,7 +51,7 @@ $BAW_CONF['drupal_base'] = 'admin/report
 $BAW_CONF['path_data'] = variable_get('bawstats_data','');
 $BAW_CONF['path_lib'] = variable_get('bawstats_lib','');
 $BAW_CONF['path_lang'] = variable_get('bawstats_lang','');
-$BAW_CONF['icons_url'] = variable_get('bawstats_icon','/' . $bawstats_path . '/icon');
+$BAW_CONF['icons_url'] = libraries_get_path('bawstats', TRUE) . '/icon';
 
 // drupal map
 $BAW_CONF_DIS['domains']['map'] = true;
