merged editmenu submodule

This commit is contained in:
Bachir Soussi Chiadmi 2015-04-19 16:06:48 +02:00
commit 72cf8934c3
27 changed files with 2111 additions and 0 deletions

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,62 @@
--- README -------------------------------------------------------------
EditMenu, Version 6.0
Written by Ted Serbinski, aka, m3avrck
hello@tedserbinski.com
http://tedserbinski.com
Requirements: Drupal 6.x
jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/
--- INSTALLATION --------------------------------------------------------
1. Place editmenu folder in your modules directory
2. Enable "EditMenu" under administer > site building > modules
3. Enable access to "view editmenu" under administer > user management > access control
4. Configure menu to use under administer > site configuration > editmenu
--- CHANGELOG --------------------------------------------------------
6.0, 2008-xx-xx
----------------------
- compatible with Drupal 6.x
- Superfish 1.4.1
- separate superfish.js into own file
- remove devel links, since devel module links in 6.x can be moved to any menu now
5.0, 2008-Jan-26
----------------------
- #199224, fix display issues in IE6/7
- #200086, don't load non-existent custom.css file
- #195972, better default CSS to avoid conflicts with themes
- #199715, remove absolute positioning to improve theme and CSS attaching compatibility
- #199882, new options for controlling menu effects and timing
4.0, 2007-Nov-22
----------------------
- new CHANGELOG to keep track of changes
- #156256 upgrade to SuperFish 1.3
- upgrade to bgIframe 2.1.1 (for IE6 compatibility with forms)
- #136478 - fix Opera compatibility
- remove RTL option; this conflicts with other changes and is properly implemented in Drupal 6
- new option to select which theme to style EditMenu with, or provide a custom one
- #184051 - don't hardcode CSS, add class to body
- #180106 - fix missing translatable strings
- #144742 - don't show annoying anchor titles
- remove dependency on menu module, now works with menu module off
- new black & blue theme, design by Jeremy Caldwell (http://nerdliness.com/article/2007/11/01/editmenu-module-customizations)
- alter height of menu and rollover to fix gaps

View File

@ -0,0 +1,245 @@
<?php
/**
* @file
* Settings of the editmenu.
*/
/**
* EditMenu settings page.
*/
function editmenu_admin_settings() {
$editmenu_path = drupal_get_path('module', 'editmenu');
// menu selection
$form['default_menu'] = array(
'#type' => 'fieldset',
'#title' => t('Menu settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if (module_exists('menu')) {
$form['default_menu']['editmenu_menu'] = array(
'#type' => 'select',
'#title' => t('Menu'),
'#options' => menu_parent_options(menu_get_menus(), array('mlid' => 0)), // return complete tree
'#default_value' => variable_get('editmenu_menu', 'management:0'),
'#description' => t('Select the menu to display.'),
'#weight' => -1,
);
}
$themes = file_scan_directory($editmenu_path . '/themes', '%.*%',
array('key' => 'filename', 'recurse' => FALSE));
$theme_selection = array('custom' => 'custom');
foreach ($themes as $name => $ignore) {
$theme_selection[$name] = $name;
}
$form['default_menu']['editmenu_theme'] = array(
'#type' => 'select',
'#title' => t('Theme'),
'#options' => $theme_selection,
'#default_value' => variable_get('editmenu_theme', 'original'),
'#description' => t('Select which theme to use. If you specify custom, you need to define CSS in your theme.'),
);
// standard settings
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Editmenu settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$fix_options = array(
'scroll' => t('Scroll with page'),
'top' => t('Fix at the Top (Forces Body, Prepend)'),
//'bottom' => t('Fix at the Bottom (Forces Body, Append)'), -- this requires another CSS... hmmm...
);
$form['settings']['editmenu_fix'] = array(
'#type' => 'radios',
'#title' => t('Scroll or fix menu'),
'#options' => $fix_options,
'#default_value' => variable_get('editmenu_fix', 'scroll'),
'#description' => t('Select the mode to use. The default is to let the menu scroll with the page.')
. '<br /><span style="color: red;">' . t('WARNING') . ':</span> '
. t('The At the Top option prevents you from ever seeing the bottom of your drop-down menus when they are too long. In other words, if you have many modules installed, it is not unlikely that some drop down menus will not fit the height of the screen and the last few entries won\'t be accessible via Editmenu.'),
);
$form['settings']['editmenu_hide_delay'] = array(
'#type' => 'textfield',
'#title' => t('Hide delay'),
'#size' => 4,
'#default_value' => variable_get('editmenu_hide_delay', 800),
'#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
);
$form['settings']['editmenu_effect'] = array(
'#type' => 'radios',
'#title' => t('Show effect'),
'#options' => array(
'opacity' => t('Fade'),
'height' => t('Slide'),
'none' => t('None')
),
'#default_value' => variable_get('editmenu_effect', 'opacity'),
'#description' => t('The effect used when displaying a menu.'),
);
$form['settings']['editmenu_effect_speed'] = array(
'#type' => 'radios',
'#title' => t('Show speed'),
'#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')),
'#default_value' => variable_get('editmenu_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',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['advanced']['editmenu_uid1'] = array(
'#type' => 'checkbox',
'#title' => t('Show to User ID 1'),
'#description' => t('Check this option to enable editmenu for user 1 (superuser/administration). This is useful if you want to use a different menu (such as admin_menu) for the superuser/admin and editmenu for others.'),
'#default_value' => variable_get('editmenu_uid1', 1),
);
$superfish_js = file_scan_directory($editmenu_path, '%^superfish-[0-9.]*\.js$%',
array('key' => 'filename', 'recurse' => FALSE));
$superfish = array('custom' => 'custom or theme');
foreach ($superfish_js as $name => $ignore) {
$superfish[$name] = $name;
}
$form['advanced']['editmenu_superfish_version'] = array(
'#type' => 'select',
'#title' => t('SuperFish Version'),
'#options' => $superfish,
'#description' => t('Select which version of SuperFish you prefer using. The choice "custom or theme" means that Editmenu does not include one of its own version of Superfish. It is expected that another module or your theme does so already.'),
'#default_value' => variable_get('editmenu_superfish_version', 'superfish-1.4.1.js'),
);
$scope = array(
'header' => 'Header',
'footer' => 'Footer',
);
$form['advanced']['editmenu_menu_scope'] = array(
'#type' => 'select',
'#title' => t('Scope of editmenu variable'),
'#options' => $scope,
'#description' => t('By default, the <code>editmenu</code> variable is put in the footer (backward compatible.) It is possible to put it in the header instead.'),
'#default_value' => variable_get('editmenu_menu_scope', 'footer'),
);
$form['advanced']['editmenu_cache_menu'] = array(
'#type' => 'checkbox',
'#title' => t('Cache the editmenu variable'),
'#description' => t('The Editmenu now has the capability to cache the editmenu variable in a .js file. This accelerate the transfer by using the Browser cache.'),
'#default_value' => variable_get('editmenu_cache_menu', TRUE),
);
$form['advanced']['editmenu_menubar_zindex'] = array(
'#type' => 'textfield',
'#title' => t('Menubar CSS z-index value'),
'#description' => t('By default, the menubar CSS z-index is set to 9999. Some themes or other modules may require you to change this value. Use -1 to completely disable the z-index in the menubar. If this value is not set to -1, then the following z-index will not have any effect and can as well be set to -1.'),
'#default_value' => variable_get('editmenu_menubar_zindex', 9999),
);
$form['advanced']['editmenu_dropdown_zindex'] = array(
'#type' => 'textfield',
'#title' => t('Dropdown CSS z-index value'),
'#description' => t('By default, the dropdown CSS z-index is set to 9999. However, some themes and modules use an even larger z-index. For instance, the AddThis overlay is put at z-index 100,000 (although from my tests, it seems that they use a much higher z-index...). So if you want the Editmenu to appear over the AddThis pop-up, you want to use a z-index which is even larger (i.e. 2,000,000 [do not enter the commas!].) On the other hand, 9999 may be too large for your site. You can use a smaller number if that works better for you. Use -1 to not remove the z-index from your dropdown.'),
'#default_value' => variable_get('editmenu_dropdown_zindex', 9999),
);
$form['advanced']['editmenu_element'] = array(
'#type' => 'textfield',
'#title' => t('CSS selector to attach menu to'),
'#default_value' => variable_get('editmenu_element', 'body'),
'#description' => t('A valid CSS selector to attach the menu to. <em>Example: body, #primary, div.my-class</em>'),
'#required' => TRUE,
);
$form['advanced']['editmenu_element_method'] = array(
'#type' => 'radios',
'#title' => t('Attach method'),
'#options' => array(
'prepend' => t('Prepend'),
'append' => t('Append'),
'replace' => t('Replace'),
),
'#default_value' => variable_get('editmenu_element_method', 'prepend'),
'#description' => t('Choose how the menu should be attached to the above selector.<br /><span style="color: red;">WARNING:</span> The Replace option should only be used with a specialized theme that offers a tag that is to be replaced by the simple menu. Make sure you don\'t use that option with your body!'),
'#required' => TRUE,
);
// when someone has many themes, this list grows big!
$themes = list_themes();
$use_list = count($themes) > 15;
$form['advanced']['editmenu_exclusions'] = array(
'#type' => $use_list ? 'select' : 'checkboxes',
'#title' => t('Theme exclusions'),
'#options' => drupal_map_assoc(array_keys($themes)),
'#multiple' => $use_list,
'#default_value' => variable_get('editmenu_exclusions', array()),
'#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']['editmenu_detect_popup'] = array(
'#type' => 'checkbox',
'#title' => t('Detect pop-up windows'),
'#default_value' => variable_get('editmenu_detect_popup', 1),
'#description' => t("Choose whether EditMenu should attempt to detect if it is inside of a pop-up window. If enabled, EditMenu will not display if it is inside of a pop-up window."),
);
$form['advanced']['editmenu_visibility_operator'] = array(
'#type' => 'radios',
'#title' => t('Show block on specific pages'),
'#default_value' => variable_get('editmenu_visibility_operator', 0),
'#options' => array(
0 => t('Show on every page except the listed pages.'),
1 => t('Show on only the listed pages.'),
),
);
$form['advanced']['editmenu_visibility_pages'] = array(
'#type' => 'textarea',
'#title' => t('Pages'),
'#default_value' => variable_get('editmenu_visibility_pages', ''),
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.",
array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
'#wysiwyg' => FALSE,
);
$form['#validate'][] = 'editmenu_admin_settings_validate';
$form['#submit'][] = 'editmenu_admin_settings_submit';
return system_settings_form($form);
}
/**
* Verify that we have settings that are sensical.
*/
function editmenu_admin_settings_validate($form, &$form_state) {
$values = &$form_state['values'];
if ($values['editmenu_fix'] != 'scroll' && $values['editmenu_menubar_zindex'] < 1) {
form_set_error('editmenu_menubar_zindex', t('In order to use a Fix mode, you want to increase the menubar z-index value to 1 or more.'));
}
}
/**
* Handle some special cases.
*/
function editmenu_admin_settings_submit($form, $form_state) {
// make sure we regenerate the CSS file
variable_set('editmenu_css_filename', '');
}
// vim: ts=2 sw=2 et syntax=php

View File

@ -0,0 +1,65 @@
/* There is a version of this file commented in great detail for educational purposes here:
* http://users.tpg.com.au/j_birch/plugins/superfish/superfish.commented.css
*/
/*** ESSENTIAL STYLES ***/
#editmenu, #editmenu * {
margin: 0;
padding: 0;
list-style: none;
}
#editmenu {
line-height: 1.0;
position: relative;
/*position: fixed;
top: 0;*/
z-index: 9999;
}
#editmenu ul {
position: absolute;
top: -999em;
width: 14em;
font-size: 1em;
line-height: 1em;
}
#editmenu ul li,
#editmenu a {
width: 100%;
}
#editmenu li {
float: left;
position: relative;
z-index: 99;
}
#editmenu a {
display: block;
}
#editmenu li:hover ul,
ul#editmenu li.sfHover ul {
left: 0px;
top: 21px;
}
#editmenu li:hover li ul,
#editmenu li.sfHover li ul {
top: -999em;
}
#editmenu li li:hover ul,
ul#editmenu li li.sfHover ul {
left: 14em;
top: -1px;
}
.superfish li:hover ul,
.superfish li li:hover ul {
top: -999em;
}

