diff --git a/core/modules/project_browser/css/project_browser.admin.css b/core/modules/project_browser/css/project_browser.admin.css index cef087e..5b9ce89 100644 --- a/core/modules/project_browser/css/project_browser.admin.css +++ b/core/modules/project_browser/css/project_browser.admin.css @@ -1,149 +1,130 @@ +/* -------------- Project Browser ------------- */ + #project-browser-install-button-form { clear: both; margin: 10px 0 0; } - #project-browser-install-queue { margin: 5px 0 0; } - .project-browser-install-queue-item { margin: 5px 0; } - .project-browser-install-queue-items { clear: both; margin: 0 0 15px; } - .project-browser-install-link { clear: both; } - .project-browser-install-queue-item a { - padding-left: 20px; + padding-left: 20px; /* LTR */ background: url("../images/red-x.png") no-repeat scroll left 2px transparent; } .project-browser-selected-release { display: none; } - .project-browser-show-releases-link { cursor: pointer; } +/* ------------------ List Styles ------------------ */ + div.item-list ul.project-browser-sort-list, div.item-list ul.project-browser-servers-list { margin: 0; } - div.item-list ul.project-browser-sort-list li, div.item-list ul.project-browser-servers-list li { display: inline; list-style-image: none; - margin-right: 10px; + margin-right: 10px; /* LTR */ } - div.item-list ul.project-browser-sort-list li a, div.item-list ul.project-browser-servers-list li a { - color: #0074BD; + color: #0074bd; } - div.item-list ul.project-browser-sort-list li.sort-active a, div.item-list ul.project-browser-servers-list li.server-active a { color: #000; } - div.item-list ul.project-browser-sort-list li.sort-header, div.item-list ul.project-browser-servers-list li.server-header { font-weight: bold; } - div.item-list ul.project-browser-sort-list li.sort-asc { background: url("../images/arrow-asc.png") no-repeat scroll right 2px transparent; - padding-right: 15px; + padding-right: 15px; /* LTR */ } - div.item-list ul.project-browser-sort-list li.sort-desc { background: url("../images/arrow-desc.png") no-repeat scroll right 2px transparent; - padding-right: 15px; + padding-right: 15px; /* LTR */ } a.show-more { - float: right; + float: right; /* LTR */ } +/* ------------------ Project ----------------- */ + .project-extra { clear: both; color: gray; - text-align: right; + text-align: right; /* LTR */ } - .project-author { color: gray; font-size: 0.9em; } - .project-updated { color: gray; font-size: 0.9em; } - .project-image { - float: left; - margin-right: 10px; + float: left; /* LTR */ + margin-right: 10px; /* LTR */ } - .project-image img { max-height: 150px; max-width: 200px; } - #project-browser-main ul, #project-browser-main ol { list-style-position: inside; } - .project-item { - border-top: 1px solid #E0E0D8; + border-top: 1px solid #e0e0d8; clear: both; padding: 10px; position: relative; } - .project-item-first { clear: both; padding: 10px; position: relative; } - div.project-status { position: absolute; - right: 10px; - text-align: right; + right: 10px; /* LTR */ + text-align: right; /* LTR */ top: 5px; } -div.project-information { - -} - .project-browser-install-main { padding: 10px; - float: right; + float: right; /* LTR */ width: 76%; } .install-disabled { color: gray; } - .install-enabled { color: green; } .project-browser-install-sidebar-left { - float: left; + float: left; /* LTR */ width: 19%; padding: 10px; } @@ -158,46 +139,41 @@ fieldset#edit-version { } div.install-item-prefix { - float:left; - margin-left: 50px; + float:left; /* LTR */ + margin-left: 50px; /* LTR */ } +/* -------------- Project Browser ------------- */ + #project-browser-main div.form-item-install { - float: right; + float: right; /* LTR */ } - #project-browser div.project-browser-region { min-height: 1px; } - #project-browser div#project-browser-main { width: 75%; - float: left; - margin-right: 1%; + float: left; /* LTR */ + margin-right: 1%; /* LTR */ } - #project-browser div#project-browser-sidebar-right { width: 23%; - float: right; + float: right; /* LTR */ } - #project-browser div.project_browser_block { margin-bottom: 20px; - border: 1px solid #CCCCCC; + border: 1px solid #cccccc; } - #project-browser .project-browser-region .project_browser_block { clear: both; } - #project-browser div.project_browser_block h2 { float: none; font-size: 1em; margin: 0; padding: 3px 10px; - background: none repeat scroll 0 0 #E0E0D8; + background: none repeat scroll 0 0 #e0e0d8; } - #project-browser div#project-browser-sidebar-right div.project_browser_block div.content { padding: 5px 10px; } diff --git a/core/modules/project_browser/js/project_browser_more_link.js b/core/modules/project_browser/js/project_browser_more_link.js index b57f3f7..c069083 100644 --- a/core/modules/project_browser/js/project_browser_more_link.js +++ b/core/modules/project_browser/js/project_browser_more_link.js @@ -5,38 +5,36 @@ * The project descriptions are by default trimmed to a certain height. When * the user clicks the more link, then the full text is shown. */ - (function ($) { -"use strict"; + "use strict"; -Drupal.behaviors.projectBrowserMoreLink = { - attach: function (context, settings) { - // The height of the content block when it's not expanded - var adjustheight = 80; - // The "more" link text - var moreText = Drupal.t('More'); - // The "less" link text - var lessText = Drupal.t('Less'); + Drupal.behaviors.projectBrowserMoreLink = { + attach: function (context, settings) { + // The height of the content block when it's not expanded. + var adjustHeight = 80; + // The "more" link text. + var moreText = Drupal.t('More'); + // The "less" link text. + var lessText = Drupal.t('Less'); - $(".project-information .project-description").each(function(index) { - if ($(this).height() > adjustheight) - { - $(this).css('height', adjustheight).css('overflow', 'hidden'); - $(this).parents(".project-information").append(''); - } - }); + $(".project-information .project-description").each(function(index) { + if ($(this).height() > adjustHeight) { + $(this).css('height', adjustHeight).css('overflow', 'hidden'); + $(this).parents(".project-information").append(''); + } + }); - $("a.show-more").text(moreText); + $("a.show-more").text(moreText); - $(".show-more").toggle(function() { + $(".show-more").toggle(function() { $(this).parents("div:first").find(".project-description").css('height', 'auto').css('overflow', 'visible'); $(this).text(lessText); }, function() { - $(this).parents("div:first").find(".project-description").css('height', adjustheight).css('overflow', 'hidden'); + $(this).parents("div:first").find(".project-description").css('height', adjustHeight).css('overflow', 'hidden'); $(this).text(moreText); - }); - } -}; + }); + } + }; })(jQuery); diff --git a/core/modules/project_browser/js/project_browser_select_releases.js b/core/modules/project_browser/js/project_browser_select_releases.js index 1a8cb18..05a4614 100644 --- a/core/modules/project_browser/js/project_browser_select_releases.js +++ b/core/modules/project_browser/js/project_browser_select_releases.js @@ -1,23 +1,22 @@ /** * @file - * This makes the Select Releases page show the default one and have the rest - * remain hidden until the 'Show All Releases' link is clicked + * Shows the default Select Releases page until 'Show All Releases' is clicked. */ (function ($) { -"use strict"; + "use strict"; -Drupal.behaviors.projectBrowserSelectReleases = { - attach: function (context, settings) { - $('.project-browser-releases-wrapper').hide(); - $('.project-browser-selected-release').show(); + Drupal.behaviors.projectBrowserSelectReleases = { + attach: function (context, settings) { + $('.project-browser-releases-wrapper').hide(); + $('.project-browser-selected-release').show(); - $('.project-browser-show-releases-link').click(function() { - var target = $(this).attr('rel'); - $('.project-browser-release-' + target).show(); - $('.project-browser-selected-release-' + target).hide(); - }) - } -}; + $('.project-browser-show-releases-link').click(function() { + var target = $(this).attr('rel'); + $('.project-browser-release-' + target).show(); + $('.project-browser-selected-release-' + target).hide(); + }) + } + }; })(jQuery); diff --git a/core/modules/project_browser/lib/Drupal/project_browser/Tests/ProjectBrowserTest.php b/core/modules/project_browser/lib/Drupal/project_browser/Tests/ProjectBrowserTest.php index 777b12f..b40634e 100644 --- a/core/modules/project_browser/lib/Drupal/project_browser/Tests/ProjectBrowserTest.php +++ b/core/modules/project_browser/lib/Drupal/project_browser/Tests/ProjectBrowserTest.php @@ -34,6 +34,9 @@ public static function getInfo() { ); } + /** + * Overrides \Drupal\simpletest\WebTestBase::setUp(). + */ function setUp() { parent::setUp(); diff --git a/core/modules/project_browser/project_browser.admin.inc b/core/modules/project_browser/project_browser.admin.inc index 1312598..8c42b55 100644 --- a/core/modules/project_browser/project_browser.admin.inc +++ b/core/modules/project_browser/project_browser.admin.inc @@ -6,7 +6,7 @@ */ /** - * Page callback: Form constructor for admin settings. + * Form constructor for admin settings. * * @see project_browser_menu() * @see project_browser_admin_form_submit() @@ -36,8 +36,6 @@ function project_browser_admin_form($form, &$form_state) { /** * Form submission handler for project_browser_admin_form(). - * - * @ingroup forms */ function project_browser_admin_form_submit($form, &$form_state) { $config = config('project_browser.settings'); diff --git a/core/modules/project_browser/project_browser.inc b/core/modules/project_browser/project_browser.inc index 8a5800b..8585aa0 100644 --- a/core/modules/project_browser/project_browser.inc +++ b/core/modules/project_browser/project_browser.inc @@ -163,7 +163,9 @@ function project_browser_get_sort_widget(array $sort_options, $current_sort_opti return theme('item_list', array( 'items' => $sort_list, 'type' => 'ul', - 'attributes' => array('class' => array('project-browser-sort-list')))); + 'attributes' => array('class' => array('project-browser-sort-list')), + ) + ); } /** @@ -182,7 +184,10 @@ function project_browser_get_sort_widget(array $sort_options, $current_sort_opti */ function project_browser_get_server_widget(array $servers, $current_server) { $list = array(); - $list[] = array('data' => t('Repository:'), 'class' => array('server-header')); + $list[] = array( + 'data' => t('Repository:'), + 'class' => array('server-header'), + ); $current_path = drupal_get_path_alias($_GET['q']); $i = 0; @@ -214,10 +219,11 @@ function project_browser_get_server_widget(array $servers, $current_server) { return theme('item_list', array( 'items' => $list, 'type' => 'ul', - 'attributes' => array('class' => array('project-browser-servers-list')))); + 'attributes' => array('class' => array('project-browser-servers-list')), + ) + ); } - /** * Builds and returns an array of sort options, keyed by method. * @@ -238,9 +244,21 @@ function project_browser_get_sort_options($full = FALSE) { ); if ($full) { - $sort_options['type'] = array('method' => 'type', 'name' => t('Type'), 'default_sort' => 'asc'); - $sort_options['created'] = array('method' => 'created', 'name' => t('Date created'), 'default_sort' => 'asc'); - $sort_options['latest_activity'] = array('method' => 'latest_activity', 'name' => t('Latest build'), 'default_sort' => 'desc'); + $sort_options['type'] = array( + 'method' => 'type', + 'name' => t('Type'), + 'default_sort' => 'asc', + ); + $sort_options['created'] = array( + 'method' => 'created', + 'name' => t('Date created'), + 'default_sort' => 'asc', + ); + $sort_options['latest_activity'] = array( + 'method' => 'latest_activity', + 'name' => t('Latest build'), + 'default_sort' => 'desc', + ); } return $sort_options; @@ -344,7 +362,6 @@ function _project_browser_is_project_enabled($type, $name) { $themes = list_themes(); return isset($themes[$name]); break; - } return FALSE; } diff --git a/core/modules/project_browser/project_browser.module b/core/modules/project_browser/project_browser.module index 8c2672d..fea9b61 100644 --- a/core/modules/project_browser/project_browser.module +++ b/core/modules/project_browser/project_browser.module @@ -15,15 +15,14 @@ function project_browser_help($path, $arg) { $output = ''; switch ($path) { case "admin/help#project_browser": - $output .= '

