renaming menu bar module to SimpleMenu module
This commit is contained in:
parent
1ed6151591
commit
60cc6ae1a3
10
README.txt
10
README.txt
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
--- README -------------------------------------------------------------
|
--- README -------------------------------------------------------------
|
||||||
|
|
||||||
Menu Bar, Version 2.0
|
SimpleMenu, Version 2.0
|
||||||
|
|
||||||
Written by Ted Serbinski, aka, m3avrck
|
Written by Ted Serbinski, aka, m3avrck
|
||||||
hello@tedserbinski.com
|
hello@tedserbinski.com
|
||||||
@ -17,10 +17,10 @@ Icons from: http://www.famfamfam.com/
|
|||||||
|
|
||||||
--- INSTALLATION --------------------------------------------------------
|
--- INSTALLATION --------------------------------------------------------
|
||||||
|
|
||||||
1. Place menu_bar folder in your modules directory
|
1. Place simplemenu folder in your modules directory
|
||||||
|
|
||||||
2. Enable "menu bar" under administer > site configuration > modules
|
2. Enable "SimpleMenu" under administer > site configuration > modules
|
||||||
|
|
||||||
3. Enable access to "view menu bar" under administer > user management > access control
|
3. Enable access to "view simplemenu" under administer > user management > access control
|
||||||
|
|
||||||
4. Configure menu to use under administer > site configuration > menu bar
|
4. Configure menu to use under administer > site configuration > simplemenu
|
@ -1,6 +1,6 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
ul#menubar,ul#menubar ul,ul#menubar li,ul#menubar a {
|
ul#simplemenu,ul#simplemenu ul,ul#simplemenu li,ul#simplemenu a {
|
||||||
color:#333;
|
color:#333;
|
||||||
display:block;
|
display:block;
|
||||||
list-style:none;
|
list-style:none;
|
||||||
@ -9,7 +9,7 @@ padding:0;
|
|||||||
z-index:48;
|
z-index:48;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar {
|
ul#simplemenu {
|
||||||
background:#eee;
|
background:#eee;
|
||||||
border-bottom:1px solid #a3a3a3;
|
border-bottom:1px solid #a3a3a3;
|
||||||
font:12px Arial, Helvetica, sans-serif;
|
font:12px Arial, Helvetica, sans-serif;
|
||||||
@ -20,11 +20,11 @@ width:100%;
|
|||||||
height:22px;
|
height:22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li {
|
ul#simplemenu li {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li a {
|
ul#simplemenu li a {
|
||||||
background:#ccc;
|
background:#ccc;
|
||||||
border-right:1px solid #a3a3a3;
|
border-right:1px solid #a3a3a3;
|
||||||
font-weight:400;
|
font-weight:400;
|
||||||
@ -32,26 +32,26 @@ padding:0.3em 0.6em;
|
|||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li:hover > a {
|
ul#simplemenu li:hover > a {
|
||||||
background:orange;
|
background:orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar ul li a {
|
ul#simplemenu ul li a {
|
||||||
border:none;
|
border:none;
|
||||||
width:11em;
|
width:11em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li.leaf {
|
ul#simplemenu li.leaf {
|
||||||
background:#eee url(bullet_go.gif) no-repeat 0.2em;
|
background:#eee url(bullet_go.gif) no-repeat 0.2em;
|
||||||
padding-left:2em;
|
padding-left:2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li.expanded {
|
ul#simplemenu li.expanded {
|
||||||
background:#eee url(folder.gif) no-repeat 0.2em;
|
background:#eee url(folder.gif) no-repeat 0.2em;
|
||||||
padding-left:2em;
|
padding-left:2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li ul {
|
ul#simplemenu li ul {
|
||||||
background:#ccc;
|
background:#ccc;
|
||||||
border:1px solid #a3a3a3;
|
border:1px solid #a3a3a3;
|
||||||
left:-9999px;
|
left:-9999px;
|
||||||
@ -60,14 +60,14 @@ width:15em;
|
|||||||
z-index:24;
|
z-index:24;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li ul ul {
|
ul#simplemenu li ul ul {
|
||||||
margin:0 0 0 3em;
|
margin:0 0 0 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li:hover ul ul,ul#menubar li:hover ul ul ul,ul#menubar li.sfhover ul ul,ul#menubar li.sfhover ul ul ul {
|
ul#simplemenu li:hover ul ul,ul#simplemenu li:hover ul ul ul,ul#simplemenu li.sfhover ul ul,ul#simplemenu li.sfhover ul ul ul {
|
||||||
left:-9999px;
|
left:-9999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#menubar li:hover ul,ul#menubar li li:hover ul,ul#menubar li li li:hover ul,ul#menubar li.sfhover ul,ul#menubar li li.sfhover ul,ul#menubar li li li.sfhover ul {
|
ul#simplemenu li:hover ul,ul#simplemenu li li:hover ul,ul#simplemenu li li li:hover ul,ul#simplemenu li.sfhover ul,ul#simplemenu li li.sfhover ul,ul#simplemenu li li li.sfhover ul {
|
||||||
left:auto;
|
left:auto;
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
name = Menu bar
|
name = SimpleMenu
|
||||||
description = Creates a menu bar that is displayed at the top of every page.
|
description = Creates a menu bar that is displayed at the top of every page.
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// get the Drupal basepath
|
// get the Drupal basepath
|
||||||
var basePath = Drupal.settings.menu_bar.basePath;
|
var basePath = Drupal.settings.simplemenu.basePath;
|
||||||
|
|
||||||
// insert extra <br /> so menu doesn't overlap theme
|
// insert extra <br /> so menu doesn't overlap theme
|
||||||
$('<ul id="menubar" class="clear-block"></ul>').prependTo('body').slideDown(400);
|
$('<ul id="simplemenu" class="clear-block"></ul>').prependTo('body').slideDown(400);
|
||||||
|
|
||||||
// Drupal menu callback
|
// Drupal menu callback
|
||||||
$('#menubar').load(basePath + 'menu_bar/menu', function() {
|
$('#simplemenu').load(basePath + 'simplemenu/menu', function() {
|
||||||
$('li', this).hover(function() {
|
$('li', this).hover(function() {
|
||||||
$('ul', this).slideDown(200);
|
$('ul', this).slideDown(200);
|
||||||
}, function() {});
|
}, function() {});
|
||||||
|
@ -3,42 +3,42 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Creates a menu bar.
|
* Creates a simplemenu.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_menu().
|
* Implementation of hook_menu().
|
||||||
*/
|
*/
|
||||||
function menu_bar_menu($may_cache) {
|
function simplemenu_menu($may_cache) {
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
if ($may_cache) {
|
if ($may_cache) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'path' => 'menu_bar/menu',
|
'path' => 'simplemenu/menu',
|
||||||
'access' => user_access('view menu bar'),
|
'access' => user_access('view simplemenu'),
|
||||||
'callback' => 'menu_bar_get_menu',
|
'callback' => 'simplemenu_get_menu',
|
||||||
'type' => MENU_CALLBACK
|
'type' => MENU_CALLBACK
|
||||||
);
|
);
|
||||||
|
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'path' => 'admin/settings/menu_bar',
|
'path' => 'admin/settings/simplemenu',
|
||||||
'title' => t('Menu bar'),
|
'title' => t('SimpleMenu'),
|
||||||
'description' => t('Set which menus should appear in the menu bar.'),
|
'description' => t('Select the menu to display.'),
|
||||||
'callback' => 'drupal_get_form',
|
'callback' => 'drupal_get_form',
|
||||||
'callback arguments' => array('menu_bar_admin_settings'),
|
'callback arguments' => array('simplemenu_admin_settings'),
|
||||||
'access' => user_access('administer menu bar')
|
'access' => user_access('administer simplemenu')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We put this in !$may_cache so it's only added once per request
|
// We put this in !$may_cache so it's only added once per request
|
||||||
elseif (user_access('view menu bar')) {
|
elseif (user_access('view simplemenu')) {
|
||||||
$path = drupal_get_path('module', 'menu_bar');
|
$path = drupal_get_path('module', 'simplemenu');
|
||||||
drupal_add_css($path .'/menu_bar.css');
|
drupal_add_css($path .'/simplemenu.css');
|
||||||
|
|
||||||
// pass in base path to the JS file
|
// pass in base path to the JS file
|
||||||
// url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
|
// url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
|
||||||
drupal_add_js(array('menu_bar' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
|
drupal_add_js(array('simplemenu' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
|
||||||
drupal_add_js($path .'/menu_bar.js');
|
drupal_add_js($path .'/simplemenu.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
@ -47,26 +47,26 @@ function menu_bar_menu($may_cache) {
|
|||||||
/**
|
/**
|
||||||
* Implementation of hook_perm().
|
* Implementation of hook_perm().
|
||||||
*/
|
*/
|
||||||
function menu_bar_perm() {
|
function simplemenu_perm() {
|
||||||
return array('view menu bar', 'administer menu bar');
|
return array('view simplemenu', 'administer simplemenu');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu bar settings page
|
* SimpleMenu settings page.
|
||||||
*/
|
*/
|
||||||
function menu_bar_admin_settings() {
|
function simplemenu_admin_settings() {
|
||||||
$form['default_menu']['menu_bar_menu'] = array(
|
$form['default_menu']['simplemenu_menu'] = array(
|
||||||
'#type' => 'select',
|
'#type' => 'select',
|
||||||
'#title' => t('Menu'),
|
'#title' => t('Menu'),
|
||||||
'#options' => menu_get_root_menus(),
|
'#options' => menu_get_root_menus(),
|
||||||
'#default_value' => variable_get('menu_bar_menu', 1),
|
'#default_value' => variable_get('simplemenu_menu', 1),
|
||||||
'#description' => t('Select the menu to display in the menu bar.')
|
'#description' => t('Select the menu to display.')
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['default_menu']['menu_bar_devel'] = array(
|
$form['default_menu']['simplemenu_devel'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('Add devel module links'),
|
'#title' => t('Add devel module links'),
|
||||||
'#default_value' => variable_get('menu_bar_devel', 0),
|
'#default_value' => variable_get('simplemenu_devel', 0),
|
||||||
'#description' => t('Add devel module links for those users that can access the devel module.')
|
'#description' => t('Add devel module links for those users that can access the devel module.')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -75,12 +75,12 @@ function menu_bar_admin_settings() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of devel module links if the module is enabled
|
* Return a list of devel module links if the module is enabled
|
||||||
* and the user has access to this module
|
* and the user has access to this module.
|
||||||
*/
|
*/
|
||||||
function menu_bar_get_devel() {
|
function simplemenu_get_devel() {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (variable_get('menu_bar_devel', 0) && module_exists('devel')) {
|
if (variable_get('simplemenu_devel', 0) && module_exists('devel')) {
|
||||||
if (user_access('access devel information')) {
|
if (user_access('access devel information')) {
|
||||||
$links[] = l('module settings', 'admin/settings/devel');
|
$links[] = l('module settings', 'admin/settings/devel');
|
||||||
$links[] = l('empty cache', 'devel/cache/clear');
|
$links[] = l('empty cache', 'devel/cache/clear');
|
||||||
@ -105,11 +105,11 @@ function menu_bar_get_devel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom implementation of menu_tree()
|
* Custom implementation of menu_tree().
|
||||||
* We want to retrieve the entire menu structure for a given menu,
|
* We want to retrieve the entire menu structure for a given menu,
|
||||||
* regardless of whether or not the menu item is expanded or not.
|
* regardless of whether or not the menu item is expanded or not.
|
||||||
*/
|
*/
|
||||||
function menu_bar_menu_tree($pid = 1) {
|
function simplemenu_menu_tree($pid = 1) {
|
||||||
$menu = menu_get_menu();
|
$menu = menu_get_menu();
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ function menu_bar_menu_tree($pid = 1) {
|
|||||||
foreach ($menu['visible'][$pid]['children'] as $mid) {
|
foreach ($menu['visible'][$pid]['children'] as $mid) {
|
||||||
$type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL;
|
$type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL;
|
||||||
$children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL;
|
$children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL;
|
||||||
$output .= theme('menu_item', $mid, menu_bar_theme_menu_tree($mid), count($children) == 0);
|
$output .= theme('menu_item', $mid, simplemenu_theme_menu_tree($mid), count($children) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,25 +125,25 @@ function menu_bar_menu_tree($pid = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom implementation of theme_menu_tree() to call our custom menu above
|
* Custom implementation of theme_menu_tree() to call our custom menu above.
|
||||||
*/
|
*/
|
||||||
function menu_bar_theme_menu_tree($pid = 1) {
|
function simplemenu_theme_menu_tree($pid = 1) {
|
||||||
if ($tree = menu_bar_menu_tree($pid)) {
|
if ($tree = simplemenu_menu_tree($pid)) {
|
||||||
return '<ul>'. $tree .'</ul>';
|
return '<ul>'. $tree .'</ul>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AJAX menu callback to return an HTML list of links for a given menu
|
* AJAX menu callback to return an HTML list of links for a given menu.
|
||||||
*/
|
*/
|
||||||
function menu_bar_get_menu() {
|
function simplemenu_get_menu() {
|
||||||
$menu = menu_bar_menu_tree(variable_get('menu_bar_menu', 1));
|
$menu = simplemenu_menu_tree(variable_get('simplemenu_menu', 1));
|
||||||
|
|
||||||
if (!$menu) {
|
if (!$menu) {
|
||||||
$menu = '<li><a href="'. url('admin/settings/menu_bar') .'">'. t('No menu items found. Try a different menu as the default.') .'</a></li>';
|
$menu = '<li><a href="'. url('admin/settings/simplemenu') .'">'. t('No menu items found. Try a different menu as the default.') .'</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print menu_bar_get_devel();
|
print simplemenu_get_devel();
|
||||||
print $menu;
|
print $menu;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user