View File

@ -0,0 +1,68 @@
/* There is a version of this file commented in great detail for educational purposes here:
* http://users.tpg.com.au/j_birch/plugins/superfish/superfish.commented.css
*/
/*** ESSENTIAL STYLES ***/
#editmenu, #editmenu * {
margin: 0;
padding: 0;
list-style: none;
}
#editmenu {
line-height: 1.0;
@FIX@
@MENUBAR_ZINDEX@
}
#editmenu ul {
position: absolute;
top: -999em;
width: 14em;
font-size: 1em;
line-height: 1em;
}
#editmenu ul li,
#editmenu a {
width: 100%;
}
#editmenu li {
float: left;
position: relative;
}
#editmenu a {
display: block;
}
#editmenu li ul {
@DROPDOWN_ZINDEX@
}
#editmenu li:hover ul,
ul#editmenu li.sfHover ul {
left: 0px;
top: 21px;
}
#editmenu li:hover li ul,
#editmenu li.sfHover li ul {
top: -999em;
}
#editmenu li li:hover ul,
ul#editmenu li li.sfHover ul {
left: 14em;
top: -1px;
}
.superfish li:hover ul,
.superfish li li:hover ul {
top: -999em;
}
/* vim: ts=2 sw=2 et syntax=css
*/

View File

