Browse Source

redo of update. automated broke git merge, somehow.

master
Bèr Kessels 11 years ago
parent
commit
195b40ca1d
100 changed files with 7671 additions and 1744 deletions
  1. 63
    12
      sites/all/modules/admin_menu/CHANGELOG.txt
  2. 41
    16
      sites/all/modules/admin_menu/admin_menu-rtl.css
  3. 51
    0
      sites/all/modules/admin_menu/admin_menu.api.php
  4. 47
    0
      sites/all/modules/admin_menu/admin_menu.color.css
  5. 134
    39
      sites/all/modules/admin_menu/admin_menu.css
  6. 232
    335
      sites/all/modules/admin_menu/admin_menu.inc
  7. 10
    4
      sites/all/modules/admin_menu/admin_menu.info
  8. 81
    6
      sites/all/modules/admin_menu/admin_menu.install
  9. 164
    22
      sites/all/modules/admin_menu/admin_menu.js
  10. 566
    150
      sites/all/modules/admin_menu/admin_menu.module
  11. 10
    0
      sites/all/modules/admin_menu/admin_menu.uid1.css
  12. 107
    0
      sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css
  13. 13
    0
      sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info
  14. 33
    0
      sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.js
  15. 77
    0
      sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
  16. 14
    0
      sites/all/modules/admin_menu/admin_views/admin_views.info
  17. 17
    0
      sites/all/modules/admin_menu/admin_views/admin_views.install
  18. 56
    0
      sites/all/modules/admin_menu/admin_views/admin_views.module
  19. 239
    0
      sites/all/modules/admin_menu/admin_views/views_default/admin_content_comment.inc
  20. 311
    0
      sites/all/modules/admin_menu/admin_views/views_default/admin_content_node.inc
  21. 225
    0
      sites/all/modules/admin_menu/admin_views/views_default/admin_content_taxonomy.inc
  22. 332
    0
      sites/all/modules/admin_menu/admin_views/views_default/admin_user_user.inc
  23. BIN
      sites/all/modules/admin_menu/images/bkg-red.png
  24. BIN
      sites/all/modules/admin_menu/images/icon_users.png
  25. 18
    12
      sites/all/modules/admin_menu/tests/admin_menu.test
  26. 67
    79
      sites/all/modules/admin_menu/translations/da.po
  27. 1
    1
      sites/all/modules/admin_menu/translations/ja.po
  28. 176
    0
      sites/all/modules/admin_menu/translations/ms.po
  29. 69
    71
      sites/all/modules/admin_menu/translations/sv.po
  30. 54
    549
      sites/all/modules/cck/CHANGELOG.txt
  31. 3
    3
      sites/all/modules/cck/content.info
  32. 1
    1
      sites/all/modules/cck/content.install
  33. 100
    36
      sites/all/modules/cck/content.module
  34. BIN
      sites/all/modules/cck/images/remove.png
  35. 1
    1
      sites/all/modules/cck/includes/content.admin.inc
  36. 1
    1
      sites/all/modules/cck/includes/content.crud.inc
  37. 1
    1
      sites/all/modules/cck/includes/content.diff.inc
  38. 157
    15
      sites/all/modules/cck/includes/content.node_form.inc
  39. 1
    1
      sites/all/modules/cck/includes/panels/content_types/content_field.inc
  40. 51
    0
      sites/all/modules/cck/includes/panels/content_types/translations/includes-panels-content_types.de.po
  41. 557
    0
      sites/all/modules/cck/includes/translations/includes.de.po
  42. 1
    1
      sites/all/modules/cck/includes/views/content.views.inc
  43. 1
    1
      sites/all/modules/cck/includes/views/content.views_convert.inc
  44. 8
    6
      sites/all/modules/cck/includes/views/handlers/content_handler_field.inc
  45. 12
    7
      sites/all/modules/cck/includes/views/handlers/content_handler_field_multiple.inc
  46. 1
    1
      sites/all/modules/cck/includes/views/handlers/content_handler_filter_many_to_one.inc
  47. 1
    1
      sites/all/modules/cck/includes/views/handlers/content_plugin_display_simple.inc
  48. 1
    1
      sites/all/modules/cck/includes/views/handlers/content_plugin_style_php_array_ac.inc
  49. 89
    0
      sites/all/modules/cck/includes/views/handlers/translations/includes-views-handlers.de.po
  50. 51
    0
      sites/all/modules/cck/includes/views/translations/includes-views.de.po
  51. 80
    0
      sites/all/modules/cck/js/content.admin.js
  52. 255
    0
      sites/all/modules/cck/js/content.node_form.js
  53. 41
    0
      sites/all/modules/cck/js/translations/de.po
  54. 3
    3
      sites/all/modules/cck/modules/content_copy/content_copy.info
  55. 2
    2
      sites/all/modules/cck/modules/content_copy/content_copy.module
  56. 5
    6
      sites/all/modules/cck/modules/content_copy/translations/modules-content_copy.de.po
  57. 2
    2
      sites/all/modules/cck/modules/content_copy/translations/modules-content_copy.pot
  58. 99
    3
      sites/all/modules/cck/modules/content_multigroup/README.txt
  59. 507
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.admin.inc
  60. 42
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.css
  61. 13
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.info
  62. 47
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.install
  63. 188
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.module
  64. 936
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.node_form.inc
  65. 237
    0
      sites/all/modules/cck/modules/content_multigroup/content_multigroup.node_view.inc
  66. 175
    0
      sites/all/modules/cck/modules/content_multigroup/panels/content_types/content_multigroup.inc
  67. BIN
      sites/all/modules/cck/modules/content_multigroup/panels/content_types/icon_cck_field_group.png
  68. 51
    0
      sites/all/modules/cck/modules/content_multigroup/panels/content_types/translations/de.po
  69. 128
    0
      sites/all/modules/cck/modules/content_multigroup/translations/modules-content_multigroup.de.po
  70. 95
    0
      sites/all/modules/cck/modules/content_multigroup/views/content_multigroup.views.inc
  71. 100
    0
      sites/all/modules/cck/modules/content_multigroup/views/handlers/content_multigroup_handler_filter.inc
  72. 33
    0
      sites/all/modules/cck/modules/content_multigroup/views/handlers/translations/modules-content_multigroup-views-handlers
  73. 33
    0
      sites/all/modules/cck/modules/content_multigroup/views/translations/modules-content_multigroup-views.de.po
  74. 3
    3
      sites/all/modules/cck/modules/content_permissions/content_permissions.info
  75. 1
    1
      sites/all/modules/cck/modules/content_permissions/content_permissions.module
  76. 22
    39
      sites/all/modules/cck/modules/content_permissions/translations/modules-content_permissions.de.po
  77. 2
    2
      sites/all/modules/cck/modules/content_permissions/translations/modules-content_permissions.pot
  78. 3
    3
      sites/all/modules/cck/modules/fieldgroup/fieldgroup.info
  79. 1
    1
      sites/all/modules/cck/modules/fieldgroup/fieldgroup.module
  80. 1
    1
      sites/all/modules/cck/modules/fieldgroup/panels/content_types/content_fieldgroup.inc
  81. 75
    0
      sites/all/modules/cck/modules/fieldgroup/panels/content_types/translations/modules-fieldgroup-panels-content_types.de.
  82. 33
    58
      sites/all/modules/cck/modules/fieldgroup/translations/modules-fieldgroup.de.po
  83. 34
    30
      sites/all/modules/cck/modules/fieldgroup/translations/modules-fieldgroup.pot
  84. 3
    3
      sites/all/modules/cck/modules/nodereference/nodereference.info
  85. 1
    1
      sites/all/modules/cck/modules/nodereference/nodereference.install
  86. 1
    1
      sites/all/modules/cck/modules/nodereference/nodereference.module
  87. 1
    1
      sites/all/modules/cck/modules/nodereference/panels/relationships/node_from_noderef.inc
  88. 31
    0
      sites/all/modules/cck/modules/nodereference/panels/relationships/translations/modules-nodereference-panels-relationshi
  89. 26
    48
      sites/all/modules/cck/modules/nodereference/translations/modules-nodereference.de.po
  90. 17
    17
      sites/all/modules/cck/modules/nodereference/translations/modules-nodereference.pot
  91. 3
    3
      sites/all/modules/cck/modules/number/number.info
  92. 1
    1
      sites/all/modules/cck/modules/number/number.module
  93. 42
    64
      sites/all/modules/cck/modules/number/translations/modules-number.de.po
  94. 27
    27
      sites/all/modules/cck/modules/number/translations/modules-number.pot
  95. 3
    3
      sites/all/modules/cck/modules/optionwidgets/optionwidgets.info
  96. 1
    1
      sites/all/modules/cck/modules/optionwidgets/optionwidgets.module
  97. 13
    39
      sites/all/modules/cck/modules/optionwidgets/translations/modules-optionwidgets.de.po
  98. 1
    1
      sites/all/modules/cck/modules/optionwidgets/translations/modules-optionwidgets.nl.po
  99. 7
    7
      sites/all/modules/cck/modules/optionwidgets/translations/modules-optionwidgets.pot
  100. 0
    0
      sites/all/modules/cck/modules/optionwidgets/translations/modules-optionwidgets.sv.po

