' . 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 .= '
';
@@ -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']) . '
' . 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