Commit 1d1bca51 authored by noahlively's avatar noahlively
Browse files

Initial commit.

parents
/* overrides - begin */
.muchomenu-menu li{
margin:0px 4px;
padding:0px;
line-height:120%;
}
.muchomenu-menu *{
list-style:none;
}
/* overrides - end */
.muchomenu-menu{
padding:0px 0px 5px 10px;
}
.muchomenu-menu a:hover{
text-decoration:none;
}
.muchomenu-menu .muchomenu-parent-title{
font-weight:normal;
font-size:110%;
vertical-align:bottom;
}
.muchomenu-menu .muchomenu-parent-title a,
.muchomenu-menu .muchomenu-parent-title span,
.muchomenu-menu .muchomenu-parent-title a:visited{
display: inline-block;
background: #fff;
border: 1px solid #eee;
font-style:normal;
color:#000; /* black */
padding:5px;
margin: 0px 5px;
}
.muchomenu-menu .muchomenu-parent-title a,
.muchomenu-menu .muchomenu-parent-title span,
.muchomenu-menu .hovering .muchomenu-parent-title a:hover{
-moz-border-radius-topright:8px;
-webkit-border-top-right-radius:8px;
-moz-border-radius-topleft:8px;
-webkit-border-top-left-radius:8px;
}
.muchomenu-menu .muchomenu-slot,
.muchomenu-menu .muchomenu-slot a:hover{
-moz-border-radius:8px;
-webkit-border-radius:8px;
border-radius:8px;
}
.muchomenu-menu li.muchomenu-slot{
/*width:auto;*/
/*max-width:200px;*/
width:200px;
margin:10px 10px auto auto;
padding-top:10px;
padding-bottom:10px;
}
.muchomenu-menu li.muchomenu-slot:hover{
background-color:#b08700; /* pharmacy dark gold */
}
.muchomenu-menu .hovering .muchomenu-parent-title a,
.muchomenu-menu .hovering .muchomenu-parent-title span{
color:#fff;
background:navy;
border-color: #000;
}
.muchomenu-menu .hovering .muchomenu-parent-title span:hover,
.muchomenu-menu .muchomenu-slot-title span{
cursor:default;
}
.muchomenu-menu .hovering .muchomenu-parent-title a:hover{
color:#fff; /* white */
background:#00325b; /* 540 blue */
}
.muchomenu-menu .muchomenu-bin{
margin-top:5px;
padding:0px;
}
.muchomenu-menu ul a:hover{
text-decoration:none;
}
/* start - ensure that #muchomenu-menu bar is the same height in all browsers
* very frustrating to get this correct - do not touch!
*--------------------------------------------------------*/
.muchomenu-menu .muchomenu-item a,
.muchomenu-menu .muchomenu-item span
{
font-size:120%;
}
.muchomenu-menu,
.muchomenu-menu .muchomenu-parent,
.muchomenu-menu .muchomenu-parent-title
/* this is the key -- all these must be set to the same value */
{
font-size:100%;
line-height:110%;
height:100%;
}
.muchomenu-menu .muchomenu-parent-title a,
.muchomenu-menu .muchomenu-parent-title a:link,
.muchomenu-menu .muchomenu-parent-title a:visited,
.muchomenu-menu .muchomenu-parent-title a:focus,
.muchomenu-menu .muchomenu-parent-title a:hover,
.muchomenu-menu .muchomenu-parent-title a:active,
.muchomenu-menu .muchomenu-parent-title span
{
padding:4px 8px;
}
/* end - ensure that #muchomenu-menu bar is the same height in all browsers
*--------------------------------------------------------*/
.muchomenu-menu .muchomenu-parent-title a:hover {
text-decoration:none;
color:#fff; /* white */
background:#00325b; /* 540 blue coated */
}
\ No newline at end of file
/*=============================================================
* mucho MENU
*-------------------------------------------------------------
* This style sheet is divided into the following 3 sections:
* 1 Fundamentals
* 1.1 Reset
* 1.2 Structure
* 1.3 Default styles
* 2 User Overrides
* 2.1 Widths, margins, and padding
* 2.2 Vertical menu
* 2.3 Horizontal slots
* 3 Skins
*=============================================================*/
/* @group Fundamentals */
/* Reset
*------------------------------------------------------------*/
/* @group Reset */
/*
.muchomenu-menu,
.muchomenu-menu *,
.muchomenu-menu .muchomenu-parent,
.muchomenu-menu .muchomenu-parent-title,
.muchomenu-menu .muchomenu-bin,
.muchomenu-menu .muchomenu-slot,
.muchomenu-menu .muchomenu-slot-title,
.muchomenu-menu .muchomenu-items {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
font-weight: normal;
vertical-align: baseline;
background: transparent;
}
*/
ul.muchomenu-menu,
.muchomenu-menu ul.muchomenu-items, .muchomenu-menu li.muchomenu-parent {
list-style: none;
background: none;
}
/* @end */
/* Structure
*------------------------------------------------------------*/
/* @group Structure */
.muchomenu-menu {
overflow: visible; /* Contain floated elements */
}
.muchomenu-menu .muchomenu-parent {
display: inline-block;
position: relative;
z-index: 1;
}
.muchomenu-menu .muchomenu-parent-title {
display: inline;
}
.muchomenu-menu .muchomenu-bin {
position: absolute;
left: 0; /* Default horizontal orientation */
top: -9000px; /* default hidden position */
z-index: 10000;
overflow: hidden;
}
/* Bin Alignment
*--------------------------------------------------------*/
.muchomenu-menu .muchomenu-bin-right{
left:auto;
right:-500px;
}
/* @group Horizontal Links */
.muchomenu-menu .muchomenu-links-horizontal {
overflow: hidden;
}
.muchomenu-menu .muchomenu-links-horizontal li,
.muchomenu-menu .muchomenu-links-horizontal li a {
float: left;
}
/* @end Horizontal Links */
.muchomenu-menu-vertical .muchomenu-parent {
display: block;
}
/* @end Structure */
/* Default styles
*--------------------------------------------------------*/
/* @group Default styles */
.muchomenu-menu ul a {
text-decoration: none;
}
.muchomenu-menu ul a:hover {
text-decoration: underline;
}
/* @end */
/* @end Fundamentals */
/* User Overrides
*
* This part will have to be dynamically generated in the
* customization admin screen. The user can specify the
* proper widths for structural elements according to the
* ID of the mucho menu.
*--------------------------------------------------------*/
/* @group Widths, Padding, & Margins */
.muchomenu-parent {
margin: 0.1em 1em; /* Left margin affects fly-out value */
}
.muchomenu-menu .muchomenu-bin {
padding: 0.5em;
}
.muchomenu-menu .muchomenu-slot {
width: 200px; /* move this to skins or php */
margin-bottom: 0.5em;
}
/* Vertical Orientation
*--------------------------------------------------------*/
/* @group Vertical Menu */
.muchomenu-menu-vertical {
width: 8em;
}
.muchomenu-menu-vertical .muchomenu-parent {
margin-top: 1em;
}
.muchomenu-slots.flyright {
left: 7em; /* [muchomenu-menu-vertical] (width) - [muchomenu-parent] (margin) */
top: 0;
}
.muchomenu-slots.flyleft {
left: -16.2em; /* Calculation of this value did not seem straightforward */
top: 0;
}
/* @end */
/* Horizontal Orientation
*--------------------------------------------------------*/
/* @group Horizontal Slots */
/* This value will have to be calculated to account for slot widths + margins */
/* 2009.1009.1437 EFD: this width conflicted with our layout. it made more sense for us to set width on the slots themselves. unsure how the interface should handle this. */
.muchomenu-menu .muchomenu-slots-columnar {
overflow: hidden; /* contain floated slots */
}
.muchomenu-slots-columnar li.muchomenu-slot {
float: left;
}
/* @end Horizontal Slots */
/* @end Widths*/
/* muchomenu-menu end */
/* section: muchomenu-skins */
.muchomenu-bin .panel-display {
padding: 20px;
background: #eee;
border: 1px solid #ccc;
border-radius: 10px;
width: 450px;
}
\ No newline at end of file
<?php
// $Id: muchomenu.admin.inc,v 1.1.2.6 2010/09/28 21:33:00 pobster Exp $
/**
* @file
* Administrative page callbaks for muchomenu module.
*/
/**
* Menu callback which shows an overview page of all the custom muchomenus and their descriptions.
*/
function muchomenu_overview_page() {
$sql = "SELECT id, title, description FROM {muchomenu_menus} ORDER BY title;";
$result = db_query($sql);
$content = array();
foreach ($result as $menu) {
$menu->href = 'admin/structure/menu/muchomenu-customize/' . $menu->id;
$menu->localized_options = array();
$menu->description = filter_xss_admin($menu->description);
$content[] = (array) $menu;
}
if (empty($content)) {
$content[] = array(
'description' => t('There are no muchomenus yet.'),
'localized_options' => array()
);
}
return theme('admin_block_content', array('content' => $content));
}
/**
* Title callback for the menu overview page and links.
*/
function muchomenu_overview_title($menu) {
return check_plain($menu['title']);
}
/**
* Form for editing an entire muchomenu tree at once.
*
* Shows for one menu the muchomenu items and relevant operations.
*/
function muchomenu_overview_form($form, &$form_state, $menu = array()) {
$tree = muchomenu_tree_data($menu['id']);
$form = array_merge($form, _muchomenu_overview_tree_form($tree));
$form['#menu'] = $menu;
if (element_children($form)) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
}
else {
$form['empty_menu'] = array('#value' => t('There are no muchomenu items yet.'));
}
return $form;
}
/**
* Recursive helper function for muchomenu_overview_form().
*/
function _muchomenu_overview_tree_form($tree) {
static $form = array('#tree' => TRUE);
foreach ($tree as $data) {
$title = '';
$item = $data['link'];
if ($item) {
$id = 'id:' . $item['id'];
$form[$id]['#item'] = $item;
$form[$id]['#attributes']['class'] = (!$item['enabled']) ? array('menu-disabled') : array('menu-enabled');
$form[$id]['title']['#markup'] = l($item['title'], $item['path']) . (!$item['enabled'] ? ' (' . t('disabled') . ')' : '');
$form[$id]['enabled'] = array(
'#type' => 'checkbox',
'#default_value' => $item['enabled'],
);
$form[$id]['target'] = array(
'#type' => 'checkbox',
'#default_value' => $data['link']['target'],
);
$form[$id]['disable_click'] = array(
'#type' => 'checkbox',
'#default_value' => $data['link']['disable_click'],
);
$form[$id]['weight'] = array(
'#type' => 'weight',
'#delta' => 50,
'#default_value' => isset($form_state[$id]['weight']) ? $form_state[$id]['weight'] : $item['weight'],
);
$form[$id]['id'] = array(
'#type' => 'hidden',
'#value' => $item['id'],
);
$form[$id]['menu_id'] = array(
'#type' => 'hidden',
'#default_value' => isset($form_state[$id]['menu_id']) ? $form_state[$id]['menu_id'] : $item['menu_id'],
'#size' => 6,
);
// Build a list of operations.
$operations = array();
$operations['edit'] = l(t('edit'), 'admin/structure/menu/muchomenu/item/' . $item['id'] . '/edit');
$operations['delete'] = l(t('delete'), 'admin/structure/menu/muchomenu/item/' . $item['id'] . '/delete');
$form[$id]['operations'] = array();
foreach ($operations as $op => $value) {
$form[$id]['operations'][$op] = array('#markup' => $value);
}
}
if ($data['below']) {
_muchomenu_overview_tree_form($data['below']);
}
}
return $form;
}
/**
* Submit handler for the menu overview form.
*/
function muchomenu_overview_form_submit($form, &$form_state) {
$updated_items = array();
$fields = array('enabled', 'type', 'weight', 'menu_id', 'target', 'disable_click');
foreach ($form_state['values'] as $id => $value) {
if (isset($form[$id]['#item'])) {
$element = $form[$id];
// Update any fields that have changed in this menu item.
foreach ($fields as $field) {
if ($element[$field]['#value'] != $element[$field]['#default_value']) {
$element['#item'][$field] = $element[$field]['#value'];
$updated_items[$id] = $element['#item'];
}
}
}
}
// Save all our changed items to the database.
foreach ($updated_items as $item) {
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query("
* UPDATE {muchomenu_items} SET
* menu_id = %d, enabled = %d, weight = %d, target = %d, disable_click = %d
* WHERE id = %d
* ",
* $item['menu_id'], $item['enabled'], $item['weight'],
* $item['target'], $item['disable_click'], $item['id'])
*/
db_update('muchomenu_items')
->fields(array(
'menu_id' => $item['menu_id'],
'enabled' => $item['enabled'],
'weight' => $item['weight'],
'target' => $item['target'],
'disable_click' => $item['disable_click'],
))
->condition('id', $item['id'])
->execute();
}
}
/**
* Menu callback; Build the form that handles the adding/editing of a custom menu.
*/
function muchomenu_edit_menu($form, &$form_state, $type, $menu = array()) {
if ($type == 'edit') {
$form['id'] = array('#type' => 'value', '#value' => $menu['id']);
$form['#insert'] = FALSE;
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array('muchomenu_delete_menu_submit'),
'#weight' => 10,
);
}
else {
$menu = array('title' => '', 'description' => '', 'orientation' => 'horizontal');
$form['#insert'] = TRUE;
}
$form['#title'] = $menu['title'];
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $menu['title'],
'#required' => TRUE,
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#default_value' => $menu['description'],
);
$form['orientation'] = array(
'#type' => 'radios',
'#title' => t('Menu Layout'),
'#options' => array(
'horizontal' => t('Horizontal'),
'vertical' => t('Vertical'),
),
'#default_value' => $menu['orientation'],
'#description' => t('Select whether the menu will extend horizontally and drop down, or if it will extend vertically and fly out.'),
);
$form['animation_effect'] = array(
'#type' => 'select',
'#title' => t('Animation Effect'),
'#options' => array(
'' => t('None'),
'fade' => t('Fade'),
'slide' => t('Slide'),
),
'#default_value' => $menu['animation_effect'],
'#description' => t('Choose the effect to use when showing or hiding the menu'),
);
/*
$form['animation_speed'] = array(
'#type' => 'select',
'#title' => t('Animation Speed'),
'#options' => array(
'slow' => t('Slow'),
'fast' => t('Fast'),
),
'#default_value' => $menu['animation_speed'],
'#description' => t('Choose the speed at which to show the effect'),
);
*/
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}
/**
* Submit function for adding or editing a custom menu.
*/
function muchomenu_edit_menu_submit($form, &$form_state) {
$menu = $form_state['values'];
$path = 'admin/structure/menu/muchomenu-customize/';
if ($form['#insert']) {
$obj = new stdClass();
$key = NULL;
}
else {
$obj = (object) muchomenu_load($menu['id']);
$key = 'id';
}
$obj->title = $menu['title'];
$obj->description = $menu['description'];
$obj->orientation = $menu['orientation'];
$obj->animation_effect = $menu['animation_effect'];
$obj->animation_speed = $menu['animation_speed'];
drupal_write_record('muchomenu_menus', $obj, $key);
if ($form['#insert']) {
$menu['id'] = $obj->id;
}
$form_state['redirect'] = $path . $menu['id'];
}
/**
* Submit function for the 'Delete' button on the menu editing form.
*/
function muchomenu_delete_menu_submit($form, &$form_state) {
$form_state['redirect'] = 'admin/structure/menu/muchomenu-customize/' . $form_state['values']['id'] . '/delete';
}
/**
* Build a confirm form for deletion of a custom menu.
*/
function muchomenu_delete_menu_confirm($form, &$form_state, $menu) {
$form['#menu'] = $menu;
$caption = '<p>' . t('This action cannot be undone.') . '</p>';
return confirm_form($form, t('Are you sure you want to delete the muchomenu %title?', array('%title' => $menu['title'])), 'admin/structure/menu/muchomenu-customize/' . $menu['id'], $caption, t('Delete'));
}
/**
* Delete a muchomenu and all items in it.
*/
function muchomenu_delete_menu_confirm_submit($form, &$form_state) {
$menu = $form['#menu'];
$form_state['redirect'] = 'admin/structure/menu/muchomenu';
$menu_id = $menu['id'];
$items = muchomenu_get_items_by_menu($menu_id);
if ($items) {
foreach ($items as $item) {
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query('DELETE FROM {muchomenu_items} WHERE id = %d', $item['id']) */
db_delete('muchomenu_items')
->condition('id', $item['id'])
->execute();
}
}
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query('DELETE FROM {muchomenu_menus} WHERE id = %d', $menu_id) */
db_delete('muchomenu_menus')
->condition('id', $menu_id)
->execute();
cache_clear_all();
drupal_set_message(t('The menu %title and all its menu items have been deleted.', array('%title' => $menu['title'])));
watchdog('muchomenu', 'Deleted menu %title and all its menu items.', array('%title' => $menu['title']), WATCHDOG_NOTICE);
}
/**
* Menu callback; Build the menu link editing form.
*/
function muchomenu_edit_item($form, &$form_state, $type, $item, $menu) {
if ($type == 'add' || empty($item)) {
$menu_id = isset($menu['id']) ? $menu['id'] : 0;
}
if ($type == 'edit') {
$menu_id = $item['menu_id'];