Browse Source

* Moved a few things around in the settings screen.
* Fixed a potential problem with themes.

Alexis Wilke 15 years ago
parent
commit
f3409f422e
3 changed files with 54 additions and 31 deletions
  1. 48 28
      simplemenu.admin.inc
  2. 2 0
      simplemenu.css
  3. 4 3
      simplemenu.module

+ 48 - 28
simplemenu.admin.inc

@@ -50,6 +50,54 @@ function simplemenu_admin_settings() {
   );
 
 
+  // standard settings
+  $form['settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Advanced settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['settings']['simplemenu_hide_delay'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Hide delay'),
+    '#size' => 4,
+    '#default_value' => variable_get('simplemenu_hide_delay', 800),
+    '#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
+  );
+
+  $form['settings']['simplemenu_scroll_effect'] = array(
+    '#type' => 'radios',
+    '#title' => t('Scroll effect'),
+    '#options' => array(
+      'scroll' => t('Scroll with the page'),
+      'fixed' => t('Fixed'),
+    ),
+    '#default_value' => variable_get('simplemenu_scroll_effect', 'scroll'),
+    '#description' => t('Whether the menu scrolls with the page or stays at the top or bottom (this should only be used when the menu is attached to the <body> tag.)'),
+  );
+
+  $form['settings']['simplemenu_effect'] = array(
+    '#type' => 'radios',
+    '#title' => t('Show effect'),
+    '#options' => array(
+      'opacity' => t('Fade'),
+      'height' => t('Slide'),
+      'none' => t('None')
+    ),
+    '#default_value' => variable_get('simplemenu_effect', 'opacity'),
+    '#description' => t('The effect used when displaying a menu.'),
+  );
+
+  $form['settings']['simplemenu_effect_speed'] = array(
+    '#type' => 'radios',
+    '#title' => t('Show speed'),
+    '#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')),
+    '#default_value' => variable_get('simplemenu_effect_speed', 'fast'),
+    '#description' => t('The speed of the effect, not used when "none" is set to show effect.'),
+  );
+
+
   // advanced options
   $form['advanced'] = array(
     '#type' => 'fieldset',
@@ -97,34 +145,6 @@ function simplemenu_admin_settings() {
     '#description' => t('Select which themes to <strong>not</strong> display the menu. Use this when you have a theme that displays its own admin navigation.'),
   );
 
-  $form['advanced']['simplemenu_hide_delay'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Hide delay'),
-    '#size' => 4,
-    '#default_value' => variable_get('simplemenu_hide_delay', 800),
-    '#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
-  );
-
-  $form['advanced']['simplemenu_effect'] = array(
-    '#type' => 'radios',
-    '#title' => t('Show effect'),
-    '#options' => array(
-      'opacity' => t('Fade'),
-      'height' => t('Slide'),
-      'none' => t('None')
-    ),
-    '#default_value' => variable_get('simplemenu_effect', 'opacity'),
-    '#description' => t('The effect used when displaying a menu.'),
-  );
-
-  $form['advanced']['simplemenu_effect_speed'] = array(
-    '#type' => 'radios',
-    '#title' => t('Show speed'),
-    '#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')),
-    '#default_value' => variable_get('simplemenu_effect_speed', 'fast'),
-    '#description' => t('The speed of the effect, not used when "none" is set to show effect.'),
-  );
-
   $form['advanced']['simplemenu_detect_popop'] = array(
     '#type' => 'checkbox',
     '#title' => t('Detect pop-up windows'),

+ 2 - 0
simplemenu.css

@@ -14,6 +14,8 @@
 #simplemenu {
   line-height: 1.0;
   position: relative;
+  /*position: fixed;
+  top: 0;*/
   z-index: 9999;
 }
 

+ 4 - 3
simplemenu.module

@@ -50,10 +50,11 @@ function simplemenu_init() {
   if (user_access('view simplemenu') && simplemenu_enabled()) {
     $path = drupal_get_path('module', 'simplemenu');
     drupal_add_css($path .'/simplemenu.css');
-    $simplemenu_theme = variable_get('simplemenu_theme', 'original');
 
-    if ($simplemenu_theme != 'custom') {
-      drupal_add_css($path .'/themes/'. $simplemenu_theme .'/'. $simplemenu_theme .'.css');
+    $simplemenu_theme = variable_get('simplemenu_theme', 'original');
+    $theme_file = $path .'/themes/'. $simplemenu_theme .'/'. $simplemenu_theme .'.css';
+    if (is_file($theme_file)) {
+      drupal_add_css($theme_file);
     }
 
     $settings = array(