diff -u modules/shortcut/shortcut.module modules/shortcut/shortcut.module --- modules/shortcut/shortcut.module +++ modules/shortcut/shortcut.module @@ -316,0 +317,46 @@ + + +function shortcut_page_build(&$page) { + global $user; + + if (user_access('customize toolbar shortcuts')) { + // $_GET['q'] is the unaliased version. + $get = $_GET; + unset($get['q']); + $link = $_GET['q']; + if (!empty($get)) { + $link .= '?' . drupal_http_build_query($get); + } + $query = array( + 'link' => $link, + 'name' => drupal_get_title(), + ); + + $shortcut_set = shortcut_default_set($user); + $page['add_to_shortcuts'] = array( + '#prefix' => '
', + '#markup' => l('' . t('Add to %shortcut_set_name shortcuts', array('%shortcut_set_name' => $shortcut_set->title)) . '', 'admin/config/system/shortcut/' . $shortcut_set->set_name . '/add-link', array('query' => $query, 'html' => TRUE)), + '#suffix' => '
', + ); + } + + $links = shortcut_links(); + $links['#attached'] = array('css' => array(drupal_get_path('module', 'shortcut') . '/shortcut.css')); + + $links['#prefix'] = '
'; + $links['#suffix'] = '
'; + $page['toolbar_drawrer'] = $links; +} + +/** + * Implement hook_preprocess_page(). + * + * Add the add_to_shortcuts variable. + */ +function shortcut_preprocess_page(&$vars) { + if (user_access('access toolbar') && user_access('customize toolbar shortcuts')) { + $vars['add_to_shortcuts'] = drupal_render($vars['page']['add_to_shortcuts']); + } + + $vars['page']['page_top']['toolbar']['toolbar_shortcuts'] = shortcut_links(); +} \ No newline at end of file reverted: --- /dev/null +++ modules/toolbar/toolbar.install @@ -0,0 +1,56 @@ + 'admin_shortcuts', + 'title' => $t('Administration shortcuts'), + 'description' => $t('The Administration shortcuts menu contains commonly used links for administrative tasks.'), + ); + menu_save($menu); + + // Add starter convenience shortcuts. + menu_rebuild(); + $items = array( + 'node/add' => 'Add content', + 'admin/content' => 'Find content', + 'admin' => 'Dashboard', + ); + $weight = -20; + foreach ($items as $path => $title) { + $link = array( + 'mlid' => 0, + 'link_title' => $title, + 'link_path' => $path, + 'router_path' => $path, + 'menu_name' => 'admin_shortcuts', + 'module' => 'menu', + 'weight' => $weight, + ); + + // Check for an existing menu item before attempting to create a new one. + $menu_link = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name", array( + ':path' => $link['link_path'], + ':menu_name' => $link['menu_name'] + )) + ->fetchField(); + if (!$menu_link) { + menu_link_save($link); + } + + // Increment weight so items can be displayed in desired order. + $weight++; + } +} diff -u modules/toolbar/toolbar.module modules/toolbar/toolbar.module --- modules/toolbar/toolbar.module +++ modules/toolbar/toolbar.module @@ -38,17 +38,18 @@ function toolbar_page_build(&$page) { if (user_access('access toolbar')) { $page['page_top']['toolbar'] = toolbar_build(); + $page['page_top']['toolbar']['toolbar_drawrer'] = isset($page['toolbar_drawrer']) ? $page['toolbar_drawrer'] : array(); } } /** - * Implement hook_preprocess_page(). + * Implement hook_preprocess_html(). * * Add some page classes, so global page theming can adjust to the toolbar. */ function toolbar_preprocess_html(&$vars) { if (user_access('access toolbar')) { - $vars['classes_array'][] = 'toolbar toolbar-shortcuts'; + $vars['classes_array'][] = 'toolbar toolbar-drawrer'; } } @@ -100,15 +101,6 @@ ), '#attributes' => array('id' => 'toolbar-user'), ); - - // Add convenience shortcut links. - $shortcuts = shortcut_links(); - $build['toolbar_shortcuts'] = array( - '#theme' => 'links', - '#links' => toolbar_menu_navigation_links($shortcuts), - '#attributes' => array('id' => 'toolbar-shortcuts'), - ); - return $build; } only in patch2: unchanged: --- /dev/null +++ modules/shortcut/shortcut.css @@ -0,0 +1,35 @@ +div#toolbar div.toolbar-shortcuts ul { + padding: 5px 0; + height: 40px; + line-height: 30px; + overflow: hidden; + float: left; +} + +div#toolbar div.toolbar-shortcuts ul li a { + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding: 5px 10px 5px 5px; + margin-right: 5px; +} + +div#toolbar div.toolbar-shortcuts ul li a:focus, +div#toolbar div.toolbar-shortcuts ul li a:hover, +div#toolbar div.toolbar-shortcuts ul li a.active:focus { + background: #555; +} + +div#toolbar div.toolbar-shortcuts ul li a.active:hover, +div#toolbar div.toolbar-shortcuts ul li a.active { + background: url(toolbar.png) 0 -20px repeat-x; +} + +div#toolbar div.toolbar-shortcuts span.icon { + float: left; + background: #444; + width: 30px; + height: 30px; + margin-right: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} \ No newline at end of file only in patch2: unchanged: --- modules/toolbar/toolbar.css +++ modules/toolbar/toolbar.css @@ -4,7 +4,7 @@ body.toolbar { padding-top: 30px; } -body.toolbar-shortcuts { +body.toolbar-drawrer { padding-top: 80px; } @@ -118,49 +118,13 @@ div#toolbar div.toolbar-menu ul li a.active { } /** - * Administration shortcuts. + * Collapsed drawrer of additional toolbar content. */ -div#toolbar div.toolbar-shortcuts { +div#toolbar div.toolbar-drawrer { position: relative; padding: 0 10px; } -div#toolbar div.toolbar-shortcuts ul { - padding: 5px 0; - height: 40px; - line-height: 30px; - overflow: hidden; - float: left; -} - -div#toolbar div.toolbar-shortcuts ul li a { - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - padding: 5px 10px 5px 5px; - margin-right: 5px; -} - -div#toolbar div.toolbar-shortcuts ul li a:focus, -div#toolbar div.toolbar-shortcuts ul li a:hover, -div#toolbar div.toolbar-shortcuts ul li a.active:focus { - background: #555; -} - -div#toolbar div.toolbar-shortcuts ul li a.active:hover, -div#toolbar div.toolbar-shortcuts ul li a.active { - background: url(toolbar.png) 0 -20px repeat-x; -} - -div#toolbar div.toolbar-shortcuts span.icon { - float: left; - background: #444; - width: 30px; - height: 30px; - margin-right: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - /** * IE 6 Fixes. * @@ -168,7 +132,7 @@ div#toolbar div.toolbar-shortcuts span.icon { * the behavior of the admin toolbar entirely to static positioning. */ * html body.toolbar, -* html body.toolbar-shortcuts { +* html body.toolbar-drawrer { padding-top: 0; } only in patch2: unchanged: --- modules/toolbar/toolbar.js +++ modules/toolbar/toolbar.js @@ -10,7 +10,7 @@ Drupal.behaviors.admin = { // Set the intial state of the toolbar. $('#toolbar', context).once('toolbar', Drupal.admin.toolbar.init); - // Toggling of admin shortcuts visibility. + // Toggling toolbar drawrer. $('#toolbar span.toggle', context).once('toolbar-toggle').click(function() { Drupal.admin.toolbar.toggle(); return false; @@ -44,9 +44,9 @@ Drupal.admin.toolbar.init = function() { * Collapse the admin toolbar. */ Drupal.admin.toolbar.collapse = function() { - $('#toolbar div.toolbar-shortcuts').addClass('collapsed'); + $('#toolbar div.toolbar-drawrer').addClass('collapsed'); $('#toolbar span.toggle').removeClass('toggle-active'); - $('body').removeClass('toolbar-shortcuts'); + $('body').removeClass('toolbar-drawrer'); $.cookie( 'Drupal.admin.toolbar.collapsed', 1, @@ -58,9 +58,9 @@ Drupal.admin.toolbar.collapse = function() { * Expand the admin toolbar. */ Drupal.admin.toolbar.expand = function() { - $('#toolbar div.toolbar-shortcuts').removeClass('collapsed'); + $('#toolbar div.toolbar-drawrer').removeClass('collapsed'); $('#toolbar span.toggle').addClass('toggle-active'); - $('body').addClass('toolbar-shortcuts'); + $('body').addClass('toolbar-drawrer'); $.cookie( 'Drupal.admin.toolbar.collapsed', 0, @@ -72,7 +72,7 @@ Drupal.admin.toolbar.expand = function() { * Toggle the admin toolbar. */ Drupal.admin.toolbar.toggle = function() { - if ($('#toolbar div.toolbar-shortcuts').is('.collapsed')) { + if ($('#toolbar .toolbar-drawrer').is('.collapsed')) { Drupal.admin.toolbar.expand(); } else { only in patch2: unchanged: --- modules/toolbar/toolbar.tpl.php +++ modules/toolbar/toolbar.tpl.php @@ -8,7 +8,7 @@ * Available variables: * - $toolbar['toolbar_user']: User account / logout links. * - $toolbar['toolbar_menu']: Top level management menu links. - * - $toolbar['toolbar_shortcuts']: Convenience shortcuts. + * - $toolbar['toolbar_drawrer']: A place for extended toolbar content. * * @see template_preprocess() * @see template_preprocess_admin_toolbar() @@ -21,8 +21,8 @@ -
- +
+
only in patch2: unchanged: --- themes/seven/page.tpl.php +++ themes/seven/page.tpl.php @@ -4,6 +4,7 @@

+