--- nice_menus.module	2006-08-11 07:16:28.000000000 -0700
+++ nice_menus.module	2007-02-06 14:14:18.000000000 -0800
@@ -4,37 +4,51 @@
   By Jake Gordon (jakeg)
   Module to enable nice navigation menus
   Modifications and help by Simon Rawson.
+  Drupal V5.x mods by Robin Beckett (SCT)
 */
 
 // Implementation of hook_help()
 function nice_menus_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      $output = t('Make drop down css/javascript menus for site navigation and admin menus');
-      break;
     case 'admin/settings/nice_menus':
-      $output = t('<p>This is a simple module that enables the site to have drop down css/javascript menus for site navigation and admin navigation.</p><p>Remember to activate and configure the menus in %link</p>', array('%link' => l('admin/block', 'admin/block')));
+      $output = t('<p>This is a simple module that enables the site to have drop down css/javascript menus for site navigation and admin navigation.</p><p>Remember to activate and configure the menus in !link</p>', array('!link' => l('admin/build/block', 'admin/build/block')));
       break;
   }
   return $output;
 }
 
+function nice_menus_perm() {
+  $array = array('administer nice menus');
+
+  return $array;
+}
 
 // Implemention of hook_menu()
 function nice_menus_menu($may_cache) {
-  if (!$may_cache) {
-    // We only want to include the JS for IE, not browsers capable of doing everything in css
-    // drupal_add_js(drupal_get_path('module', 'nice_menus').'/nice_menus.js');
-    drupal_add_js('misc/drupal.js'); // won't add if already added, but need this *before* our js
-    drupal_set_html_head('<!--[if lte IE 6]><script type="text/javascript" src="'. check_url(base_path() . drupal_get_path('module', 'nice_menus').'/nice_menus.js') .'"></script><![endif]-->');
+  $items = array();
 
-    theme_add_style(drupal_get_path('module', 'nice_menus').'/nice_menus.css');
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/nice_menus',
+      'title' => t('Nice Menus'),
+      'description' => t('Configure Nice Menus'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('nice_menus_admin_settings'),
+      'access' => user_access('administer nice menus'),
+      'type' => MENU_NORMAL_ITEM,
+    );
+  } else {
+    // We only want to include the JS for IE, not browsers capable of doing everything in css
+    drupal_add_js('misc/drupal.js', 'core', 'header'); // won't add if already added, but need this *before* our js
+    drupal_set_html_head('<!--[if lte IE 6]><script type="text/javascript" src="'. check_url(base_path() . drupal_get_path('module', 'nice_menus').'/nice_menus.js') .'"></script><![endif]-->'); // Has to be left as is, add_js always wraps with script tags
+    drupal_add_css(drupal_get_path('module', 'nice_menus') .'/nice_menus.css');
   }
+
+  return $items;
 }
 
 
-// Implementation of hook_settings()
-function nice_menus_settings() {
+function nice_menus_admin_settings() {
   $form['nice_menus_number'] = array(
     '#type' => 'select', 
     '#title' => t('Number of Nice Menus'), 
@@ -43,7 +57,7 @@
     '#options' => drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
   );
 
-  return $form;
+  return system_settings_form($form);
 }
 
 