' . t("Provides a UI for users to browse for and install new modules and themes from - within their Drupal admin interface.") . '

'; + $output .= '

' . t("Provides a UI for users to browse for and install new modules and themes from within their Drupal admin interface.") . '

'; break; } return $output; } /** - * Implements hook_perm(). + * Implements hook_permission(). */ function project_browser_permission() { return array( @@ -31,7 +30,7 @@ function project_browser_permission() { 'title' => t('Use Project Browser'), 'description' => t('This allows the user to browse for and install new modules and themes using Project Browser.'), 'restrict access' => TRUE, - ) + ), ); } @@ -110,6 +109,8 @@ function project_browser_menu() { * * @return array * An array of elements that should be changed. + * + * @see project_browser_menu() */ function project_browser_install_queue_callback($method, $op, $project_name) { module_load_include('inc', 'project_browser', 'project_browser'); @@ -130,7 +131,6 @@ function project_browser_install_queue_callback($method, $op, $project_name) { case 'remove': project_browser_install_queue_remove($project_name); break; - } switch ($method) { @@ -151,7 +151,6 @@ function project_browser_install_queue_callback($method, $op, $project_name) { return array('#type' => 'ajax', '#commands' => $commands); break; - } } @@ -359,8 +358,6 @@ function project_browser_preprocess_project_browser_list(array &$variables) { default: $title = t('Projects'); - break; - } // If any filters were selected, change the title to 'Search results'. diff --git a/core/modules/project_browser/project_browser.pages.inc b/core/modules/project_browser/project_browser.pages.inc index b92c32f..1834693 100644 --- a/core/modules/project_browser/project_browser.pages.inc +++ b/core/modules/project_browser/project_browser.pages.inc @@ -126,7 +126,10 @@ function project_browser_page($type) { ); } - $build['#attached']['library'][] = array('project_browser', 'drupal.project_browser'); + $build['#attached']['library'][] = array( + 'project_browser', + 'drupal.project_browser', + ); return $build; } @@ -139,6 +142,8 @@ function project_browser_page($type) { * * @return string * A themed page from the install process, depending on the $op. + * + * @see project_browser_menu() */ function project_browser_installation_page($op) { drupal_add_library('project_browser', 'drupal.project_browser.css'); @@ -158,7 +163,6 @@ function project_browser_installation_page($op) { drupal_set_title(t("Enable modules")); $content = project_browser_installation_enable_page(); break; - } return theme('project_browser_install', array('current_task' => $op, 'main_content' => drupal_render($content))); } diff --git a/core/modules/project_browser/tests/project_browser_test.module b/core/modules/project_browser/tests/project_browser_test.module index 1fb9c5f..2ae1d7e 100644 --- a/core/modules/project_browser/tests/project_browser_test.module +++ b/core/modules/project_browser/tests/project_browser_test.module @@ -15,7 +15,7 @@ function project_browser_test_menu() { } /** - * Page callback. Generates json based on the input filters + * Page callback. Generates json based on the input filters. */ function project_browser_test_query() { if (!isset($_GET['method'])) { @@ -35,7 +35,7 @@ function project_browser_test_query() { exit(); case 'query': - // Check that we have valid data + // Check that we have valid data. if (!isset($_GET['version'])) { print drupal_json_encode(t('You must specify a drupal version.')); exit(); @@ -45,7 +45,7 @@ function project_browser_test_query() { exit(); } - // Get the filters + // Get the filters. $filters = array( 'drupal_version' => $_GET['version'], 'type' => $_GET['type'], @@ -63,7 +63,7 @@ function project_browser_test_query() { } } - // Pass them off to the project_browser_server_get_results() function + // Pass them off to the project_browser_server_get_results() function. $results = project_browser_test_get_results($filters); print drupal_json_encode($results); @@ -73,7 +73,7 @@ function project_browser_test_query() { } /** - * Returns some static categories + * Returns some static categories. */ function project_browser_test_get_categories($type) { $categories = array(); @@ -98,7 +98,7 @@ function project_browser_test_get_categories($type) { } /** - * Returns projects based on the filters + * Returns projects based on the filters. */ function project_browser_test_get_results($filters) { $projects = project_browser_test_projects(); @@ -108,7 +108,7 @@ function project_browser_test_get_results($filters) { 'projects' => array(), ); - // Filter out projects based on type + // Filter out projects based on type. if (isset($filters['type']) AND $type = $filters['type']) { foreach ($projects as $name => $project) { if ($type != $project['type']) { @@ -117,7 +117,7 @@ function project_browser_test_get_results($filters) { } } - // Filter out projects based on drupal version number + // Filter out projects based on drupal version number. if (isset($filters['drupal_version']) AND $version = $filters['drupal_version']) { foreach ($projects as $name => $project) { if ($version != $project['drupal version']) { @@ -126,7 +126,7 @@ function project_browser_test_get_results($filters) { } } - // Filter out projects based on categories number + // Filter out projects based on categories number. if (isset($filters['categories']) AND is_array($filters['categories']) AND !empty($filters['categories'])) { $filtered = array(); foreach ($projects as $name => $project) { @@ -139,7 +139,7 @@ function project_browser_test_get_results($filters) { $projects = $filtered; } - // Filter out projects based on the text query + // Filter out projects based on the text query. if (isset($filters['text']) AND $text = $filters['text']) { foreach ($projects as $name => $project) { if (!stristr($project['title'], $text) AND !stristr($project['description'], $text)) { @@ -150,7 +150,7 @@ function project_browser_test_get_results($filters) { $results['total'] = count($projects); - // Only send back the requested amount + // Only send back the requested amount. $start = $filters['page'] * $filters['requested']; $end = $start + $filters['requested']; @@ -160,7 +160,7 @@ function project_browser_test_get_results($filters) { } /** - * Returns some static projects + * Returns some static projects. */ function project_browser_test_projects() { $projects = array();