From d59ba41f65a26cdd31ae9da5b847be008cd365dd Mon Sep 17 00:00:00 2001 From: Angie Byron <webchick@24967.no-reply.drupal.org> Date: Thu, 9 Oct 2008 15:15:55 +0000 Subject: [PATCH] =?UTF-8?q?#313213=20by=20maartenvg,=20G=C3=A1bor=20Hojtsy?= =?UTF-8?q?:=20Add=20a=20'title'=20attribute=20for=20permissions=20to=20al?= =?UTF-8?q?low=20for=20localization=20of=20permission=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.txt | 2 +- modules/aggregator/aggregator.module | 10 ++++- modules/block/block.module | 10 ++++- modules/blogapi/blogapi.module | 5 ++- modules/book/book.module | 20 +++++++-- modules/comment/comment.module | 20 +++++++-- modules/contact/contact.module | 10 ++++- modules/filter/filter.module | 5 ++- modules/forum/forum.module | 5 ++- modules/locale/locale.module | 10 ++++- modules/menu/menu.module | 5 ++- modules/node/node.module | 57 +++++++++++++++++++++----- modules/path/path.module | 10 ++++- modules/poll/poll.module | 15 +++++-- modules/search/search.module | 15 +++++-- modules/simpletest/simpletest.module | 5 ++- modules/statistics/statistics.module | 10 ++++- modules/system/system.module | 35 ++++++++++++---- modules/taxonomy/taxonomy.module | 5 ++- modules/translation/translation.module | 5 ++- modules/upload/upload.module | 10 ++++- modules/user/user.admin.inc | 13 ++---- modules/user/user.module | 20 +++++++-- 23 files changed, 235 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3ba1cd88cdcc..079660e8d44a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,7 +19,7 @@ Drupal 7.0, xxxx-xx-xx (development version) * Implemented drag-and-drop positioning for input format listings. * Implemented drag-and-drop positioning for language listing. * Implemented drag-and-drop positioning for poll options. - * Provided descriptions for user permissions. + * Provided descriptions and human-readable names for user permissions. * Removed comment controls for users. * Removed display order settings for comment module. Comment display order can now be customised using the Views module. diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 758c2b4dcf20..70d1538cb426 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -270,8 +270,14 @@ function _aggregator_has_categories() { */ function aggregator_perm() { return array( - 'administer news feeds' => t('Add, edit or delete news feeds that are aggregated to your site.'), - 'access news feeds' => t('View aggregated news feed items.'), + 'administer news feeds' => array( + 'title' => t('Administer news feeds'), + 'description' => t('Add, edit or delete news feeds that are aggregated to your site.'), + ), + 'access news feeds' => array( + 'title' => t('Access news feeds'), + 'description' => t('View aggregated news feed items.'), + ), ); } diff --git a/modules/block/block.module b/modules/block/block.module index 7c976ad243b9..f56e428dc94c 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -105,8 +105,14 @@ function block_theme() { */ function block_perm() { return array( - 'administer blocks' => t('Select which blocks are displayed, and arrange them on the page.'), - 'use PHP for block visibility' => t('Enter PHP code in the field for block visibility settings. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + 'administer blocks' => array( + 'title' => t('Administer blocks'), + 'description' => t('Select which blocks are displayed, and arrange them on the page.'), + ), + 'use PHP for block visibility' => array( + 'title' => t('Use PHP for block visibility'), + 'description' => t('Enter PHP code in the field for block visibility settings. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), ); } diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index 99c1bb43e17b..d49f53049c5b 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -25,7 +25,10 @@ function blogapi_help($path, $arg) { */ function blogapi_perm() { return array( - 'administer content with blog api' => t('Manage website content from external tools.'), + 'administer content with blog api' => array( + 'title' => t('Administer content with blog API'), + 'description' => t('Manage website content from external tools.'), + ), ); } diff --git a/modules/book/book.module b/modules/book/book.module index e739df143e6f..d5a2e4468747 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -41,10 +41,22 @@ function book_theme() { */ function book_perm() { return array( - 'administer book outlines' => t('Manage books through the administration panel.'), - 'create new books' => t('Add new top-level books.'), - 'add content to books' => t('Add new content and child pages to books.'), - 'access printer-friendly version' => t('View a book page and all of its sub-pages as a single document for ease of printing. Can be performance heavy.'), + 'administer book outlines' => array( + 'title' => t('Administer book outlines'), + 'description' => t('Manage books through the administration panel.'), + ), + 'create new books' => array( + 'title' => t('Create new books'), + 'description' => t('Add new top-level books.'), + ), + 'add content to books' => array( + 'title' => t('Add content to books'), + 'description' => t('Add new content and child pages to books.'), + ), + 'access printer-friendly version' => array( + 'title' => t('Access printer-friendly version'), + 'description' => t('View a book page and all of its sub-pages as a single document for ease of printing. Can be performance heavy.'), + ), ); } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 4f3e6dff9fa3..cde48a9890ef 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -241,10 +241,22 @@ function comment_node_type($op, $info) { */ function comment_perm() { return array( - 'administer comments' => t('Manage and approve comments, and configure comment administration settings.'), - 'access comments' => t('View comments attached to content.'), - 'post comments' => t('Add comments to content (approval required).'), - 'post comments without approval' => t('Add comments to content (no approval required).'), + 'administer comments' => array( + 'title' => t('Administer comments'), + 'description' => t('Manage and approve comments, and configure comment administration settings.'), + ), + 'access comments' => array( + 'title' => t('Access comments'), + 'description' => t('View comments attached to content.'), + ), + 'post comments' => array( + 'title' => t('Post comments'), + 'description' => t('Add comments to content (approval required).'), + ), + 'post comments without approval' => array( + 'title' => t('Post comments without approval'), + 'description' => t('Add comments to content (no approval required).'), + ), ); } diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 4eb82043f378..9eee7558ac3d 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -37,8 +37,14 @@ function contact_help($path, $arg) { */ function contact_perm() { return array( - 'administer site-wide contact form' => t('Configure site-wide contact form administration settings.'), - 'access site-wide contact form' => t('Send feedback to administrators via e-mail using the site-wide contact form.'), + 'administer site-wide contact form' => array( + 'title' => t('Administer site-wide contact form'), + 'description' => t('Configure site-wide contact form administration settings.'), + ), + 'access site-wide contact form' => array( + 'title' => t('Access site-wide contact form'), + 'description' => t('Send feedback to administrators via e-mail using the site-wide contact form.'), + ), ); } diff --git a/modules/filter/filter.module b/modules/filter/filter.module index c35fc9567288..64c5fc321a3d 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -146,7 +146,10 @@ function filter_admin_format_title($format) { */ function filter_perm() { return array( - 'administer filters' => t('Manage input formats and filters, and select which roles may use them. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + 'administer filters' => array( + 'title' => t('Administer filters'), + 'description' => t('Manage input formats and filters, and select which roles may use them. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), ); } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index e2bd329acdd0..1ad242382c54 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -382,7 +382,10 @@ function forum_access($op, $node, $account) { */ function forum_perm() { $perms = array( - 'administer forums' => t('Manage forums and configure forum administration settings.'), + 'administer forums' => array( + 'title' => t('Administer forums'), + 'description' => t('Manage forums and configure forum administration settings.'), + ), ); $perms += node_list_permissions('forum'); return $perms; diff --git a/modules/locale/locale.module b/modules/locale/locale.module index b48bb239fcfd..128197247276 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -190,8 +190,14 @@ function locale_inc_callback() { */ function locale_perm() { return array( - 'administer languages' => t('Manage the languages in which the website content and interface text may be displayed.'), - 'translate interface' => t('Translate the text of the website interface.'), + 'administer languages' => array( + 'title' => t('Administer languages'), + 'description' => t('Manage the languages in which the website content and interface text may be displayed.'), + ), + 'translate interface' => array( + 'title' => t('Translate the interface'), + 'description' => t('Translate the text of the website interface.'), + ), ); } diff --git a/modules/menu/menu.module b/modules/menu/menu.module index f812785d592d..55dad4e7cea6 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -38,7 +38,10 @@ function menu_help($path, $arg) { */ function menu_perm() { return array( - 'administer menu' => t('Manage menus and menu items.'), + 'administer menu' => array( + 'title' => t('Administer menu'), + 'description' => t('Manage menus and menu items.'), + ), ); } diff --git a/modules/node/node.module b/modules/node/node.module index 104c0f1c1856..0f8c5f9fd728 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1170,12 +1170,30 @@ function theme_node_log_message($log) { */ function node_perm() { $perms = array( - 'administer content types' => t('Manage content types and content type administration settings.'), - 'administer nodes' => t('Manage all website content, and bypass any content-related access control. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), - 'access content' => t('View published content.'), - 'view revisions' => t('View content revisions.'), - 'revert revisions' => t('Replace content with an older revision.'), - 'delete revisions' => t('Delete content revisions.'), + 'administer content types' => array( + 'title' => t('Administer content types'), + 'description' => t('Manage content types and content type administration settings.'), + ), + 'administer nodes' => array( + 'title' => t('Administer nodes'), + 'description' => t('Manage all website content, and bypass any content-related access control. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), + 'access content' => array( + 'title' => t('Access content'), + 'description' => t('View published content.'), + ), + 'view revisions' => array( + 'title' => t('View revisions'), + 'description' => t('View content revisions.'), + ), + 'revert revisions' => array( + 'title' => t('Revert revisions'), + 'description' => t('Replace content with an older revision.'), + ), + 'delete revisions' => array( + 'title' => t('Delete revisions'), + 'description' => t('Delete content revisions.'), + ), ); foreach (node_get_types() as $type) { @@ -2874,11 +2892,28 @@ function node_list_permissions($type) { $type = check_plain($info->type); // Build standard list of node permissions for this type. - $perms["create $type content"] = t('Create new %type_name content.', array('%type_name' => $info->name)); - $perms["edit own $type content"] = t('Edit %type_name content created by the user.', array('%type_name' => $info->name)); - $perms["edit any $type content"] = t('Edit any %type_name content, regardless of its author.', array('%type_name' => $info->name)); - $perms["delete own $type content"] = t('Delete %type_name content created by the user.', array('%type_name' => $info->name)); - $perms["delete any $type content"] = t('Delete any %type_name content, regardless of its author.', array('%type_name' => $info->name)); + $perms = array( + "create $type content" => array( + 'title' => t('Create %type_name content', array('%type_name' => $info->name)), + 'description' => t('Create new %type_name content.', array('%type_name' => $info->name)), + ), + "edit own $type content" => array( + 'title' => t('Edit own %type_name content', array('%type_name' => $info->name)), + 'description' => t('Edit %type_name content created by the user.', array('%type_name' => $info->name)), + ), + "edit any $type content" => array( + 'title' => t('Edit any %type_name content', array('%type_name' => $info->name)), + 'description' => t('Edit any %type_name content, regardless of its author.', array('%type_name' => $info->name)), + ), + "delete own $type content" => array( + 'title' => t('Delete own %type_name content', array('%type_name' => $info->name)), + 'description' => t('Delete %type_name content created by the user.', array('%type_name' => $info->name)), + ), + "delete any $type content" => array( + 'title' => t('Delete any %type_name content', array('%type_name' => $info->name)), + 'description' => t('Delete any %type_name content, regardless of its author.', array('%type_name' => $info->name)), + ), + ); return $perms; } diff --git a/modules/path/path.module b/modules/path/path.module index 78933bcb512c..f4f2a006d8e2 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -217,8 +217,14 @@ function path_form_alter(&$form, $form_state, $form_id) { */ function path_perm() { return array( - 'administer url aliases' => t('Manage URL aliases across the entire website.'), - 'create url aliases' => t('Manage URL aliases on content.'), + 'administer url aliases' => array( + 'title' => t('Administer URL aliases'), + 'description' => t('Manage URL aliases across the entire website.'), + ), + 'create url aliases' => array( + 'title' => t('Create URL aliases'), + 'description' => t('Manage URL aliases on content.'), + ), ); } diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 5d547549d6f1..5dd356f1bf5b 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -56,9 +56,18 @@ function poll_theme() { function poll_perm() { $perms = node_list_permissions('poll'); $perms += array( - 'vote on polls' => t('Cast votes on polls.'), - 'cancel own vote' => t('Retract and optionally change own votes.'), - 'inspect all votes' => t('View voting results.'), + 'vote on polls' => array( + 'title' => t('Vote on polls'), + 'description' => t('Cast votes on polls.'), + ), + 'cancel own vote' => array( + 'title' => t('Cancel own vote'), + 'description' => t('Retract and optionally change own votes.'), + ), + 'inspect all votes' => array( + 'title' => t('Inspect all votes'), + 'description' => t('View voting results.'), + ), ); return $perms; diff --git a/modules/search/search.module b/modules/search/search.module index 245c5ee339f0..e5ad72185b9c 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -142,9 +142,18 @@ function search_theme() { */ function search_perm() { return array( - 'administer search' => t('Configure search administration settings.'), - 'search content' => t('Search website content.'), - 'use advanced search' => t('Limit search results with additional criteria, such as specific content types. Could have performance implications.'), + 'administer search' => array( + 'title' => t('Administer search'), + 'description' => t('Configure search administration settings.'), + ), + 'search content' => array( + 'title' => t('Search content'), + 'description' => t('Search website content.'), + ), + 'use advanced search' => array( + 'title' => t('Use advanced search'), + 'description' => t('Limit search results with additional criteria, such as specific content types. Could have performance implications.'), + ), ); } diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 8ef584ca4679..1cc8e0bd99c1 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -35,7 +35,10 @@ function simpletest_menu() { */ function simpletest_perm() { return array( - 'administer unit tests' => t('Manage and run automated testing. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + 'administer unit tests' => array( + 'title' => t('Administer unit tests'), + 'description' => t('Manage and run automated testing. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), ); } diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index b830b20fd024..2bafc54bf441 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -84,8 +84,14 @@ function statistics_exit() { */ function statistics_perm() { return array( - 'access statistics' => t('View content access statistics.'), - 'view post access counter' => t('View the total number of times a piece of content has been accessed.'), + 'access statistics' => array( + 'title' => t('Access statistics'), + 'description' => t('View content access statistics.'), + ), + 'view post access counter' => array( + 'title' => t('View post access counter'), + 'description' => t('View the total number of times a piece of content has been accessed.'), + ), ); } diff --git a/modules/system/system.module b/modules/system/system.module index 8f533b20f8e3..2ccdbc01ad0e 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -165,13 +165,34 @@ function system_theme() { */ function system_perm() { return array( - 'administer site configuration' => t('Configure site-wide settings such as module or theme administration settings.'), - 'administer actions' => t('Manage the actions defined for your site.'), - 'administer files' => t('Manage user-uploaded files.'), - 'access administration pages' => t('View the administration panel and browse the help system.'), - '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.'), - 'block IP addresses' => t('Block IP addresses from accessing your site.'), + 'administer site configuration' => array( + 'title' => t('Administer site configuration'), + 'description' => t('Configure site-wide settings such as module or theme administration settings.'), + ), + 'administer actions' => array( + 'title' => t('Administer actions'), + 'description' => t('Manage the actions defined for your site.'), + ), + 'administer files' => array( + 'title' => t('Administer files'), + 'description' => t('Manage user-uploaded files.'), + ), + 'access administration pages' => array( + 'title' => t('Access administration pages'), + 'description' => t('View the administration panel and browse the help system.'), + ), + 'access site reports' => array( + 'title' => t('Access site reports'), + 'description' => t('View reports from system logs and other status information.'), + ), + 'select different theme' => array( + 'title' => t('Select different theme'), + 'description' => t('Select a theme other than the default theme set by the site administrator.'), + ), + 'block IP addresses' => array( + 'title' => t('Block IP addresses'), + 'description' => t('Block IP addresses from accessing your site.'), + ), ); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 97ab280e355a..03cee16a45b1 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -11,7 +11,10 @@ */ function taxonomy_perm() { return array( - 'administer taxonomy' => t('Manage taxonomy vocabularies and terms.'), + 'administer taxonomy' => array( + 'title' => t('Administer taxonomy'), + 'description' => t('Manage taxonomy vocabularies and terms.'), + ), ); } diff --git a/modules/translation/translation.module b/modules/translation/translation.module index 0f79c00e0eb1..04401aed1881 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -86,7 +86,10 @@ function _translation_tab_access($node) { */ function translation_perm() { return array( - 'translate content' => t('Translate website content.'), + 'translate content' => array( + 'title' => t('Tranlate content'), + 'description' => t('Translate website content.'), + ), ); } diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 3e4049f637d5..0c8e792275eb 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -44,8 +44,14 @@ function upload_theme() { */ function upload_perm() { return array( - 'upload files' => t('Attach images and other files to content.'), - 'view uploaded files' => t('View and download files attached to content.'), + 'upload files' => array( + 'title' => t('Upload files'), + 'description' => t('Attach images and other files to content.'), + ), + 'view uploaded files' => array( + 'title' => t('View uploaded files'), + 'description' => t('View and download files attached to content.'), + ), ); } diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 9260da77f6c4..84a1c79c26a1 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -514,18 +514,13 @@ function user_admin_perm($form_state, $rid = NULL) { if ($permissions = module_invoke($module, 'perm')) { $form['permission'][] = array( '#markup' => $module, - ); - foreach ($permissions as $perm => $description) { - // Account for permissions lacking a description. - if (is_int($perm)) { - $perm = $description; - $description = NULL; - } + ); + foreach ($permissions as $perm => $perm_item) { $options[$perm] = ''; $form['permission'][$perm] = array( '#type' => 'item', - '#markup' => t($perm), - '#description' => $hide_descriptions ? $description : NULL, + '#markup' => $perm_item['title'], + '#description' => $hide_descriptions ? $perm_item['description'] : NULL, ); foreach ($role_names as $rid => $name) { // Builds arrays for checked boxes for each role diff --git a/modules/user/user.module b/modules/user/user.module index e8d956d0fb8f..ee189ff58b3d 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -571,10 +571,22 @@ function user_is_blocked($name) { */ function user_perm() { return array( - 'administer permissions' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), - 'administer users' => t('Manage or block users, and manage their role assignments.'), - 'access user profiles' => t('View profiles of users on the site, which may contain personal information.'), - 'change own username' => t('Select a different username.'), + 'administer permissions' => array( + 'title' => t('Administer permissions'), + 'description' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), + 'administer users' => array( + 'title' => t('Administer users'), + 'description' => t('Manage or block users, and manage their role assignments.'), + ), + 'access user profiles' => array( + 'title' => t('Access user profiles'), + 'description' => t('View profiles of users on the site, which may contain personal information.'), + ), + 'change own username' => array( + 'title' => t('Change own username'), + 'description' => t('Select a different username.'), + ), ); } -- GitLab