+ 63
- 12
sites/all/modules/admin_menu/CHANGELOG.txt View File

@@ -1,27 +1,80 @@
// $Id: CHANGELOG.txt,v 1.33.2.58 2009/07/02 12:10:37 sun Exp $
// $Id: CHANGELOG.txt,v 1.33.2.48.2.56 2009/08/16 22:38:24 sun Exp $

Admin Menu x.x-x.x, xxxx-xx-xx
------------------------------


Admin Menu 6.x-1.x, xxxx-xx-xx
Admin Menu 6.x-3.x, xxxx-xx-xx
------------------------------


Admin Menu 6.x-1.5, 2009-07-02
------------------------------
Admin Menu 6.x-3.0-ALPHA3, 2009-08-16
-------------------------------------
#502500 by sun: Added "Create content" menu.
#538714 by sun: Fixed wrong re-parenting in Drupal's menu system.
#550132 by sun: Fixed (temporarily) admin_views menu items.
by sun: Added Administration views sub-module, converting all administrative
listing pages in Drupal core into real, ajaxified, and alterable views.
#547206 by sun: Fixed menu link descriptions lead to mouseover clashes.
#540954 by Rob Loach: Added String Overrides to list of developer modules.
#540762 by Deslack: Added Malay translation.


Admin Menu 6.x-3.0-ALPHA2, 2009-08-02
-------------------------------------
#527908 by sun: Changed theme_admin_menu_links() to use $element['#children'].
#527908 by markus_petrux, sun: Changed admin menu into a renderable array.
#420812 by sun, smk-ka: Added support for hook_js().
by sun: Fixed destination query string of current page not applied to links.
by sun: Changed Drupal.admin.attachBehaviors() to accept local JS settings.
#276751 by sun: Revamped rendering of menu additions/widgets.
#500866 by sun: Updated for removed t() from getInfo() in tests.
#402058 by sun: Added Administration menu toolbar module.
by markus_petrux, sun: Added API documentation.
#461264 by sun: Added site/domain as CSS class.
#451270 by smk-ka, sun: Changed visual indication for uid1.
by sun: Minor code clean-up.
#490670 by sun: Fixed missing menu after installation/upgrade.
#515718 by joelstein, sun: Added rules_admin module to developer modules list.
#352065 by sun: Added setting to select developer modules to keep enabled.
#511854 by psynaptic: Fixed logout link.
#424960 by markus_petrux, sun: Fixed gzip compression for cached output.
by sun: Fixed opacity of links in sub-menus.
#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.
#495148 by sun: Fixed MENU_NORMAL_ITEMs do not appear in administration menu.
by sun: Fixed tests for new content-type locations.
#345984 by markus_petrux, sun: Fixed old menu links not removed on upgrade.
#276751 by sun: Major rewrite. Fixed menu items cannot be moved, altered, or
added as well as various performance issues.
by sun: Added variable to allow to disable caching (rewrite).


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.
Admin Menu 6.x-3.0-ALPHA1, 2009-06-10
-------------------------------------
#236657 by sun: Updated for corrected arguments of system_clear_cache_submit().
#483870 by sun: Fixed compatibility with new Admin module.
#483152 by sun: Fixed admin_menu caches not flushed when clean URLs are toggled.
#479922 by danep: Fixed fieldsets not collapsed on admin/build/modules/list.
#469716 by sun: Fixed wrong AJAX callback URL under various conditions.
#471504 by wulff: Updated Danish translation.
by sun: Fixed admin_menu_suppress() does not suppress margin-top.
#451270 by sun: Added visual indication when working as uid 1.
by Dave Reid: Updated for getInfo() in tests.
#420828 by sun: Added dynamic replacements for cached administration menu.
#420840 by sun: Fixed Drupal.behaviors.adminMenu must be only executed once.
#345984 by markus_petrux, sun: Added client-side caching of administration menu.
Attention: A new era of Drupal user experience starts here. This is the very
first issue of a series of improvements targeting plain awesomeness.
#349169 by sun: Fixed Devel switch user links contain multiple path prefixes.
#345984 by sun: Code clean-up in preparation for client-side caching.
#415196 by psynaptic: Updated for CSS coding standards.
#406672 by mr.j, sun: Fixed "Move local tasks" option leaves stale UL.
by sun: Major code clean-up and sync across 3.x branches.
#349505 by smk-ka, sun: Performance: Added caching of entire menu output.
#315342 by wulff: Added "My account" link (by splitting the "Log out" item).
#384100 by kepol, sun: Fixed content-type items displayed in wrong place.
#373339 by sun: Fixed double-escaped 'Edit <content-type>' link titles.
#373372 by sun: Turned procedural JavaScript into admin menu behaviors.
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.
@@ -221,5 +274,3 @@ 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.



+ 41
- 16
sites/all/modules/admin_menu/admin_menu-rtl.css View File

@@ -1,26 +1,51 @@
/* $Id: admin_menu-rtl.css,v 1.1.2.3 2008/10/29 20:02:01 sun Exp $ */
/* $Id: admin_menu-rtl.css,v 1.1.2.3.2.2 2009/03/27 04:22:45 sun Exp $ */

#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; }
#admin-menu {
direction: rtl;
text-align: right;
}
#admin-menu li.admin-menu-action {
float: left;
}
#admin-menu li.admin-menu-action a {
border-left: none;
border-right: 1px solid #323232;
}

