summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2014-01-23 14:16:54 (GMT)
committerTorsten Grote <grote@kolabsys.com>2014-01-23 14:16:54 (GMT)
commit9ec77367e92d9c9dd55f6b4f3d88b09f18e56b49 (patch)
tree301223a76d554f5c61a849534e1c52922a2fd984 /kolab.org/www/drupal-7.18/sites/all/modules/admin_menu
parentf2e198d9dc13020ac2307d2e58cfc9b650a1ecec (diff)
downloadkolab.org-www-9ec77367e92d9c9dd55f6b4f3d88b09f18e56b49.tar.gz
bring most modules up to date
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/admin_menu')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_devel/admin_devel.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu-rtl.css48
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.admin.js14
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.api.php104
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.css65
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.drush.inc14
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.inc154
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.install5
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.js145
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.module139
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css11
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module34
14 files changed, 588 insertions, 163 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_devel/admin_devel.info b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_devel/admin_devel.info
index df04a54..6408a1b 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_devel/admin_devel.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_devel/admin_devel.info
@@ -4,9 +4,9 @@ package = Administration
core = 7.x
scripts[] = admin_devel.js
-; Information added by drupal.org packaging script on 2012-05-17
-version = "7.x-3.0-rc3"
+; Information added by drupal.org packaging script on 2013-01-31
+version = "7.x-3.0-rc4"
core = "7.x"
project = "admin_menu"
-datestamp = "1337292349"
+datestamp = "1359651687"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu-rtl.css b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu-rtl.css
index 6004de5..9414dcf 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu-rtl.css
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu-rtl.css
@@ -1,50 +1,64 @@
#admin-menu {
- direction: rtl;
text-align: right;
}
-#admin-menu li.admin-menu-action {
+#admin-menu .dropdown .admin-menu-users a {
+ background-position: 10% center;
+ padding-left: 22px;
+ padding-right: 0;
+}
+#admin-menu .dropdown .admin-menu-action,
+#admin-menu .dropdown .admin-menu-search {
float: left;
}
-#admin-menu li.admin-menu-action a {
+#admin-menu .dropdown .admin-menu-action a {
border-left: none;
border-right: 1px solid #323232;
}
/* All lists */
-#admin-menu ul a {
+#admin-menu a {
+ text-align: right;
+}
+#admin-menu .dropdown a {
border-left: 1px solid #323232;
border-right: 0;
- padding: 4px 8px;
- text-align: right;
+}
+#admin-menu .dropdown .admin-menu-tab a {
+ border-left: 1px solid #52565E;
+ border-right: 0;
+}
+#admin-menu .dropdown li li a {
+ border-left: 0;
}
/* All list items */
-#admin-menu li {
+#admin-menu .dropdown li {
float: right;
- position: relative;
}
-#admin-menu li li {
- position: static;
+#admin-menu .dropdown li li {
}
/* Second-level lists */
-#admin-menu li ul {
- right: 0;
+#admin-menu .dropdown li ul {
+ left: auto;
+ right: -999em;
}
/* Third-and-above-level lists */
-#admin-menu li li.expandable ul {
- margin: -20px 160px 0 0;
+#admin-menu .dropdown li li.expandable ul {
+ margin-left: 0;
+ margin-right: 160px;
}
/* Lists nested under hovered list items */
-#admin-menu li.admin-menu-action:hover ul {
+#admin-menu .dropdown 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;
+#admin-menu .dropdown li li.expandable {
+ background-image: url(images/arrow-rtl.png);
+ background-position: 5px 6px;
}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.admin.js b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.admin.js
index 6adf3a8..9ee9f36 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.admin.js
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.admin.js
@@ -1,6 +1,20 @@
(function($) {
/**
+ * Live preview of Administration menu components.
+ */
+Drupal.behaviors.adminMenuLivePreview = {
+ attach: function (context, settings) {
+ $('input[name^="admin_menu_components"]', context).once('admin-menu-live-preview')
+ .change(function () {
+ var target = $(this).attr('rel');
+ $(target).toggle(this.checked);
+ })
+ .trigger('change');
+ }
+};
+
+/**
* Automatically enables required permissions on demand.
*
* Many users do not understand that two permissions are required for the
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.api.php b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.api.php
index 46646ae..2d212fb 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.api.php
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.api.php
@@ -41,11 +41,21 @@ function hook_admin_menu_map() {
/**
* Add to the administration menu content before it is rendered.
*
+ * Only use this hook to add new data to the menu structure. Use
+ * hook_admin_menu_output_alter() to *alter* existing data.
+ *
* @param array $content
- * A structured array suitable for drupal_render(), containing:
+ * A structured array suitable for drupal_render(), potentially containing:
* - menu: The administrative menu of links below the path 'admin/*'.
* - icon: The icon menu.
- * - user: The user items and links.
+ * - account: The user account name and log out link.
+ * - users: The user counter.
+ * Additionally, these special properties:
+ * - #components: The actual components contained in $content are configurable
+ * and depend on the 'admin_menu_components' configuration value. #components
+ * holds a copy of that for convenience.
+ * - #complete: A Boolean indicating whether the complete menu should be built,
+ * ignoring the current configuration in #components.
* Passed by reference.
*
* @see hook_admin_menu_output_alter()
@@ -55,45 +65,77 @@ function hook_admin_menu_map() {
* @see theme_admin_menu_links()
*/
function hook_admin_menu_output_build(&$content) {
+ // In case your implementation provides a configurable component, check
+ // whether the component should be displayed:
+ if (empty($content['#components']['shortcut.links']) && !$content['#complete']) {
+ return;
+ }
+
+ // Add new top-level item to the menu.
+ if (isset($content['menu'])) {
+ $content['menu']['myitem'] = array(
+ '#title' => t('My item'),
+ // #attributes are used for list items (LI).
+ '#attributes' => array('class' => array('mymodule-myitem')),
+ '#href' => 'mymodule/path',
+ // #options are passed to l().
+ '#options' => array(
+ 'query' => drupal_get_destination(),
+ // Apply a class on the link (anchor).
+ 'attributes' => array('class' => array('myitem-link-anchor')),
+ ),
+ // #weight controls the order of links in the resulting item list.
+ '#weight' => 50,
+ );
+ }
+ // Add link to the icon menu to manually run cron.
+ if (isset($content['icon'])) {
+ $content['icon']['myitem']['cron'] = array(
+ '#title' => t('Run cron'),
+ '#access' => user_access('administer site configuration'),
+ '#href' => 'admin/reports/status/run-cron',
+ );
+ }
}
/**
* Change the administration menu content before it is rendered.
*
+ * Only use this hook to alter existing data in the menu structure. Use
+ * hook_admin_menu_output_build() to *add* new data.
+ *
* @param array $content
- * A structured array suitable for drupal_render(), containing:
- * - menu: The administrative menu of links below the path 'admin/*'.
- * - icon: The icon menu.
- * - user: The user items and links.
- * Passed by reference.
+ * A structured array suitable for drupal_render(). Passed by reference.
*
* @see hook_admin_menu_output_build()
- * @see admin_menu_links_menu()
- * @see admin_menu_links_icon()
- * @see admin_menu_links_user()
- * @see theme_admin_menu_links()
*/
function hook_admin_menu_output_alter(&$content) {
- // Add new top-level item.
- $content['menu']['myitem'] = array(
- '#title' => t('My item'),
- // #attributes are used for list items (LI).
- '#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['menu']['myitem']['cron'] = array(
- '#title' => t('Run cron'),
- '#access' => user_access('administer site configuration'),
- '#href' => 'admin/reports/status/run-cron',
- );
+}
+
+/**
+ * Return content to be replace via JS in the cached menu output.
+ *
+ * @param bool $complete
+ * A Boolean indicating whether all available components of the menu will be
+ * output and the cache will be skipped.
+ *
+ * @return array
+ * An associative array whose keys are jQuery selectors and whose values are
+ * strings containing the replacement content.
+ */
+function hook_admin_menu_replacements($complete) {
+ $items = array();
+ // If the complete menu is output, then it is uncached and will contain the
+ // current counts already.
+ if (!$complete) {
+ // Check whether the users count component is enabled.
+ $components = variable_get('admin_menu_components', array());
+ if (!empty($components['admin_menu.users']) && ($user_count = admin_menu_get_user_count())) {
+ // Replace the counters in the cached menu output with current counts.
+ $items['.admin-menu-users a'] = $user_count;
+ }
+ }
+ return $items;
}
/**
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.css b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.css
index 0ceec28..fd86dd7 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.css
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.css
@@ -34,7 +34,8 @@
background: transparent url(images/icon_users.png) 90% center no-repeat;
padding-right: 22px;
}
-#admin-menu .dropdown .admin-menu-action {
+#admin-menu .dropdown .admin-menu-action,
+#admin-menu .dropdown .admin-menu-search {
float: right;
}
#admin-menu .dropdown .admin-menu-action a {
@@ -57,31 +58,33 @@ body.admin-menu {
#admin-menu .dropdown {
position: static;
}
-#admin-menu a {
+#admin-menu a,
+#admin-menu li > span {
background: transparent none;
border: none;
color: #EEE;
font-weight: normal;
- text-align: left;
+ text-align: left; /* LTR */
text-decoration: none;
}
-#admin-menu .dropdown a {
- border-right: 1px solid #323232;
+#admin-menu .dropdown a,
+#admin-menu .dropdown li > span {
+ border-right: 1px solid #323232; /* LTR */
display: block;
padding: 4px 8px;
}
#admin-menu .dropdown .admin-menu-tab a {
- border-right: 1px solid #52565E;
+ border-right: 1px solid #52565E; /* LTR */
}
#admin-menu .dropdown li li a {
- border-right: none;
+ border-right: none; /* LTR */
border-top: 1px solid #323232;
}
/* All list items */
#admin-menu .dropdown li {
background-image: none;
- float: left;
+ float: left; /* LTR */
height: 100%;
list-style-image: none;
list-style-type: none;
@@ -108,7 +111,7 @@ body.admin-menu {
#admin-menu .dropdown li ul {
background: none;
display: none;
- left: -999em;
+ left: -999em; /* LTR */
line-height: 1.2em;
margin: 0;
position: absolute;
@@ -117,7 +120,7 @@ body.admin-menu {
/* Third-and-above-level lists */
#admin-menu .dropdown li li.expandable ul {
- margin: -20px 0 0 160px;
+ margin: -20px 0 0 160px; /* LTR */
}
#admin-menu .dropdown li:hover ul ul,
@@ -129,7 +132,7 @@ body.admin-menu {
#admin-menu .dropdown li.iehover ul ul ul ul,
#admin-menu .dropdown li.iehover ul ul ul ul ul {
display: none;
- left: -999em;
+ left: -999em; /* LTR */
}
/* Lists nested under hovered list items */
@@ -144,10 +147,10 @@ body.admin-menu {
#admin-menu .dropdown li li li li.iehover ul,
#admin-menu .dropdown li li li li li.iehover ul {
display: block;
- left: auto;
+ left: auto; /* LTR */
}
#admin-menu .dropdown li.admin-menu-action:hover ul {
- right: 0;
+ right: 0; /* LTR */
}
/* Second-and-more-level hovering */
@@ -184,6 +187,42 @@ body.admin-menu {
width: 90%; /* IE */
}
+/* Search form */
+#admin-menu .admin-menu-search .form-item {
+ margin: 0;
+ padding: 0;
+}
+#admin-menu .admin-menu-search input {
+ background: #fff none center right no-repeat;
+ border: none;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ font-size: 10px;
+ margin: 1px 0;
+ outline: none;
+ padding: 2px 22px 2px 4px;
+ width: 158px;
+}
+
+#admin-menu .dropdown .admin-menu-search-results {
+ display: block !important;
+ left: auto !important;
+ top: 100%;
+}
+#admin-menu .admin-menu-search-results,
+#admin-menu .admin-menu-search-results li {
+ width: 186px;
+}
+
+#admin-menu li.highlight {
+ background-color: #eee !important;
+}
+#admin-menu li.highlight > a {
+ border-color: #ccc !important;
+ color: #111 !important;
+}
+
/* #210615: Mozilla on Mac fix */
html.js fieldset.collapsible div.fieldset-wrapper {
overflow: visible;
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.drush.inc b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.drush.inc
deleted file mode 100644
index a8469a9..0000000
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.drush.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-<?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();
- }
-}
-
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.inc b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.inc
index 31efaea..e212970 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.inc
@@ -425,6 +425,7 @@ function admin_menu_links_icon() {
$links = array(
'#theme' => 'admin_menu_links',
+ '#wrapper_attributes' => array('id' => 'admin-menu-icon'),
'#weight' => -100,
);
$links['icon'] = array(
@@ -495,52 +496,47 @@ function admin_menu_links_icon() {
),
);
}
+
// 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'),
+ '#access' => user_access('administer modules'),
'#href' => 'admin_menu/toggle-modules',
'#options' => array(
'query' => $destination + array('token' => drupal_get_token('admin_menu/toggle-modules')),
),
);
- // Add Devel module links.
+ // Add Devel module menu links.
if (module_exists('devel')) {
- // Add variable editor.
- $links['icon']['devel-variables'] = array(
- '#title' => t('Variable editor'),
- '#weight' => 20,
- '#access' => user_access('access devel information'),
- '#href' => 'devel/variable',
- );
+ $devel_tree = menu_build_tree('devel');
+ $devel_links = admin_menu_links_menu($devel_tree);
+ if (element_get_visible_children($devel_links)) {
+ $links['icon']['devel'] = array(
+ '#title' => t('Development'),
+ '#weight' => 30,
+ ) + $devel_links;
+ }
}
return $links;
}
/**
- * Build user/action links; mostly account information and links.
+ * Builds the account links.
*
* @see theme_admin_menu_links()
*/
-function admin_menu_links_user() {
+function admin_menu_links_account() {
$links = array(
'#theme' => 'admin_menu_links',
+ '#wrapper_attributes' => array('id' => 'admin-menu-account'),
'#weight' => 100,
);
- // 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/people/people' : 'user'),
- );
$links['account'] = array(
- '#title' => $GLOBALS['user']->name,
+ '#title' => format_username($GLOBALS['user']),
'#weight' => -99,
'#attributes' => array('class' => array('admin-menu-action', 'admin-menu-account')),
'#href' => 'user/' . $GLOBALS['user']->uid,
@@ -551,7 +547,6 @@ function admin_menu_links_user() {
'#attributes' => array('class' => array('admin-menu-action')),
'#href' => 'user/logout',
);
-
// Add Devel module switch user links.
$switch_links = module_invoke('devel', 'switch_user_list');
if (!empty($switch_links) && count($switch_links) > 1) {
@@ -567,7 +562,51 @@ function admin_menu_links_user() {
);
}
}
+ return $links;
+}
+/**
+ * Builds user counter.
+ *
+ * @see theme_admin_menu_links()
+ */
+function admin_menu_links_users() {
+ $links = array(
+ '#theme' => 'admin_menu_links',
+ '#wrapper_attributes' => array('id' => 'admin-menu-users'),
+ '#weight' => 150,
+ );
+ // 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/people/people' : 'user'),
+ );
+ return $links;
+}
+
+/**
+ * Build search widget.
+ *
+ * @see theme_admin_menu_links()
+ */
+function admin_menu_links_search() {
+ $links = array(
+ '#theme' => 'admin_menu_links',
+ '#wrapper_attributes' => array('id' => 'admin-menu-search'),
+ '#weight' => 180,
+ );
+ $links['search'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Search'),
+ '#title_display' => 'attribute',
+ '#attributes' => array(
+ 'placeholder' => t('Search'),
+ 'class' => array('admin-menu-search'),
+ ),
+ );
return $links;
}
@@ -584,20 +623,43 @@ function admin_menu_theme_settings() {
$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),
+ '#default_value' => variable_get('admin_menu_position_fixed', 1),
'#description' => t('Displays the administration menu always at the top of the browser viewport (even when scrolling the page).'),
);
// @todo Re-confirm this with latest browser versions.
$form['admin_menu_position_fixed']['#description'] .= '<br /><strong>' . t('In some browsers, this setting may result in a malformed page, an invisible cursor, non-selectable elements in forms, or other issues.') . '</strong>';
- $form['admin_menu_cache_client'] = array(
- '#type' => 'checkbox',
- '#title' => t('Cache menu in client-side browser'),
- '#default_value' => variable_get('admin_menu_cache_client', 1),
+
+ $form['advanced'] = array(
+ '#type' => 'vertical_tabs',
+ '#title' => t('Advanced settings'),
);
+ $form['plugins'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Plugins'),
+ '#group' => 'advanced',
+ );
+ $form['plugins']['admin_menu_components'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Enabled components'),
+ '#options' => array(
+ 'admin_menu.icon' => t('Icon menu'),
+ 'admin_menu.menu' => t('Administration menu'),
+ 'admin_menu.search' => t('Search bar'),
+ 'admin_menu.users' => t('User counts'),
+ 'admin_menu.account' => t('Account links'),
+ ),
+ );
+ $form['plugins']['admin_menu_components']['#default_value'] = array_keys(array_filter(variable_get('admin_menu_components', $form['plugins']['admin_menu_components']['#options'])));
+
+ $process = element_info_property('checkboxes', '#process', array());
+ $form['plugins']['admin_menu_components']['#process'] = array_merge(array('admin_menu_settings_process_components'), $process);
+ $form['#attached']['js'][] = drupal_get_path('module', 'admin_menu') . '/admin_menu.admin.js';
+
$form['tweaks'] = array(
'#type' => 'fieldset',
- '#title' => t('Advanced settings'),
+ '#title' => t('System tweaks'),
+ '#group' => 'advanced',
);
$form['tweaks']['admin_menu_tweak_modules'] = array(
'#type' => 'checkbox',
@@ -625,6 +687,16 @@ function admin_menu_theme_settings() {
'#description' => t('Moves the tabs on all pages into the administration menu. Only possible for themes using the CSS classes <code>tabs primary</code> and <code>tabs secondary</code>.'),
);
+ $form['performance'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Performance'),
+ '#group' => 'advanced',
+ );
+ $form['performance']['admin_menu_cache_client'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Cache menu in client-side browser'),
+ '#default_value' => variable_get('admin_menu_cache_client', 1),
+ );
// Fetch all available modules manually, since module_list() only returns
// currently enabled modules, which makes this setting pointless if developer
// modules are currently disabled.
@@ -638,7 +710,7 @@ function admin_menu_theme_settings() {
}
$devel_modules = variable_get('admin_menu_devel_modules', _admin_menu_developer_modules());
$devel_modules = array_intersect_key($all_modules, array_flip($devel_modules));
- $form['tweaks']['admin_menu_devel_modules_skip'] = array(
+ $form['performance']['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()),
@@ -653,6 +725,32 @@ function admin_menu_theme_settings() {
}
/**
+ * #process callback for component plugin form element in admin_menu_theme_settings().
+ */
+function admin_menu_settings_process_components($element) {
+ // Assign 'rel' attributes to all options to achieve a live preview.
+ // Unfortunately, #states relies on wrapping .form-wrapper classes, so it
+ // cannot be used here.
+ foreach ($element['#options'] as $key => $label) {
+ if (!isset($element[$key]['#attributes']['rel'])) {
+ $id = preg_replace('/[^a-z]/', '-', $key);
+ $element[$key]['#attributes']['rel'] = '#' . $id;
+ }
+ }
+ return $element;
+}
+
+/**
+ * Form validation handler for admin_menu_theme_settings().
+ */
+function admin_menu_theme_settings_validate(&$form, &$form_state) {
+ // Change the configured components to Boolean values.
+ foreach ($form_state['values']['admin_menu_components'] as $component => &$enabled) {
+ $enabled = (bool) $enabled;
+ }
+}
+
+/**
* Implementation of hook_form_FORM_ID_alter().
*
* Extends Devel module with Administration menu developer settings.
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.info b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.info
index bac8b2e..ee58c66 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.info
@@ -8,9 +8,9 @@ configure = admin/config/administration/admin_menu
dependencies[] = system (>7.10)
files[] = tests/admin_menu.test
-; Information added by drupal.org packaging script on 2012-05-17
-version = "7.x-3.0-rc3"
+; Information added by drupal.org packaging script on 2013-01-31
+version = "7.x-3.0-rc4"
core = "7.x"
project = "admin_menu"
-datestamp = "1337292349"
+datestamp = "1359651687"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.install b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.install
index acbd06b..70e31c6 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.install
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.install
@@ -32,6 +32,7 @@ function admin_menu_install() {
*/
function admin_menu_uninstall() {
// Delete variables.
+ variable_del('admin_menu_components');
variable_del('admin_menu_devel_modules');
variable_del('admin_menu_devel_modules_enabled');
variable_del('admin_menu_devel_modules_skip');
@@ -102,7 +103,9 @@ function admin_menu_update_7303() {
*/
function admin_menu_update_7304() {
// Remove the custom menu used by 6.x-1.x.
- db_delete('menu_custom')->condition('menu_name', 'admin_menu')->execute();
+ if (db_table_exists('menu_custom')) {
+ db_delete('menu_custom')->condition('menu_name', 'admin_menu')->execute();
+ }
// 6.x-1.x cloned the entire link structure below the path 'admin' into a
// separate 'menu_name' "admin_menu" with 'module' "admin_menu". 6.x-3.x and
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.js b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.js
index 169eba8..de0bb90 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.js
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.js
@@ -85,10 +85,11 @@ Drupal.behaviors.adminMenuCollapsePermissions = {
});
});
});
- // Get fragment from current URL.
- var fragment = window.location.hash || '#';
// Collapse all but the targeted permission rows set.
- $modules.not(':has(' + fragment + ')').trigger('click.admin-menu');
+ if (window.location.hash.length) {
+ $modules = $modules.not(':has(' + window.location.hash + ')');
+ }
+ $modules.trigger('click.admin-menu');
}
}
};
@@ -252,6 +253,144 @@ Drupal.admin.behaviors.hover = function (context, settings, $adminMenu) {
};
/**
+ * Apply the search bar functionality.
+ */
+Drupal.admin.behaviors.search = function (context, settings, $adminMenu) {
+ // @todo Add a HTML ID.
+ var $input = $('input.admin-menu-search', $adminMenu);
+ // Initialize the current search needle.
+ var needle = $input.val();
+ // Cache of all links that can be matched in the menu.
+ var links;
+ // Minimum search needle length.
+ var needleMinLength = 2;
+ // Append the results container.
+ var $results = $('<div />').insertAfter($input);
+
+ /**
+ * Executes the search upon user input.
+ */
+ function keyupHandler() {
+ var matches, $html, value = $(this).val();
+ // Only proceed if the search needle has changed.
+ if (value !== needle) {
+ needle = value;
+ // Initialize the cache of menu links upon first search.
+ if (!links && needle.length >= needleMinLength) {
+ // @todo Limit to links in dropdown menus; i.e., skip menu additions.
+ links = buildSearchIndex($adminMenu.find('li:not(.admin-menu-action, .admin-menu-action li) > a'));
+ }
+ // Empty results container when deleting search text.
+ if (needle.length < needleMinLength) {
+ $results.empty();
+ }
+ // Only search if the needle is long enough.
+ if (needle.length >= needleMinLength && links) {
+ matches = findMatches(needle, links);
+ // Build the list in a detached DOM node.
+ $html = buildResultsList(matches);
+ // Display results.
+ $results.empty().append($html);
+ }
+ }
+ }
+
+ /**
+ * Builds the search index.
+ */
+ function buildSearchIndex($links) {
+ return $links
+ .map(function () {
+ var text = (this.textContent || this.innerText);
+ // Skip menu entries that do not contain any text (e.g., the icon).
+ if (typeof text === 'undefined') {
+ return;
+ }
+ return {
+ text: text,
+ textMatch: text.toLowerCase(),
+ element: this
+ };
+ });
+ }
+
+ /**
+ * Searches the index for a given needle and returns matching entries.
+ */
+ function findMatches(needle, links) {
+ var needleMatch = needle.toLowerCase();
+ // Select matching links from the cache.
+ return $.grep(links, function (link) {
+ return link.textMatch.indexOf(needleMatch) !== -1;
+ });
+ }
+
+ /**
+ * Builds the search result list in a detached DOM node.
+ */
+ function buildResultsList(matches) {
+ var $html = $('<ul class="dropdown admin-menu-search-results" />');
+ $.each(matches, function () {
+ var result = this.text;
+ var $element = $(this.element);
+
+ // Check whether there is a top-level category that can be prepended.
+ var $category = $element.closest('#admin-menu-wrapper > ul > li');
+ var categoryText = $category.find('> a').text()
+ if ($category.length && categoryText) {
+ result = categoryText + ': ' + result;
+ }
+
+ var $result = $('<li><a href="' + $element.attr('href') + '">' + result + '</a></li>');
+ $result.data('original-link', $(this.element).parent());
+ $html.append($result);
+ });
+ return $html;
+ }
+
+ /**
+ * Highlights selected result.
+ */
+ function resultsHandler(e) {
+ var $this = $(this);
+ var show = e.type === 'mouseenter' || e.type === 'focusin';
+ $this.trigger(show ? 'showPath' : 'hidePath', [this]);
+ }
+
+ /**
+ * Closes the search results and clears the search input.
+ */
+ function resultsClickHandler(e, link) {
+ var $original = $(this).data('original-link');
+ $original.trigger('mouseleave');
+ $input.val('').trigger('keyup');
+ }
+
+ /**
+ * Shows the link in the menu that corresponds to a search result.
+ */
+ function highlightPathHandler(e, link) {
+ if (link) {
+ var $original = $(link).data('original-link');
+ var show = e.type === 'showPath';
+ // Toggle an additional CSS class to visually highlight the matching link.
+ // @todo Consider using same visual appearance as regular hover.
+ $original.toggleClass('highlight', show);
+ $original.trigger(show ? 'mouseenter' : 'mouseleave');
+ }
+ }
+
+ // Attach showPath/hidePath handler to search result entries.
+ $results.delegate('li', 'mouseenter mouseleave focus blur', resultsHandler);
+ // Hide the result list after a link has been clicked, useful for overlay.
+ $results.delegate('li', 'click', resultsClickHandler);
+ // Attach hover/active highlight behavior to search result entries.
+ $adminMenu.delegate('.admin-menu-search-results li', 'showPath hidePath', highlightPathHandler);
+ // Attach the search input event handler.
+ $input.bind('keyup search', keyupHandler);
+};
+
+/**
* @} End of "defgroup admin_behaviors".
*/
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.module b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.module
index 4f4f056..8a8dee1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu.module
@@ -89,7 +89,7 @@ function admin_menu_menu() {
// Menu link callbacks.
$items['admin_menu/toggle-modules'] = array(
'page callback' => 'admin_menu_toggle_modules',
- 'access arguments' => array('administer site configuration'),
+ 'access arguments' => array('administer modules'),
'type' => MENU_CALLBACK,
'file' => 'admin_menu.inc',
);
@@ -182,10 +182,16 @@ function admin_menu_page_build(&$page) {
// Destination query strings are applied via JS.
$settings['destination'] = drupal_http_build_query(drupal_get_destination());
+ // Determine whether we need to show all components and disable all caches.
+ $complete = FALSE;
+ if (current_path() == 'admin/config/administration/admin_menu' && $_SERVER['REQUEST_METHOD'] == 'GET') {
+ $complete = TRUE;
+ }
+
// If the client supports JavaScript and we have a cached menu for the current
// user, only output the hash for the client-side HTTP cache callback URL.
$cid = 'admin_menu:' . $user->uid . ':' . session_id() . ':' . $language->language;
- if (!empty($_COOKIE['has_js']) && ($hash = admin_menu_cache_get($cid))) {
+ if (!$complete && !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
@@ -198,10 +204,10 @@ function admin_menu_page_build(&$page) {
}
// Otherwise, add the full menu to the page.
else {
- $page['page_bottom']['admin_menu']['#markup'] = admin_menu_output();
+ $page['page_bottom']['admin_menu']['#markup'] = admin_menu_output($complete);
}
- $replacements = module_invoke_all('admin_menu_replacements');
+ $replacements = module_invoke_all('admin_menu_replacements', $complete);
if (!empty($replacements)) {
$settings['replacements'] = $replacements;
}
@@ -213,7 +219,7 @@ function admin_menu_page_build(&$page) {
// @see http://drupal.org/node/1473548, http://drupal.org/node/1194528
//$page['#attributes']['class'][] = 'admin-menu';
}
- if ($setting = variable_get('admin_menu_position_fixed', 0)) {
+ if ($setting = variable_get('admin_menu_position_fixed', 1)) {
$settings['position_fixed'] = $setting;
// In fixed positioning, supply a callback function for tableheader.js to
@@ -326,6 +332,9 @@ function admin_menu_cache_set($cid, $data) {
function admin_menu_js_cache() {
global $conf;
+ // Suppress Devel module.
+ $GLOBALS['devel_shutdown'] = FALSE;
+
// Enforce page caching.
$conf['cache'] = 1;
drupal_page_is_cacheable(TRUE);
@@ -384,10 +393,17 @@ function admin_menu_deliver($page_callback_result) {
/**
* Implements hook_admin_menu_replacements().
*/
-function admin_menu_admin_menu_replacements() {
+function admin_menu_admin_menu_replacements($complete) {
$items = array();
- if ($user_count = admin_menu_get_user_count()) {
- $items['.admin-menu-users a'] = $user_count;
+ // If the complete menu is output, then it is uncached and will contain the
+ // current counts already.
+ if (!$complete) {
+ // Check whether the users count component is enabled.
+ $components = variable_get('admin_menu_components', array());
+ if (!empty($components['admin_menu.users']) && ($user_count = admin_menu_get_user_count())) {
+ // Replace the counters in the cached menu output with current counts.
+ $items['.admin-menu-users a'] = $user_count;
+ }
}
return $items;
}
@@ -434,11 +450,16 @@ function admin_menu_session_count($timestamp = 0, $anonymous = TRUE) {
/**
* Build the administration menu output.
+ *
+ * @param bool $complete
+ * (optional) Whether to build to the complete menu including all components
+ * and ignore the cache. Defaults to FALSE. Internally used for the settings
+ * page.
*/
-function admin_menu_output() {
+function admin_menu_output($complete = FALSE) {
global $user, $language;
- $cache_server_enabled = variable_get('admin_menu_cache_server', TRUE);
+ $cache_server_enabled = !$complete && variable_get('admin_menu_cache_server', TRUE);
$cid = 'admin_menu:' . $user->uid . ':' . session_id() . ':' . $language->language;
// Try to load and output administration menu from server-side cache.
@@ -458,6 +479,16 @@ function admin_menu_output() {
// Rebuild the output.
if (!isset($content)) {
+ // Retrieve enabled components to display and make them available for others.
+ $components = variable_get('admin_menu_components', array());
+ $components += array(
+ 'admin_menu.menu' => TRUE,
+ 'admin_menu.icon' => TRUE,
+ 'admin_menu.account' => TRUE,
+ );
+ $content['#components'] = $components;
+ $content['#complete'] = $complete;
+
// Add site name as CSS class for development/staging theming purposes. We
// leverage the cookie domain instead of HTTP_HOST to account for many (but
// not all) multi-domain setups (e.g. language-based sub-domains).
@@ -475,15 +506,31 @@ function admin_menu_output() {
// Load menu builder functions.
module_load_include('inc', 'admin_menu');
+ // @todo Move the below callbacks into hook_admin_menu_build()
+ // implementations (and $module.admin_menu.inc).
+
// Add administration menu.
- $content['menu'] = admin_menu_links_menu(admin_menu_tree('management'));
- $content['menu']['#theme'] = 'admin_menu_links';
- // Ensure the menu tree is rendered between the icon and user links.
- $content['menu']['#weight'] = 0;
+ if (!empty($components['admin_menu.menu']) || $complete) {
+ $content['menu'] = admin_menu_links_menu(admin_menu_tree('management'));
+ $content['menu']['#theme'] = 'admin_menu_links';
+ $content['menu']['#wrapper_attributes']['id'] = 'admin-menu-menu';
+ // Ensure the menu tree is rendered between the icon and user links.
+ $content['menu']['#weight'] = 0;
+ }
// Add menu additions.
- $content['icon'] = admin_menu_links_icon();
- $content['user'] = admin_menu_links_user();
+ if (!empty($components['admin_menu.icon']) || $complete) {
+ $content['icon'] = admin_menu_links_icon();
+ }
+ if (!empty($components['admin_menu.account']) || $complete) {
+ $content['account'] = admin_menu_links_account();
+ }
+ if (!empty($components['admin_menu.users']) || $complete) {
+ $content['users'] = admin_menu_links_users();
+ }
+ if (!empty($components['admin_menu.search']) || $complete) {
+ $content['search'] = admin_menu_links_search();
+ }
// Allow modules to enhance the menu.
// Uses '_output' suffix for consistency with the alter hook (see below).
@@ -506,7 +553,7 @@ function admin_menu_output() {
}
// Store the new hash for this user.
- if (!empty($_COOKIE['has_js'])) {
+ if (!empty($_COOKIE['has_js']) && !$complete) {
admin_menu_cache_set($cid, md5($content));
}
@@ -517,6 +564,10 @@ function admin_menu_output() {
* Implements hook_admin_menu_output_build().
*/
function admin_menu_admin_menu_output_build(&$content) {
+ if (!isset($content['menu'])) {
+ return;
+ }
+
// Unassign weights for categories below Configuration.
// An alphabetical order is more natural for a dropdown menu.
if (isset($content['menu']['admin/config'])) {
@@ -623,6 +674,7 @@ function theme_admin_menu_links($variables) {
}
$link = '';
+ // Handle menu links.
if (isset($elements[$path]['#href'])) {
// Strip destination query string from href attribute and apply a CSS class
// for our JavaScript behavior instead.
@@ -631,21 +683,21 @@ function theme_admin_menu_links($variables) {
$elements[$path]['#options']['attributes']['class'][] = 'admin-menu-destination';
}
- $link .= l($elements[$path]['#title'], $elements[$path]['#href'], $elements[$path]['#options']);
+ $link = l($elements[$path]['#title'], $elements[$path]['#href'], $elements[$path]['#options']);
}
- elseif (isset($elements[$path]['#title'])) {
+ // Handle plain text items, but do not interfere with menu additions.
+ elseif (!isset($elements[$path]['#type']) && isset($elements[$path]['#title'])) {
if (!empty($elements[$path]['#options']['html'])) {
$title = $elements[$path]['#title'];
}
else {
$title = check_plain($elements[$path]['#title']);
}
- if (!empty($elements[$path]['#options']['attributes'])) {
- $link .= '<span' . drupal_attributes($elements[$path]['#options']['attributes']) . '>' . $title . '</span>';
- }
- else {
- $link .= $title;
+ $attributes = '';
+ if (isset($elements[$path]['#options']['attributes'])) {
+ $attributes = drupal_attributes($elements[$path]['#options']['attributes']);
}
+ $link = '<span' . $attributes . '>' . $title . '</span>';
}
$output .= '<li' . drupal_attributes($elements[$path]['#attributes']) . '>';
@@ -655,7 +707,9 @@ function theme_admin_menu_links($variables) {
// @todo #attributes probably required for UL, but already used for LI.
// @todo Use $element['#children'] here instead.
if ($output) {
- $output = "\n" . '<ul class="dropdown">' . $output . '</ul>';
+ $elements['#wrapper_attributes']['class'][] = 'dropdown';
+ $attributes = drupal_attributes($elements['#wrapper_attributes']);
+ $output = "\n" . '<ul' . $attributes . '>' . $output . '</ul>';
}
return $output;
}
@@ -665,12 +719,12 @@ function theme_admin_menu_links($variables) {
*/
function admin_menu_element_sort($a, $b) {
// @see element_sort()
- $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
- $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
+ $a_weight = isset($a['#weight']) ? $a['#weight'] : 0;
+ $b_weight = isset($b['#weight']) ? $b['#weight'] : 0;
if ($a_weight == $b_weight) {
// @see element_sort_by_title()
- $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
- $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
+ $a_title = isset($a['#title']) ? $a['#title'] : '';
+ $b_title = isset($b['#title']) ? $b['#title'] : '';
return strnatcasecmp($a_title, $b_title);
}
return ($a_weight < $b_weight) ? -1 : 1;
@@ -723,6 +777,22 @@ function admin_menu_translated_menu_link_alter(&$item, $map) {
* (optional) A user ID to limit the cache flush to.
*/
function admin_menu_flush_caches($uid = NULL) {
+ // A call to menu_rebuild() will trigger potentially thousands of calls into
+ // menu_link_save(), for which admin_menu has to implement the corresponding
+ // CRUD hooks, in order to take up any menu link changes, since any menu link
+ // change could affect the admin menu (which essentially is an aggregate) and
+ // since there is no other way to get notified about stale caches. The cache
+ // only needs to be flushed once though, so we prevent a ton of needless
+ // subsequent calls with this static.
+ // @see http://drupal.org/node/918538
+ $was_flushed = &drupal_static(__FUNCTION__, array());
+ // $uid can be NULL. PHP automatically converts that into '' (empty string),
+ // which is different to uid 0 (zero).
+ if (isset($was_flushed[$uid])) {
+ return;
+ }
+ $was_flushed[$uid] = TRUE;
+
$cid = 'admin_menu:';
if (isset($uid)) {
$cid .= $uid . ':';
@@ -742,6 +812,7 @@ function admin_menu_flush_caches($uid = NULL) {
*/
function admin_menu_form_alter(&$form, &$form_state, $form_id) {
$global_flush_ids = array(
+ 'admin_menu_theme_settings' => 1,
// Update links for clean/non-clean URLs.
'system_clean_url_settings' => 1,
// Incorporate changed user permissions.
@@ -753,12 +824,12 @@ function admin_menu_form_alter(&$form, &$form_state, $form_id) {
);
if (isset($global_flush_ids[$form_id])) {
$form['#submit'][] = 'admin_menu_form_alter_flush_cache_submit';
- }
- // Optionally limit the cache flush to a certain user ID.
- $form_state['admin_menu_uid'] = NULL;
- if ($form_id == 'user_profile_form') {
- $form_state['admin_menu_uid'] = $form_state['user']->uid;
+ // Optionally limit the cache flush to a certain user ID.
+ $form_state['admin_menu_uid'] = NULL;
+ if ($form_id == 'user_profile_form') {
+ $form_state['admin_menu_uid'] = $form_state['user']->uid;
+ }
}
// UX: Add a confirmation to the permissions form to ask the user whether to
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css
index 56e448a..a3e9f3e 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css
@@ -16,7 +16,8 @@ html body.admin-menu {
html body.admin-menu-with-shortcuts {
margin-top: 65px !important;
}
-body div#toolbar {
+/* Displace the core Toolbar, if concurrently output. */
+body div#toolbar.toolbar {
top: 30px;
}
@@ -28,11 +29,9 @@ body div#toolbar {
*/
#admin-menu {
font: normal small "Lucida Grande", Verdana, sans-serif;
- margin: 0 -20px;
- padding: 0 20px;
- -moz-box-shadow: 0 3px 20px #000;
- -webkit-box-shadow: 0 3px 20px #000;
- box-shadow: 0 3px 20px #000;
+ -moz-box-shadow: 0 -10px 20px 13px #000;
+ -webkit-box-shadow: 0 -10px 20px 13px #000;
+ box-shadow: 0 -10px 20px 13px #000;
right: 0;
width: auto;
}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info
index a63b6ce..2514776 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info
@@ -4,9 +4,9 @@ package = Administration
core = 7.x
dependencies[] = admin_menu
-; Information added by drupal.org packaging script on 2012-05-17
-version = "7.x-3.0-rc3"
+; Information added by drupal.org packaging script on 2013-01-31
+version = "7.x-3.0-rc4"
core = "7.x"
project = "admin_menu"
-datestamp = "1337292349"
+datestamp = "1359651687"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
index 1885fce..74a9ee1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
@@ -8,6 +8,17 @@
*/
/**
+ * Implements hook_form_FORMID_alter().
+ */
+function admin_menu_toolbar_form_admin_menu_theme_settings_alter(&$form) {
+ // Add the shortcut links as component on behalf of Shortcut module.
+ $form['plugins']['admin_menu_components']['#options']['shortcut.links'] = t('Shortcuts');
+ // The shortcut bar consists of two elements, so we target their class names
+ // instead of cluttering the markup with additional IDs.
+ $form['plugins']['admin_menu_components']['shortcut.links']['#attributes']['rel'] = '.shortcut-toggle, .shortcut-toolbar';
+}
+
+/**
* Implementation of hook_page_build().
*/
function admin_menu_toolbar_page_build(&$page) {
@@ -48,6 +59,9 @@ function admin_menu_toolbar_page_build(&$page) {
* Implements hook_admin_menu_output_build().
*/
function admin_menu_toolbar_admin_menu_output_build(&$content) {
+ if (empty($content['#components']['shortcut.links']) && !$content['#complete']) {
+ return;
+ }
// Add shortcuts toggle.
$content['shortcut-toggle'] = array(
'#access' => module_exists('shortcut'),
@@ -82,17 +96,23 @@ function admin_menu_toolbar_admin_menu_output_build(&$content) {
*/
function admin_menu_toolbar_admin_menu_output_alter(&$content) {
// Add a class to top-level items for styling.
- foreach (element_children($content['menu']) as $link) {
- $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ if (isset($content['menu'])) {
+ foreach (element_children($content['menu']) as $link) {
+ $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ }
}
// Alter icon.
- unset($content['icon']['icon']['#theme']);
- $content['icon']['icon']['#title'] = '<span>' . t('Home') . '</span>';
- $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ if (isset($content['icon'])) {
+ unset($content['icon']['icon']['#theme']);
+ $content['icon']['icon']['#title'] = '<span>' . t('Home') . '</span>';
+ $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ }
// Alter user account link.
- $content['user']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['user']['account']['#title']));
- $content['user']['account']['#options']['html'] = TRUE;
+ if (isset($content['account'])) {
+ $content['account']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['account']['account']['#title']));
+ $content['account']['account']['#options']['html'] = TRUE;
+ }
}