@ -0,0 +1,20 @@
name = EditMenu
description = Displays a menu bar with drop down items. By default it appears at the top of the screen with the Navigation menu.
core = 7.x
package = Menu
files[] = editmenu.admin.inc
files[] = editmenu.install
files[] = editmenu.module
configure = admin/config/editmenu
; Normally aded by Drupal
version = "7.x-1.x-dev"
project = editmenu
datestamp = "1274876110"
; Information added by drupal.org packaging script on 2011-11-10
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1320887030"

View File

@ -0,0 +1,34 @@
<?php
/**
* @file
* EditMenu module installation file.
*/
/**
* Implements hook_uninstall().
*/
function editmenu_uninstall() {
// Get rid of the variables used by simple menu.
variable_del('editmenu_cache_menu');
variable_del('editmenu_css_error');
variable_del('editmenu_css_filename');
variable_del('editmenu_detect_popup');
variable_del('editmenu_dropdown_zindex');
variable_del('editmenu_effect');
variable_del('editmenu_effect_speed');
variable_del('editmenu_element');
variable_del('editmenu_element_method');
variable_del('editmenu_exclusions');
variable_del('editmenu_fix');
variable_del('editmenu_hide_delay');
variable_del('editmenu_menu');
variable_del('editmenu_menu_scope');
variable_del('editmenu_menubar_zindex');
variable_del('editmenu_running');
variable_del('editmenu_superfish_version');
variable_del('editmenu_theme');
variable_del('editmenu_uid1');
variable_del('editmenu_visibility_operator');
variable_del('editmenu_visibility_pages');
}

View File

@ -0,0 +1,79 @@
(function($){
Drupal.behaviors.editmenuAttach = {
attach: function(context, settings) {
// If detect pop-ups setting is enabled and we are in a pop-up window
if (settings.editmenu.detectPopup && window.opener) {
return;
}
if ($('body').hasClass('editmenu-enabled')) {
return;
}
$('body').addClass('editmenu-enabled');
// get the element to add the menu to
var element = settings.editmenu.element;
if ($(element).length == 0) {
// this happens when you open a pop-up or a different theme
// that does not have such an element or the named element
// just does not exist in the first place.
return;
}
var menu = $(editmenu);
switch (settings.editmenu.placement) {
case 'prepend':
$(menu).prependTo(element);
break;
case 'append':
$(menu).appendTo(element);
break;
case 'replace':
$(element).html(menu);
break;
}
var animation = {};
animation[settings.editmenu.effect] = 'toggle';
// Build menu
$(menu)
.find('#editmenu')
.superfish({
pathClass: 'current',
animation: animation,
delay: settings.editmenu.hideDelay,
speed: settings.editmenu.effectSpeed,
autoArrows: false
})
.find(">li:has(ul)")
.mouseover(function(){
$("ul", this).bgIframe();
})
.find("a")
.focus(function(){
$("ul", $(".nav>li:has(ul)")).bgIframe();
})
.end()
.end()
.find("a")
.removeAttr('title');
$('#editmenu').children('li.expanded').addClass('root');
}
};
})(jQuery);
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
* $Rev: 2447 $
*
* Version 2.1.1
*/
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);

View File

