diff options
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.admin.inc | 21 | ||||
-rw-r--r-- | modules/system/system.install | 39 | ||||
-rw-r--r-- | modules/system/system.module | 40 |
3 files changed, 79 insertions, 21 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index edfb2a926..9ec72a6d2 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -82,18 +82,6 @@ function system_admin_menu_block_page() { } /** - * Menu callback; Sets whether the admin menu is in compact mode or not. - * - * @param $mode - * Valid values are 'on' and 'off'. - */ -function system_admin_compact_page($mode = 'off') { - global $user; - user_save($user, array('admin_compact_mode' => ($mode == 'on'))); - drupal_goto('admin'); -} - -/** * Menu callback; prints a listing of admin tasks for each installed module. */ function system_admin_by_module() { @@ -1899,14 +1887,7 @@ function theme_admin_page($blocks) { } $output = '<div class="admin clear-block">'; - $output .= '<div class="compact-link">'; - if (system_admin_compact_mode()) { - $output .= l(t('Show descriptions'), 'admin/compact/off', array('title' => t('Expand layout to include descriptions.'))); - } - else { - $output .= l(t('Hide descriptions'), 'admin/compact/on', array('title' => t('Compress layout by hiding descriptions.'))); - } - $output .= '</div>'; + $output .= theme('system_compact_link'); foreach ($container as $id => $data) { $output .= '<div class="'. $id .' clear-block">'; diff --git a/modules/system/system.install b/modules/system/system.install index 2f70091b3..d0fd48c45 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2471,3 +2471,42 @@ function system_update_6047() { * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ + +/** + * @defgroup updates-6.x-to-7.x System updates from 6.x to 7.x + * @{ + */ + +/** + * Rename blog and forum permissions to be consistent with other content types. + */ +function system_update_7000() { + $ret = array(); + $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid"); + while ($role = db_fetch_object($result)) { + $renamed_permission = preg_replace('/(?<=^|,\ )create\ blog\ entries(?=,|$)/', 'create blog content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )edit\ own\ blog\ entries(?=,|$)/', 'edit own blog content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )edit\ any\ blog\ entry(?=,|$)/', 'edit any blog content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )delete\ own\ blog\ entries(?=,|$)/', 'delete own blog content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )delete\ any\ blog\ entry(?=,|$)/', 'delete any blog content', $role->perm); + + $renamed_permission = preg_replace('/(?<=^|,\ )create\ forum\ topics(?=,|$)/', 'create forum content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )delete\ any\ forum\ topic(?=,|$)/', 'delete any forum content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )delete\ own\ forum\ topics(?=,|$)/', 'delete own forum content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )edit\ any\ forum\ topic(?=,|$)/', 'edit any forum content', $role->perm); + $renamed_permission = preg_replace('/(?<=^|,\ )edit\ own\ forum\ topics(?=,|$)/', 'edit own forum content', $role->perm); + + if ($renamed_permission != $role->perm) { + $ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid"); + } + } + + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ + + diff --git a/modules/system/system.module b/modules/system/system.module index d3f9d6fae..67a32cee6 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -148,6 +148,7 @@ function system_theme() { 'system_powered_by' => array( 'arguments' => array('image_path' => NULL), ), + 'system_compact_link' => array(), )); } @@ -155,7 +156,14 @@ function system_theme() { * Implementation of hook_perm(). */ function system_perm() { - return array('administer site configuration', 'access administration pages', 'administer actions', 'access site reports', 'select different theme', 'administer files'); + return array( + 'administer site configuration' => t('Configure site-wide settings such as module or theme administration settings.'), + 'access administration pages' => t('View the administration panel and browse the help system.'), + 'administer actions' => t('Manage the actions defined for your site.'), + 'access site reports' => t('View reports from system logs and other status information.'), + 'select different theme' => t('Select a theme other than the default theme set by the site administrator.'), + 'administer files' => t('Manage user-uploaded files.'), + ); } /** @@ -1159,6 +1167,18 @@ function system_admin_compact_mode() { } /** + * Menu callback; Sets whether the admin menu is in compact mode or not. + * + * @param $mode + * Valid values are 'on' and 'off'. + */ +function system_admin_compact_page($mode = 'off') { + global $user; + user_save($user, array('admin_compact_mode' => ($mode == 'on'))); + drupal_goto(drupal_get_destination()); +} + +/** * Generate a list of tasks offered by a specified module. * * @param $module @@ -1875,3 +1895,21 @@ function theme_system_powered_by($image_path) { $image = theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system')); return l($image, 'http://drupal.org', array('html' => TRUE, 'absolute' => TRUE, 'external' => TRUE)); } + +/** + * Display the link to show or hide inline help descriptions. + * + * @ingroup themeable + */ +function theme_system_compact_link() { + $output = '<div class="compact-link">'; + if (system_admin_compact_mode()) { + $output .= l(t('Show descriptions'), 'admin/compact/off', array('title' => t('Expand layout to include descriptions.'), 'query' => drupal_get_destination())); + } + else { + $output .= l(t('Hide descriptions'), 'admin/compact/on', array('title' => t('Compress layout by hiding descriptions.'), 'query' => drupal_get_destination())); + } + $output .= '</div>'; + + return $output; +} |