From f3409f422e2cbf3ffb47e77c770bac4bd2da63ff Mon Sep 17 00:00:00 2001 From: Alexis Wilke Date: Wed, 21 Apr 2010 10:32:17 +0000 Subject: [PATCH] * Moved a few things around in the settings screen. * Fixed a potential problem with themes. --- simplemenu.admin.inc | 76 ++++++++++++++++++++++++++++---------------- simplemenu.css | 2 ++ simplemenu.module | 7 ++-- 3 files changed, 54 insertions(+), 31 deletions(-) diff --git a/simplemenu.admin.inc b/simplemenu.admin.inc index d0b618fa..3a3c1a49 100644 --- a/simplemenu.admin.inc +++ b/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 not 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'), diff --git a/simplemenu.css b/simplemenu.css index ea63d736..a8f209ea 100644 --- a/simplemenu.css +++ b/simplemenu.css @@ -14,6 +14,8 @@ #simplemenu { line-height: 1.0; position: relative; + /*position: fixed; + top: 0;*/ z-index: 9999; } diff --git a/simplemenu.module b/simplemenu.module index 631c425f..19805461 100644 --- a/simplemenu.module +++ b/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(