@ -0,0 +1,523 @@
<?php
/**
* @file
* Creates a editmenu.
*/
/**
* Implements hook_menu().
*/
function editmenu_menu() {
$items = array();
$items['admin/config/user-interface/editmenu'] = array(
'title' => 'EditMenu',
'description' => 'Select the menu to display.',
'page callback' => 'drupal_get_form',
'page arguments' => array('editmenu_admin_settings'),
'access arguments' => array('administer editmenu'),
'file' => 'editmenu.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Is editmenu enabled for this page request?
*/
function editmenu_enabled() {
$enabled = &drupal_static(__FUNCTION__);
if (!isset($enabled)) {
global $theme;
$is_overlay = FALSE;
if (function_exists('overlay_get_mode')) {
$is_overlay = (overlay_get_mode() == 'child') ? TRUE : FALSE;
}
$exclusions = variable_get('editmenu_exclusions', array());
$enabled = (!isset($exclusions[$theme]) || !$exclusions[$theme])
&& user_access('view editmenu')
&& _editmenu_page_visibility()
&& _editmenu_superuser_active()
&& !$is_overlay;
}
return $enabled;
}
/**
* Implements hook_init().
*/
function editmenu_init() {
// do a simple access check here, since theme isn't available to check yet
if (editmenu_enabled()) {
_editmenu_add_menu();
_editmenu_add_css(); // basic CSS must be before _editmenu_add_theme()
_editmenu_add_theme();
_editmenu_add_js();
}
}
/** \brief Add the editmenu variable with the menu to be displayed.
*
* This function loads the menu to be displayed and transforms it so
* it works with superfish.
*
* If the cache version of the editmenu JavaScript string cannot be
* created, then it is sent inline whether or not the user asked for it
* to be sent inline.
*/
function _editmenu_add_menu() {
// XXX -- should we put that in the settings instead? why put it in its own variable?
$editmenu = 'var editmenu=' . drupal_json_encode(editmenu_get_menu()) . ';';
$has_file = variable_get('editmenu_cache_menu', TRUE);
if ($has_file) {
$js_hash = drupal_hash_base64($editmenu);
$js_path = 'public://js'; // same path as concatenated Core JS
$js_filename = $js_path . '/editmenu_' . $js_hash . '.js';
if (!file_exists($js_filename)) {
file_prepare_directory($js_path, FILE_CREATE_DIRECTORY);
if (!file_unmanaged_save_data($editmenu, $js_filename, FILE_EXISTS_REPLACE)) {
$has_file = FALSE;
}
}
}
$options = array(
'scope' => variable_get('editmenu_menu_scope', 'footer'),
// 'version' => ?, -- could we make use of the version?
);
if ($has_file) {
//$options['type'] = 'file'; -- default
drupal_add_js($js_filename, $options);
}
else {
// inline adds the value as is (untouched)
$options['type'] = 'inline';
drupal_add_js($editmenu, $options);
}
}
/** \brief Generate the CSS and add it to the page.
*
* This function generates the dynamic CSS and then insert that to
* the header of the page.
*
* The function regenerates the CSS only when the settings were
* modified. Otherwise, it uses the cached version.
*
* The function has a fall back, in case the dynamic CSS cannot
* be created.
*/
function _editmenu_add_css() {
global $user;
$editmenu_path = drupal_get_path('module', 'editmenu');
$css_path = 'public://css'; // same path as concatenated Core CSS
if (file_prepare_directory($css_path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
$fix = variable_get('editmenu_fix', 'scroll');
// XXX add a variable editmenu_update which is set to TRUE whenever
// the settings get modified and false here
$output_filename = variable_get('editmenu_css_filename', '');
if (!$output_filename) {
$tags = array(
'@MENUBAR_ZINDEX@' => simplemnu_get_zindex('editmenu_menubar_zindex', 9999),
'@DROPDOWN_ZINDEX@' => simplemnu_get_zindex('editmenu_dropdown_zindex', 9999),
);
switch ($fix) {
case 'top':
$tags['@FIX@'] = "position: fixed;\n top: 0; left: 0;";
break;
case 'bottom':
$tags['@FIX@'] = "position: fixed;\n bottom: 0; left: 0;";
break;
default: // scroll
$tags['@FIX@'] = 'position: relative;';
break;
}
$css = file_get_contents($editmenu_path . '/editmenu.css.tpl');
$css = strtr($css, $tags);
$css_hash = hash('sha256', $css);
$output_filename = $css_path . '/editmenu-' . $css_hash . '.css';
if (!file_exists($output_filename)) {
// new content, create a new file
file_put_contents($output_filename, $css);
}
else {
// this call is rather ugly, but we must make sure that the
// system cache will take the current Editmenu CSS in account
_drupal_flush_css_js();
}
//variable_set('editmenu_css_filename', $output_filename);
}
drupal_add_css($output_filename);
}
else {
// in case we cannot create the dynamic CSS
$last_msg = variable_get('editmenu_css_error', 0);
if (($last_msg != -1 && $last_msg + 3600 > time()) || $user->uid == 1) {
// avoid displaying the error on each page... only once per hour.
// (unless you are the admin, in which case you probably want to know!)
variable_set('editmenu_css_error', time());
drupal_set_message(t('Editmenu could not create the folder @path in order to save the dynamic CSS data.',
array('@path' => $css_path)), 'warning');
}
// use a default that cannot react to the dynamic changes...
drupal_add_css($editmenu_path .'/editmenu.css');
}
}
/** \brief Add the module theme.
*
* This function adds a theme for the Editmenu look.
*
* By default, the original theme is used. The module also offers the
* blackblue theme. It is also possible to create new themes or use
* the theming of the current theme for editmenu (so the menu fits
* perfectly for that theme.)
*/
function _editmenu_add_theme() {
// we want to put the editmenu theme CSS first
// so we can change some CSS entries dynamically
// but at this time the editmenu.css is used to
// reset many of the CSS entries... Hmmm...
$editmenu_theme = variable_get('editmenu_theme', 'original');
if ($editmenu_theme != 'custom') {
$editmenu_path = drupal_get_path('module', 'editmenu');
$theme_file = $editmenu_path . '/themes/' . $editmenu_theme
. '/' . $editmenu_theme . '.css';
if (is_file($theme_file)) {
drupal_add_css($theme_file);
}
}
}
/** \brief Add the JavaScript that makes it all work.
*
* This function adds the Editmenu JavaScript, the Superfish JavaScript
* and settings from the user.
*/
function _editmenu_add_js() {
$editmenu_path = drupal_get_path('module', 'editmenu');
// Settings
$fix = variable_get('editmenu_fix', 'scroll');
switch ($fix) {
case 'top':
$element = 'body';
$placement = 'prepend';
break;
case 'bottom':
$element = 'body';
$placement = 'append';
break;
default: // 'scroll'
// let user defined other elements when not fixed
$element = variable_get('editmenu_element', 'body');
$placement = variable_get('editmenu_element_method', 'prepend');
break;
}
$settings = array(
'effect' => variable_get('editmenu_effect', 'opacity'),
'effectSpeed' => variable_get('editmenu_effect_speed', 'fast'),
'element' => $element,
'placement' => $placement,
'hideDelay' => variable_get('editmenu_hide_delay', 800),
'detectPopup' => variable_get('editmenu_detect_popup', 1),
);
drupal_add_js(array('editmenu' => $settings), array('type' => 'setting'));
// Editmenu
drupal_add_js($editmenu_path . '/editmenu.js', array('version' => '1.2'));
// Superfish
$superfish = variable_get('editmenu_superfish_version', 'superfish-1.4.1.js');
if ($superfish != 'custom') {
$sf_version = str_replace(array('superfish-', '.js'), '', $superfish);
drupal_add_js($editmenu_path . '/' . $superfish, array('version' => $sf_version));
}
}
/**
* \brief Retrieve the zindex for the CSS files.
*
* This function retrieves a z-index from a Drupal variable and
* transform it to fit in a CSS file.
*
* \param[in] $name The name of the z-index variable to read.
* \param[in] $default The default value to use when the variable is not defined.
*
* \return A string representing the current value of the specified z-index.
*/
function simplemnu_get_zindex($name, $default) {
$zindex = variable_get($name, $default);
if ($zindex == -1) {
$zindex = '';
}
else {
$zindex = 'z-index: ' . $zindex . ';';
}
return $zindex;
}
/**
* Implements hook_permission().
*/
function editmenu_permission() {
return array(
'view editmenu' => array(
'title' => t('View EditMenu'),
'description' => t('Display EditMenu to this user.'),
),
'administer editmenu' => array(
'title' => t('Administer EditMenu'),
'description' => t('Change settings of EditMenu.'),
),
);
}
/**
* Render an HTML list of links for a given menu.
*/
function editmenu_get_menu() {
variable_set('editmenu_running', TRUE);
// if a user turned off menu module but EditMenu was previously set
// reset variable so a menu appears
$all_menus = array(variable_get('editmenu_menu', 'management:0'));
drupal_alter('editmenu_menus', $all_menus);
if (count($all_menus) > 1) {
// if menu is not enable then we cannot have a count other than 1
$menu_titles = menu_get_menus();
$tree = array();
foreach ($all_menus as $full_name) {
list($menu_name, $mlid) = explode(':', $full_name);
$tree[] = array(
'link' => array(
'editmenu_multi_menu_root' => TRUE,
'mlid' => $mlid,
'menu_name' => $full_name,
'hidden' => FALSE,
'title' => $menu_titles[$menu_name],
'href' => 'admin/settings/editmenu', /// ??? -- we should not have a link here
'in_active_trail' => FALSE,
'has_children' => TRUE,
'localized_options' => array(
'attributes' => array('class' => 'editmenu-top-level'),
),
),
'below' => editmenu_menu_tree($full_name),
);
}
}
else {
reset($all_menus);
$tree = editmenu_menu_tree(current($all_menus));
}
// allow other modules to modify the menu tree
drupal_alter('editmenu_tree', $tree);
$tree = editmenu_tree_remove_hidden($tree);
// now generate the output
$menu_form = menu_tree_output($tree);
$menu = drupal_render($menu_form);
if (!$menu) {
$menu = '<ul class="menu"><li><a href="' . url('admin/settings/editmenu') . '">'
. t('No menu items found. Try a different menu as the default.') . '</a></li></ul>';
}
// add the id to the UL tag here instead of the JavaScript
// otherwise it could be added to the <div> tag instead...
$pos = strpos($menu, '>');
$menu = str_replace('class="menu', 'class="menu clear-block', substr($menu, 0, $pos))
. ' id="editmenu"' . substr($menu, $pos);
variable_set('editmenu_running', FALSE);
return '<div class="editmenu-block">' . $menu . '&nbsp;</div>';
}
/**
* At this point (May 31, 2010) the menu tree includes
* many 'below' that should be considered empty but
* aren't... unless we make sure we remove the children
* ourselves.
*/
function editmenu_tree_remove_hidden($tree) {
$clean = array();
foreach ($tree as $key => $data) {
if (!$data['link']['hidden']) {
if ($data['below']) {
$data['below'] = editmenu_tree_remove_hidden($data['below']);
if (count($data['below']) == 0) {
$data['below'] = 0;
}
}
$clean[] = $data;
}
}
return $clean;
}
/**
* Custom implementation of menu_tree().
* We want to retrieve the entire menu structure for a given menu,
* regardless of whether or not the menu item is expanded or not.
*/
function editmenu_menu_tree($menu_name = 'management:0') {
$menu_tree = &drupal_static(__FUNCTION__, array());
// until we take $mlid in account, we can use $mname
// for the rest of the function
list($mname, $mlid) = explode(':', $menu_name);
if (!isset($menu_tree[$mname])) {
$menu_tree[$mname] = menu_tree_all_data($mname);
}
return $menu_tree[$mname];
}
/**
* Modified menu_tree_all_data(), providing the complete menu tree below $root_menu
* (which can be *any* menu item, not just the root of a custom menu).
*
* @param $root_menu
* root menu item of the tree to return as "menu_name:mlid" (mlid = menu link id)
*
* @todo we don't actually need $menu_name, $mlid would be sufficient
*/
function editmenu_tree_all_data($root_menu = 'management:0') {
$tree = &drupal_static(__FUNCTION__, array());
list($menu_name, $mlid) = explode(':', $root_menu);
// Generate the cache ID for Drupal 7.
$max_depth = NULL;
$cid = 'links:' . $menu_name . ':all:' . $mlid . ':' . $GLOBALS['language']->language . ':' . (int) $max_depth;
if (!isset($tree[$cid])) {
$cache = cache_get($cid, 'cache_menu');
if ($cache && isset($cache->data)) {
$data = $cache->data;
}
else {
// Build the query using a LEFT JOIN since there is no match in
// {menu_router} for an external link.
$query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC));
$query->addTag('translatable');
$query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
$query->fields('ml');
$query->fields('m', array(
'load_functions',
'to_arg_functions',
'access_callback',
'access_arguments',
'page_callback',
'page_arguments',
'delivery_callback',
'tab_parent',
'tab_root',
'title',
'title_callback',
'title_arguments',
'theme_callback',
'theme_arguments',
'type',
'description',
));
for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) {
$query->orderBy('p' . $i, 'ASC');
}
$query->condition('ml.menu_name', $menu_name);
if ($mlid > 0) {
$item = menu_link_load($mlid);
if ($item) {
// The tree is a subtree of $menu_name, so we need to restrict the query to
// this subtree.
$px = "p" . (int) $item['depth'];
$and = db_and()->condition("ml.$px", $item[$px])->condition("ml.mlid", $mlid, '!=');
$query->condition($and);
}
}
// Build an ordered array of links using the query result object.
$links = array();
foreach ($query->execute() as $item) {
$links[] = $item;
}
$data['tree'] = menu_tree_data($links);
if (count($data['tree']) == 1) {
// Move the menu items from below to root
$key = key($data['tree']);
foreach ($data['tree'][$key]['below'] as $id => $item) {
$data['tree'][$id] = $item;
unset($data['tree'][$key]['below'][$id]);
}
}
$data['node_links'] = array();
menu_tree_collect_node_links($data['tree'], $data['node_links']);
menu_tree_check_access($data['tree'], $data['node_links']);
cache_set($cid, $data, 'cache_menu');
}
$tree[$cid] = $data['tree'];
}
return $tree[$cid];
}
/**
* Determine if editmenu should be displayed based on visibility settings.
*
* @return boolean
*/
function _editmenu_page_visibility() {
$operator = variable_get('editmenu_visibility_operator', 0);
$pages = variable_get('editmenu_visibility_pages', '');
if ($pages) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);
}
// When $operator has a value of 0, the menu is displayed on
// all pages except those listed in $pages. When set to 1, it
// is displayed only on those pages listed in $pages.
$page_match = !($operator ^ $page_match);
}
else {
$page_match = TRUE;
}
return $page_match;
}
/**
* Check whether the superuser/admin should be shown editmenu.
*/
function _editmenu_superuser_active() {
global $user;
return $user->uid != 1 || variable_get('editmenu_uid1', 1) == 1;
}