/* all lists */
#admin-menu ul a { border-left: 1px solid #323232; border-right: 0; padding: 4px 8px; text-align: right; }
/* 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; }
/* All list items */
#admin-menu li {
float: right;
position: relative;
}
#admin-menu li li {
position: static;
}

/* third-and-above-level lists */
#admin-menu li li.expandable ul { margin: -20px 160px 0 0; }
/* Second-level lists */
#admin-menu li ul {
right: 0;
}

/* Third-and-above-level lists */
#admin-menu li li.expandable ul {
margin: -20px 160px 0 0;
}

/* Lists nested under hovered list items */
#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; }

/* Second-and-more-level hovering */
#admin-menu li li.expandable {
background: #45454A url(images/arrow-rtl.png) no-repeat 5px 7px;
}

+ 51
- 0
sites/all/modules/admin_menu/admin_menu.api.php View File

@@ -0,0 +1,51 @@
<?php
// $Id: admin_menu.api.php,v 1.1.2.3 2009/07/22 20:33:17 sun Exp $

/**
* @file
* API documentation for Administration menu.
*/

/**
* Alter content in Administration menu bar before it is rendered.
*
* @param $content
* A structured array suitable for drupal_render(), at the very least
* containing the keys 'menu' and 'links'. Most implementations likely want
* to alter or add to 'links'.
*
* $content['menu'] contains the HTML representation of the 'admin_menu' menu
* tree.
* @see admin_menu_menu_alter()
*
* $content['links'] contains additional top-level links in the Administration
* menu, such as the icon menu or the logout link. You can add more items here
* or play with the #weight attribute to customize them.
* @see theme_admin_menu_links()
* @see admin_menu_links_icon()
* @see admin_menu_links_user()
*/
function hook_admin_menu_output_alter(&$content) {
// Add new top-level item.
$content['links']['myitem'] = array(
'#title' => t('My item'),
// #attributes are used for list items (LI). Note the special syntax for
// the 'class' attribute.
'#attributes' => array('class' => array('mymodule-myitem')),
'#href' => 'mymodule/path',
// #options are passed to l(). Note that you can apply 'attributes' for
// links (A) here.
'#options' => array(
'query' => drupal_get_destination(),
),
// #weight controls the order of links in the resulting item list.
'#weight' => 50,
);
// Add link to manually run cron.
$content['links']['myitem']['cron'] = array(
'#title' => t('Run cron'),
'#access' => user_access('administer site configuration'),
'#href' => 'admin/reports/status/run-cron',
);
}


+ 47
- 0
sites/all/modules/admin_menu/admin_menu.color.css View File

@@ -0,0 +1,47 @@
/* $Id: admin_menu.color.css,v 1.1.2.2 2009/05/07 00:34:40 sun Exp $ */

/**
* @file
* Administration menu color override.
*/

#admin-menu {
background-color: #911;
background-image: url(images/bkg-red.png);
}
#admin-menu li.admin-menu-action a {
border-left-color: #a91f1f;
}

/* All lists */
#admin-menu ul a {
border-right-color: #a91f1f;
}
#admin-menu ul li.admin-menu-tab a {
border-right-color: #52565E;
}
#admin-menu li li a {
border-top-color: #801f1f;
}

/* All list items */
#admin-menu li li {
background-color: #991f1f;
}

/* Second-and-more-level hovering */
#admin-menu li li.expandable {
background-color: #b93f3f;
}
#admin-menu li li:hover,
#admin-menu li li.iehover {
background-color: #690f0f;
}
#admin-menu li li.expandable:hover a,
#admin-menu li li.expandable:hover li.expandable:hover a {
border-color: #801f1f;
}
#admin-menu li li.expandable:hover li a,
#admin-menu li li.expandable:hover li.expandable:hover li a {
border-color: #801f1f;
}

+ 134
- 39
sites/all/modules/admin_menu/admin_menu.css View File

@@ -1,38 +1,122 @@
/* $Id: admin_menu.css,v 1.25.2.4 2008/11/02 21:36:22 sun Exp $ */
/* $Id: admin_menu.css,v 1.25.2.4.2.5 2009/07/22 20:33:17 sun Exp $ */

/**
* Administration Menu.
* @file
* 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; }
*/

#admin-menu {
background: #101010 url(images/bkg.png) bottom left repeat-x;
font-size: 9px;
font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
left: 0;
position: absolute;
text-align: left;
top: 0;
width: 100%;
}
#admin-menu-wrapper {
overflow: hidden;
}
#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 a {
background: transparent url(images/icon_users.png) 90% center no-repeat;
padding-right: 22px;
}
#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 lists */
#admin-menu,
#admin-menu ul {
line-height: 1.4em;
list-style: none;
margin: 0;
padding: 0;
z-index: 999;
}
#admin-menu ul {
position: static;
}
#admin-menu ul a {
border-bottom: none;
border-right: 1px solid #323232;
color: #EEE;
display: block;
font-weight: normal;
padding: 4px 8px;
text-align: left;
text-decoration: none;
}
#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; }
/* All list items */
#admin-menu li {
background-image: none;
float: left;
height: 100%;
list-style-image: none;
list-style-type: none;
margin: 0 !important;
padding: 0;
}
#admin-menu li.admin-menu-tab {
background: url(images/bkg_tab.png) repeat-x left bottom;
padding-bottom: 1px;
}
#admin-menu li li {
background: #202020;
filter: Alpha(opacity=88);
opacity: 0.88;
width: 160px; /* Required for Opera */
}
#admin-menu li li li {
filter: Alpha(opacity=100);
opacity: 1;
}

/* 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; }
/* Second-level lists */
/* Note: We must hide sub-lists or scrollbars might appear (display: none is not read by screen readers). */
#admin-menu li ul {
background: none;
display: none;
left: -999em;
line-height: 1.2em;
margin: 0;
position: absolute;
width: 160px;
}

/* third-and-above-level lists */
#admin-menu li li.expandable ul { margin: -20px 0 0 160px; }
/* 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,
@@ -42,11 +126,11 @@ body.admin-menu { margin-top: 20px !important; }
#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;
left: -999em;
}

/* lists nested under hovered list items */
/* Lists nested under hovered list items */
#admin-menu li:hover ul,
#admin-menu li li:hover ul,
#admin-menu li li li:hover ul,
@@ -57,15 +141,17 @@ body.admin-menu { margin-top: 20px !important; }
#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;
left: auto;
}
#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; }
/* 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;
@@ -73,11 +159,12 @@ body.admin-menu { margin-top: 20px !important; }
#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;
color: #FFF;
}
#admin-menu li li.expandable:hover a,
#admin-menu li li.expandable:hover li.expandable:hover a {
border-color: #666666; color: #eee;
border-color: #666666;
color: #EEE;
}
#admin-menu li li.expandable:hover li a,
#admin-menu li li.expandable:hover li.expandable:hover li a {
@@ -86,18 +173,26 @@ body.admin-menu { margin-top: 20px !important; }
#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;
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 */
color: #FFF;
width: 90%; /* IE */
}

/* #210615: Mozilla on Mac fix */
html.js fieldset.collapsible div.fieldset-wrapper { overflow: visible; }
html.js fieldset.collapsible div.fieldset-wrapper {
overflow: visible;
}

