New module 'Administration menu'

This commit is contained in:
Manuel Cillero 2017-07-26 10:54:20 +02:00
parent e666049d60
commit 89b4aad0f8
17 changed files with 2067 additions and 0 deletions

View file

@ -0,0 +1,246 @@
Admin Menu x.x-x.x, xxxx-xx-xx
------------------------------
Admin Menu 6.x-1.x, xxxx-xx-xx
------------------------------
#927018 by DamienMcKenna, mikeytown2: Fixed PHP notice in admin_menu_link_build().
Admin Menu 6.x-1.8, 2011-06-16
------------------------------
#1190466 by pwolanin: fix for Call to undefined function admin_menu_exit() breaks some drush commands.
Admin Menu 6.x-1.7, 2011-06-15
------------------------------
#1189672 by pwolanin: fix for 'flush all caches' open to csrf.
#1189532 by pwolanin: fix rebuild logic to avoid an extra menu rebuild.
Admin Menu 6.x-1.6, 2010-09-03
------------------------------
#567618 by indytechcook, neclimdul: Fixed tests.
#860390 by Kevin Rogers: Fixed .info file parsing error on uncertain platform.
#645526 by TravisCarden, hutch: Fixed stale local tasks markup after moving them.
#615058 by Dave Reid: Fixed compatibility with PHP 5.3.
#540762 by Deslack: Added Malay translation.
#362454 by sun: Fixed Drupal.settings.admin_menu is undefined error.
Admin Menu 6.x-1.5, 2009-07-02
------------------------------
#479922 by sun: Fixed fieldsets not collapsed on admin/build/modules/list*.
#236657 by sun: Updated for corrected arguments of system_clear_cache_submit().
#471504 by wulff: Updated Danish translation.
Admin Menu 6.x-1.4, 2009-05-15
------------------------------
by Dave Reid: Updated for getInfo() for tests.
#433016 by ultimateboy: Fixed Devel switch user links added to wrong parent.
#349169 by sun: Fixed Devel switch user links contain multiple path prefixes.
#384100 by kepol, sun: Fixed content-type items displayed in wrong place.
#373339 by sun: Fixed double-escaped 'Edit <content-type>' link titles.
by sun: Fixed admin menu tests (and updated to 6.x for SimpleTest 2.x).
#359158 by nitrospectide, sun: Fixed Devel Themer breaks admin menu.
#365335 by sun: Fixed not all variables removed after uninstall.
Admin Menu 6.x-1.3, 2009-01-24
------------------------------
#362454 by sun: Fixed Drupal.settings.admin_menu is undefined JS error in some
browsers.
Admin Menu 6.x-1.2, 2009-01-20
------------------------------
#358697 by sun: Added docs about admin_menu_suppress() to README.txt.
#342684 by darumaki, sun: Added notice about Opera configuration to README.txt.
#350932 by sun: Fixed "Run updates" link repeated per language/site.
#342298 by gustz: Updated Spanish translation.
#346106 by sun: Fixed XHTML-Strict validation for admin menu icon.
#287448 by sun: Fixed unnecessary menu rebuild for users without permission to
use admin menu.
#342002 by AltaVida: Fixed improper test for node/add paths.
#272920 by keith.smith: Changed all text strings throughout the module.
#322731 by sun: Fixed improper use of t() in module install file.
#282030 by sun: Fixed "Run updates" item visible for unprivileged users.
#322877 by sun: Added tweak to move page tabs into administration menu.
#287468 by sun: Fixed module paths directly below "admin" get the wrong parent.
#310423 by sun: Added optional position: fixed configuration setting.
#292657 by smk-ka: Improved rendering performance.
#234149 by yhager, sun: Fixed RTL support for IE.
#323726 by danez1972: Added Spanish translation.
#325057 by sun: Updated README.txt.
#234149 by yhager, levavie, sun: Added RTL support.
#325057 by sun: Added links to flush specific caches.
#324334 by AltaVida: Fixed usernames with spaces not in Devel user switch links.
#319382 by betz: Added Dutch translation.
Admin Menu 6.x-1.1, 2008-09-12
------------------------------
#295476 by pwolanin, use <front> for icon path to fix front-page path-change
bug and pathauto conflict, add wipe button to admin form.
#301370 by sun: Disabled module fieldset collapsing behavior by default.
#288672 by sun: Fixed JS hover behavior not working in IE.
#290803 by sun: Fixed missing devel_themer in devel modules; added some others.
#286636 by sun: Fixed menus do not drop down in IE6.
#249537 by pwolanin, sun: Added admin_menu_suppress() to allow other modules to
disable the display of admin_menu on certain pages (f.e. popups).
#268211 by sun: Fixed invalid issue queue links for custom modules and
sub-modules of projects.
#261461 by sun: Added FAQ entry for displaying other menus like admin_menu.
#264067 by sun: Added FAQ entry for huge amount of anonymous users displayed.
#280002 by pwolanin: Clean up .test setUp function.
#242377 by sun: Fixed sub-level menu items exceed total document height.
Admin Menu 6.x-1.0, 2008-06-26
------------------------------
#266308 by sun: Fixed jQuery 1.0.x incompatible selector for collapsing modules.
#268373 by sun: Added hook_update to cleanup for alpha/beta testers.
#268373 by sun: Added menu callback to disable/enable developer modules.
#132524 by pwolanin: Fixed admin_menu links are re-inserted each time menu links
are rebuilt.
by smk-ka: Performance: Use 'defer' attribute for JavaScript to delay execution.
#266099 by sun: Fixed description of "Apply margin-top" configuration setting.
#266308 by sun: Usability: Added Utility module features to collapse module
fieldsets on Modules page.
#251341 by sun: Added docs about display drupal links permission.
Admin Menu 6.x-1.0-BETA, 2008-06-08
-----------------------------------
#132524 by sun: Fixed support for sub-content-types below node/add.
#132524 by pwolanin: Added support for localizable menu links.
#132524 by pwolanin, sun: Fixed menu links adjustments.
#132524 by pwolanin: Added simpletest.
#132524 by pwolanin: Major rewrite to better use Drupal 6 menu system.
#132524 by sun: Moved gettext translation files into translations.
#132524 by sun: Committing pre-alpha code for D6 due to public demand.
Admin Menu 5.x-2.x, xxxx-xx-xx
------------------------------
#246221 by sun: Fixed user counter displays different values than Who's online
block.
#239022 by mikl: Added Danish translation.
#234444 by smk-ka: Fixed admin_menu icon does not respect theme settings.
#198240 by sun: Fixed admin_menu displayed in print output.
Admin Menu 5.x-2.4, 2008-02-24
------------------------------
#214740 by sun: Regression: Fixed directly applied marginTop not supported by IE.
#214725 by sun: Fixed wrong CSS id in admin_menu.js (missed in 5.x-2.3).
Admin Menu 5.x-2.3, 2008-02-24
------------------------------
#214725 by sun: Fixed CSS id and classes should not contain underscores.
#209390 by sun: Added note about interaction with user role permissions.
#214740 by jjeff, sun: Added module settings to configure margin-top CSS.
#200737 by sun: Changed admin_menu (fav)icon to use theme setting, if defined.
#203116 by smk-ka: Improved performance of non-cached admin_menu by storing
already processed URLs in the cache.
#224605 by sun: 'Add <content_type>' items do not appear without 'administer
nodes' permission.
#210615 by robertgarrigos: Fixed Mozilla Mac: Collapsible fieldsets display
error.
Admin Menu 5.x-2.2, 2007-01-08
------------------------------
#204884 by jjeff: Usability: Override theme font family declaration.
#204935 by jjeff: Added mouseout delay for hovered menus (yay!).
#193941 by downgang: Fixed margin in IE6 using Garland theme.
#197306 by sun: Fixed 'Run updates' leads to wrong url with clean URLs disabled.
Moved images into sub-folder.
by smk-ka: Fixed icon title for user counter not displayed & coding style.
Fixed user count not displayed without 'administer users' permission.
Admin Menu 5.x-2.1, 2007-12-02
------------------------------
Fixed adding menu items with negative weight not always working.
Fixed admin_menu_copy_items() is overwriting already existing items.
Fixed display menu item ids in devel settings does not work.
Admin Menu 5.x-2.0, 2007-12-02
------------------------------
Added devel_admin_menu() for fast access to clear-cache, variable editor and
switch_user.
Added username to logout button.
Added hook_admin_menu() to allow other modules to alter admin_menu.
#194189 by sun: Added counter for current anonymous/authenticated users.
Added Drupal.org project issue queue links for all enabled contrib modules.
#189701 by sun: Changed admin_menu icon to be a menu.
#193925 by sun: Removed obsolete menu slicing code.
#193669 by smk-ka: Moved admin_menu builder functions into include file.
Admin Menu 5.x-1.2, 2007-11-18
------------------------------
#176969 by smk-ka: Fixed performance issues with path(auto) module by
introducing a menu cache for admin_menu.
#179648 by sun: Inject admin_menu into theme.
Fixes several CSS bugs in various themes and also activation of admin_menu
immediately after installation.
#191213 by Standard: Fixed block info shouldn't contain the word "block".
#187816 by sun: Fixed "Add" not translatable.
#186218 by sun: Fixed admin menu icon too big in Safari.
#182563 by sun: Fixed wrong datatype for array_search in _admin_menu_get_children().
#183496 by sun: Fixed invalid argument supplied for foreach in admin_menu_copy_items().
Admin Menu 5.x-1.1, 2007-10-10
------------------------------
#178876 by sun: Fixed 3rd-level submenus expand without hover over.
#153455 by sun: Fixed add product node sub-elements are empty.
Fixed path_to_theme() call breaking blocks page.
#177582 by sun: Fixed bluebreeze theme compatibility.
Admin Menu 5.x-1.0, 2007-09-06
------------------------------
#156952 by sun: Fixed admin menu inaccessible due to margins.
#149229 by sun: Fixed admin menu not expanding in IE7.
#172545 by sun: Use opacity instead of -moz-opacity.
#132867 Fixed z-index too low.
- Fixed admin menu block selectors to override any other theme styles.
#155589 by sun: Added permission to access administration menu.
- Fixed a PHP warning when there are no content types defined in the system, as
node/add then has no child menu items.
#155312 by sun: Fixed menu item tooltip clashes.
Added support for custom stylesheets per theme.
Removed 4.7.x compatibility.
Admin Menu 4.7-1.3, 2007-03-30
------------------------------
#126601 Fixed Users can see inaccessible items.
#121027 Fixed Page not found entries for menu-collapsed.png.
Admin Menu 4.7-1.2, 2007-03-04
------------------------------
- Fixed menu item adjustments
- Fixed IE / Safari support
- Fixed base_path for IE support
- Added create content options to content management menu
Admin Menu 4.7-1.1, 2007-01-24
------------------------------
First stable release, compatible to Drupal 4.7.x and 5.x.
Admin Menu 4.7-1.0, 2007-01-16
------------------------------
Initial release of admin_menu module. Already supporting Drupal 5.0.

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,181 @@
-- SUMMARY --
The Drupal administration menu module displays the entire administrative
menu tree (and most local tasks) in a drop-down menu, providing administrators
one- or two-click access to most pages. Other modules may also add menu
links to administration menu using hook_admin_menu().
For a full description of the module, visit the project page:
http://drupal.org/project/admin_menu
To submit bug reports and feature suggestions, or to track changes:
http://drupal.org/project/issues/admin_menu
-- REQUIREMENTS --
None.
-- INSTALLATION --
* Install as usual, see http://drupal.org/node/70151 for further information.
-- CONFIGURATION --
* Configure user permissions in Administer >> User management >> Permissions >>
admin_menu module:
- access administration menu
Users in roles with the "access administration menu" permission will see
the administration menu at the top of each page.
- display drupal links
Users in roles with the "display drupal links" permission will receive
links to Drupal.org issue queues for all enabled contributed modules. The
issue queue links appear under the administration menu icon.)
Note that the menu items displayed in the administration Menu depend on the
actual permissions of the viewing user. For example, the "User management"
menu item is not displayed to a user who is not a member of a role with the
"administer permissions" and "administer users" permissions.
* Customize the menu settings in Administer >> Site configuration >>
Administration menu.
* To prevent administrative menu items from appearing twice, you may hide the
"Navigation" menu block, or move the "Administer" menu items into a separate
menu.
-- CUSTOMIZATION --
* To override the default administration menu icon, you may:
1) Disable it via CSS in your theme:
body #admin-menu-icon { display: none; }
2) Alter the image by overriding the theme function:
Copy the entire theme_admin_menu_icon() function into your template.php,
rename it to phptemplate_admin_menu_icon() or THEMENAME_admin_menu_icon(),
and customize the output according to your needs.
Remember that the output of the administration menu is cached. To see changes
from your theme override function, you must clear your site cache (via
the "Flush all caches" link on the menu).
* To override the font size, add the following line to your theme's stylesheet:
body #admin-menu { font-size: 10px; }
-- TROUBLESHOOTING --
* If the menu does not display, check the following:
- Are the "access administration menu" and "access administration pages"
permissions enabled for the appropriate roles?
- Does your theme output the $closure variable?
* If the menu is rendered behind a Flash movie object, add this property to your
Flash object(s):
<param name="wmode" value="transparent" />
See http://drupal.org/node/195386 for further information.
-- FAQ --
Q: When the administration menu module is enabled, blank space is added to the
bottom of my theme. Why?
A: This is caused by a long list of links to module issue queues at Drupal.org.
Use Administer >> User management >> Permissions to disable the "display
drupal links" permission for all appropriate roles. Note that since UID 1
automatically receives all permissions, the list of issue queue links cannot
be disabled for UID 1.
Q: After upgrading to 6.x-1.x, the menu disappeared. Why?
A: You may need to regenerate your menu. Visit
http://example.com/admin/build/modules to regenerate your menu (substitute
your site name for example.com).
Q: Can I configure the administration menu module to display another menu (like
the Navigation menu, for instance)?
A: No. As the name implies, administration menu module is for administrative
menu links only. However, you can copy and paste the contents of
admin_menu.css into your theme's stylesheet and replace #admin-menu with any
other menu block id (#block-menu-1, for example).
Q: Sometimes, the user counter displays a lot of anonymous users, but no spike
of users or requests appear in Google Analytics or other tracking tools.
A: If your site was concurrently spidered by search-engine robots, it may have
a significant number of anonymous users for a short time. Most web tracking
tools like Google Analytics automatically filter out these requests.
Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still
there. Is this normal?
A: Yes, this is the intended behavior. the administration menu module only loads
its stylesheet as needed (i.e., on page requests by logged-on, administrative
users).
Q: Why are sub-menus not visible in Opera?
A: In the Opera browser preferences under "web pages" there is an option to fit
to width. By disabling this option, sub-menus in the administration menu
should appear.
Q: How can the administration menu be hidden on certain pages?
A: You can suppress it by simply calling the following function in PHP:
module_invoke('admin_menu', 'suppress');
However, this needs to happen as early as possible in the page request, so
placing it in the theming layer (resp. a page template file) is too late.
Ideally, the function is called in hook_init() in a custom module. If you do
not have a custom module, placing it into some conditional code at the top of
template.php may work out, too.
-- CONTACT --
Current maintainers:
* Daniel F. Kudwien (sun) - http://drupal.org/user/54136
* Peter Wolanin (pwolanin) - http://drupal.org/user/49851
* Stefan M. Kudwien (smk-ka) - http://drupal.org/user/48898
* Dave Reid (Dave Reid) - http://drupal.org/user/53892
Major rewrite for Drupal 6 by Peter Wolanin (pwolanin).
This project has been sponsored by:
* UNLEASHED MIND
Specialized in consulting and planning of Drupal powered sites, UNLEASHED
MIND offers installation, development, theming, customization, and hosting
to get you started. Visit http://www.unleashedmind.com for more information.
* Lullabot
Friendly Drupal experts providing professional consulting & education
services. Visit http://www.lullabot.com for more information.
* Acquia
Commercially Supported Drupal. Visit http://acquia.com for more information.

View file

@ -0,0 +1,25 @@
#admin-menu { text-align: right; direction: rtl; }
#admin-menu li.admin-menu-action { float: left; }
#admin-menu li.admin-menu-action a { border-right: 1px solid #323232; border-left: none; }
/* all lists */
#admin-menu ul a { border-left: 1px solid #323232; border-right: 0; padding: 4px 8px; text-align: right; }
/* all list items */
/* width needed or else Opera goes nuts */
#admin-menu li { float: right; position: relative; }
#admin-menu li li { position: static; }
#admin-menu li ul { right: 0; }
/* third-and-above-level lists */
#admin-menu li li.expandable ul { margin: -20px 160px 0 0; }
#admin-menu li.admin-menu-action:hover ul {
left: 0 !important;
right: auto;
}
/* second-and-more-level hovering */
#admin-menu li li.expandable { background: #45454a url(images/arrow-rtl.png) no-repeat 5px 7px; }

