Index: administration.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/administration/administration.module,v retrieving revision 1.24 diff -u -r1.24 administration.module --- administration.module 24 Feb 2006 19:01:10 -0000 1.24 +++ administration.module 22 Jun 2006 09:50:57 -0000 @@ -15,7 +15,7 @@ function administration_help($section) { switch ($section) { case 'admin/modules#description': - return t('Site administration dashboard.'); + return t('Site administration dashboard. Do not disable this module without first going to administration settings and clicking "deactivate menus."', array('%settings' => url('admin/settings/administration'))); case 'admin/settings/administration': return t('IMPORTANT! Before deactivating this module click the "Deactivate" button on this page. If you deactivate this module BEFORE clicking the "Deactivate" button on this page you will need to reactivate the administration module by going to url "admin/modules" and then return here and click "Deactivate".'); } @@ -24,14 +24,11 @@ * Implementation of hook_menu(). */ function administration_menu($may_cache) { - global $user; - - $items = array(); if ($may_cache) { $access = user_access('administer site configuration'); $top_path = 'sadmin'; - if (variable_get('administration_module_active', 'false') == 'true') { + if (variable_get('administration_module_active', FALSE)) { $config = administration_menu_config(); if ($config['top_path']) { $top_path = $config['top_path']; @@ -78,8 +75,15 @@ 'type' => MENU_CALLBACK ); - if (variable_get('administration_module_active', 'false') == 'true') { + if (variable_get('administration_module_active', FALSE)) { $menu_weight = -10; + // Redefine the 'admin' menu here as a callback to get rid of it in the menu + // we need to do this so 'logs' doesn't show up twice + $items[] = array( + 'path' => 'admin', + 'type' => MENU_CALLBACK + ); + foreach ($config['section'] as $section_path => $section) { if ($section['callback']) { $items[] = array( @@ -89,11 +93,11 @@ 'access' => $access, 'callback' => $section['callback'], 'callback arguments' => $section['callback arguments'], - 'type' => MENU_NORMAL_ITEM, + 'type' => ($section['callback'] == '_administration_sub_dashboard_page' ? MENU_ITEM_GROUPING : MENU_NORMAL_ITEM), 'weight' => isset($section['weight']) ? $section['weight'] : $menu_weight++, ); + $item_weight = 0; foreach ((array) $section['items'] as $item_path => $item_info) { - $item_weight = 0; if ($item_info['callback']) { $items[] = array( 'path' => $item_path, @@ -109,9 +113,25 @@ } } } + + $items[] = array( + 'path' => "$top_path/deactivate", + 'title' => t('Deactivate menus'), + 'access' => $access, + 'callback' => 'administration_deactivate_menus', + 'type' => MENU_CALLBACK, + ); + } + else { + $items[] = array( + 'path' => "$top_path/activate", + 'title' => t('Activate menus'), + 'access' => $access, + 'callback' => 'administration_activate_menus', + 'type' => MENU_CALLBACK, + ); } } - theme_add_style(drupal_get_path('module','administration') .'/administration.css'); return $items; } @@ -166,29 +186,37 @@ /** * Display the form that turns on and off the menu configuration. */ -function administration_form($edit = '') { +function administration_form() { if (!module_exist('menu')) { drupal_set_message(t('IMPORTANT! The "Menu" must be enabled BEFORE you activate this module!'), 'error'); } - if (variable_get('administration_module_active', 'false') == 'true') { + if (variable_get('administration_module_active', FALSE)) { $config = administration_menu_config(); if (function_exists('administration_form_' . variable_get('administration_config', 'default'))) { - $form = call_user_func('administration_form_' . variable_get('administration_config', 'default'), $form, $edit); + $form[variable_get('administration_config', 'default')] = call_user_func('administration_form_' . variable_get('administration_config', 'default'), $form); } - $form['buttons']['activate'] = array('#type' => 'submit', '#value' => t('Deactivate menus')); } else { $files = system_listing('\.inc$', drupal_get_path('module', 'administration'), 'name', 0); foreach ($files as $file => $info) { $options[$file] = $file; } - $form['config'] = array( + $form['administration_config'] = array( '#type' => 'radios', + '#title' => t('Configuration profile'), '#default_value' => variable_get('administration_config', 'default'), '#options' => $options, ); - $form['activate'] = array('#type' => 'submit', '#value' => t('Activate menus')); } + $form['administration_module_active'] = array( + '#type' => 'radios', + '#title' => t('Administration menus'), + '#default_value' => variable_get('administration_module_active', FALSE), + '#options' => array(t('Disabled'), t('Enabled')), + '#description' => t('Activate administration menus and dashboard.') + ); + + $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); return drupal_get_form('administration_form', $form); } @@ -197,39 +225,66 @@ * Submit function for the administration form. */ function administration_form_submit($formid, $form_values) { + // Retrieve module state before saving changes + $already_active = variable_get('administration_module_active', FALSE); - $op = isset($_POST['op']) ? $_POST['op'] : ''; - - if ($op == 'Deactivate menus') { - _administration_unset_menus(); - variable_del('administration_panels'); + if ($form_values['administration_config']) { + variable_set('administration_config', $form_values['administration_config']); } - else { - if ($op == 'Activate menus') { - variable_set('administration_config', $form_values['config']); - variable_set('administration_module_active', 'true'); - variable_set('administration_show_menu_icons', $form_values['menu_icons']); + + if ($form_values['administration_module_active']) { + if (!$already_active) { + variable_set('administration_module_active', TRUE); // force a menu_rebuild to get the right menu sections. // Yes, this means menu_rebuild is performed twice. menu_rebuild(); - _administration_set_menus(); + _administration_activate_menus(); } - else { - if (function_exists('administration_form_submit_' . variable_get('administration_config', 'default') . '')) { - call_user_func('administration_form_submit_' . variable_get('administration_config', 'default'), $formid, $form_values); - } - } - } - if (form_get_errors()) { - return administration_form($edit); } else { - //drupal_set_message(t('Changes made.')); - drupal_goto('admin/settings/administration'); + if ($already_active){ + variable_set('administration_module_active', FALSE); + _administration_deactivate_menus(); + } + } + + if (function_exists('administration_form_submit_' . variable_get('administration_config', 'default'))) { + call_user_func('administration_form_submit_' . variable_get('administration_config', 'default'), $formid, $form_values); } } /** + * Menu callback; de-activate menus + */ +function administration_deactivate_menus() { + _administration_deactivate_menus(); + drupal_goto('admin'); +} + +/** + * Menu callback; activate menus + */ +function administration_activate_menus() { + _administration_activate_menus(); + drupal_goto('sadmin'); +} + +/** + * De-activates custom menus + */ +function _administration_deactivate_menus() { + _administration_unset_menus(); + variable_del('administration_panels'); +} + +/** + * Activates custom menus + */ +function _administration_activate_menus() { + _administration_set_menus(); +} + +/** * Callback exists because we have some funky special handling with admin/settings. */ function _administration_settings_page() { @@ -291,12 +346,8 @@ function _administration_set_head() { $config = administration_menu_config(); $cssfile = $config['cssfile'] ? $config['cssfile'] : 'default.css'; - static $sent = array(); - if (!isset($sent[drupal_get_path('module','administration') . "/$cssfile"])) { - theme_add_style(drupal_get_path('module','administration') .'/' . $cssfile); - $sent[drupal_get_path('module','administration') . "/' . $cssfile . ;"] = TRUE; - } - return; + $path = drupal_get_path('module','administration') . '/'; + theme_add_style($path . $cssfile); } /** @@ -325,6 +376,9 @@ } } menu_rebuild(); + if ($config['after_build']) { + call_user_func($config['after_build'], $config); + } } /** @@ -335,9 +389,6 @@ $config = administration_menu_config(); $top_path = $config['top_path'] ? $config['top_path'] : 'sadmin'; _administration_unset_menu_item($menu['path index'][$top_path]); - db_query('DELETE FROM {menu} WHERE mid = %d', $menu['path index']['admin']); - - drupal_clear_path_cache(); menu_rebuild(); } @@ -363,7 +414,7 @@ } else { $mid = db_next_id('{menu}_mid'); - $type = MENU_CUSTOM_ITEM | MENU_MODIFIED_BY_ADMIN; + $type = MENU_NORMAL_ITEM | MENU_MODIFIED_BY_ADMIN; db_query("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)", $mid, $pid, $path, $title, $desc, $weight, $type); } return; @@ -376,12 +427,12 @@ db_query('DELETE FROM {menu} WHERE pid = %d', $pid); $menu = menu_get_menu(); - foreach ($menu['items'][$pid]['children'] as $cid) { + foreach ((array) $menu['items'][$pid]['children'] as $cid) { if (!empty($menu['items'][$cid]) && $menu['items'][$cid]['children']) { _administration_unset_menu_item($cid); } } - variable_set('administration_module_active', 'false'); + variable_set('administration_module_active', FALSE); } @@ -395,7 +446,16 @@ if (!$default_theme) { $default_theme = 'administration_sub_menu_panel'; } - $output = '
'; + $output = "
"; + $path = base_path() . drupal_get_path('module', 'administration'); + $config = administration_menu_config(); + $top_path = $config['top_path'] ? $config['top_path']: 'sadmin'; + if ($_GET['q'] == $top_path) { + $output .= " "; + } + else { + $output .= " "; + } $i = 0; $total = count($panels); foreach ($panels as $id => $panel) { Index: civicspace.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/administration/civicspace.css,v retrieving revision 1.3 diff -u -r1.3 civicspace.css --- civicspace.css 30 Jan 2006 18:28:55 -0000 1.3 +++ civicspace.css 22 Jun 2006 09:50:57 -0000 @@ -1,94 +1,285 @@ - - -div.dashboard { - font: 11px/13px "Lucida Grande", verdana, Helvetica, arial, sans-serif; - margin: 0 auto; - color: #333; - text-align: left; -} - -div.dashboard-panel { - margin: 0px 0px 0px 0px; - padding-bottom: 5px; - padding-left: 5px; - padding-right: 5px; - padding-top: 5px; -} - -div.dashboard-panel-body { +/** + * = Switch Views + */ + +#switch-views { + float: right; +} +#switch-views img { + margin-bottom: -7px; +} + +/** + * = Dashboard Style Elements + */ + +.dashboard { + margin-top: 20px; +} +.dashboard-panel { + clear: both; + margin-bottom: 10px; +} +.dashboard-panel-head { + font-size: 1.2em; + font-weight: bold; + padding-left: 55px; +} +.dashboard-panel-desc { + margin-bottom: -5px; + margin-top: 2px; + padding-left: 65px; + color: #888; +} +.dashboard ul { padding: 0; margin: 0; } +.wrapper { + padding: 1px 1px 1px 65px; + text-align: left; + margin: 0 auto; +} +.dashboard-admin { +} +.dashboard-help, +.dashboard-stats { + float: right; + /* background: url(images/dashboard-icon-manage.png) top left no-repeat; */ +} +.dashboard-help, .dashboard-admin, .dashboard-stats { + clear: none; + min-width: 49%; + width: 49%; +} +.dashboard-help-buffer, .dashboard-admin-buffer { +} +.xboxcontent { + padding: 5px 10px; +} +.xboxcontent li { + line-height: 20px; +} +.xboxcontent a { + display: block; +} +.xboxcontent .desc { + font-size: 0.85em; + padding-left: 10px; + line-height: 12px; +} + +/** + * = List arrows :: Help & Admin + */ +.dashboard-admin .xboxcontent ul { + list-style-type: none; + padding: 0; + margin: 0; +} +.dashboard-admin .xboxcontent li { + background-image: url(images/admin-arrow.png); + background-repeat: no-repeat; + background-position: 0 .4em; + padding-left: 1.2em; +} +.dashboard-help .xboxcontent ul { + list-style-type: none; + padding: 0; + margin: 0; +} +.dashboard-help .xboxcontent li { + background-image: url(images/help-arrow.png); + background-repeat: no-repeat; + background-position: 0 .4em; + padding-left: 20px; +} + +/** + * = Help - rounded corners + */ + +.dashboard-help .xsnazzy p { margin:0 10px; letter-spacing:1px; } +.dashboard-help .xsnazzy p { padding-bottom:0.5em; } +.dashboard-help .xsnazzy { background: transparent; margin: 1em 0; } + +.dashboard-help .xtop, +.dashboard-help .xbottom { + display:block; + background:transparent; + font-size:1px; +} +.dashboard-help .xb1, +.dashboard-help .xb2, +.dashboard-help .xb3, +.dashboard-help .xb4 { + display:block; + overflow:hidden; +} +.dashboard-help .xb1, +.dashboard-help .xb2, +.dashboard-help .xb3 { + height:1px; +} +.dashboard-help .xb2, +.dashboard-help .xb3, +.dashboard-help .xb4 { + background: #E4EDF6; + border-left:1px solid #E4EDF6; + border-right:1px solid #E4EDF6; +} +.dashboard-help .xb1 { margin:0 5px; background: #E4EDF6; } +.dashboard-help .xb2 { margin:0 3px; border-width:0 2px; } +.dashboard-help .xb3 { margin:0 2px; } +.dashboard-help .xb4 { height:2px; margin:0 1px; } + +.dashboard-help .xboxcontent { + display:block; + background: #E4EDF6; + border:0 solid #E4EDF6; + border-width:0 1px; +} + +/** + * = Admin - rounded corners + */ + +.dashboard-admin .xsnazzy p { margin:0 10px; letter-spacing:1px; } +.dashboard-admin .xsnazzy p { padding-bottom:0.5em; } +.dashboard-admin .xsnazzy { background: transparent; margin: 1em 0; } + +.dashboard-admin .xtop, +.dashboard-admin .xbottom { + display:block; + background:transparent; + font-size:1px; +} +.dashboard-admin .xb1, +.dashboard-admin .xb2, +.dashboard-admin .xb3, +.dashboard-admin .xb4 { + display:block; + overflow:hidden; +} +.dashboard-admin .xb1, +.dashboard-admin .xb2, +.dashboard-admin .xb3 { + height:1px; +} +.dashboard-admin .xb2, +.dashboard-admin .xb3, +.dashboard-admin .xb4 { + background: #DBF6C0; + border-left:1px solid #DBF6C0; + border-right:1px solid #DBF6C0; +} +.dashboard-admin .xb1 { margin:0 5px; background: #DBF6C0; } +.dashboard-admin .xb2 { margin:0 3px; border-width:0 2px; } +.dashboard-admin .xb3 { margin:0 2px; } +.dashboard-admin .xb4 { height:2px; margin:0 1px; } + +.dashboard-admin .xboxcontent { + display:block; + background: #DBF6C0; + border:0 solid #DBF6C0; + border-width:0 1px; +} + +/** + * = Help - rounded corners + */ + +.dashboard-stats .xsnazzy p { margin:0 10px; letter-spacing:1px; } +.dashboard-stats .xsnazzy p { padding-bottom:0.5em; } +.dashboard-stats .xsnazzy { background: transparent; margin: 1em 0; } + +.dashboard-stats .xtop, +.dashboard-stats .xbottom { + display:block; + background:transparent; + font-size:1px; +} +.dashboard-stats .xb1, +.dashboard-stats .xb2, +.dashboard-stats .xb3, +.dashboard-stats .xb4 { + display:block; + overflow:hidden; +} +.dashboard-stats .xb1, +.dashboard-stats .xb2, +.dashboard-stats .xb3 { + height:1px; +} +.dashboard-stats .xb2, +.dashboard-stats .xb3, +.dashboard-stats .xb4 { + background: #E4EDF6; + border-left:1px solid #E4EDF6; + border-right:1px solid #E4EDF6; +} +.dashboard-stats .xb1 { margin:0 5px; background: #E4EDF6; } +.dashboard-stats .xb2 { margin:0 3px; border-width:0 2px; } +.dashboard-stats .xb3 { margin:0 2px; } +.dashboard-stats .xb4 { height:2px; margin:0 1px; } + +.dashboard-stats .xboxcontent { + display:block; + background: #E4EDF6; + border:0 solid #E4EDF6; + border-width:0 1px; +} + +/* Stats output */ + +.dashboard-stats h2 { + margin-top: -5px; + margin-bottom: 5px; +} +.dashboard-stats ul { + font-size: 0.8em; + border: 1px solid #D8DBDB; + list-style: none; +} +.dashboard-stats ul li { + line-height: 1.2em; + padding: 5px; + margin: 0; + list-style: none; +} + +.dashboard-stats .stats-li-wrapper { + border: 1px solid #D8DBDB; + background-color: #fff; + margin: 5px; +} +.dashboard-stats span.stat-title { + font-weight: bold; +} +.dashboard-stats span.stat-value { + margin-top: 3px; + text-align: right; + padding-left: 3px; + width: auto; +} + +/** + * = Icons + */ + +.dashboard #features { + background: url(images/dashboard-icon-features.png) top left no-repeat; +} +.dashboard #content { + background: url(images/dashboard-icon-content.png) top left no-repeat; +} +.dashboard #build { + background: url(images/dashboard-icon-build.png) top left no-repeat; } -div.dashboard-panel-desc { - margin: 3px 0; - font-size: 10px; - line-height: 10px; - font-weight: normal; -/* text-transform: uppercase; */ - text-align: left; - color: #999; - border-bottom: 1px solid #777777; - padding: 1px 0 3px 0; - } - - -div.dashboard-panel-head { - clear: left; - font: normal 20px/18px Arial, Helvetica, sans-serif; - margin: 0 0 2px; - text-align: left; -/* text-transform: uppercase; */ - color: #0066cc; -} - -div.dashboard-panel div.dashboard-panel-body ul { - list-style: square; - list-style-image: url(images/menu-leaf.gif); - padding: 5px 15px 15px 15px; - margin: 0; -} - -div.dashboard-panel li { - padding: 2px; - margin: 0; +.dashboard #style { + background: url(images/dashboard-icon-style.png) top left no-repeat; } -div.dashboard-panel-body li a { - color:#555555; - text-decoration: underline; - font-weight: normal; +.dashboard #manage { + background: url(images/dashboard-icon-manage.png) top left no-repeat; } -div.dashboard-panel a:hover { - color:#AAAAAA; +.dashboard #mail { + background: url(images/dashboard-icon-mail.png) top left no-repeat; } -div.dashboard-panel #col1 { - float: left; - width: 50%; -} - -div.dashboard-panel #col2 { - float: left; - width: 50%; -} - -div.dashboard-panel table { - width: 100%; - margin-top: 5px; -} - - -div.dashboard-panel tr { - margin-bottom: 1em; -} -div.dashboard-panel th { - background: url(images/menu-leaf.gif) no-repeat center left; - width: 40%; - margin: 0 0 0 1em; - padding: 0 0 0em 1.5em; - text-decoration: none; - border: none; -} - -div.dashboard-panel td { - width: 1%; - margin: 0 0 0 0; - padding: 0 1em 0em 0; -} Index: civicspace.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/administration/civicspace.inc,v retrieving revision 1.13 diff -u -r1.13 civicspace.inc --- civicspace.inc 28 Feb 2006 00:15:07 -0000 1.13 +++ civicspace.inc 22 Jun 2006 09:50:58 -0000 @@ -1,4 +1,5 @@ The longer descriptive title * 'callback' => The callback to use for this section. If blank no menu entry * will be provided. - * + * * Each menu entry has * 'title' => The short title of the menu entry * 'description' => The longer desc - * 'weight' => A weight can be specified; this will override the default weight + * 'weight' => A weight can be specified; this will override the default weight * and is not recommended; the default weight will put menu items * in the order they appear in the array. */ function _administration_menu_config() { $config['cssfile'] = 'civicspace.css'; $config['default']['sub_panel_theme'] = 'cs_administration_sub_menu_panel'; + $config['after_build'] = 'cs_administration_move_module_settings'; // This is for new links so that they get the right permissions. // Kind of annoying honestly. @@ -38,6 +40,7 @@ 'admin/help' => array( 'title' => 'help', 'description' => 'Application (Module) help', + 'class' => 'dashboard-help', ), 'sadmin/features/support' => array( 'title' => 'get support', @@ -46,25 +49,35 @@ 'long-desc' => 'This exists as an example of what the long-desc will do', 'callback' => 'administration_offsite', 'callback arguments' => array('http://drupal.org/support'), + 'class' => 'dashboard-help', ), 'admin/modules' => array( 'title' => 'activate/deactivate', 'description' => 'Turn on and off applications (modules)', + 'class' => 'dashboard-admin', + 'active' => TRUE, ), - 'admin/settings' => array( + 'sadmin/modules' => array( 'title' => 'configure modules', - 'description' => "Configure my site's module settings", + 'description' => "Configure my site's application (module) settings", + 'callback' => '_administration_sub_dashboard_page', + 'class' => 'dashboard-admin', + ), + 'sadmin/style/no-link1' => array( + 'title' => 'troubleshoot your theme', + 'description' => 'Troubleshoot your theme', + 'short-desc' => 'Help page that describes best practices for troubleshooting', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://drupal.org/node/37156'), + 'class' => 'dashboard-help', ), - 'admin' => array( - 'title' => 'other', - 'description' => "Configure uncategorized items for modules", - ), - 'chat' => array( - 'title' => 'chat', - 'description' => 'Chat live to volunteers', - 'short-desc' => 'Well researched questions may be answered', + 'sadmin/features/no-link1' => array( + 'title' => t('Application categories'), + 'description' => t('Review new features and applications'), + 'short-desc' => t('Administration, Categories, Commerce/advertising, Community, Content, Content display, Evaluation/rating, Event, File management, Mail, Media, Paging, Security, Theme,User access/authentication, Utility'), 'callback' => 'administration_offsite', - 'callback arguments' => array('http://drupal.org/support'), + 'callback arguments' => array('http://drupal.org/project/Modules/category'), + 'class' => 'dashboard-help', ), ), ); @@ -81,57 +94,74 @@ 'admin/comment' => array( 'title' => 'manage comments', 'description' => "Moderate and publish comments", + 'class' => 'dashboard-admin', + ), + 'admin/node' => array( + 'title' => 'manage content', + 'description' => "Moderate, promote and manage your web pages", + 'class' => 'dashboard-admin', ), 'admin/taxonomy' => array( 'title' => 'manage categories', 'description' => "Set up and maintain your site's categories (vocabularies/taxonomy)", - ), - 'node/add' => array( - 'title' => 'create content', - 'description' => "Add new web pages (content) to your site", - ), - 'sadmin/content/no-link1' => array( - 'title' => 'apply tags', - 'description' => 'Apply tags to web pages (content)', - 'callback' => 'drupal_not_found', + 'class' => 'dashboard-admin', ), 'admin/node' => array( 'title' => 'organize', 'description' => 'Order and organize web pages (content)', + 'class' => 'dashboard-admin', ), ), ); - + $config['section']['sadmin/build'] = array( 'title' => t('build'), 'description' => t('Build your web site'), - 'long-desc' => t('Adminstering users, installing new applications, upgrading, creating menus, checking versions'), + 'long-desc' => t('Administering role permissions, installing new applications, upgrading, configuring menus'), 'callback' => '_administration_sub_dashboard_page', 'panel_theme' => 'cs_administration_menu_panel', 'sub_panel_theme' => 'cs_administration_sub_menu_panel', 'sub_panel_css' => 'dashboard', 'items' => array( 'sadmin/build/no-link2' => array( - 'title' => 'install modules', - 'description' => 'Install new modules', - 'short-desc' => 'Download module files, database install', - 'callback' => 'drupal_not_found' + 'title' => 'install new modules (applications)', + 'description' => 'Install new applications (modules)', + 'short-desc' => 'Help instructions to download application (module) files', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://drupal.org/node/17473'), + 'class' => 'dashboard-help', + ), + 'sadmin/build/no-link1' => array( + 'title' => 'upgrade site', + 'description' => 'Instructions for upgrading your site', + 'short-desc' => 'Upgrading CivicSpace, CiviCRM, database, individual modules', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://civicspacelabs.org/home/upgrade'), + 'class' => 'dashboard-help', ), 'admin/menu' => array( 'title' => 'menus', 'description' => "Create and configure menus", + 'short-desc' => "Rename menu links to be friendly to your users", + 'class' => 'dashboard-admin', + ), + 'admin/filters' => array( + 'title' => 'input formats', + 'description' => "Configure allowable input formats/input filters", + 'short-desc' => 'Configure allowable input formats/input filters such as HTML, PHP', + 'class' => 'dashboard-admin', ), 'admin/access' => array( - 'title' => 'access control', - 'description' => "Setup site security (access control to site features)", + 'title' => 'role access control', + 'description' => "Configure user role permissions", + 'short-desc' => "permissions for admins, editors, volunteers, anonymous, registered users", + 'class' => 'dashboard-admin', ), 'admin/path' => array( 'title' => 'url aliases', 'description' => "Create and manage URL aliases", - ), - 'admin/filters' => array( - 'title' => 'input formats', - 'description' => "Configure allowable input formats/input filters", + 'short-desc'=>'Readable URLs help users and search engines', + 'class' => 'dashboard-admin', ), ), ); @@ -148,29 +178,51 @@ 'admin/themes' => array( 'title' => 'themes', 'description' => "Activate/configure themes", + 'class' => 'dashboard-admin', ), 'admin/block' => array( 'title' => 'blocks', 'description' => "Activate/configure blocks", + 'short-desc' => "Configure blocks for users, pages, and webpage type", + 'class' => 'dashboard-admin', + ), + 'admin/settings/front_page' => array( + 'title' => 'front page', + 'description' => "Design front page", + 'short-desc' => "Design front page for anonymous, authenticated users", + 'class' => 'dashboard-admin', ), 'sadmin/style/no-link1' => array( - 'title' => 'fix themes', - 'description' => 'Fix theme problems', - 'callback' => 'drupal_not_found', + 'title' => 'troubleshoot your theme', + 'description' => 'Troubleshoot your theme', + 'short-desc' => 'Help page that describes best practices for troubleshooting', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://drupal.org/node/37156'), + 'class' => 'dashboard-help', + ), + 'sadmin/build/no-link3' => array( + 'title' => 'Block examples', + 'description' => 'Block examples', + 'short-desc' => 'Sample PHP for making custom blocks', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://drupal.org/node/21867'), + 'class' => 'dashboard-help', ), 'sadmin/style/no-link2' => array( 'title' => 'page layout', 'description' => 'Page layout', - 'short-desc' => 'Page layouts, front pages, number of columns', - 'callback' => 'drupal_not_found' + 'short-desc' => 'Advanced PHP examples for modifying page layouts, front pages, number of columns', + 'callback' => 'administration_offsite', + 'callback arguments' => array('http://drupal.org/node/46006'), + 'class' => 'dashboard-help', ), ), ); $config['section']['sadmin/overview'] = array( - 'title' => t('site overview'), - 'description' => t('Site overview'), - 'long-desc' => t('View site users, manage content, view system logs'), + 'title' => t('manage web site and users'), + 'description' => t('Manage web site and users'), + 'long-desc' => t('Manage web site settings, view system logs, manage users'), 'callback' => '_administration_sub_dashboard_page', 'panel_theme' => 'cs_administration_menu_panel', 'sub_panel_theme' => 'cs_administration_sub_menu_panel', @@ -179,14 +231,25 @@ 'admin/user' => array( 'title' => 'manage users', 'description' => "Change or add users", + 'class' => 'dashboard-admin', ), - 'admin/node' => array( - 'title' => 'manage content', - 'description' => "Moderate, promote and manage your web pages", + 'admin/settings' => array( + 'title' => t('site settings'), + 'description' => t('Configure site-wide settings'), + 'short-desc' => 'General settings, error handling, cache, and time zone settings', + 'callback' => 'system_site_settings', + 'class' => 'dashboard-admin', + ), + 'civicrm' => array( + 'title' => 'civicrm', + 'description' => "CiviCRM", + 'short-desc' => 'manage contact information, contact relationships, and contact activity history', + 'class' => 'dashboard-admin', ), 'admin/logs' => array( 'title' => 'logs', 'description' => "Site errors and other logs", + 'class' => 'dashboard-admin', ), ), ); @@ -200,101 +263,188 @@ 'sub_panel_theme' => 'cs_administration_sub_menu_panel', 'sub_panel_css' => 'dashboard', 'items' => array( - 'sadmin/mail/no-link1' => array( + 'admin/massmailer/list' => array( 'title' => 'mailing lists', 'description' => 'Mailing lists', - 'callback' => 'drupal_not_found', + 'class' => 'dashboard-admin', ), 'admin/aggregator' => array( 'title' => 'news feeds', 'description' => "Manage my news feeds", + 'class' => 'dashboard-admin', ), ), ); - $config['section']['sadmin/statistics'] = array( - 'title' => t('statistics'), - 'description' => t('Site Statistics'), - 'long-desc' => t('A glance at administrative statistics about your site'), - 'callback' => '_administration_sub_dashboard_page', - 'panel_theme' => 'administration_statistics', - 'sub_panel_css' => 'dashboard', - ); - - // This special one clones the system settings section so it goes into the - // right place - $config['section']['sadmin/build/settings'] = array( - 'title' => t('site settings'), - 'description' => t('Configure site-wide settings'), - 'callback' => 'system_site_settings', - ); - // overrides to repoint a couple of settings. - $config['section']['admin/settings'] = array( - 'title' => t('configure modules'), - 'description' => t("Configure my site's module settings"), - 'callback' => '_administration_settings_page', - ); - - // overrides to repoint a couple of settings. - $config['section']['admin'] = array( - 'title' => t('configure modules'), - 'description' => t("Configure uncategorized module settings"), - 'callback' => '_administration_sub_dashboard_page', - ); + //$config['section']['admin'] = array( + // 'title' => t('configure modules'), + // 'description' => t("Configure uncategorized module settings"), + // 'callback' => '_administration_sub_dashboard_page', + //); $config['dashboard']['dashboard'] = array( - 'sadmin/features', + 'sadmin/features', 'sadmin/content', 'sadmin/build', 'sadmin/style', 'sadmin/overview', 'sadmin/mail', - 'sadmin/statistics', ); return $config; } +/** + * Centralize all module settings under sadmin/modules. + * called in the 'after_build' section property. + */ +function cs_administration_move_module_settings($config) { + + // Get a list of paths already covered by the $config array + $config_paths = array(); + foreach ($config['section'] as $section_path => $section) { + if (is_array($section['items'])) { + foreach ($section['items'] as $path => $info) { + $config_paths[] = $path; + } + } + } + + // Get the current menu + $menu = menu_get_menu(); + + // Array to store module settings menu items + $module_settings = array(); + + // Loop through each menu item, checking for admin/ or + // admin/settings/ + foreach ($menu['items'] as $item) { + $path = $item['path']; + + // Check for a path like 'admin/something' + if (substr($path, 0, 6) == 'admin/') { + + // Does this path already exist in $config? If so, skip + if (in_array($path, $config_paths)) { + continue; + } + + // This bunch of stuff checks for whether: + // 1. The path starts with 'admin/settings/' and there are exactly 2 '/'s in the path + // 2. Or, there is only one '/' in the path + if ((substr($path, 0, 15) == 'admin/settings/' && substr_count($path, '/') == 2) + || (substr_count($path, '/') == 1)) { + $module_settings[$path] = $item['title']; + } + } + } + + // Check for duplicate names - thank you chx! + $duplicates = array_diff(array_keys($module_settings), array_keys(array_unique($module_settings))); + + foreach ($duplicates as $duplicate) { + // Get the title of the menu item + $title = $module_settings[$duplicate]; + + // Find all the titles that match + $paths = array_keys($module_settings, $title); + + // Change title to either module settings or module configuration, depending on path + foreach ($paths as $path) { + if ((substr($path, 0, 15) == 'admin/settings/')) { + $module_settings[$duplicate] = $title ." settings"; + } + } + } + + // Re-parent menu items + foreach ($module_settings as $path => $title) { + _administration_reparent_menu_item($path, "sadmin/modules", $title); + } + + // Need to rebuild the menu to reflect changes + menu_rebuild(); +} + function theme_cs_administration_menu_panel($path) { + static $old_class; // Just a copy of the standard one, but uses 2 columns. $config = _administration_menu_config(); $menu = menu_get_menu(); $mid = $menu['path index'][$path]; - $output .= '
'; - $output .= '
'; - $output .= $menu['items'][$mid]['description']; - $output .= '
'; - $output .= '
'; - $output .= '
'; - $output .= $config['section'][$path]['long-desc']; - $output .= '
'; - $col1 = '
    '; - $col2 = '
      '; + + // Don't render the panel if it doesn't have any child + if (empty($menu['visible'][$mid]['children'])) { + return; + } + + // Grab the title to generate a unique ID for each grouping + $title = $menu['items'][$mid]['title']; + // We only want the first word; no spaces in IDs + if ($space = strpos($title, ' ')) { + $title = substr($title, 0, $space); + } + + $output = " \n"; + $output .= "
      \n"; + $output .= "
      " . $menu['items'][$mid]['description'] . "
      \n"; + $output .= "
      \n"; + $output .= "
      ". $config['section'][$path]['long-desc'] . "
      \n"; + $output .= " \n"; + $output .= "
      \n"; $counter = 0; + if (!isset($menu['visible'][$mid]['children']) || !is_array($menu['visible'][$mid]['children'])) { + // Menus are deactivated; re-direct to admin + drupal_goto('admin'); + } + $group = array(); foreach ($menu['visible'][$mid]['children'] as $cid) { - $item = ''; - $item .= '
    • '; + $item = '
    • '; $title = !empty($menu['items'][$cid]['description']) ? $menu['items'][$cid]['description'] : $menu['items'][$cid]['title']; $item .= l($title, $menu['items'][$cid]['path'], array('title' => $menu['items'][$cid]['title'])); - $longdesc = $config['section'][$path]['items'][$menu['items'][$cid]['path']]['short-desc']; - if ($longdesc) { - $item .= " $longdesc"; + if (isset($config['section'][$path]['items'][$menu['items'][$cid]['path']]['short-desc'])) { + $longdesc = $config['section'][$path]['items'][$menu['items'][$cid]['path']]['short-desc']; + $item .= "
      $longdesc
      "; } - $item .= '
    • '; - if ($counter++ % 2 == 0) { - $col1 .= $item; + $class = $config['section'][$path]['items'][$menu['items'][$cid]['path']]['class']; + $item .= "\n"; + if (!isset($group[$class])) { + $group[$class] = $item; } else { - $col2 .= $item; + $group[$class] .= $item; } } - $col1 .= '
    '; - $col2 .= '
'; - $output .= $col1 . $col2; - $output .= '
'; - $output .= '
'; + krsort($group); + foreach($group as $class => $text) { + // Show statistics panel under "Manage web site and users" + // This goes before the 'normal' panel due to the way the CSS + // is setup. + if ($path == 'sadmin/overview') { + $output .= theme('cs_administration_statistics'); + } + if (!$class) $class = 'dashboard-admin'; + $output .= " \n"; + $output .= "
\n"; + $output .= "
\n"; + $output .= " \n"; + $output .= "
\n"; + $output .= "
    \n"; + $output .= $text; + $output .= "
\n"; + $output .= "
\n"; + $output .= " \n"; + $output .= "
\n"; + $output .= "
\n"; + $output .= " \n"; + } + $output .= "
\n"; + $output .= " \n"; + $output .= "
\n"; + $output .= " \n"; + $output .= " \n"; return $output; } @@ -305,30 +455,50 @@ $mid = menu_get_active_item(); $path = $menu['items'][$mid]['path']; - $output .= '
'; - $output .= '
'; - $output .= $menu['items'][$mid]['description']; - $output .= '
'; - $output .= '
'; - - $output .= '
'; - $output .= $config['section'][$path]['long-desc']; - $output .= '
'; + // Grab the title to generate a unique ID for each grouping + $title = $menu['items'][$mid]['title']; + // We only want the first word; no spaces in IDs + if ($space = strpos($title, ' ')) { + $title = substr($title, 0, $space); + } - $output .= '\n"; + // START copy from theme_cs_administration_menu_panel + $output .= "
\n"; + $output .= " \n"; + $output .= "
\n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + // END copy from theme_cs_administration_menu_panel return $output; } @@ -342,49 +512,65 @@ else { $mid = $menu['path index'][$path]; } - - $output .= '
'; - $output .= '
'; - $output .= $menu['items'][$mid]['description']; - $output .= '
'; - $output .= '
'; - - $output .= '
'; - $output .= $config['section'][$path]['long-desc']; - $output .= '
'; - - $output .= ''; + $output = "

Site Statistics

\n"; + $output .= " "; - if ($counter++ % 2 == 1 || $counter == $last) { - $output .= "$item\n"; + $output .= "
  • {$stat['title']}: {$stat['value']}
  • \n"; +/* if ($counter++ % 2 == 1 || $counter == $last) { + $output .= " \n"; + $output .= $item; + $output .= " \n"; $item = ""; - } + }*/ } - $output .= '
    $stat[title]$stat[value]
    '; - $output .= '
    '; - $output .= '
    '; + $output .= " \n"; return $output; } + +/** + * Formats statistics for display inside a panel. + */ +function theme_cs_administration_statistics() { + $class = 'dashboard-stats'; + $output = " \n"; + $output .= "
    \n"; + $output .= "
    \n"; + $output .= " \n"; + $output .= "
    \n"; + $output .= theme('administration_statistics_panel', cs_administration_statistics()); + $output .= "
    \n"; + $output .= " \n"; + $output .= "
    \n"; + $output .= "
    \n"; + $output .= " \n"; + return $output; +} + /** - * This function generates some basic site statistics, then sends them - * into a theme function for display. + * Retrieves statistics into an array */ -function theme_administration_statistics($path) { - $users = db_result(db_query("SELECT COUNT(*) FROM users WHERE status = 1")); +function cs_administration_statistics() { + $users = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE status = 1")); $stats['users'] = array('title' => "Users", 'value' => $users); - $nodes = db_result(db_query("SELECT COUNT(*) FROM node WHERE status = 1")); - $stats['nodes'] = array('title' => "Published Nodes", 'value' => $nodes); + $nodes = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE status = 1")); + $stats['nodes'] = array('title' => "Published web pages", 'value' => $nodes); - $comments = db_result(db_query("SELECT COUNT(*) FROM comments WHERE status = 1")); + $comments = db_result(db_query("SELECT COUNT(*) FROM {comments} WHERE status = 0")); $stats['comments'] = array('title' => "Published comments", 'value' => $comments); - $config = administration_menu_config(); - return theme('administration_statistics_panel', $stats, $path); -} + if (function_exists('memory_get_usage')) { + $memory_used = memory_get_usage(); + $stats['memory'] = array( + 'title' => t('Memory used'), + 'value' => t('%value MB', array('%value' => round($memory_used / 1024 / 1024, 2))) + ); + } -?> + return $stats; +} Index: default.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/administration/default.inc,v retrieving revision 1.23 diff -u -r1.23 default.inc --- default.inc 21 Feb 2006 01:42:12 -0000 1.23 +++ default.inc 22 Jun 2006 09:50:58 -0000 @@ -77,7 +77,7 @@ 'description' => "Configure my site's module settings", ), // NOTE: We need to give THIS menu item a different callback TOO - 'admin' => array( + 'admin/uncategorized' => array( 'title' => 'other', 'description' => "Configure uncategorized items for modules", ), @@ -251,7 +251,7 @@ ); // overrides to repoint a couple of settings. - $config['section']['admin'] = array( + $config['section']['admin/uncategorized'] = array( 'title' => t('configure modules'), 'description' => t("Configure uncategorized module settings"), 'callback' => '_administration_sub_dashboard_page', @@ -544,7 +544,7 @@ return $output; } -function administration_form_default($form, $edit = ''){ +function administration_form_default($form){ $form['default'] = array( '#type' => 'fieldset', '#title' => t('Settings for default dashboard theme'), '#collapsible' => FALSE, '#collapsed' => FALSE @@ -555,22 +555,11 @@ '#default_value' => variable_get('administration_show_menu_icons', FALSE), '#tree' => FALSE ); - $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') ); - $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') ); return $form; } function administration_form_submit_default($formid, $form_values) { - $op = isset($_POST['op']) ? $_POST['op'] : ''; - - if ($op == 'Save configuration') { - variable_set('administration_show_menu_icons', $form_values['menu_icons']); - } - else { - if ($op == 'Reset to defaults') { - variable_set('administration_show_menu_icons', FALSE); - } - } + variable_set('administration_show_menu_icons', $form_values['menu_icons']); } function _administration_get_icon_file_name($path) { @@ -697,7 +686,7 @@ $output .= '
    '; $output .= theme('table', $header, $rows); $output .= '
    '; - $output .= theme('pager', NULL, $page_size, 0, tablesort_pager()); + $output .= theme('pager', NULL, $page_size, 0); return $output; } Index: merged.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/administration/merged.inc,v retrieving revision 1.2 diff -u -r1.2 merged.inc --- merged.inc 13 Apr 2006 15:49:30 -0000 1.2 +++ merged.inc 22 Jun 2006 09:50:59 -0000 @@ -322,7 +322,7 @@ ); // overrides to repoint a couple of settings. - $config['section']['admin'] = array( + $config['section']['admin/uncategorized'] = array( 'title' => t('configure modules'), 'description' => t("Configure uncategorized module settings"), 'callback' => '_administration_sub_dashboard_page', @@ -384,7 +384,7 @@ else { if ($config['section'][$path]['menu_expandable']) $collapsible = 'collapsible'; $output .= '