diff --git a/.travis.yml b/.travis.yml index c06834e86a..660a274d51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,18 @@ language: php addons: artifacts: true + chrome: stable # PHP 7 php: - - 7.0 + - 7.2 -# make sure we test on latest trusty environment +# make sure we test on latest xenial environment sudo: required -dist: trusty +dist: xenial + +services: + - mysql # Cache Composer & Drush directories. cache: @@ -27,14 +31,7 @@ branches: only: - master - travis-ci - -# Firefox 47.0 is currently breaking Selenium Server -# TODO - Update from Selenium Server Standalone to alternative Marionette -# https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver -# Addons not working with Firefox. SeleniumHQ issue? Manually adding proper FF version. -addons: - chrome: stable - + # Cut down on git depth from default of 50 git: depth: 3 diff --git a/profiles/openasu/CHANGELOG.txt b/profiles/openasu/CHANGELOG.txt index 643e4dfa74..f805c517f7 100644 --- a/profiles/openasu/CHANGELOG.txt +++ b/profiles/openasu/CHANGELOG.txt @@ -1,3 +1,40 @@ +Webspark 1.70 (Texas), 2019-07-02 +--------------------------------- +- Webspark core + + * Panopoly - v1.70 + * Multiple Panopoly releases (1.68-1.70) rolled into one update; Includes updates to contrib modules. + See https://www.drupal.org/project/panopoly/releases/7.x-1.70 for more info. + +- Web standards components in webspark + + * ASU Local iSearch Directory (asu_isearch) - v1.12 + * Fixed bug where local rank weight for an affiliation couldn't be removed using the node edit form + * Added error handling to better detect field_collection-related failures + * Fixed bug where absolute URLs imported from iSearch were being rewritten + * ASU Directory Integration Reinvented (asu_dir) - v1.10.1 + * Added helpful description for the 'Use local iSearch view' option in the ASU Directory panel configs + * ASU Webspark Carousel (uto_carousel) - v1.8 + * Fixed bug where field settings summary was being returned as array instead of string + * Added flexslider dependency + +- Contrib module updates + + - Managed by Webspark + + * Views (views) - v3.23 + * Webform (webform) - v4.19 + * SMTP (smtp) - v1.7+patch (https://www.drupal.org/project/smtp/issues/2979682) + + - Managed by Panopoly + + * Chaos Tool Suite (ctools) - v1.15 + * Universally Unique Identifier (uuid) - v1.3 + * Devel (devel) - v1.7 + * Search API (search_api) - v1.26 + * Tablefield (tablefield) - v3.5 + * Media: Youtube (media_youtube) - v3.8 + Webspark 1.67 (Iowa), 2019-05-20 -------------------------------- - Webspark core diff --git a/profiles/openasu/modules/contrib/ctools/bulk_export/bulk_export.info b/profiles/openasu/modules/contrib/ctools/bulk_export/bulk_export.info index 388cd6f736..9bb3394450 100644 --- a/profiles/openasu/modules/contrib/ctools/bulk_export/bulk_export.info +++ b/profiles/openasu/modules/contrib/ctools/bulk_export/bulk_export.info @@ -3,11 +3,9 @@ description = Performs bulk exporting of data objects known about by Chaos tools core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/css/dropbutton.css b/profiles/openasu/modules/contrib/ctools/css/dropbutton.css index 376fc674d0..486ac3edaa 100644 --- a/profiles/openasu/modules/contrib/ctools/css/dropbutton.css +++ b/profiles/openasu/modules/contrib/ctools/css/dropbutton.css @@ -19,7 +19,6 @@ height: auto; position: absolute; right: 0; - text-indent: -9999px; /* LTR */ top: 0; width: 17px; } @@ -50,6 +49,7 @@ right: 6px; position: absolute; top: 0.75em; + white-space: nowrap; } .ctools-dropbutton-processed.open .ctools-twisty { diff --git a/profiles/openasu/modules/contrib/ctools/ctools.info b/profiles/openasu/modules/contrib/ctools/ctools.info index c9d0c63a50..188b55dde8 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools.info +++ b/profiles/openasu/modules/contrib/ctools/ctools.info @@ -19,9 +19,8 @@ files[] = tests/object_cache.test files[] = tests/object_cache_unit.test files[] = tests/page_tokens.test -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/ctools.module b/profiles/openasu/modules/contrib/ctools/ctools.module index 3a805808b7..62f2919230 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools.module +++ b/profiles/openasu/modules/contrib/ctools/ctools.module @@ -22,6 +22,9 @@ define('CTOOLS_API_VERSION', '2.0.9'); * simply include a dependency line in that module's info file, e.g.: * ; Requires CTools v7.x-1.4 or newer. * dependencies[] = ctools (>=1.4) + * + * @deprecated in CTools 1.15 and will be removed before CTools 2.0.0. + * Use the version provided by the drupal.org packaging system. */ define('CTOOLS_MODULE_VERSION', '7.x-1.13'); diff --git a/profiles/openasu/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/profiles/openasu/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info index 84a922fb5a..3fc355649a 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info +++ b/profiles/openasu/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info @@ -2,12 +2,10 @@ name = Custom rulesets description = Create custom, exportable, reusable access rulesets for applications like Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/profiles/openasu/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info index 4bb8943cde..c2a52df408 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info +++ b/profiles/openasu/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info @@ -1,13 +1,11 @@ name = Chaos Tools (CTools) AJAX Example description = Shows how to use the power of Chaos AJAX. package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools core = 7.x -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info b/profiles/openasu/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info index 637bf25d54..2bc73489c7 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info +++ b/profiles/openasu/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info @@ -2,12 +2,10 @@ name = Custom content panes description = Create custom, exportable, reusable content panes for applications like Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info b/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info index 40f133bc81..3f268dbc0c 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info +++ b/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info @@ -1,16 +1,14 @@ name = Chaos Tools (CTools) Plugin Example description = Shows how an external module can provide ctools plugins (for Panels, etc.). package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools dependencies[] = panels dependencies[] = page_manager dependencies[] = advanced_help core = 7.x -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc b/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc index bbabf22710..ed3ffd776e 100644 --- a/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc +++ b/profiles/openasu/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc @@ -95,6 +95,7 @@ function ctools_plugin_example_default_page_manager_pages() { 'access' => array( 'logic' => 'and', ), + 'pipeline' => 'standard', ); $display = new panels_display(); $display->layout = 'threecol_33_34_33_stacked'; @@ -154,7 +155,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->configuration = array( 'title' => 'Long Arg Visibility Block', 'body' => 'This block will be here when the argument is longer than configured arg length. It uses the \'arg_length\' access plugin to test against the length of the argument used for Simplecontext.', - 'format' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -185,7 +186,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->configuration = array( 'title' => 'Short Arg Visibility', 'body' => 'This block appears when the simplecontext argument is less than the configured length.', - 'format' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -297,7 +298,7 @@ function ctools_plugin_example_default_page_manager_pages() { item1 is %sc:item1 item2 is %sc:item2 description is %sc:description', - 'format' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -363,7 +364,7 @@ function ctools_plugin_example_default_page_manager_pages() { 'body' => 'The CTools Plugin Example module (and this panel page) are just here to demonstrate how to build CTools plugins. ', - 'format' => '2', + 'format' => 'full_html', 'substitute' => 1, ); $pane->cache = array(); @@ -408,6 +409,7 @@ function ctools_plugin_example_default_page_manager_pages() { 'css' => '', 'contexts' => array(), 'relationships' => array(), + 'pipeline' => 'standard', ); $display = new panels_display(); $display->layout = 'onecol'; @@ -428,7 +430,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->configuration = array( 'title' => 'Use this page with an argument', 'body' => 'This demo page works if you use an argument, like ctools_plugin_example/xxxxx.', - 'format' => '1', + 'format' => 'filtered_html', 'substitute' => NULL, ); $pane->cache = array(); diff --git a/profiles/openasu/modules/contrib/ctools/drush/ctools.drush.inc b/profiles/openasu/modules/contrib/ctools/drush/ctools.drush.inc index 3677b1712f..34fd4d3a57 100644 --- a/profiles/openasu/modules/contrib/ctools/drush/ctools.drush.inc +++ b/profiles/openasu/modules/contrib/ctools/drush/ctools.drush.inc @@ -452,6 +452,7 @@ function ctools_drush_export_info() { * all arg handling etc in one place. */ function ctools_drush_export_op_command() { + $args = func_get_args(); // Get all info for the current drush command. $command = drush_get_command(); $op = ''; @@ -495,7 +496,6 @@ function ctools_drush_export_op_command() { } } else { - $args = func_get_args(); // Table name should always be first arg... $table_name = array_shift($args); // Any additional args are assumed to be exportable names. diff --git a/profiles/openasu/modules/contrib/ctools/includes/dropbutton.theme.inc b/profiles/openasu/modules/contrib/ctools/includes/dropbutton.theme.inc index d69c988317..4b95ef0dfb 100644 --- a/profiles/openasu/modules/contrib/ctools/includes/dropbutton.theme.inc +++ b/profiles/openasu/modules/contrib/ctools/includes/dropbutton.theme.inc @@ -104,10 +104,10 @@ function theme_links__ctools_dropbutton($vars) { $output .= ''; diff --git a/profiles/openasu/modules/contrib/ctools/includes/export-ui.inc b/profiles/openasu/modules/contrib/ctools/includes/export-ui.inc index 1eb87ae779..72e5a2fdf1 100644 --- a/profiles/openasu/modules/contrib/ctools/includes/export-ui.inc +++ b/profiles/openasu/modules/contrib/ctools/includes/export-ui.inc @@ -333,7 +333,7 @@ function ctools_export_ui_process(&$plugin, $info) { $plugin['strings']['confirmation']['delete'] += array( 'question' => t('Are you sure you want to delete %title?'), - 'information' => t('This action will permanently remove this item from your database..'), + 'information' => t('This action will permanently remove this item from your database.'), 'success' => t('The item has been deleted.'), ); diff --git a/profiles/openasu/modules/contrib/ctools/includes/wizard.inc b/profiles/openasu/modules/contrib/ctools/includes/wizard.inc index 8b0d061c40..e0b8fbd14e 100644 --- a/profiles/openasu/modules/contrib/ctools/includes/wizard.inc +++ b/profiles/openasu/modules/contrib/ctools/includes/wizard.inc @@ -503,7 +503,7 @@ function ctools_wizard_defaults(&$form_info) { $form_info = $form_info + $defaults; // Set form callbacks if they aren't defined. foreach ($form_info['forms'] as $step => $params) { - if (!$params['form id']) { + if (empty($params['form id'])) { $form_callback = $hook . '_' . $step . '_form'; $form_info['forms'][$step]['form id'] = $form_callback; } diff --git a/profiles/openasu/modules/contrib/ctools/js/modal.js b/profiles/openasu/modules/contrib/ctools/js/modal.js index e65f51afaf..ec7b02aea3 100644 --- a/profiles/openasu/modules/contrib/ctools/js/modal.js +++ b/profiles/openasu/modules/contrib/ctools/js/modal.js @@ -378,7 +378,7 @@ } } - if (!speed) { + if (!speed && 0 !== speed) { speed = 'fast'; } @@ -555,7 +555,7 @@ // Create our content div, get the dimensions, and hide it var modalContent = $('#modalContent').css('top','-1000px'); var $modalHeader = modalContent.find('.modal-header'); - var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); + var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); @@ -588,35 +588,43 @@ $('body').unbind( 'keypress', modalEventHandler ); $('body').unbind( 'keydown', modalTabTrapHandler ); $('.close', $modalHeader).unbind('click', modalContentClose); - $('body').unbind('keypress', modalEventEscapeCloseHandler); + $(document).unbind('keydown', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); - // Set our animation parameters and use them - if ( animation == 'fadeIn' ) animation = 'fadeOut'; - if ( animation == 'slideDown' ) animation = 'slideUp'; - if ( animation == 'show' ) animation = 'hide'; + // Closing animation. + switch (animation) { + case 'fadeIn': + modalContent.fadeOut(speed, modalContentRemove); + break; - // Close the content - modalContent.hide()[animation](speed); + case 'slideDown': + modalContent.slideUp(speed, modalContentRemove); + break; - // Remove the content + case 'show': + modalContent.hide(speed, modalContentRemove); + break; + } + } + + // Remove the content. + modalContentRemove = function () { $('#modalContent').remove(); $('#modalBackdrop').remove(); - // Restore focus to where it was before opening the dialog + // Restore focus to where it was before opening the dialog. $(oldFocus).focus(); }; // Move and resize the modalBackdrop and modalContent on window resize. - modalContentResize = function(){ - + modalContentResize = function () { // Reset the backdrop height/width to get accurate document size. $('#modalBackdrop').css('height', '').css('width', ''); // Position code lifted from: // http://www.quirksmode.org/viewport/compatibility.html if (self.pageYOffset) { // all except Explorer - var wt = self.pageYOffset; + var wt = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict var wt = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers @@ -632,7 +640,7 @@ // Get where we should move content to var modalContent = $('#modalContent'); - var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); + var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); // Apply the changes diff --git a/profiles/openasu/modules/contrib/ctools/page_manager/page_manager.info b/profiles/openasu/modules/contrib/ctools/page_manager/page_manager.info index 5866138514..a56663b8d3 100644 --- a/profiles/openasu/modules/contrib/ctools/page_manager/page_manager.info +++ b/profiles/openasu/modules/contrib/ctools/page_manager/page_manager.info @@ -3,13 +3,11 @@ description = Provides a UI and API to manage pages within the site. core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION files[] = tests/head_links.test -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/page_manager/plugins/tasks/page.inc b/profiles/openasu/modules/contrib/ctools/page_manager/plugins/tasks/page.inc index 8d24d3309c..100dfd8176 100644 --- a/profiles/openasu/modules/contrib/ctools/page_manager/plugins/tasks/page.inc +++ b/profiles/openasu/modules/contrib/ctools/page_manager/plugins/tasks/page.inc @@ -261,6 +261,7 @@ function page_manager_page_theme(&$items, $task) { * creating named arguments in the path. */ function page_manager_page_execute($subtask_id) { + $func_args = func_get_args(); $page = page_manager_page_load($subtask_id); $task = page_manager_get_task($page->task); $subtask = page_manager_get_task_subtask($task, $subtask_id); @@ -268,7 +269,7 @@ function page_manager_page_execute($subtask_id) { // Turn the contexts into a properly keyed array. $contexts = array(); $args = array(); - foreach (func_get_args() as $count => $arg) { + foreach ($func_args as $count => $arg) { if (is_object($arg) && get_class($arg) == 'ctools_context') { $contexts[$arg->id] = $arg; $args[] = $arg->original_argument; @@ -430,7 +431,7 @@ function page_manager_page_save(&$page) { /** * Remove a page subtask. */ -function page_manager_page_delete($page) { +function page_manager_page_delete($page, $skip_menu_rebuild = FALSE) { $task = page_manager_get_task($page->task); if ($function = ctools_plugin_get_function($task, 'delete')) { $function($page); @@ -448,7 +449,11 @@ function page_manager_page_delete($page) { // rebuild this page again. ctools_include('export'); ctools_export_load_object_reset('page_manager_pages'); - menu_rebuild(); + // Allow menu rebuild to be skipped when calling code is deleting multiple + // pages. + if (!$skip_menu_rebuild) { + menu_rebuild(); + } } /** diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_attachments.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_attachments.inc index c55e0752d2..51c95a5e9d 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_attachments.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_attachments.inc @@ -21,7 +21,7 @@ if (module_exists('upload')) { function ctools_node_form_attachments_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Attach files'); $block->delta = 'url-path-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_author.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_author.inc index f9e9371983..86f3d73142 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_author.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_author.inc @@ -17,7 +17,7 @@ $plugin = array( function ctools_node_form_author_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Authoring information'); $block->delta = 'author-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_book.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_book.inc index af022bfd69..b7ad36bdf2 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_book.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_book.inc @@ -21,7 +21,7 @@ if (module_exists('book')) { function ctools_node_form_book_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Book outline'); $block->delta = 'book-outline'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_buttons.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_buttons.inc index 560a01e4f1..ed553a67d3 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_buttons.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_buttons.inc @@ -17,7 +17,7 @@ $plugin = array( function ctools_node_form_buttons_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = ''; $block->delta = 'buttons'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_comment.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_comment.inc index 352681cc61..eaf5c954c1 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_comment.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_comment.inc @@ -21,7 +21,7 @@ if (module_exists('comment')) { function ctools_node_form_comment_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Comment options'); $block->delta = 'comment-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_language.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_language.inc index 76ab3f8248..dfef295f51 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_language.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_language.inc @@ -17,7 +17,7 @@ $plugin = array( function ctools_node_form_language_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'language-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_log.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_log.inc index 329ea89903..aac42a6455 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_log.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_log.inc @@ -17,7 +17,7 @@ $plugin = array( function ctools_node_form_log_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Revision information'); if (isset($context->form)) { diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_menu.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_menu.inc index 576dcd4389..9b4df43452 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_menu.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_menu.inc @@ -21,7 +21,7 @@ if (module_exists('menu')) { function ctools_node_form_menu_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Menu options'); $block->delta = 'menu-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_path.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_path.inc index 9aeeba00af..262851f0ad 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_path.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_path.inc @@ -21,7 +21,7 @@ if (module_exists('path')) { function ctools_node_form_path_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('URL path options'); $block->delta = 'url-path-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_publishing.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_publishing.inc index f8b92aec9b..53b584f909 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_publishing.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_publishing.inc @@ -23,7 +23,7 @@ function ctools_node_form_publishing_content_type_render($subtype, $conf, $panel $block = new stdClass(); $block->title = t('Publishing options'); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'publishing-options'; if (isset($context->form)) { diff --git a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_title.inc b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_title.inc index 2f58ee309e..14e79abae8 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_title.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/content_types/node_form/node_form_title.inc @@ -17,7 +17,7 @@ $plugin = array( function ctools_node_form_title_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'title-options'; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/contexts/user.inc b/profiles/openasu/modules/contrib/ctools/plugins/contexts/user.inc index 362cfe3b12..bbdbd1a274 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/contexts/user.inc +++ b/profiles/openasu/modules/contrib/ctools/plugins/contexts/user.inc @@ -152,6 +152,7 @@ function ctools_context_user_settings_form_submit($form, &$form_state) { */ function ctools_context_user_convert_list() { $tokens = token_info(); + $list = array(); foreach ($tokens['tokens']['user'] as $id => $info) { if (!isset($list[$id])) { $list[$id] = $info['name']; diff --git a/profiles/openasu/modules/contrib/ctools/plugins/export_ui/ctools_export_ui.class.php b/profiles/openasu/modules/contrib/ctools/plugins/export_ui/ctools_export_ui.class.php index 3e1aed4bae..0c8145e4bf 100644 --- a/profiles/openasu/modules/contrib/ctools/plugins/export_ui/ctools_export_ui.class.php +++ b/profiles/openasu/modules/contrib/ctools/plugins/export_ui/ctools_export_ui.class.php @@ -644,6 +644,7 @@ public function redirect($op, $item = NULL) { } public function add_page($js, $input, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('add'), PASS_THROUGH); // If a step not set, they are trying to create a new item. If a step @@ -666,7 +667,7 @@ public function add_page($js, $input, $step = NULL) { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -681,6 +682,7 @@ public function add_page($js, $input, $step = NULL) { * Main entry point to edit an item. */ public function edit_page($js, $input, $item, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('edit', $item), PASS_THROUGH); // Check to see if there is a cached item to get if we're using the wizard. @@ -702,7 +704,7 @@ public function edit_page($js, $input, $item, $step = NULL) { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -717,6 +719,7 @@ public function edit_page($js, $input, $item, $step = NULL) { * Main entry point to clone an item. */ public function clone_page($js, $input, $original, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('clone', $original), PASS_THROUGH); // If a step not set, they are trying to create a new clone. If a step @@ -756,7 +759,7 @@ public function clone_page($js, $input, $original, $step = NULL) { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -1237,6 +1240,7 @@ public function export_page($js, $input, $item) { * Page callback to import information for an exportable item. */ public function import_page($js, $input, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('import'), PASS_THROUGH); // Import is basically a multi step wizard form, so let's go ahead and // use CTools' wizard.inc for it. @@ -1261,7 +1265,7 @@ public function import_page($js, $input, $step = NULL) { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); // import always uses the wizard. diff --git a/profiles/openasu/modules/contrib/ctools/stylizer/stylizer.info b/profiles/openasu/modules/contrib/ctools/stylizer/stylizer.info index f8b442e497..90204a3def 100644 --- a/profiles/openasu/modules/contrib/ctools/stylizer/stylizer.info +++ b/profiles/openasu/modules/contrib/ctools/stylizer/stylizer.info @@ -2,13 +2,11 @@ name = Stylizer description = Create custom styles for applications such as Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools dependencies[] = color -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/term_depth/term_depth.info b/profiles/openasu/modules/contrib/ctools/term_depth/term_depth.info index 326b2aef3c..4baee51d89 100644 --- a/profiles/openasu/modules/contrib/ctools/term_depth/term_depth.info +++ b/profiles/openasu/modules/contrib/ctools/term_depth/term_depth.info @@ -3,11 +3,9 @@ description = Controls access to context based upon term depth core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/tests/ctools_export_test/ctools_export_test.info b/profiles/openasu/modules/contrib/ctools/tests/ctools_export_test/ctools_export_test.info index 7abac58cb4..a2d0efbd92 100644 --- a/profiles/openasu/modules/contrib/ctools/tests/ctools_export_test/ctools_export_test.info +++ b/profiles/openasu/modules/contrib/ctools/tests/ctools_export_test/ctools_export_test.info @@ -2,15 +2,13 @@ name = CTools export test description = CTools export test module core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools hidden = TRUE files[] = ctools_export.test -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/tests/ctools_plugin_test.info b/profiles/openasu/modules/contrib/ctools/tests/ctools_plugin_test.info index 649e8912bf..d51a526148 100644 --- a/profiles/openasu/modules/contrib/ctools/tests/ctools_plugin_test.info +++ b/profiles/openasu/modules/contrib/ctools/tests/ctools_plugin_test.info @@ -1,14 +1,12 @@ name = Chaos tools plugins test description = Provides hooks for testing ctools plugins. package = Chaos tool suite -version = CTOOLS_MODULE_VERSION core = 7.x dependencies[] = ctools hidden = TRUE -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/ctools/views_content/plugins/relationships/node_from_view.inc b/profiles/openasu/modules/contrib/ctools/views_content/plugins/relationships/node_from_view.inc index 0f3fa8e0a8..f54cbc6b5f 100644 --- a/profiles/openasu/modules/contrib/ctools/views_content/plugins/relationships/node_from_view.inc +++ b/profiles/openasu/modules/contrib/ctools/views_content/plugins/relationships/node_from_view.inc @@ -33,7 +33,7 @@ function views_content_node_from_view_context($context, $conf, $placeholder = FA views_content_context_get_output($context); $row = intval($conf['row']) - 1; - if (isset($view->result[$row])) { + if (isset($view->result[$row]) && isset($view->base_field) && isset($view->result[$row]->{$view->base_field})) { $nid = $view->result[$row]->{$view->base_field}; if ($nid) { $node = node_load($nid); diff --git a/profiles/openasu/modules/contrib/ctools/views_content/views_content.info b/profiles/openasu/modules/contrib/ctools/views_content/views_content.info index 254d474b80..68f4d87568 100644 --- a/profiles/openasu/modules/contrib/ctools/views_content/views_content.info +++ b/profiles/openasu/modules/contrib/ctools/views_content/views_content.info @@ -5,14 +5,12 @@ dependencies[] = ctools dependencies[] = views core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION files[] = plugins/views/views_content_plugin_display_ctools_context.inc files[] = plugins/views/views_content_plugin_display_panel_pane.inc files[] = plugins/views/views_content_plugin_style_ctools_context.inc -; Information added by Drupal.org packaging script on 2018-02-24 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1519455788" - +datestamp = "1549603691" diff --git a/profiles/openasu/modules/contrib/devel/README.txt b/profiles/openasu/modules/contrib/devel/README.txt index 194fcbf57f..217d1401e6 100644 --- a/profiles/openasu/modules/contrib/devel/README.txt +++ b/profiles/openasu/modules/contrib/devel/README.txt @@ -1,13 +1,32 @@ -README.txt -========== +README.txt for Devel module +--------------------------- -A module containing helper functions for Drupal developers and -inquisitive admins. This module can print a log of -all database queries for each page request at the bottom of each page. The -summary includes how many times each query was executed on a page, and how long -each query took. +CONTENTS OF THIS FILE +--------------------- - It also offers + * Introduction + * Requirements + * Included Modules and Features + * Recommended Modules + * Installation + * Compatibility Notes + * Maintainers + +INTRODUCTION +------------ + +A module containing helper functions for Drupal developers and inquisitive +admins. This module can print a log of all database queries for each page +request at the bottom of each page. The summary includes how many times each +query was executed on a page, and how long each query took. + + - For a full description of the module visit: + https://www.drupal.org/project/devel + + - To submit bug reports and feature suggestions, or to track changes visit: + https://www.drupal.org/project/issues/devel + +It also offers - a block for running custom PHP on a page - a block for quickly accessing devel pages - a block for masquerading as other users (useful for testing) @@ -15,45 +34,74 @@ each query took. - A mail-system class which redirects outbound email to files - more - This module is safe to use on a production site. Just be sure to only grant - 'access development information' permission to developers. +This module is safe to use on a production site. Just be sure to only grant +'access development information' permission to developers. Also a dpr() function is provided, which pretty prints arrays and strings. Useful during development. Many other nice functions like dpm(), dvm(). AJAX developers in particular ought to install FirePHP Core from -http://www.firephp.org/ and put it in the devel directory. You may -use the devel-download drush command to download the library. If downloading by hand, -your path to fb.php should look like devel/FirePHPCore/lib/FirePHPCore/fb.php. -You can use svn checkout http://firephp.googlecode.com/svn/trunk/trunk/Libraries/FirePHPCore. +http://www.firephp.org/ and put it in the devel directory. You may use the +devel-download drush command to download the library. If downloading by hand, +your path to fb.php should look like +devel/FirePHPCore/lib/FirePHPCore/fb.php. You can use svn checkout +http://firephp.googlecode.com/svn/trunk/trunk/Libraries/FirePHPCore. Then you can log php variables to the Firebug console. Is quite useful. + +REQUIREMENTS +------------ + +This module requires no modules outside of Drupal core. + + +INCLUDED MODULES AND FEATURES +----------------------------- + Included in this package is also: -- devel_node_access module which prints out the node_access records for a given node. Also offers hook_node_access_explain for all node access modules to implement. Handy. -- devel_generate.module which bulk creates nodes, users, comment, terms for development. + - Devel Node Access module - Prints out the node_access records for a given + node. Also offers hook_node_access_explain for all node access modules to + implement. Handy. + - Devel Generate module - Bulk creates nodes, users, comment, terms for + development. -Some nifty drush integration ships with devel and devel_generate. See drush help for details. +Some nifty drush integration ships with Devel and Devel Generate. See drush help +for details. + +DRUSH UNIT TEST - See develDrushTest.php for an example of unit testing of the +Drush integration. This uses Drush's own test framework, based on PHPUnit. To +run the tests, use +phpunit --bootstrap=/path/to/drush/tests/drush_testcase.inc. Note that we must +name a file under /tests there. + + +RECOMMENDED MODULE +------------------ + +Devel Generate Extensions - Devel Images Provider allows to configure external +providers for images. + + - http://drupal.org/project/devel_image_provider + + +INSTALLATION +------------ + + - Install the Devel module as you would normally install a contributed Drupal + module. Visit https://www.drupal.org/node/895232 for further information. -DEVEL GENERATE EXTENSIONS -========================= -Devel Images Provider [http://drupal.org/project/devel_image_provider] allows to configure external providers for images. COMPATIBILITY NOTES -================== +------------------- + - Modules that use AHAH may have incompatibility with the query log and other - footer info. Consider setting $GLOBALS['devel_shutdown'] = FALSE if you run into - any issues. + footer info. Consider setting $GLOBALS['devel_shutdown'] = FALSE if you run + into any issues. -DRUSH UNIT TEST -================== -See develDrushTest.php for an example of unit testing of the Drush integration. -This uses Drush's own test framework, based on PHPUnit. To run the tests, use -phpunit --bootstrap=/path/to/drush/tests/drush_testcase.inc. Note that we must name a file -under /tests there. AUTHOR/MAINTAINER -====================== --moshe weitzman -http://cyrve.com -Hans Salvisberg +----------------- + + - Moshe Weitzman (moshe weitzman) - https://www.drupal.org/u/moshe-weitzman + - Hans Salvisberg (salvis) - https://www.drupal.org/u/salvis diff --git a/profiles/openasu/modules/contrib/devel/devel.info b/profiles/openasu/modules/contrib/devel/devel.info index f6defe61d6..c9747d234b 100644 --- a/profiles/openasu/modules/contrib/devel/devel.info +++ b/profiles/openasu/modules/contrib/devel/devel.info @@ -7,8 +7,8 @@ tags[] = developer files[] = devel.test files[] = devel.mail.inc -; Information added by Drupal.org packaging script on 2018-04-18 -version = "7.x-1.6" +; Information added by Drupal.org packaging script on 2019-02-22 +version = "7.x-1.7" core = "7.x" project = "devel" -datestamp = "1524009787" +datestamp = "1550852892" diff --git a/profiles/openasu/modules/contrib/devel/devel.module b/profiles/openasu/modules/contrib/devel/devel.module index 719088d65f..ebbbd02dcb 100644 --- a/profiles/openasu/modules/contrib/devel/devel.module +++ b/profiles/openasu/modules/contrib/devel/devel.module @@ -355,6 +355,21 @@ function devel_menu_need_destination() { 'devel/variable', 'admin/reports/status/run-cron'); } +/** + * Returns list of paths which need CSRF token protection. + * + * @return array + * An associative array in which every item is composed in the following way: + * - key: path which need token protection. + * - value: additional value used for generate the token. + */ +function devel_menu_need_token_protection() { + return array( + 'devel/cache/clear' => 'devel-cache-clear', + 'devel/run-cron' => 'run-cron', + ); +} + /** * Implements hook_menu_link_alter(). * @@ -364,7 +379,7 @@ function devel_menu_need_destination() { * @see devel_translated_menu_link_alter() */ function devel_menu_link_alter(&$item) { - if (in_array($item['link_path'], devel_menu_need_destination()) || $item['link_path'] == 'devel/menu/item') { + if (in_array($item['link_path'], devel_menu_need_destination()) || array_key_exists($item['link_path'], devel_menu_need_token_protection()) || $item['link_path'] == 'devel/menu/item') { $item['options']['alter'] = TRUE; } } @@ -372,11 +387,22 @@ function devel_menu_link_alter(&$item) { /** * Implements hook_translated_menu_item_alter(). * - * Append dynamic querystring 'destination' to several of our own menu items. + * Append dynamic querystring 'destination' or 'token' (csfr protection) to + * several of our own menu items. */ function devel_translated_menu_link_alter(&$item) { - if (in_array($item['href'], devel_menu_need_destination())) { - $item['localized_options']['query'] = drupal_get_destination(); + $need_destination = in_array($item['href'], devel_menu_need_destination()); + + $token_protection = devel_menu_need_token_protection(); + $need_token = array_key_exists($item['href'], $token_protection); + + if ($need_destination || $need_token) { + if ($need_destination) { + $item['localized_options']['query'] = drupal_get_destination(); + } + if ($need_token) { + $item['localized_options']['query']['token'] = drupal_get_token($token_protection[$item['href']]); + } } elseif ($item['href'] == 'devel/menu/item') { $item['localized_options']['query'] = array('path' => $_GET['q']); diff --git a/profiles/openasu/modules/contrib/devel/devel.pages.inc b/profiles/openasu/modules/contrib/devel/devel.pages.inc index f24777fe3f..c93eda53bc 100644 --- a/profiles/openasu/modules/contrib/devel/devel.pages.inc +++ b/profiles/openasu/modules/contrib/devel/devel.pages.inc @@ -35,6 +35,10 @@ function devel_function_reference() { * Page callback: Clears all caches, then redirects to the previous page. */ function devel_cache_clear() { + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'devel-cache-clear')) { + return MENU_ACCESS_DENIED; + } + drupal_flush_all_caches(); drupal_set_message('Cache cleared.'); diff --git a/profiles/openasu/modules/contrib/devel/devel_generate/devel_generate.info b/profiles/openasu/modules/contrib/devel/devel_generate/devel_generate.info index 841d93ac41..477d935409 100644 --- a/profiles/openasu/modules/contrib/devel/devel_generate/devel_generate.info +++ b/profiles/openasu/modules/contrib/devel/devel_generate/devel_generate.info @@ -6,8 +6,8 @@ tags[] = developer configure = admin/config/development/generate files[] = devel_generate.test -; Information added by Drupal.org packaging script on 2018-04-18 -version = "7.x-1.6" +; Information added by Drupal.org packaging script on 2019-02-22 +version = "7.x-1.7" core = "7.x" project = "devel" -datestamp = "1524009787" +datestamp = "1550852892" diff --git a/profiles/openasu/modules/contrib/devel/devel_krumo.js b/profiles/openasu/modules/contrib/devel/devel_krumo.js index 28f01cea80..e55780a377 100644 --- a/profiles/openasu/modules/contrib/devel/devel_krumo.js +++ b/profiles/openasu/modules/contrib/devel/devel_krumo.js @@ -31,7 +31,7 @@ Drupal.behaviors.devel = { $('.krumo-child > div:first-child', context).once('krumo_path', function() { - $('.krumo-child > div:first-child', context).dblclick( + $(this).dblclick( function(e) { if ($(this).find('> .krumo-php-path').length > 0) { // Remove path if shown. diff --git a/profiles/openasu/modules/contrib/devel/devel_node_access.info b/profiles/openasu/modules/contrib/devel/devel_node_access.info index 134932c2bf..bd790b23d6 100644 --- a/profiles/openasu/modules/contrib/devel/devel_node_access.info +++ b/profiles/openasu/modules/contrib/devel/devel_node_access.info @@ -6,8 +6,8 @@ core = 7.x configure = admin/config/development/devel tags[] = developer -; Information added by Drupal.org packaging script on 2018-04-18 -version = "7.x-1.6" +; Information added by Drupal.org packaging script on 2019-02-22 +version = "7.x-1.7" core = "7.x" project = "devel" -datestamp = "1524009787" +datestamp = "1550852892" diff --git a/profiles/openasu/modules/contrib/devel/krumo/class.krumo.php b/profiles/openasu/modules/contrib/devel/krumo/class.krumo.php index ec31a0aaf3..8276f744f8 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/class.krumo.php +++ b/profiles/openasu/modules/contrib/devel/krumo/class.krumo.php @@ -1036,7 +1036,7 @@
- + (Recursion)
diff --git a/profiles/openasu/modules/contrib/devel/krumo/skins/blue/skin.css b/profiles/openasu/modules/contrib/devel/krumo/skins/blue/skin.css index 1fc28812b3..c4936ccb38 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/skins/blue/skin.css +++ b/profiles/openasu/modules/contrib/devel/krumo/skins/blue/skin.css @@ -56,14 +56,14 @@ a.krumo-name { color:navy; font: bold 13px Arial; } -a.krumo-name big { +a.krumo-name span.krumo-big { font: bold 20pt Georgia; line-height: 14px; position:relative; top:2px; left:-2px; } -* html a.krumo-name big { +* html a.krumo-name span.krumo-big { font: bold 19pt Georgia; top: 5px; left: 0px; diff --git a/profiles/openasu/modules/contrib/devel/krumo/skins/default/skin.css b/profiles/openasu/modules/contrib/devel/krumo/skins/default/skin.css index 0fb87ef12d..d18b4586b3 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/skins/default/skin.css +++ b/profiles/openasu/modules/contrib/devel/krumo/skins/default/skin.css @@ -56,14 +56,14 @@ a.krumo-name { color:#2C5858; font: bold 13px Arial; } -a.krumo-name big { +a.krumo-name span.krumo-big { font: bold 20pt Georgia; line-height: 14px; position:relative; top:2px; left:-2px; } -* html a.krumo-name big { +* html a.krumo-name span.krumo-big { font: bold 19pt Georgia; top: 5px; left: 0px; diff --git a/profiles/openasu/modules/contrib/devel/krumo/skins/green/skin.css b/profiles/openasu/modules/contrib/devel/krumo/skins/green/skin.css index 6f985231bd..e80006fb3e 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/skins/green/skin.css +++ b/profiles/openasu/modules/contrib/devel/krumo/skins/green/skin.css @@ -56,14 +56,14 @@ a.krumo-name { color:#004000; font: bold 13px Arial; } -a.krumo-name big { +a.krumo-name span.krumo-big { font: bold 20pt Georgia; line-height: 14px; position:relative; top:2px; left:-2px; } -* html a.krumo-name big { +* html a.krumo-name span.krumo-big { font: bold 19pt Georgia; top: 5px; left: 0px; diff --git a/profiles/openasu/modules/contrib/devel/krumo/skins/orange/skin.css b/profiles/openasu/modules/contrib/devel/krumo/skins/orange/skin.css index 0a54da3b4a..cdce857205 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/skins/orange/skin.css +++ b/profiles/openasu/modules/contrib/devel/krumo/skins/orange/skin.css @@ -56,14 +56,14 @@ a.krumo-name { color:#404000; font: bold 13px Arial; } -a.krumo-name big { +a.krumo-name span.krumo-big { font: bold 20pt Georgia; line-height: 14px; position:relative; top:2px; left:-2px; } -* html a.krumo-name big { +* html a.krumo-name span.krumo-big { font: bold 19pt Georgia; top: 5px; left: 0px; diff --git a/profiles/openasu/modules/contrib/devel/krumo/skins/white/skin.css b/profiles/openasu/modules/contrib/devel/krumo/skins/white/skin.css index bdcad3c1f2..bbc917c664 100644 --- a/profiles/openasu/modules/contrib/devel/krumo/skins/white/skin.css +++ b/profiles/openasu/modules/contrib/devel/krumo/skins/white/skin.css @@ -66,14 +66,14 @@ a.krumo-name { font: bold 13px courier new; line-height:12px; } -a.krumo-name big { +a.krumo-name span.krumo-big { font: bold 16pt Georgia; line-height: 10px; position:relative; top:2px; left:-2px; } -* html a.krumo-name big { +* html a.krumo-name span.krumo-big { font: bold 15pt Georgia; float:left; top: -5px; diff --git a/profiles/openasu/modules/contrib/field_collection/ctools/relationships/field_collection_from_field.inc b/profiles/openasu/modules/contrib/field_collection/ctools/relationships/field_collection_from_field.inc index ab33e5f46c..8fbd099232 100644 --- a/profiles/openasu/modules/contrib/field_collection/ctools/relationships/field_collection_from_field.inc +++ b/profiles/openasu/modules/contrib/field_collection/ctools/relationships/field_collection_from_field.inc @@ -78,6 +78,15 @@ function field_collection_field_collection_from_field_context($context, $conf) { if (isset($entity->{$plugin_info['field_name']})) { $items = field_get_items($plugin_info['entity_type'], $entity, $plugin_info['field_name']); + + // Use negative delta to get item from the end. + if ($delta < 0) { + // Add negative pseudo-delta to total amount of items to get the real + // delta. Example (field_collection with 5 elements): count() == 5: + // 5 + -1 = 4, which would be the last element in this example. + $delta = count($items) + $delta; + } + if (!empty($items) && isset($items[$delta]['value'])) { $field_collection_item = field_collection_item_load($items[$delta]['value']); } @@ -98,7 +107,7 @@ function field_collection_field_collection_from_field_edit_form($form, &$form_st '#type' => 'textfield', '#title' => t('Delta'), '#size' => 3, - '#description' => t('The relationship can only create one context, but multiple items can be related. Please type in the number you want. The first one will be 0.'), + '#description' => t('The relationship can only create one context, but multiple items can be related. Please type in the number you want. The first one will be 0. Use negative delta to get items from the end. The last item will be -1'), '#default_value' => empty($conf['delta']) ? 0 : $conf['delta'], ); diff --git a/profiles/openasu/modules/contrib/field_collection/field_collection.entity.inc b/profiles/openasu/modules/contrib/field_collection/field_collection.entity.inc index e1ec874b8a..1f9306d909 100644 --- a/profiles/openasu/modules/contrib/field_collection/field_collection.entity.inc +++ b/profiles/openasu/modules/contrib/field_collection/field_collection.entity.inc @@ -226,19 +226,18 @@ class FieldCollectionItemEntity extends Entity { // not saved in the DB yet then fill in info about the hostEntity manually. // This happens when creating a new revision of a field collection entity // and it needs to relate to the new revision of the host entity. - if (!$this->hostEntityType) { + if (!$this->hostEntityType || isset($entity->tid)) { $this->hostEntityType = $host_entity_type; $this->hostEntity = $entity; list($this->hostEntityId, $this->hostEntityRevisionId) = entity_extract_ids($this->hostEntityType, $this->hostEntity); } list($recieved_id) = entity_extract_ids($this->hostEntityType, $entity); - if ($this->isInUse() && !empty($this->hostEntityId)) { + if (!empty($this->hostEntityId) && $this->isInUse()) { if (is_array($this->hostEntityId)) { - $current_id = in_array( - $recieved_id, - $this->hostEntityId - ) ? $recieved_id : FALSE; + $current_id = in_array($recieved_id, $this->hostEntityId) + ? $recieved_id + : FALSE; } else { $current_id = $this->hostEntityId; @@ -246,7 +245,7 @@ class FieldCollectionItemEntity extends Entity { } else { $current_host = entity_revision_load($this->hostEntityType, $this->hostEntityRevisionId); - list($current_id) = entity_extract_ids($this->hostEntityType, $current_host); + list($current_id) = $current_host ? entity_extract_ids($this->hostEntityType, $current_host) : array($recieved_id); } if ($current_id == $recieved_id) { @@ -326,10 +325,14 @@ class FieldCollectionItemEntity extends Entity { if ($hostEntity) { $entity_type = key($field_info['bundles']); $bundle = current($field_info['bundles'][$entity_type]); + $entity_info = entity_get_info($entity_type); + $key = $entity_info['entity keys']['id']; $query->entityCondition('entity_type', $entity_type); - $query->entityCondition('entity_id', $hostEntity->nid); + $query->entityCondition('entity_id', $hostEntity->{$key}); $query->entityCondition('bundle', $bundle); - $query->propertyCondition('language', $hostEntity->language); + if (isset($entity_info['entity keys']['language'])) { + $query->propertyCondition('language', $hostEntity->language); + } } $query->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT'); if (!$this->isInUse()) { @@ -342,7 +345,7 @@ class FieldCollectionItemEntity extends Entity { if ($this->isInUse()) { $data_array_keys = array_keys($data); - $this->hostEntityId = $data ? $data_array_keys : FALSE; + $this->hostEntityId = $data ? end($data_array_keys) : FALSE; $this->hostEntityRevisionId = FALSE; } // If we are querying for revisions, we get the revision ID. @@ -412,7 +415,7 @@ class FieldCollectionItemEntity extends Entity { * Determines the language code under which the item is stored. */ public function langcode() { - if ($this->delta() === NULL || empty($this->langcode)) { + if (empty($this->langcode) || $this->delta() === NULL) { $this->langcode = field_collection_entity_language('field_collection_item', $this); } @@ -463,7 +466,7 @@ class FieldCollectionItemEntity extends Entity { } // Copy the values of translatable fields for a new field collection item. - if (field_collection_item_is_translatable() && !empty($this->is_new) && $this->langcode() == LANGUAGE_NONE) { + if (!empty($this->is_new) && field_collection_item_is_translatable() && $this->langcode() == LANGUAGE_NONE) { $this->copyTranslations(); } diff --git a/profiles/openasu/modules/contrib/field_collection/field_collection.info b/profiles/openasu/modules/contrib/field_collection/field_collection.info index 43475ee2b0..c1c52d3750 100644 --- a/profiles/openasu/modules/contrib/field_collection/field_collection.info +++ b/profiles/openasu/modules/contrib/field_collection/field_collection.info @@ -11,3 +11,4 @@ files[] = views/field_collection_handler_relationship.inc files[] = field_collection.migrate.inc configure = admin/structure/field-collections package = Fields +version = "7.x-1.0-beta13+48-dev" \ No newline at end of file diff --git a/profiles/openasu/modules/contrib/field_collection/field_collection.install b/profiles/openasu/modules/contrib/field_collection/field_collection.install index ef44a79ce0..30a9bc60c3 100644 --- a/profiles/openasu/modules/contrib/field_collection/field_collection.install +++ b/profiles/openasu/modules/contrib/field_collection/field_collection.install @@ -374,7 +374,7 @@ function field_collection_update_7008() { ->fieldLanguageCondition($f_name, LANGUAGE_NONE); $query_result = $query->execute(); if (isset($query_result['field_collection_item'])) { - $results = $results + $query_result['field_collection_item']; + $results += $query_result['field_collection_item']; } } } diff --git a/profiles/openasu/modules/contrib/field_collection/field_collection.migrate.inc b/profiles/openasu/modules/contrib/field_collection/field_collection.migrate.inc index f7e4c93c00..16ad444c2d 100644 --- a/profiles/openasu/modules/contrib/field_collection/field_collection.migrate.inc +++ b/profiles/openasu/modules/contrib/field_collection/field_collection.migrate.inc @@ -150,7 +150,7 @@ class MigrateDestinationFieldCollection extends MigrateDestinationEntity { $status = entity_save('field_collection_item', $entity); migrate_instrument_stop('field_collection_save'); - if (in_array($this->hostEntityType, array('node', 'field_collection_item')) || ($status !== FALSE)) { + if ($status !== FALSE || in_array($this->hostEntityType, array('node', 'field_collection_item'))) { $this->complete($entity, $row); if ($updating) { $this->numUpdated++; diff --git a/profiles/openasu/modules/contrib/field_collection/field_collection.module b/profiles/openasu/modules/contrib/field_collection/field_collection.module index b4eef80c99..df173ed6d0 100644 --- a/profiles/openasu/modules/contrib/field_collection/field_collection.module +++ b/profiles/openasu/modules/contrib/field_collection/field_collection.module @@ -294,7 +294,7 @@ function field_collection_menu() { * Implements hook_menu_alter() to fix the field collections admin UI tabs. */ function field_collection_menu_alter(&$items) { - if (module_exists('field_ui') && isset($items['admin/structure/field-collections/%field_collection_field_name/fields'])) { + if (isset($items['admin/structure/field-collections/%field_collection_field_name/fields']) && module_exists('field_ui')) { // Make the fields task the default local task. $items['admin/structure/field-collections/%field_collection_field_name'] = $items['admin/structure/field-collections/%field_collection_field_name/fields']; $item = &$items['admin/structure/field-collections/%field_collection_field_name']; @@ -344,6 +344,10 @@ function field_collection_permission() { 'title' => t('Administer field collections'), 'description' => t('Create and delete fields on field collections.'), ), + 'edit field collections' => array( + 'title' => t('Edit field collections'), + 'description' => t('Edit field collections.'), + ), ); } @@ -365,9 +369,12 @@ function field_collection_item_access($op, FieldCollectionItemEntity $item = NUL // We do not support editing field collection revisions that are not used at // the hosts default revision as saving the host might result in a new default // revision. - if (isset($item) && !$item->isInUse() && $op != 'view') { + if ($op != 'view' && isset($item) && !$item->isInUse()) { return FALSE; } + if (user_access('edit field collections', $account)) { + return TRUE; + } if (user_access('administer field collections', $account)) { return TRUE; } @@ -375,10 +382,13 @@ function field_collection_item_access($op, FieldCollectionItemEntity $item = NUL return FALSE; } $op = $op == 'view' ? 'view' : 'edit'; + // Access is determined by the entity and field containing the reference. $field = field_info_field($item->field_name); - $entity_access = entity_access($op == 'view' ? 'view' : 'update', $item->hostEntityType(), $item->hostEntity(), $account); - return $entity_access && field_access($op, $field, $item->hostEntityType(), $item->hostEntity(), $account); + $hostEntity = $item->hostEntity() !== FALSE ? $item->hostEntity() : NULL; + $entity_access = entity_access($op == 'view' ? 'view' : 'update', $item->hostEntityType(), $hostEntity, $account); + + return $entity_access && field_access($op, $field, $item->hostEntityType(), $hostEntity, $account); } /** @@ -567,7 +577,7 @@ function field_collection_field_update($host_entity_type, $host_entity, $field, // In case the entity has been changed / created, save it and set the id. // If the host entity creates a new revision, save new item-revisions as // well. - if (isset($item['entity']) || !empty($host_entity->revision)) { + if (!empty($host_entity->revision) || isset($item['entity'])) { if ($entity = field_collection_field_get_entity($item)) { // If the host entity is saved as new revision, do the same for the item. if (!empty($host_entity->revision) || !empty($host_entity->is_new_revision)) { @@ -1114,7 +1124,7 @@ function field_collection_field_formatter_links(&$element, $entity_type, $entity $path = field_collection_field_get_path($field); list($id) = entity_extract_ids($entity_type, $entity); $element['#suffix'] = ''; - if (!empty($settings['description']) && $entity_type != 'node') { + if ($entity_type != 'node' && !empty($settings['description'])) { $element['#suffix'] .= '
' . field_filter_xss($instance['description']) . '
'; } $title = entity_i18n_string("field:{$field['field_name']}:{$instance['bundle']}:setting_add", $settings['add']); @@ -1168,6 +1178,14 @@ function field_collection_field_widget_info() { 'default value' => FIELD_BEHAVIOR_NONE, ), ), + 'field_collection_sorter' => array( + 'label' => t('Sortable only'), + 'field types' => array('field_collection'), + 'behaviors' => array( + 'multiple values' => FIELD_BEHAVIOR_CUSTOM, + 'default value' => FIELD_BEHAVIOR_DEFAULT, + ), + ), ); } @@ -1208,14 +1226,14 @@ function field_collection_field_widget_form(&$form, &$form_state, $field, $insta $field_state = field_form_get_state($field_parents, $field_name, $language, $form_state); - if (field_collection_hide_blank_items($field) && $delta == $field_state['items_count'] && $delta > 0) { + if ($delta > 0 && $delta == $field_state['items_count'] && field_collection_hide_blank_items($field)) { // Do not add a blank item. Also see // field_collection_field_attach_form() for correcting #max_delta. $recursion--; return FALSE; } - if (field_collection_hide_blank_items($field) && $field_state['items_count'] == 0) { + if ($field_state['items_count'] == 0 && field_collection_hide_blank_items($field)) { // We show one item, so also specify that as item count. So when the // add button is pressed the item count will be 2 and we show two items. $field_state['items_count'] = 1; @@ -1308,6 +1326,66 @@ function field_collection_field_widget_form(&$form, &$form_state, $field, $insta $recursion--; return $element; + + case 'field_collection_sorter': + $elements = array(); + + $field_name = $field['field_name']; + $parents = $form['#parents']; + $field_state = field_form_get_state($parents, $field_name, $langcode, $form_state); + $count = $field_state['items_count']; + + for ($delta = 0; $delta < $count; $delta++) { + $item_id = isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL; + $revision_id = isset($items[$delta]['revision_id']) ? $items[$delta]['revision_id'] : NULL; + + // add a label component to visually identify this field collection item + $element['label'] = array(); + if ($item_id) { + $item = field_collection_item_load($item_id); + $element['label']['#markup'] = $item ? $item->label() : $item_id; + } + + // the field stored value (item_id) and revision_id values + // so we need hidden fields to represent them + $element['value'] = array( + '#type' => 'hidden', + '#default_value' => $item_id, + ); + $element['revision_id'] = array( + '#type' => 'hidden', + '#default_value' => $revision_id, + ); + + // Input field for the delta (drag-n-drop reordering). + // We name the element '_weight' to avoid clashing with elements + // defined by widget. + $element['_weight'] = array( + '#type' => 'weight', + '#title' => t('Weight for row @number', array('@number' => $delta + 1)), + '#title_display' => 'invisible', + // Note: this 'delta' is the FAPI 'weight' element's property. + '#delta' => $count, + '#default_value' => isset($items[$delta]['_weight']) ? $items[$delta]['_weight'] : $delta, + '#weight' => 100, + ); + + $elements[$delta] = $element; + } + + if ($elements) { + $elements += array( + '#theme' => 'field_multiple_value_form', + '#field_name' => $field['field_name'], + '#cardinality' => $field['cardinality'], + '#title' => check_plain($instance['label']), + '#required' => FALSE, + '#description' => field_filter_xss($instance['description']), + '#max_delta' => $count-1, + ); + } + + return $elements; } } @@ -1367,11 +1445,11 @@ function field_collection_field_attach_form($entity_type, $entity, &$form, &$for } } - if ($field['type'] == 'field_collection' - && $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED + if ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED && empty($form_state['programmed']) + && $instance['widget']['type'] === 'field_collection_embed' && field_access('edit', $field, $entity_type) - && $instance['widget']['type'] == 'field_collection_embed') { + && $field['type'] === 'field_collection') { $element_langcode = $form[$field_name]['#language']; $element_wrapper = $form[$field_name][$element_langcode]['add_more']['#ajax']['wrapper']; @@ -1385,7 +1463,7 @@ function field_collection_field_attach_form($entity_type, $entity, &$form, &$for // If FCs are translatable, make sure we mark any necessary sub-fields in the // FC widget as translatable as well. - if ($entity_type == 'field_collection_item' + if ($entity_type === 'field_collection_item' && field_collection_item_is_translatable() ) { foreach (field_info_instances($entity_type, $form['#bundle']) as $field_name => $instance) { @@ -1570,7 +1648,7 @@ function field_collection_field_get_entity(&$item, $field_name = NULL) { return $entity; } - if (!isset($item['entity']) && isset($field_name)) { + if (isset($field_name) && !isset($item['entity'])) { $item['entity'] = entity_create('field_collection_item', array('field_name' => $field_name)); return $item['entity']; } @@ -1653,7 +1731,7 @@ function field_collection_field_widget_embed_validate($element, &$form_state, $c } // Now validate required elements if the entity is not empty. - if (!field_collection_item_is_empty($field_collection_item) && !empty($element['#field_collection_required_elements'])) { + if (!empty($element['#field_collection_required_elements']) && !field_collection_item_is_empty($field_collection_item)) { foreach ($element['#field_collection_required_elements'] as &$elements) { // Copied from _form_validate(). @@ -1676,7 +1754,7 @@ function field_collection_field_widget_embed_validate($element, &$form_state, $c $field_values = drupal_array_get_nested_value($form_state['values'], array_slice($elements['#array_parents'], 0, $field_depth)); // Special case lists since we don't get the correct array_parents. - if (count($elements['#array_parents']) < $field_depth && is_array($field_values)) { + if (is_array($field_values) && count($elements['#array_parents']) < $field_depth) { $field_values = reset($field_values); } @@ -1942,7 +2020,7 @@ function field_collection_field_property_set($entity, $name, $value, $langcode, $items[$delta][$columns[0]] = $value->item_id; $items[$delta][$columns[1]] = $value->revision_id; } - elseif (isset($value['value'], $value['revision_id']) && is_array($value)) { + elseif (is_array($value) && isset($value['value'], $value['revision_id'])) { $items[$delta][$columns[0]] = $value['value']; $items[$delta][$columns[1]] = $value['revision_id']; } diff --git a/profiles/openasu/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc b/profiles/openasu/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc index a58097338f..b636215790 100644 --- a/profiles/openasu/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc +++ b/profiles/openasu/modules/contrib/media_youtube/includes/MediaInternetYouTubeHandler.inc @@ -25,12 +25,12 @@ class MediaInternetYouTubeHandler extends MediaInternetBaseHandler { return file_stream_wrapper_uri_normalize('youtube://l/' . $matches[1]); } } - // http://youtube.com/watch/* - // http://youtube.com/embed/* - // http://youtube.com/v/* - // http://youtube.com/?v=* - // http://youtu.be/* - // http://gdata.youtube.com/feeds/api/videos/* + // https://youtube.com/watch/* + // https://youtube.com/embed/* + // https://youtube.com/v/* + // https://youtube.com/?v=* + // https://youtu.be/* + // https://gdata.youtube.com/feeds/api/videos/* $patterns = array( '@youtube\.com/watch[#\?].*?v=([^"#\& ]+).*&list=([^"#\& ]+)@i', '@youtu\.be/([^"#\&\? ]+)\?list=([^"#\& ]+)@i', @@ -88,7 +88,7 @@ class MediaInternetYouTubeHandler extends MediaInternetBaseHandler { public function getOEmbed() { $uri = $this->parse($this->embedCode); $external_url = file_create_url($uri); - $oembed_url = url('http://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json'))); + $oembed_url = url('https://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json'))); $response = drupal_http_request($oembed_url); if (!isset($response->error)) { @@ -110,7 +110,7 @@ class MediaInternetYouTubeHandler extends MediaInternetBaseHandler { public function validId($id, $type = 'v') { $uri = file_stream_wrapper_uri_normalize('youtube://' . $type . '/' . check_plain($id)); $external_url = file_create_url($uri); - $oembed_url = url('http://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json'))); + $oembed_url = url('https://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json'))); $response = drupal_http_request($oembed_url, array('method' => 'HEAD')); if ($response->code == 401) { diff --git a/profiles/openasu/modules/contrib/media_youtube/includes/MediaYouTubeStreamWrapper.inc b/profiles/openasu/modules/contrib/media_youtube/includes/MediaYouTubeStreamWrapper.inc index 46c08b6a57..ea7b2d050d 100644 --- a/profiles/openasu/modules/contrib/media_youtube/includes/MediaYouTubeStreamWrapper.inc +++ b/profiles/openasu/modules/contrib/media_youtube/includes/MediaYouTubeStreamWrapper.inc @@ -27,6 +27,9 @@ class MediaYouTubeStreamWrapper extends MediaReadOnlyStreamWrapper { if (!isset($response->error)) { return $thumbnail_url; } + elseif ($response->code == -110) { + throw new MediaInternetValidationException("Connection timed out."); + } elseif ($response->code == 401) { throw new MediaInternetValidationException("Embedding has been disabled for this video."); } @@ -99,7 +102,7 @@ class MediaYouTubeStreamWrapper extends MediaReadOnlyStreamWrapper { } /** - * Returns a url in the format "http://www.youtube.com/watch?v=qsPQN4MiTeE". + * Returns a url in the format "https://www.youtube.com/watch?v=qsPQN4MiTeE". * * Overrides interpolateUrl() defined in MediaReadOnlyStreamWrapper. */ diff --git a/profiles/openasu/modules/contrib/media_youtube/includes/media_youtube.formatters.inc b/profiles/openasu/modules/contrib/media_youtube/includes/media_youtube.formatters.inc index 639a339587..f1f9888713 100644 --- a/profiles/openasu/modules/contrib/media_youtube/includes/media_youtube.formatters.inc +++ b/profiles/openasu/modules/contrib/media_youtube/includes/media_youtube.formatters.inc @@ -184,9 +184,8 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti $element['protocol'] = array( '#title' => t('Iframe protocol'), '#type' => 'radios', - '#default_value' => $settings['protocol'], + '#default_value' => 'https:', '#options' => array( - 'http:' => 'http://', 'https:' => 'https://', ), '#states' => array( diff --git a/profiles/openasu/modules/contrib/media_youtube/media_youtube.info b/profiles/openasu/modules/contrib/media_youtube/media_youtube.info index 6beeaec557..3a5ff93c97 100644 --- a/profiles/openasu/modules/contrib/media_youtube/media_youtube.info +++ b/profiles/openasu/modules/contrib/media_youtube/media_youtube.info @@ -11,9 +11,8 @@ files[] = media_youtube.test files[] = includes/MediaYouTubeStreamWrapper.inc files[] = includes/MediaInternetYouTubeHandler.inc -; Information added by Drupal.org packaging script on 2018-02-17 -version = "7.x-3.7" +; Information added by Drupal.org packaging script on 2019-02-14 +version = "7.x-3.8" core = "7.x" project = "media_youtube" -datestamp = "1518862084" - +datestamp = "1550118784" diff --git a/profiles/openasu/modules/contrib/media_youtube/media_youtube.test b/profiles/openasu/modules/contrib/media_youtube/media_youtube.test index ca63c86af8..78b1729f57 100644 --- a/profiles/openasu/modules/contrib/media_youtube/media_youtube.test +++ b/profiles/openasu/modules/contrib/media_youtube/media_youtube.test @@ -78,7 +78,8 @@ class MediaInternetYouTubeTestCase extends MediaYouTubeTestHelper { 'origin' => '', 'protocol' => 'https:', 'protocol_specify' => FALSE, - 'rel' => TRUE, + 'rel' => FALSE, + 'controls' => FALSE, 'showinfo' => TRUE, 'theme' => 'dark', 'captions' => FALSE, diff --git a/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.info b/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.info index 3e9025ed85..0624d1c10a 100644 --- a/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.info +++ b/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.info @@ -8,9 +8,8 @@ hidden = TRUE files[] = includes/MediaYouTubeTestStreamWrapper.inc files[] = includes/MediaYouTubeTestHandler.inc -; Information added by Drupal.org packaging script on 2018-02-17 -version = "7.x-3.7" +; Information added by Drupal.org packaging script on 2019-02-14 +version = "7.x-3.8" core = "7.x" project = "media_youtube" -datestamp = "1518862084" - +datestamp = "1550118784" diff --git a/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.module b/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.module index 44f3c4ba33..863dc87895 100644 --- a/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.module +++ b/profiles/openasu/modules/contrib/media_youtube/tests/media_youtube_test.module @@ -32,7 +32,7 @@ function media_youtube_test_oembed() { 'thumbnail_width' => 480, 'author_name' => 'YouTube Help', 'height' => 270, - 'provider_url' => 'http://www.youtube.com/', + 'provider_url' => 'https://www.youtube.com/', 'html' => '', 'thumbnail_height' => 360, 'title' => 'YouTube Content ID', @@ -40,7 +40,7 @@ function media_youtube_test_oembed() { 'type' => 'video', 'width' => 480, 'version' => '1.0', - 'author_url' => 'http://www.youtube.com/user/YouTubeHelp', + 'author_url' => 'https://www.youtube.com/user/YouTubeHelp', ); drupal_json_output($data); diff --git a/profiles/openasu/modules/contrib/search_api/CHANGELOG.txt b/profiles/openasu/modules/contrib/search_api/CHANGELOG.txt index 1b61a9a191..c1e66d96e1 100644 --- a/profiles/openasu/modules/contrib/search_api/CHANGELOG.txt +++ b/profiles/openasu/modules/contrib/search_api/CHANGELOG.txt @@ -1,3 +1,18 @@ +Search API 1.26 (2019-03-11): +----------------------------- +- #2324023 by drumm, drunken monkey: Changed Views field definition for to + float. +- #3008849 by pamatt, drunken monkey: Fixed non-exposed numeric and date + filters in Views. +- #3009744 by evgeny.chernyavskiy, drunken monkey: Fixed wrong "continue" in + search_api_server_tasks_check(). +- #3003742 by Jelle_S, drunken monkey: Fixed problems with Views date filters. +- #3002043 by alonaoneill, drunken monkey: Fixed module name capitalization and + dependency namespacing in .info files. +- #2990940 by drunken monkey: Fixed multi-byte handling of Highlight processor. +- #3001424 by drunken monkey: Fixed notice when configuring the More Like This + contextual filter. + Search API 1.25 (2018-09-17): ----------------------------- - #2408727 by swim, drunken monkey: Added a batch operation for executing diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_facetapi/search_api_facetapi.info b/profiles/openasu/modules/contrib/search_api/contrib/search_api_facetapi/search_api_facetapi.info index 2fd1c653bb..904a64dcb6 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_facetapi/search_api_facetapi.info +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_facetapi/search_api_facetapi.info @@ -1,7 +1,7 @@ -name = Search facets +name = Search Facets description = "Integrate the Search API with the Facet API to provide facetted searches." -dependencies[] = search_api -dependencies[] = facetapi +dependencies[] = search_api:search_api +dependencies[] = facetapi:facetapi core = 7.x package = Search @@ -9,8 +9,8 @@ files[] = plugins/facetapi/adapter.inc files[] = plugins/facetapi/query_type_term.inc files[] = plugins/facetapi/query_type_date.inc -; Information added by Drupal.org packaging script on 2018-09-17 -version = "7.x-1.25" +; Information added by Drupal.org packaging script on 2019-03-11 +version = "7.x-1.26" core = "7.x" project = "search_api" -datestamp = "1537171099" +datestamp = "1552334832" diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument.inc b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument.inc index a11a662be3..a31738ee25 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument.inc +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument.inc @@ -79,8 +79,8 @@ class SearchApiViewsHandlerArgument extends views_handler_argument { public function option_definition() { $options = parent::option_definition(); - $options['break_phrase'] = array('default' => FALSE); - $options['not'] = array('default' => FALSE); + $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE); + $options['not'] = array('default' => FALSE, 'bool' => TRUE); return $options; } diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument_more_like_this.inc b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument_more_like_this.inc index df526e4b7c..bfb20393c5 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument_more_like_this.inc +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_argument_more_like_this.inc @@ -16,8 +16,6 @@ class SearchApiViewsHandlerArgumentMoreLikeThis extends SearchApiViewsHandlerArg */ public function option_definition() { $options = parent::option_definition(); - unset($options['break_phrase']); - unset($options['not']); $options['entity_type'] = array('default' => FALSE); $options['fields'] = array('default' => array()); return $options; diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_date.inc b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_date.inc index 1259aa0bbb..c921e9f536 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_date.inc +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_date.inc @@ -122,6 +122,8 @@ class SearchApiViewsHandlerFilterDate extends SearchApiViewsHandlerFilterNumeric * Add this filter to the query. */ public function query() { + $this->normalizeValue(); + if ($this->operator === 'empty') { $this->query->condition($this->real_field, NULL, '=', $this->options['group']); } @@ -129,11 +131,11 @@ class SearchApiViewsHandlerFilterDate extends SearchApiViewsHandlerFilterNumeric $this->query->condition($this->real_field, NULL, '<>', $this->options['group']); } elseif (in_array($this->operator, array('between', 'not between'), TRUE)) { - $min = isset($this->value[0]['min']) ? $this->value[0]['min'] : ''; + $min = $this->value['min']; if ($min !== '') { $min = is_numeric($min) ? $min : strtotime($min, REQUEST_TIME); } - $max = isset($this->value[0]['max']) ? $this->value[0]['max'] : ''; + $max = $this->value['max']; if ($max !== '') { $max = is_numeric($max) ? $max : strtotime($max, REQUEST_TIME); } @@ -151,8 +153,7 @@ class SearchApiViewsHandlerFilterDate extends SearchApiViewsHandlerFilterNumeric } } else { - $value = isset($this->value[0]) ? $this->value[0]['value'] : $this->value['value']; - $v = is_numeric($value) ? $value : strtotime($value, REQUEST_TIME); + $v = is_numeric($this->value['value']) ? $this->value['value'] : strtotime($this->value['value'], REQUEST_TIME); if ($v !== FALSE) { $this->query->condition($this->real_field, $v, $this->operator, $this->options['group']); } diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_numeric.inc b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_numeric.inc index f29a3e6e5c..b4c8ec195f 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_numeric.inc +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/includes/handler_filter_numeric.inc @@ -10,6 +10,15 @@ */ class SearchApiViewsHandlerFilterNumeric extends SearchApiViewsHandlerFilter { + /** + * {@inheritdoc} + */ + public function init(&$view, &$options) { + parent::init($view, $options); + + $this->normalizeValue(); + } + /** * {@inheritdoc} */ @@ -172,31 +181,30 @@ class SearchApiViewsHandlerFilterNumeric extends SearchApiViewsHandlerFilter { return t('is not empty'); } - $value = isset($this->value[0]) ? $this->value[0] : $this->value; - if (in_array($this->operator, array('between', 'not between'), TRUE)) { // This is of course wrong for translation purposes, but copied from // views_handler_filter_numeric::admin_summary() so probably still better // to re-use this than to do it correctly. $operator = $this->operator === 'between' ? t('between') : t('not between'); $vars = array( - '@min' => (string) $value['min'], - '@max' => (string) $value['max'], + '@min' => (string) $this->value['min'], + '@max' => (string) $this->value['max'], ); return $operator . ' ' . t('@min and @max', $vars); } - return check_plain((string) $this->operator) . ' ' . check_plain((string) $value['value']); - + return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value['value']); } /** * {@inheritdoc} */ public function query() { + $this->normalizeValue(); + if (in_array($this->operator, array('between', 'not between'), TRUE)) { - $min = isset($this->value[0]['min']) ? $this->value[0]['min'] : ''; - $max = isset($this->value[0]['max']) ? $this->value[0]['max'] : ''; + $min = $this->value['min']; + $max = $this->value['max']; if ($min !== '' && $max !== '') { $this->query->condition($this->real_field, array($min, $max), strtoupper($this->operator), $this->options['group']); } @@ -210,8 +218,31 @@ class SearchApiViewsHandlerFilterNumeric extends SearchApiViewsHandlerFilter { } } else { + // The parent handler doesn't expect our value structure, just pass the + // scalar value instead. + $this->value = $this->value['value']; parent::query(); } } + /** + * Sets $this->value to an array of options as defined by the filter. + * + * @see SearchApiViewsHandlerFilterNumeric::option_definition() + */ + protected function normalizeValue() { + $value = $this->value; + if (is_array($value) && isset($value[0])) { + $value = $value[0]; + } + if (!is_array($value)) { + $value = array('value' => $value); + } + $this->value = array( + 'value' => isset($value['value']) ? $value['value'] : '', + 'min' => isset($value['min']) ? $value['min'] : '', + 'max' => isset($value['max']) ? $value['max'] : '', + ); + } + } diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.info b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.info index ee66b2fb18..2f0bfd727c 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.info +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.info @@ -1,7 +1,7 @@ -name = Search views +name = Search Views description = Integrates the Search API with Views, enabling users to create views with searches as filters or arguments. -dependencies[] = search_api -dependencies[] = views +dependencies[] = search_api:search_api +dependencies[] = views:views core = 7.x package = Search @@ -29,8 +29,8 @@ files[] = includes/plugin_cache.inc files[] = includes/plugin_content_cache.inc files[] = includes/query.inc -; Information added by Drupal.org packaging script on 2018-09-17 -version = "7.x-1.25" +; Information added by Drupal.org packaging script on 2019-03-11 +version = "7.x-1.26" core = "7.x" project = "search_api" -datestamp = "1537171099" +datestamp = "1552334832" diff --git a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.views.inc b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.views.inc index cc1cf4e52a..afec2d8668 100644 --- a/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.views.inc +++ b/profiles/openasu/modules/contrib/search_api/contrib/search_api_views/search_api_views.views.inc @@ -99,6 +99,7 @@ function search_api_views_views_data() { $table['search_api_relevance']['title'] = t('Relevance'); $table['search_api_relevance']['help'] = t('The relevance of this search result with respect to the query.'); $table['search_api_relevance']['field']['type'] = 'decimal'; + $table['search_api_relevance']['field']['float'] = TRUE; $table['search_api_relevance']['field']['handler'] = 'entity_views_handler_field_numeric'; $table['search_api_relevance']['field']['click sortable'] = TRUE; $table['search_api_relevance']['sort']['handler'] = 'SearchApiViewsHandlerSort'; diff --git a/profiles/openasu/modules/contrib/search_api/includes/processor_highlight.inc b/profiles/openasu/modules/contrib/search_api/includes/processor_highlight.inc index 04be02b669..2ac502a1f4 100644 --- a/profiles/openasu/modules/contrib/search_api/includes/processor_highlight.inc +++ b/profiles/openasu/modules/contrib/search_api/includes/processor_highlight.inc @@ -315,100 +315,141 @@ class SearchApiHighlight extends SearchApiAbstractProcessor { * @param array $keys * Search keywords entered by the user. * - * @return string - * A string containing HTML for the excerpt. + * @return string|null + * A string containing HTML for the excerpt, or NULL if none could be + * created. */ protected function createExcerpt($text, array $keys) { // Prepare text by stripping HTML tags and decoding HTML entities. $text = strip_tags(str_replace(array('<', '>'), array(' <', '> '), $text)); - $text = ' ' . decode_entities($text); + $text = decode_entities($text); + $text = preg_replace('/\s+/', ' ', $text); + $text = trim($text, ' '); + $text_length = strlen($text); - // Extract fragments around keywords. - // First we collect ranges of text around each keyword, starting/ending - // at spaces, trying to get to the requested length. - // If the sum of all fragments is too short, we look for second occurrences. + // Try to reach the requested excerpt length with about two fragments (each + // with a keyword and some context). $ranges = array(); - $included = array(); $length = 0; - $work_keys = $keys; - while ($length < $this->options['excerpt_length'] && $work_keys) { - foreach ($work_keys as $k => $key) { - if ($length >= $this->options['excerpt_length']) { + $look_start = array(); + $remaining_keys = $keys; + + // Get the set excerpt length from the configuration. If the length is too + // small, only use one fragment. + $excerpt_length = $this->options['excerpt_length']; + $context_length = round($excerpt_length / 4) - 3; + if ($context_length < 32) { + $context_length = round($excerpt_length / 2) - 1; + } + + while ($length < $excerpt_length && !empty($remaining_keys)) { + $found_keys = array(); + foreach ($remaining_keys as $key) { + if ($length >= $excerpt_length) { break; } - // Remember occurrence of key so we can skip over it if more occurrences - // are desired. - if (!isset($included[$key])) { - $included[$key] = 0; + + // Remember where we last found $key, in case we are coming through a + // second time. + if (!isset($look_start[$key])) { + $look_start[$key] = 0; } - // Locate a keyword (position $p, always >0 because $text starts with a - // space). - $p = 0; - if (empty($this->options['highlight_partial'])) { - $regex = '/' . self::$boundary . preg_quote($key, '/') . self::$boundary . '/iu'; - if (preg_match($regex, $text, $match, PREG_OFFSET_CAPTURE, $included[$key])) { - $p = $match[0][1]; + + // See if we can find $key after where we found it the last time. Since + // we are requiring a match on a word boundary, make sure $text starts + // and ends with a space. + $matches = array(); + + if (!$this->options['highlight_partial']) { + $found_position = FALSE; + $regex = '/' . static::$boundary . preg_quote($key, '/') . static::$boundary . '/iu'; + if (preg_match($regex, ' ' . $text . ' ', $matches, PREG_OFFSET_CAPTURE, $look_start[$key])) { + $found_position = $matches[0][1]; } } else { - $function = function_exists('mb_stripos') ? 'mb_stripos' : 'stripos'; - $p = $function($text, $key, $included[$key]); + $found_position = stripos($text, $key, $look_start[$key]); } - // Now locate a space in front (position $q) and behind it (position $s), - // leaving about 60 characters extra before and after for context. - // Note that a space was added to the front and end of $text above. - if ($p) { - if (($q = strpos(' ' . $text, ' ', max(0, $p - 61))) !== FALSE) { - $end = substr($text . ' ', $p, 80); - if (($s = strrpos($end, ' ')) !== FALSE) { - // Account for the added spaces. - $q = max($q - 1, 0); - $s = min($s, strlen($end) - 1); - $ranges[$q] = $p + $s; - $length += $p + $s - $q; - $included[$key] = $p + 1; - continue; + if ($found_position !== FALSE) { + $look_start[$key] = $found_position + 1; + // Keep track of which keys we found this time, in case we need to + // pass through again to find more text. + $found_keys[] = $key; + + // Locate a space before and after this match, leaving some context on + // each end. + if ($found_position > $context_length) { + $before = strpos($text, ' ', $found_position - $context_length); + if ($before !== FALSE) { + ++$before; + } + } + else { + $before = 0; + } + if ($before !== FALSE && $before <= $found_position) { + if ($text_length > $found_position + $context_length) { + $after = strrpos(substr($text, 0, $found_position + $context_length), ' ', $found_position); + } + else { + $after = $text_length; + } + if ($after !== FALSE && $after > $found_position) { + if ($before < $after) { + // Save this range. + $ranges[$before] = $after; + $length += $after - $before; + } } } } - // Unless we got a match above, we don't need to look for this key any - // more. - unset($work_keys[$k]); } + // Next time through this loop, only look for keys we found this time, + // if any. + $remaining_keys = $found_keys; } - if (count($ranges) == 0) { - // We didn't find any keyword matches, so just return NULL. + if (!$ranges) { + // We didn't find any keyword matches, return NULL. return NULL; } // Sort the text ranges by starting position. ksort($ranges); - // Now we collapse overlapping text ranges into one. The sorting makes it O(n). + // Collapse overlapping text ranges into one. The sorting makes it O(n). $newranges = array(); + $from1 = $to1 = NULL; foreach ($ranges as $from2 => $to2) { - if (!isset($from1)) { + if ($from1 === NULL) { + // This is the first time through this loop: initialize. $from1 = $from2; $to1 = $to2; continue; } if ($from2 <= $to1) { + // The ranges overlap: combine them. $to1 = max($to1, $to2); } else { + // The ranges do not overlap: save the working range and start a new + // one. $newranges[$from1] = $to1; $from1 = $from2; $to1 = $to2; } } + // Save the remaining working range. $newranges[$from1] = $to1; - // Fetch text + // Fetch text within the combined ranges we found. $out = array(); foreach ($newranges as $from => $to) { $out[] = substr($text, $from, $to - $from); } + if (!$out) { + return NULL; + } // Let translators have the ... separator text as one chunk. $dots = explode('!excerpt', t('... !excerpt ... !excerpt ...')); diff --git a/profiles/openasu/modules/contrib/search_api/search_api.info b/profiles/openasu/modules/contrib/search_api/search_api.info index 201c3db412..b59bc92952 100644 --- a/profiles/openasu/modules/contrib/search_api/search_api.info +++ b/profiles/openasu/modules/contrib/search_api/search_api.info @@ -1,6 +1,6 @@ name = Search API description = "Provides a generic API for modules offering search capabilities." -dependencies[] = entity +dependencies[] = entity:entity core = 7.x package = Search @@ -38,8 +38,8 @@ files[] = includes/service.inc configure = admin/config/search/search_api -; Information added by Drupal.org packaging script on 2018-09-17 -version = "7.x-1.25" +; Information added by Drupal.org packaging script on 2019-03-11 +version = "7.x-1.26" core = "7.x" project = "search_api" -datestamp = "1537171099" +datestamp = "1552334832" diff --git a/profiles/openasu/modules/contrib/search_api/search_api.module b/profiles/openasu/modules/contrib/search_api/search_api.module index a509302cda..c1cf4e4bc1 100644 --- a/profiles/openasu/modules/contrib/search_api/search_api.module +++ b/profiles/openasu/modules/contrib/search_api/search_api.module @@ -1476,7 +1476,7 @@ function search_api_server_tasks_check(SearchApiServer $server = NULL) { default: // This should never happen. - continue; + continue 2; } $executed_tasks[] = $task->id; } diff --git a/profiles/openasu/modules/contrib/search_api/tests/search_api_test.info b/profiles/openasu/modules/contrib/search_api/tests/search_api_test.info index e3a3695da5..2c5f46e005 100644 --- a/profiles/openasu/modules/contrib/search_api/tests/search_api_test.info +++ b/profiles/openasu/modules/contrib/search_api/tests/search_api_test.info @@ -1,17 +1,16 @@ - -name = Search API test +name = Search API Test description = "Some dummy implementations for testing the Search API." core = 7.x package = Search -dependencies[] = search_api +dependencies[] = search_api:search_api files[] = search_api_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2018-09-17 -version = "7.x-1.25" +; Information added by Drupal.org packaging script on 2019-03-11 +version = "7.x-1.26" core = "7.x" project = "search_api" -datestamp = "1537171099" +datestamp = "1552334832" diff --git a/profiles/openasu/modules/contrib/search_api/tests/search_api_test_2.info b/profiles/openasu/modules/contrib/search_api/tests/search_api_test_2.info index e84483ed21..5d36c8fbc9 100644 --- a/profiles/openasu/modules/contrib/search_api/tests/search_api_test_2.info +++ b/profiles/openasu/modules/contrib/search_api/tests/search_api_test_2.info @@ -1,16 +1,16 @@ -name = Search API test service 2 +name = Search API Test Service 2 description = "A module providing a second test search service." core = 7.x package = Search -dependencies[] = search_api +dependencies[] = search_api:search_api files[] = search_api_test_service_2.module hidden = TRUE -; Information added by Drupal.org packaging script on 2018-09-17 -version = "7.x-1.25" +; Information added by Drupal.org packaging script on 2019-03-11 +version = "7.x-1.26" core = "7.x" project = "search_api" -datestamp = "1537171099" +datestamp = "1552334832" diff --git a/profiles/openasu/modules/contrib/smtp/smtp.info b/profiles/openasu/modules/contrib/smtp/smtp.info index c42e85d8bc..fdc4a83566 100644 --- a/profiles/openasu/modules/contrib/smtp/smtp.info +++ b/profiles/openasu/modules/contrib/smtp/smtp.info @@ -3,6 +3,7 @@ description = "Allow for site emails to be sent through an SMTP server of your c core = 7.x package = Mail configure = admin/config/system/smtp +version = "7.x-1.7+3-dev" files[] = smtp.mail.inc files[] = smtp.phpmailer.inc files[] = smtp.transport.inc diff --git a/profiles/openasu/modules/contrib/smtp/smtp.mail.inc b/profiles/openasu/modules/contrib/smtp/smtp.mail.inc index 4887ddc192..69617f6fce 100644 --- a/profiles/openasu/modules/contrib/smtp/smtp.mail.inc +++ b/profiles/openasu/modules/contrib/smtp/smtp.mail.inc @@ -486,6 +486,9 @@ class SmtpMailSystem implements MailSystemInterface { if (isset($attachment['filecontent'])) { $mailer->AddStringAttachment($attachment['filecontent'], $attachment['filename'], 'base64', $attachment['filemime']); } + if (!isset($attachment['filepath']) && isset($attachment['uri'])) { + $attachment['filepath'] = $attachment['uri']; + } if (isset($attachment['filepath'])) { $filename = isset($attachment['filename']) ? $attachment['filename'] : basename($attachment['filepath']); $filemime = isset($attachment['filemime']) ? $attachment['filemime'] : file_get_mimetype($attachment['filepath']); diff --git a/profiles/openasu/modules/contrib/tablefield/tablefield.info b/profiles/openasu/modules/contrib/tablefield/tablefield.info index dd03ecce51..7dd714b454 100644 --- a/profiles/openasu/modules/contrib/tablefield/tablefield.info +++ b/profiles/openasu/modules/contrib/tablefield/tablefield.info @@ -7,8 +7,8 @@ package = Fields dependencies[] = field configure = admin/config/content/tablefield -; Information added by Drupal.org packaging script on 2019-04-16 -version = "7.x-3.4" +; Information added by Drupal.org packaging script on 2019-05-29 +version = "7.x-3.5" core = "7.x" project = "tablefield" -datestamp = "1555444847" +datestamp = "1559118492" diff --git a/profiles/openasu/modules/contrib/tablefield/tablefield.module b/profiles/openasu/modules/contrib/tablefield/tablefield.module index 7002305c66..244b8c67af 100644 --- a/profiles/openasu/modules/contrib/tablefield/tablefield.module +++ b/profiles/openasu/modules/contrib/tablefield/tablefield.module @@ -96,21 +96,26 @@ function tablefield_permission() { * The field delta to load. */ function tablefield_export_csv($entity_type, $entity_id, $field_name, $langcode, $delta) { - // Ensure this is a tablefield. $field_info = field_info_field($field_name); if (!$field_info || $field_info['type'] != 'tablefield') { return drupal_not_found(); } + // Attempt to load the entity. + $entities = entity_load($entity_type, array($entity_id)); + if (empty($entities)) return MENU_NOT_FOUND; + $entity = reset($entities); + + // Ensure the user has access to view this field on this entity. + if (!_tablefield_entity_access('view', $entity_type, $entity) || + !field_access('view', $field_info, $entity_type, $entity)) { + return MENU_ACCESS_DENIED; + } + $filename = sprintf('%s_%s_%s_%s_%s.csv', $entity_type, $entity_id, $field_name, $langcode, $delta); $uri = 'temporary://' . $filename; - // Attempt to load the entity. - $ids = array($entity_id); - $entity = entity_load($entity_type, $ids); - $entity = array_pop($entity); - // Ensure that the data is available and that we can load a // temporary file to stream the data. if (isset($entity->{$field_name}[$langcode][$delta]['value']) && $fp = fopen($uri, 'w+')) { @@ -150,6 +155,36 @@ function tablefield_export_csv($entity_type, $entity_id, $field_name, $langcode, drupal_exit(); } +/** + * Helper function: A sort-of copy of entity_access() from entity API. + * @todo Remove if entity_acess() ends up in core. + */ +function _tablefield_entity_access($op, $entity_type, $entity = NULL, $account = NULL) { + $info = entity_get_info($entity_type); + // Use entity API access callbacks if provided. + if (isset($info[$entity_type]['access callback'])) { + $access_callback = $info[$entity_type]['access callback']; + return $access_callback($op, $entity, $account, $entity_type); + } + // Fall back to core entity access callbacks if EntityAPI is not available. + elseif ($entity_type == 'node') { + return node_access($op, $entity, $account); + } + elseif ($entity_type == 'user') { + return user_view_access($entity); + } + elseif ($entity_type == 'taxonomy_term') { + if (user_access('administer taxonomy', $account)) { + return TRUE; + } + if (user_access('access content', $account)) { + return TRUE; + } + } + + return FALSE; +} + /** * Implements hook_field_info(). */ @@ -1084,7 +1119,7 @@ function tablefield_field_formatter_view($entity_type, $entity, $field, $instanc drupal_alter('tablefield_output', $markup, $context); $element[0] = array( // See http://php.net/manual/en/json.constants.php#119565. - '#markup' => $markup, + '#markup' => check_plain($markup), ); } break; @@ -1284,6 +1319,8 @@ function tablefield_field_widget_form(&$form, &$form_state, $field, $instance, $ // Importing CSV data. tablefield_import_csv($form, $form_state, $langcode, $import_id, $tablefield_parents); $default_value = drupal_array_get_nested_value($form_state['input'], $tablefield_parents); + $identifier = implode('--', $tablefield_parents); + $form_state['_tablefield_imported_values'][$identifier] = $default_value; } elseif ($form_state['triggering_element']['#name'] == $pasted_id) { // Importing pasted data. @@ -1667,9 +1704,95 @@ function tablefield_field_widget_form(&$form, &$form_state, $field, $instance, $ } } + $form['element']['#element_validate'][] = 'tablefield_field_widget_form_validate'; + return $element; } + /** + * Validation callback. + * + * If the POST request exceeds the server's limit of max_input_vars, the tablefield + * values that were computed by a CSV import will be directly get set by the + * CSV table, bypassing the form submission step, and also any changes that the + * user made on browser. + * + * @param $form + * @param $form_state + * @param $element + */ +function tablefield_field_widget_form_validate(&$form, &$form_state, &$element) { + if (tablefield_post_exceeds_max_input_vars()) { + // Check if the values have been imported from a CSV file. If so, original + // values still exist in $form_state['_tablefield_imported_values']. + $values_from_csv = FALSE; + if (isset($form_state['_tablefield_imported_values'])) { + $values_from_csv = $form_state['_tablefield_imported_values']; + } + + if ($values_from_csv) { + // Each key is one of the fields multiple values + $elements = array_keys($values_from_csv); + foreach ($elements as $key) { + $table_values = $values_from_csv[$key]; + // Reconstruct in the same form as the array is passed in $form_state. + $table_values_format = array(); + $i_row = 0; + foreach ($table_values as $row) { + $i_col = 0; + foreach ($row as $cell) { + $table_values_format['cell_' . $i_row . '_' . $i_col] = $cell; + $i_col++; + } + $i_row++; + } + + $keys = explode('--', $key); + tablefield_replace_csv_values($form_state['values'], $keys, $table_values_format); + $message_warning = t('This table is too large to be safely edited. The original CSV values are stored. Please import a new CSV file to make changes to this table.'); + drupal_set_message($message_warning, 'warning'); + } + } + else { + $message_error = t('This table is too large to be safely edited. To assure that no data is lost, please import a new CSV file to make changes to this table.'); + drupal_set_message($message_error, 'error'); + } + } +} + +/** + * Helper function that uses recursion to replace table field values from + * $form_state['values'] with the values that were saved right after the csv + * upload. + * + * The function is used if the size of the table is so large, that on the form + * submission the max_input_vars is exceeded. + * + * @param array $destination + * It should only contain the $form_state['values']. + * + * @param array $keys + * Array with the nested keys of the field's location into $form_state['values']. + * + * @param array $value + * The table to be placed. + */ +function tablefield_replace_csv_values(array &$destination, array &$keys, array $value) { + $cur_key = array_shift($keys); + if (!isset($destination[$cur_key])) { + return; + } + + if (!empty($keys)) { + tablefield_replace_csv_values( $destination[$cur_key], $keys, $value); + return; + } + + foreach ($value as $key => $value2) { + $destination[$cur_key][$key] = $value2; + } +} + /** * Implements hook_custom_theme(). */ @@ -2450,3 +2573,16 @@ function array_to_xml($data, &$xml_data) { } } } + +/** + * Helper function, that checks if the POST request contains more input variables + * than the max_input_vars configuration on the server. + * + * @return bool + */ +function tablefield_post_exceeds_max_input_vars() { + $posted_vars = count($_POST, COUNT_RECURSIVE); + $max_input_vars = get_cfg_var('max_input_vars'); + + return ($posted_vars > $max_input_vars) ? TRUE : FALSE; +} diff --git a/profiles/openasu/modules/contrib/uuid/composer.json b/profiles/openasu/modules/contrib/uuid/composer.json new file mode 100644 index 0000000000..306e4964d1 --- /dev/null +++ b/profiles/openasu/modules/contrib/uuid/composer.json @@ -0,0 +1,13 @@ +{ + "name": "drupal/uuid", + "description": "Extends the entity functionality and adds support for universally unique identifiers.", + "type": "drupal-module", + "license": "GPL-2.0+", + "minimum-stability": "dev", + "require-dev": { + "drupal/ctools": "1.x-dev", + "drupal/rest_server": "~3.0", + "drupal/services": "~3.0", + "drupal/entity": "~1.0" + } +} diff --git a/profiles/openasu/modules/contrib/uuid/uuid.info b/profiles/openasu/modules/contrib/uuid/uuid.info index cefaf29132..08f429c24c 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid.info +++ b/profiles/openasu/modules/contrib/uuid/uuid.info @@ -7,8 +7,8 @@ files[] = uuid.test dependencies[] = node dependencies[] = user -; Information added by Drupal.org packaging script on 2018-07-19 -version = "7.x-1.2" +; Information added by Drupal.org packaging script on 2019-05-29 +version = "7.x-1.3" core = "7.x" project = "uuid" -datestamp = "1531990689" +datestamp = "1559150887" diff --git a/profiles/openasu/modules/contrib/uuid/uuid.test b/profiles/openasu/modules/contrib/uuid/uuid.test index 6c1481a3af..26f3c8397a 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid.test +++ b/profiles/openasu/modules/contrib/uuid/uuid.test @@ -6,11 +6,9 @@ */ /** - * UUID test helper trait. - * - * Contains methods that assist with running UUID tests. + * Base class with some helper methods. */ -trait UUIDTestHelper { +abstract class UUIDTestCase extends DrupalWebTestCase { /** * Helper function that asserts a UUID. @@ -21,15 +19,6 @@ trait UUIDTestHelper { } -/** - * Base class with some helper methods. - */ -abstract class UUIDTestCase extends DrupalWebTestCase { - - use UUIDTestHelper; - -} - /** * Tests the UUID API functions. */ @@ -488,8 +477,6 @@ class UUIDNodeTestCase extends UUIDTestCase { */ class UUIDCommentTestCase extends CommentHelperCase { - use UUIDTestHelper; - /** * {@inheritdoc} */ @@ -501,6 +488,13 @@ class UUIDCommentTestCase extends CommentHelperCase { ); } + /** + * Helper function that asserts a UUID. + */ + protected function assertUuid($uuid, $message = NULL) { + $this->assertTrue(uuid_is_valid($uuid), $message); + } + /** * Test CRUD on comments with UUID functions. */ @@ -559,8 +553,6 @@ class UUIDCommentTestCase extends CommentHelperCase { */ class UUIDTaxonomyTestCase extends TaxonomyWebTestCase { - use UUIDTestHelper; - /** * {@inheritdoc} */ @@ -588,6 +580,13 @@ class UUIDTaxonomyTestCase extends TaxonomyWebTestCase { parent::setUp($modules); } + /** + * Helper function that asserts a UUID. + */ + protected function assertUuid($uuid, $message = NULL) { + $this->assertTrue(uuid_is_valid($uuid), $message); + } + /** * Test CRUD on comments with UUID functions. */ diff --git a/profiles/openasu/modules/contrib/uuid/uuid_path/uuid_path.info b/profiles/openasu/modules/contrib/uuid/uuid_path/uuid_path.info index 77ad15c31c..e37d92791a 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid_path/uuid_path.info +++ b/profiles/openasu/modules/contrib/uuid/uuid_path/uuid_path.info @@ -5,8 +5,8 @@ package = UUID dependencies[] = uuid -; Information added by Drupal.org packaging script on 2018-07-19 -version = "7.x-1.2" +; Information added by Drupal.org packaging script on 2019-05-29 +version = "7.x-1.3" core = "7.x" project = "uuid" -datestamp = "1531990689" +datestamp = "1559150887" diff --git a/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.info b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.info index dd1ae423bf..65ddd3b6c0 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.info +++ b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.info @@ -3,6 +3,8 @@ description = Provides integration with the Services module, like exposing a UUI core = 7.x package = Services - resources +files[] = uuid_services.user_services.test + dependencies[] = services dependencies[] = uuid dependencies[] = entity @@ -13,8 +15,8 @@ test_dependencies[] = file test_dependencies[] = field test_dependencies[] = file_entity -; Information added by Drupal.org packaging script on 2018-07-19 -version = "7.x-1.2" +; Information added by Drupal.org packaging script on 2019-05-29 +version = "7.x-1.3" core = "7.x" project = "uuid" -datestamp = "1531990689" +datestamp = "1559150887" diff --git a/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.module b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.module index 5a0e628975..eee362d060 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.module +++ b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.module @@ -170,6 +170,13 @@ function _uuid_services_entity_update($entity_type, $uuid, $entity) { } } } + + // Sanitize user roles if user is not allowed to modify them. + if ($entity_type == 'user' && !empty($entity->roles) && !user_access('administer permissions')) { + $original_user = user_load(entity_get_id_by_uuid('user', array($entity->uuid))[$entity->uuid]); + $entity->roles = $original_user->roles; + } + entity_uuid_save($entity_type, $entity); return $entity; } @@ -194,7 +201,7 @@ function _uuid_services_entity_delete($entity_type, $uuid) { return TRUE; } - $return = entity_uuid_delete($entity_type, array($uuid)) !== FALSE; + $return = entity_uuid_delete($entity_type, $uuid) !== FALSE; return $return; } catch (Exception $exception) { diff --git a/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.user_services.test b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.user_services.test new file mode 100644 index 0000000000..b7f327ca17 --- /dev/null +++ b/profiles/openasu/modules/contrib/uuid/uuid_services/uuid_services.user_services.test @@ -0,0 +1,231 @@ + 'UUID User Services tests', + 'description' => 'Test the user services resource UUID methods and actions.', + 'group' => 'UUID', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp( + 'ctools', + 'services', + 'rest_server', + 'uuid_services' + ); + $this->endpoint = $this->saveNewEndpoint(); + } + + /** + * {@inheritdoc} + */ + public function saveNewEndpoint() { + $edit = $this->populateEndpointFAPI(); + $endpoint = new stdClass(); + $endpoint->disabled = FALSE; + $endpoint->api_version = 3; + $endpoint->name = $edit['name']; + $endpoint->server = $edit['server']; + $endpoint->path = $edit['path']; + $endpoint->authentication = array( + 'services' => 'services', + ); + $endpoint->server_settings = array( + 'formatters' => array( + 'json' => TRUE, + 'bencode' => TRUE, + 'rss' => TRUE, + 'plist' => TRUE, + 'xmlplist' => TRUE, + 'php' => TRUE, + 'yaml' => TRUE, + 'jsonp' => FALSE, + 'xml' => FALSE, + ), + 'parsers' => array( + 'application/x-yaml' => TRUE, + 'application/json' => TRUE, + 'application/vnd.php.serialized' => TRUE, + 'application/plist' => TRUE, + 'application/plist+xml' => TRUE, + 'application/x-www-form-urlencoded' => TRUE, + 'multipart/form-data' => TRUE, + ), + ); + $endpoint->resources = array( + 'user' => array( + 'operations' => array( + 'create' => array( + 'enabled' => 1, + ), + 'retrieve' => array( + 'enabled' => 1, + ), + 'update' => array( + 'enabled' => 1, + ), + 'delete' => array( + 'enabled' => 1, + ), + 'index' => array( + 'enabled' => 1, + ), + ), + ), + ); + $endpoint->debug = 1; + $endpoint->export_type = FALSE; + services_endpoint_save($endpoint); + $endpoint = services_endpoint_load($endpoint->name); + $this->assertTrue($endpoint->name == $edit['name'], 'Endpoint successfully created'); + return $endpoint; + } + + /** + * Tests user Retrieve. + */ + public function testUserRetrieve() { + $admin_user = $this->drupalCreateUser(array( + 'administer services', + 'administer users', + )); + $this->drupalLogin($admin_user); + $other_user = $this->drupalCreateUser(); + + // Verify user is found. + $response = $this->servicesGet($this->endpoint->path . '/user/' . $other_user->uuid); + $this->assertTrue($other_user->uuid == $response['body']->uuid, + 'Successfully received User info'); + } + + /** + * Tests user Update his own account. + */ + public function testUserUpdate() { + $admin_user = $this->drupalCreateUser(array( + 'administer services', + 'administer users', + 'administer permissions', + )); + $this->drupalLogin($admin_user); + + $other_user = $this->drupalCreateUser(); + $update = array( + 'uuid' => $other_user->uuid, + 'roles' => array( + '2' => 'authenticated user', + '3' => 'administrator', + ), + ); + $this->servicesPut($this->endpoint->path . '/user/' . $other_user->uuid, $update); + $user_after_update = user_load($other_user->uid, TRUE); + $this->assertTrue(in_array('administrator', $user_after_update->roles), 'Administrator role successfully added'); + } + + /** + * Tests user Update another account fail with no permissions. + */ + public function testUserUpdatePermFail() { + $user = $this->drupalCreateUser(); + $this->drupalLogin($user); + + $other_user = $this->drupalCreateUser(); + + $update = array( + 'uuid' => $other_user->uuid, + 'name' => 'test_edit', + 'roles' => array( + '2' => 'authenticated user', + '3' => 'administrator', + ), + ); + $response = $this->servicesPut($this->endpoint->path . '/user/' . $other_user->uuid, $update); + $user_after_update = user_load($other_user->uid, TRUE); + $this->assertNotEqual($update['name'], $user_after_update->name, 'User name was not updated without the needed permissions'); + $this->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions'); + $this->assertTrue($response['code'] == 403, + 'Updating the user failed without the needed permissions'); + } + + /** + * Tests user Update his own account fail with no permissions. + */ + public function testUserOwnUpdatePermFail() { + $user = $this->drupalCreateUser([ + 'access user profiles', + ]); + $this->drupalLogin($user); + $user = user_load($user->uid, TRUE); + + $update = array( + 'uuid' => $user->uuid, + 'roles' => array( + '2' => 'authenticated user', + '3' => 'administrator', + ), + ); + $this->servicesPut($this->endpoint->path . '/user/' . $user->uuid, $update); + $user_after_update = user_load($user->uid, TRUE); + $this->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions'); + $this->assertEqual($user->roles, $user_after_update->roles, 'Existing roles persist after update.'); + } + + /** + * Tests user Delete. + */ + public function testUserDelete() { + $admin_user = $this->drupalCreateUser(array( + 'administer services', + 'administer users', + )); + $this->drupalLogin($admin_user); + + $other_user = $this->drupalCreateUser(); + + $this->servicesDelete($this->endpoint->path . '/user/' . $other_user->uuid); + $user_after_update = user_load($other_user->uid, TRUE); + $this->assertTrue(empty($user_after_update), 'User was deleted'); + } + + /** + * Tests user Delete fail with no permissions. + */ + public function testUserDeletePermFail() { + $user = $this->drupalCreateUser(); + $this->drupalLogin($user); + + $other_user = $this->drupalCreateUser(); + + $response = $this->servicesDelete($this->endpoint->path . '/user/' . $other_user->uuid); + $user_after_update = user_load($other_user->uid, TRUE); + $this->assertTrue(!empty($user_after_update), 'User was not deleted without the needed permissions'); + $this->assertTrue($response['code'] == 403, + 'Deleting the user failed without the needed permissions'); + } + +} diff --git a/profiles/openasu/modules/contrib/uuid/uuid_services_example/uuid_services_example.info b/profiles/openasu/modules/contrib/uuid/uuid_services_example/uuid_services_example.info index 5874051f15..f8e88d1722 100644 --- a/profiles/openasu/modules/contrib/uuid/uuid_services_example/uuid_services_example.info +++ b/profiles/openasu/modules/contrib/uuid/uuid_services_example/uuid_services_example.info @@ -11,8 +11,8 @@ features[ctools][] = services:services:3 features[features_api][] = api:2 features[services_endpoint][] = uuid_services_example -; Information added by Drupal.org packaging script on 2018-07-19 -version = "7.x-1.2" +; Information added by Drupal.org packaging script on 2019-05-29 +version = "7.x-1.3" core = "7.x" project = "uuid" -datestamp = "1531990689" +datestamp = "1559150887" diff --git a/profiles/openasu/modules/contrib/views/css/ie/views-admin.ie7.css b/profiles/openasu/modules/contrib/views/css/ie/views-admin.ie7.css index 9a8852a3bd..417a28adf3 100644 --- a/profiles/openasu/modules/contrib/views/css/ie/views-admin.ie7.css +++ b/profiles/openasu/modules/contrib/views/css/ie/views-admin.ie7.css @@ -17,7 +17,7 @@ /** * IE7 has no idea how large this container should be and it doesn't - * apply has-layout. Expand it's width to 100% and trigger has-layout. + * apply has-layout. Expand its width to 100% and trigger has-layout. */ .views-edit-view .views-displays { height: 1%; diff --git a/profiles/openasu/modules/contrib/views/css/views-admin.css b/profiles/openasu/modules/contrib/views/css/views-admin.css index 7b367fd356..6a1603ff61 100644 --- a/profiles/openasu/modules/contrib/views/css/views-admin.css +++ b/profiles/openasu/modules/contrib/views/css/views-admin.css @@ -312,9 +312,7 @@ div.form-item-options-value-all { /* @end */ - - -/* @group Javascript dependent styling */ +/* @group JavaScript dependent styling */ .js-only { display: none; diff --git a/profiles/openasu/modules/contrib/views/drush/views.drush.inc b/profiles/openasu/modules/contrib/views/drush/views.drush.inc index e4ccfb4f10..a3954b8c44 100644 --- a/profiles/openasu/modules/contrib/views/drush/views.drush.inc +++ b/profiles/openasu/modules/contrib/views/drush/views.drush.inc @@ -119,10 +119,11 @@ function views_drush_command() { * Callback function for views-revert command. */ function views_revert_views() { + $args = func_get_args(); + // The provided views names specified in the command. + $viewnames = _convert_csv_to_array($args); $views = views_get_all_views(); $i = 0; - // The provided views names specified in the command. - $viewnames = _convert_csv_to_array(func_get_args()); // Find all overridden views. foreach ($views as $view) { diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_area_result.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_area_result.inc index c69d3d2dc5..6c98c0e744 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_area_result.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_area_result.inc @@ -101,7 +101,7 @@ class views_handler_area_result extends views_handler_area { $replacements["@$item"] = ${$item}; } // Send the output. - if (!empty($total)) { + if (!empty($total) || !empty($this->options['empty'])) { $output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format)); } return $output; diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument.inc index 309091ee64..ced42a1fe4 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument.inc @@ -14,7 +14,7 @@ /** * Base class for arguments. * - * The basic argument works for very simple arguments such as nid and uid + * The basic argument works for very simple arguments such as nid and uid. * * Definition terms for this handler: * - name field: The field to use for the name to use in the summary, which is @@ -158,9 +158,10 @@ class views_handler_argument extends views_handler { } /** - * Determine if the argument can generate a breadcrumb + * Determine if the argument can generate a breadcrumb. * * @return bool + * Indicates whether the argument can generate a breadcrumb. */ public function uses_breadcrumb() { $info = $this->default_actions($this->options['default_action']); @@ -195,6 +196,7 @@ class views_handler_argument extends views_handler { * Determine if the argument needs a style plugin. * * @return bool + * the argument needs a plugin style. */ public function needs_style_plugin() { $info = $this->default_actions($this->options['default_action']); @@ -527,8 +529,7 @@ class views_handler_argument extends views_handler { } /** - * Provide a list of default behaviors for this argument if the argument - * is not present. + * List of default behaviors for this argument if the argument is not present. * * Override this method to provide additional (or fewer) default behaviors. */ @@ -657,8 +658,9 @@ class views_handler_argument extends views_handler { } /** - * Provide a form for selecting further summary options when the default - * action is set to display one. + * Form for selecting further summary options. + * + * Only used when the default action is set to display one. */ public function default_summary_form(&$form, &$form_state) { $style_plugins = views_fetch_plugin_data('style'); @@ -795,10 +797,10 @@ class views_handler_argument extends views_handler { } /** - * Default action: empty + * Default action: empty. * * If an argument was expected and was not given, in this case, display the - * view's empty text + * view's empty text. */ public function default_empty() { // We return with no query; this will force the empty text. @@ -967,6 +969,8 @@ class views_handler_argument extends views_handler { * * @param string $order * The order selected in the UI. + * @param string $by + * Optional alias for this field. */ public function summary_sort($order, $by = NULL) { $this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias)); @@ -1116,7 +1120,7 @@ class views_handler_argument extends views_handler { } /** - * Set the input for this argument + * Set the input for this argument. * * @return bool * TRUE if it successfully validates; FALSE if it does not. diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_date.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_date.inc index d10694c290..5501e00398 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_date.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_date.inc @@ -17,7 +17,7 @@ * Definitions terms: * - many to one: If true, the "many to one" helper will be used. * - invalid input: A string to give to the user for obviously invalid input. - * This is deprecated in favor of argument validators. + * This is deprecated in favor of argument validators. * * @see views_many_to_one_helper() * @@ -26,12 +26,12 @@ class views_handler_argument_date extends views_handler_argument_formula { /** - * + * @var string */ public $option_name = 'default_argument_date'; /** - * + * @var string */ public $arg_format = 'Y-m-d'; @@ -46,9 +46,9 @@ class views_handler_argument_date extends views_handler_argument_formula { } /** - * Set the empty argument value to the current date, + * Set the empty argument value to the current date. * - * formatted appropriately for this argument. + * Formatted appropriately for this argument. * * @return string * The default argument. diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_string.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_string.inc index 2b605cf3f0..86000c6caa 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_string.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_argument_string.inc @@ -38,6 +38,7 @@ class views_handler_argument_string extends views_handler_argument { $options['path_case'] = array('default' => 'none'); $options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE); $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE); + $options['not'] = array('default' => FALSE, 'bool' => TRUE); if (!empty($this->definition['many to one'])) { $options['add_table'] = array('default' => FALSE, 'bool' => TRUE); @@ -132,6 +133,13 @@ class views_handler_argument_string extends views_handler_argument { '#default_value' => !empty($this->options['break_phrase']), '#fieldset' => 'more', ); + $form['not'] = array( + '#type' => 'checkbox', + '#title' => t('Exclude'), + '#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), + '#default_value' => !empty($this->options['not']), + '#fieldset' => 'more', + ); } /** @@ -207,21 +215,19 @@ class views_handler_argument_string extends views_handler_argument { } if (count($this->value) > 1) { - $operator = 'IN'; + $operator = empty($this->options['not']) ? 'IN' : 'NOT IN'; $argument = $this->value; } else { - $operator = '='; + $operator = empty($this->options['not']) ? '=' : '!='; } if ($formula) { $placeholder = $this->placeholder(); - if ($operator == 'IN') { - $field .= " IN($placeholder)"; - } - else { - $field .= ' = ' . $placeholder; + if (count($this->value) > 1) { + $placeholder = "($placeholder)"; } + $field .= " $operator $placeholder"; $placeholders = array( $placeholder => $argument, ); diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_field.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_field.inc index f33cf8845d..4b690dca8c 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_field.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_field.inc @@ -68,7 +68,7 @@ class views_handler_field extends views_handler { /** * @var array - * Stores additional fields which get's added to the query. + * Stores additional fields which get added to the query. * The generated aliases are stored in $aliases. */ public $additional_fields = array(); @@ -424,6 +424,7 @@ class views_handler_field extends views_handler { 'absolute' => array('default' => FALSE, 'bool' => TRUE), 'external' => array('default' => FALSE, 'bool' => TRUE), 'replace_spaces' => array('default' => FALSE, 'bool' => TRUE), + 'unwanted_characters' => array('default' => ''), 'path_case' => array('default' => 'none', 'translatable' => FALSE), 'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE), 'alt' => array('default' => '', 'translatable' => TRUE), @@ -744,6 +745,16 @@ class views_handler_field extends views_handler { 'edit-options-alter-make-link' => array(1), ), ); + $form['alter']['unwanted_characters'] = array( + '#type' => 'textfield', + '#title' => t('Remove unwanted characters'), + '#description' => t('Space-separated list of characters to remove from the URL path'), + '#default_value' => $this->options['alter']['unwanted_characters'], + '#dependency' => array( + 'edit-options-alter-make-link' => array(1) + ), + '#maxlength' => 255, + ); $form['alter']['path_case'] = array( '#type' => 'select', '#title' => t('Transform the case'), @@ -782,7 +793,7 @@ class views_handler_field extends views_handler { '#title' => t('Rel Text'), '#type' => 'textfield', '#default_value' => $this->options['alter']['rel'], - '#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'), + '#description' => t('Include Rel attribute for use in lightbox2 or other JavaScript utility.'), '#dependency' => array( 'edit-options-alter-make-link' => array(1), ), @@ -1234,8 +1245,9 @@ If you would like to have the characters \'[\' and \']\' please use the html ent * Render this field as altered text, from a fieldset set by the user. */ public function render_altered($alter, $tokens) { - // Filter this right away as our substitutions are already sanitized. - $value = filter_xss_admin($alter['text']); + // We trust admins so we allow any tag content. This is important for + // displays such as XML where we should not mess with tags. + $value = $alter['text']; $value = strtr($value, $tokens); return $value; @@ -1287,6 +1299,12 @@ If you would like to have the characters \'[\' and \']\' please use the html ent if (!empty($alter['replace_spaces'])) { $path = str_replace(' ', '-', $path); } + + if (!empty($alter['unwanted_characters'])) { + foreach (explode(' ', $alter['unwanted_characters']) as $unwanted) { + $path = str_replace($unwanted, '', $path); + } + } } // Parse the URL and move any query and fragment parameters out of the path. diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_date.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_date.inc index 36bb117462..cd0838bf14 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_date.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_date.inc @@ -8,6 +8,9 @@ /** * A handler to provide proper displays for dates. * + * This may be used on table fields that hold either UNIX timestamps or SQL + * datetime strings. + * * @ingroup views_field_handlers */ class views_handler_field_date extends views_handler_field { @@ -138,6 +141,12 @@ class views_handler_field_date extends views_handler_field { */ public function render($values) { $value = $this->get_value($values); + + if (!is_numeric($value)) { + // If the value isn't numeric, assume it's an SQL DATETIME. + $value = strtotime($value); + } + $format = $this->options['date_format']; if (in_array($format, $this->supported_date_types())) { $custom_format = $this->options['custom_date_format']; diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_entity.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_entity.inc index c4df028c05..f255e04506 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_entity.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_entity.inc @@ -41,7 +41,9 @@ class views_handler_field_entity extends views_handler_field { // Initialize the entity-type used. $table_data = views_fetch_data($this->table); - $this->entity_type = $table_data['table']['entity type']; + if (isset($table_data['table']['entity type'])) { + $this->entity_type = $table_data['table']['entity type']; + } } /** diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_links.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_links.inc index 51fe6e69f6..7e32550c7c 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_links.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_links.inc @@ -64,6 +64,7 @@ class views_handler_field_links extends views_handler_field { public function options_submit(&$form, &$form_state) { // Remove unselected options. $form_state['values']['options']['fields'] = array_filter($form_state['values']['options']['fields']); + parent::options_submit($form, $form_state); } /** diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_numeric.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_numeric.inc index acc301def4..b8de0fdeb4 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_field_numeric.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_field_numeric.inc @@ -118,6 +118,11 @@ class views_handler_field_numeric extends views_handler_field { public function render($values) { $value = $this->get_value($values); + // Output nothing if the value is null. + if (is_null($value)) { + return ''; + } + // Hiding should happen before rounding or adding prefix/suffix. if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) { return ''; @@ -127,12 +132,13 @@ class views_handler_field_numeric extends views_handler_field { $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']); } else { - $remainder = abs($value) - intval(abs($value)); + $point_position = strpos($value, '.'); + $remainder = ($point_position === FALSE) ? '' : substr($value, $point_position + 1); $value = $value > 0 ? floor($value) : ceil($value); $value = number_format($value, 0, '', $this->options['separator']); if ($remainder) { // The substr may not be locale safe. - $value .= $this->options['decimal'] . substr($remainder, 2); + $value .= $this->options['decimal'] . $remainder; } } diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter.inc index 9615c3058f..6ffb10d128 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter.inc @@ -15,15 +15,14 @@ * available as standard operators. * * Object flags: - * You can set some specific behavior by setting up the following flags on - * your custom class. - * - * - always_multiple: - * Disable the possibility to force a single value. - * - no_operator: - * Disable the possibility to use operators. - * - always_required: - * Disable the possibility to allow a exposed input to be optional. + * It's possible to set specific behavior using the following flags on the + * custom class: + * - always_multiple: + * Disable the possibility to force a single value. + * - no_operator: + * Disable the possibility to use operators. + * - always_required: + * Disable the possibility to allow a exposed input to be optional. */ /** @@ -34,8 +33,10 @@ class views_handler_filter extends views_handler { /** - * Contains the actual value of the field,either configured in the views ui - * or entered in the exposed filters. + * Contains the actual value of the field. + * + * This will be either configured in the views UI or entered in the exposed + * filters. * * @var mixed */ @@ -135,13 +136,17 @@ class views_handler_filter extends views_handler { 'use_operator' => array('default' => FALSE, 'bool' => TRUE), 'operator_label' => array('default' => '', 'translatable' => TRUE), 'operator' => array('default' => ''), + 'limit_operators' => array('default' => FALSE, 'bool' => TRUE), + 'available_operators' => array('default' => array()), 'identifier' => array('default' => ''), 'required' => array('default' => FALSE, 'bool' => TRUE), 'remember' => array('default' => FALSE, 'bool' => TRUE), 'multiple' => array('default' => FALSE, 'bool' => TRUE), - 'remember_roles' => array('default' => array( - DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID, - )), + 'remember_roles' => array( + 'default' => array( + DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID, + ), + ), ), ); @@ -205,9 +210,8 @@ class views_handler_filter extends views_handler { /** * Provide the basic form which calls through to subforms. * - * If overridden, it is best to call through to the parent, - * or to at least make sure all of the functions in this form - * are called. + * If overridden, it is best to call through to the parent, or to at least + * make sure all of the functions in this form are called. */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -248,7 +252,7 @@ class views_handler_filter extends views_handler { } /** - * Simple validate handler + * Simple validate handler. */ public function options_validate(&$form, &$form_state) { $this->operator_validate($form, $form_state); @@ -274,6 +278,8 @@ class views_handler_filter extends views_handler { $this->value_submit($form, $form_state); } if (!empty($this->options['exposed'])) { + $options = &$form_state['values']['options']['expose']; + $options['available_operators'] = (!empty($options['use_operator']) && !empty($options['limit_operators'])) ? array_filter($options['available_operators']) : array(); $this->expose_submit($form, $form_state); } if ($this->is_a_group()) { @@ -293,14 +299,29 @@ class views_handler_filter extends views_handler { /** * Options form subform for setting the operator. * - * This may be overridden by child classes, and it must - * define $form['operator']; + * This may be overridden by child classes, and it must define + * $form['operator']. * * @see options_form() */ public function operator_form(&$form, &$form_state) { $options = $this->operator_options(); if (!empty($options)) { + $available = $this->options['expose']['available_operators']; + if ($this->options['expose']['limit_operators'] && count($available)) { + foreach ($options as $key => $value) { + if (!isset($available[$key])) { + unset($options[$key]); + } + } + + // Make sure we have a valid default value if the current one is + // excluded. + if (!isset($options[$this->operator])) { + // Just choose the first. + $this->operator = key($options); + } + } $form['operator'] = array( '#type' => count($options) < 10 ? 'radios' : 'select', '#title' => t('Operator'), @@ -313,7 +334,7 @@ class views_handler_filter extends views_handler { /** * Provide a list of options for the default operator form. * - * Should be overridden by classes that don't override operator_form + * Should be overridden by classes that don't override operator_form. */ public function operator_options() { return array(); @@ -511,6 +532,33 @@ class views_handler_filter extends views_handler { '#title' => t('Required'), '#default_value' => $this->options['expose']['required'], ); + + $operator_options = $this->operator_options(); + if (count($operator_options)) { + $form['expose']['limit_operators'] = array( + '#type' => 'checkbox', + '#title' => t('Limit operators'), + '#description' => t('When checked, the operator will be exposed to the user'), + '#default_value' => !empty($this->options['expose']['limit_operators']), + '#dependency' => array( + 'edit-options-expose-use-operator' => array(1), + ), + '#description' => t('Restrict which operators will be available to select in the exposed operator form.'), + ); + + $form['expose']['available_operators'] = array( + '#type' => 'checkboxes', + '#title' => t('Limit the exposed operators'), + '#default_value' => $this->options['expose']['available_operators'], + '#prefix' => '
', + '#suffix' => '
', + '#description' => t('Select which operators will be available to select in the exposed operator form. If none are selected, all the operators listed here will be used.'), + '#options' => $operator_options, + '#dependency' => array( + 'edit-options-expose-limit-operators' => array(1), + ), + ); + } } else { $form['expose']['required'] = array( @@ -533,7 +581,7 @@ class views_handler_filter extends views_handler { ); if (!empty($form['operator']['#type'])) { - // Increase the width of the left (operator) column. + // Increase the width of the left (operator) column. $form['operator']['#prefix'] = '
'; $form['operator']['#suffix'] = '
'; $form['value']['#prefix'] = '
'; @@ -552,7 +600,7 @@ class views_handler_filter extends views_handler { '#size' => 40, '#description' => t('This will appear before your operator select field.'), '#dependency' => array( - 'edit-options-expose-use-operator' => array(1) + 'edit-options-expose-use-operator' => array(1), ), ); $form['expose']['operator_id'] = array( @@ -562,7 +610,7 @@ class views_handler_filter extends views_handler { '#size' => 40, '#description' => t('This will appear in the URL after the ? to identify this operator.'), '#dependency' => array( - 'edit-options-expose-use-operator' => array(1) + 'edit-options-expose-use-operator' => array(1), ), '#fieldset' => 'more', ); @@ -629,6 +677,12 @@ class views_handler_filter extends views_handler { if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) { form_error($form['expose']['identifier'], t('This identifier is used by another handler.')); } + + // Filter out roles which weren't selected, so that they aren't exported. + // This is purely cosmetic. + if (!empty($form_state['values']['options']['expose']['remember_roles'])) { + $form_state['values']['options']['expose']['remember_roles'] = array_filter($form_state['values']['options']['expose']['remember_roles']); + } } /** @@ -657,10 +711,13 @@ class views_handler_filter extends views_handler { if (empty($group['remove'])) { // Check if the title is defined but value wasn't defined. if (!empty($group['title'])) { - if ((!is_array($group['value']) && trim($group['value']) == "") || - (is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) { - form_error($form['group_info']['group_items'][$id]['value'], - t('The value is required if title for this item is defined.')); + // No value is needed for 'empty' and 'not empty' operator. + if (!in_array($group['operator'], array('empty', 'not empty'))) { + if ((!is_array($group['value']) && trim($group['value']) == "") || + (is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) { + form_error($form['group_info']['group_items'][$id]['value'], + t('The value is required if title for this item is defined.')); + } } } @@ -786,9 +843,8 @@ class views_handler_filter extends views_handler { } } - /** - * Render our chunk of the exposed filter form when selecting + * Render our chunk of the exposed filter form when selecting. * * You can override this if it doesn't do what you expect. */ @@ -802,7 +858,7 @@ class views_handler_filter extends views_handler { $operator = $this->options['expose']['operator_id']; $this->operator_form($form, $form_state); $form[$operator] = $form['operator']; - $form[$operator]['#title'] = $this->options['expose']['operator_label']; + $form[$operator]['#title'] = $this->options['expose']['operator_label']; $form[$operator]['#title_display'] = 'invisible'; $this->exposed_translate($form[$operator], 'operator'); @@ -813,7 +869,19 @@ class views_handler_filter extends views_handler { // Build the form and set the value based on the identifier. if (!empty($this->options['expose']['identifier'])) { $value = $this->options['expose']['identifier']; - $this->value_form($form, $form_state); + if ($this->operator == 'empty' || $this->operator == 'not empty') { + $boolean = new views_handler_filter_boolean_operator(); + $boolean->value = $this->value = 'All'; + $boolean->value_value = $this->value_value = ''; + $boolean->value_options = $this->value_options = array( + 1 => t('Yes'), + 0 => t('No'), + ); + $boolean->value_form($form, $form_state); + } + else { + $this->value_form($form, $form_state); + } $form[$value] = $form['value']; if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') { @@ -955,7 +1023,7 @@ class views_handler_filter extends views_handler { // The string '- Any -' will not be rendered. // @see theme_views_ui_build_group_filter_form() - $groups = array('All' => '- Any -'); + $groups = array('All' => '- Any -'); // Provide 3 options to start when we are in a new group. if (count($this->options['group_info']['group_items']) == 0) { @@ -968,6 +1036,7 @@ class views_handler_filter extends views_handler { if (!empty($form_state['values']['options']['group_info']['group_items'][$item_id]['remove'])) { continue; } + // Each rows contains three widgets: // a) The title, where users define how they identify a pair of operator // | value. @@ -979,14 +1048,14 @@ class views_handler_filter extends views_handler { $row = array(); $groups[$item_id] = ''; $this->operator_form($row, $form_state); - // Force the operator form to be a select box. Some handlers uses - // radios and they occupy a lot of space in a table row. + // Force the operator form to be a select box. Some handlers uses radios + // and they occupy a lot of space in a table row. $row['operator']['#type'] = 'select'; $row['operator']['#title'] = ''; $this->value_form($row, $form_state); // Fix the dependencies to update value forms when operators changes. - // This is needed because forms are inside a new form and their ids + // This is needed because forms are inside a new form and their IDs // changes. Dependencies are used when operator changes from to // 'Between', 'Not Between', etc, and two or more widgets are displayed. $without_children = TRUE; @@ -1041,6 +1110,7 @@ class views_handler_filter extends views_handler { ), ); } + // From all groups, let chose which is the default. $form['group_info']['default_group'] = array( '#type' => 'radios', @@ -1049,8 +1119,9 @@ class views_handler_filter extends views_handler { '#required' => TRUE, '#attributes' => array( 'class' => array('default-radios'), - ) + ), ); + // From all groups, let chose which is the default. $form['group_info']['default_group_multiple'] = array( '#type' => 'checkboxes', @@ -1058,7 +1129,7 @@ class views_handler_filter extends views_handler { '#default_value' => $this->options['group_info']['default_group_multiple'], '#attributes' => array( 'class' => array('default-checkboxes'), - ) + ), ); $form['group_info']['add_group'] = array( @@ -1086,7 +1157,6 @@ class views_handler_filter extends views_handler { } } - /** * Make some translations to a form item to make it more suitable to exposing. */ @@ -1190,13 +1260,13 @@ class views_handler_filter extends views_handler { /** * Transform the input from a grouped filter into a standard filter. * - * When a filter is a group, find the set of operator and values - * that the choosed item represents, and inform views that a normal - * filter was submitted by telling the operator and the value selected. + * When a filter is a group, find the set of operator and values that the + * choosen item represents, and inform views that a normal filter was + * submitted by telling the operator and the value selected. * * The param $selected_group_id is only passed when the filter uses the - * checkboxes widget, and this function will be called for each item - * choosed in the checkboxes. + * checkboxes widget, and this function will be called for each item choosen + * in the checkboxes. */ public function convert_exposed_input(&$input, $selected_group_id = NULL) { if ($this->is_a_group()) { @@ -1234,9 +1304,12 @@ class views_handler_filter extends views_handler { } /** - * Returns the options available for a grouped filter that users checkboxes - * as widget, and therefore has to be applied several times, one per - * item selected. + * Options available for a grouped filter which uses checkboxes. + * + * Note: has to be applied several times, one per item selected. + * + * @return array + * The options available for a grouped filter. */ public function group_multiple_exposed_input(&$input) { if (!empty($input[$this->options['group_info']['identifier']])) { @@ -1246,7 +1319,7 @@ class views_handler_filter extends views_handler { } /** - * + * Indicate whether users can select multiple group items. * * @return bool * TRUE if users can select multiple groups items of a grouped exposed @@ -1258,8 +1331,9 @@ class views_handler_filter extends views_handler { /** * If set to remember exposed input in the session, store it there. - * This function is similar to store_exposed_input but modified to - * work properly when the filter is a group. + * + * This function is similar to store_exposed_input but modified to work + * properly when the filter is a group. */ public function store_group_input($input, $status) { if (!$this->is_a_group() || empty($this->options['group_info']['identifier'])) { @@ -1312,14 +1386,13 @@ class views_handler_filter extends views_handler { // Various ways to check for the absence of non-required input. if (empty($this->options['expose']['required'])) { - if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') { - $value = ' '; + if ($this->operator == 'empty' || $this->operator == 'not empty') { + $value = is_array($value) ? $value['value'] : $value; + $this->operator = ($this->operator == 'empty' && empty($value)) || ($this->operator == 'not empty' && !empty($value)) ? 'not empty' : 'empty'; } - if ($this->operator != 'empty' && $this->operator != 'not empty') { - if ($value == 'All' || $value === array()) { - return FALSE; - } + if ($value == 'All' || $value === array()) { + return FALSE; } if (!empty($this->always_multiple) && $value === '') { @@ -1342,7 +1415,7 @@ class views_handler_filter extends views_handler { } /** - * + * Store the exposed input for processing later. */ public function store_exposed_input($input, $status) { if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) { @@ -1392,7 +1465,9 @@ class views_handler_filter extends views_handler { $session[$this->options['expose']['operator_id']] = $input[$this->options['expose']['operator_id']]; } - $session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']]; + if (isset($input[$this->options['expose']['identifier']])) { + $session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']]; + } } } @@ -1419,9 +1494,9 @@ class views_handler_filter extends views_handler { * @return bool * Whether the filter can be used in OR groups. */ - public function can_group() { - return TRUE; - } + public function can_group() { + return TRUE; + } } @@ -1476,14 +1551,15 @@ class views_handler_filter_broken extends views_handler_filter { * Filter by no empty values, though allow to use "0". * * @param string $var + * The string to check. * * @return bool + * Indicates if the argument is an empty string. */ function _views_array_filter_zero($var) { - return trim($var) != ""; + return trim($var) != ''; } - /** * @} */ diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_combine.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_combine.inc index 44e6dc93e6..35bfb20fe6 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_combine.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_combine.inc @@ -73,7 +73,7 @@ class views_handler_filter_combine extends views_handler_filter_string { // Always add the table of the selected fields to be sure a table alias // exists. $field->ensure_my_table(); - if (!empty($field->field_alias) && !empty($field->field_alias)) { + if (!empty($field->table_alias) && !empty($field->real_field)) { $fields[] = "$field->table_alias.$field->real_field"; } } @@ -198,6 +198,14 @@ class views_handler_filter_combine extends views_handler_filter_string { $this->query->add_where_expression($this->options['group'], "$field RLIKE $placeholder", array($placeholder => $this->value)); } + /** + * + */ + public function op_not_regex($field) { + $placeholder = $this->placeholder(); + $this->query->add_where_expression($this->options['group'], "$field NOT RLIKE $placeholder", array($placeholder => $this->value)); + } + /** * */ diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_date.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_date.inc index 13e3827ac3..26fb1a37ce 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_date.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_date.inc @@ -158,7 +158,7 @@ class views_handler_filter_date extends views_handler_filter_numeric { return FALSE; } } - else { + elseif ($operators[$operator]['values'] == 2) { if ($this->value['min'] == '' || $this->value['max'] == '') { return FALSE; } diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_numeric.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_numeric.inc index f5467f6825..a338374148 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_numeric.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_numeric.inc @@ -116,6 +116,12 @@ class views_handler_filter_numeric extends views_handler_filter { 'method' => 'op_regex', 'values' => 1, ), + 'not_regular_expression' => array( + 'title' => t('Not regular expression'), + 'short' => t('not regex'), + 'method' => 'op_not_regex', + 'values' => 1, + ), ); } @@ -159,72 +165,108 @@ class views_handler_filter_numeric extends views_handler_filter { // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; + $limit_operators = !empty($this->options['expose']['limit_operators']) && (count($this->options['expose']['available_operators']) > 0); + $use_value = FALSE; + $use_minmax = FALSE; + if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { + $operator_values_with_1_values = $this->operator_values(1); + $operator_values_with_2_values = $this->operator_values(2); + if ($limit_operators) { + // If limit operators is enabled, check that at least one operator + // with two values is enabled to display the min max widgets + foreach ($operator_values_with_2_values as $operator) { + if (isset($this->options['expose']['available_operators'][$operator])) { + $use_minmax = TRUE; + break; + } + } + // the same for operators with one value + foreach ($operator_values_with_1_values as $operator) { + if (isset($this->options['expose']['available_operators'][$operator])) { + $use_value = TRUE; + break; + } + } + } + else { + $use_minmax = $use_value = TRUE; + } $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. - $which = in_array($this->operator, $this->operator_values(2)) ? 'minmax' : 'value'; + $which = in_array($this->operator, $operator_values_with_2_values) ? 'minmax' : 'value'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } + else { + $use_minmax = $use_value = TRUE; + } - if ($which == 'all') { - $form['value']['value'] = array( - '#type' => 'textfield', - '#title' => empty($form_state['exposed']) ? t('Value') : '', - '#size' => 30, - '#default_value' => $this->value['value'], - '#dependency' => array($source => $this->operator_values(1)), - ); - if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) { - $form_state['input'][$identifier]['value'] = $this->value['value']; + if ($use_value) { + if ($which == 'all') { + $form['value']['value'] = array( + '#type' => 'textfield', + '#title' => empty($form_state['exposed']) ? t('Value') : '', + '#size' => 30, + '#default_value' => $this->value['value'], + '#dependency' => array($source => $this->operator_values(1)), + ); + if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) { + $form_state['input'][$identifier]['value'] = $this->value['value']; + } } - } - elseif ($which == 'value') { - // When exposed we drop the value-value and just do value if - // the operator is locked. - $form['value'] = array( - '#type' => 'textfield', - '#title' => empty($form_state['exposed']) ? t('Value') : '', - '#size' => 30, - '#default_value' => $this->value['value'], - ); - if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { - $form_state['input'][$identifier] = $this->value['value']; + elseif ($which == 'value') { + // When exposed we drop the value-value and just do value if + // the operator is locked. + $form['value'] = array( + '#type' => 'textfield', + '#title' => empty($form_state['exposed']) ? t('Value') : '', + '#size' => 30, + '#default_value' => $this->value['value'], + ); + if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { + $form_state['input'][$identifier] = $this->value['value']; + } } } if ($which == 'all' || $which == 'minmax') { - $form['value']['min'] = array( - '#type' => 'textfield', - '#title' => empty($form_state['exposed']) ? t('Min') : '', - '#size' => 30, - '#default_value' => $this->value['min'], - ); - $form['value']['max'] = array( - '#type' => 'textfield', - '#title' => empty($form_state['exposed']) ? t('And max') : t('And'), - '#size' => 30, - '#default_value' => $this->value['max'], - ); - if ($which == 'all') { - $dependency = array( - '#dependency' => array($source => $this->operator_values(2)), + if ($use_minmax) { + $form['value']['min'] = array( + '#type' => 'textfield', + '#title' => empty($form_state['exposed']) ? t('Min') : '', + '#size' => 30, + '#default_value' => $this->value['min'], ); - $form['value']['min'] += $dependency; - $form['value']['max'] += $dependency; + $form['value']['max'] = array( + '#type' => 'textfield', + '#title' => empty($form_state['exposed']) ? t('And max') : t('And'), + '#size' => 30, + '#default_value' => $this->value['max'], + ); + + if ($which == 'all') { + $dependency = array( + '#dependency' => array($source => $this->operator_values(2)), + ); + + $form['value']['min'] += $dependency; + $form['value']['max'] += $dependency; + } } - if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min'])) { + + if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min']) && $use_minmax) { $form_state['input'][$identifier]['min'] = $this->value['min']; } - if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max'])) { + if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max']) && $use_minmax) { $form_state['input'][$identifier]['max'] = $this->value['max']; } @@ -291,6 +333,13 @@ class views_handler_filter_numeric extends views_handler_filter { $this->query->add_where($this->options['group'], $field, $this->value['value'], 'RLIKE'); } + /** + * {@inheritdoc} + */ + public function op_not_regex($field) { + $this->query->add_where($this->options['group'], $field, $this->value['value'], 'NOT RLIKE'); + } + /** * {@inheritdoc} */ diff --git a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_string.inc b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_string.inc index c7b2dcd658..4c60cd1090 100644 --- a/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_string.inc +++ b/profiles/openasu/modules/contrib/views/handlers/views_handler_filter_string.inc @@ -135,6 +135,12 @@ class views_handler_filter_string extends views_handler_filter { 'method' => 'op_regex', 'values' => 1, ), + 'not_regular_expression' => array( + 'title' => t('Not regular expression'), + 'short' => t('not regex'), + 'method' => 'op_not_regex', + 'values' => 1, + ), ); } @@ -275,7 +281,9 @@ class views_handler_filter_string extends views_handler_filter { * {@inheritdoc} */ public function op_contains($field) { - $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE'); + if (!empty($this->value)) { + $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE'); + } } /** @@ -372,6 +380,13 @@ class views_handler_filter_string extends views_handler_filter { $this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE'); } + /** + * {@inheritdoc} + */ + public function op_not_regex($field) { + $this->query->add_where($this->options['group'], $field, $this->value, 'NOT RLIKE'); + } + /** * {@inheritdoc} */ diff --git a/profiles/openasu/modules/contrib/views/help/about.html b/profiles/openasu/modules/contrib/views/help/about.html index 8ba77f86dc..b03d1fcb31 100644 --- a/profiles/openasu/modules/contrib/views/help/about.html +++ b/profiles/openasu/modules/contrib/views/help/about.html @@ -19,9 +19,9 @@
  • Header, which allow you to add by default one or more text area above the views output.
  • -
  • Footer, which allow you to add by default one or more text area beneath the views output.
  • +
  • Footer, which allow you to add by default one or more text area beneath the views output.
  • -
  • The Emtpy Text content will be displayed, when you choose in the Arguments Section "Action to take if argument is not present" the option "Display empty text".
  • +
  • The Emtpy Text content will be displayed, when you choose in the Arguments Section "Action to take if argument is not present" the option "Display empty text".
  • diff --git a/profiles/openasu/modules/contrib/views/help/ui-crashes.html b/profiles/openasu/modules/contrib/views/help/ui-crashes.html index da0ca4fde2..6c2079493b 100644 --- a/profiles/openasu/modules/contrib/views/help/ui-crashes.html +++ b/profiles/openasu/modules/contrib/views/help/ui-crashes.html @@ -1,10 +1,10 @@

    Troubleshooting UI crashes

    -There are a number of reasons why the Views UI may crash; the most common state or result of a crash is either a white screen (everyone's favorite WSOD), or a screen of what looks like garbage text. This is generally a javascript crash of some fashion. +There are a number of reasons why the Views UI may crash; the most common state or result of a crash is either a white screen (everyone's favorite WSOD), or a screen of what looks like garbage text. This is generally JavaScript crash of some fashion. To get the most timely and accurate help in the issue queue, please try to gather this information: -Check your javascript console. In Firefox, you can hit ctrl-shift-j or use firebug. Copy this information into the issue, or attach it as a text file. Really - this is the single biggest thing you can do to help figure out where the crash is coming from. +Check your JavaScript console. In Firefox, you can hit ctrl-shift-j or use firebug. Copy this information into the issue, or attach it as a text file. Really - this is the single biggest thing you can do to help figure out where the crash is coming from.

    JSON prepends data with jQuery, causing editing and preview problems.

    diff --git a/profiles/openasu/modules/contrib/views/includes/admin.inc b/profiles/openasu/modules/contrib/views/includes/admin.inc index a8211b03f3..810c70fc59 100644 --- a/profiles/openasu/modules/contrib/views/includes/admin.inc +++ b/profiles/openasu/modules/contrib/views/includes/admin.inc @@ -691,7 +691,7 @@ function views_ui_ajax_update_form($form, $form_state) { } /** - * Non-Javascript fallback for updating the add view form. + * Non-JavaScript fallback for updating the add view form. */ function views_ui_nojs_submit($form, &$form_state) { $form_state['rebuild'] = TRUE; @@ -1598,7 +1598,7 @@ function views_ui_get_display_tab_details($view, $display) { $is_enabled = $display->handler->get_option('enabled'); if (!$is_display_deleted && $is_deletable && !$is_default) { - $prefix = '
      '; + $prefix = '
        '; $suffix = '
      '; $item_element = 'li'; } @@ -2987,6 +2987,10 @@ function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FAL * together. */ function views_ui_ajax_form($js, $key, $view, $display_id = '') { + $args = func_get_args(); + // Remove the known args. + array_splice($args, 0, 4); + // Reset the cache of IDs. Drupal rather aggressively prevents id duplication // but this causes it to remember IDs that are no longer even being used. if (isset($_POST['ajax_html_ids'])) { @@ -2999,9 +3003,6 @@ function views_ui_ajax_form($js, $key, $view, $display_id = '') { } views_include('ajax'); - $args = func_get_args(); - // Remove the known args. - array_splice($args, 0, 4); $form_state = views_ui_build_form_state($js, $key, $view, $display_id, $args); // check to see if this is the top form of the stack. If it is, pop @@ -3044,6 +3045,11 @@ function views_ui_ajax_form($js, $key, $view, $display_id = '') { $stack = $view->stack; $top = array_shift($stack); $top[0] = $js; + + // Change view into a reference. + $stepview = $top[2]; + $top[2] = &$stepview; + $form_state = call_user_func_array('views_ui_build_form_state', $top); $form_state['input'] = array(); $form_state['url'] = url(views_ui_build_form_url($form_state)); @@ -3165,7 +3171,7 @@ function views_ui_reorder_displays_form($form, &$form_state) { $form['#title'] = t('Displays Reorder'); $form['#section'] = 'reorder'; - // Add javascript settings that will be added via $.extend for tabledragging. + // Add JavaScript settings that will be added via $.extend for tabledragging. $form['#js']['tableDrag']['reorder-displays']['weight'][0] = array( 'target' => 'weight', 'source' => NULL, @@ -3548,7 +3554,7 @@ function views_ui_rearrange_form($form, &$form_state) { ); } - // Add javascript settings that will be added via $.extend for tabledragging. + // Add JavaScript settings that will be added via $.extend for tabledragging. $form['#js']['tableDrag']['arrange']['weight'][0] = array( 'target' => 'weight', 'source' => NULL, @@ -5036,7 +5042,7 @@ function views_ui_admin_settings_advanced() { $form['debug']['views_no_javascript'] = array( '#type' => 'checkbox', '#title' => t('Disable JavaScript with Views'), - '#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without javascript; it's just not as good."), + '#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without JavaScript; it's just not as good."), '#default_value' => variable_get('views_no_javascript', FALSE), ); diff --git a/profiles/openasu/modules/contrib/views/includes/ajax.inc b/profiles/openasu/modules/contrib/views/includes/ajax.inc index e7b3789d8b..37eee9c75d 100644 --- a/profiles/openasu/modules/contrib/views/includes/ajax.inc +++ b/profiles/openasu/modules/contrib/views/includes/ajax.inc @@ -18,8 +18,8 @@ function views_ajax() { if (isset($_REQUEST['view_name']) && isset($_REQUEST['view_display_id'])) { $name = $_REQUEST['view_name']; $display_id = $_REQUEST['view_display_id']; - $args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array(); - $path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL; + $args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', htmlspecialchars_decode($_REQUEST['view_args'], ENT_QUOTES)) : array(); + $path = isset($_REQUEST['view_path']) ? htmlspecialchars_decode($_REQUEST['view_path'], ENT_QUOTES) : NULL; $dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL; $pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL; @@ -72,7 +72,8 @@ function views_ajax() { // Reuse the same DOM id so it matches that in Drupal.settings. $view->dom_id = $dom_id; - $commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, $view->preview($display_id, $args)); + // Always return HTML with the same DOM ID that was sent by the browser. + $commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, preg_replace('/view-dom-id-[a-zA-Z0-9_-]+/', 'view-dom-id-' . $view->dom_id, $view->preview($display_id, $args), 1)); } drupal_alter('views_ajax_data', $commands, $view); return array('#type' => 'ajax', '#commands' => $commands); diff --git a/profiles/openasu/modules/contrib/views/includes/handlers.inc b/profiles/openasu/modules/contrib/views/includes/handlers.inc index 432fb43727..8c2f8eceb2 100644 --- a/profiles/openasu/modules/contrib/views/includes/handlers.inc +++ b/profiles/openasu/modules/contrib/views/includes/handlers.inc @@ -278,6 +278,9 @@ class views_handler extends views_object { return $title; } $title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title']; + if (empty($this->definition['group'])) { + return $title; + } return t('!group: !title', array('!group' => $this->definition['group'], '!title' => $title)); } @@ -418,8 +421,10 @@ class views_handler extends views_object { '#collapsed' => TRUE, '#weight' => 150, ); + // Allow to alter the default values brought into the form. - drupal_alter('views_handler_options', $this->options, $view); + // Triggers hook_views_handler_options_alter(). + drupal_alter('views_handler_options', $this->options, $this); } /** @@ -1000,20 +1005,24 @@ class views_many_to_one_helper { // We do one join per selected value. // Clone the join for each table: - $this->handler->table_aliases = []; - foreach ($this->handler->value as $value) { + $this->handler->table_aliases = array(); + $values = $this->handler->operator === 'not' ? array($this->handler->value) : $this->handler->value; + foreach ($values as $value) { $join = $this->get_join(); if ($this->handler->operator == 'and') { $join->type = 'INNER'; } if (empty($join->extra)) { - $join->extra = []; + $join->extra = array(); } - $join->extra[] = [ + $join->extra[] = array( 'field' => $this->handler->real_field, 'value' => $value, 'numeric' => !empty($this->handler->definition['numeric']), - ]; + ); + if (($this->handler->is_a_group() && is_array($value)) || $this->handler->operator === 'not') { + $value = serialize($value); + } // The table alias needs to be unique to this value across the // multiple times the filter or argument is called by the view. if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) { @@ -1028,6 +1037,9 @@ class views_many_to_one_helper { $this->handler->table_alias = $alias; } } + else { + $this->handler->table_aliases[$value] = $this->handler->view->many_to_one_aliases[$field][$value]; + } } } return $this->handler->table_alias; @@ -1063,12 +1075,17 @@ class views_many_to_one_helper { // should be added via an db_or()/db_and() (TRUE). $add_condition = TRUE; if ($operator == 'or' && empty($options['reduce_duplicates'])) { - if (is_array($value) && count($value) > 1) { + if (count($value) > 1) { $operator = 'IN'; } else { $value = is_array($value) ? array_pop($value) : $value; - $operator = '='; + if (is_array($value) && count($value) > 1) { + $operator = 'IN'; + } + else { + $operator = '='; + } } $add_condition = FALSE; } @@ -1675,15 +1692,18 @@ class views_join { } if (is_array($info['value'])) { + $value_placeholders = array(); + // With an array of values, we need multiple placeholders and the // 'IN' operator is implicit. foreach ($info['value'] as $value) { $placeholder_i = $view_query->placeholder('views_join_condition_'); + $value_placeholders[] = $placeholder_i; $arguments[$placeholder_i] = $value; } $operator = !empty($info['operator']) ? $info['operator'] : 'IN'; - $placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )'; + $placeholder = '( ' . implode(', ', $value_placeholders) . ' )'; } else { // With a single value, the '=' operator is implicit. diff --git a/profiles/openasu/modules/contrib/views/includes/view.inc b/profiles/openasu/modules/contrib/views/includes/view.inc index ae6df4c6ae..4f26650b69 100644 --- a/profiles/openasu/modules/contrib/views/includes/view.inc +++ b/profiles/openasu/modules/contrib/views/includes/view.inc @@ -843,7 +843,11 @@ class view extends views_db_object { $argument->set_relationship(); - $arg = isset($this->args[$position]) ? $this->args[$position] : NULL; + $arg = NULL; + if (isset($this->args[$position]) && $this->args[$position] !== '') { + $arg = $this->args[$position]; + } + $argument->position = $position; if (isset($arg) || $argument->has_default_argument()) { @@ -1575,7 +1579,7 @@ class view extends views_db_object { /** * Override the view's current title. * - * The tokens in the title get's replaced before rendering. + * The tokens in the title get replaced before rendering. */ public function set_title($title) { $this->build_info['title'] = $title; @@ -2008,7 +2012,7 @@ class view extends views_db_object { public function clone_view() { $clone = clone $this; - $keys = array('current_display', 'display_handler', 'build_info', 'built', 'executed', 'attachment_before', 'attachment_after', 'field', 'argument', 'filter', 'sort', 'relationship', 'header', 'footer', 'empty', 'query', 'inited', 'style_plugin', 'plugin_name', 'exposed_data', 'exposed_input', 'exposed_widgets', 'many_to_one_tables', 'feed_icon'); + $keys = array('current_display', 'display_handler', 'build_info', 'built', 'executed', 'attachment_before', 'attachment_after', 'field', 'argument', 'filter', 'sort', 'relationship', 'header', 'footer', 'empty', 'query', 'inited', 'style_plugin', 'plugin_name', 'exposed_data', 'exposed_input', 'exposed_widgets', 'many_to_one_aliases', 'many_to_one_tables', 'feed_icon'); foreach ($keys as $key) { if (isset($clone->{$key})) { unset($clone->{$key}); diff --git a/profiles/openasu/modules/contrib/views/js/ajax_view.js b/profiles/openasu/modules/contrib/views/js/ajax_view.js index c3e5bb923e..5012c33ec3 100644 --- a/profiles/openasu/modules/contrib/views/js/ajax_view.js +++ b/profiles/openasu/modules/contrib/views/js/ajax_view.js @@ -20,7 +20,7 @@ Drupal.views.instances = {}; /** - * Javascript object for a certain view. + * JavaScript object for a certain view. */ Drupal.views.ajaxView = function(settings) { var selector = '.view-dom-id-' + settings.view_dom_id; @@ -69,9 +69,6 @@ // Add the ajax to pagers. this.$view - // Don't attach to nested views. Doing so would attach multiple behaviors - // to a given element. - .filter(jQuery.proxy(this.filterNestedViews, this)) .once(jQuery.proxy(this.attachPagerAjax, this)); // Add a trigger to update this view specifically. In order to trigger a @@ -100,12 +97,6 @@ this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); }; - Drupal.views.ajaxView.prototype.filterNestedViews = function() { - // If there is at least one parent with a view class, this view - // is nested (e.g., an attachment). Bail. - return !this.$view.parents('.view').length; - }; - /** * Attach the ajax behavior to each link. */ @@ -119,8 +110,20 @@ */ Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { var $link = $(link); + // Don't attach to pagers inside nested views. + if ($link.closest('.view')[0] !== this.$view[0]) { + return; + } var viewData = {}; var href = $link.attr('href'); + + // Provide a default page if none has been set. This must be done + // prior to merging with settings to avoid accidentally using the + // page landed on instead of page 1. + if (typeof(viewData.page) === 'undefined') { + viewData.page = 0; + } + // Construct an object using the settings defaults and then overriding // with data specific to the link. $.extend( diff --git a/profiles/openasu/modules/contrib/views/js/jquery.ui.dialog.patch.js b/profiles/openasu/modules/contrib/views/js/jquery.ui.dialog.patch.js index bc468f7561..0b099ce92a 100644 --- a/profiles/openasu/modules/contrib/views/js/jquery.ui.dialog.patch.js +++ b/profiles/openasu/modules/contrib/views/js/jquery.ui.dialog.patch.js @@ -10,7 +10,7 @@ * @see views_ui.module * @see js/jquery.ui.dialog.min.js * - * This javascript patch overwrites the $.ui.dialog.overlay.events object to remove + * This JavaScript patch overwrites the $.ui.dialog.overlay.events object to remove * the mousedown, mouseup and click events from the list of events that are bound * in $.ui.dialog.overlay.create * diff --git a/profiles/openasu/modules/contrib/views/js/views-admin.js b/profiles/openasu/modules/contrib/views/js/views-admin.js index 3c5575012e..807d7f7b18 100644 --- a/profiles/openasu/modules/contrib/views/js/views-admin.js +++ b/profiles/openasu/modules/contrib/views/js/views-admin.js @@ -981,11 +981,11 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { var difference = 0; difference += parseInt($scroll.css('padding-top')); difference += parseInt($scroll.css('padding-bottom')); - difference += $('.views-override').outerHeight(true); - difference += $('.views-messages').outerHeight(true); - difference += $('#views-ajax-title').outerHeight(true); - difference += $('.views-add-form-selected').outerHeight(true); - difference += $('.form-buttons', $modal).outerHeight(true); + difference += $('.views-override').outerHeight(true) || 0; + difference += $('.views-messages').outerHeight(true) || 0; + difference += $('#views-ajax-title').outerHeight(true) || 0; + difference += $('.views-add-form-selected').outerHeight(true) || 0; + difference += $('.form-buttons', $modal).outerHeight(true) || 0; height = scrollHeight + difference; diff --git a/profiles/openasu/modules/contrib/views/js/views-contextual.js b/profiles/openasu/modules/contrib/views/js/views-contextual.js index 5245af6fd8..09fabc9d9e 100644 --- a/profiles/openasu/modules/contrib/views/js/views-contextual.js +++ b/profiles/openasu/modules/contrib/views/js/views-contextual.js @@ -1,6 +1,6 @@ /** * @file - * Javascript related to contextual links. + * JavaScript related to contextual links. */ (function ($) { diff --git a/profiles/openasu/modules/contrib/views/js/views-list.js b/profiles/openasu/modules/contrib/views/js/views-list.js index be67103cf9..d7a274dc8c 100644 --- a/profiles/openasu/modules/contrib/views/js/views-list.js +++ b/profiles/openasu/modules/contrib/views/js/views-list.js @@ -1,6 +1,6 @@ /** * @file - * Javascript related to the main view list. + * JavaScript related to the main view list. */ (function ($) { diff --git a/profiles/openasu/modules/contrib/views/modules/aggregator/views_plugin_row_aggregator_rss.inc b/profiles/openasu/modules/contrib/views/modules/aggregator/views_plugin_row_aggregator_rss.inc index ca5ab60d94..72e941880c 100644 --- a/profiles/openasu/modules/contrib/views/modules/aggregator/views_plugin_row_aggregator_rss.inc +++ b/profiles/openasu/modules/contrib/views/modules/aggregator/views_plugin_row_aggregator_rss.inc @@ -11,12 +11,12 @@ class views_plugin_row_aggregator_rss extends views_plugin_row { /** - * + * {@inheritdoc} */ public $base_table = 'aggregator_item'; /** - * + * {@inheritdoc} */ public $base_field = 'iid'; @@ -52,8 +52,8 @@ class views_plugin_row_aggregator_rss extends views_plugin_row { * {@inheritdoc} */ public function render($row) { - $iid = $row->{$this->field_alias}; - $sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, "; + $iid = $row->{$this->field_alias}; + $sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, "; $sql .= "ai.timestamp, ai.guid, af.title AS feed_title, ai.link AS feed_LINK "; $sql .= "FROM {aggregator_item} ai LEFT JOIN {aggregator_feed} af ON ai.fid = af.fid "; $sql .= "WHERE ai.iid = :iid"; @@ -72,7 +72,7 @@ class views_plugin_row_aggregator_rss extends views_plugin_row { array( 'key' => 'guid', 'value' => $item->guid, - 'attributes' => array('isPermaLink' => 'false') + 'attributes' => array('isPermaLink' => 'false'), ), ); @@ -85,7 +85,7 @@ class views_plugin_row_aggregator_rss extends views_plugin_row { return theme($this->theme_functions(), array( 'view' => $this->view, 'options' => $this->options, - 'row' => $item + 'row' => $item, )); } diff --git a/profiles/openasu/modules/contrib/views/modules/comment.views.inc b/profiles/openasu/modules/contrib/views/modules/comment.views.inc index 17c31c774b..3cecfcc260 100644 --- a/profiles/openasu/modules/contrib/views/modules/comment.views.inc +++ b/profiles/openasu/modules/contrib/views/modules/comment.views.inc @@ -133,8 +133,8 @@ function comment_views_data() { // Email address. $data['comment']['mail'] = array( - 'title' => t('Mail'), - 'help' => t('Email of user that posted the comment. Will be empty if the author is a registered user.'), + 'title' => t('E-mail'), + 'help' => t('E-mail of user that posted the comment. Will be empty if the author is a registered user.'), 'field' => array( 'handler' => 'views_handler_field', 'click sortable' => TRUE, @@ -320,7 +320,7 @@ function comment_views_data() { // Status (approved or not). $data['comment']['status'] = array( - 'title' => t('Approved'), + 'title' => t('Approved status'), 'help' => t('Whether the comment is approved (or still in the moderation queue).'), 'field' => array( 'handler' => 'views_handler_field_boolean', @@ -331,7 +331,7 @@ function comment_views_data() { ), 'filter' => array( 'handler' => 'views_handler_filter_boolean_operator', - 'label' => t('Approved comment'), + 'label' => t('Approved comment status'), 'type' => 'yes-no', ), 'sort' => array( @@ -342,7 +342,7 @@ function comment_views_data() { // Link to view comment. $data['comment']['view_comment'] = array( 'field' => array( - 'title' => t('View link'), + 'title' => t('Link to comment'), 'help' => t('Provide a simple link to view the comment.'), 'handler' => 'views_handler_field_comment_link', ), @@ -351,7 +351,7 @@ function comment_views_data() { // Link to edit comment. $data['comment']['edit_comment'] = array( 'field' => array( - 'title' => t('Edit link'), + 'title' => t('Link to edit comment'), 'help' => t('Provide a simple link to edit the comment.'), 'handler' => 'views_handler_field_comment_link_edit', ), @@ -360,7 +360,7 @@ function comment_views_data() { // Link to delete comment. $data['comment']['delete_comment'] = array( 'field' => array( - 'title' => t('Delete link'), + 'title' => t('Link to delete comment'), 'help' => t('Provide a simple link to delete the comment.'), 'handler' => 'views_handler_field_comment_link_delete', ), @@ -369,7 +369,7 @@ function comment_views_data() { // Link to approve comment. $data['comment']['approve_comment'] = array( 'field' => array( - 'title' => t('Approve link'), + 'title' => t('Link to approve comment'), 'help' => t('Provide a simple link to approve the comment.'), 'handler' => 'views_handler_field_comment_link_approve', ), @@ -378,7 +378,7 @@ function comment_views_data() { // Link to reply to comment. $data['comment']['replyto_comment'] = array( 'field' => array( - 'title' => t('Reply-to link'), + 'title' => t('Link to reply-to comment'), 'help' => t('Provide a simple link to reply to the comment.'), 'handler' => 'views_handler_field_comment_link_reply', ), @@ -419,6 +419,20 @@ function comment_views_data() { ), ); + $data['comment']['cid'] = array( + 'title' => t('Comment id'), + 'help' => t('Unique identifier for the comment.'), + 'filter' => array( + 'handler' => 'views_handler_filter_numeric', + ), + 'argument' => array( + 'handler' => 'views_handler_argument_numeric', + ), + 'field' => array( + 'handler' => 'views_handler_field_numeric', + ), + ); + $data['comment']['uid'] = array( 'title' => t('Author uid'), 'help' => t('If you need more fields than the uid add the comment: author relationship'), @@ -544,7 +558,7 @@ function comment_views_data() { 'title' => t('Last comment CID'), 'help' => t('Display the last comment of a node'), 'relationship' => array( - 'title' => t('Last Comment'), + 'title' => t('Last comment'), 'help' => t('The last comment of a node.'), 'group' => t('Comment'), 'base' => 'comment', diff --git a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_approve.inc b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_approve.inc index b161eeb0a3..6776a6c661 100644 --- a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_approve.inc +++ b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_approve.inc @@ -16,7 +16,7 @@ class views_handler_field_comment_link_approve extends views_handler_field_comme * {@inheritdoc} */ public function access() { - //needs permission to administer comments in general + // Needs permission to administer comments in general. return user_access('administer comments'); } @@ -32,7 +32,7 @@ class views_handler_field_comment_link_approve extends views_handler_field_comme } $text = !empty($this->options['text']) ? $this->options['text'] : t('approve'); - $cid = $this->get_value($values, 'cid'); + $cid = $this->get_value($values, 'cid'); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "comment/" . $cid . "/approve"; diff --git a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_delete.inc b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_delete.inc index 6b230eacac..ade8cb9b1f 100644 --- a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_delete.inc +++ b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_delete.inc @@ -25,7 +25,7 @@ class views_handler_field_comment_link_delete extends views_handler_field_commen */ public function render_link($data, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('delete'); - $cid = $this->get_value($values, 'cid'); + $cid = $this->get_value($values, 'cid'); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "comment/" . $cid . "/delete"; diff --git a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_reply.inc b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_reply.inc index 581b06dd97..aa2d7dadcd 100644 --- a/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_reply.inc +++ b/profiles/openasu/modules/contrib/views/modules/comment/views_handler_field_comment_link_reply.inc @@ -25,8 +25,8 @@ class views_handler_field_comment_link_reply extends views_handler_field_comment */ public function render_link($data, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('reply'); - $nid = $this->get_value($values, 'nid'); - $cid = $this->get_value($values, 'cid'); + $nid = $this->get_value($values, 'nid'); + $cid = $this->get_value($values, 'cid'); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "comment/reply/" . $nid . '/' . $cid; diff --git a/profiles/openasu/modules/contrib/views/modules/field/views_handler_field_field.inc b/profiles/openasu/modules/contrib/views/modules/field/views_handler_field_field.inc index cbc22513ab..da316049bb 100644 --- a/profiles/openasu/modules/contrib/views/modules/field/views_handler_field_field.inc +++ b/profiles/openasu/modules/contrib/views/modules/field/views_handler_field_field.inc @@ -127,7 +127,7 @@ class views_handler_field_field extends views_handler_field { */ public function access() { $base_table = $this->get_base_table(); - return field_access('view', $this->field_info, $this->definition['entity_tables'][$base_table]); + return isset($this->definition['entity_tables'][$base_table]) && field_access('view', $this->field_info, $this->definition['entity_tables'][$base_table]); } /** @@ -537,6 +537,7 @@ class views_handler_field_field extends views_handler_field { 'ul' => t('Unordered list'), 'ol' => t('Ordered list'), 'separator' => t('Simple separator'), + 'count' => t('Count'), ), '#dependency' => array('edit-options-group-rows' => array(TRUE)), '#default_value' => $this->options['multi_type'], @@ -727,6 +728,9 @@ class views_handler_field_field extends views_handler_field { if ($this->options['multi_type'] == 'separator') { return implode(filter_xss_admin($this->options['separator']), $items); } + elseif ($this->options['multi_type'] == 'count') { + return count($items); + } else { return theme('item_list', array( diff --git a/profiles/openasu/modules/contrib/views/modules/node.views.inc b/profiles/openasu/modules/contrib/views/modules/node.views.inc index 642825f7cb..2eb351d9f1 100644 --- a/profiles/openasu/modules/contrib/views/modules/node.views.inc +++ b/profiles/openasu/modules/contrib/views/modules/node.views.inc @@ -155,7 +155,7 @@ function node_views_data() { // Published status. $data['node']['status'] = array( - 'title' => t('Published'), + 'title' => t('Published status'), 'help' => t('Whether or not the content is published.'), 'field' => array( 'handler' => 'views_handler_field_boolean', @@ -166,7 +166,7 @@ function node_views_data() { ), 'filter' => array( 'handler' => 'views_handler_filter_boolean_operator', - 'label' => t('Published'), + 'label' => t('Published status'), 'type' => 'yes-no', 'use equal' => TRUE, // Use status = 1 instead of status <> 0 in WHERE statment. @@ -178,18 +178,18 @@ function node_views_data() { // Published status + extra. $data['node']['status_extra'] = array( - 'title' => t('Published or admin'), + 'title' => t('Published status or admin user'), 'help' => t('Filters out unpublished content if the current user cannot view it.'), 'filter' => array( 'field' => 'status', 'handler' => 'views_handler_filter_node_status', - 'label' => t('Published or admin'), + 'label' => t('Published status or admin user'), ), ); // Promote status. $data['node']['promote'] = array( - 'title' => t('Promoted to front page'), + 'title' => t('Promoted to front page status'), 'help' => t('Whether or not the content is promoted to the front page.'), 'field' => array( 'handler' => 'views_handler_field_boolean', @@ -200,7 +200,7 @@ function node_views_data() { ), 'filter' => array( 'handler' => 'views_handler_filter_boolean_operator', - 'label' => t('Promoted to front page'), + 'label' => t('Promoted to front page status'), 'type' => 'yes-no', ), 'sort' => array( @@ -211,7 +211,7 @@ function node_views_data() { // Sticky. $data['node']['sticky'] = array( // The item it appears as on the UI, - 'title' => t('Sticky'), + 'title' => t('Sticky status'), // The help that appears on the UI, 'help' => t('Whether or not the content is sticky.'), // Information for displaying a title as a field. @@ -224,7 +224,7 @@ function node_views_data() { ), 'filter' => array( 'handler' => 'views_handler_filter_boolean_operator', - 'label' => t('Sticky'), + 'label' => t('Sticky status'), 'type' => 'yes-no', ), 'sort' => array( @@ -241,7 +241,7 @@ function node_views_data() { $data['node']['view_node']['moved to'] = array('views_entity_node', 'view_node'); $data['views_entity_node']['view_node'] = array( 'field' => array( - 'title' => t('Link'), + 'title' => t('Link to content'), 'help' => t('Provide a simple link to the content.'), 'handler' => 'views_handler_field_node_link', ), @@ -250,7 +250,7 @@ function node_views_data() { $data['node']['edit_node']['moved to'] = array('views_entity_node', 'edit_node'); $data['views_entity_node']['edit_node'] = array( 'field' => array( - 'title' => t('Edit link'), + 'title' => t('Link to edit content'), 'help' => t('Provide a simple link to edit the content.'), 'handler' => 'views_handler_field_node_link_edit', ), @@ -259,7 +259,7 @@ function node_views_data() { $data['node']['delete_node']['moved to'] = array('views_entity_node', 'delete_node'); $data['views_entity_node']['delete_node'] = array( 'field' => array( - 'title' => t('Delete link'), + 'title' => t('Link to delete content'), 'help' => t('Provide a simple link to delete the content.'), 'handler' => 'views_handler_field_node_link_delete', ), @@ -387,7 +387,7 @@ function node_views_data() { 'title' => t('Author uid'), 'help' => t('The user authoring the content. If you need more fields than the uid add the content: author relationship'), 'relationship' => array( - 'title' => t('Author'), + 'title' => t('Content author'), 'help' => t('Relate content to the user who created it.'), 'handler' => 'views_handler_relationship', 'base' => 'users', @@ -606,7 +606,7 @@ function node_views_data() { $data['node_revision']['link_to_revision'] = array( 'field' => array( - 'title' => t('Link'), + 'title' => t('Link to revision'), 'help' => t('Provide a simple link to the revision.'), 'handler' => 'views_handler_field_node_revision_link', ), @@ -614,7 +614,7 @@ function node_views_data() { $data['node_revision']['revert_revision'] = array( 'field' => array( - 'title' => t('Revert link'), + 'title' => t('Link to revert revision'), 'help' => t('Provide a simple link to revert to the revision.'), 'handler' => 'views_handler_field_node_revision_link_revert', ), @@ -622,7 +622,7 @@ function node_views_data() { $data['node_revision']['delete_revision'] = array( 'field' => array( - 'title' => t('Delete link'), + 'title' => t('Link to delete revision'), 'help' => t('Provide a simple link to delete the content revision.'), 'handler' => 'views_handler_field_node_revision_link_delete', ), diff --git a/profiles/openasu/modules/contrib/views/modules/taxonomy.views.inc b/profiles/openasu/modules/contrib/views/modules/taxonomy.views.inc index ddf91e13fb..99c3b7138f 100644 --- a/profiles/openasu/modules/contrib/views/modules/taxonomy.views.inc +++ b/profiles/openasu/modules/contrib/views/modules/taxonomy.views.inc @@ -17,7 +17,7 @@ function taxonomy_views_data() { // 'taxonomy_vocabulary' table. $data['vocabulary']['moved to'] = 'taxonomy_vocabulary'; $data['taxonomy_vocabulary']['table']['group'] = t('Taxonomy vocabulary'); - + $data['taxonomy_vocabulary']['table']['entity type'] = 'taxonomy_vocabulary'; $data['taxonomy_vocabulary']['table']['join'] = array( // Vocabulary links to taxonomy_term_data directly via vid. 'taxonomy_term_data' => array( diff --git a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_field_term_link_edit.inc b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_field_term_link_edit.inc index 1e238f4448..3bd3212325 100644 --- a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_field_term_link_edit.inc +++ b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_field_term_link_edit.inc @@ -59,20 +59,26 @@ class views_handler_field_term_link_edit extends views_handler_field { /** * {@inheritdoc} */ - public function render($values) { - // Check there is an actual value, as on a relationship there may not be. - if ($tid = $this->get_value($values, 'tid')) { - // Mock a term object for taxonomy_term_edit_access(). Use machine name - // and vid to ensure compatibility with vid based and machine name based - // access checks. See http://drupal.org/node/995156 - $term = new stdClass(); - $term->vid = $values->{$this->aliases['vid']}; - $term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']}; - if (taxonomy_term_edit_access($term)) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); - $tid = $this->get_value($values, 'tid'); - return l($text, 'taxonomy/term/' . $tid . '/edit', array('query' => drupal_get_destination())); - } + function render($values) { + $value = $this->get_value($values, 'tid'); + return $this->render_link($this->sanitize_value($value), $values); + } + + /** + * {@inheritdoc} + */ + function render_link($data, $values) { + // Mock a term object for taxonomy_term_edit_access(). Use machine name and + // vid to ensure compatibility with vid based and machine name based + // access checks. See http://drupal.org/node/995156 + $term = new stdClass(); + $term->vid = $values->{$this->aliases['vid']}; + $term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']}; + if ($data && taxonomy_term_edit_access($term)) { + $text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); + $this->options['alter']['path'] = "taxonomy/term/$data/edit"; + $this->options['alter']['query'] = drupal_get_destination(); + return $text; } } diff --git a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_filter_term_node_tid.inc b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_filter_term_node_tid.inc index 0b3188ae99..03b8d11e4f 100644 --- a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_filter_term_node_tid.inc +++ b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_handler_filter_term_node_tid.inc @@ -61,6 +61,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on $options['vocabulary'] = array('default' => 0); $options['hierarchy'] = array('default' => 0); $options['error_message'] = array('default' => TRUE, 'bool' => TRUE); + $options['optgroups'] = array('default' => 0); return $options; } @@ -106,6 +107,14 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on '#default_value' => !empty($this->options['hierarchy']), '#dependency' => array('radio:options[type]' => array('select')), ); + + $form['optgroups'] = array( + '#type' => 'checkbox', + '#title' => t('Show groups in dropdown'), + '#default_value' => !empty($this->options['optgroups']), + '#dependency' => array('radio:options[type]' => array('select')), + ); + } /** @@ -145,15 +154,22 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on else { if (!empty($this->options['hierarchy']) && $this->options['limit']) { $tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE); - $options = array(); - - if ($tree) { - // Translation system needs full entity objects, so we have access to - // label. - foreach ($tree as $term) { - $choice = new stdClass(); - $choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term)); - $options[] = $choice; + if (!empty($tree)) { + if (!empty($this->options['optgroups'])) { + foreach ($tree as $term) { + $term_name = entity_label('taxonomy_term', $term); + if ($term->parents[0] == 0) { + $parent_name = $term_name; + } + else { + $options[$parent_name][$term->tid] = str_repeat('-', $term->depth - 1) . $term_name; + } + } + } + else { + foreach ($tree as $term) { + $options[$term->tid] = str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term); + } } } } diff --git a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc index 343af3cb12..7e7f2c154b 100644 --- a/profiles/openasu/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc +++ b/profiles/openasu/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc @@ -227,7 +227,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument $query = db_select('taxonomy_term_data', 'td'); $query->addTag('taxonomy_term_access'); - $query->condition('tid', $args); + $query->condition('td.tid', $args); $query->addField('td', 'tid', 'tid'); if (!empty($vocabularies)) { $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); diff --git a/profiles/openasu/modules/contrib/views/modules/translation/views_handler_field_node_link_translate.inc b/profiles/openasu/modules/contrib/views/modules/translation/views_handler_field_node_link_translate.inc index aedbb83403..257c3b86db 100644 --- a/profiles/openasu/modules/contrib/views/modules/translation/views_handler_field_node_link_translate.inc +++ b/profiles/openasu/modules/contrib/views/modules/translation/views_handler_field_node_link_translate.inc @@ -20,7 +20,7 @@ class views_handler_field_node_link_translate extends views_handler_field_node_l $node = $this->get_value($values); $node->status = 1; // unpublished nodes ignore access control. - if (empty($node->language) || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) { + if ($node->language == LANGUAGE_NONE || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) { return; } diff --git a/profiles/openasu/modules/contrib/views/modules/user.views.inc b/profiles/openasu/modules/contrib/views/modules/user.views.inc index 97abd2728a..7d96a73538 100644 --- a/profiles/openasu/modules/contrib/views/modules/user.views.inc +++ b/profiles/openasu/modules/contrib/views/modules/user.views.inc @@ -110,6 +110,19 @@ function user_views_data() { ), ); + // Comments authored. + $data['users']['uid_comment'] = array( + 'relationship' => array( + 'title' => t('Comments authored'), + 'help' => t('Relate comments to the user who created it. This relationship will create one record for each comment created by the user.'), + 'handler' => 'views_handler_relationship', + 'base' => 'comment', + 'base field' => 'uid', + 'field' => 'uid', + 'label' => t('comments'), + ), + ); + // User name. $data['users']['name'] = array( // The item it appears as on the UI, @@ -139,7 +152,7 @@ function user_views_data() { // The item it appears as on the UI, 'title' => t('E-mail'), // The help that appears on the UI, - 'help' => t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.'), + 'help' => t('E-mail address for a given user. This field is normally not shown to users, so be cautious when using it.'), 'field' => array( 'handler' => 'views_handler_field_user_mail', 'click sortable' => TRUE, @@ -200,7 +213,7 @@ function user_views_data() { // Link. $data['users']['view_user'] = array( 'field' => array( - 'title' => t('Link'), + 'title' => t('Link to user'), 'help' => t('Provide a simple link to the user.'), 'handler' => 'views_handler_field_user_link', ), @@ -318,7 +331,7 @@ function user_views_data() { // Active status. $data['users']['status'] = array( // The item it appears as on the UI, - 'title' => t('Active'), + 'title' => t('Active status'), // The help that appears on the UI, 'help' => t('Whether a user is active or blocked.'), // Information for displaying a title as a field. @@ -357,7 +370,7 @@ function user_views_data() { $data['users']['edit_node'] = array( 'field' => array( - 'title' => t('Edit link'), + 'title' => t('Link to edit user'), 'help' => t('Provide a simple link to edit the user.'), 'handler' => 'views_handler_field_user_link_edit', ), @@ -365,7 +378,7 @@ function user_views_data() { $data['users']['cancel_node'] = array( 'field' => array( - 'title' => t('Cancel link'), + 'title' => t('Link to cancel user'), 'help' => t('Provide a simple link to cancel the user.'), 'handler' => 'views_handler_field_user_link_cancel', ), diff --git a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user.inc b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user.inc index 7939612257..8856c4ab93 100644 --- a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user.inc +++ b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user.inc @@ -17,9 +17,7 @@ class views_handler_field_user extends views_handler_field { */ public function init(&$view, &$data) { parent::init($view, $data); - if (!empty($this->options['link_to_user'])) { - $this->additional_fields['uid'] = 'uid'; - } + $this->additional_fields['uid'] = 'uid'; } /** diff --git a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_language.inc b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_language.inc index b96963d94c..9f2ae4f3c6 100644 --- a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_language.inc +++ b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_language.inc @@ -35,12 +35,4 @@ class views_handler_field_user_language extends views_handler_field_user { return $this->sanitize_value($lang->name); } - /** - * {@inheritdoc} - */ - public function render($values) { - $value = $this->get_value($values); - return $this->render_link($this->sanitize_value($value), $values); - } - } diff --git a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_name.inc b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_name.inc index 7043718a6d..c7bf8c6918 100644 --- a/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_name.inc +++ b/profiles/openasu/modules/contrib/views/modules/user/views_handler_field_user_name.inc @@ -12,16 +12,6 @@ */ class views_handler_field_user_name extends views_handler_field_user { - /** - * Add uid in the query so we can test for anonymous if needed. - */ - public function init(&$view, &$data) { - parent::init($view, $data); - if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) { - $this->additional_fields['uid'] = 'uid'; - } - } - /** * {@inheritdoc} */ @@ -73,6 +63,10 @@ class views_handler_field_user_name extends views_handler_field_user { $account = new stdClass(); $account->uid = $this->get_value($values, 'uid'); $account->name = $this->get_value($values); + // If we don't have a UID, we can't format anything. + if (!isset($account->uid)) { + return $data; + } if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) { if (!empty($this->options['overwrite_anonymous']) && !$account->uid) { // This is an anonymous user, and we're overriting the text. diff --git a/profiles/openasu/modules/contrib/views/plugins/export_ui/views_ui.class.php b/profiles/openasu/modules/contrib/views/plugins/export_ui/views_ui.class.php index 97a69a1e21..81cbdac322 100644 --- a/profiles/openasu/modules/contrib/views/plugins/export_ui/views_ui.class.php +++ b/profiles/openasu/modules/contrib/views/plugins/export_ui/views_ui.class.php @@ -364,6 +364,8 @@ function tablesort_link($label, $field, $class) { * */ function clone_page($js, $input, $item, $step = NULL) { + $args = func_get_args(); + drupal_set_title($this->get_page_title('clone', $item)); $name = $item->{$this->plugin['export']['key']}; @@ -380,7 +382,7 @@ function clone_page($js, $input, $item, $step = NULL) { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = drupal_build_form('views_ui_clone_form', $form_state); diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_cache.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_cache.inc index 6fdc5bbab1..80eb8314b8 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_cache.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_cache.inc @@ -181,7 +181,7 @@ class views_plugin_cache extends views_plugin { } /** - * Start caching javascript, css and other out of band info. + * Start caching JavaScript, css and other out of band info. * * This takes a snapshot of the current system state so that we don't * duplicate it. Later on, when gather_headers() is run, this information @@ -214,10 +214,10 @@ class views_plugin_cache extends views_plugin { $css_start = isset($this->storage['css']) ? $this->storage['css'] : array(); $this->storage['css'] = $this->assetDiff($css, $css_start, $array_mapping_func); - // Get javascript after/before views renders. + // Get JavaScript after/before views renders. $js = drupal_add_js(); $js_start = isset($this->storage['js']) ? $this->storage['js'] : array(); - // If there are any differences between the old and the new javascript then + // If there are any differences between the old and the new JavaScript then // store them to be added later. $this->storage['js'] = $this->assetDiff($js, $js_start, $array_mapping_func); @@ -353,8 +353,15 @@ class views_plugin_cache extends views_plugin { // If the default query back-end is used generate SQL query strings from // the query objects. if ($build_info[$index] instanceof SelectQueryInterface) { - $query = clone $build_info[$index]; - $query->preExecute(); + $query = $build_info[$index]; + + // If the query was not yet prepared, work on a clone and run + // preExecute(). + if (!$query->isPrepared()) { + $query = clone $build_info[$index]; + $query->preExecute(); + } + $key_data['build_info'][$index] = array( 'sql' => (string) $query, 'arguments' => $query->getArguments(), diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display.inc index fd8de19e9a..7383ac98c3 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display.inc @@ -32,12 +32,16 @@ class views_plugin_display extends views_plugin { public $view = NULL; /** + * List of handlers for this display. * + * @var array */ public $handlers = array(); /** * Stores all available display extenders. + * + * @var array */ public $extender = array(); @@ -131,7 +135,7 @@ class views_plugin_display extends views_plugin { $pager = array( 'type' => $type, 'options' => array( - 'offset' => intval($offset) + 'offset' => intval($offset), ), ); @@ -143,8 +147,8 @@ class views_plugin_display extends views_plugin { $pager['options']['id'] = $id; } - // Unset the previous options - // After edit and save the view they will be erased + // Unset the previous options. After edit and save the view they will be + // erased. $this->set_option('items_per_page', NULL); $this->set_option('offset', NULL); $this->set_option('use_pager', NULL); @@ -152,10 +156,9 @@ class views_plugin_display extends views_plugin { $changed = TRUE; } - - // Plugable headers, footer and empty texts are - // not compatible with previous version of views - // This code converts old values into a configured handler for each area + // Plugable headers, footer and empty texts are not compatible with + // previous version of views. This code converts old values into a + // configured handler for each area. foreach (array('header', 'footer', 'empty') as $area) { $converted = FALSE; if (isset($this->options[$area]) && !is_array($this->options[$area])) { @@ -182,7 +185,7 @@ class views_plugin_display extends views_plugin { $changed = TRUE; } } - // Ensure that options are at least an empty array + // Ensure that options are at least an empty array. if (!$converted) { $this->set_option($area, array()); } @@ -195,7 +198,7 @@ class views_plugin_display extends views_plugin { $query_settings = $this->get_option('query'); $query_settings['options']['distinct'] = $distinct; $this->set_option('query', $query_settings); - // Clear the values + // Clear the values. $this->set_option('distinct', NULL); $changed = TRUE; } @@ -217,10 +220,10 @@ class views_plugin_display extends views_plugin { // Convert filter groups. $filter_groups = $this->get_option('filter_groups'); // Only convert if it wasn't converted yet, which is the case if there is a - // 0 group. + // '0' group. if (isset($filter_groups['groups'][0])) { // Update filter groups. - $filter_groups ['groups'] = views_array_key_plus($filter_groups['groups']); + $filter_groups['groups'] = views_array_key_plus($filter_groups['groups']); $this->set_option('filter_groups', $filter_groups); // Update the filter group on each filter. $filters = $this->get_option('filters'); @@ -285,16 +288,19 @@ class views_plugin_display extends views_plugin { } /** - * Determine if this display is the 'default' display which contains - * fallback settings + * If this display is the 'default' display which contains fallback settings. + * + * @return bool + * This is the default display and contains fallback settings. */ public function is_default_display() { return FALSE; } /** - * Determine if this display uses exposed filters, so the view - * will know whether or not to build them. + * Does this display uses exposed filters? + * + * So the view will know whether or not to build them. */ public function uses_exposed() { if (!isset($this->has_exposed)) { @@ -319,13 +325,12 @@ class views_plugin_display extends views_plugin { } /** - * Determine if this display should display the exposed - * filters widgets, so the view will know whether or not - * to render them. + * Determine if this display should display the exposed filters widgets. * - * Regardless of what this function - * returns, exposed filters will not be used nor - * displayed unless uses_exposed() returns TRUE. + * If so, the view will know whether or not to render them. + * + * Regardless of what this function returns, exposed filters will not be used + * nor displayed unless uses_exposed() returns TRUE. */ public function displays_exposed() { return TRUE; @@ -422,8 +427,7 @@ class views_plugin_display extends views_plugin { } /** - * Static member function to list which sections are defaultable - * and what items each section contains. + * List which sections are defaultable and what items each section contains. */ public function defaultable_sections($section = NULL) { $sections = array( @@ -464,10 +468,30 @@ class views_plugin_display extends views_plugin { 'link_display' => array('link_display', 'link_url'), // Force these to cascade properly. - 'style_plugin' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'), - 'style_options' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'), - 'row_plugin' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'), - 'row_options' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'), + 'style_plugin' => array( + 'style_plugin', + 'style_options', + 'row_plugin', + 'row_options', + ), + 'style_options' => array( + 'style_plugin', + 'style_options', + 'row_plugin', + 'row_options', + ), + 'row_plugin' => array( + 'style_plugin', + 'style_options', + 'row_plugin', + 'row_options', + ), + 'row_options' => array( + 'style_plugin', + 'style_options', + 'row_plugin', + 'row_options', + ), 'pager' => array('pager', 'pager_options'), 'pager_options' => array('pager', 'pager_options'), @@ -475,7 +499,7 @@ class views_plugin_display extends views_plugin { 'exposed_form' => array('exposed_form', 'exposed_form_options'), 'exposed_form_options' => array('exposed_form', 'exposed_form_options'), - // These guys are special + // These guys are special. 'header' => array('header'), 'footer' => array('footer'), 'empty' => array('empty'), @@ -636,42 +660,60 @@ class views_plugin_display extends views_plugin { // therefore need special handling. 'access' => array( 'contains' => array( - 'type' => array('default' => 'none', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'), - ), + 'type' => array( + 'default' => 'none', + 'export' => 'export_plugin', + 'unpack_translatable' => 'unpack_plugin', + ), + ), ), 'cache' => array( 'contains' => array( - 'type' => array('default' => 'none', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'), - ), + 'type' => array( + 'default' => 'none', + 'export' => 'export_plugin', + 'unpack_translatable' => 'unpack_plugin', + ), + ), ), 'query' => array( 'contains' => array( - 'type' => array('default' => 'views_query', 'export' => 'export_plugin'), + 'type' => array( + 'default' => 'views_query', + 'export' => 'export_plugin', + ), 'options' => array('default' => array(), 'export' => FALSE), - ), + ), ), - // Note that exposed_form plugin has options in a separate array, - // while access and cache do not. access and cache are legacy and - // that pattern should not be repeated, but it is left as is to - // reduce the need to modify older views. Let's consider the - // pattern used here to be the template from which future plugins - // should be copied. + // Note that exposed_form plugin has options in a separate array, while + // access and cache do not. access and cache are legacy and that pattern + // should not be repeated, but it is left as is to reduce the need to + // modify older views. Let's consider the pattern used here to be the + // template from which future plugins should be copied. 'exposed_form' => array( 'contains' => array( - 'type' => array('default' => 'basic', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'), + 'type' => array( + 'default' => 'basic', + 'export' => 'export_plugin', + 'unpack_translatable' => 'unpack_plugin', + ), 'options' => array('default' => array(), 'export' => FALSE), - ), + ), ), 'pager' => array( 'contains' => array( - 'type' => array('default' => 'full', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'), + 'type' => array( + 'default' => 'full', + 'export' => 'export_plugin', + 'unpack_translatable' => 'unpack_plugin', + ), 'options' => array('default' => array(), 'export' => FALSE), - ), + ), ), - // Note that the styles have their options completely independent. - // Like access and cache above, this is a legacy pattern and - // should not be repeated. + // Note that the styles have their options completely independent. Like + // access and cache above, this is a legacy pattern and should not be + // repeated. 'style_plugin' => array( 'default' => 'default', 'export' => 'export_style', @@ -817,7 +859,7 @@ class views_plugin_display extends views_plugin { else { return $display_id; } - // fall-through returns NULL + // Fall-through returns NULL. } /** @@ -898,6 +940,7 @@ class views_plugin_display extends views_plugin { * The name of the plugin defined in hook_views_plugins. * * @return views_plugin|FALSE + * FALSE if no plugin, otherwise the requested instance of a plugin. */ public function get_plugin($type = 'style', $name = NULL) { static $cache = array(); @@ -931,7 +974,7 @@ class views_plugin_display extends views_plugin { $plugin = views_get_plugin($type, $name); if (!$plugin) { - return; + return FALSE; } if ($type != 'query') { $plugin->init($this->view, $this->display, $options); @@ -1033,13 +1076,13 @@ class views_plugin_display extends views_plugin { /** * List of fields for the current display with the associated relationship. * - * @param $groupable_only - * Return only an array of field labels from handler that return TRUE - * from use_string_group_by method. + * @param bool $groupable_only + * Return only an array of field labels from handler that return TRUE from + * use_string_group_by method. */ public function get_field_labels() { - // Use func_get_arg so the function signature isn't amended but we can - // still pass TRUE into the function to filter by groupable handlers. + // Use func_get_arg so the function signature isn't amended but we can still + // pass TRUE into the function to filter by groupable handlers. $args = func_get_args(); $groupable_only = isset($args[0]) ? $args[0] : FALSE; @@ -1080,9 +1123,8 @@ class views_plugin_display extends views_plugin { return $this->default_display->set_option($option, $value); } - // Set this in two places: On the handler where we'll notice it - // but also on the display object so it gets saved. This should - // only be a temporary fix. + // Set this in two places: On the handler where we'll notice it but also on + // the display object so it gets saved. This should only be a temporary fix. $this->display->display_options[$option] = $value; return $this->options[$option] = $value; } @@ -1118,14 +1160,24 @@ class views_plugin_display extends views_plugin { $text = views_ui_truncate($text, 24); } - return l($text, 'admin/structure/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title, 'id' => drupal_html_id('views-' . $this->display->id . '-' . $section)), 'html' => TRUE)); + return l($text, + 'admin/structure/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, + array( + 'attributes' => array( + 'class' => 'views-ajax-link ' . $class, + 'title' => $title, + 'id' => drupal_html_id('views-' . $this->display->id . '-' . $section), + ), + 'html' => TRUE, + ) + ); } /** * Returns to tokens for arguments. * - * This function is similar to views_handler_field::get_render_tokens() - * but without fields tokens. + * This function is similar to views_handler_field::get_render_tokens() but + * without fields tokens. */ public function get_arguments_tokens() { $tokens = array(); @@ -1344,9 +1396,9 @@ class views_plugin_display extends views_plugin { ); $languages = array( - '***CURRENT_LANGUAGE***' => t("Current user's language"), - '***DEFAULT_LANGUAGE***' => t("Default site language"), - LANGUAGE_NONE => t('Language neutral'), + '***CURRENT_LANGUAGE***' => t("Current user's language"), + '***DEFAULT_LANGUAGE***' => t("Default site language"), + LANGUAGE_NONE => t('Language neutral'), ); if (module_exists('locale')) { $languages = array_merge($languages, locale_language_list()); @@ -1361,7 +1413,7 @@ class views_plugin_display extends views_plugin { $access_plugin = $this->get_plugin('access'); if (!$access_plugin) { - // default to the no access control plugin. + // Default to the no access control plugin. $access_plugin = views_get_plugin('access', 'none'); } @@ -1381,7 +1433,7 @@ class views_plugin_display extends views_plugin { $cache_plugin = $this->get_plugin('cache'); if (!$cache_plugin) { - // default to the no cache control plugin. + // Default to the no cache control plugin. $cache_plugin = views_get_plugin('cache', 'none'); } @@ -1406,7 +1458,7 @@ class views_plugin_display extends views_plugin { if ($this->uses_link_display()) { $display_id = $this->get_link_display(); $link_display = empty($this->view->display[$display_id]) ? t('None') : check_plain($this->view->display[$display_id]->display_title); - $link_display = $this->get_option('link_display') == 'custom_url' ? t('Custom URL') : $link_display; + $link_display = $this->get_option('link_display') == 'custom_url' ? t('Custom URL') : $link_display; $options['link_display'] = array( 'category' => 'other', 'title' => t('Link display'), @@ -1478,10 +1530,9 @@ class views_plugin_display extends views_plugin { } $form['#title'] = check_plain($this->display->display_title) . ': '; - // Set the 'section' to highlight on the form. - // If it's the item we're looking at is pulling from the default display, - // reflect that. Don't use is_defaulted since we want it to show up even - // on the default display. + // Set the 'section' to highlight on the form. If it's the item we're + // looking at is pulling from the default display, reflect that. Don't use + // is_defaulted since we want it to show up even on the default display. if (!empty($this->options['defaults'][$form_state['section']])) { $form['#section'] = 'default-' . $form_state['section']; } @@ -1587,9 +1638,9 @@ class views_plugin_display extends views_plugin { '#title' => t("Display 'more' link only if there is more content"), '#description' => t("Leave this unchecked to display the 'more' link even if there are no more items to display."), '#default_value' => !$this->get_option('use_more_always'), - '#dependency' => array( - 'edit-use-more' => array(TRUE), - ), + '#dependency' => array( + 'edit-use-more' => array(TRUE), + ), ); $form['open_new_window'] = array( '#type' => 'checkbox', @@ -1629,7 +1680,7 @@ class views_plugin_display extends views_plugin { '#tree' => TRUE, ); $access = $this->get_option('access'); - $form['access']['type'] = array( + $form['access']['type'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('access', NULL, array($this->view->base_table)), '#default_value' => $access['type'], @@ -1674,7 +1725,7 @@ class views_plugin_display extends views_plugin { '#tree' => TRUE, ); $cache = $this->get_option('cache'); - $form['cache']['type'] = array( + $form['cache']['type'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('cache', NULL, array($this->view->base_table)), '#default_value' => $cache['type'], @@ -1784,7 +1835,7 @@ class views_plugin_display extends views_plugin { case 'style_plugin': $form['#title'] .= t('How should this view be styled'); $form['#help_topic'] = 'style'; - $form['style_plugin'] = array( + $form['style_plugin'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('style', $this->get_style_type(), array($this->view->base_table)), '#default_value' => $this->get_option('style_plugin'), @@ -1832,7 +1883,7 @@ class views_plugin_display extends views_plugin { case 'row_plugin': $form['#title'] .= t('How should each row in this view be styled'); $form['#help_topic'] = 'style-row'; - $form['row_plugin'] = array( + $form['row_plugin'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('row', $this->get_style_type(), array($this->view->base_table)), '#default_value' => $this->get_option('row_plugin'), @@ -1884,7 +1935,7 @@ class views_plugin_display extends views_plugin { $output .= theme('item_list', array( 'items' => $items, - 'type' => $type + 'type' => $type, )); } } @@ -1946,14 +1997,14 @@ class views_plugin_display extends views_plugin { } } else { - // include non-engine theme files + // Include non-engine theme files. foreach ($base_theme as $base) { // Include the theme file or the engine. if (!empty($base->owner)) { include_once DRUPAL_ROOT . '/' . $base->owner; } } - // and our theme gets one too. + // And our theme gets one too. if (!empty($theme->owner)) { include_once DRUPAL_ROOT . '/' . $theme->owner; } @@ -1972,15 +2023,15 @@ class views_plugin_display extends views_plugin { } $funcs = array(); - // Get theme functions for the display. Note that some displays may - // not have themes. The 'feed' display, for example, completely - // delegates to the style. + // Get theme functions for the display. Note that some displays may not + // have themes. The 'feed' display, for example, completely delegates to + // the style. if (!empty($this->definition['theme'])) { - $funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions()); + $funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions()); $themes = $this->additional_theme_functions(); if ($themes) { foreach ($themes as $theme) { - $funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme); + $funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme); } } } @@ -1991,7 +2042,7 @@ class views_plugin_display extends views_plugin { $themes = $plugin->additional_theme_functions(); if ($themes) { foreach ($themes as $theme) { - $funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme); + $funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme); } } @@ -2002,7 +2053,7 @@ class views_plugin_display extends views_plugin { $themes = $row_plugin->additional_theme_functions(); if ($themes) { foreach ($themes as $theme) { - $funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme); + $funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme); } } } @@ -2158,8 +2209,8 @@ class views_plugin_display extends views_plugin { $output .= '

      ' . t('This is the default theme template used for this row style.') . '

      '; - // Field templates aren't registered the normal way...and they're always - // this one, anyhow. + // Field templates aren't registered the normal way... and they're + // always this one, anyhow. $output .= '
      ' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '
      '; $form['analysis'] = array( @@ -2189,7 +2240,7 @@ class views_plugin_display extends views_plugin { ); $exposed_form = $this->get_option('exposed_form'); - $form['exposed_form']['type'] = array( + $form['exposed_form']['type'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('exposed_form', NULL, array($this->view->base_table)), '#default_value' => $exposed_form['type'], @@ -2232,7 +2283,7 @@ class views_plugin_display extends views_plugin { ); $pager = $this->get_option('pager'); - $form['pager']['type'] = array( + $form['pager']['type'] = array( '#type' => 'radios', '#options' => views_fetch_plugin_names('pager', empty($this->definition['use pager']) ? 'basic' : NULL, array($this->view->base_table)), '#default_value' => $pager['type'], @@ -2287,7 +2338,7 @@ class views_plugin_display extends views_plugin { $template_path = isset($registry[$theme]['path']) ? $registry[$theme]['path'] . '/' : './'; if (file_exists($template_path . $template)) { $hint = t('File found in folder @template-path', array('@template-path' => $template_path)); - $template = '' . $template . ''; + $template = '' . $template . ''; } else { $template = '' . $template . ' ' . t('(File not found, in folder @template-path)', array('@template-path' => $template_path)) . ''; @@ -2297,7 +2348,7 @@ class views_plugin_display extends views_plugin { $fixed[] = $template; } - return implode(', ', array_reverse($fixed)); + return theme('item_list', array('items' => array_reverse($fixed))); } /** @@ -2335,7 +2386,7 @@ class views_plugin_display extends views_plugin { case 'style_options': $style = TRUE; case 'row_options': - // if row, $style will be empty. + // If row, $style will be empty. $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); if ($plugin) { $plugin->options_validate($form[$form_state['section']], $form_state); @@ -2384,6 +2435,7 @@ class views_plugin_display extends views_plugin { /** * Perform any necessary changes to the form values prior to storage. + * * There is no need for this function to actually store the data. */ public function options_submit(&$form, &$form_state) { @@ -2474,7 +2526,7 @@ class views_plugin_display extends views_plugin { case 'use_ajax': case 'hide_attachment_summary': case 'hide_admin_links': - $this->set_option($section, (bool)$form_state['values'][$section]); + $this->set_option($section, (bool) $form_state['values'][$section]); break; case 'use_more': @@ -2499,7 +2551,7 @@ class views_plugin_display extends views_plugin { $this->set_option($section, $form_state['values'][$section]); $this->set_option('row_options', array()); - // send ajax form to options page if we use it. + // Send ajax form to options page if we use it. if (!empty($plugin->definition['uses options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('row_options')); } @@ -2515,7 +2567,7 @@ class views_plugin_display extends views_plugin { if ($plugin) { $this->set_option($section, $form_state['values'][$section]); $this->set_option('style_options', array()); - // send ajax form to options page if we use it. + // Send ajax form to options page if we use it. if (!empty($plugin->definition['uses options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('style_options')); } @@ -2526,7 +2578,7 @@ class views_plugin_display extends views_plugin { case 'style_options': $style = TRUE; case 'row_options': - // if row, $style will be empty. + // If row, $style will be empty. $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); if ($plugin) { $plugin->options_submit($form['options'][$section], $form_state); @@ -2610,8 +2662,8 @@ class views_plugin_display extends views_plugin { * Which option should be marked as overridden, for example "filters". * @param bool $new_state * Select the new state of the option. - * - TRUE: Revert to default. - * - FALSE: Mark it as overridden. + * - TRUE: Revert to default. + * - FALSE: Mark it as overridden. */ public function set_override($section, $new_state = NULL) { $options = $this->defaultable_sections($section); @@ -2631,7 +2683,7 @@ class views_plugin_display extends views_plugin { unset($this->display->display_options[$option]); } else { - // copy existing values into our display. + // Copy existing values into our display. $this->options[$option] = $this->get_option($option); $this->display->display_options[$option] = $this->options[$option]; } @@ -2702,7 +2754,12 @@ class views_plugin_display extends views_plugin { $path = check_url(url($path, $url_options)); - return theme($theme, array('more_url' => $path, 'new_window' => $this->use_more_open_new_window(), 'link_text' => check_plain($this->use_more_text()), 'view' => $this->view)); + return theme($theme, array( + 'more_url' => $path, + 'new_window' => $this->use_more_open_new_window(), + 'link_text' => check_plain($this->use_more_text()), + 'view' => $this->view, + )); } } } @@ -2790,9 +2847,10 @@ class views_plugin_display extends views_plugin { } /** - * Set up any variables on the view prior to execution. These are separated - * from execute because they are extremely common and unlikely to be - * overridden on an individual display. + * Set up any variables on the view prior to execution. + * + * These are separated from execute because they are extremely common and + * unlikely to be overridden on an individual display. */ public function pre_execute() { $this->view->set_use_ajax($this->use_ajax()); @@ -2955,7 +3013,7 @@ class views_plugin_display extends views_plugin { */ public function view_special_blocks($type) { if ($type == '-exp') { - // avoid interfering with the admin forms. + // Avoid interfering with the admin forms. if (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'views') { return; } @@ -3011,7 +3069,7 @@ class views_plugin_display extends views_plugin { $output = ''; // Cut the 's' off because the data is stored as the plural form but we need - // the singular form. Who designed that anyway? Oh yeah, I did. :( + // the singular form. if ($option != 'header' && $option != 'footer' && $option != 'empty') { $type = substr($option, 0, -1); } @@ -3026,9 +3084,9 @@ class views_plugin_display extends views_plugin { else { $handler_type = $type; } - // If aggregation is on, the group type might override the actual - // handler that is in use. This piece of code checks that and, - // if necessary, sets the override handler. + // If aggregation is on, the group type might override the actual handler + // that is in use. This piece of code checks that and, if necessary, sets + // the override handler. $override = NULL; if ($this->use_group_by() && !empty($info['group_type'])) { if (empty($this->view->query)) { @@ -3057,8 +3115,8 @@ class views_plugin_display extends views_plugin { * Special handling for the style export. * * Styles are stored as style_plugin and style_options or row_plugin and - * row_options accordingly. The options are told not to export, and the - * export for the plugin should export both. + * row_options accordingly. The options are told not to export, and the export + * for the plugin should export both. */ public function export_style($indent, $prefix, $storage, $option, $definition, $parents) { $output = ''; @@ -3092,7 +3150,7 @@ class views_plugin_display extends views_plugin { } /** - * Special handling for plugin export + * Special handling for plugin export. * * Plugins other than styles are stored in array with 'type' being the key * to the plugin. For modern plugins, the options are stored in the 'options' @@ -3110,7 +3168,7 @@ class views_plugin_display extends views_plugin { $output .= $indent . $new_prefix . "['$option'] = '$value';\n"; - if ($plugin_type != 'access' && $plugin_type!= 'cache') { + if ($plugin_type != 'access' && $plugin_type != 'cache') { $new_prefix .= "['options']"; } @@ -3172,7 +3230,7 @@ class views_plugin_display extends views_plugin { $output = ''; // Cut the 's' off because the data is stored as the plural form but we need - // the singular form. Who designed that anyway? Oh yeah, I did. :( + // the singular form. if ($option != 'header' && $option != 'footer' && $option != 'empty') { $type = substr($option, 0, -1); } @@ -3190,7 +3248,8 @@ class views_plugin_display extends views_plugin { $handler = views_get_handler($info['table'], $info['field'], $handler_type); if ($handler) { $handler->init($this->view, $info); - $handler->unpack_translatables($translatable, array_merge($parents, array($type, $info['table'], $info['id']))); + $items = array_merge($parents, array($type, $info['table'], $info['id'])); + $handler->unpack_translatables($translatable, $items); } // Prevent reference problems. @@ -3203,14 +3262,13 @@ class views_plugin_display extends views_plugin { /** * Provide some helpful text for the arguments. * - * The result should contain of an array with - * - filter value present: The title of the fieldset in the argument - * where you can configure what should be done with a given argument. - * - filter value not present: The tiel of the fieldset in the argument - * where you can configure what should be done if the argument does not - * exist. - * - description: A description about how arguments comes to the display. - * For example blocks don't get it from url. + * The result should contain of an array with: + * - filter value present: The title of the fieldset in the argument where + * you can configure what should be done with a given argument. + * - filter value not present: The tiel of the fieldset in the argument where + * you can configure what should be done if the argument does not exist. + * - description: A description about how arguments comes to the display. For + * example blocks don't get it from url. */ public function get_argument_text() { return array( @@ -3223,13 +3281,14 @@ class views_plugin_display extends views_plugin { /** * Provide some helpful text for pagers. * - * The result should contain of an array within - * - items per page title + * The result should contain of an array with: + * - items per page title. + * - items per page description. */ public function get_pager_text() { return array( 'items per page title' => t('Items to display'), - 'items per page description' => t('The number of items to display. Enter 0 for no limit.') + 'items per page description' => t('The number of items to display. Enter 0 for no limit.'), ); } diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_attachment.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_attachment.inc index c80771a09e..57bd090638 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_attachment.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_attachment.inc @@ -22,6 +22,8 @@ class views_plugin_display_attachment extends views_plugin_display { public function option_definition () { $options = parent::option_definition(); + $options['show_title'] = array('default' => FALSE, 'bool' => TRUE); + $options['show_title_empty'] = array('default' => FALSE, 'bool' => TRUE); $options['displays'] = array('default' => array()); $options['attachment_position'] = array('default' => 'before'); $options['inherit_arguments'] = array('default' => TRUE, 'bool' => TRUE); @@ -88,6 +90,18 @@ class views_plugin_display_attachment extends views_plugin_display { $attach_to = t('Not defined'); } + $options['show_title'] = array( + 'category' => 'title', + 'title' => t('Show title'), + 'value' => $this->get_option('show_title') ? t('Yes') : t('No'), + ); + + $options['show_title_empty'] = array( + 'category' => 'title', + 'title' => t('Show title even if view has no results'), + 'value' => $this->get_option('show_title_empty') ? t('Yes') : t('No'), + ); + $options['displays'] = array( 'category' => 'attachment', 'title' => t('Attach to'), @@ -134,6 +148,24 @@ class views_plugin_display_attachment extends views_plugin_display { parent::options_form($form, $form_state); switch ($form_state['section']) { + case 'show_title': + $form['#title'] .= t('Title'); + $form['show_title'] = array( + '#type' => 'checkbox', + '#title' => t('Show title'), + '#description' => t('Do you want to show the title of the attachment?'), + '#default_value' => $this->get_option('show_title'), + ); + break; + case 'show_title_empty': + $form['#title'] .= t('Title'); + $form['show_title_empty'] = array( + '#type' => 'checkbox', + '#title' => t('Show title for empty view'), + '#description' => t('Do you want to show the title of the attachment even if the view has no results?'), + '#default_value' => $this->get_option('show_title_empty'), + ); + break; case 'inherit_arguments': $form['#title'] .= t('Inherit contextual filters'); $form['inherit_arguments'] = array( @@ -210,6 +242,8 @@ class views_plugin_display_attachment extends views_plugin_display { // It is very important to call the parent function here. parent::options_submit($form, $form_state); switch ($form_state['section']) { + case 'show_title': + case 'show_title_empty': case 'inherit_arguments': case 'inherit_pager': case 'render_pager': @@ -242,7 +276,7 @@ class views_plugin_display_attachment extends views_plugin_display { $args = $this->get_option('inherit_arguments') ? $this->view->args : array(); $view->set_arguments($args); - $exposed_input = $this->get_option('inherit_exposed_filters') ? $this->view->exposed_input : array(); + $exposed_input = $this->get_option('inherit_exposed_filters') && isset($this->view->exposed_input) ? $this->view->exposed_input : array(); $view->set_exposed_input($exposed_input); $view->set_display($this->display->id); if ($this->get_option('inherit_pager')) { @@ -250,7 +284,20 @@ class views_plugin_display_attachment extends views_plugin_display { $view->display_handler->set_option('pager', $this->view->display[$display_id]->handler->get_option('pager')); } - $attachment = $view->execute_display($this->display->id, $args); + $attachment_output = $view->execute_display($this->display->id, $args); + + $attachment = ''; + if ($view->display_handler->get_option('show_title') && $view->display_handler->get_option('title')) { + if ($view->display_handler->get_option('show_title_empty') || !empty($view->result)) { + $attachment .= theme('html_tag', array( + 'element' => array( + '#tag' => 'h2', + '#value' => $view->display_handler->get_option('title'), + ), + )); + } + } + $attachment .= $attachment_output; switch ($this->get_option('attachment_position')) { case 'before': diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_page.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_page.inc index e2cc01771b..9b9e900bb7 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_page.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_display_page.inc @@ -167,6 +167,9 @@ class views_plugin_display_page extends views_plugin_display { case 'default tab': $items[$path]['type'] = MENU_DEFAULT_LOCAL_TASK; break; + case 'local action': + $items[$path]['type'] = MENU_LOCAL_ACTION; + break; } // Add context for contextual links. @@ -311,6 +314,8 @@ class views_plugin_display_page extends views_plugin_display { case 'default tab': $menu_str = t('Tab: @title', array('@title' => $menu['title'])); break; + case 'local action': + $menu_str = t('Local action: @title', array('@title' => $menu['title'])); } $options['menu'] = array( @@ -345,6 +350,7 @@ class views_plugin_display_page extends views_plugin_display { '#field_prefix' => '' . url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), '#field_suffix' => '‎', '#attributes' => array('dir'=>'ltr'), + '#maxlength' => 255, ); break; @@ -360,6 +366,7 @@ class views_plugin_display_page extends views_plugin_display { if (empty($menu)) { $menu = array('type' => 'none', 'title' => '', 'weight' => 0); } + $menu_type_dependencies = array('normal', 'tab', 'default tab', 'local action'); $form['menu']['type'] = array( '#prefix' => '
      ', '#suffix' => '
      ', @@ -369,7 +376,8 @@ class views_plugin_display_page extends views_plugin_display { 'none' => t('No menu entry'), 'normal' => t('Normal menu entry'), 'tab' => t('Menu tab'), - 'default tab' => t('Default menu tab') + 'default tab' => t('Default menu tab'), + 'local action' => t('Local action'), ), '#default_value' => $menu['type'], ); @@ -379,14 +387,14 @@ class views_plugin_display_page extends views_plugin_display { '#type' => 'textfield', '#default_value' => $menu['title'], '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), + '#dependency' => array('radio:menu[type]' => $menu_type_dependencies), ); $form['menu']['description'] = array( '#title' => t('Description'), '#type' => 'textfield', '#default_value' => $menu['description'], '#description' => t("If set to normal or tab, enter the text to use for the menu item's description."), - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), + '#dependency' => array('radio:menu[type]' => $menu_type_dependencies), ); // Only display the menu selector if menu module is enabled. @@ -414,7 +422,7 @@ class views_plugin_display_page extends views_plugin_display { '#type' => 'textfield', '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, '#description' => t('The lower the weight the higher/further left it will appear.'), - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), + '#dependency' => array('radio:menu[type]' => $menu_type_dependencies), ); $form['menu']['context'] = array( '#title' => t('Context'), @@ -502,8 +510,8 @@ class views_plugin_display_page extends views_plugin_display { '#type' => 'textfield', '#default_value' => $tab_options['weight'], '#size' => 5, - '#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'), - '#dependency' => array('radio:tab_options[type]' => array('tab')), + '#description' => t('Enter the weight of the item. The lower the number, the more to the left it will be.'), + '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), ); break; } diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_exposed_form.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_exposed_form.inc index 563a2af192..976115ac48 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_exposed_form.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_exposed_form.inc @@ -128,7 +128,7 @@ class views_plugin_exposed_form extends views_plugin { $form['autosubmit_hide'] = array( '#type' => 'checkbox', '#title' => t('Hide submit button'), - '#description' => t('Hide submit button if javascript is enabled.'), + '#description' => t('Hide submit button if JavaScript is enabled.'), '#default_value' => $this->options['autosubmit_hide'], '#dependency' => array( 'edit-exposed-form-options-autosubmit' => array(1), diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_query_default.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_query_default.inc index 2911a56033..db3e7e27ef 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_query_default.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_query_default.inc @@ -248,15 +248,26 @@ class views_plugin_query_default extends views_plugin_query { public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); - $form['disable_sql_rewrite'] = array( - '#title' => t('Disable SQL rewriting'), - '#description' => t('Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().'), - '#type' => 'checkbox', - '#default_value' => !empty($this->options['disable_sql_rewrite']), - '#suffix' => '
      ' - . t('WARNING: Disabling SQL rewriting means that node access security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Please use this option only if you understand and accept this security risk.') - . '
      ', - ); + // Establish which query tag will be affected by disable_sql_rewrite. + // This 'access query tag' is defined by hook_views_data() for the base table. + // e.g. node_views_data() + if (!empty($form_state['view']->base_table)) { + $base_table = $form_state['view']->base_table; + $base_table_data = views_fetch_data($base_table); + if (!empty($base_table_data['table']['base']['access query tag'])) { + $access_tag = $base_table_data['table']['base']['access query tag']; + $disable_rewrite = !empty($this->options['disable_sql_rewrite']); + $form['disable_sql_rewrite'] = array( + '#title' => t('Disable access checks'), + '#description' => t('Do not apply %access_tag checks to this query. Selecting this option omits that tag from the alterable query.', array('%access_tag' => $access_tag)), + '#type' => 'checkbox', + '#default_value' => $disable_rewrite, + '#suffix' => '
      ' + . t('WARNING: Disabling access checks means that %access_tag security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Please use this option only if you understand and accept this security risk.', array('%access_tag' => $access_tag)) + . '
      ', + ); + } + } $form['distinct'] = array( '#type' => 'checkbox', '#title' => t('Distinct'), @@ -1214,7 +1225,10 @@ class views_plugin_query_default extends views_plugin_query { } // This is a formula, using no tables. elseif (empty($field['table'])) { - if (!in_array($fieldname, $non_aggregates)) { + if (Database::getConnection()->databaseType() != 'pgsql') { + $non_aggregates[] = $fieldname; + } + elseif (!in_array($fieldname, $non_aggregates)) { $non_aggregates[] = $fieldname; } $placeholders = !empty($field['placeholders']) ? $field['placeholders'] : array(); @@ -1224,13 +1238,16 @@ class views_plugin_query_default extends views_plugin_query { elseif ($this->distinct && !in_array($fieldname, $this->groupby)) { // d7cx: This code was there, apparently needed for PostgreSQL // $string = db_driver() == 'pgsql' ? "FIRST($string)" : $string; - if (!in_array($string, $non_aggregates)) { + if (Database::getConnection()->databaseType() == 'pgsql' && !in_array($string, $non_aggregates)) { $non_aggregates[] = $string; } $query->addField(!empty($field['table']) ? $field['table'] : $this->base_table, $field['field'], $fieldname); } elseif (empty($field['aggregate'])) { - if (!in_array($string, $non_aggregates)) { + if (Database::getConnection()->databaseType() != 'pgsql') { + $non_aggregates[] = $fieldname; + } + elseif (!in_array($string, $non_aggregates)) { $non_aggregates[] = $string; } $query->addField(!empty($field['table']) ? $field['table'] : $this->base_table, $field['field'], $fieldname); @@ -1340,8 +1357,9 @@ class views_plugin_query_default extends views_plugin_query { if (count($this->having)) { $this->has_aggregate = TRUE; } - elseif (!$this->has_aggregate) { - // Allow 'GROUP BY' even no aggregation function has been set. + // Allow 'GROUP BY' even if no aggregation function has been set, but only + // when there is a legitimate display_handler. + elseif (!$this->has_aggregate && !empty($this->view->display_handler)) { $this->has_aggregate = $this->view->display_handler->get_option('group_by'); } if ($this->has_aggregate && (!empty($this->groupby) || !empty($non_aggregates))) { diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style.inc index 6f3cf34c84..1433f31989 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style.inc @@ -372,6 +372,7 @@ class views_plugin_style extends views_plugin { $output = ''; foreach ($sets as $set) { $row = reset($set['rows']); + $level = isset($set['level']) ? $set['level'] : 0; // Render as a grouping set. if (is_array($row) && isset($row['group'])) { $output .= theme(views_theme_functions('views_view_grouping', $this->view, $this->display), @@ -463,7 +464,7 @@ class views_plugin_style extends views_plugin { // hierarchically positioned set where the current row belongs to. // While iterating, parent groups, that do not exist yet, are added. $set = &$sets; - foreach ($groupings as $info) { + foreach ($groupings as $level => $info) { $field = $info['field']; $rendered = isset($info['rendered']) ? $info['rendered'] : $group_rendered; $rendered_strip = isset($info['rendered_strip']) ? $info['rendered_strip'] : FALSE; @@ -496,6 +497,7 @@ class views_plugin_style extends views_plugin { // Create the group if it does not exist yet. if (empty($set[$grouping])) { $set[$grouping]['group'] = $group_content; + $set[$grouping]['level'] = $level; $set[$grouping]['rows'] = array(); } diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_jump_menu.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_jump_menu.inc index 3d83ea3455..418766b199 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_jump_menu.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_jump_menu.inc @@ -65,7 +65,7 @@ class views_plugin_style_jump_menu extends views_plugin_style { '#type' => 'checkbox', '#title' => t('Hide the "Go" button'), '#default_value' => !empty($this->options['hide']), - '#description' => t('If hidden, this button will only be hidden for users with javascript and the page will automatically jump when the select is changed.'), + '#description' => t('If hidden, this button will only be hidden for users with JavaScript and the page will automatically jump when the select is changed.'), ); $form['text'] = array( diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_summary_jump_menu.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_summary_jump_menu.inc index 17fdcca9ae..ee75f24e21 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_summary_jump_menu.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_summary_jump_menu.inc @@ -66,7 +66,7 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style { '#type' => 'checkbox', '#title' => t('Hide the "Go" button'), '#default_value' => !empty($this->options['hide']), - '#description' => t('If hidden, this button will only be hidden for users with javascript and the page will automatically jump when the select is changed.'), + '#description' => t('If hidden, this button will only be hidden for users with JavaScript and the page will automatically jump when the select is changed.'), ); $form['text'] = array( diff --git a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_table.inc b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_table.inc index 75fe389711..54679205a0 100644 --- a/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_table.inc +++ b/profiles/openasu/modules/contrib/views/plugins/views_plugin_style_table.inc @@ -31,6 +31,7 @@ class views_plugin_style_table extends views_plugin_style { $options = parent::option_definition(); $options['columns'] = array('default' => array()); + $options['class'] = array('default' => array()); $options['default'] = array('default' => ''); $options['info'] = array('default' => array()); $options['override'] = array('default' => TRUE, 'bool' => TRUE); @@ -178,7 +179,7 @@ class views_plugin_style_table extends views_plugin_style { $form['sticky'] = array( '#type' => 'checkbox', - '#title' => t('Enable Drupal style "sticky" table headers (Javascript)'), + '#title' => t('Enable Drupal style "sticky" table headers (JavaScript)'), '#default_value' => !empty($this->options['sticky']), '#description' => t('(Sticky header effects will not be active for preview below, only on live output.)'), ); @@ -198,6 +199,14 @@ class views_plugin_style_table extends views_plugin_style { '#default_value' => $this->options['summary'], '#maxlength' => 255, ); + + $form['class'] = array( + '#type' => 'textfield', + '#title' => t('CSS classes'), + '#description' => t('Add CSS classes to the table; multiple classes may be separated by spaces.'), + '#default_value' => $this->options['class'], + '#maxlength' => 255, + ); // Note: views UI registers this theme handler on our behalf. Your module // will have to register your theme handlers if you do stuff like this. @@ -296,7 +305,7 @@ class views_plugin_style_table extends views_plugin_style { '#type' => 'checkbox', '#title' => t('Show the empty text in the table'), '#default_value' => $this->options['empty_table'], - '#description' => t('Per default the table is hidden for an empty view. With this option it is posible to show an empty table with the text in it.'), + '#description' => t('Per default the table is hidden for an empty view. With this option it is possible to show an empty table with the text in it.'), ); $form['description_markup'] = array( diff --git a/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_filter_numeric.test b/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_filter_numeric.test index 6cfe2d37a1..a18e20ac94 100644 --- a/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_filter_numeric.test +++ b/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_filter_numeric.test @@ -314,6 +314,38 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest { $this->assertIdenticalResultset($view, $resultset, $this->column_map); } + /** + * Tests the limit operators functionality. + */ + public function testFilterNumericExposedLimitOperators() { + $filters = $this->getGroupedExposedFilters(); + $view = $this->getBasicView(); + + $available_operators = array('<', '>', 'between'); + + $filters['age']['expose'] += array( + 'limit_operators' => TRUE, + 'available_operators' => drupal_map_assoc($available_operators), + ); + + $view->display['default']->handler->override_option('filters', $filters); + + + $this->executeView($view); + + $form = array(); + $form_state = array(); + $view->filter['age']->operator_form($form, $form_state); + + $operator = $form['operator']; + + $this->assertTrue(in_array($operator['#default_value'], $available_operators), 'Default value operator found in list of available operators.'); + + foreach ($available_operators as $available_operator) { + $this->assertTrue($operator['#options'][$available_operator], format_string('@operator found in options', array('@operator' => $available_operator))); + } + } + public function testAllowEmpty() { $view = $this->getBasicView(); diff --git a/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_manytoone.test b/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_manytoone.test new file mode 100644 index 0000000000..fb06645eb3 --- /dev/null +++ b/profiles/openasu/modules/contrib/views/tests/handlers/views_handler_manytoone.test @@ -0,0 +1,1099 @@ + 'Handler: Many To One Helper', + 'description' => 'Tests the many to one helper handler', + 'group' => 'Views Handlers', + ); + } + + /** + * Clears views data cache. + */ + protected function clearViewsDataCache() { + drupal_static_reset('_views_fetch_data_cache'); + drupal_static_reset('_views_fetch_data_recursion_protected'); + drupal_static_reset('_views_fetch_data_fully_loaded'); + } + + /** + * Returns a new term with random properties. + * + * @param string $vocabulary + * Vocabulary ID to create term in. + * + * @return object + * Term with random properties. + */ + protected function createTerm($vocabulary) { + $term = new stdClass(); + $term->name = $this->randomName(); + $term->description = $this->randomName(); + // Use the first available text format. + $term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(); + $term->vid = $vocabulary->vid; + taxonomy_term_save($term); + return $term; + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + // Create boolean field. + $this->fields[0] = array( + 'field_name' => 'field_bool', + 'type' => 'list_boolean', + 'cardinality' => 1, + 'settings' => array( + 'allowed_values' => array( + 0 => '', + 1 => '', + ), + ), + ); + $this->fields[0] = field_create_field($this->fields[0]); + + // Create text list field. + $this->fields[1] = array( + 'field_name' => 'field_list', + 'type' => 'list_text', + 'cardinality' => FIELD_CARDINALITY_UNLIMITED, + 'settings' => array( + 'allowed_values' => array( + 1 => '1', + 2 => '2', + 3 => '3', + ), + ), + ); + $this->fields[1] = field_create_field($this->fields[1]); + + // Create boolean field instance for article nodes. + $instance = array( + 'field_name' => $this->fields[0]['field_name'], + 'entity_type' => 'node', + 'bundle' => 'article', + 'widget' => array( + 'type' => 'options_onoff', + ), + ); + $this->instances[0][] = field_create_instance($instance); + + // Create text list field instance for article nodes. + $instance = array( + 'field_name' => $this->fields[1]['field_name'], + 'entity_type' => 'node', + 'bundle' => 'article', + 'widget' => array( + 'type' => 'options_buttons', + ), + ); + $this->instances[1][] = field_create_instance($instance); + + // Create boolean field instance for users. + $instance = array( + 'field_name' => $this->fields[0]['field_name'], + 'entity_type' => 'user', + 'bundle' => 'user', + 'widget' => array( + 'type' => 'options_onoff', + ), + ); + $this->instances[0][] = field_create_instance($instance); + + // Create text list field instance for users. + $instance = array( + 'field_name' => $this->fields[1]['field_name'], + 'entity_type' => 'user', + 'bundle' => 'user', + 'widget' => array( + 'type' => 'options_buttons', + ), + ); + $this->instances[1][] = field_create_instance($instance); + + // Create tags field instance for users. + $instance = array( + 'field_name' => 'field_tags', + 'entity_type' => 'user', + 'bundle' => 'user', + ); + $this->instances[2][] = field_create_instance($instance); + + // Clear views data cache. + $this->clearViewsDataCache(); + + // Create 62 tags. + $vocabulary = taxonomy_vocabulary_machine_name_load('tags'); + for ($i = 0; $i < 62; $i++) { + $this->terms[] = $this->createTerm($vocabulary); + } + + // Create a node where the field_bool is checked, field_list is '1' and + // tag is term 2. + $node = array(); + $node['type'] = 'article'; + $node[$this->fields[0]['field_name']][LANGUAGE_NONE][]['value'] = '1'; + $node[$this->fields[1]['field_name']][LANGUAGE_NONE][]['value'] = '1'; + $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid; + $this->nodes[0] = $this->drupalCreateNode($node); + + // Create a node where the field_bool is not checked, field_list is empty + // and tag is term 1. + $node = array(); + $node['type'] = 'article'; + $node[$this->fields[0]['field_name']] = array(); + $node[$this->fields[1]['field_name']] = array(); + $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid; + $this->nodes[1] = $this->drupalCreateNode($node); + + // Create a node where the field_bool is not checked, field_list is empty + // and tag is term 1 and 2. + $node = array(); + $node['type'] = 'article'; + $node[$this->fields[0]['field_name']] = array(); + $node[$this->fields[1]['field_name']] = array(); + $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid; + $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid; + $this->nodes[2] = $this->drupalCreateNode($node); + + // Create a user where field_bool is checked, field_list is '1' and tag is + // term 1. + $permissions = array('access content'); + $account = $this->drupalCreateUser($permissions); + $account->{$this->fields[0]['field_name']}[LANGUAGE_NONE][]['value'] = '1'; + $account->{$this->fields[1]['field_name']}[LANGUAGE_NONE][]['value'] = '1'; + $account->field_tags[LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid; + $this->accounts[0] = user_save($account); + } + + /** + * Tests "none of" filter with terms in excess of JOIN limit selected. + */ + public function testJoinLimitNoneOf() { + $view = $this->getJoinLimitNoneOfTestView(); + $this->executeView($view); + + // Assert that nodes have been created and have expected field values. + $value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.'); + + $value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.'); + + // Assert that user has been created and has expected field values. + $value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'User has been created and tags field references term 1.'); + + // Assert that node id with empty field value matches user id so that the + // node would be excluded from the result, if the joins are missing extras. + $this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node id of second node matches uid of first user.'); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 1, 'View has one result.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $this->assertIdentical($nid, (int) $this->nodes[1]->nid, 'View result has correct node id.'); + } + + /** + * Tests duplicate grouped "none of" filters on boolean field. + */ + public function testGroupedNoneOf() { + $view = $this->getGroupedNoneOfTestView(); + $this->executeView($view); + + // Assert that nodes have been created and have expected field values. + $value = field_get_items('node', $this->nodes[0], $this->fields[0]['field_name'], LANGUAGE_NONE); + $value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0; + $this->assertIdentical($value, 1, 'First node has been created and boolean field is checked.'); + + $value = field_get_items('node', $this->nodes[1], $this->fields[0]['field_name'], LANGUAGE_NONE); + $this->assertFalse($value, 'Second node has been created and boolean field is not checked.'); + + $value = field_get_items('node', $this->nodes[2], $this->fields[0]['field_name'], LANGUAGE_NONE); + $this->assertFalse($value, 'Third node has been created and boolean field is not checked.'); + + // Assert that user has been created and has expected field values. + $value = field_get_items('user', $this->accounts[0], $this->fields[0]['field_name'], LANGUAGE_NONE); + $value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0; + $this->assertIdentical($value, 1, 'User has been created and boolean field is checked.'); + + // Assert that node ID with empty field value matches user ID so that the + // node would be excluded from the result, if the joins are missing extras. + $this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.'); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 2, 'View has two results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2, 'View result has correct node IDs.'); + } + + /** + * Tests duplicate grouped "one of" filters on taxonomy term field. + */ + public function testGroupedOneOf() { + $view = $this->getGroupedOneOfTestView(); + $this->executeView($view); + + // Assert that nodes have been created and have expected field values. + $value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.'); + + $value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.'); + + $value = field_get_items('node', $this->nodes[2], 'field_tags', LANGUAGE_NONE); + $value = !empty($value[0]['tid']) && !empty($value[1]['tid']); + $this->assertTrue($value, 'Third node has been created and tags field references both terms 1 and 2.'); + + // Assert that user has been created and has expected field values. + $value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'User has been created and tags field references term 1.'); + + // Assert that node ID with empty field value matches user ID so that the + // node would be excluded from the result, if the joins are missing extras. + $this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.'); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 2, 'View has two results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2, 'View result has correct node IDs.'); + } + + /** + * Tests exposed filter with "Reduce duplicates." and grouped options. + */ + public function testReducedExposedGroupedOptions() { + // Assert that nodes have been created and have expected field values. + $value = field_get_items('node', $this->nodes[0], 'field_list', LANGUAGE_NONE); + $value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0; + $this->assertIdentical($value, 1, 'First node has been created and list field has value 1.'); + + $value = field_get_items('node', $this->nodes[1], 'field_list', LANGUAGE_NONE); + $this->assertFalse($value, 'Second node has been created and list field is empty.'); + + $value = field_get_items('node', $this->nodes[2], 'field_list', LANGUAGE_NONE); + $this->assertFalse($value, 'Third node has been created and list field is empty.'); + + // Assert that user has been created and has expected field values. + $value = field_get_items('user', $this->accounts[0], 'field_list', LANGUAGE_NONE); + $value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0; + $this->assertIdentical($value, 1, 'User has been created and list field has value 1.'); + + // Assert that node ID with empty field value matches user ID so that the + // node would be excluded from the result option 1, if the joins are missing + // extras. + $this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.'); + + // Default option: Any. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 3, 'Default option: View has three results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[0]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0; + $result3 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.'); + + // Option 1: Is none of 1 or 2. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_list_value' => '1', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 2, 'Option 1: View has two results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2, 'Option 1: View result has correct node ID.'); + + // Option 2: Is one of 1. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_list_value' => '2', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 1, 'Option 2: View has one result.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 2: View result has correct node ID.'); + + // Option 3: Is one of 1 or 2. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_list_value' => '3', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 1, 'Option 3: View has one result.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 3: View result has correct node ID.'); + + /* @todo: Fix and uncomment in issue #3045168. + * // Option 4: Is all of 1 and 2. + * $view = $this->getReducedExposedGroupedOptionsTestView(); + * $view->set_exposed_input(array( + * 'field_list_value' => '4', + * )); + * $this->executeView($view); + * + * // Assert correct result set. + * $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1; + * $this->assertEqual($result_count, 0, 'Option 4: View has empty result.'); + */ + + // Option 5: Is empty. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_list_value' => '5', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 2, 'Option 5: View has two results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2, 'Option 5: View result has correct node IDs.'); + + // Option 6: Is not empty. + $view = $this->getReducedExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_list_value' => '6', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 1, 'Option 6: View has one result.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 6: View result has correct node ID.'); + } + + /** + * Tests exposed filter on term ID with grouped options. + */ + public function testTermIdExposedGroupedOptions() { + // Assert that nodes have been created and have expected field values. + $value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.'); + + $value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.'); + + // Assert that user has been created and has expected field values. + $value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE); + $value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0; + $this->assertIdentical($value, 1, 'User has been created and tags field references term 1.'); + + // Assert that node ID with empty field value matches user ID so that the + // node would be excluded from the result option 1, if the joins are missing + // extras. + $this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.'); + + // Default option: Any. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 3, 'Default option: View has three results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[0]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0; + $result3 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.'); + + // Option 1: Is none of 2. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '1', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 1, 'Option 1: View has one result.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $this->assertIdentical($nid, (int) $this->nodes[1]->nid, 'Option 1: View result has correct node ID.'); + + // Option 2: Is none of 1 or 2. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '2', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1; + $this->assertEqual($result_count, 0, 'Option 2: View has empty result.'); + + // Option 3: Is one of 1. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '3', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $this->assertEqual($result_count, 2, 'Option 3: View has two results.'); + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2, 'Option 3: View result has correct node ID.'); + + // Option 4: Is one of 1 or 2. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '4', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[0]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0; + $result3 = ($nid === (int) $this->nodes[2]->nid); + $nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0; + $result4 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 4: View result has correct node ID.'); + $this->verbose($view->result); + $this->assertEqual($result_count, 4, 'Option 4: View has four results.'); + + /* @todo: Fix and uncomment in issue #3045168. + * // Option 5: Is all of 1 and 2. + * $view = $this->getTermIdExposedGroupedOptionsTestView(); + * $view->set_exposed_input(array( + * 'field_tags_tid' => '5', + * )); + * $this->executeView($view); + * + * // Assert correct result set. + * $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + * $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + * $this->assertIdentical($nid, (int) $this->nodes[2]->nid, 'Option 5: View result has correct node ID.'); + * $this->assertIdentical($result_count, 1, 'Option 5: View has one result.'); + */ + + // Option 6: Is empty. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '6', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1; + $this->assertIdentical($result_count, 0, 'Option 6: View has empty result.'); + + // Option 7: Is not empty. + $view = $this->getTermIdExposedGroupedOptionsTestView(); + $view->set_exposed_input(array( + 'field_tags_tid' => '7', + )); + $this->executeView($view); + + // Assert correct result set. + $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0; + $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0; + $result1 = ($nid === (int) $this->nodes[0]->nid); + $nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0; + $result2 = ($nid === (int) $this->nodes[1]->nid); + $nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0; + $result3 = ($nid === (int) $this->nodes[2]->nid); + $nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0; + $result4 = ($nid === (int) $this->nodes[2]->nid); + $this->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 7: View result has correct node ID.'); + $this->verbose($view->result); + $this->assertIdentical($result_count, 4, 'Option 7: View has four results.'); + } + + /** + * Generates test_not view. + */ + protected function getGroupedNoneOfTestView() { + $view = new view(); + $view->name = 'test_not'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_not'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Nid */ + $handler->display->display_options['sorts']['nid']['id'] = 'nid'; + $handler->display->display_options['sorts']['nid']['table'] = 'node'; + $handler->display->display_options['sorts']['nid']['field'] = 'nid'; + $handler->display->display_options['filter_groups']['operator'] = 'OR'; + $handler->display->display_options['filter_groups']['groups'] = array( + 1 => 'AND', + 2 => 'AND', + ); + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 1; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: Content: Type */ + $handler->display->display_options['filters']['type']['id'] = 'type'; + $handler->display->display_options['filters']['type']['table'] = 'node'; + $handler->display->display_options['filters']['type']['field'] = 'type'; + $handler->display->display_options['filters']['type']['value'] = array( + 'article' => 'article', + ); + $handler->display->display_options['filters']['type']['group'] = 1; + /* Filter criterion: Field: field_bool (field_bool) */ + $handler->display->display_options['filters']['field_bool_value']['id'] = 'field_bool_value'; + $handler->display->display_options['filters']['field_bool_value']['table'] = 'field_data_field_bool'; + $handler->display->display_options['filters']['field_bool_value']['field'] = 'field_bool_value'; + $handler->display->display_options['filters']['field_bool_value']['operator'] = 'not'; + $handler->display->display_options['filters']['field_bool_value']['value'] = array( + 1 => '1', + ); + $handler->display->display_options['filters']['field_bool_value']['group'] = 1; + /* Filter criterion: Field: field_bool (field_bool) */ + $handler->display->display_options['filters']['field_bool_value_1']['id'] = 'field_bool_value_1'; + $handler->display->display_options['filters']['field_bool_value_1']['table'] = 'field_data_field_bool'; + $handler->display->display_options['filters']['field_bool_value_1']['field'] = 'field_bool_value'; + $handler->display->display_options['filters']['field_bool_value_1']['operator'] = 'not'; + $handler->display->display_options['filters']['field_bool_value_1']['value'] = array( + 1 => '1', + ); + $handler->display->display_options['filters']['field_bool_value_1']['group'] = 2; + /* Filter criterion: Content: Type */ + $handler->display->display_options['filters']['type_1']['id'] = 'type_1'; + $handler->display->display_options['filters']['type_1']['table'] = 'node'; + $handler->display->display_options['filters']['type_1']['field'] = 'type'; + $handler->display->display_options['filters']['type_1']['value'] = array( + 'article' => 'article', + ); + $handler->display->display_options['filters']['type_1']['group'] = 2; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status_1']['id'] = 'status_1'; + $handler->display->display_options['filters']['status_1']['table'] = 'node'; + $handler->display->display_options['filters']['status_1']['field'] = 'status'; + $handler->display->display_options['filters']['status_1']['value'] = '1'; + $handler->display->display_options['filters']['status_1']['group'] = 2; + + return $view; + } + + /** + * Generates test_oneof view. + */ + protected function getGroupedOneOfTestView() { + $view = new view(); + $view->name = 'test_oneof'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_oneof'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Nid */ + $handler->display->display_options['sorts']['nid']['id'] = 'nid'; + $handler->display->display_options['sorts']['nid']['table'] = 'node'; + $handler->display->display_options['sorts']['nid']['field'] = 'nid'; + $handler->display->display_options['filter_groups']['operator'] = 'OR'; + $handler->display->display_options['filter_groups']['groups'] = array( + 1 => 'AND', + 2 => 'AND', + ); + /* Filter criterion: Content: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['value'] = array( + 1 => '1', + ); + $handler->display->display_options['filters']['field_tags_tid']['group'] = 2; + $handler->display->display_options['filters']['field_tags_tid']['reduce_duplicates'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid']['type'] = 'select'; + $handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags'; + /* Filter criterion: Content: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid_1']['id'] = 'field_tags_tid_1'; + $handler->display->display_options['filters']['field_tags_tid_1']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid_1']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid_1']['value'] = array( + 1 => '1', + ); + $handler->display->display_options['filters']['field_tags_tid_1']['reduce_duplicates'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid_1']['type'] = 'select'; + $handler->display->display_options['filters']['field_tags_tid_1']['vocabulary'] = 'tags'; + return $view; + } + + /** + * Generates test_reduced_exposed_grouped_options view. + */ + protected function getReducedExposedGroupedOptionsTestView() { + $view = new view(); + $view->name = 'test_reduced_exposed_grouped_options'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_reduced_exposed_grouped_options'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Nid */ + $handler->display->display_options['sorts']['nid']['id'] = 'nid'; + $handler->display->display_options['sorts']['nid']['table'] = 'node'; + $handler->display->display_options['sorts']['nid']['field'] = 'nid'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 1; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: Content: list (field_list) */ + $handler->display->display_options['filters']['field_list_value']['id'] = 'field_list_value'; + $handler->display->display_options['filters']['field_list_value']['table'] = 'field_data_field_list'; + $handler->display->display_options['filters']['field_list_value']['field'] = 'field_list_value'; + $handler->display->display_options['filters']['field_list_value']['exposed'] = TRUE; + $handler->display->display_options['filters']['field_list_value']['expose']['operator_id'] = 'field_list_value_op'; + $handler->display->display_options['filters']['field_list_value']['expose']['label'] = 'list (field_list)'; + $handler->display->display_options['filters']['field_list_value']['expose']['operator'] = 'field_list_value_op'; + $handler->display->display_options['filters']['field_list_value']['expose']['identifier'] = 'field_list_value'; + $handler->display->display_options['filters']['field_list_value']['is_grouped'] = TRUE; + $handler->display->display_options['filters']['field_list_value']['group_info']['label'] = 'list (field_list)'; + $handler->display->display_options['filters']['field_list_value']['group_info']['identifier'] = 'field_list_value'; + $handler->display->display_options['filters']['field_list_value']['group_info']['group_items'] = array( + 1 => array( + 'title' => 'Not 1 or 2', + 'operator' => 'not', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 2 => array( + 'title' => '1', + 'operator' => 'or', + 'value' => array( + 1 => '1', + ), + ), + 3 => array( + 'title' => '1 or 2', + 'operator' => 'or', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 4 => array( + 'title' => '1 and 2', + 'operator' => 'and', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 5 => array( + 'title' => 'empty', + 'operator' => 'empty', + 'value' => array(), + ), + 6 => array( + 'title' => 'not empty', + 'operator' => 'not empty', + 'value' => array(), + ), + ); + return $view; + } + + /** + * Generates test_tid_exposed_grouped_options view. + */ + protected function getTermIdExposedGroupedOptionsTestView() { + $view = new view(); + $view->name = 'test_tid_exposed_grouped_options'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_tid_exposed_grouped_options'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Nid */ + $handler->display->display_options['sorts']['nid']['id'] = 'nid'; + $handler->display->display_options['sorts']['nid']['table'] = 'node'; + $handler->display->display_options['sorts']['nid']['field'] = 'nid'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 1; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: Content: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['value'] = array( + 1 => '1', + 2 => '2', + ); + $handler->display->display_options['filters']['field_tags_tid']['exposed'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator_id'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['label'] = 'Tags (field_tags)'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['identifier'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['remember_roles'] = array( + 2 => '2', + ); + $handler->display->display_options['filters']['field_tags_tid']['is_grouped'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid']['group_info']['label'] = 'Tags (field_tags)'; + $handler->display->display_options['filters']['field_tags_tid']['group_info']['identifier'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['group_info']['group_items'] = array( + 1 => array( + 'title' => 'Is none of 2', + 'operator' => 'not', + 'value' => array( + 2 => '2', + ), + ), + 2 => array( + 'title' => 'Is none of 1 or 2', + 'operator' => 'not', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 3 => array( + 'title' => 'Is one of 1', + 'operator' => 'or', + 'value' => array( + 1 => '1', + ), + ), + 4 => array( + 'title' => 'Is one of 1 or 2', + 'operator' => 'or', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 5 => array( + 'title' => 'Is all of 1 and 2', + 'operator' => 'and', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 6 => array( + 'title' => 'Is empty', + 'operator' => 'empty', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + 7 => array( + 'title' => 'Is not empty', + 'operator' => 'not empty', + 'value' => array( + 1 => '1', + 2 => '2', + ), + ), + ); + $handler->display->display_options['filters']['field_tags_tid']['type'] = 'select'; + $handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags'; + return $view; + } + + /** + * Generates test_join_limit_none_of view. + */ + protected function getJoinLimitNoneOfTestView() { + $view = new view(); + $view->name = 'test_join_limit_none_of'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_join_limit_none_of'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Post date */ + $handler->display->display_options['sorts']['created']['id'] = 'created'; + $handler->display->display_options['sorts']['created']['table'] = 'node'; + $handler->display->display_options['sorts']['created']['field'] = 'created'; + $handler->display->display_options['sorts']['created']['order'] = 'DESC'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 1; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: Content: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['operator'] = 'not'; + $handler->display->display_options['filters']['field_tags_tid']['value'] = array( + 2 => '2', + 3 => '3', + 4 => '4', + 5 => '5', + 6 => '6', + 7 => '7', + 8 => '8', + 9 => '9', + 10 => '10', + 11 => '11', + 12 => '12', + 13 => '13', + 14 => '14', + 15 => '15', + 16 => '16', + 17 => '17', + 18 => '18', + 19 => '19', + 20 => '20', + 21 => '21', + 22 => '22', + 23 => '23', + 24 => '24', + 25 => '25', + 26 => '26', + 27 => '27', + 28 => '28', + 29 => '29', + 30 => '30', + 31 => '31', + 32 => '32', + 33 => '33', + 34 => '34', + 35 => '35', + 36 => '36', + 37 => '37', + 38 => '38', + 39 => '39', + 40 => '40', + 41 => '41', + 42 => '42', + 43 => '43', + 44 => '44', + 45 => '45', + 46 => '46', + 47 => '47', + 48 => '48', + 49 => '49', + 50 => '50', + 51 => '51', + 52 => '52', + 53 => '53', + 54 => '54', + 55 => '55', + 56 => '56', + 57 => '57', + 58 => '58', + 59 => '59', + 60 => '60', + 61 => '61', + 62 => '62', + 63 => '63', + 64 => '64', + 65 => '65', + 66 => '66', + 67 => '67', + 68 => '68', + 69 => '69', + 61 => '61', + 62 => '62', + ); + $handler->display->display_options['filters']['field_tags_tid']['type'] = 'select'; + $handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags'; + return $view; + } + +} diff --git a/profiles/openasu/modules/contrib/views/tests/styles/views_plugin_style.test b/profiles/openasu/modules/contrib/views/tests/styles/views_plugin_style.test index 20a24eb9f1..89d2816c6a 100644 --- a/profiles/openasu/modules/contrib/views/tests/styles/views_plugin_style.test +++ b/profiles/openasu/modules/contrib/views/tests/styles/views_plugin_style.test @@ -78,6 +78,7 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase { $expected = array(); $expected['Job: Singer'] = array(); $expected['Job: Singer']['group'] = 'Job: Singer'; + $expected['Job: Singer']['level'] = '0'; $expected['Job: Singer']['rows'][0] = new StdClass(); $expected['Job: Singer']['rows'][0]->views_test_name = 'John'; $expected['Job: Singer']['rows'][0]->views_test_job = 'Singer'; @@ -88,6 +89,7 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase { $expected['Job: Singer']['rows'][1]->views_test_id = '2'; $expected['Job: Drummer'] = array(); $expected['Job: Drummer']['group'] = 'Job: Drummer'; + $expected['Job: Drummer']['level'] = '0'; $expected['Job: Drummer']['rows'][2] = new StdClass(); $expected['Job: Drummer']['rows'][2]->views_test_name = 'Ringo'; $expected['Job: Drummer']['rows'][2]->views_test_job = 'Drummer'; @@ -161,8 +163,10 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase { $expected = array(); $expected['Job: Singer'] = array(); $expected['Job: Singer']['group'] = 'Job: Singer'; + $expected['Job: Singer']['level'] = 0; $expected['Job: Singer']['rows']['Age: 25'] = array(); $expected['Job: Singer']['rows']['Age: 25']['group'] = 'Age: 25'; + $expected['Job: Singer']['rows']['Age: 25']['level'] = 1; $expected['Job: Singer']['rows']['Age: 25']['rows'][0] = new StdClass(); $expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_name = 'John'; $expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_job = 'Singer'; @@ -170,6 +174,7 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase { $expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_id = '1'; $expected['Job: Singer']['rows']['Age: 27'] = array(); $expected['Job: Singer']['rows']['Age: 27']['group'] = 'Age: 27'; + $expected['Job: Singer']['rows']['Age: 27']['level'] = 1; $expected['Job: Singer']['rows']['Age: 27']['rows'][1] = new StdClass(); $expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_name = 'George'; $expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_job = 'Singer'; @@ -177,8 +182,10 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase { $expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_id = '2'; $expected['Job: Drummer'] = array(); $expected['Job: Drummer']['group'] = 'Job: Drummer'; + $expected['Job: Drummer']['level'] = 0; $expected['Job: Drummer']['rows']['Age: 28'] = array(); $expected['Job: Drummer']['rows']['Age: 28']['group'] = 'Age: 28'; + $expected['Job: Drummer']['rows']['Age: 28']['level'] = 1; $expected['Job: Drummer']['rows']['Age: 28']['rows'][2] = new StdClass(); $expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_name = 'Ringo'; $expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_job = 'Drummer'; diff --git a/profiles/openasu/modules/contrib/views/tests/user/views_handler_field_user_name.test b/profiles/openasu/modules/contrib/views/tests/user/views_handler_field_user_name.test index 60ec3b251a..73a8ac110b 100644 --- a/profiles/openasu/modules/contrib/views/tests/user/views_handler_field_user_name.test +++ b/profiles/openasu/modules/contrib/views/tests/user/views_handler_field_user_name.test @@ -51,6 +51,23 @@ class viewsHandlerFieldUserNameTest extends ViewsSqlTest { $this->assertIdentical($render, $anon_name, 'For user0 it should use the configured anonymous text if overwrite_anonymous is checked.'); } + + /** + * Tests that deselecting 'link_to_user' and 'format_username' works. + */ + public function testOptions() { + $view = $this->view_raw_user_name(); + $view->init_display(); + $this->executeView($view); + + $view->row_index = 0; + + $username = $view->result[0]->users_name = 'test'; + $view->result[0]->uid = 1; + $render = $view->field['name']->advanced_render($view->result[0]); + $this->assertTrue(strpos($render, $username) !== FALSE, 'If link to user is checked the username should be part of the output.'); + } + function view_user_name() { $view = new view(); $view->name = 'test_views_handler_field_user_name'; @@ -93,4 +110,46 @@ class viewsHandlerFieldUserNameTest extends ViewsSqlTest { return $view; } + function view_raw_user_name() { + $view = new view; + $view->name = 'test_views_handler_field_user_name'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'users'; + $view->human_name = 'test_views_handler_field_user_name'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['access']['type'] = 'none'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['query']['options']['query_comment'] = FALSE; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: User: Name */ + $handler->display->display_options['fields']['name']['id'] = 'name'; + $handler->display->display_options['fields']['name']['table'] = 'users'; + $handler->display->display_options['fields']['name']['field'] = 'name'; + $handler->display->display_options['fields']['name']['label'] = ''; + $handler->display->display_options['fields']['name']['alter']['alter_text'] = 0; + $handler->display->display_options['fields']['name']['alter']['make_link'] = 0; + $handler->display->display_options['fields']['name']['alter']['absolute'] = 0; + $handler->display->display_options['fields']['name']['alter']['word_boundary'] = 0; + $handler->display->display_options['fields']['name']['alter']['ellipsis'] = 0; + $handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0; + $handler->display->display_options['fields']['name']['alter']['trim'] = 0; + $handler->display->display_options['fields']['name']['alter']['html'] = 0; + $handler->display->display_options['fields']['name']['hide_empty'] = 0; + $handler->display->display_options['fields']['name']['empty_zero'] = 0; + $handler->display->display_options['fields']['name']['link_to_user'] = 0; + $handler->display->display_options['fields']['name']['format_username'] = 0; + $handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0; + + return $view; + } } diff --git a/profiles/openasu/modules/contrib/views/tests/views_clone.test b/profiles/openasu/modules/contrib/views/tests/views_clone.test new file mode 100644 index 0000000000..7ac10aba10 --- /dev/null +++ b/profiles/openasu/modules/contrib/views/tests/views_clone.test @@ -0,0 +1,277 @@ + 'Test cloning a view', + 'description' => 'Tests clone_view method of views class', + 'group' => 'Views', + ); + } + + /** + * Returns a new term with random properties in vocabulary $vocabulary. + */ + protected function createTerm($vocabulary) { + $term = new stdClass(); + $term->name = $this->randomName(); + $term->description = $this->randomName(); + // Use the first available text format. + $term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(); + $term->vid = $vocabulary->vid; + taxonomy_term_save($term); + return $term; + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + $vocabulary = taxonomy_vocabulary_machine_name_load('tags'); + $this->term = $this->createTerm($vocabulary); + + $node = array(); + $node['type'] = 'article'; + $node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->term->tid; + $this->node = $this->drupalCreateNode($node); + } + + /** + * Test cloning a view. + */ + public function testClone() { + // Prepare view to be cloned. + $view = $this->getTestCloneView(); + $view->set_arguments(array( + 0 => $this->node->nid, + )); + $view->set_exposed_input(array( + 'field_tags_tid' => $this->term->tid, + )); + + // Execute view to be cloned. + $result = $view->execute(); + + // To make sure that we are properly testing removal of all properties, we + // first need to assert that they are actually present in the original view. + $keys = array( + 'current_display', + 'display_handler', + 'field', + 'argument', + 'filter', + 'sort', + 'relationship', + 'header', + 'footer', + 'empty', + 'query', + 'inited', + 'style_plugin', + 'plugin_name', + 'exposed_data', + 'exposed_input', + 'exposed_widgets', + 'many_to_one_aliases', + 'many_to_one_tables', + 'feed_icon', + ); + foreach ($keys as $key) { + $this->assertTrue(isset($view->{$key}), $key . 'is set in original view.'); + } + $this->assertTrue($view->built, 'Assert original view built.'); + $this->assertTrue($view->executed, 'Assert original view executed.'); + $this->assertNotEqual($view->build_info, array(), 'Assert original view has build_info.'); + $this->assertNotEqual($view->attachment_before, '', 'Assert original view has attachment_before.'); + $this->assertNotEqual($view->attachment_after, '', 'Assert original view has attachment_after.'); + $this->assertNotEqual($view->result, array(), 'Assert original view has result.'); + + // Clone view. + $clone = $view->clone_view(); + + // Assert that all relevant properties have been removed or reset. + $keys = array( + 'current_display', + 'display_handler', + 'field', + 'argument', + 'filter', + 'sort', + 'relationship', + 'header', + 'footer', + 'empty', + 'query', + 'inited', + 'style_plugin', + 'plugin_name', + 'exposed_data', + 'exposed_input', + 'exposed_widgets', + 'many_to_one_aliases', + 'many_to_one_tables', + 'feed_icon', + ); + foreach ($keys as $key) { + $this->assertFalse(isset($clone->{$key}), $key . ' has been removed in cloned view.'); + } + foreach ($clone->display as $id => $display) { + $this->assertFalse(isset($clone->display[$id]->handler), 'Make sure all display handlers have been destroyed.'); + } + $this->assertFalse($clone->built, 'Assert cloned view not built.'); + $this->assertFalse($clone->executed, 'Assert cloned view not executed.'); + $this->assertEqual($clone->build_info, array(), 'Assert cloned view has empty build_info.'); + $this->assertEqual($clone->attachment_before, '', 'Assert cloned view has empty attachment_before.'); + $this->assertEqual($clone->attachment_after, '', 'Assert cloned view has empty attachment_after.'); + $this->assertEqual($clone->result, array(), 'Assert cloned view has empty result.'); + + // Execute cloned view. + $clone->execute(); + + // Assert result sets are equal. + $this->assertEqual($view->result, $clone->result, 'Result sets of cloned view and original view match.'); + } + + /** + * Generate test_clone view. + */ + protected function getTestCloneView() { + $view = new view(); + $view->name = 'test_clone'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'test_clone'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'test_clone'; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'node'; + /* Header: Global: Text area */ + $handler->display->display_options['header']['area']['id'] = 'area'; + $handler->display->display_options['header']['area']['table'] = 'views'; + $handler->display->display_options['header']['area']['field'] = 'area'; + $handler->display->display_options['header']['area']['label'] = 'Header'; + $handler->display->display_options['header']['area']['content'] = 'Header'; + $handler->display->display_options['header']['area']['format'] = 'filtered_html'; + /* Footer: Global: Text area */ + $handler->display->display_options['footer']['area']['id'] = 'area'; + $handler->display->display_options['footer']['area']['table'] = 'views'; + $handler->display->display_options['footer']['area']['field'] = 'area'; + $handler->display->display_options['footer']['area']['label'] = 'Footer'; + $handler->display->display_options['footer']['area']['content'] = 'Footer'; + $handler->display->display_options['footer']['area']['format'] = 'filtered_html'; + /* No results behavior: Global: Text area */ + $handler->display->display_options['empty']['area']['id'] = 'area'; + $handler->display->display_options['empty']['area']['table'] = 'views'; + $handler->display->display_options['empty']['area']['field'] = 'area'; + $handler->display->display_options['empty']['area']['label'] = 'Empty'; + $handler->display->display_options['empty']['area']['empty'] = TRUE; + $handler->display->display_options['empty']['area']['content'] = 'Empty'; + $handler->display->display_options['empty']['area']['format'] = 'filtered_html'; + /* Relationship: Comment: Last Comment */ + $handler->display->display_options['relationships']['cid']['id'] = 'cid'; + $handler->display->display_options['relationships']['cid']['table'] = 'node_comment_statistics'; + $handler->display->display_options['relationships']['cid']['field'] = 'cid'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Sort criterion: Content: Post date */ + $handler->display->display_options['sorts']['created']['id'] = 'created'; + $handler->display->display_options['sorts']['created']['table'] = 'node'; + $handler->display->display_options['sorts']['created']['field'] = 'created'; + $handler->display->display_options['sorts']['created']['order'] = 'DESC'; + /* Contextual filter: Content: Nid */ + $handler->display->display_options['arguments']['nid']['id'] = 'nid'; + $handler->display->display_options['arguments']['nid']['table'] = 'node'; + $handler->display->display_options['arguments']['nid']['field'] = 'nid'; + $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed'; + $handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0'; + $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary'; + $handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 'All'; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['exposed'] = TRUE; + $handler->display->display_options['filters']['status']['expose']['operator_id'] = ''; + $handler->display->display_options['filters']['status']['expose']['label'] = 'Published'; + $handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op'; + $handler->display->display_options['filters']['status']['expose']['identifier'] = 'status'; + $handler->display->display_options['filters']['status']['expose']['remember_roles'] = array( + 2 => '2', + ); + /* Filter criterion: Content: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['exposed'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator_id'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['label'] = 'Tags (field_tags)'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['identifier'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['remember_roles'] = array( + 2 => '2', + ); + $handler->display->display_options['filters']['field_tags_tid']['reduce_duplicates'] = TRUE; + $handler->display->display_options['filters']['field_tags_tid']['type'] = 'select'; + $handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags'; + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page'); + $handler->display->display_options['path'] = 'test-clone'; + /* Display: attachment_before */ + $handler = $view->new_display('attachment', 'attachment_before', 'attachment_1'); + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['displays'] = array( + 'default' => 'default', + 'page' => 'page', + ); + $handler->display->display_options['inherit_exposed_filters'] = TRUE; + /* Display: attachment_after */ + $handler = $view->new_display('attachment', 'attachment_after', 'attachment_2'); + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['displays'] = array( + 'default' => 'default', + 'page' => 'page', + ); + $handler->display->display_options['attachment_position'] = 'after'; + $handler->display->display_options['inherit_exposed_filters'] = TRUE; + /* Display: Feed */ + $handler = $view->new_display('feed', 'Feed', 'feed_1'); + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['style_plugin'] = 'rss'; + $handler->display->display_options['row_plugin'] = 'node_rss'; + $handler->display->display_options['path'] = 'test_clone/rss'; + $handler->display->display_options['displays'] = array( + 'default' => 'default', + 'page' => 'page', + ); + return $view; + } + +} diff --git a/profiles/openasu/modules/contrib/views/tests/views_handler_filter.test b/profiles/openasu/modules/contrib/views/tests/views_handler_filter.test index 5c1e7cae32..e41b35a39f 100644 --- a/profiles/openasu/modules/contrib/views/tests/views_handler_filter.test +++ b/profiles/openasu/modules/contrib/views/tests/views_handler_filter.test @@ -60,8 +60,8 @@ class ViewsHandlerFilterTest extends ViewsSqlTest { $node1 = $this->drupalCreateNode(array('type' => 'article','field_tags_tid' => $term->tid, 'created' => REQUEST_TIME)); $node2 = $this->drupalCreateNode(array('type' => 'article', 'created' => REQUEST_TIME + 1)); $user2 = $this->drupalCreateUser(array('access content')); - // $this->drupalLogin($this->drupalCreateUser(['administer users']); - $this->drupalLogin($this->drupalCreateUser(['administer users', 'access administration pages', 'administer site configuration', 'administer nodes', 'bypass node access'])); + // $this->drupalLogin($this->drupalCreateUser(array('administer users')); + $this->drupalLogin($this->drupalCreateUser(array('administer users', 'access administration pages', 'administer site configuration', 'administer nodes', 'bypass node access'))); $this->drupalGet('node/1/edit'); $edit['field_tags' . '[' . LANGUAGE_NONE . ']'] = $term->name; diff --git a/profiles/openasu/modules/contrib/views/tests/views_query.test b/profiles/openasu/modules/contrib/views/tests/views_query.test index 5acf01e958..ed10f3bed2 100644 --- a/profiles/openasu/modules/contrib/views/tests/views_query.test +++ b/profiles/openasu/modules/contrib/views/tests/views_query.test @@ -152,6 +152,23 @@ abstract class ViewsTestCase extends DrupalWebTestCase { $this->drupalLogin($account); } + /** + * {@inheritdoc} + */ + protected function verbose($message, $title = NULL) { + // Handle arrays, objects, etc. + if (!is_string($message)) { + $message = "
      \n" . print_r($message, TRUE) . "\n
      \n"; + } + + // Optional title to go before the output. + if (!empty($title)) { + $title = '

      ' . check_plain($title) . "

      \n"; + } + + parent::verbose($title . $message); + } + } /** diff --git a/profiles/openasu/modules/contrib/views/tests/views_test.info b/profiles/openasu/modules/contrib/views/tests/views_test.info index 9f089bc2f6..d7e79211ed 100644 --- a/profiles/openasu/modules/contrib/views/tests/views_test.info +++ b/profiles/openasu/modules/contrib/views/tests/views_test.info @@ -5,8 +5,8 @@ core = 7.x dependencies[] = views hidden = TRUE -; Information added by Drupal.org packaging script on 2019-03-13 -version = "7.x-3.21" +; Information added by Drupal.org packaging script on 2019-05-10 +version = "7.x-3.23" core = "7.x" project = "views" -datestamp = "1552486703" +datestamp = "1557505389" diff --git a/profiles/openasu/modules/contrib/views/theme/theme.inc b/profiles/openasu/modules/contrib/views/theme/theme.inc index 7382f01dd5..99b8efe7a1 100644 --- a/profiles/openasu/modules/contrib/views/theme/theme.inc +++ b/profiles/openasu/modules/contrib/views/theme/theme.inc @@ -379,8 +379,10 @@ function template_preprocess_views_view_summary(&$vars) { $active_urls = drupal_map_assoc(array( // Force system path. url($_GET['q'], array('alias' => TRUE)), + url($_GET['q'], $url_options + array('alias' => TRUE)), // Could be an alias. url($_GET['q']), + url($_GET['q'], $url_options), )); // Collect all arguments foreach row, to be able to alter them for example by @@ -430,8 +432,10 @@ function template_preprocess_views_view_summary_unformatted(&$vars) { $active_urls = drupal_map_assoc(array( // Force system path. url($_GET['q'], array('alias' => TRUE)), + url($_GET['q'], $url_options + array('alias' => TRUE)), // Could be an alias. url($_GET['q']), + url($_GET['q'], $url_options), )); // Collect all arguments foreach row, to be able to alter them for example by @@ -479,9 +483,24 @@ function template_preprocess_views_view_table(&$vars) { $vars['rows'] = array(); $vars['field_classes'] = array(); $vars['header'] = array(); + $vars['classes_array'] = array(); $options = $view->style_plugin->options; $handler = $view->style_plugin; + + if (!empty($handler->options['class'])) { + $classes = explode(' ', $handler->options['class']); + $classes = array_map('views_clean_css_identifier', $classes); + + if (!empty($classes)) { + // Trim empty class entries. + foreach ($classes as $key => $class) { + if (!empty($class)) { + $vars['classes_array'][] = $class; + } + } + } + } $default_row_class = isset($options['default_row_class']) ? $options['default_row_class'] : TRUE; $row_class_special = isset($options['row_class_special']) ? $options['row_class_special'] : TRUE; @@ -647,7 +666,7 @@ function template_preprocess_views_view_table(&$vars) { $vars['row_classes'][count($vars['row_classes']) - 1][] = 'views-row-last'; } - $vars['classes_array'] = array('views-table'); + $vars['classes_array'][] = 'views-table'; if (empty($vars['rows']) && !empty($options['empty_table'])) { $vars['rows'][0][0] = $view->display_handler->render_area('empty'); // Calculate the amounts of rows with output. @@ -710,7 +729,7 @@ function template_preprocess_views_view_grid(&$vars) { } if ($row) { // Fill up the last line only if it's configured, but this is default. - if (!empty($handler->options['fill_single_line']) && count($rows)) { + if (!empty($handler->options['fill_single_line'])) { for ($i = 0; $i < ($columns - $col_count); $i++) { $row[] = ''; } @@ -739,8 +758,15 @@ function template_preprocess_views_view_grid(&$vars) { $remainders--; } } - for ($i = 0; $i < count($rows[0]); $i++) { - // This should be string so that's okay :) + + // Fill out the row with empty values, if needed. + if (!empty($handler->options['fill_single_line'])) { + $column_fill = $columns; + } + else { + $column_fill = count($rows[0]); + } + for ($i = 0; $i < $column_fill; $i++) { if (!isset($rows[count($rows) - 1][$i])) { $rows[count($rows) - 1][$i] = ''; } diff --git a/profiles/openasu/modules/contrib/views/views.api.php b/profiles/openasu/modules/contrib/views/views.api.php index ea53a37cfc..dcf8019538 100644 --- a/profiles/openasu/modules/contrib/views/views.api.php +++ b/profiles/openasu/modules/contrib/views/views.api.php @@ -752,7 +752,7 @@ function hook_views_plugin_option_definition_alter(&$options, $plugin) { * Alter existing handler option definitions. * * This can be used to edit default or add new option definitions to existing - * handers. The reason for doing this is that only overriding the relevent form + * handlers. The reason for doing this is that only overriding the relevent form * with hook_form_alter() is insufficent because submitted form values will be * ignored if they haven't been declared as an available option. * @@ -787,7 +787,7 @@ function hook_views_handler_option_definition_alter(&$options, $handler) { * - api: (required) The version of the Views API the module implements. * - path: (optional) If includes are stored somewhere other than within the * root module directory, specify its path here. - * - template path: (optional) A path where the module has stored it's views + * - template path: (optional) A path where the module has stored its views * template files. When you have specified this key views automatically * uses the template files for the views. You can use the same naming * conventions like for normal views template files. diff --git a/profiles/openasu/modules/contrib/views/views.info b/profiles/openasu/modules/contrib/views/views.info index 6f311f9a4f..a857b233f9 100644 --- a/profiles/openasu/modules/contrib/views/views.info +++ b/profiles/openasu/modules/contrib/views/views.info @@ -285,6 +285,7 @@ files[] = tests/handlers/views_handler_filter_equality.test files[] = tests/handlers/views_handler_filter_in_operator.test files[] = tests/handlers/views_handler_filter_numeric.test files[] = tests/handlers/views_handler_filter_string.test +files[] = tests/handlers/views_handler_manytoone.test files[] = tests/handlers/views_handler_sort_random.test files[] = tests/handlers/views_handler_sort_date.test files[] = tests/handlers/views_handler_sort.test @@ -326,11 +327,12 @@ files[] = tests/user/views_user_argument_default.test files[] = tests/user/views_user_argument_validate.test files[] = tests/user/views_user.test files[] = tests/views_cache.test +files[] = tests/views_clone.test files[] = tests/views_view.test files[] = tests/views_ui.test -; Information added by Drupal.org packaging script on 2019-03-13 -version = "7.x-3.21" +; Information added by Drupal.org packaging script on 2019-05-10 +version = "7.x-3.23" core = "7.x" project = "views" -datestamp = "1552486703" +datestamp = "1557505389" diff --git a/profiles/openasu/modules/contrib/views/views.module b/profiles/openasu/modules/contrib/views/views.module index 58cfed4fc4..aa407f028a 100644 --- a/profiles/openasu/modules/contrib/views/views.module +++ b/profiles/openasu/modules/contrib/views/views.module @@ -752,6 +752,65 @@ function views_block_info() { return $items; } +/** + * Implements hook_block_configure(). + */ +function views_block_configure($delta = '') { + // If there's no Views UI module there's nothing to link to. + if (!module_exists('views_ui')) { + return array(); + } + + // If the user doesn't have access to edit the view then don't bother with + // anything else. + if (!user_access('administer views')) { + return array(); + } + + // If this is 32, this should be an md5 hash. + if (strlen($delta) == 32) { + $hashes = variable_get('views_block_hashes', array()); + if (!empty($hashes[$delta])) { + $delta = $hashes[$delta]; + } + } + + // Some added precaution in case the delta is missing values. + list($view_name, $display_id) = explode('-', $delta, 2) + array('', ''); + + // If the view name or display ID can't be found, there's something wrong. + if ($view_name === '' || $display_id === '') { + return array(); + } + + $view = views_get_view($view_name); + if (empty($view)) { + return array(); + } + + if (!isset($view->display[$display_id])) { + return array(); + } + + /** @var \views_display $display */ + $display = $view->display[$display_id]; + + $view_label = $view->get_human_name(); + $display_label = $display->display_title; + + $path = "admin/structure/views/view/$view_name/edit/$display_id"; + + return array( + 'fieldset' => array( + '#type' => 'fieldset', + '#title' => t('Configure this views display'), + 'content' => array( + '#markup' => l($view_label . ' - ' . $display_label, $path), + ), + ), + ); +} + /** * Implements hook_block_view(). */ @@ -1231,7 +1290,7 @@ function views_add_css($file) { * Include views .js files. */ function views_add_js($file) { - // If javascript has been disabled by the user, never add js files. + // If JavaScript has been disabled by the user, never add js files. if (variable_get('views_no_javascript', FALSE)) { return; } @@ -2586,6 +2645,17 @@ function views_views_api() { ); } +/** + * Implements hook_admin_menu_cache_info(). + */ +function views_admin_menu_cache_info() { + $caches['views'] = array( + 'title' => t('Views'), + 'callback' => 'views_invalidate_cache', + ); + return $caches; +} + if (!function_exists('aggregator_views_api')) { /** * Provide Views integration for the Aggregator module. diff --git a/profiles/openasu/modules/contrib/views/views_ui.info b/profiles/openasu/modules/contrib/views/views_ui.info index dc079b1173..7a8e5383d8 100644 --- a/profiles/openasu/modules/contrib/views/views_ui.info +++ b/profiles/openasu/modules/contrib/views/views_ui.info @@ -8,8 +8,8 @@ dependencies[] = views files[] = views_ui.module files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php -; Information added by Drupal.org packaging script on 2019-03-13 -version = "7.x-3.21" +; Information added by Drupal.org packaging script on 2019-05-10 +version = "7.x-3.23" core = "7.x" project = "views" -datestamp = "1552486703" +datestamp = "1557505389" diff --git a/profiles/openasu/modules/contrib/views/views_ui.module b/profiles/openasu/modules/contrib/views/views_ui.module index 387e669791..0eadd6ff55 100644 --- a/profiles/openasu/modules/contrib/views/views_ui.module +++ b/profiles/openasu/modules/contrib/views/views_ui.module @@ -804,6 +804,9 @@ function views_ui_contextual_links_suppress_pop() { * @see http://drupal.org/node/774876 */ function views_ui_ajax_get_form($form_id) { + $args = func_get_args(); + array_shift($args); + // @see ajax_get_form() $form_state = array( 'no_redirect' => TRUE, @@ -812,8 +815,6 @@ function views_ui_ajax_get_form($form_id) { $form_state['rebuild_info']['copy']['#action'] = TRUE; // @see drupal_get_form() - $args = func_get_args(); - array_shift($args); $form_state['build_info']['args'] = $args; $form = drupal_build_form($form_id, $form_state); @@ -902,7 +903,7 @@ function _views_ui_get_displays_list($view) { * @see /js/jquery.ui.dialog.patch.js * @see /js/jquery.ui.dialog.min.js * - * The javascript patch overwrites the $.ui.dialog.overlay.events object to + * The JavaScript patch overwrites the $.ui.dialog.overlay.events object to * remove the mousedown, mouseup and click events from the list of events that * are bound in $.ui.dialog.overlay.create. */ diff --git a/profiles/openasu/modules/contrib/webform/THEMING.txt b/profiles/openasu/modules/contrib/webform/THEMING.txt index 90ea883299..bf771a03cf 100644 --- a/profiles/openasu/modules/contrib/webform/THEMING.txt +++ b/profiles/openasu/modules/contrib/webform/THEMING.txt @@ -1,9 +1,9 @@ Overview -------- -Webform supports theming similar to the CCK or Views modules. Any webform -may be themed on the server side, though doing so may require a reasonable -amount of knowledge about the Drupal Form API. More information about the Form -API may be found at http://api.drupal.org/api/file/developer/topics/forms_api.html +Webform supports theming similar to the CCK or Views modules. Any webform may be +themed on the server side, though doing so may require a reasonable amount of +knowledge about the Drupal Form API. More information about the Form API may be +found at: http://api.drupal.org/api/file/developer/topics/forms_api.html Theme submission e-mails ----------------------- diff --git a/profiles/openasu/modules/contrib/webform/components/date.inc b/profiles/openasu/modules/contrib/webform/components/date.inc index 2268f35777..23a9648e51 100644 --- a/profiles/openasu/modules/contrib/webform/components/date.inc +++ b/profiles/openasu/modules/contrib/webform/components/date.inc @@ -224,7 +224,7 @@ function webform_expand_date($element) { unset($element['#value']); } - // Set defaults according to existing #default_value (set by Form API) + // Set defaults according to existing #default_value (set by Form API). if (isset($element['#default_value']['month']) || isset($element['#default_value']['day']) || isset($element['#default_value']['year'])) { $default_values = array( 'month' => $element['#default_value']['month'], @@ -409,7 +409,8 @@ function theme_webform_date($variables) { function webform_validate_date($element, $form_state) { $field_types = array('day', 'month', 'year'); - // Determine if the user has specified a date. Hidden parts of the date will be submitted automatically. + // Determine if the user has specified a date. Hidden parts of the date will + // be submitted automatically. foreach ($field_types as $field_type) { if (!in_array($field_type, $element['#exclude']) && $element[$field_type]['#value'] !== '') { $field_found = TRUE; diff --git a/profiles/openasu/modules/contrib/webform/components/email.inc b/profiles/openasu/modules/contrib/webform/components/email.inc index b384dbe48d..bbabf69668 100644 --- a/profiles/openasu/modules/contrib/webform/components/email.inc +++ b/profiles/openasu/modules/contrib/webform/components/email.inc @@ -240,16 +240,15 @@ function theme_webform_email($variables) { } /** - * A Drupal Form API Validation function. Validates the entered values from - * email components on the client-side form. + * A Drupal Form API Validation function. * - * @param $form_element + * Validates the entered values from email components on the client-side form. + * Calls a form_set_error if the e-mail is not valid. + * + * @param array $form_element * The e-mail form element. - * @param $form_state + * @param array $form_state * The full form state for the webform. - * - * @return - * None. Calls a form_set_error if the e-mail is not valid. */ function _webform_validate_email($form_element, &$form_state) { $component = $form_element['#webform_component']; @@ -322,13 +321,15 @@ function _webform_analysis_email($component, $sids = array(), $single = FALSE, $ $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks)); $rows[1] = array(t('User entered value'), $nonblanks); - $other[0] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[0] = array( + t('Average submission length in words (ex blanks)'), + ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0'), + ); return array( 'table_rows' => $rows, 'other_data' => $other, ); - } /** diff --git a/profiles/openasu/modules/contrib/webform/components/file.inc b/profiles/openasu/modules/contrib/webform/components/file.inc index 47cf46fcb6..b8233e5071 100644 --- a/profiles/openasu/modules/contrib/webform/components/file.inc +++ b/profiles/openasu/modules/contrib/webform/components/file.inc @@ -191,24 +191,12 @@ function _webform_edit_file($component) { '#parents' => array('extra', 'progress_indicator'), ); - // TODO: Make managed_file respect the "size" parameter. - /* - $form['display']['width'] = array( - '#type' => 'textfield', - '#title' => t('Width'), - '#default_value' => $component['extra']['width'], - '#description' => t('Width of the file field.') . ' ' . t('Leaving blank will use the default size.'), - '#size' => 5, - '#maxlength' => 10, - '#weight' => 4, - '#parents' => array('extra', 'width') - ); - */ - return $form; } /** + * Form API validator ensures rename string is empty or contains one token. + * * A Form API element validate function to ensure that the rename string is * either empty or contains at least one token. */ @@ -389,11 +377,12 @@ function _webform_render_file($component, $value = NULL, $filter = TRUE, $submis * wrapper around the element with the element's id, thereby creating 2 elements * with the same id. * - * @param $variables + * @param array $variables * An associative array containing: * - element: A render element representing the file. * * @return string + * The HTML. */ function theme_webform_managed_file($variables) { $element = $variables['element']; @@ -426,8 +415,9 @@ function _webform_submit_file($component, $value) { $fid = is_array($value) ? (!empty($value['fid']) ? $value['fid'] : '') : (!empty($value) ? $value : ''); - // Extend access to this file, even if the submission has not been saved yet. This may happen when - // previewing a private file which was selected but not explicitly uploaded, and then previewed. + // Extend access to this file, even if the submission has not been saved yet. + // This may happen when previewing a private file which was selected but not + // explicitly uploaded, and then previewed. if ($fid) { $_SESSION['webform_files'][$fid] = $fid; } @@ -497,8 +487,6 @@ function _webform_delete_file($component, $value) { */ function _webform_attachments_file($component, $value) { $file = (array) webform_get_file($value[0]); - // This is necessary until the next release of mimemail is out, see [#1388786]. - $file['filepath'] = $file['uri']; $files = array($file); return $files; } @@ -627,8 +615,9 @@ function webform_file_usage_adjust($submission) { } /** - * Rename any files which are eligible for renaming, if this submission is being - * submitted for the first time. + * Rename any files which are eligible for renaming. + * + * Renames if this submission is being submitted for the first time. */ function webform_file_rename($node, $submission) { if (isset($submission->file_usage)) { @@ -643,13 +632,13 @@ function webform_file_rename($node, $submission) { /** * Renames the uploaded file name using tokens. * - * @param $node + * @param object $node * The webform node object. - * @param $submission + * @param object $submission * The webform submission object. - * @param $component + * @param array $component * Component settings array for which fid is going to be processed. - * @param $fid + * @param int $fid * A file id to be processed. */ function webform_file_process_rename($node, $submission, $component, $fid) { diff --git a/profiles/openasu/modules/contrib/webform/components/grid.inc b/profiles/openasu/modules/contrib/webform/components/grid.inc index b27744e96a..bffa23664d 100644 --- a/profiles/openasu/modules/contrib/webform/components/grid.inc +++ b/profiles/openasu/modules/contrib/webform/components/grid.inc @@ -324,7 +324,7 @@ function webform_expand_grid($element) { * @return array * The merged array. */ -function webform_grid_merge_options($existing, $new) { +function webform_grid_merge_options(array $existing, array $new) { $insert = NULL; $queue = array(); foreach ($new as $key => $value) { @@ -369,7 +369,7 @@ function webform_grid_merge_options($existing, $new) { * @return array * The $row_options with any missing options replaced with empty values. */ -function webform_grid_remove_options($header, $row_options) { +function webform_grid_remove_options(array $header, array $row_options) { foreach ($header as $key => $value) { if (!isset($row_options[$key])) { $header[$key] = ''; @@ -672,7 +672,7 @@ function _webform_edit_grid_unique_validate($element) { } /** - * + * Theme function to render a grid component. */ function theme_webform_grid($variables) { $element = $variables['element']; @@ -728,26 +728,60 @@ function theme_webform_grid($variables) { $rows[] = array( 'data' => $row, 'class' => empty($question_element['#grid_question']) - ? array('webform-component', 'webform-component-' . str_replace('_', '-', $question_element['#type']), 'webform-component--' . $parents) + ? array( + 'webform-component', + 'webform-component-' . str_replace('_', '-', $question_element['#type']), + 'webform-component--' . $parents, + ) : array(), ); } $option_count = count($header) - 1; - return theme('table', array('header' => $header, 'rows' => $rows, 'sticky' => $element['#sticky'], 'attributes' => array('class' => array('webform-grid', 'webform-grid-' . $option_count)))); + return theme('table', array( + 'header' => $header, + 'rows' => $rows, + 'sticky' => $element['#sticky'], + 'attributes' => array( + 'class' => array( + 'webform-grid', + 'webform-grid-' . $option_count, + ), + ), + )); } /** * Generate a table header suitable for form or html display. + * + * @param array $element + * The element array. + * @param bool $right_titles + * If TRUE, display a right-side title column. + * + * @return array + * An array of headers. */ -function _webform_grid_header($element, $right_titles) { +function _webform_grid_header(array $element, $right_titles) { $titles = explode('|', $element['#title'], 2); - $header = array(array('data' => _webform_grid_header_title($element, $titles[0]), 'class' => array('webform-grid-question'))); + $header = array( + array( + 'data' => _webform_grid_header_title($element, $titles[0]), + 'class' => array('webform-grid-question'), + ), + ); foreach ($element['#grid_options'] as $option) { - $header[] = array('data' => webform_filter_xss($option), 'class' => array('checkbox', 'webform-grid-option')); + $header[] = array( + 'data' => webform_filter_xss($option), + 'class' => array('checkbox', 'webform-grid-option'), + 'scope' => 'col', + ); } if ($right_titles) { - $header[] = array('data' => _webform_grid_header_title($element, isset($titles[1]) ? $titles[1] : ''), 'class' => array('webform-grid-question')); + $header[] = array( + 'data' => _webform_grid_header_title($element, isset($titles[1]) ? $titles[1] : ''), + 'class' => array('webform-grid-question'), + ); } return $header; } @@ -801,7 +835,7 @@ function webform_validate_grid($element, $form_state) { foreach ($element['#parents'] as $key) { $values = isset($values[$key]) ? $values[$key] : $values; } - // Remove any values that aren't grid question (i.e. nested components) + // Remove any values that aren't grid question (i.e. nested components). $grid_questions = $element['#grid_questions']; $values = array_intersect_key($values, $grid_questions); // Remove any unanswered grid questions. @@ -810,7 +844,11 @@ function webform_validate_grid($element, $form_state) { }); // Give required errors for any questions that aren't answered. foreach (array_diff_key($grid_questions, $answers) as $question_key => $question) { - form_error($element[$question_key], t('!question field within !name is required.', array('!question' => $question, '!name' => $element['#title']))); + // If the question is still required (e.g not modified by an after_build + // function), give the required error. + if (!empty($element[$question_key]['#required'])) { + form_error($element[$question_key], t('!question field within !name is required.', array('!question' => $question, '!name' => $element['#title']))); + } } } } diff --git a/profiles/openasu/modules/contrib/webform/components/hidden.inc b/profiles/openasu/modules/contrib/webform/components/hidden.inc index 0fa9deee17..ca6618e00d 100644 --- a/profiles/openasu/modules/contrib/webform/components/hidden.inc +++ b/profiles/openasu/modules/contrib/webform/components/hidden.inc @@ -118,7 +118,7 @@ function _webform_display_hidden($component, $value, $format = 'html', $submissi } /** - * + * Theme callback. */ function theme_webform_display_hidden($variables) { $element = $variables['element']; @@ -158,7 +158,10 @@ function _webform_analysis_hidden($component, $sids = array(), $single = FALSE, $rows[0] = array(t('Empty'), ($submissions - $nonblanks)); $rows[1] = array(t('Non-empty'), $nonblanks); - $other[0] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[0] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/openasu/modules/contrib/webform/components/markup.inc b/profiles/openasu/modules/contrib/webform/components/markup.inc index dd9d3fb339..2460e714cb 100644 --- a/profiles/openasu/modules/contrib/webform/components/markup.inc +++ b/profiles/openasu/modules/contrib/webform/components/markup.inc @@ -132,7 +132,8 @@ function _webform_render_markup_after_build($form_element, &$form_state) { } $conditional_value = $sorter->componentMarkup($component['cid'], $component['page_num']); if (isset($conditional_value)) { - // Provide original value, should conditional logic no longer set the value. + // Provide original value, should conditional logic no longer set the + // value. $form_element['#wrapper_attributes']['data-webform-markup'] = $value; if (is_string($conditional_value)) { $value = check_markup($conditional_value, $component['extra']['format']); diff --git a/profiles/openasu/modules/contrib/webform/components/number.inc b/profiles/openasu/modules/contrib/webform/components/number.inc index dbbd2ddab5..c2bf76e723 100644 --- a/profiles/openasu/modules/contrib/webform/components/number.inc +++ b/profiles/openasu/modules/contrib/webform/components/number.inc @@ -58,8 +58,7 @@ function _webform_theme_number() { } /** - * Adjusts the view field(s) that are automatically generated for number - * components. + * Fix the view field(s) that are automatically generated for number components. */ function _webform_view_field_number($component, $fields) { foreach ($fields as &$field) { @@ -610,12 +609,13 @@ function _webform_csv_data_number($component, $export_options, $value) { } /** - * A Drupal Form API Validation function. Validates the entered values from - * number components on the client-side form. + * A Drupal Form API Validation function. * - * @param $element + * Validates the entered values from number components on the client-side form. + * + * @param array $element * The form element. May either be a select or a webform_number element. - * @param $form_state + * @param array $form_state * The full form state for the webform. */ function _webform_validate_number($element, &$form_state) { @@ -815,17 +815,18 @@ function _webform_number_format($component, $value) { * This function allows the thousands separator to be optional, but decimal * points must be in the right location. * + * A valid number is: + * 1. optional minus sign. + * 2. optional space. + * 3. the rest of the string can't be just a decimal or blank. + * 4. optional integer portion, with thousands separators. + * 5. optional decimal portion, starting is a decimal separator. + * Don't use preg_quote because a space is a valid thousands separator and + * needs quoting for the 'x' option to preg_match. + * * Based on http://stackoverflow.com/questions/5917082/regular-expression-to-match-numbers-with-or-without-commas-and-decimals-in-text. */ function webform_number_format_match($value, $point, $separator) { - // A valid number is: - // 1. optional minus sign. - // 2. optional space. - // 3. the rest of the string can't be just a decimal or blank. - // 4. optional integer portion, with thousands separators. - // 5. optional decimal portion, starting is a decimal separator. - // Don't use preg_quote because a space is a valid thousands separator and - // needs quoting for the 'x' option to preg_match. $thousands = $separator ? "\\$separator?" : ''; $decimal = "\\$point"; return preg_match("/ @@ -882,10 +883,11 @@ function webform_number_format($value, $decimals = NULL, $point = '.', $separato * * @param string $value * The string value to be standardized into a numeric string. - * @param $point + * @param string $point * The point separator between the whole number and the decimals. * - * @return mixed|string + * @return string + * The converted number. */ function webform_number_standardize($value, $point) { // For simplicity, strip everything that's not the decimal point. diff --git a/profiles/openasu/modules/contrib/webform/components/select.inc b/profiles/openasu/modules/contrib/webform/components/select.inc index 4b39d274ce..2b1b7fff95 100644 --- a/profiles/openasu/modules/contrib/webform/components/select.inc +++ b/profiles/openasu/modules/contrib/webform/components/select.inc @@ -965,11 +965,11 @@ function _webform_select_options_info() { /** * Execute a select option callback. * - * @param $name + * @param string $name * The name of the options group. - * @param $component + * @param array $component * The full Webform component. - * @param $flat + * @param bool $flat * Whether the information returned should exclude any nested groups. */ function _webform_select_options_callback($name, $component, $flat = FALSE) { @@ -996,8 +996,7 @@ function _webform_select_options_callback($name, $component, $flat = FALSE) { } /** - * Utility function to split user-entered values from new-line separated - * text into an array of options. + * Splits user values from new-line separated text into an array of options. * * @param string $text * Text to be converted into a select option array. diff --git a/profiles/openasu/modules/contrib/webform/components/textarea.inc b/profiles/openasu/modules/contrib/webform/components/textarea.inc index d1d0b013eb..c4556b78c6 100644 --- a/profiles/openasu/modules/contrib/webform/components/textarea.inc +++ b/profiles/openasu/modules/contrib/webform/components/textarea.inc @@ -211,7 +211,10 @@ function _webform_analysis_textarea($component, $sids = array(), $single = FALSE $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks)); $rows[1] = array(t('User entered value'), $nonblanks); - $other[] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/openasu/modules/contrib/webform/components/textfield.inc b/profiles/openasu/modules/contrib/webform/components/textfield.inc index 3a1cca8eb0..1bddc466ea 100644 --- a/profiles/openasu/modules/contrib/webform/components/textfield.inc +++ b/profiles/openasu/modules/contrib/webform/components/textfield.inc @@ -158,7 +158,12 @@ function _webform_render_textfield($component, $value = NULL, $filter = TRUE, $s '#description' => $filter ? webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'], '#attributes' => $component['extra']['attributes'], '#theme_wrappers' => array('webform_element'), - '#translatable' => array('title', 'description', 'field_prefix', 'field_suffix'), + '#translatable' => array( + 'title', + 'description', + 'field_prefix', + 'field_suffix', + ), ); if ($component['required']) { @@ -263,7 +268,10 @@ function _webform_analysis_textfield($component, $sids = array(), $single = FALS $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks)); $rows[1] = array(t('User entered value'), $nonblanks); - $other[] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/openasu/modules/contrib/webform/components/time.inc b/profiles/openasu/modules/contrib/webform/components/time.inc index 493012776c..aaedb7385d 100644 --- a/profiles/openasu/modules/contrib/webform/components/time.inc +++ b/profiles/openasu/modules/contrib/webform/components/time.inc @@ -130,7 +130,7 @@ function _webform_edit_time_validate($form, &$form_state) { foreach (array('start_time', 'end_time') as $field) { $time[$field] = FALSE; if (trim($form_state['values']['extra'][$field]) && ($time[$field] = strtotime('1-1-1970 UTC ' . $form_state['values']['extra'][$field])) === FALSE) { - form_set_error("extra][$field", t('The @field isn\'t a valid time.', array('@field' => $form['validation'][$field]['#title']))); + form_set_error("extra][$field", t("The @field isn't a valid time.", array('@field' => $form['validation'][$field]['#title']))); } } } @@ -188,7 +188,7 @@ function webform_expand_time($element) { else { $default_values = array( 'hour' => '', - 'minute' => '0', + 'minute' => '', 'second' => '', ); } @@ -304,7 +304,7 @@ function theme_webform_time($variables) { } /** - * + * Validate that the time data is valid, calling form_error() if not. */ function webform_validate_time($element, $form_state) { // Check if the user filled the required fields. @@ -495,12 +495,12 @@ function _webform_csv_data_time($component, $export_options, $value) { /** * Convert a time between a 24-hour and a 12-hour value. * - * @param $array + * @param array $array * An array of hour, minute, second, and optionally ampm. - * @param $format + * @param string $format * Either 12-hour or 24-hour. * - * @return + * @return array * An array with hour, minute, second, and ampm (if using "12-hour"). */ function webform_time_convert($array, $format) { diff --git a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter.inc b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter.inc index df8e2965ef..b7556526ae 100644 --- a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter.inc +++ b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter.inc @@ -1,13 +1,8 @@ line_ending = webform_variable_get('webform_csv_line_ending'); @@ -27,9 +22,9 @@ class webform_exporter_delimited extends webform_exporter { } /** - * + * {@inheritdoc} */ - public function add_row(&$file_handle, $data, $row_count) { + public function add_row(&$file_handle, array $data, $row_count) { foreach ($data as $key => $value) { // Escape inner quotes and wrap all contents in new quotes. $data[$key] = '"' . str_replace('"', '""', $data[$key]) . '"'; @@ -43,7 +38,7 @@ class webform_exporter_delimited extends webform_exporter { } /** - * + * {@inheritdoc} */ public function set_headers($filename) { parent::set_headers($filename); diff --git a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_delimited.inc b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_delimited.inc index 9fe373925b..7e79976e77 100644 --- a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_delimited.inc +++ b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_delimited.inc @@ -1,17 +1,12 @@ $value) { // Escape inner quotes and wrap all contents in new quotes. $data[$key] = '"' . str_replace('"', '""', $data[$key]) . '"'; @@ -53,7 +48,7 @@ class webform_exporter_excel_delimited extends webform_exporter_delimited { } /** - * + * {@inheritdoc} */ public function set_headers($filename) { drupal_add_http_header('Content-Type', 'application/x-msexcel'); diff --git a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc index a8b15371c3..4410040f60 100644 --- a/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc +++ b/profiles/openasu/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc @@ -1,13 +1,8 @@ 'checkbox', '#title' => t('Use Reply-To header'), '#default_value' => webform_variable_get('webform_email_replyto'), - '#description' => t('Sends all e-mail from the domain of the default address above and sets the "Reply-To" header to the actual sender. Helps prevent e-mail from being flagged as spam.'), + '#description' => t('If the default from name and address are set above, send all e-mail from the default address set the "Reply-To" header to the actual sender. This helps prevent e-mail from being flagged as spam.'), ); $form['email']['webform_email_html_capable'] = array( @@ -312,7 +312,8 @@ function theme_webform_admin_settings($variables) { * Menu callback for admin/content/webform. Displays all webforms on the site. */ function webform_admin_content() { - // Determine whether views or hard-coded tables should be used for the webforms table. + // Determine whether views or hard-coded tables should be used for the + // webforms table. if (!webform_variable_get('webform_table')) { $view = views_get_view('webform_webforms'); return $view->preview('default'); diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.components.inc b/profiles/openasu/modules/contrib/webform/includes/webform.components.inc index c0fcad518e..1ded858f3c 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.components.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.components.inc @@ -159,7 +159,7 @@ function template_preprocess_webform_components_form(&$variables) { $form['components']['#attached']['library'][] = array('webform', 'admin'); - // TODO: Attach these. See http://drupal.org/node/732022. + // @todo: Attach these. See http://drupal.org/node/732022. drupal_add_tabledrag('webform-components', 'order', 'sibling', 'webform-weight'); drupal_add_tabledrag('webform-components', 'match', 'parent', 'webform-pid', 'webform-pid', 'webform-cid'); @@ -281,7 +281,7 @@ function _webform_components_form_rows($node, $cid, $component, $level, &$form, /** * Theme the node components form. Use a table to organize the components. * - * @return + * @return string * Formatted HTML form, ready for display. */ function theme_webform_components_form($variables) { @@ -463,7 +463,7 @@ function webform_component_edit_form($form, $form_state, $node, $component, $clo 'inline' => t('Inline'), 'none' => t('None'), ), - '#description' => t('Determines the placement of the component\'s label.'), + '#description' => t("Determines the placement of the component's label."), ); } else { @@ -579,7 +579,7 @@ function webform_component_edit_form($form, $form_state, $node, $component, $clo ); // Add the fields specific to this component type: - $additional_form_elements = (array) webform_component_invoke($component['type'], 'edit', $component); + $additional_form_elements = (array) webform_component_invoke($component['type'], 'edit', $component, $form, $form_state); if (empty($additional_form_elements)) { drupal_set_message(t('The webform component of type @type does not have an edit function defined.', array('@type' => $component['type']))); } @@ -855,7 +855,7 @@ function webform_component_update($component) { } /** - * + * Delete a Webform component. */ function webform_component_delete($node, $component) { // Check if a delete function is available for this component. If so, @@ -919,6 +919,9 @@ function webform_component_delete($node, $component) { // Delete the conditional if this component is the only source / target. if (empty($conditional[$field])) { webform_conditional_delete($node, $conditional); + // Also delete the conditional from the $node so it is not re-created + // later on in webform_node_update(). + unset($node->webform['conditionals'][$conditional['rgid']]); // Loop exit. break; } @@ -1039,6 +1042,7 @@ function webform_component_property($type, $property) { * returned list of options. * * @return array + * An array of options. */ function webform_component_list($node, $component_filter = NULL, $prepend_group = TRUE, $pagebreak_groups = FALSE) { $options = array(); diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.conditionals.inc b/profiles/openasu/modules/contrib/webform/includes/webform.conditionals.inc index 7433a98c1c..80c4051d8b 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.conditionals.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.conditionals.inc @@ -34,9 +34,9 @@ function webform_conditionals_form($form, &$form_state, $node) { // Drop PHP reference. unset($conditional); - // Check the current topological sort order for the conditionals and report any errors, - // but only for actual form submissions and not for ajax-related form builds, such as - // adding or removing a condition or conditional group. + // Check the current topological sort order for the conditionals and report + // any errors, but only for actual form submissions and not for ajax-related + // form builds, such as adding or removing a condition or conditional group. if (empty($form_state['triggering_element']['#ajax'])) { $node->webform['conditionals'] = $conditionals; webform_get_conditional_sorter($node)->reportErrors($conditionals); @@ -143,10 +143,11 @@ function webform_conditionals_form($form, &$form_state, $node) { '#submit' => array('webform_conditionals_form_submit'), ); - // Estimate if the form is too long for PHP max_input_vars and detect whether a previous submission was truncated. - // The estimate will be accurate because the form elements for this page are well known. Ajax use of this - // page will not generate user-visible errors, so a preflight may be the only indication to the user that - // the page is too long. + // Estimate if the form is too long for PHP max_input_vars and detect whether + // a previous submission was truncated. The estimate will be accurate because + // the form elements for this page are well known. Ajax use of this page will + // not generate user-visible errors, so a preflight may be the only indication + // to the user that the page is too long. webform_input_vars_check($form, $form_state, 'conditionals', ''); return $form; } @@ -221,7 +222,7 @@ function webform_conditionals_form_validate($form, &$form_state) { $component_type = $node->webform['components'][$action['target']['#value']]['type']; if (!webform_conditional_action_able($component_type, $action['action']['#value'])) { form_set_error('conditionals][' . $conditional_key . '][actions][' . $action_key . '][action', - t('A component of type %type can\'t be %action. (%target)', + t("A component of type %type can't be %action. (%target)", array( '%action' => $action['action']['#options'][$action['action']['#value']], '%type' => $component_options[$component_type], @@ -341,9 +342,11 @@ function theme_webform_conditional_group_row($variables) { * Form API #process function to expand a webform conditional element. */ function _webform_conditional_expand($element) { + $default_operator = 'and'; + $element['#tree'] = TRUE; $element['#default_value'] += array( - 'andor' => 'and', + 'andor' => $default_operator, ); $wrapper_id = drupal_clean_css_identifier(implode('-', $element['#parents'])) . '-ajax'; @@ -381,7 +384,7 @@ function _webform_conditional_expand($element) { 'remove' => _webform_conditional_remove_expand($element, $rid), ); $andor_stack[++$level] = array( - 'value' => $conditional['operator'], + 'value' => isset($conditional['operator']) ? $conditional['operator'] : $default_operator, 'parents' => array_merge($element['#parents'], array('rules', $rid, 'operator')), 'rid' => $rid, 'first' => TRUE, @@ -463,8 +466,7 @@ function _webform_conditional_add_expand($element, $rid, $subconditional) { '#value' => $subconditional ? t('(+)') : t('+'), '#submit' => array('webform_conditional_element_add'), '#subconditional' => $subconditional, - '#name' => implode('_', $element['#parents']) . '_rules_' . $rid . - ($subconditional ? '_add_subconditional' : '_add'), + '#name' => implode('_', $element['#parents']) . '_rules_' . $rid . ($subconditional ? '_add_subconditional' : '_add'), '#attributes' => array('class' => array('webform-conditional-rule-add')), '#ajax' => array( 'progress' => 'none', @@ -546,10 +548,10 @@ function _webform_conditional_action_expand($element, $aid, $action) { ), 'invert' => array( '#type' => 'select', - '#title' => t('Is/Isn\'t'), + '#title' => t("Is/Isn't"), '#options' => array( '0' => t('is'), - '1' => t('isn\'t'), + '1' => t("isn't"), ), '#default_value' => $action['invert'], ), @@ -618,11 +620,11 @@ function _webform_conditional_action_expand($element, $aid, $action) { * ); * @endcode * - forms[$form_key]: A string representing an HTML form for an operator. - * - forms[$form_key][$source]: Or instead of a single form for all components, - * if each component requires its own form, key each component by its source - * value (currently always the component ID). + * - forms[$form_key][$source]: Or instead of a single form for all + * components, if each component requires its own form, key each component + * by its source value (currently always the component ID). * - * @param $node + * @param object $node * The Webform node for which these forms are being generated. */ function _webform_conditional_expand_value_forms($node) { @@ -664,7 +666,7 @@ function _webform_conditional_expand_value_forms($node) { * The rid of the found rule, or -1 if none. Note that NULL is not used as a * semaphore for "not found" because it casts to 0, which is a valid rule id. */ -function _webform_conditional_find_end($rules, $origin_rid, $target_delta_level = 0) { +function _webform_conditional_find_end(array $rules, $origin_rid, $target_delta_level = 0) { $rids = array_keys($rules); $offset = array_search($origin_rid, $rids); $delta_level = 0; @@ -756,7 +758,7 @@ function webform_conditional_element_add($form, &$form_state) { ); if (empty($button['#subconditional'])) { - $new[0] = $parent_values[$rid]['source_type'] == 'component' ? $parent_values[$rid] : $default_rule; + $new[0] = (isset($parent_values[$rid]['source_type']) && $parent_values[$rid]['source_type'] == 'component') ? $parent_values[$rid] : $default_rule; } else { // The default andor operator is opposite of current subconditional's @@ -819,7 +821,7 @@ function webform_conditional_element_remove($form, &$form_state) { * @return array * Array of deleted subconditionals. Empty array if none were deleted. */ -function webform_delete_empty_subconditionals(&$conditional) { +function webform_delete_empty_subconditionals(array &$conditional) { $deleted = array(); do { $empty_deleted = FALSE; @@ -901,9 +903,9 @@ function theme_webform_conditional($variables) { default: // Hide labels. - $rule['source']['#title_display'] = 'none'; - $rule['operator']['#title_display'] = 'none'; - $rule['value']['#title_display'] = 'none'; + $rule['source']['#title_display'] = 'invisible'; + $rule['operator']['#title_display'] = 'invisible'; + $rule['value']['#title_display'] = 'invisible'; $source = '
      ' . drupal_render($rule['source']) . '
      '; $operator = '
      ' . drupal_render($rule['operator']) . '
      '; @@ -926,7 +928,7 @@ function theme_webform_conditional($variables) { $output .= '
    '; if (isset($rule['andor'])) { - $rule['andor']['#title_display'] = 'none'; + $rule['andor']['#title_display'] = 'invisible'; $output .= '
    '; $output .= drupal_render($rule['andor']); $output .= '
    '; @@ -946,10 +948,10 @@ function theme_webform_conditional($variables) { // Hide labels. foreach (element_children($element['actions']) as $aid) { // Hide labels. - $element['actions'][$aid]['target']['#title_display'] = 'none'; - $element['actions'][$aid]['invert']['#title_display'] = 'none'; - $element['actions'][$aid]['action']['#title_display'] = 'none'; - $element['actions'][$aid]['argument']['#title_display'] = 'none'; + $element['actions'][$aid]['target']['#title_display'] = 'invisible'; + $element['actions'][$aid]['invert']['#title_display'] = 'invisible'; + $element['actions'][$aid]['action']['#title_display'] = 'invisible'; + $element['actions'][$aid]['argument']['#title_display'] = 'invisible'; $target = '
    ' . drupal_render($element['actions'][$aid]['target']) . '
    '; $invert = '
    ' . drupal_render($element['actions'][$aid]['invert']) . '
    '; @@ -1273,7 +1275,7 @@ function webform_conditional_form_select($node) { webform_component_include('select'); foreach ($node->webform['components'] as $cid => $component) { if (webform_component_property($component['type'], 'conditional_type') == 'select') { - // TODO: Use a pluggable mechanism for retrieving select list values. + // @todo: Use a pluggable mechanism for retrieving select list values. $options = _webform_select_options($component); $element = array( '#type' => 'select', @@ -1299,7 +1301,7 @@ function webform_conditional_form_date($node) { static $count = 0; $element = array( '#title' => NULL, - '#title_display' => 'none', + '#title_display' => 'invisible', '#size' => 24, '#attributes' => array('placeholder' => t('@format or valid date', array('@format' => webform_date_format('short')))), '#type' => 'textfield', @@ -1315,7 +1317,7 @@ function webform_conditional_form_time($node) { static $count = 0; $element = array( '#title' => NULL, - '#title_display' => 'none', + '#title_display' => 'invisible', '#size' => 24, '#attributes' => array('placeholder' => t('HH:MMam or valid time')), '#type' => 'textfield', @@ -1399,7 +1401,7 @@ function webform_conditional_delete($node, $conditional) { * @return array * Array of settings to be send to the browser as javascript settings. */ -function webform_conditional_prepare_javascript($node, $submission_data, $page_num) { +function webform_conditional_prepare_javascript($node, array $submission_data, $page_num) { $settings = array( 'ruleGroups' => array(), 'sourceMap' => array(), @@ -1439,8 +1441,9 @@ function webform_conditional_prepare_javascript($node, $submission_data, $page_n $source_parents = webform_component_parent_keys($node, $source_component); $source_id = 'webform-component--' . str_replace('_', '-', implode('--', $source_parents)); - // If this source has a value set, add that as a setting. - // NULL or array(NULL) should be sent as an empty array to simplify the jQuery. + // If this source has a value set, add that as a setting. NULL or + // array(NULL) should be sent as an empty array to simplify the + // jQuery. if (isset($submission_data[$source_component['cid']])) { $source_value = $submission_data[$source_component['cid']]; $source_value = is_array($source_value) ? $source_value : array($source_value); @@ -1747,12 +1750,13 @@ function webform_conditional_value_datetime($input_values) { * @param array $options * Associative array where the $a and $b are within the keys. * - * @return integer based upon position of $a and $b in $options + * @return int|null + * Based upon position of $a and $b in $options: * -N if $a above (<) $b * 0 if $a = $b * +N if $a is below (>) $b */ -function webform_compare_select($a, $b, $options) { +function webform_compare_select($a, $b, array $options) { // Select keys that are integer-like strings are numeric indices in PHP. // Convert the array keys to an array of strings. $options_array = array_map(function ($i) { @@ -1760,6 +1764,5 @@ function webform_compare_select($a, $b, $options) { }, array_keys($options)); $a_position = array_search($a, $options_array, TRUE); $b_position = array_search($b, $options_array, TRUE); - return ($a_position === FALSE || $a_position === FALSE) ? NULL : $a_position - $b_position; - + return ($a_position === FALSE || $b_position === FALSE) ? NULL : $a_position - $b_position; } diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.emails.inc b/profiles/openasu/modules/contrib/webform/includes/webform.emails.inc index fb10f4270c..5b8d56a023 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.emails.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.emails.inc @@ -102,7 +102,7 @@ function webform_emails_form($form, $form_state, $node) { * * @throws Exception */ -function theme_webform_emails_form($variables) { +function theme_webform_emails_form(array $variables) { $form = $variables['form']; $node = $form['#node']; @@ -233,13 +233,13 @@ function webform_email_edit_form($form, $form_state, $node, $email = array(), $c case 'from_address': $default_value = webform_replace_tokens(webform_variable_get('webform_default_from_address'), $node); $title = t('E-mail from address'); - $description = t('Any email, select, or hidden form element may be selected as the sender\'s e-mail address.'); + $description = t("Any email, select, or hidden form element may be selected as the sender's e-mail address."); break; case 'from_name': $default_value = webform_replace_tokens(webform_variable_get('webform_default_from_name'), $node); $title = t('E-mail from name'); - $description = t('Any textfield, select, or hidden form element may be selected as the sender\'s name for e-mails.'); + $description = t("Any textfield, select, or hidden form element may be selected as the sender's name for e-mails."); break; } @@ -392,7 +392,7 @@ function webform_email_edit_form($form, $form_state, $node, $email = array(), $c '#default_value' => $email['exclude_empty'], ); - // TODO: Allow easy re-use of existing templates. + // @todo: Allow easy re-use of existing templates. $form['templates']['#tree'] = TRUE; $form['templates']['default'] = array( '#type' => 'textarea', @@ -575,7 +575,7 @@ function webform_email_edit_form_submit($form, &$form_state) { $form_state['values']['templates']['default'] = str_replace(array("\r", "\n"), array('', "\n"), $form_state['values']['templates']['default']); // Set the template value. - // TODO: Support reuse of templates. + // @todo: Support reuse of templates. if (strcmp(trim($form_state['values']['templates']['default']), trim($form_state['values']['template'])) == 0) { $email['template'] = 'default'; } @@ -701,7 +701,7 @@ function webform_email_load($eid, $nid) { * The e-mail identifier for this row's settings on success else false. */ function webform_email_insert($email) { - // TODO: This is not race-condition safe. Switch to using transactions? + // @todo: This is not race-condition safe. Switch to using transactions? if (!isset($email['eid'])) { $next_id_query = db_select('webform_emails')->condition('nid', $email['nid']); $next_id_query->addExpression('MAX(eid) + 1', 'eid'); @@ -740,8 +740,8 @@ function webform_email_clone($email) { * other fields from the e-mail form. * * @return false|int - * On success SAVED_NEW or SAVED_UPDATED, depending on the operation performed, - * false on failure. + * On success SAVED_NEW or SAVED_UPDATED, depending on the operation + * performed, FALSE on failure. */ function webform_email_update($email) { $email['excluded_components'] = implode(',', $email['excluded_components']); diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.export.inc b/profiles/openasu/modules/contrib/webform/includes/webform.export.inc index e326113ba7..5a1f615522 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.export.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.export.inc @@ -7,12 +7,6 @@ /** * Implements hook_webform_exporters(). - * - * Defines the exporters this module implements. - * - * @return array - * An "array of arrays", keyed by content-types. The 'handler' slot - * should point to the PHP class implementing this flag. */ function webform_webform_exporters() { $exporters = array( @@ -108,7 +102,7 @@ function webform_export_create_handler($format, $options) { $handler = new $definition['handler']($options); } else { - // TODO: Create a default broken exporter. + // @todo: Create a default broken exporter. $handler = new webform_exporter_broken($options); } diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.report.inc b/profiles/openasu/modules/contrib/webform/includes/webform.report.inc index 3918aeeabf..cd121efe6d 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.report.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.report.inc @@ -113,7 +113,7 @@ function webform_results_submissions($node, $user_filter, $pager_count) { * @param object $node * Loaded webform node. * @param string $view_id - * machine_id of the view, such as webform_results or webform_submissions. + * The machine_id of the view, such as webform_results or webform_submissions. * * @return object|null * The loaded view. @@ -138,7 +138,7 @@ function webform_get_view($node, $view_id) { * @return string * Pager. */ -function theme_webform_results_per_page($variables) { +function theme_webform_results_per_page(array $variables) { $total_count = $variables['total_count']; $pager_count = $variables['pager_count']; $output = ''; @@ -251,7 +251,7 @@ function webform_results_table($node, $pager_count = 0) { } /** - * + * Theme function for the Webform results table header. */ function theme_webform_results_table_header($variables) { return array( @@ -338,7 +338,7 @@ function theme_webform_results_table($variables) { * @param $batch_size * The number of submissions to be processed. NULL means all submissions. * - * @return + * @return int * The number of submissions processed. */ function webform_results_clear($nid, $batch_size = NULL) { @@ -369,7 +369,7 @@ function webform_results_clear_form($form, $form_state, $node) { } /** - * + * Form submit handler. */ function webform_results_clear_form_submit($form, &$form_state) { $nid = $form_state['values']['nid']; @@ -686,7 +686,8 @@ function webform_results_download_range_validate($element, $form_state) { case 'range_date': // Download Start-end range of submissions. // Start submission time. - $start_date = strtotime($element['start_date']['#value']); + $format = webform_date_format('short'); + $start_date = DateTime::createFromFormat($format, $element['start_date']['#value']); if ($element['start_date']['#value'] == '') { form_error($element['start_date'], t('Start date range is required.')); } @@ -694,13 +695,13 @@ function webform_results_download_range_validate($element, $form_state) { form_error($element['start_date'], t('Start date range is not in a valid format.')); } // End submission time. - $end_date = strtotime($element['end_date']['#value']); + $end_date = DateTime::createFromFormat($format, $element['end_date']['#value']); if ($element['end_date']['#value'] != '') { if ($end_date === FALSE) { form_error($element['end_date'], t('End date range is not in a valid format.')); } elseif ($start_date !== FALSE && $start_date > $end_date) { - form_error($element['end_date'], t('End date range must not be before the Start date..')); + form_error($element['end_date'], t('End date range must not be before the Start date.')); } } break; @@ -898,7 +899,11 @@ function webform_export_batch_size($node) { * Returns a temporary export filename. */ function _webform_export_tempname() { - return drupal_tempnam(variable_get('webform_export_path', 'temporary://'), 'webform_'); + $webform_export_path = variable_get('webform_export_path', 'temporary://'); + + // If the directory does not exist, create it. + file_prepare_directory($webform_export_path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + return drupal_tempnam($webform_export_path, 'webform_'); } /** @@ -992,7 +997,7 @@ function webform_results_export($node, $format = 'delimited', $options = array() * @return array * A Batch API array suitable to pass to batch_set(). */ -function webform_results_export_batch($node, $format = 'delimited', $options = array()) { +function webform_results_export_batch($node, $format = 'delimited', array $options = array()) { $defaults = webform_results_download_default_options($node, $format); $options += $defaults; $options['range'] += $defaults['range']; @@ -1023,7 +1028,7 @@ function webform_results_export_batch($node, $format = 'delimited', $options = a * A list of options that define the output format. These are generally passed * through from the GUI interface. */ -function webform_results_download_headers($node, $options) { +function webform_results_download_headers($node, array $options) { module_load_include('inc', 'webform', 'includes/webform.components'); $submission_information = webform_results_download_submission_information($node, $options); @@ -1070,8 +1075,6 @@ function webform_results_download_headers($node, $options) { /** * Returns rows of downloadable webform data. * - * @deprecated This function is scheduled to be removed in webform 7.x-5.x. - * * @param $node * The webform node on which to generate the analysis. * @param array $options @@ -1086,8 +1089,10 @@ function webform_results_download_headers($node, $options) { * An array of rows built according to the provided $serial_start and * $pager_count variables. Note that the current page number is determined * by the super-global $_GET['page'] variable. + * + * @deprecated This function is scheduled to be removed in webform 7.x-5.x. */ -function webform_results_download_rows($node, $options, $serial_start = 0, &$last_sid = NULL) { +function webform_results_download_rows($node, array $options, $serial_start = 0, &$last_sid = NULL) { // Get all the required submissions for the download. $filters['nid'] = $node->nid; if (isset($options['sids'])) { @@ -1126,7 +1131,7 @@ function webform_results_download_rows($node, $options, $serial_start = 0, &$las * $pager_count variables. Note that the current page number is determined * by the super-global $_GET['page'] variable. */ -function webform_results_download_rows_process($node, $options, $serial_start, $submissions) { +function webform_results_download_rows_process($node, array $options, $serial_start, array $submissions) { module_load_include('inc', 'webform', 'includes/webform.components'); $submission_information = webform_results_download_submission_information($node, $options); @@ -1279,9 +1284,6 @@ function webform_webform_results_download_submission_information_data($token, $s * The webform node on which to generate the analysis. * @param string $format * The export format being used. - * @param array $options - * A list of options that define the output format. These are generally passed - * through from the GUI interface. * * @return array * Option for creating downloadable version of the webform data. @@ -1406,7 +1408,7 @@ function webform_results_download_callback($node) { /** * Batch API callback; Write the opening byte in the export file. */ -function webform_results_batch_bof($node, $format = 'delimited', $options = array(), &$context) { +function webform_results_batch_bof($node, $format = 'delimited', $options = array(), &$context = NULL) { module_load_include('inc', 'webform', 'includes/webform.export'); $exporter = webform_export_create_handler($format, $options); @@ -1421,7 +1423,7 @@ function webform_results_batch_bof($node, $format = 'delimited', $options = arra /** * Batch API callback; Write the headers of the export to the export file. */ -function webform_results_batch_headers($node, $format = 'delimited', $options = array(), &$context) { +function webform_results_batch_headers($node, $format = 'delimited', $options = array(), &$context = NULL) { module_load_include('inc', 'webform', 'includes/webform.export'); $exporter = webform_export_create_handler($format, $options); @@ -1448,7 +1450,7 @@ function webform_results_batch_headers($node, $format = 'delimited', $options = /** * Batch API callback; Write the rows of the export to the export file. */ -function webform_results_batch_rows($node, $format = 'delimited', $options = array(), &$context) { +function webform_results_batch_rows($node, $format = 'delimited', $options = array(), &$context = NULL) { module_load_include('inc', 'webform', 'includes/webform.export'); // Initialize the sandbox if this is the first execution of the batch @@ -1508,7 +1510,7 @@ function webform_results_batch_rows($node, $format = 'delimited', $options = arr /** * Batch API callback; Write the closing bytes in the export file. */ -function webform_results_batch_eof($node, $format = 'delimited', $options = array(), &$context) { +function webform_results_batch_eof($node, $format = 'delimited', $options = array(), &$context = NULL) { module_load_include('inc', 'webform', 'includes/webform.export'); $exporter = webform_export_create_handler($format, $options); @@ -1529,7 +1531,7 @@ function webform_results_batch_eof($node, $format = 'delimited', $options = arra /** * Batch API callback; Do any last processing on the finished export. */ -function webform_results_batch_post_process($node, $format = 'delimited', $options = array(), &$context) { +function webform_results_batch_post_process($node, $format = 'delimited', $options = array(), &$context = NULL) { module_load_include('inc', 'webform', 'includes/webform.export'); $context['results']['node'] = $node; @@ -1558,10 +1560,10 @@ function webform_results_batch_results($node, $format, $options, &$context) { ); if (isset($_SESSION)) { - // UI exection. Defer resetting last-downloaded sid until download page. - // Set a session variable containing the information referencing the exported - // file. A cookie is also set to allow the browser to ensure the redirect - // to the file only happens one time. + // UI exection. Defer resetting last-downloaded sid until download page. Set + // a session variable containing the information referencing the exported + // file. A cookie is also set to allow the browser to ensure the redirect to + // the file only happens one time. $_SESSION['webform_export_info'] = $export_info; $params = session_get_cookie_params(); setcookie('webform_export_info', '1', REQUEST_TIME + 120, $params['path'], $params['domain'], $params['secure'], FALSE); @@ -1715,6 +1717,7 @@ function template_preprocess_webform_analysis_component(&$variables) { * array of values * * @return string + * The rendered table. */ function theme_webform_analysis_component_basic($variables) { $data = $variables['data']; @@ -1915,8 +1918,9 @@ function webform_download_sids_count($nid, $range_options, $uid = NULL) { * the submissions. * * @return QueryAlterableInterface + * The query object. */ -function webform_download_sids_query($nid, $range_options, $uid = NULL) { +function webform_download_sids_query($nid, array $range_options, $uid = NULL) { $query = db_select('webform_submissions', 'ws') ->condition('nid', $nid) ->addTag('webform_download_sids'); @@ -1962,15 +1966,16 @@ function webform_download_sids_query($nid, $range_options, $uid = NULL) { case 'range_date': $date_field = $range_options['completion_type'] == 'finished' ? 'ws.completed' : 'ws.submitted'; - $query->condition($date_field, strtotime($range_options['start_date']), '>='); - if ($range_options['end_date'] != '' && ($end_time = strtotime($range_options['end_date'])) !== FALSE) { - if ($end_time == strtotime('midnight', $end_time)) { - // Full day specified - // 86400 is a full day of seconds. - $end_time += 86399; - } - $query->condition($date_field, $end_time, '<='); - }; + $format = webform_date_format('short'); + $start_date = DateTime::createFromFormat($format, $range_options['start_date']); + $start_date->setTime(0, 0, 0); + $query->condition($date_field, $start_date->getTimestamp(), '>='); + $end_time = DateTime::createFromFormat($format, $range_options['end_date']); + if ($range_options['end_date'] != '' && ($end_time !== FALSE)) { + // Check for the full day's submissions. + $end_time->setTime(23, 59, 59); + $query->condition($date_field, $end_time->getTimestamp(), '<='); + } $query->orderBy($date_field, 'ASC'); break; } @@ -2000,7 +2005,7 @@ function webform_download_sids_query($nid, $range_options, $uid = NULL) { * @param $uid * The user account ID for which to retrieve download information. * - * @return + * @return array|false * An array of download information or FALSE if this user has never downloaded * results for this particular node. */ @@ -2030,11 +2035,11 @@ function webform_download_last_download_info($nid, $uid = NULL) { * @param string $completion_type * The completion type, either "finished", "draft", or "all". * - * @return + * @return int * The submission ID that starts the latest sequence of submissions. */ function webform_download_latest_start_sid($nid, $latest_count, $completion_type = 'all') { - // TODO: Find a more efficient DBTNG query to retrieve this number. + // @todo: Find a more efficient DBTNG query to retrieve this number. $query = db_select('webform_submissions', 'ws') ->fields('ws', array('sid')) ->condition('nid', $nid) diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.submissions.inc b/profiles/openasu/modules/contrib/webform/includes/webform.submissions.inc index 048a6aabdf..22a06399f7 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.submissions.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.submissions.inc @@ -2,6 +2,8 @@ /** * @file + * Submission handling functions. + * * This file is loaded when handling submissions, either submitting new, * editing, or viewing. It also contains all CRUD functions for submissions. * @@ -54,7 +56,7 @@ function webform_submission_data($node, $submitted) { * @return object * A new submission object, possibly for preview */ -function webform_submission_create($node, $account, $form_state, $is_preview = FALSE, $prototype = NULL) { +function webform_submission_create($node, $account, array $form_state, $is_preview = FALSE, $prototype = NULL) { $data = webform_submission_data($node, $form_state['values']['submitted']); if (is_object($prototype)) { $submission = clone $prototype; @@ -89,7 +91,7 @@ function webform_submission_create($node, $account, $form_state, $is_preview = F * @param $submission * The webform submission object to be saved into the database. * - * @return + * @return int * The existing submission SID. */ function webform_submission_update($node, $submission) { @@ -139,7 +141,7 @@ function webform_submission_update($node, $submission) { * @param $submission * The webform submission object to be saved into the database. * - * @return + * @return int * The new submission SID. */ function webform_submission_insert($node, $submission) { @@ -231,171 +233,199 @@ function webform_submission_delete($node, $submission) { * Number of mail sent. */ function webform_submission_send_mail($node, $submission, $emails = NULL) { - global $user; - // Get the list of e-mails we'll be sending. $emails = isset($emails) ? $emails : $node->webform['emails']; // Create a themed message for mailing. $send_count = 0; foreach ($emails as $eid => $email) { - // Continue with next email recipients array if disabled for current. - if (!$email['status']) { + $mail = _webform_submission_prepare_mail($node, $submission, $email); + if (!$mail) { continue; } - // Set the HTML property based on availablity of MIME Mail. - $email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable')); + $addresses_final = $mail['addresses_final']; + $send_increment = $mail['send_increment']; + $language = $mail['language']; + $mail_params = $mail['mail_params']; - // Pass through the theme layer if using the default template. - if ($email['template'] == 'default') { - $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), array('node' => $node, 'submission' => $submission, 'email' => $email)); - } - else { - $email['message'] = $email['template']; + // Mail the webform results. + foreach ($addresses_final as $address) { + $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']); + if ($message['result']) { + $send_count += $send_increment; + } } + } - // Replace tokens in the message. - $email['message'] = webform_replace_tokens($email['message'], $node, $submission, $email, (boolean) $email['html']); + return $send_count; +} - // Build the e-mail headers. - $email['headers'] = theme(array('webform_mail_headers_' . $node->nid, 'webform_mail_headers'), array('node' => $node, 'submission' => $submission, 'email' => $email)); +/** + * Prepare a submission email for use by webform_submission_send_mail() + * + * @param $node + * The node object containing the current webform. + * @param $submission + * The webform submission object to be used in sending e-mails. + * @param $email + * The e-mail settings to be used. This will have some of its values adjusted. + * + * @return array|null + * An array of the information about the email needed by drupal_mail(). + */ +function _webform_submission_prepare_mail($node, $submission, &$email) { + global $user; - // Assemble the From string. - if (isset($email['headers']['From'])) { - // If a header From is already set, don't override it. - $email['from'] = $email['headers']['From']; - unset($email['headers']['From']); - } - else { - // Format the From address. - $mapping = isset($email['extra']['from_address_mapping']) ? $email['extra']['from_address_mapping'] : NULL; - $email['from'] = webform_format_email_address($email['from_address'], $email['from_name'], $node, $submission, TRUE, TRUE, NULL, $mapping); - } + // Don't process disabled emails. + if (!$email['status']) { + return; + } - // If requested and not already set, set Reply-To to the From and re-format From address. - if (webform_variable_get('webform_email_replyto') && - empty($email['headers']['Reply-To']) && - ($default_from_name = webform_variable_get('webform_default_from_name')) && - ($default_from_address = webform_variable_get('webform_default_from_address')) && - ($default_from_parts = explode('@', $default_from_address)) && - count($default_from_parts) == 2 && - $default_from_parts[1] && - stripos($email['from'], '@' . $default_from_parts[1]) === FALSE) { - // Message is not already being sent from the domain of the default - // webform from address. - $email['headers']['Reply-To'] = $email['from']; - $email['from'] = $default_from_address; - if (webform_variable_get('webform_email_address_format') == 'long') { - $email_parts = webform_parse_email_address($email['headers']['Reply-To']); - $from_name = t('!name via !site_name', - array( - '!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'], - '!site_name' => $default_from_name, - )); - $from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name))); - $email['from'] = '"' . $from_name . '" <' . $email['from'] . '>'; - } - } + // Set the HTML property based on availablity of MIME Mail. + $email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable')); - // Update the subject if set in the themed headers. - if (isset($email['headers']['Subject'])) { - $email['subject'] = $email['headers']['Subject']; - unset($email['headers']['Subject']); - } - else { - $email['subject'] = webform_format_email_subject($email['subject'], $node, $submission); - } + // Pass through the theme layer if using the default template. + if ($email['template'] == 'default') { + $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), array('node' => $node, 'submission' => $submission, 'email' => $email)); + } + else { + $email['message'] = $email['template']; + } - // Update the to e-mail if set in the themed headers. - if (isset($email['headers']['To'])) { - $email['email'] = $email['headers']['To']; - unset($email['headers']['To']); - $addresses = array_filter(explode(',', $email['email'])); - } - else { - // Format the To address(es). - $mapping = isset($email['extra']['email_mapping']) ? $email['extra']['email_mapping'] : NULL; - $addresses = webform_format_email_address($email['email'], NULL, $node, $submission, TRUE, FALSE, NULL, $mapping); - $email['email'] = implode(',', $addresses); - } + // Replace tokens in the message. + $email['message'] = webform_replace_tokens($email['message'], $node, $submission, $email, (boolean) $email['html']); - // Generate the list of addresses that this e-mail will be sent to. - $addresses_final = array_filter($addresses, 'webform_valid_email_address'); + // Build the e-mail headers. + $email['headers'] = theme(array('webform_mail_headers_' . $node->nid, 'webform_mail_headers'), array('node' => $node, 'submission' => $submission, 'email' => $email)); - if (!$addresses_final) { - continue; - } + // Assemble the From string. + if (isset($email['headers']['From'])) { + // If a header From is already set, don't override it. + $email['from'] = $email['headers']['From']; + unset($email['headers']['From']); + } + else { + // Format the From address. + $mapping = isset($email['extra']['from_address_mapping']) ? $email['extra']['from_address_mapping'] : NULL; + $email['from'] = webform_format_email_address($email['from_address'], $email['from_name'], $node, $submission, TRUE, TRUE, NULL, $mapping); + } - // Verify that this submission is not attempting to send any spam hacks. - foreach ($addresses_final as $address) { - if (_webform_submission_spam_check($address, $email['subject'], $email['from'], $email['headers'])) { - watchdog('webform', 'Possible spam attempt from @remote !message', - array('@remote' => ip_address(), '!message' => "
    \n" . nl2br(htmlentities($email['message'])))); - drupal_set_message(t('Illegal information. Data not submitted.'), 'error'); - return FALSE; - } + // If "Use Reply-To header" is set in Webform settings and the Reply-To + // header is not already set, set Reply-To to the From and set From address + // to webform_default_from_name and webform_default_from_address. + if (webform_variable_get('webform_email_replyto') && + empty($email['headers']['Reply-To']) && + ($default_from_name = webform_variable_get('webform_default_from_name')) && + ($default_from_address = webform_variable_get('webform_default_from_address')) && + $email['from'] !== $default_from_name) { + $email['headers']['Reply-To'] = $email['from']; + $email['from'] = $default_from_address; + if (webform_variable_get('webform_email_address_format') == 'long') { + $email_parts = webform_parse_email_address($email['headers']['Reply-To']); + $from_name = t('!name via !site_name', + array( + '!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'], + '!site_name' => $default_from_name, + )); + $from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name))); + $email['from'] = '"' . $from_name . '" <' . $email['from'] . '>'; } + } + + // Update the subject if set in the themed headers. + if (isset($email['headers']['Subject'])) { + $email['subject'] = $email['headers']['Subject']; + unset($email['headers']['Subject']); + } + else { + $email['subject'] = webform_format_email_subject($email['subject'], $node, $submission); + } + + // Update the to e-mail if set in the themed headers. + if (isset($email['headers']['To'])) { + $email['email'] = $email['headers']['To']; + unset($email['headers']['To']); + $addresses = array_filter(explode(',', $email['email'])); + } + else { + // Format the To address(es). + $mapping = isset($email['extra']['email_mapping']) ? $email['extra']['email_mapping'] : NULL; + $addresses = webform_format_email_address($email['email'], NULL, $node, $submission, TRUE, FALSE, NULL, $mapping); + $email['email'] = implode(',', $addresses); + } + + // Generate the list of addresses that this e-mail will be sent to. + $addresses_final = array_filter($addresses, 'webform_valid_email_address'); + + if (!$addresses_final) { + return; + } - // Consolidate addressees into one message if permitted by configuration. - $send_increment = 1; - if (!webform_variable_get('webform_email_address_individual')) { - $send_increment = count($addresses_final); - $addresses_final = array(implode(', ', $addresses_final)); + // Verify that this submission is not attempting to send any spam hacks. + foreach ($addresses_final as $address) { + if (_webform_submission_spam_check($address, $email['subject'], $email['from'], $email['headers'])) { + watchdog('webform', 'Possible spam attempt from @remote !message', + array('@remote' => ip_address(), '!message' => "
    \n" . nl2br(htmlentities($email['message'])))); + drupal_set_message(t('Illegal information. Data not submitted.'), 'error'); + return; } + } - // Mail the webform results. - foreach ($addresses_final as $address) { + // Consolidate addressees into one message if permitted by configuration. + $send_increment = 1; + if (!webform_variable_get('webform_email_address_individual')) { + $send_increment = count($addresses_final); + $addresses_final = array(implode(', ', $addresses_final)); + } - $language = $user->uid ? user_preferred_language($user) : language_default(); - $mail_params = array( - 'message' => $email['message'], - 'subject' => $email['subject'], - 'headers' => $email['headers'], - 'node' => $node, - 'submission' => $submission, - 'email' => $email, - ); + // Prepare the variables used by drupal_mail(). + $language = $user->uid ? user_preferred_language($user) : language_default(); + $mail_params = array( + 'message' => $email['message'], + 'subject' => $email['subject'], + 'headers' => $email['headers'], + 'node' => $node, + 'submission' => $submission, + 'email' => $email, + ); - if (webform_variable_get('webform_email_html_capable')) { - // Load attachments for the e-mail. - $attachments = array(); - if ($email['attachments']) { - webform_component_include('file'); - foreach ($node->webform['components'] as $component) { - if (webform_component_feature($component['type'], 'attachment') && !empty($submission->data[$component['cid']][0])) { - if (webform_component_implements($component['type'], 'attachments')) { - $files = webform_component_invoke($component['type'], 'attachments', $component, $submission->data[$component['cid']]); - if ($files) { - $attachments = array_merge($attachments, $files); - } - } + if (webform_variable_get('webform_email_html_capable')) { + // Load attachments for the e-mail. + $attachments = array(); + if ($email['attachments']) { + webform_component_include('file'); + foreach ($node->webform['components'] as $component) { + if (webform_component_feature($component['type'], 'attachment') && !empty($submission->data[$component['cid']][0])) { + if (webform_component_implements($component['type'], 'attachments')) { + $files = webform_component_invoke($component['type'], 'attachments', $component, $submission->data[$component['cid']]); + if ($files) { + $attachments = array_merge($attachments, $files); } } } - - // Add the attachments to the mail parameters. - $mail_params['attachments'] = $attachments; - - // Set all other properties for HTML e-mail handling. - $mail_params['plain'] = !$email['html']; - $mail_params['plaintext'] = $email['html'] ? NULL : $email['message']; - $mail_params['headers'] = $email['headers']; - if ($email['html']) { - // MIME Mail requires this header or it will filter all text. - $mail_params['headers']['Content-Type'] = 'text/html; charset=UTF-8'; - } } + } - // Mail the submission. - $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']); - if ($message['result']) { - $send_count += $send_increment; - } + // Add the attachments to the mail parameters. + $mail_params['attachments'] = $attachments; + + // Set all other properties for HTML e-mail handling. + $mail_params['plain'] = !$email['html']; + $mail_params['plaintext'] = $email['html'] ? NULL : $email['message']; + $mail_params['headers'] = $email['headers']; + if ($email['html']) { + // MIME Mail requires this header or it will filter all text. + $mail_params['headers']['Content-Type'] = 'text/html; charset=UTF-8'; } } - return $send_count; + return array( + 'addresses_final' => $addresses_final, + 'send_increment' => $send_increment, + 'language' => $language, + 'mail_params' => $mail_params, + ); } /** @@ -417,7 +447,6 @@ function webform_submission_delete_form($form, $form_state, $node, $submission) drupal_set_title(webform_submission_title($node, $submission)); // Keep the NID and SID in the same location as the webform_client_form(). - // This helps mollom identify the same fields when deleting a submission. $form['#tree'] = TRUE; $form['details']['nid'] = array( '#type' => 'value', @@ -434,7 +463,7 @@ function webform_submission_delete_form($form, $form_state, $node, $submission) } /** - * + * Form submit handler. */ function webform_submission_delete_form_submit($form, &$form_state) { $node = node_load($form_state['values']['details']['nid']); @@ -609,7 +638,7 @@ function webform_submission_resend_submit($form, &$form_state) { * * @throws Exception */ -function theme_webform_submission_resend($variables) { +function theme_webform_submission_resend(array $variables) { $form = $variables['form']; $header = array(t('Send'), t('E-mail to'), t('Subject')); @@ -724,6 +753,7 @@ function webform_get_submissions($filters = array(), $header = NULL, $pager_coun * Optional. The number of submissions to include in the results. * * @return QueryExtendableInterface|SelectQueryInterface + * The query object. */ function webform_get_submissions_query($filters = array(), $header = NULL, $pager_count = 0) { if (!is_array($filters)) { @@ -902,8 +932,8 @@ function webform_get_submissions_load($pager_query) { * Optional; NULL for all, truthy for drafts only, falsy for completed only. * The default is completed submissions only. * - * @return - * An integer value of the number of submissions. + * @return int + * The number of submissions. */ function webform_get_submission_count($nid, $uid = NULL, $is_draft = 0) { $counts = &drupal_static(__FUNCTION__); @@ -951,7 +981,7 @@ function webform_get_submission($nid, $sid) { } /** - * + * Verify that an email is not attempting to send any spam. */ function _webform_submission_spam_check($to, $subject, $from, $headers = array()) { $headers = implode('\n', (array) $headers); diff --git a/profiles/openasu/modules/contrib/webform/includes/webform.webformconditionals.inc b/profiles/openasu/modules/contrib/webform/includes/webform.webformconditionals.inc index ed8f02698c..39db0695e8 100644 --- a/profiles/openasu/modules/contrib/webform/includes/webform.webformconditionals.inc +++ b/profiles/openasu/modules/contrib/webform/includes/webform.webformconditionals.inc @@ -152,7 +152,7 @@ class WebformConditionals { )); } elseif ($source_component['page_num'] == $page_num && $component['type'] == 'pagebreak') { - $errors[$page_num][] = t('The page break %to can\'t be controlled by %from on the same page.', + $errors[$page_num][] = t("The page break %to can't be controlled by %from on the same page.", array( '%from' => $source_component['name'], '%to' => $component['name'], @@ -208,7 +208,7 @@ class WebformConditionals { $nodes[$id]['out'] = array(); } - // Check for a cyclic graph (circular dependency) + // Check for a cyclic graph (circular dependency). foreach ($nodes as $id => $n) { if ($n['in'] || $n['out']) { $errors[$page_num][] = t('A circular reference involving %name was found.', @@ -216,9 +216,9 @@ class WebformConditionals { } } - } // End finishing previous page + } // End finishing previous page. - } // End component loop + } // End component loop. // Create an empty page map for the preview page. $page_map[$page_num + 1] = array(); @@ -313,8 +313,9 @@ class WebformConditionals { protected $resultStack; /** - * Initializes an execution stack for a conditional group's rules and - * sub-conditional rules. + * Initializes an execution stack for a conditional group's rules. + * + * Also initializes sub-conditional rules. */ public function executionStackInitialize($andor) { $this->stackPointer = -1; @@ -355,8 +356,9 @@ class WebformConditionals { } /** - * Executes the conditionals on a submission, removing any data which should - * be hidden. + * Executes the conditionals on a submission. + * + * This removes any data which should be hidden. */ public function executeConditionals($input_values, $page_num = 0) { $this->getOrder(); @@ -435,11 +437,11 @@ class WebformConditionals { // in webform.conditionals.inc. switch ($conditional_type) { case 'numeric': - module_load_include('inc', 'webform', 'components/number'); + webform_component_include('number'); break; case 'select': - module_load_include('inc', 'webform', 'components/select'); + webform_component_include($conditional_type); break; } @@ -510,6 +512,8 @@ class WebformConditionals { } /** + * Returns the required status for a component. + * * Returns whether a given component is always hidden, always shown, or might * be shown depending upon other sources on the same page. * @@ -533,10 +537,11 @@ class WebformConditionals { } /** - * Returns whether a given page should be displayed. This requires any - * conditional for the page itself to be shown, plus at least one component - * within the page must be shown too. The first and preview pages are always - * shown, however. + * Returns whether a given page should be displayed. + * + * This requires any conditional for the page itself to be shown, plus at + * least one component within the page must be shown too. The first and + * preview pages are always shown, however. * * @param int $page_num * The page number that the component is on. @@ -561,6 +566,8 @@ class WebformConditionals { } /** + * Returns the required status for a component. + * * Returns whether a given component is always required, always optional, or * unchanged by conditional logic. * diff --git a/profiles/openasu/modules/contrib/webform/js/webform.js b/profiles/openasu/modules/contrib/webform/js/webform.js index adcd01863a..bbcfdb6f8d 100644 --- a/profiles/openasu/modules/contrib/webform/js/webform.js +++ b/profiles/openasu/modules/contrib/webform/js/webform.js @@ -76,8 +76,8 @@ // Make sure that the default year fits in the available options. year = (year < startYear || year > endYear) ? startYear : year; - // jQuery UI Datepicker will read the input field and base its date off - // of that, even though in our case the input field is a button. + // jQuery UI Datepicker will read the input field and base its date + // off of that, even though in our case the input field is a button. $(input).val(year + '-' + month + '-' + day); } }); @@ -129,8 +129,9 @@ var resultStack; /** - * Initializes an execution stack for a conditional group's rules and - * sub-conditional rules. + * Initializes an execution stack for a conditional group's rules. + * + * Also initializes sub-conditional rules. */ function executionStackInitialize(andor) { stackPointer = -1; @@ -172,9 +173,15 @@ : filteredResults.length === $conditionalResults.length; } - // Track what has be set/shown for each target component. - var targetLocked = []; - + // Track what has been set/hidden for each target component's elements. + // Hidden elements must be disabled because if they are required and don't + // have a value, they will prevent submission due to html5 validation. + // Each execution of the conditionals adds a temporary class + // webform-disabled-flag so that elements hidden or set can be disabled and + // also be prevented from being re-enabled by another conditional (such as a + // parent fieldset). After processing conditionals, this temporary class + // must be removed in preparation for the next execution of the + // conditionals. $.each(settings.ruleGroups, function (rgid_key, rule_group) { var ruleGroup = settings.ruleGroups[rgid_key]; @@ -205,26 +212,26 @@ var actionResult = action['invert'] ? !conditionalResult : conditionalResult; switch (action['action']) { case 'show': - if (actionResult != Drupal.webform.isVisible($target)) { - var $targetElements = actionResult - ? $target.find('.webform-conditional-disabled').removeClass('webform-conditional-disabled') - : $target.find(':input').addClass('webform-conditional-disabled'); - $targetElements.webformProp('disabled', !actionResult); - $target.toggleClass('webform-conditional-hidden', !actionResult); - // Anything hidden needs to be disabled so that child elements of - // fieldsets do not block submission by being required. - $target.webformProp('disabled', !actionResult); - if (actionResult) { - $target.show(); - } - else { - $target.hide(); - // Record that the target was hidden. - targetLocked[action['target']] = 'hide'; - } - if ($target.is('tr')) { - Drupal.webform.restripeTable($target.closest('table').first()); - } + var changed = actionResult != Drupal.webform.isVisible($target); + if (actionResult) { + $target.find('.webform-conditional-disabled:not(.webform-disabled-flag)') + .removeClass('webform-conditional-disabled') + .webformProp('disabled', false); + $target + .removeClass('webform-conditional-hidden') + .show(); + $form.find('.chosen-disabled').prev().trigger('chosen:updated.chosen'); + } + else { + $target + .hide() + .addClass('webform-conditional-hidden') + .find(':input') + .addClass('webform-conditional-disabled webform-disabled-flag') + .webformProp('disabled', true); + } + if (changed && $target.is('tr')) { + Drupal.webform.restripeTable($target.closest('table').first()); } break; @@ -232,7 +239,8 @@ var $requiredSpan = $target.find('.form-required, .form-optional').first(); if (actionResult != $requiredSpan.hasClass('form-required')) { var $targetInputElements = $target.find("input:text,textarea,input[type='email'],select,input:radio,input:file"); - // Rather than hide the required tag, remove it so that other jQuery can respond via Drupal behaviors. + // Rather than hide the required tag, remove it so that other + // jQuery can respond via Drupal behaviors. Drupal.detachBehaviors($requiredSpan); $targetInputElements .webformProp('required', actionResult) @@ -248,20 +256,30 @@ break; case 'set': - var isLocked = targetLocked[action['target']]; var $texts = $target.find("input:text,textarea,input[type='email']"); var $selects = $target.find('select,select option,input:radio,input:checkbox'); var $markups = $target.filter('.webform-component-markup'); if (actionResult) { var multiple = $.map(action['argument'].split(','), $.trim); - $selects.webformVal(multiple); - $texts.val([action['argument']]); - // A special case is made for markup. It is sanitized with filter_xss_admin on the server. - // otherwise text() should be used to avoid an XSS vulnerability. text() however would - // preclude the use of tags like or . + $selects + .webformVal(multiple) + .webformProp('disabled', true) + .addClass('webform-disabled-flag'); + $texts + .val([action['argument']]) + .webformProp('readonly', true) + .addClass('webform-disabled-flag'); + // A special case is made for markup. It is sanitized with + // filter_xss_admin on the server. otherwise text() should be used + // to avoid an XSS vulnerability. text() however would preclude + // the use of tags like or . $markups.html(action['argument']); } else { + $selects.not('.webform-disabled-flag') + .webformProp('disabled', false); + $texts.not('.webform-disabled-flag') + .webformProp('readonly', false); // Markup not set? Then restore original markup as provided in // the attribute data-webform-markup. $markups.each(function () { @@ -272,21 +290,18 @@ } }); } - if (!isLocked) { - // If not previously hidden or set, disable the element readonly or readonly-like behavior. - $selects.webformProp('disabled', actionResult); - $texts.webformProp('readonly', actionResult); - targetLocked[action['target']] = actionResult ? 'set' : false; - } break; } - }); // End look on each action for one conditional + }); // End look on each action for one conditional. }); // End loop on each conditional. + + $form.find('.webform-disabled-flag').removeClass('webform-disabled-flag'); }; /** - * Event handler to prevent propagation of events, typically click for disabling - * radio and checkboxes. + * Event handler to prevent propagation of events. + * + * Typically click for disabling radio and checkboxes. */ Drupal.webform.stopEvent = function () { return false; @@ -524,8 +539,10 @@ }; /** - * Utility to return current visibility. Uses actual visibility, except for - * hidden components which use the applied disabled class. + * Utility to return current visibility. + * + * Uses actual visibility, except for hidden components which use the applied + * disabled class. */ Drupal.webform.isVisible = function ($element) { return $element.hasClass('webform-component-hidden') @@ -534,7 +551,7 @@ }; /** - * Utility function to get a string value from a select/radios/text/etc. field. + * Function to get a string value from a select/radios/text/etc. field. */ Drupal.webform.stringValue = function (element, existingValue) { var value = []; @@ -557,8 +574,8 @@ } } } - // Simple text fields. This check is done last so that the select list in - // select-or-other fields comes before the "other" text field. + // Simple text fields. This check is done last so that the select list + // in select-or-other fields comes before the "other" text field. if (!value.length) { $element.find('input:not([type=checkbox],[type=radio]),textarea').each(function () { value.push(this.value); @@ -666,8 +683,9 @@ }; /** - * Make a multi-valued val() function for setting checkboxes, radios, and select - * elements. + * Make a multi-valued val() function. + * + * This is for setting checkboxes, radios, and select elements. */ $.fn.webformVal = function (values) { this.each(function () { diff --git a/profiles/openasu/modules/contrib/webform/templates/webform-mail.tpl.php b/profiles/openasu/modules/contrib/webform/templates/webform-mail.tpl.php index c171e6c6db..216b732008 100644 --- a/profiles/openasu/modules/contrib/webform/templates/webform-mail.tpl.php +++ b/profiles/openasu/modules/contrib/webform/templates/webform-mail.tpl.php @@ -17,8 +17,8 @@ * - $ip_address: The IP address of the user submitting the form or '(unknown)' * for confidential submissions. * - * The $email['email'] variable can be used to send different e-mails to different users - * when using the "default" e-mail template. + * The $email['email'] variable can be used to send different e-mails to + * different users when using the "default" e-mail template. */ ?> ' : '') . t('Submitted on [submission:date:long]') . ($email['html'] ? '

    ' : ''); ?> diff --git a/profiles/openasu/modules/contrib/webform/templates/webform-results-submissions.tpl.php b/profiles/openasu/modules/contrib/webform/templates/webform-results-submissions.tpl.php index 8ceb907af9..32218e50f9 100644 --- a/profiles/openasu/modules/contrib/webform/templates/webform-results-submissions.tpl.php +++ b/profiles/openasu/modules/contrib/webform/templates/webform-results-submissions.tpl.php @@ -13,7 +13,8 @@ * - $table: The table[] array consists of three keys: * - $table['#header']: Table header. * - $table['#rows']: Table rows. - * - $table['#operation_total']: Maximum number of operations in the operation column. + * - $table['#operation_total']: Maximum number of operations in the operation + * column. */ ?> diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformComponentsTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformComponentsTestCase.test index f353fa647d..1fb855473d 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformComponentsTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformComponentsTestCase.test @@ -1,13 +1,8 @@ webformForm(); $this->drupalGet('node/' . $node->nid); + // Check th elements have the scope attribute. + $this->assertRaw('', 'Grid th elements have @scope of "col".'); + // Check that each label @for points to an element. $labels = $this->xpath('//label/@for'); foreach ($labels as $label) { diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformConditionalsTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformConditionalsTestCase.test index 452da165f6..a43313db85 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformConditionalsTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformConditionalsTestCase.test @@ -1,13 +1,8 @@ drupalLogout(); + + // Test that the whole conditional is deleted when all source components are + // deleted. Inital setup: Two components. One source (c1) one target (c2). + $node = (object) array( + 'type' => 'webform', + 'title' => 'Conditional test', + ); + $default = array( + 'type' => 'textfield', + 'pid' => 0, + ); + webform_component_defaults($default); + node_object_prepare($node); + $node->webform['components'][1] = array( + 'cid' => 1, + 'form_key' => 'c1', + ) + $default; + $node->webform['components'][2] = array( + 'cid' => 2, + 'form_key' => 'c2', + ) + $default; + $node->webform['conditionals'][0] = array( + 'rgid' => 0, + 'andor' => NULL, + 'weight' => -1, + 'rules' => array(array( + 'source_type' => 'component', + 'source' => 1, + 'operator' => 'not_empty', + ), + ), + 'actions' => array(array( + 'target_type' => 'component', + 'target' => 2, + 'action' => 'show', + ), + ), + ); + node_save($node); + + // Delete the source. + unset($node->webform['components'][1]); + node_save($node); + + $this->assertEqual(array(), $node->webform['conditionals'], 'The whole conditional is deleted when all source components are deleted.'); } /** @@ -54,6 +94,7 @@ class WebformConditionalsTestCase extends WebformTestCase { * @param $component * The sample component that should be tested as the source of a conditional * operator. + * @param $input_values * @param $operator * The operator that will be used to check the source component, such as * "equal" or "starts_with". See _webform_conditional_operator_info(). @@ -67,9 +108,6 @@ class WebformConditionalsTestCase extends WebformTestCase { * If FALSE, validation errors are expected to be triggered. The input * $value will be compared against the "sample values" input provided by * webformComponents(). - * - * @return void - * This function executes its own assert statements to show results. */ private function webformTestConditionalComponent($component, $input_values, $operator, $conditional_values, $should_match) { // Create the Webform test node and add a same-page conditional followed diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformGeneralTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformGeneralTestCase.test index 6052ef5bcf..1092ed02cd 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformGeneralTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformGeneralTestCase.test @@ -1,13 +1,8 @@ $nid))->fetchField(); diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformPermissionsTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformPermissionsTestCase.test index 0f268b7317..4f960b88a9 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformPermissionsTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformPermissionsTestCase.test @@ -1,13 +1,8 @@ drupalGet('node/' . $node->nid); - // Note: Should be: You must
    login or register to view this form. - // Something in SimpleTest isn't handling the string correctly. + // Note: Should be: You must login or + // register to view this form. Something in + // SimpleTest isn't handling the string correctly. $this->assertText('to view this form.', t('Anonymous user is not allowed to submit form.'), t('Webform')); } diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformSubmissionTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformSubmissionTestCase.test index 193141011d..c972a968ba 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformSubmissionTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformSubmissionTestCase.test @@ -1,13 +1,8 @@ drupalPost('node/' . $node->nid, array(), 'Submit', array(), array(), 'webform-client-form-' . $node->nid); foreach ($node->webform['components'] as $component) { if ($component['type'] != 'hidden' && $component['type'] != 'date') { @@ -124,7 +119,7 @@ class WebformSubmissionTestCase extends WebformTestCase { /** * Execute the submission test. * - * @param $value_type + * @param string $value_type * The values to be submitted to the webform. Either "sample" or "default". */ public function webformSubmissionExecute($value_type = 'sample') { @@ -168,9 +163,6 @@ class WebformSubmissionTestCase extends WebformTestCase { /** * Execute a validation check for a single component. - * - * @param $value_type - * The values to be submitted to the webform. Either "sample" or "default". */ public function webformSubmissionValidateExecute() { $path = drupal_get_path('module', 'webform'); @@ -191,7 +183,8 @@ class WebformSubmissionTestCase extends WebformTestCase { // Submit our test data. $this->drupalPost('node/' . $node->nid, $submission_values, 'Submit', array(), array(), 'webform-client-form-' . $node->nid); - // Confirm that the validation error occurred and the submission did not save. + // Confirm that the validation error occurred and the submission did + // not save. $this->assertRaw($error_message, t('Validation message properly thrown: "%message".', array('%message' => $error_message)), t('Webform')); $this->assertFalse(preg_match('/sid=([0-9]+)/', $this->getUrl()), t('Submission not saved.')); diff --git a/profiles/openasu/modules/contrib/webform/tests/WebformTestCase.test b/profiles/openasu/modules/contrib/webform/tests/WebformTestCase.test index afb10deb07..d045129ed5 100644 --- a/profiles/openasu/modules/contrib/webform/tests/WebformTestCase.test +++ b/profiles/openasu/modules/contrib/webform/tests/WebformTestCase.test @@ -1,13 +1,8 @@ _webform_node = NULL; @@ -118,7 +113,8 @@ class WebformTestCase extends DrupalWebTestCase { * - A default configuration for the component. * - Values to try setting via POST * - Values that should match the database storage when set via POST - * - Values that should match the database storage when using the default values. + * - Values that should match the database storage when using the default + * values. * * @return array * An array of each component settings. @@ -999,7 +995,7 @@ class WebformTestCase extends DrupalWebTestCase { } /** - * + * Create a sample Webform node. */ public function webformForm() { if (isset($this->_webform_node)) { diff --git a/profiles/openasu/modules/contrib/webform/views/webform.views.inc b/profiles/openasu/modules/contrib/webform/views/webform.views.inc index f51e998915..31d79ab9c0 100644 --- a/profiles/openasu/modules/contrib/webform/views/webform.views.inc +++ b/profiles/openasu/modules/contrib/webform/views/webform.views.inc @@ -6,7 +6,7 @@ */ /** - * + * Implements hook_views_data(). */ function webform_views_data() { // Webform table definitions. @@ -527,8 +527,6 @@ function webform_views_plugins() { ), ), ); - - return $plugins; } /** @@ -544,8 +542,8 @@ function webform_views_pre_view($view, $display_id, $args) { ($node = node_load($args[0])) && isset($node->webform['components'])) { // This is a view/display that needs its fields expanded. It contains the // webform_all_fields field, has a nid argument to the webform_submission - // table that is a valid node. - // Retrieve the display's fields and remove any fields after the 'webform_all_fields' field. + // table that is a valid node. Retrieve the display's fields and remove any + // fields after the 'webform_all_fields' field. $fields = $view->get_items('field', $display_id); $prototype = $fields[$all_fields_id]; $field_index = array_flip(array_keys($fields)); diff --git a/profiles/openasu/modules/contrib/webform/views/webform_handler_area_result_pager.inc b/profiles/openasu/modules/contrib/webform/views/webform_handler_area_result_pager.inc index 729eb88681..afbc2ba028 100644 --- a/profiles/openasu/modules/contrib/webform/views/webform_handler_area_result_pager.inc +++ b/profiles/openasu/modules/contrib/webform/views/webform_handler_area_result_pager.inc @@ -1,11 +1,8 @@ type, webform_node_types()) || !webform_results_access($node)) { return; } diff --git a/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_count.inc b/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_count.inc index 12cb6d456f..743279c461 100644 --- a/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_count.inc +++ b/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_count.inc @@ -1,17 +1,14 @@ webform['components'][$cid]; $submission = $this->view->_webform_submissions[$nid][$sid]; if ($submission->nid != $nid) { - // The actual submission is from a different webform than the one used to define the view. - // Rather than using the component with the same cid, try to match the form_key. + // The actual submission is from a different webform than the one used + // to define the view. Rather than using the component with the same + // cid, try to match the form_key. if (!isset($this->view->_webform_components[$nid][$submission->nid][$cid])) { if (!isset($this->view->_webform_components[$nid][$submission->nid]['webform'])) { $this->view->_webform_components[$nid][$submission->nid]['webform'] = $webform; @@ -213,8 +211,9 @@ class webform_handler_field_submission_data extends views_handler_field { } $webform = $this->view->_webform_components[$nid][$submission->nid]['webform']; $component = $this->view->_webform_components[$nid][$submission->nid][$cid]; - // Note: $nid and $cid refer to the definition webform, not the submission webform - // whereas $component refers to the submission component. + // Note: $nid and $cid refer to the definition webform, not the + // submission webform whereas $component refers to the submission + // component. } if ($this->options['format'] == 'html') { @@ -225,7 +224,8 @@ class webform_handler_field_submission_data extends views_handler_field { $render['#theme_wrappers'] = array(); } else { - // Plain text format is generated via invoking the table output to ensure output is sanitised. + // Plain text format is generated via invoking the table output to + // ensure output is sanitised. $data = isset($submission->data[$component['cid']]) ? $submission->data[$component['cid']] : NULL; $render = webform_component_invoke($component['type'], 'table', $component, $data); } diff --git a/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_link.inc b/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_link.inc index 6b93402f07..9e13c7484d 100644 --- a/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_link.inc +++ b/profiles/openasu/modules/contrib/webform/views/webform_handler_field_submission_link.inc @@ -1,18 +1,15 @@ NULL); $options['webform_cid'] = array('default' => NULL); + $options['webform_form_key'] = array('default' => NULL); + $options['webform_join_by'] = array('default' => 'nid_cid'); return $options; } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -32,10 +29,23 @@ class webform_handler_relationship_submission_data extends views_handler_relatio // Helper function provides webform_nid and webform_cid options. _webform_views_options_form($form, $form_state, $nid, $cid); + + $form['webform_join_by'] = array( + '#type' => 'select', + '#title' => t('Relate using'), + '#default_value' => $this->options['webform_join_by'], + '#options' => array( + 'nid_cid' => t('Node and Component ID'), + 'cid' => t('Component ID'), + 'form_key' => t('Component Form Key'), + ), + '#description' => t('Choose Node and Component ID when this view will display data from only this webform.
    Choose Component ID when this view will display data from other webforms and where the Component ID is identical.
    Choose Component Form Key when this view will display data from other webforms with varying Component IDs.'), + ); + } /** - * + * {@inheritdoc} */ public function options_validate(&$form, &$form_state) { parent::options_validate($form, $form_state); @@ -43,11 +53,17 @@ class webform_handler_relationship_submission_data extends views_handler_relatio } /** - * + * {@inheritdoc} */ public function options_submit(&$form, &$form_state) { parent::options_submit($form, $form_state); _webform_views_options_submit($form, $form_state); + $options =& $form_state['values']['options']; + $options['webform_form_key'] = $options['webform_join_by_form_key'] == 'form_key' && ($node = node_load($options['webform_nid'])) + ? $node->webform['components'][$options['webform_cid']]['form_key'] + : NULL; + // Drop PHP reference. + unset($options); } /** @@ -56,16 +72,67 @@ class webform_handler_relationship_submission_data extends views_handler_relatio * It respects the given component ids, provided via options form. */ public function query() { - $this->definition['extra'][] = array( - 'table' => NULL, - 'field' => "%alias.nid", - 'value' => $this->options['webform_nid'], - ); - $this->definition['extra'][] = array( - 'table' => NULL, - 'field' => "%alias.cid", - 'value' => $this->options['webform_cid'], - ); + // When defining extra clauses, the 'table' key can be used to specify the + // alias of another table. If NULL is specified, then the field is not + // qualified with a table. Therefore, do NOT specify "'table' => NULL". + switch ($this->options['webform_join_by']) { + case 'form_key': + $form_key = $this->options['webform_form_key']; + $join_type = $this->options['required'] ? 'INNER' : 'LEFT'; + + $this->ensure_my_table(); + $join = new views_join(); + + $join->construct( + // The table to be joined. + 'webform_component', + // The left table (i.e. this table, webform_submission). + $this->table, + // The left field (i.e. the webform node id). + 'nid', + // The field (i.e. webform_components.nid). + 'nid', + // Extra array of additional conditions. + array( + array( + // Extra join of form_key. + 'field' => 'form_key', + // ... = $form_key (operator '=' is default) + 'value' => $form_key, + ), + ), + // Join type is the same as this relationship's join type. + $join_type); + + $alias = $this->query->add_relationship( + // Requested alias for new reliationship. + 'webform_component_' . $form_key, + // Addition join to be added to this relatinship. + $join, + // Base table (i.e. drivingevals_submission) + $this->table_alias, + // Add the view to this relationship. + $this->relationship); + + // The actual alias for this relationship's join is not known yet. Becasue + // of name conflicts, it may have a number appended to the end. %alias is + // substitued when the query is build with the actual alias name. + $this->definition['extra'][] = "%alias.cid = {$alias}.cid"; + break; + + case 'nid_cid': + $this->definition['extra'][] = array( + 'field' => "nid", + 'value' => $this->options['webform_nid'], + ); + // FALL THROUGH. + case 'cid': + $this->definition['extra'][] = array( + 'field' => "cid", + 'value' => $this->options['webform_cid'], + ); + break; + } // The rest of building the join is performed by the parent. parent::query(); diff --git a/profiles/openasu/modules/contrib/webform/views/webform_plugin_row_submission_view.inc b/profiles/openasu/modules/contrib/webform/views/webform_plugin_row_submission_view.inc index 300e2a65df..74c697ecc7 100644 --- a/profiles/openasu/modules/contrib/webform/views/webform_plugin_row_submission_view.inc +++ b/profiles/openasu/modules/contrib/webform/views/webform_plugin_row_submission_view.inc @@ -1,11 +1,8 @@ $row_data) { @@ -446,6 +446,7 @@ function hook_webform_csv_data_alter(&$data, $component, $submission) { * - conditional * - spam_analysis * - group + * - private * * Note that most of these features do not indicate the default state, but * determine if the component can have this property at all. Setting @@ -532,7 +533,7 @@ function hook_webform_component_info() { // (like a fieldset or tabs). Defaults to FALSE. 'group' => FALSE, - // If this component can be used for SPAM analysis, usually with Mollom. + // If this component can be used for SPAM analysis. 'spam_analysis' => FALSE, // If this component saves a file that can be used as an e-mail @@ -542,6 +543,12 @@ function hook_webform_component_info() { // If this component reflects a time range and should use labels such as // "Before" and "After" when exposed as filters in Views module. 'views_range' => FALSE, + + // Set this to FALSE if this component cannot be used as a private + // component. If this is not FALSE, in your implementation of + // _webform_defaults_COMPONENT(), set ['extra']['private'] property to + // TRUE or FALSE. + 'private' => FALSE, ), // Specify the conditional behaviour of this component. @@ -626,19 +633,14 @@ function hook_webform_submission_access($node, $submission, $op = 'view', $accou case 'view': return TRUE; - break; case 'edit': return FALSE; - break; case 'delete': return TRUE; - break; case 'list': return TRUE; - - break; } } @@ -650,8 +652,6 @@ function hook_webform_submission_access($node, $submission, $op = 'view', $accou * Access via this hook is in addition (adds permission) to the standard * webform access. * - * @see webform_results_access() - * * @param $node * The Webform node to check access on. * @param $account @@ -659,6 +659,8 @@ function hook_webform_submission_access($node, $submission, $op = 'view', $accou * * @return bool * TRUE or FALSE if the user can access the webform results. + * + * @see webform_results_access() */ function hook_webform_results_access($node, $account) { // Let editors view results of unpublished webforms. @@ -676,8 +678,6 @@ function hook_webform_results_access($node, $account) { * Access via this hook is in addition (adds permission) to the standard * webform access (delete all webform submissions). * - * @see webform_results_clear_access() - * * @param object $node * The Webform node to check access on. * @param object $account @@ -685,12 +685,16 @@ function hook_webform_results_access($node, $account) { * * @return bool * TRUE or FALSE if the user can access the webform results. + * + * @see webform_results_clear_access() */ function hook_webform_results_clear_access($node, $account) { return user_access('my additional access', $account); } /** + * Overrides the node_access and user_access permissions. + * * Overrides the node_access and user_access permission to access and edit * webform components, e-mails, conditions, and form settings. * @@ -705,8 +709,6 @@ function hook_webform_results_clear_access($node, $account) { * access as this will be the only test. For example, 'return TRUE;' would grant * annonymous access to creating webform components, which seldom be desired. * - * @see webform_node_update_access() - * * @param object $node * The Webform node to check access on. * @param object $account @@ -716,6 +718,8 @@ function hook_webform_results_clear_access($node, $account) { * TRUE or FALSE if the user can access the webform results, or NULL if * access should be deferred to other implementations of this hook or * node_access('update') plus user_access('edit webform components'). + * + * @see webform_node_update_access() */ function hook_webform_update_access($node, $account) { // Allow anyone who can see webform_editable_by_user nodes and who has @@ -762,11 +766,12 @@ function _webform_attachments_component($component, $value) { * Alter default settings for a newly created webform node. * * @param array $defaults - * Default settings for a newly created webform node as defined by webform_node_defaults(). + * Default settings for a newly created webform node as defined by + * webform_node_defaults(). * * @see webform_node_defaults() */ -function hook_webform_node_defaults_alter(&$defaults) { +function hook_webform_node_defaults_alter(array &$defaults) { $defaults['allow_draft'] = '1'; } @@ -863,17 +868,19 @@ function _webform_defaults_component() { * every component type and are not necessary to specify here (although they * may be overridden if desired). * - * @param $component + * @param array $component * A Webform component array. + * @param array $form + * The form array. + * @param array $form_state + * The form state array. * * @return array * An array of form items to be displayed on the edit component page */ -function _webform_edit_component($component) { - $form = array(); - +function _webform_edit_component(array $component, array &$form, array &$form_state) { // Disabling the description if not wanted. - $form['description'] = array(); + $form['description']['#access'] = FALSE; // Most options are stored in the "extra" array, which stores any settings // unique to a particular component type. @@ -933,7 +940,7 @@ function _webform_render_component($component, $value = NULL, $filter = TRUE, $s } /** - * Allow modules to modify a webform component that is going to be rendered in a form. + * Allow modules to modify a webform component that will be rendered in a form. * * @param array $element * The display element as returned by _webform_render_component(). @@ -942,7 +949,7 @@ function _webform_render_component($component, $value = NULL, $filter = TRUE, $s * * @see _webform_render_component() */ -function hook_webform_component_render_alter(&$element, &$component) { +function hook_webform_component_render_alter(array &$element, array &$component) { if ($component['cid'] == 10) { $element['#title'] = 'My custom title'; $element['#default_value'] = 42; @@ -1003,7 +1010,7 @@ function _webform_display_component($component, $value, $format = 'html', $submi * * @see _webform_display_component() */ -function hook_webform_component_display_alter(&$element, &$component) { +function hook_webform_component_display_alter(array &$element, array &$component) { if ($component['cid'] == 10) { $element['#title'] = 'My custom title'; $element['#default_value'] = 42; @@ -1026,7 +1033,7 @@ function hook_webform_component_display_alter(&$element, &$component) { * @param string $value * The value to be set, as defined in the conditional action. */ -function _webform_action_set_component($component, &$element, &$form_state, $value) { +function _webform_action_set_component(array $component, array &$element, array &$form_state, $value) { $element['#value'] = $value; form_set_value($element, $value, $form_state); } @@ -1048,7 +1055,7 @@ function _webform_action_set_component($component, &$element, &$form_state, $val * @param $value * The POST data associated with the user input. * - * @return + * @return array * An array of values to be saved into the database. Note that this should be * a numerically keyed array. */ @@ -1312,8 +1319,7 @@ function _webform_csv_data_component($component, $export_options, $value) { } /** - * Adjusts the view field(s) that are automatically generated for number - * components. + * Fix the view field(s) that are automatically generated for number components. * * Provides each component the opportunity to adjust how this component is * displayed in a view as a field in a view table. For example, a component may @@ -1329,7 +1335,7 @@ function _webform_csv_data_component($component, $export_options, $value) { * @return array * The modified $fields array. */ -function _webform_view_field_component($component, $fields) { +function _webform_view_field_component(array $component, array $fields) { foreach ($fields as &$field) { $field['webform_datatype'] = 'number'; } @@ -1356,7 +1362,7 @@ function _webform_view_field_component($component, $fields) { * @param array $args * The arguments that were passed to the view. */ -function hook_webform_view_alter($view, $display_id, $args) { +function hook_webform_view_alter($view, $display_id, array $args) { // Don't show component with cid == 4. $fields = $view->get_items('field', $display_id); foreach ($fields as $id => $field) { @@ -1373,7 +1379,7 @@ function hook_webform_view_alter($view, $display_id, $args) { * @param array &$systems * An array of mail system class names. */ -function hook_webform_html_capable_mail_systems_alter(&$systems) { +function hook_webform_html_capable_mail_systems_alter(array &$systems) { if (module_exists('my_module')) { $systems[] = 'MyModuleMailSystem'; } @@ -1407,11 +1413,115 @@ function hook_webform_exporters() { * @param array &$exporters * A list of all available webform exporters. */ -function hook_webform_exporters_alter(&$exporters) { +function hook_webform_exporters_alter(array &$exporters) { $exporters['excel']['handler'] = 'customized_excel_exporter'; $exporters['excel']['file'] = drupal_get_path('module', 'yourmodule') . '/includes/customized_excel_exporter.inc'; } +/** + * Declare conditional types and their operators. + * + * Each conditional type defined here may then be referenced in + * hook_webform_component_info(). For each type this hook also declares a set of + * operators that may be applied to a component of this conditional type in + * conditionals. + * + * @return array + * A 2-dimensional array of operator configurations. The configurations are + * keyed first by their conditional type then by operator key. Each operator + * declaration is an array with the following keys: + * - label: Translated label for this operator that is shown in the UI. + * - comparison callback: A callback for server-side evaluation. + * - js comparison callback: A JavaScript callback for client-side evaluation. + * The callback will be looked for in the Drupal.webform object. + * - form callback (optional): A form callback that allows configuring + * additional parameters for this operator. Default: + * 'webform_conditional_operator_text'. + * + * @see hook_webform_component_info() + * @see callback_webform_conditional_comparision_operator() + * @see callback_webform_conditional_rule_value_form() + */ +function hook_webform_conditional_operator_info() { + $operators = array(); + $operators['string']['not_equal'] = array( + 'label' => t('is not'), + 'comparison callback' => 'webform_conditional_operator_string_not_equal', + 'js comparison callback' => 'conditionalOperatorStringNotEqual', + ); + return $operators; +} + +/** + * Alter the list of operators and conditional types. + * + * @param array $operators + * A data structure as described in hook_webform_conditional_operator_info(). + * + * @see hook_webform_conditional_operator_info() + */ +function hook_webform_conditional_operators_alter(array &$operators) { + $operators['string']['not_equal']['label'] = t('not equal'); +} + +/** + * Evaluate the operator for a given set of values. + * + * This function will be called two times with potentially different kinds of + * values: Once in _webform_client_form_validate() before any of the validate + * handlers or the _webform_submit_COMPONENT() callback is called, and once in + * webform_client_form_pages() after those handlers have been called. + * + * @param array $input_values + * The values received from the browser. + * @param mixed $rule_value + * The value as configured in the form callback. + * @param array $component + * The component for which we are evaluating the operator. + * + * @return bool + * The operation result. + */ +function callback_webfom_conditional_comparison_operator(array $input_values, $rule_value, array $component) { + foreach ($input_values as $value) { + if (strcasecmp($value, $rule_value)) { + return TRUE; + } + } + return FALSE; +} + +/** + * Define a form element that configures your operator. + * + * @param object $node + * The node for which the conditionals are being configured. + * + * @return string|string[] + * Either a single rendered form element or a rendered form element per + * component (keyed by cid). Make sure that none of the rendered strings + * contains any HTML IDs as the form element will be rendered multiple times. + * The JavaScript will take care of adding the appropriate name attributes. + * + * @see _webform_conditional_expand_value_forms() + */ +function callback_webform_conditional_rule_value_form($node) { + $forms = []; + foreach ($node->webform['components'] as $cid => $component) { + if (webform_component_property($component['type'], 'conditional_type') == 'newsletter') { + $element = [ + '#type' => 'select', + '#options' => [ + 'yes' => t('Opt-in'), + 'no' => t('No opt-in'), + ], + ]; + $forms[$cid] = drupal_render($element); + } + } + return $forms; +} + /** * @} */ diff --git a/profiles/openasu/modules/contrib/webform/webform.drush.inc b/profiles/openasu/modules/contrib/webform/webform.drush.inc index 493a1af517..8b550677fd 100644 --- a/profiles/openasu/modules/contrib/webform/webform.drush.inc +++ b/profiles/openasu/modules/contrib/webform/webform.drush.inc @@ -46,14 +46,17 @@ function webform_drush_command() { } /** - * Exports a webform via drush, useful for large data dumps that would otherwise - * time out due to memory consumption. + * Exports a webform via drush. + * + * This is useful for large data dumps that would otherwise time out due to + * memory consumption. * * @param bool|int $nid * Node ID of the webform that we want to export. * - * @return - * The value returned from drush_set_error(). + * @return false|null + * The value returned from drush_set_error() or NULL if that function is not + * called. */ function drush_webform_export($nid = FALSE) { if (!$nid) { @@ -165,8 +168,10 @@ function drush_webform_export($nid = FALSE) { } /** - * Clears a webform via drush, useful for webforms with many submissions that - * would otherwise fail due to time out due or memory consumption. + * Clears a webform via drush. + * + * This is useful for webforms with many submissions that would otherwise fail + * due to time out due or memory consumption. * * @param int $nid * Node ID of the webform to clear. diff --git a/profiles/openasu/modules/contrib/webform/webform.info b/profiles/openasu/modules/contrib/webform/webform.info index 1bebcfd1b8..e3e9549f22 100644 --- a/profiles/openasu/modules/contrib/webform/webform.info +++ b/profiles/openasu/modules/contrib/webform/webform.info @@ -31,7 +31,6 @@ files[] = views/webform_handler_filter_webform_status.inc files[] = views/webform_handler_numeric_data.inc files[] = views/webform_handler_relationship_submission_data.inc files[] = views/webform_plugin_row_submission_view.inc -files[] = views/webform.views.inc files[] = tests/WebformComponentsTestCase.test files[] = tests/WebformConditionalsTestCase.test @@ -40,9 +39,8 @@ files[] = tests/WebformPermissionsTestCase.test files[] = tests/WebformSubmissionTestCase.test files[] = tests/WebformTestCase.test -; Information added by Drupal.org packaging script on 2017-10-06 -version = "7.x-4.16" +; Information added by Drupal.org packaging script on 2019-01-07 +version = "7.x-4.19" core = "7.x" project = "webform" -datestamp = "1507320560" - +datestamp = "1546876989" diff --git a/profiles/openasu/modules/contrib/webform/webform.install b/profiles/openasu/modules/contrib/webform/webform.install index f881909252..0fbd7043a3 100644 --- a/profiles/openasu/modules/contrib/webform/webform.install +++ b/profiles/openasu/modules/contrib/webform/webform.install @@ -828,9 +828,9 @@ function webform_uninstall() { file_unmanaged_delete_recursive($filepath); // Delete the content type "webform" if: - // a) there are no existing nodes of type webform and - // b) no additional fields have been defined for node type webform, beyond - // the default body field. + // 1. there are no existing nodes of type webform and + // 2. no additional fields have been defined for node type webform, beyond the + // default body field. $query = new EntityFieldQuery(); $results = $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'webform') @@ -861,6 +861,12 @@ function webform_update_dependencies() { $dependencies['webform'][7320] = array( 'system' => 7059, ); + if (module_exists('rules')) { + // Ensure rules tables and fields exist before trying to use it. + $dependencies['webform'][7420] = array( + 'rules' => 7213, + ); + } return $dependencies; } @@ -1658,8 +1664,9 @@ function webform_update_7403(&$sandbox) { } /** - * Remove files left over from deleted submissions. Such files are now deleted - * automatically. + * Remove files left over from deleted submissions. + * + * Such files are now deleted automatically. */ function webform_update_7404() { module_load_include('inc', 'webform', 'components/file'); @@ -2044,8 +2051,9 @@ function webform_update_7417() { } /** - * Upgrade the "extra" column in the e-mail table to be consistent with a new - * webform installation. + * Upgrade the "extra" column in the e-mail table. + * + * Make the column consistent with a new webform installation. * * In version 7.x-4.0-rc6 and earlier, the extra field was added with 'not null' * FALSE, cause the schema module to report in mismatch. While functionally this @@ -2351,3 +2359,23 @@ function webform_update_7430() { return t('Webform emails may now be disabled.'); } + +/** + * Preserve progress bar as not active for one-page webforms. + */ +function webform_update_7431() { + // Get a list of all Webforms containing a pagebreak. + $multipage_webform_nids = db_select('webform_component'); + $multipage_webform_nids->distinct(); + $multipage_webform_nids->addField('webform_component', 'nid'); + $multipage_webform_nids->condition('type', 'pagebreak'); + + // Remove confirmation page from the progress bar for single-page Webforms. + $updated_count = db_update('webform') + ->fields(array('progressbar_include_confirmation' => 0)) + ->condition('preview', 0) + ->condition('nid', $multipage_webform_nids, 'NOT IN') + ->execute(); + + return t("Disabled progress bar for @count single-page webforms.", array('@count' => $updated_count)); +} diff --git a/profiles/openasu/modules/contrib/webform/webform.module b/profiles/openasu/modules/contrib/webform/webform.module index bb33f85582..07869996be 100644 --- a/profiles/openasu/modules/contrib/webform/webform.module +++ b/profiles/openasu/modules/contrib/webform/webform.module @@ -454,8 +454,9 @@ function webform_menu_load($nid) { } /** - * Menu LOADERNAME_to_arg callback. Determines the arguments used to generate a - * menu link. + * Menu LOADERNAME_to_arg callback. + * + * Determines the arguments used to generate a menu link. * * This is implemented only to give the webform_localization modules an * opportunity to link to the orignial webform from the localized one. See @@ -472,7 +473,7 @@ function webform_menu_load($nid) { * @return string * The $arg, modified as desired. */ -function webform_menu_to_arg($arg, $map, $index) { +function webform_menu_to_arg($arg, array $map, $index) { return function_exists('webform_localization_webform_menu_to_arg') ? webform_localization_webform_menu_to_arg($arg, $map, $index) : $arg; @@ -617,7 +618,7 @@ function webform_confirmation_page_access($node) { * The webform submission object. * @param object $op * The operation to perform. Must be one of view, edit, delete, list. - * @param array $account + * @param object $account * Optional. A user object or NULL to use the currently logged-in user. * * @return bool @@ -635,7 +636,7 @@ function webform_submission_access($node, $submission, $op = 'view', $account = // If access is granted via a token, then allow subsequent submission access // for anonymous users. - if (!$user->uid && $token_access) { + if (!$account->uid && $token_access) { $_SESSION['webform_submission'][$submission->sid] = $node->nid; } @@ -654,13 +655,27 @@ function webform_submission_access($node, $submission, $op = 'view', $account = return $module_access || $general_access; case 'edit': - return $module_access || ($general_access && (user_access('edit all webform submissions', $account) || (user_access('edit own webform submissions', $account) && $account->uid == $submission->uid))); - case 'delete': - return $module_access || ($general_access && (user_access('delete all webform submissions', $account) || (user_access('delete own webform submissions', $account) && $account->uid == $submission->uid))); + return $module_access || ( + $general_access && ( + user_access($op . ' all webform submissions', $account) || ( + user_access($op . ' own webform submissions', $account) && + $account->uid == $submission->uid + ) + ) + ); case 'list': - return $module_access || user_access('access all webform results', $account) || (user_access('access own webform submissions', $account) && ($account->uid || isset($_SESSION['webform_submission']))) || (user_access('access own webform results', $account) && $account->uid == $node->uid); + return $module_access || + user_access('access all webform results', $account) || ( + user_access('access own webform submissions', $account) && ( + $account->uid || + isset($_SESSION['webform_submission']) + ) + ) || ( + user_access('access own webform results', $account) && + $account->uid == $node->uid + ); } } @@ -677,8 +692,9 @@ function webform_results_access($node, $account = NULL) { } /** - * Menu access callback. Ensure a user has both results access and permission - * to clear submissions. + * Menu access callback. + * + * Ensure a user has both results access and permission to clear submissions. */ function webform_results_clear_access($node, $account = NULL) { global $user; @@ -693,7 +709,8 @@ function webform_results_clear_access($node, $account = NULL) { * Menu access callback. Ensure a sure has access to update a webform node. * * Unlike webform_results_access and webform_results_clear_access, access is - * completely overridden by the any implementation of hook_webform_update_access. + * completely overridden by the any implementation of + * hook_webform_update_access. * * If hook_webform_update_access is implemented by one or more other modules, * the results must be unanimously TRUE for access to be granted; otherwise it @@ -1550,7 +1567,7 @@ function webform_node_insert($node) { } // Flush the block cache if creating a block. - if (function_exists('block_flush_caches') && $node->webform['block']) { + if (module_exists('block') && $node->webform['block']) { block_flush_caches(); } } @@ -1787,7 +1804,7 @@ function webform_node_load($nodes, $types) { } // Load the components, emails, and defaults for all webform-enabled nodes. - // TODO: Increase efficiency here by pulling in all information all at once + // @todo: Increase efficiency here by pulling in all information all at once // instead of individual queries. foreach ($nodes as $nid => $node) { if (!in_array($node->type, $webform_types)) { @@ -2018,7 +2035,9 @@ function webform_node_view($node, $view_mode) { // This prevents one anonymous user from generated a disabled webform page // for the cache, which would be shown to other anonymous users who have not // exceeded the limit. - if (($user_limit_exceeded = webform_submission_user_limit_check($node)) && !$cached) { + // Cached should be checked first to avoid the expensive limit check on + // cached requests. + if (!$cached && ($user_limit_exceeded = webform_submission_user_limit_check($node))) { $enabled = FALSE; } } @@ -2132,18 +2151,13 @@ function _webform_allowed_roles($node, &$user_is_allowed) { /** * Output the Webform into the node content. * - * @param object $node - * The webform node object. - * @param object $page - * If this webform node is being viewed as the main content of the page. - * @param array $form - * The rendered form. - * @param $enabled - * If the form allowed to be completed by the current user. + * @param array $variables + * The variables array. * * @return string + * The rendered Webform. */ -function theme_webform_view($variables) { +function theme_webform_view(array $variables) { // Only show the form if this user is allowed access. if ($variables['webform']['#enabled']) { return drupal_render($variables['webform']['#form']); @@ -2153,23 +2167,10 @@ function theme_webform_view($variables) { /** * Display a message to a user if they are not allowed to fill out a form. * - * @param object $node - * The webform node object. - * @param $page - * If this webform node is being viewed as the main content of the page. - * @param $submission_count - * The number of submissions this user has already submitted. Not calculated - * for anonymous users. - * @param $user_limit_exceeded - * Boolean value if the submission limit for this user has been exceeded. - * @param $total_limit_exceeded - * Boolean value if the total submission limit has been exceeded. - * @param $allowed_roles - * A list of user roles that are allowed to submit this webform. - * @param $closed - * Boolean value if submissions are closed. - */ -function theme_webform_view_messages($variables) { + * @param array $variables + * The variables array. + */ +function theme_webform_view_messages(array $variables) { global $user; $node = $variables['node']; @@ -2443,7 +2444,7 @@ function webform_block_configure($delta = '') { 1 => t('Display the confirmation page in the block on the same page (no redirect)'), ), '#default_value' => $settings['confirmation_block'], - '#description' => t('This setting overrides the webform\'s configuration and redirection location settings when the webform is submitted via this block.'), + '#description' => t("This setting overrides the webform's configuration and redirection location settings when the webform is submitted via this block."), ); return $form; } @@ -2466,9 +2467,10 @@ function webform_block_save($delta = '', $edit = array()) { } /** - * Client form generation function. If this is displaying an existing - * submission, pass in the $submission variable with the contents of the - * submission to be displayed. + * Client form generation function. + * + * If this is displaying an existing submission, pass in the $submission + * variable with the contents of the submission to be displayed. * * @param $form * The current form array (always empty). @@ -2613,11 +2615,12 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r // For resuming a previous draft, find the next page after the last // validated page. if (!isset($form_state['storage']['page_num']) && $submission && $submission->is_draft && $submission->highest_valid_page) { - // Find the - // 1) previous/next non-empty page, or - // 2) the preview page, or - // 3) the preview page, forcing its display if the form would unexpectedly submit, or - // 4) page 1 even if empty, if no other previous page would be shown. + // Find the: + // 1. previous/next non-empty page, or + // 2. the preview page, or + // 3. the preview page, forcing its display if the form would unexpectedly + // submit, or + // 4. page 1 even if empty, if no other previous page would be shown. $form_state['webform']['page_num'] = $submission->highest_valid_page; do { $form_state['webform']['page_num']++; @@ -2627,8 +2630,8 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r $form_state['webform']['preview'] = TRUE; $form_state['webform']['page_count']++; } - // The form hasn't been submitted (ever) and the preview code will - // expect $form_state['values']['submitted'] to be set from a previous + // The form hasn't been submitted (ever) and the preview code will expect + // $form_state['values']['submitted'] to be set from a previous // submission, so provide these values here. $form_state['values']['submitted'] = $input_values; $form_state['storage']['submitted'] = $input_values; @@ -2640,7 +2643,7 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r $page_num = $form_state['webform']['page_num']; $preview = $form_state['webform']['preview']; - if ($page_count > 1) { + if ($node->webform['progressbar_include_confirmation'] || $page_count > 1) { $page_labels = webform_page_labels($node, $form_state); $form['progressbar'] = array( '#theme' => 'webform_progressbar', @@ -2652,9 +2655,10 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r ); } - // Check whether a previous submission was truncated. The length of the client form is not - // estimated before submission because a) the determination may not be accurate for some - // webform components and b) the error will be apparent upon submission. + // Check whether a previous submission was truncated. The length of the + // client form is not estimated before submission because a) the + // determination may not be accurate for some webform components and b) the + // error will be apparent upon submission. webform_input_vars_check($form, $form_state, 'submitted'); // Recursively add components to the form. The unfiltered version of the @@ -2947,7 +2951,8 @@ function _webform_client_form_add_component($node, $component, $component_value, * upon form submission. */ function webform_client_form_prevalidate($form, &$form_state) { - // Refresh the node in case it changed since the form was build and retrieved from cache. + // Refresh the node in case it changed since the form was build and retrieved + // from cache. $node = $form['#node'] = node_load($form['#node']->nid); $finished = $form_state['values']['details']['finished']; @@ -2977,7 +2982,10 @@ function webform_client_form_prevalidate($form, &$form_state) { // is no submission yet (hence isn't being edited) or the user isn't an admin. // Another way to consider this is that the form is open when its status is // open OR there is a submission and the user is an admin. - $closed = empty($node->webform['status']) && (empty($form['#submission']) || !user_access('edit all webform submissions')); + $closed = empty($node->webform['status']) && ( + empty($form['#submission']) || + !user_access('edit all webform submissions') + ); // Prevent submission by throwing an error. if ((!$allowed_role || $total_limit_exceeded || $user_limit_exceeded || $closed)) { @@ -3035,14 +3043,14 @@ function _webform_client_form_validate(&$elements, &$form_state, $form_id = NULL $cid = $elements['#webform_component']['cid']; $page_num = $form_state['values']['details']['page_num']; // Webform-specific enhancements: - // 1) Only validate the field if it was used in this submission. + // 1. Only validate the field if it was used in this submission. // This both skips validation on the field and sets the value of the // field to NULL, preventing any dangerous input. Short-circuit // validation for a hidden component (hidden by rules dependent upon // component on previous pages), or a component this is dependent upon // values on the current page, but is hidden based upon their current // values. - // 2) Only validate if the field has not been set by conditionals. + // 2. Only validate if the field has not been set by conditionals. // The user will be unable to fix the validation without surmising the // logic and changing the trigger for the conditional. Also, it isn't // possible to set $element['#value'] without component-specific @@ -3091,10 +3099,12 @@ function _webform_client_form_validate(&$elements, &$form_state, $form_id = NULL if (isset($elements['#needs_validation'])) { // Make sure a value is passed when the field is required. // A simple call to empty() will not cut it here as some fields, like - // checkboxes, can return a valid value of '0'. Instead, check the - // length if it's a string, and the item count if it's an array. For + // checkboxes, can return a valid value of 0. Instead, check the + // length if it's a string, and if it's an array whether it is empty. For // radios, FALSE means that no value was submitted, so check that too. - if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0) || $elements['#value'] === FALSE)) { + $value_is_empty_string = is_string($elements['#value']) && strlen(trim($elements['#value'])) === 0; + $value_is_empty_array = is_array($elements['#value']) && !$elements['#value']; + if ($elements['#required'] && ($value_is_empty_string || $value_is_empty_array || $elements['#value'] === FALSE || $elements['#value'] === NULL)) { form_error($elements, t('!name field is required.', array('!name' => $elements['#title']))); } @@ -3194,7 +3204,7 @@ function webform_client_form_postvalidate(&$form, &$form_state) { $nid = $form_state['values']['details']['nid']; $node = node_load($nid); if (user_is_logged_in() && - $errors && !key_exists('', $errors) && + $errors && !array_key_exists('', $errors) && $node->webform['auto_save'] && !$form_state['values']['details']['finished'] && !empty($form_state['values']['op'])) { @@ -3289,11 +3299,12 @@ function webform_client_form_pages($form, &$form_state) { $current_page = $form_state['storage']['page_num']; if (isset($forward)) { - // Find the - // 1) previous/next non-empty page, or - // 2) the preview page, or - // 3) the preview page, forcing its display if the form would unexpectedly submit, or - // 4) page 1 even if empty, if no other previous page would be shown. + // Find the: + // 1. previous/next non-empty page, or + // 2. the preview page, or + // 3. the preview page, forcing its display if the form would unexpectedly + // submit, or + // 4. page 1 even if empty, if no other previous page would be shown. $preview_page_num = $form_state['storage']['page_count'] + (int) !$form_state['webform']['preview']; $page_num = $current_page; do { @@ -3592,9 +3603,9 @@ function template_preprocess_webform_confirmation(&$vars) { // Progress bar. $vars['progressbar'] = ''; - $page_labels = webform_page_labels($node); - $page_count = count($page_labels); - if ($node->webform['progressbar_include_confirmation'] && $page_count > 2) { + if ($node->webform['progressbar_include_confirmation']) { + $page_labels = webform_page_labels($node); + $page_count = count($page_labels); $vars['progressbar'] = theme('webform_progressbar', array( 'node' => $node, 'page_num' => $page_count, @@ -3747,24 +3758,34 @@ function theme_webform_element($variables) { case 'inline': $output .= $description[$above]; $description[$above] = ''; - // FALL THRU. case 'before': case 'invisible': - $output .= ' ' . theme('form_element_label', $variables); - $output .= ' ' . $description[$above] . $prefix . $element['#children'] . $suffix . "\n"; + case 'after': + $title = ' ' . theme('form_element_label', $variables); + break; + } + + $children = ' ' . $description[$above] . $prefix . $element['#children'] . $suffix; + switch ($element['#title_display']) { + case 'inline': + case 'before': + case 'invisible': + $output .= $title; + $output .= $children; break; case 'after': - $output .= ' ' . $description[$above] . $prefix . $element['#children'] . $suffix; - $output .= ' ' . theme('form_element_label', $variables) . "\n"; + $output .= $children; + $output .= $title; break; case 'none': case 'attribute': // Output no label and no required marker, only the children. - $output .= ' ' . $description[$above] . $prefix . $element['#children'] . $suffix . "\n"; + $output .= $children; break; } + $output .= "\n"; $output .= $description[!$above]; $output .= "
    \n"; @@ -3914,24 +3935,17 @@ function theme_webform_inline_radio_label($variables) { /** * Theme the headers when sending an email from webform. * - * @param object $node - * The complete node object for the webform. - * @param $submission - * The webform submission of the user. - * @param $email - * If you desire to make different e-mail headers depending on the recipient, - * you can check the $email['email'] property to output different content. - * This will be the ID of the component that is a conditional e-mail - * recipient. For the normal e-mails, it will have the value of 'default'. + * @param array $variables + * The variables array. * - * @return + * @return array * An array of headers to be used when sending a webform email. If headers * for "From", "To", or "Subject" are set, they will take precedence over * the values set in the webform configuration. */ -function theme_webform_mail_headers($variables) { +function theme_webform_mail_headers(array $variables) { $headers = array( - 'X-Mailer' => 'Drupal Webform (PHP/' . phpversion() . ')', + 'X-Mailer' => 'Drupal Webform' . (ini_get('expose_php') ? ' (PHP/' . phpversion() . ')' : ''), ); return $headers; } @@ -4160,7 +4174,7 @@ function _webform_filter_xss($string) { * @param object $node * The node object to check if a database entry exists. * - * @return + * @return bool * This function should always return TRUE if no errors were encountered, * ensuring that a webform table row has been created. Will return FALSE if * a record does not exist and a new one could not be created. @@ -4186,7 +4200,7 @@ function webform_ensure_record(&$node) { * @param object $node * The node object to check if a database entry is still required. * - * @return + * @return bool * Returns TRUE if the webform still has a record in the database. Returns * FALSE if the webform does not have a record or if the previously existing * record was just deleted. @@ -4220,7 +4234,7 @@ function webform_check_record(&$node) { * @return int|int[] * The cid of the component or an array of component ids. */ -function webform_get_cid(&$node, $form_key, $pid = NULL) { +function webform_get_cid($node, $form_key, $pid = NULL) { if ($pid === NULL) { $cids = array(); foreach ($node->webform['components'] as $cid => $component) { @@ -4416,7 +4430,6 @@ function theme_webform_token_help($variables) { return ''; } $groups = $variables['groups']; - module_load_include('inc', 'token', 'token.pages'); // Assume dialogs are not supported, show as a fieldset. $help = array( @@ -4439,18 +4452,22 @@ function theme_webform_token_help($variables) { $help['help']['#markup'] .= '

    ' . t('A full listing of tokens may be listed here by installing the Token module.') . '

    '; unset($help['token_tree']); } - elseif (function_exists('token_page_output_tree')) { - // Token supports dialogs: display simply as a link. - $help = $help['token_tree']; - $help['#dialog'] = TRUE; + else { + module_load_include('inc', 'token', 'token.pages'); + if (function_exists('token_page_output_tree')) { + // Token supports dialogs: display simply as a link. + $help = $help['token_tree']; + $help['#dialog'] = TRUE; + } } return render($help); } /** - * Convert a name into an identifier that is safe for machine names, classes, - * and other ASCII uses. + * Convert a name into an identifier. + * + * The identifier is safe for machine names, classes, and other ASCII uses. */ function _webform_safe_name($name) { $new = trim($name); @@ -4887,6 +4904,7 @@ function webform_component_invoke($type, $callback) { * The callback to check. * * @return bool + * Whether or not the hook is implemented. */ function webform_component_implements($type, $callback) { $function = '_webform_' . $callback . '_' . $type; @@ -5091,7 +5109,7 @@ function webform_date_string($array, $type = NULL) { * @return string * A date/time format string. */ -function webform_date_format($type = NULL, $exclude = array()) { +function webform_date_format($type = NULL, array $exclude = array()) { static $formats = array(); $id = $type . ':' . implode('', $exclude); if (!isset($formats[$id])) { @@ -5166,12 +5184,12 @@ function webform_strtodate($format, $string, $timezone_name = NULL, $reference_t @$timezone = new DateTimeZone($timezone_name); if (isset($reference_timestamp)) { // A reference for relative dates has been provided. - // 1) Convert the reference timestamp (in UTC) to a DateTime. - // 2) Set to time zone to the user or system timezone, recreating - // the reference time in the appropriate time zone. - // 3) Set the time to midnight because when a non-referenced relative + // 1. Convert the reference timestamp (in UTC) to a DateTime. + // 2. Set to time zone to the user or system timezone, recreating the + // reference time in the appropriate time zone. + // 3. Set the time to midnight because when a non-referenced relative // date is created without a time, it is created at midnight (0:00). - // 4) Adjust to the specified relative (or absolute) time. + // 4. Adjust to the specified relative (or absolute) time. @$datetime = new DateTime('@' . $reference_timestamp); @$datetime->setTimezone($timezone) ->setTime(0, 0, 0) @@ -5262,96 +5280,6 @@ function webform_field_extra_fields() { return $extra; } -/** - * Implements hook_mollom_form_list(). - */ -function webform_mollom_form_list() { - $forms = array(); - $webform_types = webform_node_types(); - if (empty($webform_types)) { - return $forms; - } - - $query = db_select('webform', 'w'); - $query->innerJoin('node', 'n', 'n.nid = w.nid'); - $query->fields('n', array('nid', 'title')); - $query->condition('n.type', $webform_types, 'IN'); - $result = $query->execute(); - - foreach ($result as $node) { - $form_id = 'webform_client_form_' . $node->nid; - $forms[$form_id] = array( - 'title' => t('@name form', array('@name' => $node->title)), - 'entity' => 'webform', - 'delete form' => 'webform_submission_delete_form', - ); - } - return $forms; -} - -/** - * Implements hook_mollom_form_info(). - */ -function webform_mollom_form_info($form_id) { - module_load_include('inc', 'webform', 'includes/webform.components'); - - $nid = drupal_substr($form_id, 20); - $node = node_load($nid); - $form_info = array( - 'title' => t('@name form', array('@name' => $node->title)), - 'mode' => MOLLOM_MODE_ANALYSIS, - 'bypass access' => array('edit all webform submissions', 'edit any webform content'), - 'entity' => 'webform', - 'elements' => array(), - 'mapping' => array( - 'post_id' => 'details][sid', - 'author_id' => 'details][uid', - ), - ); - // Add components as elements. - // These components can be enabled for textual analysis (when not using a - // CAPTCHA-only protection) in Mollom's form configuration. - foreach ($node->webform['components'] as $cid => $component) { - if (webform_component_feature($component['type'], 'spam_analysis')) { - $parents = implode('][', webform_component_parent_keys($node, $component)); - $form_info['elements']['submitted][' . $parents] = check_plain(t($component['name'])); - } - } - // Assign field mappings based on webform configuration. - // Since multiple emails can be configured, we iterate over all and take - // over the assigned component for the field mapping in any email, unless - // we already assigned one. We are not interested in administratively - // configured static strings, only user-submitted values. - foreach ($node->webform['emails'] as $email) { - // Subject (post_title). - if (!isset($form_info['mapping']['post_title'])) { - $cid = $email['subject']; - if (is_numeric($cid)) { - $parents = implode('][', webform_component_parent_keys($node, $node->webform['components'][$cid])); - $form_info['mapping']['post_title'] = 'submitted][' . $parents; - } - } - // From name (author_name). - if (!isset($form_info['mapping']['author_name'])) { - $cid = $email['from_name']; - if (is_numeric($cid)) { - $parents = implode('][', webform_component_parent_keys($node, $node->webform['components'][$cid])); - $form_info['mapping']['author_name'] = 'submitted][' . $parents; - } - } - // From address (author_mail). - if (!isset($form_info['mapping']['author_mail'])) { - $cid = $email['from_address']; - if (is_numeric($cid)) { - $parents = implode('][', webform_component_parent_keys($node, $node->webform['components'][$cid])); - $form_info['mapping']['author_mail'] = 'submitted][' . $parents; - } - } - } - - return $form_info; -} - /** * Implements hook_date_views_extra_tables(). */ @@ -5360,8 +5288,7 @@ function webform_date_views_extra_tables() { } /** - * Returns the next serial number for a given node and increments the serial - * number. + * Returns the next serial number for a given node and increments it. * * @param int $nid * The nid of the node. @@ -5400,8 +5327,9 @@ function _webform_submission_serial_next_value($nid) { } /** - * Returns the next submission serial number to be used, based on the - * submissions in the database. + * Returns the next submission serial number to be used. + * + * This is based on the submissions in the database. * * @param int $nid * The Node ID of the Webform. @@ -5435,7 +5363,7 @@ function _webform_submission_serial_next_value_used($nid) { * @see clone_node_save() * @see drupal_alter() */ -function webform_clone_node_alter(&$node, $context) { +function webform_clone_node_alter(&$node, array $context) { if (isset($node->webform)) { $defaults = webform_node_defaults(); $node->webform['next_serial'] = $defaults['next_serial']; @@ -5443,9 +5371,9 @@ function webform_clone_node_alter(&$node, $context) { } /** - * Check if the last form submission exceeded the servers max_input_vars - * limit and optionally preflight the current form to be returned in this - * request. + * Check if the last form submission exceeded the servers max_input_vars limit. + * + * Optionally preflight the current form to be returned in this request. * * @param array $form * Reference to the form, which will be changed if $parent_key is set. @@ -5458,12 +5386,12 @@ function webform_clone_node_alter(&$node, $context) { * Omit to not preflight the form, or the array key for the parent of where * the preflight warning should be inserted into the form. */ -function webform_input_vars_check(&$form, $form_state, $detect_key, $parent_key = NULL) { +function webform_input_vars_check(array &$form, array $form_state, $detect_key, $parent_key = NULL) { if (isset($parent_key)) { $form['#pre_render'] = array('webform_pre_render_input_vars'); $form['#input_var_waring_parent'] = $parent_key; } - if (!empty($form_state['input']) && key_exists($detect_key, $form_state['input']) && !key_exists('form_id', $form_state['input'])) { + if (!empty($form_state['input']) && array_key_exists($detect_key, $form_state['input']) && !array_key_exists('form_id', $form_state['input'])) { // A form was submitted with POST, but the form_id was missing. The most likely cause of this // is that the POST was truncated because PHP exceeded its max_input_vars limit. $subs = array( @@ -5482,8 +5410,9 @@ function webform_input_vars_check(&$form, $form_state, $detect_key, $parent_key } /** - * Checks the number of input form elements on this page to ensure that the - * PHP max_input_vars limit is not exceeded. + * Checks the number of input form elements on this page. + * + * This ensures that the PHP max_input_vars limit is not exceeded. * * Install this function as a #pre_render function. */ @@ -5541,7 +5470,7 @@ function webform_pre_render_input_vars($element) { * @return int * The number of elements in the form that will result in $_POST entries. */ -function webform_count_input_vars($element) { +function webform_count_input_vars(array $element) { static $input_types = array( 'checkbox' => 1, 'date' => 1, @@ -5569,8 +5498,9 @@ function webform_count_input_vars($element) { } /** - * Counts terminals in an array. Useful for counting how many input_vars were - * returned in $_POST. + * Counts terminals in an array. + * + * Useful for counting how many input_vars were returned in $_POST. * * @param $a * Array or array element to be counted diff --git a/profiles/openasu/modules/contrib/webform/webform.tokens.inc b/profiles/openasu/modules/contrib/webform/webform.tokens.inc index 942ef0cbfb..c1c1f1e972 100644 --- a/profiles/openasu/modules/contrib/webform/webform.tokens.inc +++ b/profiles/openasu/modules/contrib/webform/webform.tokens.inc @@ -64,15 +64,13 @@ function webform_token_info() { ); $info['tokens']['submission']['values'] = array( 'name' => t('Webform submission values'), - 'description' => '
    ' . t('Webform tokens from submitted data. Replace the "?" with the "form key", including any parent form keys separated by colons. You can append:') . '
    ' . - '
      ' . + 'description' => '
      ' . t('Webform tokens from submitted data. Replace the "?" with the "form key", including any parent form keys separated by colons. You can append:') . '
        ' . '
      • ' . t('the question key for just that one question (grid components).') . '
      • ' . '
      • ' . t('the option key for just that one option (grid and select components).') . '
      • ' . '
      • ' . t('@token for the value without the label (the default).', array('@token' => ':nolabel')) . '
      • ' . '
      • ' . t('@token for just the label.', array('@token' => ':label')) . '
      • ' . '
      • ' . t('@token for both the label and value together.', array('@token' => ':withlabel')) . '
      • ' . - '
      • ' . t('@token for just the key in a key|label pair (grid and select components).', array('@token' => ':key')) . '
      • ' . - '
      ', + '
    • ' . t('@token for just the key in a key|label pair (grid and select components).', array('@token' => ':key')) . '
    ', 'dynamic' => TRUE, ); @@ -241,7 +239,7 @@ function webform_tokens($type, $tokens, array $data = array(), array $options = if (strcmp($name, $matched_token) !== 0) { // Check if this matches the key plus a modifier. $modifier = substr($name, strrpos($name, ':') + 1); - // TODO: Allow components to provide additional modifiers per + // @todo: Allow components to provide additional modifiers per // type, i.e. key, day, hour, minute, etc. if (strcmp($name, $matched_token . ':' . $modifier) !== 0 || !in_array($modifier, $available_modifiers)) { // No match. diff --git a/profiles/openasu/modules/custom/asu_dirs/CHANGELOG b/profiles/openasu/modules/custom/asu_dirs/CHANGELOG index fbbe222f69..e84c5b8e8b 100644 --- a/profiles/openasu/modules/custom/asu_dirs/CHANGELOG +++ b/profiles/openasu/modules/custom/asu_dirs/CHANGELOG @@ -1,3 +1,8 @@ +asu_dirs 7.x-1.2 +---------------- +- asu_isearch v1.12 +- asu_dir v1.10.1 + asu_dirs 7.x-1.1 -------------------- - Upgraded to asu_isearch v1.11 \ No newline at end of file diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_dir/CHANGELOG b/profiles/openasu/modules/custom/asu_dirs/asu_dir/CHANGELOG index 4a43fbdebb..aa0ff9740e 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_dir/CHANGELOG +++ b/profiles/openasu/modules/custom/asu_dirs/asu_dir/CHANGELOG @@ -1,3 +1,11 @@ +asu_dir 7.x-1.10.1 +------------------ +- Added more helpful description for the 'Use local iSearch view' option in the panel configs + +asu_dir 7.x-1.10 +---------------- +- Removed short array syntax + asu_dir 7.x-1.9 --------------- - Addition of variable to specify the lastname sorting field. This will allow the use of the lastNameExact field which will diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_dir/asu_dir.info b/profiles/openasu/modules/custom/asu_dirs/asu_dir/asu_dir.info index c8b15f7600..fb208b7fd2 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_dir/asu_dir.info +++ b/profiles/openasu/modules/custom/asu_dirs/asu_dir/asu_dir.info @@ -2,7 +2,7 @@ name = ASU Directory Integration Reinvented (ASU DIR) description = Allows creation and configuration of ASU Solr-enabled directory people listings, which pull directly from iSearch. core = 7.x package = ASU -version = 7.x-1.10 +version = 7.x-1.10.1 project = asu_dir dependencies[] = asu_dir_utilities (>=7.x-1.1) dependencies[] = block diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_dir/inc/asu_dir.field.inc b/profiles/openasu/modules/custom/asu_dirs/asu_dir/inc/asu_dir.field.inc index cd8a2d5608..90bf4c0915 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_dir/inc/asu_dir.field.inc +++ b/profiles/openasu/modules/custom/asu_dirs/asu_dir/inc/asu_dir.field.inc @@ -758,13 +758,19 @@ function asu_dir_field_widget_form(&$form, &$form_state, $field, $instance, $lan '#suffix' => '

    Notice: If checked, the local iSearch Directory List view will be displayed, instead of real-time Solr results. The view is subject to changes in local profiles via migrations, and may not be up to date with iSearch. Also please note that in the event of a Solr outage, - the view will be displayed automatically as a backup.

    ', + the view will be displayed automatically as a backup.

    +

    Also note that Selecting this option will invalidate some of the options you may have selected in this interface. + For example, if you have selected the \'Grid\' + Display Type, the View will not reflect that. + The View being used for this directory is named \'iSearch Directory\', with a subview named \'Directory - List.\'. + We do not recommend modifying this view directly. + We suggest making a copy of the view which can then be customized.

    + ', '#states' => array( 'visible' => array( ':input[name="field_asu_directory_items[und][0][horizontal_tabs][advanced][use_custom_q]"]' => array('checked' => FALSE) ), ) - ); } diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_dirs.info b/profiles/openasu/modules/custom/asu_dirs/asu_dirs.info index 5a55ada33b..7b02ce1fba 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_dirs.info +++ b/profiles/openasu/modules/custom/asu_dirs/asu_dirs.info @@ -21,4 +21,4 @@ dependencies[] = asu_dept_picker (>=7.x-1.0.1) dependencies[] = react ; See below for info on version number -version = 7.x-1.1 +version = 7.x-1.2 diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/CHANGELOG b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/CHANGELOG index f0774eabd2..d36b14e2f4 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/CHANGELOG +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/CHANGELOG @@ -1,3 +1,9 @@ +asu_isearch 7.x-1.12 +-------------------- +- Fixed bug where local rank weight couldn't be removed with node edit form +- Added error handling to better detect field_collection-related failures +- Fixed bug where absolute URLs imported from iSearch were being rewritten + asu_isearch 7.x-1.11 -------------------- - Added queue cleanup update and limits to avoid bloating database diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.info b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.info index 713f2ae0cb..bf0029a943 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.info +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.info @@ -2,7 +2,7 @@ name = ASU Local iSearch Directory (ASU LID) description = Pulls iSearch data and stores/updates it locally. Sets up a default listing view and profile pages. core = 7.x package = ASU -version = 7.x-1.11 +version = 7.x-1.12 project = asu_isearch dependencies[] = asu_dept_picker (>=7.x-1.0.1) dependencies[] = asu_dir_utilities (>=7.x-1.1) diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.module b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.module index 21dc5be90a..4f583a3707 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.module +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/asu_isearch.module @@ -43,6 +43,7 @@ define('ASU_ISEARCH_PROFILE_ONLOAD_UPDATE_INTERVAL', variable_get('asu_isearch_o define('ASU_ISEARCH_DEPT_CACHING_LIMIT', variable_get('asu_isearch_dept_caching_limit', 25)); define('ASU_ISEARCH_MANUAL_IMPORT_DEPT_CACHE_LIMIT', variable_get('asu_isearch_manual_import_dept_cache_limit', 5)); define('ASU_ISEARCH_MASTER_IMPORT_MINIMUM', variable_get('asu_isearch_master_import_minimum', 5)); +define('ASU_ISEARCH_DEFAULT_LOCAL_WEIGHT', variable_get('asu_isearch_default_local_weight', 999)); // DEVMODE - variable to indicate development settings define('ASU_ISEARCH_DEVMODE', variable_get('asu_isearch_devmode', FALSE)); diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/MigrateIsearchProfileMigration.inc b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/MigrateIsearchProfileMigration.inc index 14c7e6b459..9624c2b85a 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/MigrateIsearchProfileMigration.inc +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/MigrateIsearchProfileMigration.inc @@ -295,8 +295,6 @@ class MigrateIsearchProfileMigration extends Migration { $affiliation->id = $department_id; $affiliation->deptId = $department_id; $affiliation->deptName = $row->departments[$index]; - - $titlesource = 'workingTitle'; if (isset($row->titleSource)) { @@ -730,7 +728,14 @@ class MigrateIsearchProfileMigration extends Migration { else { // this affiliation does not exist, create it $affiliation = entity_create('field_collection_item', array('field_name' => 'field_isearch_affiliations')); - $affiliation->setHostEntity('node', $entity); + + try { + $affiliation->setHostEntity('node', $entity); + } + catch (Exception $e) { + // Log the exception to watchdog. + watchdog_exception('type', $e); + } } // store the affiliation title @@ -754,7 +759,6 @@ class MigrateIsearchProfileMigration extends Migration { $affiliation->field_isearch_affil_primary[LANGUAGE_NONE][0]['value'] = ($item->isPrimary) ? 1 : 0; $affiliation->field_isearch_affil_rank_tenure[LANGUAGE_NONE][0]['value'] = ($item->isRankTenure) ? 1 : 0; - if (variable_get('isearch_import_affil_weights', FALSE)) { $affiliation->field_isearch_affil_weight[LANGUAGE_NONE][0]['value'] = $item->affilWeight; } @@ -771,7 +775,13 @@ class MigrateIsearchProfileMigration extends Migration { $affiliation->field_isearch_affil_rank[LANGUAGE_NONE][0]['tid'] = $row->existing_ranks[$item->ranksTid]; } - $affiliation->save(); + try { + $affiliation->save(); + } + catch (Exception $e) { + // Log the exception to watchdog. + watchdog_exception('type', $e); + } if ($row->localPrimaryAffiliation == $item->deptId) { $entity->field_isearch_primary_aff[LANGUAGE_NONE][0]['target_id'] = $affiliation->item_id; diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/asu_isearch.entity.inc b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/asu_isearch.entity.inc index 4a3f2bd0dd..a39f1e0e7f 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/asu_isearch.entity.inc +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/inc/asu_isearch.entity.inc @@ -31,11 +31,12 @@ function asu_isearch_entity_presave($entity, $type) { $affiliation_rank_weight = $affiliation->field_isearch_affil_local_weight->value(); } - // set the rank weight - if ($affiliation_rank_weight != NULL) { - $entity->field_isearch_affil_rank_weight[LANGUAGE_NONE][0]['value'] = $affiliation_rank_weight; + if ($affiliation_rank_weight === NULL) { + $affiliation_rank_weight = ASU_ISEARCH_DEFAULT_LOCAL_WEIGHT; } + $entity->field_isearch_affil_rank_weight[LANGUAGE_NONE][0]['value'] = $affiliation_rank_weight; + // set this field for proper filtering if (empty($entity->field_isearch_affil_hide)) { $entity->field_isearch_affil_hide[LANGUAGE_NONE][0]['value'] = 0; diff --git a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/js/asu_isearch.js b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/js/asu_isearch.js index 79d68267f3..8ada5942f5 100644 --- a/profiles/openasu/modules/custom/asu_dirs/asu_isearch/js/asu_isearch.js +++ b/profiles/openasu/modules/custom/asu_dirs/asu_isearch/js/asu_isearch.js @@ -29,9 +29,9 @@ // add the complete/absolute url for the people links $.each(acts, function (index, value) { var href = $(this).attr('href'); - var isearch = href.indexOf("isearch.asu.edu"); - if (isearch == -1) { + // rewrite only relative URLs which were imported from iSearch + if (!isUrlAbsolute(href)) { href = 'https://isearch.asu.edu' + href; $(this).attr('href', href); } @@ -43,3 +43,11 @@ } } })(jQuery); + +/*** + * Checks if a URL is absolute + * Copied from Stackoverflow user Philipp's answer here: https://stackoverflow.com/questions/10687099/how-to-test-if-a-url-string-is-absolute-or-relative + */ +function isUrlAbsolute(url) { + return (url.indexOf('://') > 0 || url.indexOf('//') === 0); +} diff --git a/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_one.json b/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_one.json new file mode 100644 index 0000000000..d133336bdd --- /dev/null +++ b/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_one.json @@ -0,0 +1,113 @@ +[ + { + "eid": "1111111", + "asuriteId": "asurite1", + "lastName": "Webspark", + "firstName": "Sparky", + "middleName": "", + "displayName": "Sparky Webspark", + "preferredFirstName": "", + "affiliations": [ + "Employee" + ], + "affiliationsFacet": [ + "Employee" + ], + "emailAddress": "spark@example.com", + "addressLine1": "5555 Webspark Test", + "addressLine2": "", + "addressLine3": "", + "city": "Tempe", + "postalCode": "55555", + "titleSource": [ + "titles" + ], + "titles": [ + "Customized Drupal Developer Senior" + ], + "departments": [ + "Applications and Design" + ], + "departmentsFacet": [ + "Applications and Design" + ], + "deptids": [ + "2163" + ], + "vpAreas": [ + "U01" + ], + "emplClasses": [ + "University Staff" + ], + "simplifiedEmplClasses": [ + "University Staff" + ], + "psDeptids": [ + "U0106004" + ], + "jobCampuses": [ + "TEMPE" + ], + "mailCodes": [ + "6312" + ], + "locations": [ + "TEMPE" + ], + "employeeTypes": [ + "University Staff" + ], + "managers": [ + 0 + ], + "primaryTitle": "Drupal Developer Senior", + "workingTitle": "Super Drupal Developer Senior", + "primaryDepartment": "DEV Applications and Design", + "primaryEmplClass": "University Staff", + "primarySimplifiedEmplClass": "University Staff", + "primaryMailCode": "6312", + "primaryDeptid": "DEV Applications and Design", + "primaryJobCampus": "TEMPE", + "primaryiSearchDepartmentAffiliation": "Applications and Design", + "photoUrl": "", + "photoPermission": "private", + "photoPreference": "suncard", + "bio": "\u003Cp\u003EThis is a mock bio.\u0026nbsp;\u003C\/p\u003E", + "website": "", + "facebook": "", + "twitter": "", + "googlePlus": "", + "linkedin": "", + "teachingWebsite": "", + "fax": "", + "researchWebsite": "", + "employeeWeight": [ + "0" + ], + "imageUrls": [ + "" + ], + "_version_": 1638562985797484544, + "profileNid": "999999", + "affilWeight": [ + 999 + ], + "affilHide": [ + 0 + ], + "departmentTitleRanks": [ + null + ], + "departmentTitleRanksWeight": [ + null + ], + "departmentTitleRanksTenure": [ + 0 + ], + "departmentTitleRanksTids": [ + null + ], + "researchActivity": "" + } +] \ No newline at end of file diff --git a/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_two.json b/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_two.json new file mode 100644 index 0000000000..feaf333f93 --- /dev/null +++ b/profiles/openasu/modules/custom/webspark_test/behat/asu_isearch.test_mock_two.json @@ -0,0 +1,113 @@ +[ + { + "eid": "1111111", + "asuriteId": "asurite1", + "lastName": "Webspark", + "firstName": "Sparky", + "middleName": "", + "displayName": "Sparky Webspark", + "preferredFirstName": "", + "affiliations": [ + "Employee" + ], + "affiliationsFacet": [ + "Employee" + ], + "emailAddress": "spark@example.com", + "addressLine1": "5555 Webspark Test", + "addressLine2": "", + "addressLine3": "", + "city": "Tempe", + "postalCode": "55555", + "titleSource": [ + "workingTitle" + ], + "titles": [ + "Drupal Developer Senior" + ], + "departments": [ + "Applications and Design" + ], + "departmentsFacet": [ + "Applications and Design" + ], + "deptids": [ + "2163" + ], + "vpAreas": [ + "U01" + ], + "emplClasses": [ + "University Staff" + ], + "simplifiedEmplClasses": [ + "University Staff" + ], + "psDeptids": [ + "U0106004" + ], + "jobCampuses": [ + "TEMPE" + ], + "mailCodes": [ + "6312" + ], + "locations": [ + "TEMPE" + ], + "employeeTypes": [ + "University Staff" + ], + "managers": [ + 0 + ], + "primaryTitle": "Drupal Developer Senior", + "workingTitle": "Super Drupal Developer Senior", + "primaryDepartment": "DEV Applications and Design", + "primaryEmplClass": "University Staff", + "primarySimplifiedEmplClass": "University Staff", + "primaryMailCode": "6312", + "primaryDeptid": "DEV Applications and Design", + "primaryJobCampus": "TEMPE", + "primaryiSearchDepartmentAffiliation": "Applications and Design", + "photoUrl": "", + "photoPermission": "private", + "photoPreference": "suncard", + "bio": "\u003Cp\u003EThis is a mock bio.\u0026nbsp;\u003C\/p\u003E", + "website": "", + "facebook": "", + "twitter": "", + "googlePlus": "", + "linkedin": "", + "teachingWebsite": "", + "fax": "", + "researchWebsite": "", + "employeeWeight": [ + "0" + ], + "imageUrls": [ + "" + ], + "_version_": 1638562985797484544, + "profileNid": "999999", + "affilWeight": [ + 999 + ], + "affilHide": [ + 0 + ], + "departmentTitleRanks": [ + null + ], + "departmentTitleRanksWeight": [ + null + ], + "departmentTitleRanksTenure": [ + 0 + ], + "departmentTitleRanksTids": [ + null + ], + "researchActivity": "" + } +] \ No newline at end of file diff --git a/profiles/openasu/modules/custom/webspark_test/behat/behat.common.yml b/profiles/openasu/modules/custom/webspark_test/behat/behat.common.yml index 1c318f2ed4..0ab2eb77c3 100644 --- a/profiles/openasu/modules/custom/webspark_test/behat/behat.common.yml +++ b/profiles/openasu/modules/custom/webspark_test/behat/behat.common.yml @@ -1,8 +1,8 @@ default: suites: default: - #paths: - # features: 'features' + paths: + features: '%paths.base%/features' filters: tags: "~@chrome" contexts: diff --git a/profiles/openasu/modules/custom/webspark_test/behat/behat.travis.yml b/profiles/openasu/modules/custom/webspark_test/behat/behat.travis.yml index d287767ca8..4edfac3e95 100644 --- a/profiles/openasu/modules/custom/webspark_test/behat/behat.travis.yml +++ b/profiles/openasu/modules/custom/webspark_test/behat/behat.travis.yml @@ -1,17 +1,22 @@ imports: - behat.common.yml -# default: extensions: Behat\MinkExtension: selenium2: - # This will probably be the same always, if you follow the guide for browsers below. wd_host: http://localhost:4444/wd/hub - capabilities: + capabilities: + extra_capabilities: + chromeOptions: + args: + - "--start-maximized" + - "--headless" + - "--disable-gpu" chrome: switches: - "--headless" - "--disable-gpu" + - "--window-size=1920,1080" - "--no-sandbox" javascript_session: selenium2 browser_name: chrome diff --git a/profiles/openasu/modules/custom/webspark_test/behat/composer.json b/profiles/openasu/modules/custom/webspark_test/behat/composer.json index 20992ddd04..5d700c8f8c 100644 --- a/profiles/openasu/modules/custom/webspark_test/behat/composer.json +++ b/profiles/openasu/modules/custom/webspark_test/behat/composer.json @@ -1,6 +1,8 @@ { "require": { - "drupal/drupal-extension": "3.2.2" + "behat/behat": "~3.5.0", + "drupal/drupal-extension": "~3.4.0", + "behat/mink-extension": "~2.3.1" }, "config": { "bin-dir": "bin/" diff --git a/profiles/openasu/modules/custom/webspark_test/behat/features/asu_directory_import.feature b/profiles/openasu/modules/custom/webspark_test/behat/features/asu_directory_import.feature index f11b61da85..104fac328a 100644 --- a/profiles/openasu/modules/custom/webspark_test/behat/features/asu_directory_import.feature +++ b/profiles/openasu/modules/custom/webspark_test/behat/features/asu_directory_import.feature @@ -2,15 +2,18 @@ Feature: Import iSearch Profiles Background: Given I am logged in as a user with the "administrator" role - @javascript @api + @javascript @api @asu_isearch Scenario: Run an import, then add directory panel with imported profiles Given I am at "/admin/content/isearch/configure" When I click on the element "label" which has property "data-reactid" with value ".1.1" And I press the "Browse" button - And I click on the element "li" which has property "dept_nid" with value "1344" + And I click the '[dept_nid="1359"] a.jqtree-toggler' element + And I click the '[dept_nid="1569"] a.jqtree-toggler' element + And I click on the element "li" which has property "dept_nid" with value "2163" And I click on the text " Include sub-departments?" in the "label" tag And I press the "Submit" button And I press the "Save configuration" button + And I mock the migration source "asu_isearch.test_mock_one.json" And I click "Import iSearch Profiles" And I fill in "edit-isearch-import-limit-value" with "50" And I press the "Begin import" button @@ -27,7 +30,9 @@ Feature: Import iSearch Profiles And I click "Add new pane" And I click "Add ASU Directory Panel" And I press the "Browse" button - And I click on the element "li" which has property "dept_nid" with value "1344" + And I click the '[dept_nid="1359"] a.jqtree-toggler' element + And I click the '[dept_nid="1569"] a.jqtree-toggler' element + And I click on the element "li" which has property "dept_nid" with value "2163" And I click on the text " Include sub-departments?" in the "label" tag And I press the "Submit" button And I click on the element "a" which has property "href" with value "#edit-field-asu-directory-items-und-0-horizontal-tabs-advanced" @@ -36,4 +41,33 @@ Feature: Import iSearch Profiles And I press the "Save as custom" button And I click on the text "View" in the "a" tag And I click on the text "ALL" in the "li" tag - Then I should not see "No employees found." + Then I should see "Customized Drupal Developer Senior" + + @javascript @api @asu_isearch + Scenario: Run an import to update profiles, then load updated profile + Given I am at "/admin/content/isearch/import" + And I run drush "vset isearch_local_lock 1" + When I mock the migration source "asu_isearch.test_mock_one.json" + And I fill in "edit-isearch-import-limit-value" with "50" + And I press the "Begin import" button + And I wait for 30 seconds + Then I should see "Processed" + When I am at "/content/sparky-webspark" + Then I should see "Sparky Webspark" + And I should see "Customized Drupal Developer Senior" + And I should see "This is a mock bio." + When I click on the element "a" which has property "id" with value "ui-id-2" + Then I should see the "a" element with the "href" attribute set to "https://isearch.asu.edu/asu-people/testvalue" in the "Content" region + And I should see the "a" element with the "href" attribute set to "https://www.asu.edu/" in the "Content" region + When I am at "/admin/content/isearch/import" + When I mock the migration source "asu_isearch.test_mock_two.json" + And I fill in "edit-isearch-import-limit-value" with "50" + And I press the "Begin import" button + And I wait for 30 seconds + Then I should see "Updated" + When I am at "/content/sparky-webspark" + Then I should see "Super Drupal Developer Senior" + When I run drush "vset isearch_local_lock 0" + And I am at "/content/sparky-webspark" + Then I should see "Profile not found." + \ No newline at end of file diff --git a/profiles/openasu/modules/custom/webspark_test/behat/features/bootstrap/FeatureContext.php b/profiles/openasu/modules/custom/webspark_test/behat/features/bootstrap/FeatureContext.php index f39a3fc056..6d0bd9663c 100644 --- a/profiles/openasu/modules/custom/webspark_test/behat/features/bootstrap/FeatureContext.php +++ b/profiles/openasu/modules/custom/webspark_test/behat/features/bootstrap/FeatureContext.php @@ -11,6 +11,7 @@ * Define application features from the specific context. */ class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext { + /** * Initializes context. * Every scenario gets its own context object. @@ -22,4 +23,31 @@ public function __construct() { // Initialize your context here } + /** + * @When I mock the migration source :arg1 + */ + public function iMockTheMigrationSource($arg1) { + $path = $this->getMinkParameter('files_path') . '/' . $arg1; + $file_contents = file_get_contents($path); + $file = file_save_data( $file_contents, "private://isearch/feeds/asu_isearch_master.json", FILE_EXISTS_REPLACE ); + + if (!$file) { + throw new \Exception('Migration mocking failed at '.__FUNCTION__); + } + } + + /** + * @When I click the :arg1 element + */ + public function iClickTheElement($selector) + { + $page = $this->getSession()->getPage(); + $element = $page->find('css', $selector); + + if (empty($element)) { + throw new Exception("No html element found for the selector ('$selector')"); + } + + $element->click(); + } } diff --git a/profiles/openasu/modules/panopoly/panopoly_admin/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_admin/CHANGELOG.txt index 58f56a097e..fca33a159e 100644 --- a/profiles/openasu/modules/panopoly/panopoly_admin/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_admin/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly Admin 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_admin/panopoly_admin.info b/profiles/openasu/modules/panopoly/panopoly_admin/panopoly_admin.info index eced21ccc5..257b3b795d 100644 --- a/profiles/openasu/modules/panopoly/panopoly_admin/panopoly_admin.info +++ b/profiles/openasu/modules/panopoly/panopoly_admin/panopoly_admin.info @@ -37,8 +37,8 @@ features[page_manager_pages][] = panopoly_admin_layout_library features[page_manager_pages][] = panopoly_admin_page_library features[page_manager_pages][] = panopoly_admin_pane_library -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_admin" -datestamp = "1557416528" +datestamp = "1561745180" diff --git a/profiles/openasu/modules/panopoly/panopoly_core/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_core/CHANGELOG.txt index e20447af86..edf86d781c 100644 --- a/profiles/openasu/modules/panopoly/panopoly_core/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_core/CHANGELOG.txt @@ -1,3 +1,18 @@ +Panopoly Core 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- Update Panopoly Core to use views-7.x-3.22. +- Update Panopoly Core to fieldable_panels_panes-7.x-1.13. +- Update Panopoly Core to use devel-7.x-1.7. +- Update to ctools-7.x-1.15. + +7.x-1.68, 2019-05-29 +------------------- +- Update UUID to 7.x-1.3 for SA-CONTRIB-2019-052. + 7.x-1.67, 2019-05-09 ------------------- - Update default jQuery version to 1.10 on new sites. diff --git a/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.info b/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.info index 340257de00..479ed106ce 100644 --- a/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.info +++ b/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.info @@ -82,8 +82,8 @@ features_exclude[variable][panelizer_taxonomy_term:panopoly_categories_allowed_t features_exclude[variable][panelizer_defaults_taxonomy_term_panopoly_categories] = panelizer_defaults_taxonomy_term_panopoly_categories features_exclude[variable][pathauto_taxonomy_term_panopoly_categories_pattern] = pathauto_taxonomy_term_panopoly_categories_pattern -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_core" -datestamp = "1557416683" +datestamp = "1561745190" diff --git a/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.make b/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.make index 4b28c87c21..41c63b3fc4 100644 --- a/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.make +++ b/profiles/openasu/modules/panopoly/panopoly_core/panopoly_core.make @@ -5,7 +5,7 @@ core = 7.x ; Panels and Chaos Tools Magic -projects[ctools][version] = 1.14 +projects[ctools][version] = 1.15 projects[ctools][subdir] = contrib projects[ctools][patch][1000146] = https://www.drupal.org/files/issues/2018-03-26/views_panes-more_link_text-1000146-28.patch @@ -22,10 +22,8 @@ projects[panelizer][subdir] = contrib projects[panelizer][patch][1549608] = https://www.drupal.org/files/issues/panelizer-n1549608-26.patch projects[panelizer][patch][2788851] = https://www.drupal.org/files/issues/panelizer-administer-panelizer-2788851-2.patch -projects[fieldable_panels_panes][version] = 1.11 +projects[fieldable_panels_panes][version] = 1.13 projects[fieldable_panels_panes][subdir] = contrib -projects[fieldable_panels_panes][patch][2826205] = https://www.drupal.org/files/issues/fieldable_panels_panes-n2826205-39.patch -projects[fieldable_panels_panes][patch][3019270] = https://www.drupal.org/files/issues/2018-12-10/2848997-cant-access-admin-too-many-redirects.patch projects[pm_existing_pages][version] = 1.4 projects[pm_existing_pages][subdir] = contrib @@ -35,7 +33,7 @@ projects[fape][subdir] = contrib ; Views Magic -projects[views][version] = 3.21 +projects[views][version] = 3.22 projects[views][subdir] = contrib projects[views][patch][2037469] = https://www.drupal.org/files/issues/views-exposed-sorts-2037469-26.patch projects[views][patch][2885660] = https://www.drupal.org/files/issues/2018-06-28/2885660-13.patch @@ -119,7 +117,7 @@ projects[jquery_update][version] = 2.7 projects[jquery_update][subdir] = contrib ; Recommended Modules -projects[devel][version] = 1.6 +projects[devel][version] = 1.7 projects[devel][subdir] = contrib projects[distro_update][version] = 1.0-beta4 @@ -128,5 +126,5 @@ projects[distro_update][subdir] = contrib projects[features_override][version] = 2.0-rc3 projects[features_override][subdir] = contrib -projects[uuid][version] = 1.2 +projects[uuid][version] = 1.3 projects[uuid][subdir] = contrib diff --git a/profiles/openasu/modules/panopoly/panopoly_images/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_images/CHANGELOG.txt index 8d46d6a6d4..1252b38ccf 100644 --- a/profiles/openasu/modules/panopoly/panopoly_images/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_images/CHANGELOG.txt @@ -1,3 +1,17 @@ +Panopoly Images 7.x-1.70, 2019-06-28 +------------------- +- Use empty alt="" on images without alt, rather than omitting alt + attribute. +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.info b/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.info index 5c00f88d7e..6b91e13255 100644 --- a/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.info +++ b/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.info @@ -27,8 +27,8 @@ features[image][] = panopoly_image_square features[image][] = panopoly_image_thumbnail features[image][] = panopoly_image_video -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_images" -datestamp = "1557416722" +datestamp = "1561745213" diff --git a/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.module b/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.module index 5fd0670df7..78bd674f1b 100644 --- a/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.module +++ b/profiles/openasu/modules/panopoly/panopoly_images/panopoly_images.module @@ -166,6 +166,16 @@ function panopoly_images_preprocess_image_style(&$variables) { $variables['attributes']['class'][] = str_replace('_', '-', $variables['style_name']); } +/** + * Implements hook_preprocess_image(). + */ +function panopoly_images_preprocess_image(&$variables) { + // If the alt attribute is not set, set it to the empty string. + if (!isset($variables['alt'])) { + $variables['alt'] = ''; + } +} + /** * Implements hook_entity_info_alter(). */ diff --git a/profiles/openasu/modules/panopoly/panopoly_magic/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_magic/CHANGELOG.txt index b0ca487caa..53979eec13 100644 --- a/profiles/openasu/modules/panopoly/panopoly_magic/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_magic/CHANGELOG.txt @@ -1,3 +1,15 @@ +7.x-1.70, 2019-06-28 +------------------- +- No changes since last release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_magic/panopoly_magic.info b/profiles/openasu/modules/panopoly/panopoly_magic/panopoly_magic.info index d9ee600c71..c934507a01 100644 --- a/profiles/openasu/modules/panopoly/panopoly_magic/panopoly_magic.info +++ b/profiles/openasu/modules/panopoly/panopoly_magic/panopoly_magic.info @@ -15,8 +15,8 @@ stylesheets[all][] = css/panopoly-modal.css features[features_api][] = api:2 files[] = plugins/views/panopoly_magic_plugin_display_panel_pane.inc -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_magic" -datestamp = "1557416737" +datestamp = "1561745835" diff --git a/profiles/openasu/modules/panopoly/panopoly_pages/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_pages/CHANGELOG.txt index 7f9bcbd713..c17f29573f 100644 --- a/profiles/openasu/modules/panopoly/panopoly_pages/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_pages/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly Pages 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_pages/panopoly_pages.info b/profiles/openasu/modules/panopoly/panopoly_pages/panopoly_pages.info index cc5a77ed6f..539a1fa210 100644 --- a/profiles/openasu/modules/panopoly/panopoly_pages/panopoly_pages.info +++ b/profiles/openasu/modules/panopoly/panopoly_pages/panopoly_pages.info @@ -81,8 +81,8 @@ features_exclude[variable][pathauto_node_panopoly_landing_page_pattern] = pathau features_exclude[variable][pathauto_node_panopoly_page_pattern] = pathauto_node_panopoly_page_pattern features_exclude[variable][pathauto_taxonomy_term_panopoly_categories_pattern] = pathauto_taxonomy_term_panopoly_categories_pattern -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_pages" -datestamp = "1557416752" +datestamp = "1561745223" diff --git a/profiles/openasu/modules/panopoly/panopoly_search/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_search/CHANGELOG.txt index 61b04d2843..14b476b820 100644 --- a/profiles/openasu/modules/panopoly/panopoly_search/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_search/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly Search 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- Update Panopoly Search to search_api-7.x-1.26. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.info b/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.info index 42eb0cbcb5..975291345d 100644 --- a/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.info +++ b/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.info @@ -3,6 +3,7 @@ description = Indexes and searches site content, Solr or otherwise. core = 7.x package = Panopoly project = panopoly_search +dependencies[] = entity dependencies[] = facetapi dependencies[] = page_manager dependencies[] = search @@ -54,8 +55,8 @@ features[variable][] = search_cron_limit features[views_view][] = panopoly_database_search features[views_view][] = panopoly_search -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_search" -datestamp = "1557416773" +datestamp = "1561745234" diff --git a/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.make b/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.make index 69efd15bdd..764eb29ab0 100644 --- a/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.make +++ b/profiles/openasu/modules/panopoly/panopoly_search/panopoly_search.make @@ -8,7 +8,7 @@ core = 7.x projects[facetapi][version] = 1.5 projects[facetapi][subdir] = contrib -projects[search_api][version] = 1.25 +projects[search_api][version] = 1.26 projects[search_api][subdir] = contrib projects[search_api_solr][version] = 1.14 diff --git a/profiles/openasu/modules/panopoly/panopoly_test/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_test/CHANGELOG.txt index 20b26d2f7c..9ab3334ee3 100644 --- a/profiles/openasu/modules/panopoly/panopoly_test/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_test/CHANGELOG.txt @@ -1,3 +1,16 @@ +Panopoly Test 7.x-1.70, 2019-06-28 +------------------- +- Replace all scripts and Phing build process with Robo. +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_test/behat/behat.travis.yml b/profiles/openasu/modules/panopoly/panopoly_test/behat/behat.travis.yml index dee2774823..8fb293b1e3 100644 --- a/profiles/openasu/modules/panopoly/panopoly_test/behat/behat.travis.yml +++ b/profiles/openasu/modules/panopoly/panopoly_test/behat/behat.travis.yml @@ -5,11 +5,18 @@ default: Behat\MinkExtension: selenium2: wd_host: http://localhost:4444/wd/hub - capabilities: + capabilities: + extra_capabilities: + chromeOptions: + args: + - "--start-maximized" + - "--headless" + - "--disable-gpu" chrome: switches: - "--headless" - "--disable-gpu" + - "--window-size=1920,1080" - "--no-sandbox" javascript_session: selenium2 browser_name: chrome diff --git a/profiles/openasu/modules/panopoly/panopoly_test/panopoly_test.info b/profiles/openasu/modules/panopoly/panopoly_test/panopoly_test.info index 4e1d5b3029..375923f98c 100644 --- a/profiles/openasu/modules/panopoly/panopoly_test/panopoly_test.info +++ b/profiles/openasu/modules/panopoly/panopoly_test/panopoly_test.info @@ -99,8 +99,8 @@ features_exclude[dependencies][panopoly_pages] = panopoly_pages features_exclude[dependencies][panelizer] = panelizer hidden = 1 -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_test" -datestamp = "1557416798" +datestamp = "1561745246" diff --git a/profiles/openasu/modules/panopoly/panopoly_theme/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_theme/CHANGELOG.txt index 8cae93c633..fc8e2d76d4 100644 --- a/profiles/openasu/modules/panopoly/panopoly_theme/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_theme/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly Theme 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_theme/panopoly_theme.info b/profiles/openasu/modules/panopoly/panopoly_theme/panopoly_theme.info index 25b10f959c..d3aec676c8 100644 --- a/profiles/openasu/modules/panopoly/panopoly_theme/panopoly_theme.info +++ b/profiles/openasu/modules/panopoly/panopoly_theme/panopoly_theme.info @@ -11,8 +11,8 @@ stylesheets[all][] = css/panopoly-accordian.css stylesheets[all][] = css/panopoly-layouts.css features[features_api][] = api:2 -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_theme" -datestamp = "1557416819" +datestamp = "1561745256" diff --git a/profiles/openasu/modules/panopoly/panopoly_users/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_users/CHANGELOG.txt index 67656c384a..3ae252e202 100644 --- a/profiles/openasu/modules/panopoly/panopoly_users/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_users/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly Users 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_users/panopoly_users.info b/profiles/openasu/modules/panopoly/panopoly_users/panopoly_users.info index 55e2cfd1f8..8efd08c5a1 100644 --- a/profiles/openasu/modules/panopoly/panopoly_users/panopoly_users.info +++ b/profiles/openasu/modules/panopoly/panopoly_users/panopoly_users.info @@ -61,8 +61,8 @@ features_exclude[variable][panelizer_user:user_allowed_types] = panelizer_user:u features_exclude[variable][panelizer_user:user_default] = panelizer_user:user_default features_exclude[variable][panelizer_defaults_user_user] = panelizer_defaults_user_user -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_users" -datestamp = "1557416840" +datestamp = "1561745265" diff --git a/profiles/openasu/modules/panopoly/panopoly_widgets/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_widgets/CHANGELOG.txt index 452da36427..048c430481 100644 --- a/profiles/openasu/modules/panopoly/panopoly_widgets/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_widgets/CHANGELOG.txt @@ -1,3 +1,19 @@ +Panopoly Widgets 7.x-1.70, 2019-06-28 +------------------- +- Hide "Always display title" option on Submenu widget. +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- Update Panopoly Widgets to media_youtube-7.x-3.8. +- Taking "Manage Fields" paths of content type like + "admin/structure/types/manage/article/fields" redirects to wrong non-existing + path. + +7.x-1.68, 2019-05-29 +------------------- +- Update tablefield to 7.x-3.5 for SA-CONTRIB-2019-051. + 7.x-1.67, 2019-05-09 ------------------- - Allow Spotlight links to be up to 255 characters. diff --git a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.info b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.info index ccdeaa7bc8..b000f78eb8 100644 --- a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.info +++ b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.info @@ -125,8 +125,8 @@ features[linkit_profiles][] = content_fields features[views_view][] = panopoly_widgets_general_content features_exclude[dependencies][linkit] = linkit -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_widgets" -datestamp = "1557416859" +datestamp = "1561745274" diff --git a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.make b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.make index fb3468d9ec..01f5ecfd5c 100644 --- a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.make +++ b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.make @@ -5,7 +5,7 @@ core = 7.x ; Panopoly - Contrib - Fields -projects[tablefield][version] = 3.4 +projects[tablefield][version] = 3.5 projects[tablefield][subdir] = contrib projects[simple_gmap][version] = 1.4 @@ -25,7 +25,7 @@ projects[file_entity][subdir] = contrib projects[media][version] = 2.21 projects[media][subdir] = contrib -projects[media_youtube][version] = 3.7 +projects[media_youtube][version] = 3.8 projects[media_youtube][subdir] = contrib projects[media_vimeo][version] = 2.1 diff --git a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.module b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.module index 400fb27168..86e5cdfe92 100644 --- a/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.module +++ b/profiles/openasu/modules/panopoly/panopoly_widgets/panopoly_widgets.module @@ -270,6 +270,12 @@ function panopoly_widgets_form_alter(&$form, &$form_state, $form_id) { // and makes sense with that option. $form['expanded']['#weight'] = 8; $form['expanded']['#title'] = t('Expand children of this tree.'); + + // Hide the 'Always display title' option that only useful in rare edge + // cases. + if (!empty($form['display_empty'])) { + $form['display_empty']['#access'] = FALSE; + } } if ($form_id == 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form') { @@ -378,9 +384,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_link.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/quick-links', + 'real path' => 'admin/structure/fieldable-panels-panes/quick-links', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -393,9 +399,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_file.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/basic-file', + 'real path' => 'admin/structure/fieldable-panels-panes/basic-file', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -408,9 +414,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_image.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/image', + 'real path' => 'admin/structure/fieldable-panels-panes/image', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -423,9 +429,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_text.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/text', + 'real path' => 'admin/structure/fieldable-panels-panes/text', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -438,9 +444,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_map.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/map', + 'real path' => 'admin/structure/fieldable-panels-panes/map', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -453,9 +459,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_table.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/table', + 'real path' => 'admin/structure/fieldable-panels-panes/table', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -468,9 +474,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_video.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/video', + 'real path' => 'admin/structure/fieldable-panels-panes/video', 'access arguments' => array('administer fieldable panels panes'), ), ); @@ -483,9 +489,9 @@ function panopoly_widgets_entity_info_alter(&$entity_info) { 'pane top level' => TRUE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_spotlight.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/spotlight', + 'real path' => 'admin/structure/fieldable-panels-panes/spotlight', 'access arguments' => array('administer fieldable panels panes'), ), ); diff --git a/profiles/openasu/modules/panopoly/panopoly_wysiwyg/CHANGELOG.txt b/profiles/openasu/modules/panopoly/panopoly_wysiwyg/CHANGELOG.txt index 27151f44c4..151ecd53f3 100644 --- a/profiles/openasu/modules/panopoly/panopoly_wysiwyg/CHANGELOG.txt +++ b/profiles/openasu/modules/panopoly/panopoly_wysiwyg/CHANGELOG.txt @@ -1,3 +1,15 @@ +Panopoly WYSIWYG 7.x-1.70, 2019-06-28 +------------------- +- Getting ready for the 1.69 release. + +7.x-1.69, 2019-06-07 +------------------- +- No changes since last release. + +7.x-1.68, 2019-05-29 +------------------- +- No changes since last release. + 7.x-1.67, 2019-05-09 ------------------- - No changes since last release. diff --git a/profiles/openasu/modules/panopoly/panopoly_wysiwyg/panopoly_wysiwyg.info b/profiles/openasu/modules/panopoly/panopoly_wysiwyg/panopoly_wysiwyg.info index 224c067350..72d75ed0ba 100644 --- a/profiles/openasu/modules/panopoly/panopoly_wysiwyg/panopoly_wysiwyg.info +++ b/profiles/openasu/modules/panopoly/panopoly_wysiwyg/panopoly_wysiwyg.info @@ -33,8 +33,8 @@ features[variable][] = media_wysiwyg_wysiwyg_browser_plugins features[wysiwyg][] = panopoly_html_text features[wysiwyg][] = panopoly_wysiwyg_text -; Information added by Drupal.org packaging script on 2019-05-09 -version = "7.x-1.67" +; Information added by Drupal.org packaging script on 2019-06-28 +version = "7.x-1.70" core = "7.x" project = "panopoly_wysiwyg" -datestamp = "1557416877" +datestamp = "1561745483" diff --git a/profiles/openasu/modules/webspark_featurescustom/uto_carousel/CHANGELOG b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/CHANGELOG new file mode 100644 index 0000000000..3e7563f799 --- /dev/null +++ b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/CHANGELOG @@ -0,0 +1,4 @@ +uto_carousel 7.x-1.8 +-------------------- +- Fixed bug where field settings summary was being returned as array instead of string +- Added flexslider dependency \ No newline at end of file diff --git a/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.info b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.info index 0bb45dd4cd..37a84e85ce 100644 --- a/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.info +++ b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.info @@ -2,7 +2,7 @@ name = ASU Webspark Carousel description = Adds the option of a content carousel of formatted text and images core = 7.x package = ASU Webspark -version = 7.x-1.7 +version = 7.x-1.8 project = uto_carousel dependencies[] = ctools dependencies[] = defaultconfig @@ -10,6 +10,7 @@ dependencies[] = features dependencies[] = fieldable_panels_panes dependencies[] = image dependencies[] = strongarm +dependencies[] = flexslider scripts[] = js/jquery.flexslider-min.js scripts[] = js/webspark_carousel.js stylesheets[all][] = css/webspark_carousel.css diff --git a/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.spotlight.inc b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.spotlight.inc index 1802762db0..c07bd7c2a2 100644 --- a/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.spotlight.inc +++ b/profiles/openasu/modules/webspark_featurescustom/uto_carousel/uto_carousel.spotlight.inc @@ -162,11 +162,9 @@ function uto_carousel_field_formatter_settings_summary($field, $instance, $view_ $display = $instance['display'][$view_mode]; $settings = $display['settings']; - $summary = array(); + $summary = t('Image Style: @style', array('@style' => $settings['image_style'])). '
    '; - $summary[] = t('Image Style: @style', array('@style' => $settings['image_style'])); - - $summary[] = !empty($settings['caption']) ? t('Display captions') : t('Do not display captions'); + $summary .= (!empty($settings['caption']) ? t('Display captions') : t('Do not display captions')) . '
    '; // Load option set ctools_include('export'); @@ -175,7 +173,7 @@ function uto_carousel_field_formatter_settings_summary($field, $instance, $view_ } $optionset = isset($optionset) ? $optionset->title : t('Default settings'); - $summary[] = t('Option set: %optionset', array('%optionset' => $optionset)); + $summary .= t('Option set: %optionset', array('%optionset' => $optionset)); return $summary; } diff --git a/profiles/openasu/openasu.info b/profiles/openasu/openasu.info index b738151023..665a067fe0 100644 --- a/profiles/openasu/openasu.info +++ b/profiles/openasu/openasu.info @@ -5,7 +5,7 @@ core = 7.x exclusive = 1 ; Remember to update in innovation as well for DOM -version = 1.67 +version = 1.70 ; Drupal Core dependencies[] = taxonomy diff --git a/profiles/openasu/openasu.make b/profiles/openasu/openasu.make index 76b237f8c5..b98197c17a 100644 --- a/profiles/openasu/openasu.make +++ b/profiles/openasu/openasu.make @@ -15,45 +15,45 @@ projects[drupal][patch][1803048] = patches/ws-1514_array-flip-error-travis-ci-te ; The Panopoly Foundation ;;;;;;;;;;;;;;;;;;;;;;;;;;; -projects[panopoly_core][version] = 1.67 +projects[panopoly_core][version] = 1.70 projects[panopoly_core][subdir] = panopoly -projects[panopoly_images][version] = 1.67 +projects[panopoly_images][version] = 1.70 projects[panopoly_images][subdir] = panopoly -projects[panopoly_theme][version] = 1.67 +projects[panopoly_theme][version] = 1.70 projects[panopoly_theme][subdir] = panopoly -projects[panopoly_magic][version] = 1.67 +projects[panopoly_magic][version] = 1.70 projects[panopoly_magic][subdir] = panopoly ; Validation error with reusable FPPs. Updated in 1.52; Custom patch different from drupal.org/node/2813395 projects[panopoly_magic][patch][2813395] = patches/ws-1236_title-cant-reuse-error_2813395.patch -projects[panopoly_widgets][version] = 1.67 +projects[panopoly_widgets][version] = 1.70 projects[panopoly_widgets][subdir] = panopoly -projects[panopoly_admin][version] = 1.67 +projects[panopoly_admin][version] = 1.70 projects[panopoly_admin][subdir] = panopoly -projects[panopoly_users][version] = 1.67 +projects[panopoly_users][version] = 1.70 projects[panopoly_users][subdir] = panopoly ; The Panopoly Toolset -projects[panopoly_pages][version] = 1.67 +projects[panopoly_pages][version] = 1.70 projects[panopoly_pages][subdir] = panopoly -projects[panopoly_wysiwyg][version] = 1.67 +projects[panopoly_wysiwyg][version] = 1.70 projects[panopoly_wysiwyg][subdir] = panopoly -projects[panopoly_search][version] = 1.67 +projects[panopoly_search][version] = 1.70 projects[panopoly_search][subdir] = panopoly ; Fixes DB update dependency ordering ; projects[panopoly_search][patch][2766677] = patches/panopoly-search-update-dependency-2766677-1.patch -projects[panopoly_test][version] = 1.67 +projects[panopoly_test][version] = 1.70 projects[panopoly_test][subdir] = panopoly ; ASU custom tests and modifications -;projects[panopoly_test][patch][137] = patches/webspark-847_panopoly-test-137-update-v-1.46.patch +projects[panopoly_test][patch][137] = patches/webspark-847_panopoly-test-137-update-v-1.46.patch projects[panopoly_test][patch][1370] = patches/webspark-847_behat_common.patch projects[panopoly_test][patch][142] = patches/webspark-944_add-init-config-tests-panopoly-test.patch projects[panopoly_test][patch][143] = patches/webspark-1066-panopoly-test-v146.patch @@ -114,13 +114,15 @@ projects[smtp][download][type] = "git" projects[smtp][download][branch] = "7.x-1.x" projects[smtp][download][url] = "https://git.drupalcode.org/project/smtp.git" projects[smtp][download][revision] = "47f4114b1e6d357708b6ffcade01241a11c41ef1" +; https://www.drupal.org/project/webform/issues/2966816 +projects[smtp][patch][] = https://www.drupal.org/files/issues/2018-11-13/smtp-filepath_uri-2966816-27-D7_0.patch + projects[viewfield][version] = 2.0 projects[viewfield][type] = module projects[viewfield][subdir] = contrib -; Don't update to v4.17 until https://www.drupal.org/project/webform/issues/2966816 is worked out -projects[webform][version] = 4.16 +projects[webform][version] = 4.19 projects[webform][type] = module projects[webform][subdir] = contrib @@ -152,11 +154,12 @@ projects[entity_view_mode][version] = 1.0-rc1 projects[entity_view_mode][type] = module projects[entity_view_mode][subdir] = contrib +; field_collection latest dev verion as of 06/25/2019 projects[field_collection][type] = module projects[field_collection][subdir] = contrib projects[field_collection][download][branch] = "7.x-1.x" projects[field_collection][download][url] = "https://git.drupalcode.org/project/field_collection.git" -projects[field_collection][download][revision] = "605e0e4e029edf7a2adea41ad59849fd25bc8ed3" +projects[field_collection][download][revision] = "5f127681fcada4df97ce2903e65e1e4c52cc0dcd" projects[flexslider][version] = 2.0-rc2 projects[flexslider][type] = module diff --git a/profiles/openasu/openasu_panopoly_patches.make b/profiles/openasu/openasu_panopoly_patches.make index 1eaf471767..2b0d82efe5 100644 --- a/profiles/openasu/openasu_panopoly_patches.make +++ b/profiles/openasu/openasu_panopoly_patches.make @@ -67,9 +67,7 @@ projects[media][patch][679] = patches/webspark-679_fix-HTML-encoded-macros-20282 ; WEBSPARK-1404 projects[views][type] = module projects[views][subdir] = contrib -projects[views][version] = 3.21 -projects[views][patch][] = https://www.drupal.org/files/issues/2018-06-28/2885660-13.patch -projects[views][patch][] = https://www.drupal.org/files/issues/2019-03-13/2977851-views-php72-count-8.patch +projects[views][version] = 3.23 projects[views][patch][] = https://www.drupal.org/files/issues/views-exposed-sorts-2037469-26.patch projects[views][patch][] = patches/webspark-1404_set-views-handler-filter-maxlength-to-null.patch diff --git a/profiles/openasu/themes/innovation/template.php b/profiles/openasu/themes/innovation/template.php index 4218b98e4a..bfc38525f5 100644 --- a/profiles/openasu/themes/innovation/template.php +++ b/profiles/openasu/themes/innovation/template.php @@ -38,7 +38,7 @@ function innovation_preprocess_html(&$variables) { '#tag' => 'meta', '#attributes' => array( // Don't forget to update openasu.info as well!! - 'content' => 'Webspark:1.67 (Iowa)', + 'content' => 'Webspark:1.70 (Texas)', 'http-equiv' => 'X-Name-of-Distro', 'name' => 'cmsversion', )