View file

@ -0,0 +1,102 @@
/**
* Administration Menu.
*
* Implementation of Sons of Suckerfish Dropdowns.
* @see www.htmldog.com/articles/suckerfish
**/
#admin-menu { position: absolute; top: 0px; left: 0px; font-size: 9px; font-family: "lucida grande", tahoma, verdana, arial, sans-serif; background: url(images/bkg.png) bottom left repeat-x #101010; width: 100%; text-align: left; }
#admin-menu li.admin-menu-icon a { padding: 1px 8px 4px; }
#admin-menu li.admin-menu-icon ul a { padding: 4px 8px; }
#admin-menu li.admin-menu-icon img { vertical-align: bottom; }
#admin-menu li.admin-menu-users img { margin-top: 1px; }
#admin-menu li.admin-menu-action { float: right; }
#admin-menu li.admin-menu-action a { border-left: 1px solid #323232; border-right: none; }
body.admin-menu { margin-top: 20px !important; }
/* all lists */
#admin-menu, #admin-menu ul { padding: 0; margin: 0; list-style: none; line-height: 1.4em; z-index: 999; }
#admin-menu ul { position: static; }
#admin-menu ul a { display: block; border-right: 1px solid #323232; border-bottom: none; padding: 4px 8px; font-weight: normal; color: #eee; text-decoration: none; text-align: left; }
#admin-menu ul li.admin-menu-tab a { border-right: 1px solid #52565e; }
#admin-menu li li a { border-right: none; border-top: 1px solid #323232; }
/* all list items */
/* width needed or else Opera goes nuts */
#admin-menu li { float: left; height: 100%; margin: 0 !important; padding: 0; list-style-image: none; list-style-type: none; background-image: none; }
#admin-menu li.admin-menu-tab { padding-bottom: 1px; background: url(images/bkg_tab.png) repeat-x left bottom; }
#admin-menu li li { width: 160px; background: #202020; filter:Alpha(opacity=88); opacity: 0.88; float: none; }
/* second-level lists */
/* Note: Use left instead of display to hide publicly visible menus because display: none isn't read by screen readers */
#admin-menu li ul { position: absolute; background: none; margin: 0; width: 160px; left: -999em; display: none; line-height: 1.2em; }
/* third-and-above-level lists */
#admin-menu li li.expandable ul { margin: -20px 0 0 160px; }
#admin-menu li:hover ul ul,
#admin-menu li:hover ul ul ul,
#admin-menu li:hover ul ul ul ul,
#admin-menu li:hover ul ul ul ul ul,
#admin-menu li.iehover ul ul,
#admin-menu li.iehover ul ul ul,
#admin-menu li.iehover ul ul ul ul,
#admin-menu li.iehover ul ul ul ul ul {
left: -999em;
display: none;
}
/* lists nested under hovered list items */
#admin-menu li:hover ul,
#admin-menu li li:hover ul,
#admin-menu li li li:hover ul,
#admin-menu li li li li:hover ul,
#admin-menu li li li li li:hover ul,
#admin-menu li.iehover ul,
#admin-menu li li.iehover ul,
#admin-menu li li li.iehover ul,
#admin-menu li li li li.iehover ul,
#admin-menu li li li li li.iehover ul {
left: auto;
display: block;
}
#admin-menu li.admin-menu-action:hover ul {
right: 0;
}
/* second-and-more-level hovering */
#admin-menu li li.expandable { background: #45454a url(images/arrow.png) no-repeat 145px 7px; }
#admin-menu li li:hover,
#admin-menu li li.iehover {
background-color: #111;
}
#admin-menu li li:hover a,
#admin-menu li li:hover li:hover a,
#admin-menu li li:hover li:hover li:hover a {
color: #fff;
}
#admin-menu li li.expandable:hover a,
#admin-menu li li.expandable:hover li.expandable:hover a {
border-color: #666666; color: #eee;
}
#admin-menu li li.expandable:hover li a,
#admin-menu li li.expandable:hover li.expandable:hover li a {
border-color: #323232;
}
#admin-menu li li:hover li a,
#admin-menu li li.iehover li a,
#admin-menu li li.iehover li.iehover li a {
color: #eee;
}
#admin-menu li li.iehover a,
#admin-menu li li.iehover li.iehover a,
#admin-menu li li.iehover li.iehover li.iehover a {
color: #fff; width: 90%; /* IE */
}
/* #210615: Mozilla on Mac fix */
html.js fieldset.collapsible div.fieldset-wrapper { overflow: visible; }
@media print {
#admin-menu { display: none; }
body.admin-menu { margin-top: 0 !important; }
}