/* Hide the menu on print output. */
@media print {
#admin-menu { display: none; }
body.admin-menu { margin-top: 0 !important; }
#admin-menu {
display: none !important;
}
body.admin-menu {
margin-top: 0 !important;
}
}

+ 232
- 335
sites/all/modules/admin_menu/admin_menu.inc View File

@@ -1,355 +1,209 @@
<?php
// $Id: admin_menu.inc,v 1.11.2.25 2009/06/09 18:21:29 sun Exp $
// $Id: admin_menu.inc,v 1.11.2.20.2.23 2009/08/14 12:19:10 sun Exp $

/**
* The key function that builds the menu links whenever there is a menu rebuild.
* @file
* Menu builder functions for Administration menu.
*/
function _admin_menu_rebuild_links() {
// Get the newly rebuilt menu.
$menu = menu_router_build();
// 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 = module_invoke_all('admin_menu', $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' => $item['title'],
'link_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.
* Build the administration menu as renderable menu links.
*
* @param $tree
* A data structure representing the administration menu tree as returned from
* menu_tree_all_data().
*
* @return
* The complete administration menu, suitable for theme_admin_menu_links().
*
* @see theme_admin_menu_links()
* @see admin_menu_menu_alter()
*/
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;
function admin_menu_links_menu($tree) {
$links = array();
foreach ($tree as $data) {
// Skip menu callbacks (mostly dynamic items).
if (isset($data['link']['type']) && $data['link']['type'] == MENU_CALLBACK) {
continue;
}
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;
}
// Omit alias lookups.
$data['link']['localized_options']['alias'] = TRUE;
// Remove description to prevent mouseover tooltip clashes.
unset($data['link']['localized_options']['attributes']['title']);

$links[$data['link']['mlid']] = array(
'#title' => $data['link']['title'],
'#href' => $data['link']['href'],
'#options' => $data['link']['localized_options'],
'#weight' => $data['link']['weight'],
);
if ($data['below']) {
$links[$data['link']['mlid']] += admin_menu_links_menu($data['below']);
}
}

menu_link_save($item);
return $links;
}