View File

@ -0,0 +1,22 @@
name = EditMenu Devel Menu
description = Include the developer menu in the editmenu tree.
dependencies[] = editmenu
dependencies[] = devel
files[] = editmenu_devel.module
core = 7.x
package = Menu
project = editmenu
; Information added by drupal.org packaging script on 2010-05-26
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1274876110"
; Information added by drupal.org packaging script on 2011-11-10
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1320887030"

View File

@ -0,0 +1,33 @@
<?php
/**
* @file
* Prepend the devel menu to Editmenu.
*/
/**
* Implementation of hook_editmenu_tree_alter()
*/
function editmenu_devel_editmenu_tree_alter(&$tree) {
if (user_access('access devel information')) {
$devel = array(
'link' => array(
'mlid' => 0,
'menu_name' => 'devel',
'hidden' => FALSE,
'access' => TRUE,
'title' => t('Devel module'),
'href' => 'admin/settings/devel',
'in_active_trail' => FALSE,
'has_children' => TRUE,
'localized_options' => array(
'attributes' => array('id' => 'editmenu_devel'),
),
),
'below' => editmenu_menu_tree('devel:0'),
);
array_unshift($tree, $devel);
}
}
// vim: ts=2 sw=2 et syntax=php

View File

@ -0,0 +1,21 @@
name = EditMenu Inactive Parent Menu
description = Make all the parent menus inactive so users cannot click on them inadvertendly.
dependencies[] = editmenu
files[] = editmenu_inactive_parents.module
core = 7.x
package = Menu
project = editmenu
; Information added by drupal.org packaging script on 2010-05-26
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1274876110"
; Information added by drupal.org packaging script on 2011-11-10
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1320887030"

