diff --git a/core/modules/project_browser/css/project_browser.admin.css b/core/modules/project_browser/css/project_browser.admin.css index cef087e..0b4e08f 100644 --- a/core/modules/project_browser/css/project_browser.admin.css +++ b/core/modules/project_browser/css/project_browser.admin.css @@ -1,203 +1,174 @@ +/* -------------- 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; + color: #000000; } - 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; } - div.project-title { font-size: 18px; } - fieldset#edit-category, fieldset#edit-version { border: none; } - 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/images/arrow-asc.png b/core/modules/project_browser/images/arrow-asc.png index a3481c9..a3ccabc 100644 --- a/core/modules/project_browser/images/arrow-asc.png +++ b/core/modules/project_browser/images/arrow-asc.png @@ -1,5 +1,5 @@ -‰PNG - - IHDR H%v?PLTEÿÿÿ···kR%»tRNS@æØfIDATc`@L L¬ Œü…LL - -Li|q)í©IEND®B`‚ \ No newline at end of file +PNG + + IHDR H%v?PLTEkR%tRNS@fIDATc`@L L LL + +Li|q)IENDB` \ No newline at end of file diff --git a/core/modules/project_browser/images/arrow-desc.png b/core/modules/project_browser/images/arrow-desc.png index 9202d71..2edbb17 100644 --- a/core/modules/project_browser/images/arrow-desc.png +++ b/core/modules/project_browser/images/arrow-desc.png @@ -1,4 +1,4 @@ -‰PNG - - IHDR H%v?PLTEÿÿÿ···kR%»tRNS@æØfIDATxœc`@õì0È`ào``g``‚ -KzHƒ“ÏIEND®B`‚ \ No newline at end of file +PNG + + IHDR H%v?PLTEkR%tRNS@fIDATxc`@0`o``g`` +KzHIENDB` \ No newline at end of file diff --git a/core/modules/project_browser/images/circle.png b/core/modules/project_browser/images/circle.png index f6f3125..6b2d63f 100644 --- a/core/modules/project_browser/images/circle.png +++ b/core/modules/project_browser/images/circle.png @@ -1,3 +1,3 @@ -‰PNG - - IHDR6|JàPLTEÿÿÿ¿¿¿‹‹‹ÀÀÀE¾Ì<tRNS@æØfIDAT[c`cfe á( $•¡b ¾¯ýºšIEND®B`‚ \ No newline at end of file +PNG + + IHDR6|JPLTEE<tRNS@fIDAT[c`cfe ( $b IENDB` \ No newline at end of file diff --git a/core/modules/project_browser/images/red-x.png b/core/modules/project_browser/images/red-x.png index ce5cedc..486390c 100644 --- a/core/modules/project_browser/images/red-x.png +++ b/core/modules/project_browser/images/red-x.png @@ -1,7 +1,7 @@ -‰PNG - - IHDRóÿaÎIDATxÚ¥“?HBQÆ£¡ rŽÄ ÚÝ#§p(2hŠÊÁAk -Ü!G£±¢èßPд�¤¤õžï…½2ISiÑŠ -ú:ï¦W_O"èÂ�s¿ïw¹ïœÛ ^�¤àg©´ÕHê^ÅÃ3ºðƒ×›T(Púû¡Øí¸±Ùpcµ"31!ÿ„hÃ>_òaf�óó Epd¦¦®ë!µðô´H›¸ °»´„¬ß¯Ñ!Õ ÈLNj M•°p7<Œ”ǃµpÙl›¡2ããLû‹‹�’Ilo#6; òª×a°!÷öâvp²Ë…r4 -u -¬Rp�NE‘Õ>òyHn÷·×lÆG.·ÃRWR “B?ì%a�<ªa2#=4Ä}”©DƒrO×u_ž TW¹XT»¡ñP¦¸jm…ÐÑÁµáóA(`%Ðx®ZZj€KjFUëtÇ‹XŒßÏ''ì;GWXž›C�W83™p~zÊo©$£B{;ÊÇÇrètêAj‰X)² |�Ç!uws£ÐÖ†òÑhÐx-=2ÂÛØ©…�𛹱Q-íriIùMéÑQùç(ÿr?6¦{Lÿ~Î_Ýͧ±ãG¼IEND®B`‚ \ No newline at end of file +PNG + + IHDRaIDATxڥ?HBQƣr #p(2hAk +!GP2ISiъ +:W_O"sw^gH^3כT(Ppc"31!h>_af Epd!H ߯! LNj Mp7<ǃpl2LIlo#6; a!vp˅r4 +u +RpNE>yHnlG.RWR B?%a<a2#=4}DrOu_ TWXTPjmA(`%xZZjKjFUtNjX'';GWXCW83p~zo$B{;rtAjX) |!uwsֆhx-=2ةQ-riIMQ(r?6{L~_ͧGIENDB` \ No newline at end of file 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..c389cf1 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,37 @@ * 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() { - $(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).text(moreText); - }); - } -}; + $(".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).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 bd09e79..6aff12b 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(); @@ -63,6 +66,7 @@ public function testProjectBrowserSearchToken() { $edit = array(); $edit['search_text'] = 'token'; $this->drupalPost('admin/modules/project-browser/modules', $edit, t('Filter')); + $this->assertResponse(200); $this->assertText('Showing 1 to'); $this->assertText('Tokens are small bits of text'); } @@ -75,6 +79,7 @@ public function testProjectBrowserGetProjects() { $edit = array(); $edit['search_text'] = ''; $this->drupalPost('admin/modules/project-browser/modules', $edit, t('Filter')); + $this->assertResponse(200); $this->assertText('Showing 1 to'); } @@ -108,4 +113,3 @@ public function testProjectBrowserAddRemoveQueue() { $this->assertNoText('Error: The project was not found.'); } } -?> 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 f17611c..c4cf222 100644 --- a/core/modules/project_browser/project_browser.inc +++ b/core/modules/project_browser/project_browser.inc @@ -5,7 +5,9 @@ * Various functions that are required by project_browser. */ +// @todo - Remove these once http://drupal.org/node/1846078 is committed. use Drupal\Core\Updater\Updater; +use Drupal\Core\FileTransfer\Local; /** * Builds the themed install list form. @@ -27,6 +29,7 @@ function project_browser_get_install_list() { * no real processing is done, we just redirect to the install/select_versions * page. * + * @see project_browser_preprocess_project_browser_install_queue() * @ingroup forms */ function project_browser_install_button_form($form, &$form_state) { @@ -119,12 +122,11 @@ function project_browser_filters_form_submit($form, &$form_state) { function project_browser_get_sort_widget(array $sort_options, $current_sort_option, $current_sort_direction) { $sort_list = array(); $sort_list[] = array( - '#markup' => t('Sort by:'), - '#wrapper_attributes' => array( - 'class' => array('sort-header'), - ), - ); - $current_path = drupal_get_path_alias(current_path()); + '#markup' => t('Sort by:'), + '#wrapper_attributes' => array( + 'class' => array('sort-header'), + ), + ); foreach ($sort_options as $sort_option) { $classes = array(); @@ -153,7 +155,7 @@ function project_browser_get_sort_widget(array $sort_options, $current_sort_opti $classes[] = 'sort-inactive'; } $sort_list[] = array( - '#markup' => l($sort_option['name'], $current_path, array('query' => $query, 'class' => array())), + '#markup' => l($sort_option['name'], current_path(), array('query' => $query, 'class' => array())), '#wrapper_attributes' => array( 'class' => $classes, ), @@ -163,7 +165,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 +186,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 +221,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 +246,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 +364,6 @@ function _project_browser_is_project_enabled($type, $name) { $themes = list_themes(); return isset($themes[$name]); break; - } return FALSE; } @@ -736,7 +755,10 @@ function project_browser_get_project_release_data(array $project) { } /** - * Uses the update module to download and install a project. + * Downloads and installs a project using the update module. + * + * @todo - Use this new method once the patch in + * http://drupal.org/node/1846078 is committed. * * @param string $url * The url of the release download. @@ -745,6 +767,7 @@ function project_browser_get_project_release_data(array $project) { * An array indicating whether or not this was successful, and an error * message if applicable. */ +/** function project_browser_download_project($url) { module_load_include('inc', 'update', 'update.manager'); module_load_include('inc', 'update', 'update.authorize'); @@ -789,6 +812,131 @@ function project_browser_download_project($url) { ); } } +*/ + +/** + * Downloads and installs a project using the update module. + * + * @param string $url + * The url of the release download. + * + * @return array + * An array indicating whether or not this was successful, and an error + * message if applicable. + */ +function project_browser_download_project($url) { + module_load_include('inc', 'update', 'update.manager'); + // Download the file. + $local_cache = update_manager_file_get($url); + if (!$local_cache) { + return array( + 'success' => FALSE, + 'message' => t('Unable to retrieve Drupal project from %url.', array('%url' => $url)), + ); + } + + // Try to extract it. + $directory = _update_manager_extract_directory(); + try { + $archive = update_manager_archive_extract($local_cache, $directory); + } + catch (Exception $e) { + return array( + 'success' => FALSE, + 'message' => $e->getMessage(), + ); + } + $files = $archive->listContents(); + if (!$files) { + return array( + 'success' => FALSE, + 'message' => t('Provided archive contains no files.'), + ); + } + + $project = strtok($files[0], '/\\'); + + $archive_errors = update_manager_archive_verify($project, $local_cache, $directory); + if (!empty($archive_errors)) { + if (!empty($archive_errors)) { + foreach ($archive_errors as $error) { + drupal_set_message(check_plain($error), 'error'); + } + } + return array( + 'success' => FALSE, + 'message' => array_shift($archive_errors), + ); + } + + // Make sure the Updater registry is loaded. + drupal_get_updaters(); + + $project_location = $directory . '/' . $project; + try { + $updater = Updater::factory($project_location); + } + catch (Exception $e) { + return array( + 'success' => FALSE, + 'message' => $e->getMessage(), + ); + } + + try { + $project_title = Updater::getProjectTitle($project_location); + } + catch (Exception $e) { + return array( + 'success' => FALSE, + 'message' => $e->getMessage(), + ); + } + + if ($updater->isInstalled()) { + return array( + 'success' => FALSE, + 'message' => t('%project is already installed.', array('%project' => $project_title)), + ); + } + + $project_real_location = drupal_realpath($project_location); + $updater_name = get_class($updater); + + if (fileowner($project_real_location) == fileowner(conf_path())) { + module_load_include('inc', 'update', 'update.authorize'); + $filetransfer = new Local(DRUPAL_ROOT); + + // Initialize some variables in the Batch API $context array. + $updater = new $updater_name($project_real_location); + + try { + if ($updater->isInstalled()) { + // This is an update. + $tasks = $updater->update($filetransfer); + } + else { + $tasks = $updater->install($filetransfer); + } + } + catch (UpdaterException $e) { + return array( + 'success' => FALSE, + 'message' => t('Error installing / updating. Error: @error', array('@error' => $e->getMessage())), + ); + } + } + else { + return array( + 'success' => FALSE, + 'message' => t('Permissions are not set up properly.'), + ); + } + + return array( + 'success' => TRUE, + ); +} /** * Installs a single release of a project during batch, for example. diff --git a/core/modules/project_browser/project_browser.info b/core/modules/project_browser/project_browser.info index 4a7d7d4..343c840 100644 --- a/core/modules/project_browser/project_browser.info +++ b/core/modules/project_browser/project_browser.info @@ -1,5 +1,5 @@ name = Project Browser -description = A Project Browser that allows users to browse for and install modules and themes from their Drupal site admin area +description = Allows users to browse for and install modules and themes. dependencies[] = update package = Core version = VERSION diff --git a/core/modules/project_browser/project_browser.module b/core/modules/project_browser/project_browser.module index 8c2672d..1550158 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, - ) + ), ); } @@ -51,7 +50,7 @@ function project_browser_menu() { $items['admin/modules/project-browser'] = array( 'title' => 'Project Browser', - 'description' => 'Browse and search for new modules', + 'description' => 'Browse and search for new modules.', 'page callback' => 'project_browser_page', 'page arguments' => array('module'), 'access arguments' => array('use project browser'), @@ -60,7 +59,7 @@ function project_browser_menu() { $items['admin/modules/project-browser/modules'] = array( 'title' => 'Modules', - 'description' => 'Browse and search for new modules', + 'description' => 'Browse and search for new modules.', 'page callback' => 'project_browser_page', 'page arguments' => array('module'), 'access arguments' => array('use project browser'), @@ -70,7 +69,7 @@ function project_browser_menu() { $items['admin/modules/project-browser/themes'] = array( 'title' => 'Themes', - 'description' => 'Browse and search for new themes', + 'description' => 'Browse and search for new themes.', 'page callback' => 'project_browser_page', 'page arguments' => array('theme'), 'access arguments' => array('use project browser'), @@ -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; - } } @@ -210,7 +209,6 @@ function project_browser_menu_local_tasks_alter(&$data, $router_item, $root_path ); } break; - } } diff --git a/core/modules/project_browser/project_browser.pages.inc b/core/modules/project_browser/project_browser.pages.inc index b92c32f..0c71028 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))); } @@ -520,7 +524,7 @@ function project_browser_installation_enable_form($form, &$form_state, array $pr } /** - * Form submission handler for project_browser_installation_enable_form() + * Form submission handler for project_browser_installation_enable_form(). * * Enables the selected projects from the enable projects form. After the * selected projects are enabled, we flush all caches and then redirect to the diff --git a/core/modules/project_browser/tests/project_browser_test.info b/core/modules/project_browser/tests/project_browser_test.info index 99c23da..543e1d0 100644 --- a/core/modules/project_browser/tests/project_browser_test.info +++ b/core/modules/project_browser/tests/project_browser_test.info @@ -1,5 +1,6 @@ -name = "Project Browser module tests" -description = "Support module for Project Browser related testing." +name = Project Browser module tests +description = Support module for Project Browser related testing. package = Testing +version = VERSION core = 8.x hidden = TRUE diff --git a/core/modules/project_browser/tests/project_browser_test.module b/core/modules/project_browser/tests/project_browser_test.module index 1fb9c5f..46b456f 100644 --- a/core/modules/project_browser/tests/project_browser_test.module +++ b/core/modules/project_browser/tests/project_browser_test.module @@ -15,7 +15,9 @@ function project_browser_test_menu() { } /** - * Page callback. Generates json based on the input filters + * Page callback: Generates json based on the input filters. + * + * @see project_browser_test_menu() */ function project_browser_test_query() { if (!isset($_GET['method'])) { @@ -35,7 +37,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 +47,7 @@ function project_browser_test_query() { exit(); } - // Get the filters + // Get the filters. $filters = array( 'drupal_version' => $_GET['version'], 'type' => $_GET['type'], @@ -63,7 +65,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 +75,13 @@ function project_browser_test_query() { } /** - * Returns some static categories + * Returns an array of static categories to use for testing. + * + * @param string $type + * The type of project, 'module' or 'theme'. + * + * @return array + * An array of categories for the project type. */ function project_browser_test_get_categories($type) { $categories = array(); @@ -98,7 +106,13 @@ function project_browser_test_get_categories($type) { } /** - * Returns projects based on the filters + * Returns an array of filtered projects. + * + * @param array $filters + * An array of filters to use. + * + * @return array + * An array of projects. */ function project_browser_test_get_results($filters) { $projects = project_browser_test_projects(); @@ -108,7 +122,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 +131,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 +140,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 +153,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 +164,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 +174,10 @@ function project_browser_test_get_results($filters) { } /** - * Returns some static projects + * Returns an array of projects to use for testing. + * + * @return array + * An array of projects. */ function project_browser_test_projects() { $projects = array(); diff --git a/core/modules/project_browser/theme/project-browser-install-queue.tpl.php b/core/modules/project_browser/theme/project-browser-install-queue.tpl.php index 12ae031..4d611ea 100644 --- a/core/modules/project_browser/theme/project-browser-install-queue.tpl.php +++ b/core/modules/project_browser/theme/project-browser-install-queue.tpl.php @@ -1,7 +1,6 @@ -
- diff --git a/core/modules/project_browser/theme/project-browser-project.tpl.php b/core/modules/project_browser/theme/project-browser-project.tpl.php new file mode 100644 index 0000000..3d5f484 --- /dev/null +++ b/core/modules/project_browser/theme/project-browser-project.tpl.php @@ -0,0 +1,58 @@ + +
+ +
+ +
+ + +
+

+ +

+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + +
+
+