/**
* Implementation of hook_admin_menu().
* Build icon menu links; mostly containing maintenance helpers.
*
* @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.
* @see theme_admin_menu_links()
*/
function admin_menu_admin_menu(&$deleted) {
$links = array();
$icon_path = '<front>';
function admin_menu_links_icon() {
$destination = drupal_get_destination();

$links = array(
'#theme' => 'admin_menu_links',
'#weight' => -100,
);
$links['icon'] = array(
'#title' => theme('admin_menu_icon'),
'#attributes' => array('class' => array('admin-menu-icon')),
'#href' => '<front>',
'#options' => array(
'html' => TRUE,
),
);
// Add link to manually run cron.
$links[] = array(
'title' => 'Run cron',
'path' => 'admin/reports/status/run-cron',
'weight' => 50,
'parent_path' => $icon_path,
$links['icon']['cron'] = array(
'#title' => t('Run cron'),
'#weight' => 50,
'#access' => user_access('administer site configuration'),
'#href' => 'admin/reports/status/run-cron',
);
// Add link to run update.php.
$links[] = array(
'title' => 'Run updates',
'path' => 'update.php',
'weight' => 50,
'parent_path' => $icon_path,
'options' => array('external' => TRUE),
$links['icon']['update'] = array(
'#title' => t('Run updates'),
'#weight' => 50,
'#access' => ($GLOBALS['user']->uid == 1 || !empty($GLOBALS['update_free_access'])),
'#href' => base_path() . 'update.php',
'#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,
$links['icon']['drupal.org'] = array(
'#title' => 'Drupal.org',
'#weight' => 100,
'#access' => user_access('display drupal links'),
'#href' => 'http://drupal.org',
);
// 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']])))) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
if (!isset($info['project']) || isset($links['icon']['drupal.org'][$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',
$links['icon']['drupal.org'][$info['project']] = array(
'#title' => t('@project issue queue', array('@project' => $info['name'])),
'#weight' => ($info['project'] == 'drupal' ? -10 : 0),
'#href' => 'http://drupal.org/project/issues/' . $info['project'],
'#options' => array(
'query' => 'version=' . (isset($info['core']) ? $info['core'] : 'All'),
),
);
}

// 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,
// Add items to flush caches.
$links['icon']['flush-cache'] = array(
'#title' => t('Flush all caches'),
'#weight' => 20,
// @todo Add permission to flush cashes.
'#access' => user_access('administer site configuration'),
'#href' => 'admin_menu/flush-cache',
'#options' => array(
'query' => $destination,
),
);
$caches = array(
'admin_menu' => 'Administration menu',
'cache' => 'Cache tables',
'menu' => 'Menu',
'requisites' => 'Page requisites',
'theme' => 'Theme registry',
'admin_menu' => t('Administration menu'),
'cache' => t('Cache tables'),
'menu' => t('Menu'),
'requisites' => t('Page requisites'),
'theme' => t('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',
foreach ($caches as $arg => $title) {
$links['icon']['flush-cache'][$arg] = array(
'#title' => $title,
'#href' => 'admin_menu/flush-cache/' . $arg,
'#options' => array(
'query' => $destination,
),
);
}
// Add link to toggle developer modules (performance).
$saved_state = variable_get('admin_menu_devel_modules_enabled', NULL);
$links['icon']['toggle-modules'] = array(
'#title' => isset($saved_state) ? t('Enable developer modules') : t('Disable developer modules'),
'#weight' => 88,
'#access' => user_access('administer site configuration'),
'#href' => 'admin_menu/toggle-modules',
'#options' => array(
'query' => $destination,
),
);

// Add devel module links
// 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,
$links['icon']['devel-variables'] = array(
'#title' => t('Variable editor'),
'#weight' => 20,
'#access' => user_access('access devel information'),
'#href' => 'devel/variable',
);
// 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.
* Build user/action links; mostly account information and links.
*
* @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.
* @see theme_admin_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),
function admin_menu_links_user() {
$links = array(
'#theme' => 'admin_menu_links',
'#weight' => 100,
);
// 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),
// Add link to show current authenticated/anonymous users.
$links['user-counter'] = array(
'#title' => admin_menu_get_user_count(),
'#description' => t('Current anonymous / authenticated users'),
'#weight' => -90,
'#attributes' => array('class' => array('admin-menu-action', 'admin-menu-users')),
'#href' => (user_access('administer users') ? 'admin/user/user' : 'user'),
);
$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()),
$links['account'] = array(
'#title' => $GLOBALS['user']->name,
'#weight' => -99,
'#attributes' => array('class' => array('admin-menu-action', 'admin-menu-account')),
'#href' => 'user/' . $GLOBALS['user']->uid,
);
foreach ($links as $item) {
$path = $item['path'];
$item = admin_menu_link_build($item);
$menu_links[$path] = $item;
$sort[$path] = 1;
$links['logout'] = array(
'#title' => 'Log out',
'#weight' => -100,
'#attributes' => array('class' => array('admin-menu-action')),
'#href' => 'logout',
);

// Add Devel module links.
if (module_exists('devel')) {
// Add switch user links.
foreach (module_invoke('devel', 'switch_user_list') as $link) {
$links['account'][$link['title']] = array(
'#title' => $link['title'],
'#description' => $link['attributes']['title'],
'#href' => $link['href'],
'#options' => array(
'query' => $link['query'],
'html' => !empty($link['html']),
),
);
}
}

return $deleted;
return $links;
}

/**
@@ -379,7 +233,7 @@ function admin_menu_theme_settings() {
'#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_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',
@@ -387,35 +241,37 @@ function admin_menu_theme_settings() {
'#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;
}
// Fetch all available modules manually, since module_list() only returns
// currently enabled modules, which makes this setting pointless if developer
// modules are currently disabled.
$all_modules = array();
$result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' ORDER BY name ASC");
while ($module = db_fetch_object($result)) {
if (file_exists($module->filename)) {
$all_modules[$module->name] = $module->name;
}
}
$devel_modules = variable_get('admin_menu_devel_modules', _admin_menu_developer_modules());
$devel_modules = array_intersect($all_modules, $devel_modules);
$form['tweaks']['admin_menu_devel_modules_skip'] = array(
'#type' => 'checkboxes',
'#title' => t('Developer modules to keep enabled'),
'#default_value' => variable_get('admin_menu_devel_modules_skip', array()),
'#options' => $devel_modules,
'#access' => !empty($devel_modules),
'#description' => t('Enabled developer modules in this list will not be disabled when the link <em>Disable developer modules</em> in the menu below the icon is invoked.'),
);

/**
* 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');
variable_set('admin_menu_rebuild_links', TRUE);
return system_settings_form($form);
}

/**
* Helper function for admin_menu_form_devel_admin_settings_alter().
* Implementation of hook_form_FORM_ID_alter().
*
* Extends Devel module with Administration Menu developer settings.
* Extends Devel module with Administration menu developer settings.
*/
function _admin_menu_devel_settings_form_alter(&$form, $form_state) {
function _admin_menu_form_devel_admin_settings_alter(&$form, $form_state) {
// Shift system_settings_form buttons.
$weight = isset($form['buttons']['#weight']) ? $form['buttons']['#weight'] : 0;
$form['buttons']['#weight'] = $weight + 1;
@@ -444,10 +300,9 @@ function _admin_menu_devel_settings_form_alter(&$form, $form_state) {
}

/**
* Menu callback to enable/disable developer modules.
* Menu callback; 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.
* This can save up to 150ms on each uncached page request.
*/
function admin_menu_toggle_modules() {
$rebuild = FALSE;
@@ -461,9 +316,10 @@ function admin_menu_toggle_modules() {
}
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'));
$devel_modules = variable_get('admin_menu_devel_modules', _admin_menu_developer_modules());
// Store currently enabled modules in a variable.
$devel_modules = array_intersect(module_list(FALSE, FALSE), $devel_modules);
$devel_modules = array_diff($devel_modules, variable_get('admin_menu_devel_modules_skip', array()));
if (!empty($devel_modules)) {
variable_set('admin_menu_devel_modules_enabled', $devel_modules);
// Disable developer modules.
@@ -486,8 +342,39 @@ function admin_menu_toggle_modules() {
drupal_clear_js_cache();
// Synchronize to catch any actions that were added or removed.
actions_synchronize();
// Finally, flush admin_menu's cache.
admin_menu_flush_caches();
}
drupal_goto('');
drupal_goto(referer_uri());
}

/**
* Helper function to return a default list of developer modules.
*/
function _admin_menu_developer_modules() {
return array(
'cache_disable',
'coder',
'content_copy',
'debug',
'delete_all',
'demo',
'devel',
'devel_node_access',
'devel_themer',
'macro',
'form_controller',
'imagecache_ui',
'journal',
'rules_admin',
'stringoverrides',
'trace',
'upgrade_status',
'user_display_ui',
'util',
'views_ui',
'views_theme_wizard',
);
}

/**
@@ -499,7 +386,12 @@ function admin_menu_toggle_modules() {
function admin_menu_flush_cache($name = NULL) {
switch ($name) {
case 'admin_menu':
admin_menu_wipe();
// Flush cached menu tree.
db_query("DELETE FROM {menu_links} WHERE menu_name = 'admin_menu' AND customized = 0");
// Fall-through.

case 'menu':
menu_rebuild();
break;

case 'cache':
@@ -512,10 +404,6 @@ function admin_menu_flush_cache($name = NULL) {
}
break;

case 'menu':
module_invoke('menu', 'rebuild');
break;

case 'requisites':
// Change query-strings on css/js files to enforce reload for all users.
_drupal_flush_css_js();
@@ -539,3 +427,12 @@ function admin_menu_flush_cache($name = NULL) {
drupal_goto();
}

/**
* 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') . '" />';
}


+ 10
- 4
sites/all/modules/admin_menu/admin_menu.info View File

@@ -1,12 +1,18 @@
; $Id: admin_menu.info,v 1.5.2.1 2008/11/30 12:50:36 sun Exp $
; $Id: admin_menu.info,v 1.5.2.1.2.2 2009/07/29 15:50:51 sun Exp $
name = Administration menu
description = Provides a dropdown menu to most administrative tasks and other common destinations (to users with the proper permissions).
package = Administration

; Purposively added for feature development.
version = 6.x-3.x-dev
core = 6.x
project = admin_menu

dependencies[] = menu

; Information added by drupal.org packaging script on 2009-07-02
version = "6.x-1.5"
; Information added by drupal.org packaging script on 2009-08-16
version = "6.x-3.0-alpha3"
core = "6.x"
project = "admin_menu"
datestamp = "1246537502"
datestamp = "1250462403"


+ 81
- 6
sites/all/modules/admin_menu/admin_menu.install View File

@@ -1,22 +1,52 @@
<?php
// $Id: admin_menu.install,v 1.4.2.6 2009/01/28 19:48:41 sun Exp $
// $Id: admin_menu.install,v 1.4.2.6.2.7 2009/08/16 21:11:11 sun Exp $

/**
* Implementation of hook_schema().
*/
function admin_menu_schema() {
$schema['cache_admin_menu'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_admin_menu']['description'] = 'Cache table for Administration menu to store client-side caching hashes.';
return $schema;
}

/**
* Implementation of hook_install().
*/
function admin_menu_install() {
// Create menu.
_admin_menu_install_menu();
// Create cache table.
drupal_install_schema('admin_menu');
// Increase the module weight, so admin_menu catches any alterations made by
// other modules in hook_menu_alter().
db_query("UPDATE {system} SET weight = 100 WHERE name = 'admin_menu'");
}

/**
* 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();
// Remove cache table.
drupal_uninstall_schema('admin_menu');
// 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');
}

/**
* Helper function to ensure 'admin_menu' menu.
*/
function _admin_menu_install_menu() {
if (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'admin_menu'"))) {
return array('success' => TRUE, 'query' => 'Menu for Administration menu already exists.');
}
return update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('admin_menu', 'Administration menu', '')");
}

/**
* Ensure that admin_menu is rebuilt after upgrading to D6.
*/
@@ -24,7 +54,6 @@ 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')) {
@@ -44,3 +73,49 @@ function admin_menu_update_6001() {
return $ret;
}

/**
* Add {cache_admin_menu} table.
*/
function admin_menu_update_6300() {
$ret = array();
if (db_table_exists('cache_admin_menu')) {
return $ret;
}
$schema = drupal_get_schema_unprocessed('system', 'cache');
db_create_table($ret, 'cache_admin_menu', $schema);
return $ret;
}

/**
* Add the "admin_menu" menu.
*/
function admin_menu_update_6301() {
$ret = array();
// Delete obsolete variable.
variable_del('admin_menu_rebuild_links');
// Create menu.
$ret[] = _admin_menu_install_menu();
// Clean-up menu links from earlier versions.
db_query("DELETE FROM {menu_links} WHERE module = 'admin_menu' OR menu_name = 'admin_menu'");
return $ret;
}

/*
function admin_menu_form_update_script_selection_form_alter(&$form, $form_state) {
if ($form['start']['admin_menu']['#default_value'] <= 6301) {
drupal_set_message("<strong>BACKUP YOUR DATABASE!</strong> Administration menu's upgrade path resets and deletes all custom administrative menu items.", 'error');
}
}
*/

/**
* Increase the module weight.
*
* @see admin_menu_install()
*/
function admin_menu_update_6302() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = 100 WHERE name = 'admin_menu'");
return $ret;
}


+ 164
- 22
sites/all/modules/admin_menu/admin_menu.js View File

@@ -1,31 +1,168 @@
/* $Id: admin_menu.js,v 1.7.2.7 2009/01/24 04:59:22 sun Exp $ */
/* $Id: admin_menu.js,v 1.7.2.7.2.14 2009/07/22 20:40:22 sun Exp $ */

$(document).ready(function() {
// Apply margin-top if enabled; directly applying marginTop doesn't work in IE.
if ($('#admin-menu').size() && 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');
Drupal.admin = Drupal.admin || {};
Drupal.admin.behaviors = Drupal.admin.behaviors || {};
Drupal.admin.hashes = Drupal.admin.hashes || {};

/**
* Core behavior for Administration menu.
*
* Test whether there is an administration menu is in the output and execute all
* registered behaviors.
*/
Drupal.behaviors.adminMenu = function (context) {
// Initialize settings.
Drupal.settings.admin_menu = $.extend({
suppress: false,
margin_top: false,
position_fixed: false,
tweak_modules: false,
tweak_tabs: false,
destination: '',
basePath: Drupal.settings.basePath,
hash: 0,
replacements: {}
}, Drupal.settings.admin_menu || {});
// Check whether administration menu should be suppressed.
if (Drupal.settings.admin_menu.suppress) {
return;
}
var $adminMenu = $('#admin-menu:not(.admin-menu-processed)', context);
// Client-side caching; if administration menu is not in the output, it is
// fetched from the server and cached in the browser.
if (!$adminMenu.length && Drupal.settings.admin_menu.hash) {
Drupal.admin.getCache(Drupal.settings.admin_menu.hash, function (response) {
if (typeof response == 'string' && response.length > 0) {
$('body', context).prepend(response);
}
var $adminMenu = $('#admin-menu:not(.admin-menu-processed)', context);
// Apply our behaviors.
Drupal.admin.attachBehaviors(context, Drupal.settings, $adminMenu);
});
}
// If the menu is in the output already, this means there is a new version.
else {
// Apply our behaviors.
Drupal.admin.attachBehaviors(context, Drupal.settings, $adminMenu);
}
};

/**
* Collapse fieldsets on Modules page.
*
* For why multiple selectors see #111719.
*/
Drupal.behaviors.adminMenuCollapseModules = function (context) {
if (Drupal.settings.admin_menu.tweak_modules) {
$('#system-modules fieldset:not(.collapsed), #system-modules-1 fieldset:not(.collapsed)', context).addClass('collapsed');
}
};

/**
* Apply margin to page.
*
* Note that directly applying marginTop does not work in IE. To prevent
* flickering/jumping page content with client-side caching, this is a regular
* Drupal behavior.
*/
Drupal.behaviors.adminMenuMarginTop = function (context) {
if (!Drupal.settings.admin_menu.suppress && Drupal.settings.admin_menu.margin_top) {
$('body:not(.admin-menu)', context).addClass('admin-menu');
}
};

/**
* Retrieve content from client-side cache.
*
* @param hash
* The md5 hash of the content to retrieve.
* @param onSuccess
* A callback function invoked when the cache request was successful.
*/
Drupal.admin.getCache = function (hash, onSuccess) {
if (Drupal.admin.hashes.hash !== undefined) {
return Drupal.admin.hashes.hash;
}
$.ajax({
cache: true,
type: 'GET',
dataType: 'text', // Prevent auto-evaluation of response.
global: false, // Do not trigger global AJAX events.
url: Drupal.settings.admin_menu.basePath.replace(/admin_menu/, 'js/admin_menu/cache/' + hash),
success: onSuccess,
complete: function (XMLHttpRequest, status) {
Drupal.admin.hashes.hash = status;
}
});
}

/**
* @defgroup admin_behaviors Administration behaviors.
* @{
*/

/**
* Attach administrative behaviors.
*/
Drupal.admin.attachBehaviors = function (context, settings, $adminMenu) {
if ($adminMenu.length) {
$adminMenu.addClass('admin-menu-processed');
$.each(Drupal.admin.behaviors, function() {
this(context, settings, $adminMenu);
});
}
};

// Collapse fieldsets on Modules page. For why multiple selectors see #111719.
if (Drupal.settings.admin_menu && Drupal.settings.admin_menu.tweak_modules) {
$('#system-modules fieldset:not(.collapsed), #system-modules-1 fieldset:not(.collapsed)').addClass('collapsed');
/**
* Apply 'position: fixed'.
*/
Drupal.admin.behaviors.positionFixed = function (context, settings, $adminMenu) {
if (settings.admin_menu.position_fixed) {
$adminMenu.css('position', 'fixed');
}
};

/**
* Move page tabs into administration menu.
*/
Drupal.admin.behaviors.pageTabs = function (context, settings, $adminMenu) {
if (settings.admin_menu.tweak_tabs) {
$('ul.tabs.primary li', context).addClass('admin-menu-tab').appendTo('#admin-menu-wrapper > ul');
$('ul.tabs.secondary', context).appendTo('#admin-menu-wrapper > ul > li.admin-menu-tab.active');
$('ul.tabs.primary', context).remove();
}
};

/**
* Perform dynamic replacements in cached menu.
*/
Drupal.admin.behaviors.replacements = function (context, settings, $adminMenu) {
for (var item in settings.admin_menu.replacements) {
$(item, $adminMenu).html(settings.admin_menu.replacements[item]);
}
}

/**
* Inject destination query strings for current page.
*/
Drupal.admin.behaviors.destination = function (context, settings, $adminMenu) {
if (settings.admin_menu.destination) {
$('a.admin-menu-destination', $adminMenu).each(function() {
this.search += (!this.search.length ? '?' : '&') + Drupal.settings.admin_menu.destination;
});
}
}

/**
* Apply JavaScript-based hovering behaviors.
*
* @todo This has to run last. If another script registers additional behaviors
* it will not run last.
*/
Drupal.admin.behaviors.hover = function (context, settings, $adminMenu) {
// Hover emulation for IE 6.
if ($.browser.msie && parseInt(jQuery.browser.version) == 6) {
$('#admin-menu li').hover(function() {
$('li', $adminMenu).hover(function() {
$(this).addClass('iehover');
}, function() {
$(this).removeClass('iehover');
@@ -33,7 +170,7 @@ $(document).ready(function() {
}

// Delayed mouseout.
$('#admin-menu li').hover(function() {
$('li', $adminMenu).hover(function() {
// Stop the timer.
clearTimeout(this.sfTimer);
// Display child lists.
@@ -47,4 +184,9 @@ $(document).ready(function() {
uls.css({left: '-999em', display: 'none'});
}, 400);
});
});
};

/**
* @} End of "defgroup admin_behaviors".
*/


+ 566
- 150
sites/all/modules/admin_menu/admin_menu.module View File

@@ -1,10 +1,13 @@
<?php
// $Id: admin_menu.module,v 1.43.2.18 2009/06/21 18:58:04 sun Exp $
// $Id: admin_menu.module,v 1.43.2.17.2.26 2009/08/16 21:51:12 sun Exp $

/**
* @file
* Renders a menu tree for administrative purposes as a dropdown menu at the top
* of the window.
* Render an administrative menu as a dropdown menu at the top of the window.
*
* Note: Most theme-functions in Administration Menu are not invoked via theme(),
* because we try to keep this module as fast as possible and chances are very
* small that someone wants to override those functions.
*/

/**
@@ -36,8 +39,12 @@ function admin_menu_perm() {
*/
function admin_menu_theme() {
return array(
'admin_menu_links' => array(
'arguments' => array('elements' => array()),
),
'admin_menu_icon' => array(
'arguments' => array(),
'file' => 'admin_menu.inc',
),
);
}
@@ -46,7 +53,14 @@ function admin_menu_theme() {
* Implementation of hook_menu().
*/
function admin_menu_menu() {
$items = array();
// AJAX callback.
// @see http://drupal.org/project/js
$items['js/admin_menu/cache'] = array(
'page callback' => 'admin_menu_js_cache',
'access arguments' => array('access administration menu'),
'type' => MENU_CALLBACK,
);
// Module settings.
$items['admin/settings/admin_menu'] = array(
'title' => 'Administration menu',
'description' => 'Adjust administration menu settings.',
@@ -55,6 +69,7 @@ function admin_menu_menu() {
'access arguments' => array('administer site configuration'),
'file' => 'admin_menu.inc',
);
// Menu link callbacks.
$items['admin_menu/toggle-modules'] = array(
'page callback' => 'admin_menu_toggle_modules',
'access arguments' => array('administer site configuration'),
@@ -70,6 +85,178 @@ function admin_menu_menu() {
return $items;
}

/**
* Implementation of hook_menu_alter().
*/
function admin_menu_menu_alter(&$items) {
// Move all items below admin/* into administration menu.
foreach ($items as $path => $item) {
if (strpos($path, 'admin') === 0) {
if (!isset($item['type'])) {
$items[$path]['menu_name'] = 'admin_menu';
}
else {
// For any reason, content-type menu items are registered individually
// in Drupal core, but also by CCK. We a) have to copy and re-assign
// them the proper router path and b) turn their parent items from
// MENU_CALLBACK into something visible; otherwise, the menu system
// does not find the parents and relocates child items to the top-level.
if (strpos($path, 'admin/content/node-type/') === 0) {
// Fix router path.
$newpath = strtr($path, array('/node-type/' => '/types/'));
$items[$newpath] = $items[$path];
// Alter item type and visibility.
$items[$newpath]['type'] &= ~MENU_CALLBACK;
if ($items[$newpath]['type'] === 0) {
$items[$newpath]['type'] |= MENU_NORMAL_ITEM;
}
// Use new item from here, but leave old intact to play nice with
// others.
$path = $newpath;
$item = $items[$newpath];
}
if ($item['type'] & MENU_IS_LOCAL_TASK) {
// Trick this item into the visible menu tree.
$items[$path]['_visible'] = TRUE;
}
// Skip invisible MENU_CALLBACKs, but make sure that it is not a
// MENU_NORMAL_ITEM, which shares the MENU_VISIBLE_IN_BREADCRUMB bit.
if ($item['type'] === MENU_CALLBACK) {
continue;
}
$items[$path]['menu_name'] = 'admin_menu';
}
}
// Copy 'Add new content' into admin_menu menu.
elseif (strpos($path, 'node/add') === 0) {
$newpath = 'admin/' . $path;
$items[$newpath] = admin_menu_copy_item($item, $path, $newpath);
$items[$newpath]['menu_name'] = 'admin_menu';
if ($newpath == 'admin/node/add') {
$items[$newpath]['weight'] = -15;
}
}
}

// Remove 'admin', so children appear on the top-level.
$items['admin']['type'] = MENU_CALLBACK;
// Remove local tasks on 'admin'.
$items['admin/by-task']['_visible'] = FALSE;
$items['admin/by-module']['_visible'] = FALSE;

// menu_link_save() looks up the parent's menu_name directly in the database
// instead of taking data in hook_menu() into account. When installing
// admin_menu, {menu_links} contains the default value of 'navigation', which
// is thereby applied to all items, even if this function altered them. There
// is no other way to override this behavior.
// Additionally, if links below admin/ were moved or customized in any way and
// those are moved back into the administration menu, then the menu system
// will not calculate/assign the proper menu link parents when the parent item
// (here: 'admin') is marked as customized.
db_query("UPDATE {menu_links} SET menu_name = 'admin_menu', customized = 0 WHERE router_path = 'admin'");

// Flush client-side caches whenever the menu is rebuilt.
module_invoke('admin_menu', 'flush_caches');
}

/**
* Copy a menu router item to another location.
*
* Adjusts numeric path argument references for various menu router item
* properties.
*
* @param $item
* The existing menu router item.
* @param $old_path
* The existing path of $item, f.e. 'node/add'.
* @param $new_path
* The path to copy the menu router item to, f.e. 'admin/node/add'.
* @return
* The menu router item with adjusted path argument references.
*/
function admin_menu_copy_item($item, $old_path, $new_path) {
$offset = count(explode('/', $new_path)) - count(explode('/', $old_path));
if ($offset != 0) {
foreach (array('page arguments', 'access arguments', 'load arguments', 'title arguments') as $args) {
if (!empty($item[$args])) {
foreach ($item[$args] as $key => $value) {
if (is_numeric($value)) {
$item[$args][$key] = $value + $offset;
}
}
}
}
}
return $item;
}

/**
* Implementation of hook_menu_link_alter().
*/
function admin_menu_menu_link_alter(&$item, $menu) {
// @todo Temporary fix until #550254 has been released.
// @see menu_link_save()
// Only process links during menu router rebuild, belonging to our menu.
if (!isset($menu) || !($item['menu_name'] == 'admin_menu')) {
return;
}

// If no explicit plid is defined as parent, then the the re-parenting process
// is always invoked, since there is no guarantee that a plid of 0 is not
// caused by a re-parenting process that went wrong previously. For example,
// local tasks may be re-parented to the top-level (0) when tab_root points to
// an item of type MENU_CALLBACK.
if (!empty($item['plid'])) {
$parent = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE mlid = %d", $item['plid']));
}
else {
// Find the parent - it must be unique.
$parent_path = $item['link_path'];
$where = "WHERE link_path = '%s'";
// Only links derived from router items should have module == 'system', and
// we want to find the parent even if it's in a different menu.
if ($item['module'] == 'system') {
$where .= " AND module = '%s'";
$arg2 = 'system';
}
else {
// If not derived from a router item, we respect the specified menu name.
$where .= " AND menu_name = '%s'";
$arg2 = $item['menu_name'];
}
do {
$parent = FALSE;
$parent_path = substr($parent_path, 0, strrpos($parent_path, '/'));
$result = db_query("SELECT COUNT(*) FROM {menu_links} ". $where, $parent_path, $arg2);
// Only valid if we get a unique result.
if (db_result($result) == 1) {
$parent = db_fetch_array(db_query("SELECT * FROM {menu_links} ". $where, $parent_path, $arg2));
}
} while ($parent === FALSE && $parent_path);
}
if ($parent !== FALSE) {
// If a parent link was found, derive its menu.
$item['menu_name'] = $parent['menu_name'];

// Whenever we retrieve a parent link for a router item from the database,
// we need to update the parent link's properties according to the new
// router item. Otherwise, the re-parenting process gets stuck on the menu
// router data that was stored in {menu_links} in a previous menu rebuild.
if (isset($menu) && !empty($parent['router_path']) && isset($menu[$parent['router_path']])) {
$parent = array_merge($parent, _menu_link_build($menu[$parent['router_path']]));
}
}
$menu_name = $item['menu_name'];
// Menu callbacks need to be in the links table for breadcrumbs, but can't
// be parents if they are generated directly from a router item.
if (empty($parent['mlid']) || $parent['hidden'] < 0) {
$item['plid'] = 0;
}
else {
$item['plid'] = $parent['mlid'];
}
}

/**
* Implementation of hook_init().
*
@@ -79,25 +266,59 @@ function admin_menu_menu() {
* 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');
}
if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
return;
}
// Performance: Skip this entirely for AJAX requests.
if (strpos($_GET['q'], 'js/') === 0) {
return;
}
global $user, $language;

$path = drupal_get_path('module', 'admin_menu');
drupal_add_css($path . '/admin_menu.css', 'module', 'all', FALSE);
if ($user->uid == 1) {
drupal_add_css($path . '/admin_menu.uid1.css', 'module', 'all', FALSE);
}
// Performance: Defer execution.
drupal_add_js($path . '/admin_menu.js', 'module', 'header', TRUE);

// Destination query strings are applied via JS.
$settings['destination'] = drupal_get_destination();

// Hash for client-side HTTP/AJAX caching.
$cid = 'admin_menu:' . $user->uid . ':' . $language->language;
if (!empty($_COOKIE['has_js']) && ($hash = admin_menu_cache_get($cid))) {
$settings['hash'] = $hash;
// The base path to use for cache requests depends on whether clean URLs
// are enabled, whether Drupal runs in a sub-directory, and on the language
// system configuration. url() already provides us the proper path and also
// invokes potentially existing custom_url_rewrite() functions, which may
// add further required components to the URL to provide context. Due to
// those components, and since url('') returns only base_path() when clean
// URLs are disabled, we need to use a replacement token as path. Yuck.
$settings['basePath'] = url('admin_menu');
}

$replacements = module_invoke_all('admin_menu_replacements');
if (!empty($replacements)) {
$settings['replacements'] = $replacements;
}

if ($setting = variable_get('admin_menu_margin_top', 1)) {
$settings['margin_top'] = $setting;
}
if ($setting = variable_get('admin_menu_position_fixed', 0)) {
$settings['position_fixed'] = $setting;
}
if ($setting = variable_get('admin_menu_tweak_tabs', 0)) {
$settings['tweak_tabs'] = $setting;
}
if ($_GET['q'] == 'admin/build/modules' || strpos($_GET['q'], 'admin/build/modules/list') === 0) {
$settings['tweak_modules'] = variable_get('admin_menu_tweak_modules', 0);
}

drupal_add_js(array('admin_menu' => $settings), 'setting');
}

/**
@@ -109,134 +330,336 @@ function admin_menu_init() {
* 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.
* Defaults to TRUE. If called before hook_footer(), the menu will not be
* displayed. If FALSE is passed, the suppression state is returned.
*/
function admin_menu_suppress($set = TRUE) {
static $suppress = FALSE;
if (!empty($set)) {
// drupal_add_js() must only be invoked once.
if (!empty($set) && $suppress === FALSE) {
$suppress = TRUE;
drupal_add_js(array('admin_menu' => array('suppress' => 1)), 'setting');
}
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.
*
* @todo Since admin_menu is rebuilt in the same request, we should be able
* to use a helper function instead of a variable to remind us to rebuild
* (variable_set() is slow).
*/
function admin_menu_footer($main = 0) {
if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
return;
}

// Check for the flag indicating that we need to rebuild.
if (variable_get('admin_menu_rebuild_links', FALSE)) {
module_load_include('inc', 'admin_menu');
_admin_menu_rebuild_links();
variable_del('admin_menu_rebuild_links');
}
return admin_menu_output();
}

$content = '<div id="admin-menu">';
$content .= admin_menu_tree_output(menu_tree_all_data('admin_menu'));
$content .= '</div>';
return $content;
/**
* Implementation of hook_js().
*/
function admin_menu_js() {
return array(
'cache' => array(
'callback' => 'admin_menu_js_cache',
'includes' => array('common', 'theme', 'unicode'),
'dependencies' => array('devel', 'filter', 'user'),
),
);
}

/**
* Returns a rendered menu tree.
* Retrieve a client-side cache hash from cache.
*
* @param $tree
* A data structure representing the tree as returned from menu_tree_data.
* The hash cache is consulted more than once per request; we therefore cache
* the results statically to avoid multiple database requests.
*
* @return string
* The complete, rendered administration menu.
* This should only be used for client-side cache hashes. Use cache_menu for
* administration menu content.
*
* @param $cid
* The cache ID of the data to retrieve.
*/
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']);
function admin_menu_cache_get($cid) {
static $cache = array();

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);
if (!variable_get('admin_menu_cache_client', TRUE)) {
return FALSE;
}
if (!array_key_exists($cid, $cache)) {
$cache[$cid] = cache_get($cid, 'cache_admin_menu');
if ($cache[$cid] && isset($cache[$cid]->data)) {
$cache[$cid] = $cache[$cid]->data;
}
}
return $output ? "\n<ul>". $output .'</ul>' : '';

return $cache[$cid];
}

/**
* High-performance implementation of theme_menu_item_link().
* Store a client-side cache hash in persistent cache.
*
* This should only be used for client-side cache hashes. Use cache_menu for
* administration menu content.
*
* This saves us a theme() call and does only the absolute minimum to get
* the admin menu links rendered.
* @param $cid
* The cache ID of the data to retrieve.
*/
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>';
function admin_menu_cache_set($cid, $data) {
if (variable_get('admin_menu_cache_client', TRUE)) {
cache_set($cid, $data, 'cache_admin_menu');
}
}

/**
* 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
* Menu callback; Output administration menu for HTTP caching via AJAX request.
*/
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;
function admin_menu_js_cache($hash = NULL) {
// Get the rendered menu.
$content = admin_menu_output();

// @todo According to http://www.mnot.net/blog/2006/05/11/browser_caching,
// IE will only cache the content when it is compressed.
// Determine if the client accepts gzipped data.