View File

@ -0,0 +1,63 @@
<?php
/**
* @file
* Make all the editmenu parent menu items non-clickable.
*/
/**
* \brief Alter the menu item link theme registry.
*
* This function grabs the editmenu theme registry for the
* menu_link theming. This gives us a way to remove the
* link and replace it with a name (anchor) instead.
*
* This is only applied to the Editmenu as intefering with
* other menus could have unwanted side effects.
*
* \note
* This is called at the time the theme registry is built.
* It is then put in the cache until next time the registry
* is built by the system (i.e. caches are cleared by user,
* because a module is installed, etc.)
*/
function editmenu_inactive_parents_theme_registry_alter(&$theme_registry) {
global $theme;
// Save theme function
$themes = variable_get('editmenu_inactive_parents_theme_function', array());
$themes[$theme] = $theme_registry['menu_link']['function'];
variable_set('editmenu_inactive_parents_theme_function', $themes);
// Replace with our own
$theme_registry['menu_item_link']['function'] = 'editmenu_inactive_parents_theme_menu_link';
}
/**
* \brief Transform the menu item link.
*
* This function intercepts the menu item link theming function of
* the system and
*/
function editmenu_inactive_parents_theme_menu_link($link) {
global $theme;
static $cnt = 0;
// this is a drop down?
if (!empty($link['has_children']) && variable_get('editmenu_running', FALSE)) {
++$cnt;
return '<a name="menu-id-' . $cnt . '">' . $link['title'] . '</a>';
}
// got a theme function?
$themes = variable_get('editmenu_inactive_parents_theme_function', array());
if (isset($themes[$theme])) {
return $themes[$theme]($link);
}
// somehow the preprocess function did not get called?!
// use the core default
return theme_menu_link($link);
}
// vim: ts=2 sw=2 et syntax=php

View File

@ -0,0 +1,26 @@
name = EditMenu Multi-Menu support
description = Give support to display multiple menu in the top row.
dependencies[] = editmenu
dependencies[] = menu
files[] = editmenu_multi_menu.install
files[] = editmenu_multi_menu.module
core = 7.x
package = Menu
project = editmenu
version = "7.x-1.x-dev"
; Information added by drupal.org packaging script on 2010-05-26
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1274876110"
; Information added by drupal.org packaging script on 2011-11-10
version = "7.x-1.x-dev"
core = "7.x"
project = "editmenu"
datestamp = "1320887030"

View File

@ -0,0 +1,8 @@
<?php
function editmenu_multi_menu_uninstall() {
variable_del('editmenu_menus');
variable_del('editmenu_multi_menu_theme_function');
}
// vim: ts=2 sw=2 et syntax=php

View File