View file

@ -0,0 +1,14 @@
<?php
/**
* Implments hook_drush_exit()
*
* This is necessary because drush skips the normal hook_exit() where
* we build the links.
*/
function admin_menu_drush_exit() {
if (function_exists('admin_menu_exit')) {
admin_menu_exit();
}
}

View file

@ -0,0 +1,566 @@
<?php
/**
* The key function that builds the menu links whenever there is a menu rebuild.
*/
function _admin_menu_rebuild_links() {
$menu = NULL;
// Since it's possible this core function might change, check
// that it exists. We do this instead of calling menu_router_build()
// since that may trigger another menu rebuild that is not protected
// by the lock API.
if (function_exists('_menu_router_cache')) {
// Get the newly rebuilt menu.
$menu = _menu_router_cache();
}
else {
$menu = menu_router_build();
}
if (!$menu) {
// Something went wrong. Don't risk triggering another menu rebuild.
return;
}
// Add normal and suggested items as links.
$menu_links = array();
foreach ($menu as $path => $item) {
// Exclude menu callbacks, include items below admin/* and node/add/*.
if ($item['type'] != MENU_CALLBACK && (($item['_parts'][0] == 'admin' && count($item['_parts']) > 1) || (strpos($path, 'node/add') === 0))) {
// TODO: handle local tasks with wildcards
if (!strpos($path, '%')) {
$item = admin_menu_link_build($item);
$menu_links[$path] = $item;
$sort[$path] = $item['_number_parts'];
}
}
}
$deleted = admin_menu_adjust_items($menu_links, $sort);
if ($menu_links) {
// Make sure no child comes before its parent.
array_multisort($sort, SORT_NUMERIC, $menu_links);
foreach ($menu_links as $item) {
admin_menu_link_save($item);
}
}
// Allow modules to add more links. If you want to alter links saved by
// admin_menu, use hook_menu_link_alter() and look for
// $item['module'] == 'admin_menu'
$links = array();
foreach (module_implements('admin_menu') as $module) {
$function = $module . '_admin_menu';
$links = array_merge_recursive($links, $function($deleted));
}
foreach ($links as $item) {
admin_menu_link_save($item);
}
}
/**
* Prepare a menu link from basic information formatted for a router item.
*/
function admin_menu_link_build($item) {
$item['module'] = 'admin_menu';
$item['menu_name'] = 'admin_menu';
$item += array(
'link_title' => isset($item['title']) ? $item['title'] : '',
'link_path' => isset($item['path']) ? $item['path'] : '',
'hidden' => 0,
'options' => array(),
);
$item['options']['alter'] = TRUE;
// DAM does not output item descriptions to prevent mouseover clashes and
// increase page loading performance. However, the following code shows how
// link attributes can be added (for ajaxified DAM functionality later).
/*
if (!empty($item['description'])) {
$item['options']['attributes']['title'] = $item['description'];
}
*/
if (!empty($item['query'])) {
$item['options']['query'] = $item['query'];
}
return $item;
}
/**
* Convenience function that looks up the plid if $item['parent_path'] is set.
*/
function admin_menu_link_save($item) {
$item = admin_menu_link_build($item);
// Check whether we are able to update an existing item.
$existing_item = db_fetch_array(db_query("SELECT mlid, plid, has_children FROM {menu_links} WHERE link_path = '%s' AND menu_name = '%s'", $item['link_path'], 'admin_menu'));
if ($existing_item) {
$item['mlid'] = $existing_item['mlid'];
$item['plid'] = $existing_item['plid'];
$item['has_children'] = $existing_item['has_children'];
}
// Look up the parent path for both new and existing links, since the parent
// may change.
if (isset($item['parent_path'])) {
if ($item['parent_path'] == '<root>') {
// <root> means that we want the link at the top level.
$item['plid'] = 0;
}
else {
$plid = db_result(db_query("SELECT mlid from {menu_links} WHERE link_path = '%s' AND menu_name = '%s'", $item['parent_path'], 'admin_menu'));
if ($plid) {
$item['plid'] = $plid;
}
}
}
menu_link_save($item);
}
/**
* Implementation of hook_admin_menu().
*
* @param &$deleted
* Array of links under admin/* that were removed by admin_menu_adjust_items().
* If one of these links is added back, it should be removed from the array.
*/
function admin_menu_admin_menu(&$deleted) {
$links = array();
$icon_path = '<front>';
// Add link to manually run cron.
$links[] = array(
'title' => 'Run cron',
'path' => 'admin/reports/status/run-cron',
'weight' => 50,
'parent_path' => $icon_path,
);
// Add link to run update.php.
$links[] = array(
'title' => 'Run updates',
'path' => 'update.php',
'weight' => 50,
'parent_path' => $icon_path,
'options' => array('external' => TRUE),
);
// Move 'By module' item into Site configuration.
if (isset($deleted['admin/by-module'])) {
$deleted['admin/by-module']['parent_path'] = 'admin/settings';
$deleted['admin/by-module']['weight'] = -10;
$links[] = $deleted['admin/by-module'];
unset($deleted['admin/by-module']);
}
// Add link to drupal.org.
$links[] = array(
'title' => 'Drupal.org',
'path' => 'http://drupal.org',
'weight' => 100,
'parent_path' => $icon_path,
);
// Add links to project issue queues.
$links[] = array(
'title' => 'Drupal issue queue',
'path' => 'http://drupal.org/project/issues/drupal',
'weight' => -10,
'parent_path' => 'http://drupal.org',
);
$projects = array();
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) .'/'. $module .'.info');
if (!isset($info['project']) || (isset($info['project']) && ($info['project'] == 'drupal' || isset($projects[$info['project']])))) {
continue;
}
$projects[$info['project']] = 1;
$url = 'http://drupal.org/project/issues/'. $info['project'];
// Filtering project versions via query string is not yet supported.
// @see http://drupal.org/node/97569
// $url .= !empty($info['version']) ? '/'. $info['version'] : '';
$links[] = array(
'title' => check_plain($info['name']) . ' issue queue',
'path' => $url,
'parent_path' => 'http://drupal.org',
);
}
// Add 'Create <content-type>' items to Content management menu.
if (isset($deleted['node/add'])) {
$deleted['node/add']['parent_path'] = 'admin/content';
$deleted['node/add']['weight'] = 0;
$links[] = $deleted['node/add'];
unset($deleted['node/add']);
}
foreach($deleted as $path => $item) {
if (strpos($path, 'node/add') !== FALSE) {
$links[] = $deleted[$path];
unset($deleted[$path]);
}
}
// Make sure longer paths are after shorter ones
ksort($deleted);
foreach (node_get_types('types', NULL, TRUE) as $type) {
$type_url_str = str_replace('_', '-', $type->type);
$type_path = 'admin/content/node-type/' . $type_url_str;
$links[$type_path] = array(
'title' => 'Edit !content-type',
'path' => $type_path,
'parent_path' => 'admin/content/types',
'options' => array('t' => array('!content-type' => $type->name)),
);
unset($deleted[$type_path . '/edit']);
// CCK and other modules adding to node types handled here.
foreach($deleted as $path => $item) {
// Precise test needed to account for multiple content-types having the
// same prefix in their name.
if ($path === $type_path || strpos($path, $type_path . '/') === 0) {
// Logically, parent path can never go shorter than $type_path.
$i = $item['_number_parts'] - 1;
do {
$parent_path = implode('/', array_slice($item['_parts'], 0, $i));
--$i;
} while (!isset($links[$parent_path]) && $i);
$item['parent_path'] = $parent_path;
$links[$path] = $item;
unset($deleted[$path]);
}
}
}
// Add clear-cache.
$links[] = array(
'title' => 'Flush all caches',
'path' => 'admin_menu/flush-cache',
'query' => 'destination',
'weight' => 20,
'parent_path' => $icon_path,
);
$caches = array(
'admin_menu' => 'Administration menu',
'cache' => 'Cache tables',
'menu' => 'Menu',
'requisites' => 'Page requisites',
'theme' => 'Theme registry',
);
foreach ($caches as $name => $title) {
$links[] = array(
'title' => $title,
'path' => 'admin_menu/flush-cache/' . $name,
'query' => 'destination',
'parent_path' => 'admin_menu/flush-cache',
);
}
// Add devel module links
if (module_exists('devel')) {
// Add variable editor.
$links[] = array(
'title' => 'Variable editor',
'path' => 'devel/variable',
'weight' => 20,
'parent_path' => $icon_path,
);
// Add switch_user items.
if ($devel_user_links = module_invoke('devel', 'switch_user_list')) {
foreach ($devel_user_links as $link) {
if (is_array($link)) {
$links[] = array(
'title' => $link['title'],
'description' => $link['attributes']['title'],
'path' => $link['href'],
'options' => array(
'query' => $link['query'],
'html' => !empty($link['html']),
),
'parent_path' => 'logout',
);
}
// @todo Remove when Devel 6.x-1.16 has been released.
elseif (preg_match('!href="' . base_path() . '([^\?]+)\?([^"]+)" title="([^"]+)">((<em>)?[^<]+(</em>)?)!', $link, $match)) {
$links[] = array(
'title' => $match[4],
'description' => $match[3],
'path' => urldecode($match[1]),
'weight' => 20,
'query' => 'destination',
'parent_path' => 'logout',
'options' => array('html' => TRUE),
);
}
}
}
}
// Add developer modules toggle link.
$saved_state = variable_get('admin_menu_devel_modules_enabled', NULL);
$links[] = array(
'title' => isset($saved_state) ? t('Enable developer modules') : t('Disable developer modules'),
'path' => 'admin_menu/toggle-modules',
'weight' => 88,
'parent_path' => $icon_path,
'options' => array('query' => 'destination'),
);
return $links;
}
/**
* Add some hard-coded features for better user experience.
*
* @param array $menu_links
* An array containing the complete administration menu structure, passed by
* reference.
* @param array $sort
* An array containing the # parts of each link - must be updated if a link
* is added.
* @return
* An array of links that were removed from $menu_links.
*/
function admin_menu_adjust_items(&$menu_links, &$sort) {
global $user;
$links = array();
$deleted = array();
// Change or remove items, or add new top-level items.
$deleted['admin/by-module'] = $menu_links['admin/by-module'];
unset($menu_links['admin/by-module'], $sort['admin/by-module']);
$deleted['admin/by-task'] = $menu_links['admin/by-task'];
unset($menu_links['admin/by-task'], $sort['admin/by-task']);
// Remove certain links to re-position them in admin_menu_admin_menu().
foreach ($menu_links as $path => $link) {
// Remove links below
// - admin/content/node-type/*
// - node/add*
if (strpos($path, 'admin/content/node-type/') !== FALSE || strpos($path, 'node/add') !== FALSE) {
$deleted[$path] = $link;
unset($menu_links[$path], $sort[$path]);
}
}
// Add the icon containing special links.
$links[] = array(
'title' => theme('admin_menu_icon'),
'path' => '<front>',
'weight' => -100,
'parent_path' => '<root>',
'options' => array('extra class' => 'admin-menu-icon', 'html' => TRUE),
);
// Add link to show current authenticated/anonymous users - we will add the
// data dynamically in the _alter hook.
$links[] = array(
'title' => 'icon_users',
'path' => 'user',
'weight' => -90,
'parent_path' => '<root>',
'options' => array('extra class' => 'admin-menu-action admin-menu-icon admin-menu-users', 'html' => TRUE),
);
$links[] = array(
'title' => 'Log out @username',
'path' => 'logout',
'weight' => -100,
'parent_path' => '<root>',
// Note: @username is dynamically replaced by default, we just invoke
// replacement by setting the 't' key here.
'options' => array('extra class' => 'admin-menu-action admin-menu-logout', 't' => array()),
);
foreach ($links as $item) {
$path = $item['path'];
$item = admin_menu_link_build($item);
$menu_links[$path] = $item;
$sort[$path] = 1;
}
return $deleted;
}
/**
* Form builder function for module settings.
*/
function admin_menu_theme_settings() {
$form['admin_menu_margin_top'] = array(
'#type' => 'checkbox',
'#title' => t('Adjust top margin'),
'#default_value' => variable_get('admin_menu_margin_top', 1),
'#description' => t('If enabled, the site output is shifted down approximately 20 pixels from the top of the viewport to display the administration menu. If disabled, some absolute- or fixed-positioned page elements may be covered by the administration menu.'),
);
$form['admin_menu_position_fixed'] = array(
'#type' => 'checkbox',
'#title' => t('Keep menu at top of page'),
'#default_value' => variable_get('admin_menu_position_fixed', 0),
'#description' => t('If enabled, the administration menu is always displayed at the top of the browser viewport (even after the page is scrolled). <strong>Note: In some browsers, this setting results in a malformed page, an invisible cursor, non-selectable elements in forms, or other issues. Disable this option if these issues occur.</strong>'),
);
$form['tweaks'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
);
$form['tweaks']['admin_menu_tweak_modules'] = array(
'#type' => 'checkbox',
'#title' => t('Collapse fieldsets on modules page'),
'#default_value' => variable_get('admin_menu_tweak_modules', 0),
'#description' => t('If enabled, fieldsets on the <a href="!modules-url">modules</a> page are automatically collapsed when loading the page.', array('!modules-url' => url('admin/build/modules'))),
);
if (module_exists('util')) {
$form['tweaks']['admin_menu_tweak_modules']['#description'] .= '<br /><strong>'. t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') .'</strong>';
}
$form['tweaks']['admin_menu_tweak_tabs'] = array(
'#type' => 'checkbox',
'#title' => t('Move local tasks into menu'),
'#default_value' => variable_get('admin_menu_tweak_tabs', 0),
'#description' => t('If enabled, the tabs on the current page are moved into the administration menu. This feature is only available in themes that use the CSS classes <code>tabs primary</code> and <code>tabs secondary</code> for tabs.'),
);
$form = system_settings_form($form);
$form['wipe description'] = array(
'#type' => 'item',
'#value' => t('If the administration menu displays duplicate menu items, you may need to rebuild your menu items using the <em>Wipe and rebuild</em> button.'),
);
$form['wipe'] = array(
'#type' => 'submit',
'#value' => t('Wipe and rebuild'),
'#submit' => array('admin_menu_wipe'),
);
return $form;
}
/**
* Wipe the menu so it can be rebuilt from scratch.
*/
function admin_menu_wipe() {
db_query("DELETE FROM {menu_links} WHERE menu_name = 'admin_menu'");
menu_cache_clear('admin_menu');
menu_rebuild();
}
/**
* Helper function for admin_menu_form_devel_admin_settings_alter().
*
* Extends Devel module with Administration Menu developer settings.
*/
function _admin_menu_devel_settings_form_alter(&$form, $form_state) {
// Shift system_settings_form buttons.
$weight = isset($form['buttons']['#weight']) ? $form['buttons']['#weight'] : 0;
$form['buttons']['#weight'] = $weight + 1;
$form['admin_menu'] = array(
'#type' => 'fieldset',
'#title' => t('Administration menu settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$display_options = array('mid', 'weight', 'pid');
$display_options = array(0 => t('None'), 'mlid' => t('Menu link ID'), 'weight' => t('Weight'), 'plid' => t('Parent link ID'));
$form['admin_menu']['admin_menu_display'] = array(
'#type' => 'radios',
'#title' => t('Display additional data for each menu item'),
'#default_value' => variable_get('admin_menu_display', 0),
'#options' => $display_options,
'#description' => t('Display the selected items next to each menu item link.'),
);
$form['admin_menu']['admin_menu_show_all'] = array(
'#type' => 'checkbox',
'#title' => t('Display all menu items'),
'#default_value' => variable_get('admin_menu_show_all', 0),
'#description' => t('If enabled, all menu items are displayed regardless of your site permissions. <em>Note: Do not enable on a production site.</em>'),
);
}
/**
* Menu callback to enable/disable developer modules.
*
* This saves up to 150ms on each uncached page request. Not much, but
* on larger Drupal sites this is actually a 10% performance increase.
*/
function admin_menu_toggle_modules() {
// URL token prtects this against CSRF attacks.
if(!isset($_GET['token']) || ($_GET['token'] !== drupal_get_token($_GET['q']))) {
return MENU_ACCESS_DENIED;
}
$rebuild = FALSE;
$saved_state = variable_get('admin_menu_devel_modules_enabled', NULL);
if (isset($saved_state)) {
// Re-enable modules that were enabled before.
module_enable($saved_state);
variable_del('admin_menu_devel_modules_enabled');
drupal_set_message(t('Enabled these modules: !module-list.', array('!module-list' => implode(', ', $saved_state))));
$rebuild = TRUE;
}
else {
// Allow site admins to override this variable via settings.php.
$devel_modules = variable_get('admin_menu_devel_modules', array('cache_disable', 'coder', 'content_copy', 'debug', 'delete_all', 'demo', 'devel', 'devel_node_access', 'devel_themer', 'macro', 'form_controller', 'imagecache_ui', 'journal', 'trace', 'upgrade_status', 'user_display_ui', 'util', 'views_ui', 'views_theme_wizard'));
// Store currently enabled modules in a variable.
$devel_modules = array_intersect(module_list(FALSE, FALSE), $devel_modules);
if (!empty($devel_modules)) {
variable_set('admin_menu_devel_modules_enabled', $devel_modules);
// Disable developer modules.
module_disable($devel_modules);
drupal_set_message(t('Disabled these modules: !module-list.', array('!module-list' => implode(', ', $devel_modules))));
$rebuild = TRUE;
}
else {
drupal_set_message(t('No developer modules are enabled.'));
}
}
if ($rebuild) {
// Make sure everything is rebuilt, basically a combination of the calls
// from system_modules() and system_modules_submit().
drupal_rebuild_theme_registry();
menu_rebuild();
cache_clear_all('schema', 'cache');
cache_clear_all();
drupal_clear_css_cache();
drupal_clear_js_cache();
// Synchronize to catch any actions that were added or removed.
actions_synchronize();
}
drupal_goto('');
}
/**
* Flush all caches or a specific one.
*
* @param $name
* (optional) Name of cache to flush.
*/
function admin_menu_flush_cache($name = NULL) {
// URL token protects this against CSRF attacks.
if(!isset($_GET['token']) || ($_GET['token'] !== drupal_get_token($_GET['q']))) {
return MENU_ACCESS_DENIED;
}
switch ($name) {
case 'admin_menu':
admin_menu_wipe();
break;
case 'cache':
// Don't clear cache_form - in-progress form submissions may break.
// Ordered so clearing the page cache will always be the last action.
$core = array('cache', 'cache_block', 'cache_filter', 'cache_page');
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
foreach ($cache_tables as $table) {
cache_clear_all('*', $table, TRUE);
}
break;
case 'menu':
menu_rebuild();
break;
case 'requisites':
// Change query-strings on css/js files to enforce reload for all users.
_drupal_flush_css_js();
drupal_clear_css_cache();
drupal_clear_js_cache();
break;
case 'theme':
module_invoke('system', 'theme_data');
drupal_rebuild_theme_registry();
break;
default:
// Flush all caches; no need to re-implement this.
module_load_include('inc', 'system', 'system.admin');
$form = $form_state = array();
system_clear_cache_submit($form, $form_state);
break;
}
drupal_goto();
}

View file

@ -0,0 +1,11 @@
name = Administration menu
description = "Provides a dropdown menu to most administrative tasks and other common destinations (to users with the proper permissions)."
package = Core - optional
core = 6.x
; Information added by Drupal.org packaging script on 2015-02-21
version = "6.x-1.9"
core = "6.x"
project = "admin_menu"
datestamp = "1424535792"

View file

@ -0,0 +1,45 @@
<?php
/**
* Implementation of hook_uninstall().
*/
function admin_menu_uninstall() {
// Delete menu links.
db_query("DELETE FROM {menu_links} WHERE module = 'admin_menu'");
menu_cache_clear_all();
// Delete variables.
variable_del('admin_menu_devel_modules_enabled');
variable_del('admin_menu_margin_top');
variable_del('admin_menu_position_fixed');
variable_del('admin_menu_rebuild_links');
variable_del('admin_menu_tweak_modules');
variable_del('admin_menu_tweak_tabs');
}
/**
* Ensure that admin_menu is rebuilt after upgrading to D6.
*/
function admin_menu_update_6000() {
$ret = array();
// Delete menu links.
db_query("DELETE FROM {menu_links} WHERE module = 'admin_menu'");
variable_set('admin_menu_rebuild_links', TRUE);
// Drop the {admin_menu} table in admin_menu_update_6000() on sites that used
// one of the later patches in #132524.
if (db_table_exists('admin_menu')) {
$ret[] = update_sql("DROP TABLE {admin_menu}");
}
return $ret;
}
/**
* Wipe and rebuild so we can switch the icon path to <front>.
*/
function admin_menu_update_6001() {
$ret = array();
module_load_include('inc', 'admin_menu');
admin_menu_wipe();
$ret[] = array('success' => TRUE, 'query' => 'Administration menu links deleted for clean rebuild.');
return $ret;
}

View file

@ -0,0 +1,52 @@
$(document).ready(function() {
if (!$('#admin-menu').length) {
return;
}
// Apply margin-top if enabled; directly applying marginTop doesn't work in IE.
if (Drupal && Drupal.settings && Drupal.settings.admin_menu) {
if (Drupal.settings.admin_menu.margin_top) {
$('body').addClass('admin-menu');
}
if (Drupal.settings.admin_menu.position_fixed) {
$('#admin-menu').css('position', 'fixed');
}
// Move page tabs into administration menu.
if (Drupal.settings.admin_menu.tweak_tabs) {
$('ul.tabs.primary li').each(function() {
$(this).addClass('admin-menu-tab').appendTo('#admin-menu > ul');
});
$('ul.tabs.secondary').appendTo('#admin-menu > ul > li.admin-menu-tab.active').removeClass('secondary');
}
// Collapse fieldsets on Modules page. For why multiple selectors see #111719.
if (Drupal.settings.admin_menu.tweak_modules) {
$('#system-modules fieldset:not(.collapsed), #system-modules-1 fieldset:not(.collapsed)').addClass('collapsed');
}
}
// Hover emulation for IE 6.
if ($.browser.msie && parseInt(jQuery.browser.version) == 6) {
$('#admin-menu li').hover(function() {
$(this).addClass('iehover');
}, function() {
$(this).removeClass('iehover');
});
}
// Delayed mouseout.
$('#admin-menu li').hover(function() {
// Stop the timer.
clearTimeout(this.sfTimer);
// Display child lists.
$('> ul', this).css({left: 'auto', display: 'block'})
// Immediately hide nephew lists.
.parent().siblings('li').children('ul').css({left: '-999em', display: 'none'});
}, function() {
// Start the timer.
var uls = $('> ul', this);
this.sfTimer = setTimeout(function() {
uls.css({left: '-999em', display: 'none'});
}, 400);
});
});

View file

@ -0,0 +1,330 @@
<?php
/**
* @file
* Renders a menu tree for administrative purposes as a dropdown menu at the top
* of the window.
*/
/**
* Implementation of hook_help().
*/
function admin_menu_help($path, $arg) {
switch ($path) {
case 'admin/settings/admin_menu':
return t('The administration menu module provides a dropdown menu arranged for one- or two-click access to most administrative tasks and other common destinations (to users with the proper permissions). Use the settings below to customize the appearance of the menu.');
case 'admin/help#admin_menu':
$output = '';
$output .= '<p>' . t('The administration menu module provides a dropdown menu arranged for one- or two-click access to most administrative tasks and other common destinations (to users with the proper permissions). Administration menu also displays the number of anonymous and authenticated users, and allows modules to add their own custom menu items. Integration with the menu varies from module to module; the contributed module <a href="@drupal">Devel</a>, for instance, makes strong use of the administration menu module to provide quick access to development tools.', array('@drupal' => 'http://drupal.org/project/devel')) . '</p>';
$output .= '<p>' . t('The administration menu <a href="@settings">settings page</a> allows you to modify some elements of the menu\'s behavior and appearance. Since the appearance of the menu is dependent on your site theme, substantial customizations require modifications to your site\'s theme and CSS files. See the advanced module README.txt file for more information on theme and CSS customizations.', array('@settings' => url('admin/settings/admin_menu'))) . '</p>';
$output .= '<p>' . t('The menu items displayed in the administration menu depend upon the actual permissions of the viewer. First, the administration menu is only displayed to users in roles with the <em>Access administration menu</em> (admin_menu module) permission. Second, a user must be a member of a role with the <em>Access administration pages</em> (system module) permission to view administrative links. And, third, only currently permitted links are displayed; for example, if a user is not a member of a role with the permissions <em>Administer permissions</em> (user module) and <em>Administer users</em> (user module), the <em>User management</em> menu item is not displayed.') . '</p>';
return $output;
}
}
/**
* Implementation of hook_perm().
*/
function admin_menu_perm() {
return array('access administration menu', 'display drupal links');
}
/**
* Implementation of hook_theme().
*/
function admin_menu_theme() {
return array(
'admin_menu_icon' => array(
'arguments' => array(),
),
);
}
/**
* Implementation of hook_menu().
*/
function admin_menu_menu() {
$items = array();
$items['admin/settings/admin_menu'] = array(
'title' => 'Administration menu',
'description' => 'Adjust administration menu settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array('admin_menu_theme_settings'),
'access arguments' => array('administer site configuration'),
'file' => 'admin_menu.inc',
);
$items['admin_menu/toggle-modules'] = array(
'page callback' => 'admin_menu_toggle_modules',
'access arguments' => array('administer site configuration'),
'type' => MENU_CALLBACK,
'file' => 'admin_menu.inc',
);
$items['admin_menu/flush-cache'] = array(
'page callback' => 'admin_menu_flush_cache',
'access arguments' => array('administer site configuration'),
'type' => MENU_CALLBACK,
'file' => 'admin_menu.inc',
);
return $items;
}
/**
* Implementation of hook_init().
*
* We can't move this into admin_menu_footer(), because PHP-only based themes
* like chameleon load and output scripts and stylesheets in front of
* theme_closure(), so we ensure Admin menu's styles and scripts are loaded on
* all pages via hook_init().
*/
function admin_menu_init() {
if (user_access('access administration menu')) {
$path = drupal_get_path('module', 'admin_menu');
drupal_add_css($path .'/admin_menu.css', 'module', 'all', FALSE);
// Performance: Defer execution.
drupal_add_js($path .'/admin_menu.js', 'module', 'header', TRUE);
if ($setting = variable_get('admin_menu_margin_top', 1)) {
drupal_add_js(array('admin_menu' => array('margin_top' => $setting)), 'setting');
}
if ($setting = variable_get('admin_menu_position_fixed', 0)) {
drupal_add_js(array('admin_menu' => array('position_fixed' => $setting)), 'setting');
}
if ($setting = variable_get('admin_menu_tweak_tabs', 0)) {
drupal_add_js(array('admin_menu' => array('tweak_tabs' => $setting)), 'setting');
}
if ($_GET['q'] == 'admin/build/modules' || strpos($_GET['q'], 'admin/build/modules/list') === 0) {
drupal_add_js(array('admin_menu' => array('tweak_modules' => variable_get('admin_menu_tweak_modules', 0))), 'setting');
}
}
}
/**
* Suppress display of administration menu.
*
* This function should be called from within another module's page callback
* (preferably using module_invoke()) when the menu should not be displayed.
* This is useful for modules that implement popup pages or other special
* pages where the menu would be distracting or break the layout.
*
* @param $set
* Defaults to TRUE. If called before hook_footer, the menu will not be
* displayed. Calling with FALSE returns the suppression state.
*/
function admin_menu_suppress($set = TRUE) {
static $suppress = FALSE;
if (!empty($set)) {
$suppress = TRUE;
}
return $suppress;
}
/**
* Implementation of hook_footer().
*
* Admin menu was previously output via hook_block(), but suffered from
* theme-specific stylesheets that may be applied to layout blocks. We now
* output Admin menu in the footer to circumvent this.
*/
function admin_menu_footer($main = 0) {
if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
return;
}
$content = '<div id="admin-menu">';
$content .= admin_menu_tree_output(menu_tree_all_data('admin_menu'));
$content .= '</div>';
return $content;
}
/**
* Implementation of hook_exit().
*/
function admin_menu_exit() {
// Check for the flag indicating that we need to rebuild.
if (admin_menu_rebuild_links()) {
module_load_include('inc', 'admin_menu');
_admin_menu_rebuild_links();
}
}
/**
* Returns a rendered menu tree.
*
* @param $tree
* A data structure representing the tree as returned from menu_tree_data.
*
* @return string
* The complete, rendered administration menu.
*/
function admin_menu_tree_output($tree) {
$output = '';
foreach ($tree as $data) {
$extra_class = isset($data['link']['localized_options']['extra class']) ? $data['link']['localized_options']['extra class'] : NULL;
$link = admin_menu_item_link($data['link']);
if ($data['below']) {
$output .= theme_admin_menu_item($link, $data['link']['has_children'], admin_menu_tree_output($data['below']), $data['link']['in_active_trail'], $extra_class);
}
else {
$output .= theme_admin_menu_item($link, $data['link']['has_children'], '', $data['link']['in_active_trail'], $extra_class);
}
}
return $output ? "\n<ul>". $output .'</ul>' : '';
}
/**
* High-performance implementation of theme_menu_item_link().
*
* This saves us a theme() call and does only the absolute minimum to get
* the admin menu links rendered.
*/
function admin_menu_item_link($link) {
// Omit alias lookups.
$link['localized_options']['alias'] = TRUE;
return '<a href="'. check_url(url($link['href'], $link['localized_options'])) .'">'. (!empty($link['localized_options']['html']) ? $link['title'] : check_plain($link['title'])) .'</a>';
}
/**
* Generate the HTML output for a single menu item and submenu.
*
* @param string $link
* A rendered menu item link.
* @param bool $has_children
* Whether this item has children.
* @param string $menu
* A string containing any rendered children of this item.
* @param bool $in_active_trail
* Whether this item is in the active menu trail.
* @param string $extra_class
* An additional CSS class to set for this item.
*
* @see theme_menu_item()
* @ingroup themeable
*/
function theme_admin_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
$class = ($menu || $has_children ? 'expandable' : '');
if (!empty($extra_class)) {
$class .= ' '. $extra_class;
}
if ($in_active_trail) {
$class .= ' active-trail';
}
return '<li'. (!empty($class) ? ' class="'. $class .'"' : '') .'>'. $link . $menu .'</li>';
}
/**
* Implementation of hook_form_[form_id]_alter().
*
* Extends Devel module with Administration Menu developer settings.
*/
function admin_menu_form_devel_admin_settings_alter(&$form, $form_state) {
module_load_include('inc', 'admin_menu');
_admin_menu_devel_settings_form_alter($form, $form_state);
}
/**
* Implementation of hook_enable().
*/
function admin_menu_enable() {
admin_menu_rebuild_links(TRUE);
}
/**
* Implementation of hook_menu_alter().
*/
function admin_menu_menu_alter() {
admin_menu_rebuild_links(TRUE);
}
function admin_menu_rebuild_links($new_value = NULL) {
static $rebuild = FALSE;
if (isset($new_value)) {
$rebuild = $new_value;
}
return $rebuild;
}
/**
* Implementation of hook_translated_menu_link_alter().
*
* Here is where we make changes to links that need dynamic information such
* as the current page path or the number of users.
*/
function admin_menu_translated_menu_link_alter(&$item, $map) {
global $user, $base_url;
static $access_all;
if (!isset($access_all)) {
// We only ever do this for development
$access_all = variable_get('admin_menu_show_all', 0) && module_exists('devel');
}
if ($item['menu_name'] != 'admin_menu') {
return;
}
if ($access_all && !$item['access']) {
$item['access'] = TRUE;
// Prepare for http://drupal.org/node/266596
if (!isset($item['localized_options'])) {
_menu_item_localize($item, $map, TRUE);
}
}
// We defined 'Run updates' as external link; apply proper base path now.
if ($item['link_path'] == 'update.php') {
$item['title'] = $item['link_title'];
$item['access'] = ($user->uid == 1 || !empty($GLOBALS['update_free_access']));
$item['href'] = base_path() . $item['href'];
_menu_item_localize($item, $map, TRUE);
return;
}
// Don't waste cycles altering items that are not visible
if (!$item['access']) {
return;
}
if ($item['link_path'] == 'http://drupal.org' && !user_access('display drupal links')) {
$item['access'] = FALSE;
return;
}
// Fix destination query strings
if (isset($item['localized_options']['query'])) {
if ($item['localized_options']['query'] == 'destination') {
// URL token protects the link against CSRF attacks.
$item['localized_options']['query'] = drupal_get_destination() . '&token=' . drupal_get_token($item['link_path']);
}
}
if ($extra = variable_get('admin_menu_display', 0)) {
$item['title'] .= ' '. $extra[0] .': '. $item[$extra];
}
// Handle items that need dynamic localization/replacement.
if (isset($item['options']['t'])) {
$item['title'] = t($item['title'], $item['options']['t'] + array('@username' => $user->name));
}
if ($item['title'] == 'icon_users') {
// Add count of active anonymous/authenticated users.
// @see user_block(), user.module
$interval = time() - variable_get('user_block_seconds_online', 900);
$count_anon = sess_count($interval);
$count_auth = db_result(db_query("SELECT COUNT(DISTINCT uid) FROM {sessions} WHERE uid > 0 AND timestamp >= %d", $interval));
$icon_users = '<img src="'. base_path() . drupal_get_path('module', 'admin_menu') .'/images/icon_users.png" width="16" height="15" alt="@title" title="@title" />';
$title = array('@title' => t('Current anonymous / authenticated users'));
$icon_users = strtr($icon_users, $title);
$item['title'] = t('@count-anon / @count-auth !icon', array('@count-anon' => $count_anon, '@count-auth' => $count_auth, '!icon' => $icon_users));
if (user_access('administer users')) {
$item['href'] = 'admin/user/user';
}
}
}
/**
* Render an icon to display in the Administration Menu.
*
* @ingroup themeable
*/
function theme_admin_menu_icon() {
return '<img class="admin-menu-icon" src="'. (theme_get_setting('toggle_favicon') ? theme_get_setting('favicon') : base_path() .'misc/favicon.ico') .'" width="16" height="16" alt="'. t('Home') .'" />';
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View file

@ -0,0 +1,156 @@
<?php
/**
* @file
* Administration menu functionality tests.
*
* Note: When using $this->assertPattern(), be sure to use the 's' modifier for
* the PCRE pattern, since admin menu's output spans over multiple lines.
*/
/**
* Test menu links depending on user permissions.
*/
class AdminMenuPermissionsTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Menu link permissions'),
'description' => t('Verify that menu is displayed according to user permissions.'),
'group' => t('Administration menu'),
);
}
function setUp() {
parent::setUp('admin_menu');
admin_menu_exit();
}
/**
* Test that the links are added to the page (no JS testing).
*/
function testPermissions() {
// Anonymous users should not see the menu.
$this->assertNoRaw('<div id="admin-menu"', t('Admin menu not displayed to anonymous.'));
// Create a new user who can access administration menu, but without the
// permission 'display drupal links'.
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'administer nodes', 'access administration menu'));
$this->drupalLogin($admin_user);
// Check that the user can see the admin links, but not the drupal links.
$this->assertRaw('<div id="admin-menu"', t('Administration menu is displayed.'));
$this->drupalGet('node');
$this->assertPattern('@<div id="admin-menu".*admin/content/node@s', t('Administer content link found.'));
$this->assertNoPattern('@<div id="admin-menu".*http://drupal.org@s', t('Drupal links not found.'));
$this->assertNoPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link not found.'));
// Create a new user with the permission 'display drupal links'.
$admin_user2 = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'administer nodes', 'access administration menu', 'display drupal links'));
$this->drupalLogin($admin_user2);
$this->drupalGet('node');
$this->assertPattern('@<div id="admin-menu".*http://drupal.org@s', t('Drupal links found.'));
$this->assertNoPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link not found.'));
}
}
/**
* Test menu links depending on installed modules.
*/
class AdminMenuModulesTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Module menu links'),
'description' => t('Verify that menu contains links according to enabled modules.'),
'group' => t('Administration menu'),
);
}
function setUp() {
parent::setUp('admin_menu', 'contact');
admin_menu_exit();
}
/**
* Test that the links are added to the page (no JS testing).
*/
function testContactModuleLinks() {
// Create a new user without 'administer site-wide contact form' permission.
$admin_user = $this->drupalCreateUser(array('access administration pages', 'access administration menu'));
$this->drupalLogin($admin_user);
// Verify that proper links are displayed.
$this->assertRaw('<div id="admin-menu"', t('Administration menu is displayed.'));
$this->drupalGet('node');
$this->assertNoPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link not found.'));
// Create a new user with 'administer site-wide contact form' permission.
$admin_user = $this->drupalCreateUser(array('access administration pages', 'access administration menu', 'administer site-wide contact form'));
$this->drupalLogin($admin_user);
// Verify that proper links are displayed.
$this->drupalGet('node');
$this->assertPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link found.'));
}
}
/**
* Test contained links in administration menu.
*/
class AdminMenuLinksTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Menu links'),
'description' => t('Verify that menu contains proper links.'),
'group' => t('Administration menu'),
);
}
function setUp() {
parent::setUp('admin_menu');
admin_menu_exit();
// Create and log in a full-blown administrative user.
$permissions = module_invoke_all('perm');
$admin_user = $this->drupalCreateUser($permissions);
$this->admin_user = $this->drupalLogin($admin_user);
}
/**
* Test link contents.
*/
function testLinkContents() {
// Create a content-type with special characters.
$info = array(
'type' => 'special',
'name' => 'Cool & Special',
'module' => 'node',
'description' => '',
);
$info = (object)_node_type_set_defaults($info);
node_type_save($info);
$this->drupalPost('admin/settings/performance', array(), t('Clear cached data'));
// Fetch a page.
$this->drupalGet('node');
$this->assertRaw('<div id="admin-menu"', t('Administration menu is displayed.'));
// Verify that proper links are displayed.
// We are explicitly NOT using t() here, since the purpose is to test our
// custom link titles and 't' option.
$links = array(
url('admin/content/node-type/page') => strtr('Edit !content-type', array('!content-type' => t('Page'))),
url('admin/content/node-type/special') => strtr('Edit !content-type', array('!content-type' => t('Cool & Special'))),
);
foreach ($links as $url => $title) {
$this->assertFieldByXPath('//div[@id="admin-menu"]//a[@href="' . $url . '"]', $title, t('!link-title content-type link found.', array('!link-title' => $title)));
}
$links = array(
url('node/add/page') => t('Page'),
url('node/add/special') => t('Cool & Special'),
);
foreach ($links as $url => $title) {
$this->assertFieldByXPath('//div[@id="admin-menu"]//a[@href="' . $url . '"]', $title, t('Create content &raquo; !link-title link found.', array('!link-title' => $title)));
}
}
}