@ -0,0 +1,89 @@
<?php
/**
* @file
* Make all the editmenu parent menu items non-clickable.
*/
/**
* \brief Make the 'select' a list.
*
* Transform the menu selector from a drop-down to a list so people
* can select more than one menu.
*/
function editmenu_multi_menu_form_editmenu_admin_settings_alter(&$form, $form_state) {
$form['default_menu']['editmenu_menus'] = $form['default_menu']['editmenu_menu'];
unset($form['default_menu']['editmenu_menu']);
$def = variable_get('editmenu_menus', array(variable_get('editmenu_menu', 'navigation:0')));
$form['default_menu']['editmenu_menus']['#multiple'] = TRUE;
$form['default_menu']['editmenu_menus']['#title'] = t('Menus');
$form['default_menu']['editmenu_menus']['#default_value'] = $def;
$form['default_menu']['editmenu_menus']['#description'] = t('Select one or more menus to show each one of them (use Ctrl or Shift to select multiple entries.) Please, avoid selecting a parent and a child from the same menu.');
}
/**
* \brief Replace the default with our own user selection.
*
* In this case we ignore the user selection unless the editmenu_menus
* was not yet defined, then we keep the default.
*/
function editmenu_multi_menu_editmenu_menus_alter($all_menus) {
$all_menus = variable_get('editmenu_menus', $all_menus);
}
/**
* \brief Alter the menu item link theme registry.
*
* This function grabs the editmenu theme registry for the
* menu_item_link theming. This gives us a way to remove the
* link and replace it with a name (anchor) instead.
*
* This is only applied to the Editmenu as intefering with
* other menus could have unwanted side effects.
*
* \note
* This is called at the time the theme registry is built.
* It is then put in the cache until next time the registry
* is built by the system (i.e. caches are cleared by user,
* because a module is installed, etc.)
*/
function editmenu_multi_menu_theme_registry_alter(&$theme_registry) {
global $theme;
// Save theme function
$themes = variable_get('editmenu_multi_menu_theme_function', array());
$themes[$theme] = $theme_registry['menu_item_link']['function'];
variable_set('editmenu_multi_menu_theme_function', $themes);
// Replace with our own
$theme_registry['menu_item_link']['function'] = 'editmenu_multi_menu_theme_menu_item_link';
}
/**
* \brief Transform the menu item link.
*
* This function intercepts the menu item link theming function of
* the system and
*/
function editmenu_multi_menu_theme_menu_item_link($link) {
global $theme;
static $cnt = 0;
// this is a drop down?
if (!empty($link['editmenu_multi_menu_root']) && variable_get('editmenu_running', FALSE)) {
++$cnt;
return '<a name="menu-id-' . $cnt . '">' . $link['title'] . '</a>';
}
// got a theme function?
$themes = variable_get('editmenu_multi_menu_theme_function', array());
if (isset($themes[$theme])) {
return $themes[$theme]($link);
}
// somehow the preprocess function did not get called?!
// use the core default
return theme_menu_item_link($link);
}
// vim: ts=2 sw=2 et syntax=php

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@ -0,0 +1,100 @@
/*
* Superfish v1.4.1 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
(function($){
$.superfish = {};
$.superfish.o = [];
$.superfish.op = {};
$.superfish.defaults = {
hoverClass : 'sfHover',
pathClass : 'overideThisToUse',
delay : 800,
animation : {opacity:'show'},
speed : 'normal',
oldJquery : false, /* set to true if using jQuery version below 1.2 */
disableHI : false, /* set to true to disable hoverIntent usage */
// callback functions:
onInit : function(){},
onBeforeShow: function(){},
onShow : function(){}, /* note this name changed ('onshow' to 'onShow') from version 1.4 onward */
onHide : function(){}
};
$.fn.superfish = function(op){
var bcClass = 'sfbreadcrumb',
over = function(){
var $$ = $(this), menu = getMenu($$);
getOpts(menu,true);
clearTimeout(menu.sfTimer);
$$.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(){
var $$ = $(this), menu = getMenu($$);
var o = getOpts(menu,true);
clearTimeout(menu.sfTimer);
if ( !$$.is('.'+bcClass) ) {
menu.sfTimer=setTimeout(function(){
$$.hideSuperfishUl();
if (o.$path.length){over.call(o.$path);}
},o.delay);
}
},
getMenu = function($el){ return $el.parents('ul.superfish:first')[0]; },
getOpts = function(el,menuFound){ el = menuFound ? el : getMenu(el); return $.superfish.op = $.superfish.o[el.serial]; },
hasUl = function(){ return $.superfish.op.oldJquery ? 'li[ul]' : 'li:has(ul)'; };
return this.each(function() {
var s = this.serial = $.superfish.o.length;
var o = $.extend({},$.superfish.defaults,op);
o.$path = $('li.'+o.pathClass,this).each(function(){
$(this).addClass(o.hoverClass+' '+bcClass)
.filter(hasUl()).removeClass(o.pathClass);
});
$.superfish.o[s] = $.superfish.op = o;
$(hasUl(),this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out)
.not('.'+bcClass)
.hideSuperfishUl();
var $a = $('a',this);
$a.each(function(i){
var $li = $a.eq(i).parents('li');
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
});
o.onInit.call(this);
}).addClass('superfish');
};
$.fn.extend({
hideSuperfishUl : function(){
var o = $.superfish.op,
$ul = $('li.'+o.hoverClass,this).add(this).removeClass(o.hoverClass)
.find('>ul').hide().css('visibility','hidden');
o.onHide.call($ul);
return this;
},
showSuperfishUl : function(){
var o = $.superfish.op,
$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');
o.onBeforeShow.call($ul);
$ul.animate(o.animation,o.speed,function(){ o.onShow.call(this); });
return this;
}
});
$(window).unload(function(){
$('ul.superfish').each(function(){
$('li',this).unbind('mouseover','mouseout','mouseenter','mouseleave');
});
});
})(jQuery);

View File

@ -0,0 +1,121 @@
/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
;(function($){
$.fn.superfish = function(op){
var sf = $.fn.superfish,
c = sf.c,
$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
over = function(){
var $$ = $(this), menu = getMenu($$);
clearTimeout(menu.sfTimer);
$$.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(){
var $$ = $(this), menu = getMenu($$), o = sf.op;
clearTimeout(menu.sfTimer);
menu.sfTimer=setTimeout(function(){
o.retainPath=($.inArray($$[0],o.$path)>-1);
$$.hideSuperfishUl();
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
},o.delay);
},
getMenu = function($menu){
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
sf.op = sf.o[menu.serial];
return menu;
},
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
return this.each(function() {
var s = this.serial = sf.o.length;
var o = $.extend({},sf.defaults,op);
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
.filter('li:has(ul)').removeClass(o.pathClass);
});
sf.o[s] = sf.op = o;
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
if (o.autoArrows) addArrow( $('>a:first-child',this) );
})
.not('.'+c.bcClass)
.hideSuperfishUl();
var $a = $('a',this);
$a.each(function(i){
var $li = $a.eq(i).parents('li');
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
});
o.onInit.call(this);
}).each(function() {
var menuClasses = [c.menuClass];
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
$(this).addClass(menuClasses.join(' '));
});
};
var sf = $.fn.superfish;
sf.o = [];
sf.op = {};
sf.IE7fix = function(){
var o = sf.op;
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');
};
sf.c = {
bcClass : 'sf-breadcrumb',
menuClass : 'sf-js-enabled',
anchorClass : 'sf-with-ul',
arrowClass : 'sf-sub-indicator',
shadowClass : 'sf-shadow'
};
sf.defaults = {
hoverClass : 'sfHover',
pathClass : 'overideThisToUse',
pathLevels : 1,
delay : 800,
animation : {opacity:'show'},
speed : 'normal',
autoArrows : true,
dropShadows : true,
disableHI : false, // true disables hoverIntent detection
onInit : function(){}, // callback functions
onBeforeShow: function(){},
onShow : function(){},
onHide : function(){}
};
$.fn.extend({
hideSuperfishUl : function(){
var o = sf.op,
not = (o.retainPath===true) ? o.$path : '';
o.retainPath = false;
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
.find('>ul').hide().css('visibility','hidden');
o.onHide.call($ul);
return this;
},
showSuperfishUl : function(){
var o = sf.op,
sh = sf.c.shadowClass+'-off',
$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');
sf.IE7fix.call($ul);
o.onBeforeShow.call($ul);
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
return this;
}
});
})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

View File

@ -0,0 +1,49 @@
.editmenu-block {
height: 21px;
}
#editmenu {
background: #000;
color: #fff;
font:11px Verdana, Helvetica, sans-serif;
width: 100%;
text-align: left;
}
#editmenu a {
color: #fff;
text-decoration: none;
padding: 3px 12px 5px 12px;
width: auto;
}
#editmenu li {
background: transparent;
}
#editmenu li.expanded > a {
background: url(arrow_right.gif) no-repeat 94%;
padding-right: 18px;
}
#editmenu li.root > a {
background: url(arrow_down.gif) no-repeat 94%;
padding-right: 18px;
}
#editmenu li:hover, #editmenu li.sfHover,
#editmenu a:focus, #editmenu a:hover, #editmenu a:active {
background: #4c77b3;
color: #fff;
}
#editmenu li ul {
border: 1px solid #ccc;
background: #fafcff;
}
#editmenu li ul a {
color: #4e4e4e;
height: auto;
}
#editmenu li ul li:hover, #editmenu li ul li.sfHover,
#editmenu li ul a:focus, #editmenu li ul a:hover, #editmenu li ul a:active {
background-color: #cde;
color: #4e4e4e;
}
/* vim: ts=2 sw=2 et syntax=css
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,92 @@
/* ------ DISPLAY ------ */
body.editmenu-enabled{margin-top:23px;}
.editmenu-block{height:23px;position:fixed;top:0;left:0;width:100%;z-index:9999;}
ul#editmenu,ul#editmenu *{margin:0;padding:0;list-style:none;}
ul#editmenu{line-height:1.0;position:relative;width:100%;z-index:9999;}
ul#editmenu ul{position:absolute;top:-999em;width:14em;font-size:1em;line-height:1em;}
ul#editmenu ul li{width:100%;}
ul#editmenu a{width:auto;}
ul#editmenu li{float:left;position:relative;z-index:99;}
ul#editmenu a{display:block;}
ul#editmenu li:hover ul,
ul#editmenu li.sfHover ul{left:0px;top:30px;}
ul#editmenu li:hover li ul,
ul#editmenu li.sfHover li ul{top:-999em;}
ul#editmenu li li:hover ul,
ul#editmenu li li.sfHover ul{left:14em;top:-1px;}
.superfish li:hover ul,
.superfish li li:hover ul{top:-999em;}
ul#editmenu:after{
clear: both;
content: '.';
display: block;
height:0px;
overflow:hidden;
visibility:hidden;
width:0px;
}
/* ------ STYLE ------ */
ul#editmenu {
background-color:#333;
border-bottom: 1px dotted #9A9A9A;
box-shadow: 0 0 15px #000000 inset;
-moz-box-shadow: 0 0 15px #000000 inset;
-webkit-box-shadow: 0 0 15px #000000 inset;
}
.editmenu-block:after{
content:'by g.u.i.';
color:#fff;
font: italic 600 1em 'Baskerville',serif;
display:block;
position:fixed;
top:6px;
right:1em;
z-index:10000;
}
ul#editmenu li:hover ul,
ul#editmenu li.sfHover ul{
background:#1a1a1a;
border: 1px dotted #9A9A9A;
padding: 6px 0;
}
ul#editmenu li:hover ul:before,
ul#editmenu li.sfHover ul:before{
background:url('bkgd-border.png') 15px 0 no-repeat;
content:'';
display:block;
height:9px;
margin-top:-15px;
width:100%;
}
/* ------ FONT ------ */
.editmenu-block{font:normal normal 100 11px/1em 'Monaco','Lucida Console','Consolas',monospace;color:#fff;}
ul#editmenu a{color:#fff;margin:4px;padding:2px;text-decoration:none;word-spacing:-.35em;
transition: background-color .5s, color .5s;
-moz-transition: background-color .5s, color .5s;
-o-transition: background-color .5s, color .5s;
-webkit-transition: background-color .5s, color .5s;
}
ul#editmenu>li.first a{color:#777;}
ul#editmenu li.sfHover>a,
ul#editmenu a:focus,
ul#editmenu a:hover,
ul#editmenu a:active{
color: #000;
background-color:#fff;
transition-duration:0s;
-moz-transition-duration:0s;
-o-transition-duration:0s;
-webkit-transition-duration:0s;
}
ul#editmenu>li.first a:focus,
ul#editmenu>li.first a:hover,
ul#editmenu>li.first a:active{
color: #000;
background-color:#cc3733;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -0,0 +1,52 @@
.editmenu-block {
height: 21px;
}
#editmenu {
background: #ddd;
color: #333;
border-bottom: 1px solid #999;
font: 11px Verdana, Helvetica, sans-serif;
width: 100%;
text-align: left;
}
#editmenu a {
color: #333;
text-decoration: none;
background: #ddd;
border-right: 1px solid #999;
border-left: 1px solid #eee;
padding: 2px 6px 3px 6px;
width: auto;
}
#editmenu li {
background: #ddd;
text-align: left;
}
#editmenu li.expanded > a {
background: url(right-green.gif) no-repeat 97%;
padding-right: 2em;
}
#editmenu li.root > a {
font-weight: 700;
background: url(down-green.gif) no-repeat 97%;
}
#editmenu li:hover,
#editmenu li.sfHover,
#editmenu a:focus,
#editmenu a:hover,
#editmenu a:active {
background: #3875d7;
color: #fff;
}
#editmenu li:hover ul,
ul#editmenu li.sfHover ul {
border-top: 1px solid white;
border-bottom: 1px solid #999;
}
#editmenu li ul a {
height: auto;
}
/* vim: ts=2 sw=2 et syntax=css
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B