security upadtes

This commit is contained in:
Bachir Soussi Chiadmi
2017-09-25 15:16:35 +02:00
parent 650c6448e4
commit 8d8a60b615
240 changed files with 3022 additions and 1300 deletions

View File

@@ -1,19 +1,50 @@
CONTENTS OF THIS FILE
---------------------
* Introduction
* Requirements
* Installation
* Configuration
* Recommended
INTRODUCTION
------------
Welcome to Views 3. Please see the advanced help for more information.
If you're having trouble installing this module, please ensure that your
tar program is not flattening the directory tree, truncating filenames
or losing files.
If you're having trouble installing this module, please ensure that your tar
program is not flattening the directory tree, truncating filenames or losing
files.
Installing Views:
Place the entirety of this directory in sites/all/modules/views
You must also install the CTools module (http://www.drupal.org/project/ctools) to use Views.
REQUIREMENTS
------------
Navigate to administer >> build >> modules. Enable Views and Views UI.
This module requires the following modules:
If you're new to Views, try the Simple Views module which can create some
often used Views for you, this might save you some time.
* Chaos tool suite (ctools) (https://drupal.org/project/ctools)
Here you can find many modules extending the functionality of Views:
http://drupal.org/taxonomy/term/89
INSTALLATION
------------
Install as you would normally install a contributed Drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7 for further
information.
Navigate to administer >> modules. Enable Views and Views UI.
RECOMMENDED
-----------
* SimpleViews (https://www.drupal.org/project/simpleviews):
If you're new to Views, try the Simple Views which can create some often used
Views for you, this might save you some time.
* Advanced help (https://www.drupal.org/project/advanced_help):
If you enable the advanced help, Views will provide more and better help.
* Here you can find many modules extending the functionality of Views:
http://drupal.org/taxonomy/term/89

View File

@@ -22,7 +22,7 @@
*/
.form-actions {
float: left;
float: right;
}
/* @end */

View File

@@ -61,7 +61,6 @@ class views_handler_area_result extends views_handler_area {
// Calculate the page totals.
$current_page = (int) $this->view->get_current_page() + 1;
$per_page = (int) $this->view->get_items_per_page();
$count = count($this->view->result);
// @TODO: Maybe use a possible is views empty functionality.
// Not every view has total_rows set, use view->result instead.
$total = isset($this->view->total_rows) ? $this->view->total_rows : count($this->view->result);

View File

@@ -589,8 +589,11 @@ class views_handler_filter extends views_handler {
form_error($form['expose']['identifier'], t('The identifier is required if the filter is exposed.'));
}
if (!empty($form_state['values']['options']['expose']['identifier']) && $form_state['values']['options']['expose']['identifier'] == 'value') {
form_error($form['expose']['identifier'], t('This identifier is not allowed.'));
if (!empty($form_state['values']['options']['expose']['identifier'])) {
$illegal_identifiers = array('value', 'q');
if (in_array($form_state['values']['options']['expose']['identifier'], $illegal_identifiers)) {
form_error($form['expose']['identifier'], t('This identifier is not allowed.'));
}
}
if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) {
@@ -607,8 +610,11 @@ class views_handler_filter extends views_handler {
form_error($form['group_info']['identifier'], t('The identifier is required if the filter is exposed.'));
}
if (!empty($form_state['values']['options']['group_info']['identifier']) && $form_state['values']['options']['group_info']['identifier'] == 'value') {
form_error($form['group_info']['identifier'], t('This identifier is not allowed.'));
if (!empty($form_state['values']['options']['group_info']['identifier'])) {
$illegal_identifiers = array('value', 'q');
if (in_array($form_state['values']['options']['group_info']['identifier'], $illegal_identifiers)) {
form_error($form['group_info']['identifier'], t('This identifier is not allowed.'));
}
}
if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['group_info']['identifier'])) {

View File

@@ -18,6 +18,7 @@ function yourmodule_views_data() {
'handler' => 'yourmodule_handler_collapsible_area_text',
),
);
return $data;
}
</pre>

View File

@@ -994,7 +994,7 @@ function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) {
// @todo When more functionality is added to this form, cloning here may be
// too soon. But some of what we do with $view later in this function
// results in making it unserializable due to PDO limitations.
$form_state['view'] = clone($view);
$form_state['view'] = clone $view;
$form['#attached']['library'][] = array('system', 'ui.tabs');
$form['#attached']['library'][] = array('system', 'ui.dialog');

View File

@@ -40,15 +40,18 @@ function views_ajax() {
// Load the view.
$view = views_get_view($name);
if ($view && $view->access($display_id)) {
if ($view && $view->access($display_id) && $view->set_display($display_id) && $view->display_handler->use_ajax()) {
// Fix 'q' for paging.
if (!empty($path)) {
$_GET['q'] = $path;
}
// Add all $_POST data, because AJAX is always a post and many things,
// If page parameter is in the $_POST exclude it from $_GET,
// otherwise support views_ajax requests using $_GET.
$exclude = isset($_POST['page']) ? array('page') : array();
// Add all $_POST data to $_GET as many things,
// such as tablesorts, exposed filters and paging assume $_GET.
$_GET = $_POST + drupal_get_query_parameters($_GET, array('page'));
$_GET = $_POST + drupal_get_query_parameters($_GET, $exclude);
// Overwrite the destination.
// @see drupal_get_destination()
@@ -343,7 +346,7 @@ function views_ajax_autocomplete_taxonomy($vid, $tags_typed = '') {
$query = db_select('taxonomy_term_data', 't');
$query->addTag('translatable');
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
// Do not select already entered terms.
if (!empty($tags_typed)) {

View File

@@ -1544,9 +1544,16 @@ class views_join {
// Tack on the extra.
if (isset($this->extra)) {
if (is_array($this->extra)) {
$extras = array();
foreach ($this->extra as $info) {
// If extra has been provided as string instead of an array, convert it
// to an array.
if (!is_array($this->extra)) {
$this->extra = array($this->extra);
}
$extras = array();
foreach ($this->extra as $info) {
if (is_array($info)) {
$extra = '';
// Figure out the table name. Remember, only use aliases provided
// if at all possible.
$join_table = '';
@@ -1564,76 +1571,49 @@ class views_join {
}
}
// If left_field is set use it for a field-to-field condition.
if (!empty($info['left_field'])) {
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$left_table = (isset($info['left_table'])) ? $info['left_table'] : $left['alias'];
$extras[] = "$join_table$info[field] $operator $left_table.$info[left_field]";
}
// Else if formula is set, us it for a flexible on clause.
elseif (!empty($info['formula'])) {
// If a field is given, we build a "$field $op $formula".
// Without it would only be "$formula".
$extra = '';
if (isset($info['field'])) {
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$extra .= "$join_table$info[field] $operator ";
}
$extra .= $info['formula'];
// Add placeholder arguments.
if (isset($info['formula_arguments']) && is_array($info['formula_arguments'])) {
$arguments = array_merge($arguments, $info['formula_arguments']);
}
$extras[] = $extra;
}
// Otherwise - and if we have a value - use it for a field-to-value condition.
elseif (!empty($info['value'])) {
// Convert a single-valued array of values to the single-value case,
// and transform from IN() notation to = notation
if (is_array($info['value']) && count($info['value']) == 1) {
if (empty($info['operator'])) {
$operator = '=';
}
else {
$operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
}
$info['value'] = array_shift($info['value']);
}
if (is_array($info['value'])) {
// With an array of values, we need multiple placeholders and the
// 'IN' operator is implicit.
foreach ($info['value'] as $value) {
$placeholder_i = ':views_join_condition_' . $select_query->nextPlaceholder();
$arguments[$placeholder_i] = $value;
}
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
// Convert a single-valued array of values to the single-value case,
// and transform from IN() notation to = notation
if (is_array($info['value']) && count($info['value']) == 1) {
if (empty($info['operator'])) {
$operator = '=';
}
else {
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$placeholder = ':views_join_condition_' . $select_query->nextPlaceholder();
$arguments[$placeholder] = $info['value'];
$operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
}
$info['value'] = array_shift($info['value']);
}
if (is_array($info['value'])) {
// With an array of values, we need multiple placeholders and the
// 'IN' operator is implicit.
foreach ($info['value'] as $value) {
$placeholder_i = $view_query->placeholder('views_join_condition_');
$arguments[$placeholder_i] = $value;
}
$extras[] = "$join_table$info[field] $operator $placeholder";
}
}
if ($extras) {
if (count($extras) == 1) {
$condition .= ' AND ' . array_shift($extras);
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
}
else {
$condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$placeholder = $view_query->placeholder('views_join_condition_');
$arguments[$placeholder] = $info['value'];
}
$extras[] = "$join_table$info[field] $operator $placeholder";
}
elseif (is_string($info)) {
$extras[] = $info;
}
}
elseif ($this->extra && is_string($this->extra)) {
$condition .= " AND ($this->extra)";
if ($extras) {
if (count($extras) == 1) {
$condition .= ' AND ' . array_shift($extras);
}
else {
$condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
}
}
}
@@ -1681,11 +1661,19 @@ class views_join_subquery extends views_join {
$arguments = array();
// Tack on the extra.
// This is just copied verbatim from the parent class, which itself has a bug: http://drupal.org/node/1118100
// This is just copied verbatim from the parent class, which itself has a
// bug: http://drupal.org/node/1118100
if (isset($this->extra)) {
if (is_array($this->extra)) {
$extras = array();
foreach ($this->extra as $info) {
// If extra has been provided as string instead of an array, convert it
// to an array.
if (!is_array($this->extra)) {
$this->extra = array($this->extra);
}
$extras = array();
foreach ($this->extra as $info) {
if (is_array($info)) {
$extra = '';
// Figure out the table name. Remember, only use aliases provided
// if at all possible.
$join_table = '';
@@ -1713,18 +1701,18 @@ class views_join_subquery extends views_join {
$extras[] = "$join_table$info[field] $operator $placeholder";
$arguments[$placeholder] = $info['value'];
}
if ($extras) {
if (count($extras) == 1) {
$condition .= ' AND ' . array_shift($extras);
}
else {
$condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
}
elseif (is_string($info)) {
$extras[] = $info;
}
}
elseif ($this->extra && is_string($this->extra)) {
$condition .= " AND ($this->extra)";
if ($extras) {
if (count($extras) == 1) {
$condition .= ' AND ' . array_shift($extras);
}
else {
$condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
}
}
}

View File

@@ -411,18 +411,8 @@ class view extends views_db_object {
* Figure out what the exposed input for this view is.
*/
function get_exposed_input() {
// Fill our input either from $_GET or from something previously set on the
// view.
if (empty($this->exposed_input)) {
$this->exposed_input = $_GET;
// unset items that are definitely not our input:
foreach (array('page', 'q') as $key) {
if (isset($this->exposed_input[$key])) {
unset($this->exposed_input[$key]);
}
}
// If we have no input at all, check for remembered input via session.
$this->exposed_input = array();
// If filters are not overridden, store the 'remember' settings on the
// default display. If they are, store them on this display. This way,
@@ -430,9 +420,17 @@ class view extends views_db_object {
// remember settings.
$display_id = ($this->display_handler->is_defaulted('filters')) ? 'default' : $this->current_display;
if (empty($this->exposed_input) && !empty($_SESSION['views'][$this->name][$display_id])) {
// Start with remembered input via session.
if (!empty($_SESSION['views'][$this->name][$display_id])) {
$this->exposed_input = $_SESSION['views'][$this->name][$display_id];
}
// Fetch exposed input values from $_GET. Overwrite if clashing.
foreach ($_GET as $key => $value) {
if (!in_array($key, array('page', 'q'))) {
$this->exposed_input[$key] = $value;
}
}
}
return $this->exposed_input;
@@ -685,6 +683,10 @@ class view extends views_db_object {
*/
function init_pager() {
if (empty($this->query->pager)) {
// If the query doesn't exist, initialize it.
if (empty($this->query)) {
$this->init_query();
}
$this->query->pager = $this->display_handler->get_plugin('pager');
if ($this->query->pager->use_pager()) {
@@ -1282,7 +1284,7 @@ class view extends views_db_object {
foreach ($GLOBALS['base_theme_info'] as $base) {
$function = $base->name . '_views_post_render';
if (function_exists($function)) {
$function($this);
$function($this, $this->display_handler->output, $cache);
}
}
$function = $GLOBALS['theme'] . '_views_post_render';
@@ -1478,7 +1480,7 @@ class view extends views_db_object {
* this sets the display handler if it hasn't been.
*/
function access($displays = NULL, $account = NULL) {
// Noone should have access to disabled views.
// No one should have access to disabled views.
if (!empty($this->disabled)) {
return FALSE;
}
@@ -1960,12 +1962,12 @@ class view extends views_db_object {
* The cloned view.
*/
function clone_view() {
$clone = version_compare(phpversion(), '5.0') < 0 ? $this : clone($this);
$clone = clone $this;
$keys = array('current_display', 'display_handler', 'build_info', 'built', 'executed', 'attachment_before', 'attachment_after', 'field', 'argument', 'filter', 'sort', 'relationship', 'header', 'footer', 'empty', 'query', 'inited', 'style_plugin', 'plugin_name', 'exposed_data', 'exposed_input', 'exposed_widgets', 'many_to_one_tables', 'feed_icon');
foreach ($keys as $key) {
if (isset($clone->$key)) {
unset($clone->$key);
if (isset($clone->{$key})) {
unset($clone->{$key});
}
}
$clone->built = $clone->executed = FALSE;
@@ -1994,7 +1996,7 @@ class view extends views_db_object {
*/
function destroy() {
foreach (array_keys($this->display) as $display_id) {
if (isset($this->display[$display_id]->handler)) {
if (isset($this->display[$display_id]->handler) && is_object($this->display[$display_id]->handler)) {
$this->display[$display_id]->handler->destroy();
unset($this->display[$display_id]->handler);
}

View File

@@ -60,6 +60,9 @@ Drupal.views.ajaxView = function(settings) {
this.$exposed_form = $('#views-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-'));
this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this));
// Store Drupal.ajax objects here for all pager links.
this.links = [];
// Add the ajax to pagers.
this.$view
// Don't attach to nested views. Doing so would attach multiple behaviors
@@ -123,6 +126,7 @@ Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) {
this.element_settings.submit = viewData;
this.pagerAjax = new Drupal.ajax(false, $link, this.element_settings);
this.links.push(this.pagerAjax);
};
Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) {

View File

@@ -64,6 +64,11 @@ Drupal.Views.parseQueryString = function (query) {
* Helper function to return a view's arguments based on a path.
*/
Drupal.Views.parseViewArgs = function (href, viewPath) {
// Provide language prefix.
if (Drupal.settings.pathPrefix) {
var viewPath = Drupal.settings.pathPrefix + viewPath;
}
var returnObj = {};
var path = Drupal.Views.getPath(href);
// Ensure we have a correct path.
@@ -99,7 +104,7 @@ Drupal.Views.getPath = function (href) {
href = href.substring(3, href.length);
}
var chars = ['#', '?', '&'];
for (i in chars) {
for (var i in chars) {
if (href.indexOf(chars[i]) > -1) {
href = href.substr(0, href.indexOf(chars[i]));
}

View File

@@ -168,6 +168,59 @@ function comment_views_data() {
),
);
$data['comment']['created_fulldata'] = array(
'title' => t('Created date'),
'help' => t('Date in the form of CCYYMMDD.'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_fulldate',
),
);
$data['comment']['created_year_month'] = array(
'title' => t('Created year + month'),
'help' => t('Date in the form of YYYYMM.'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_year_month',
),
);
$data['comment']['created_year'] = array(
'title' => t('Created year'),
'help' => t('Date in the form of YYYY.'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_year',
),
);
$data['comment']['created_month'] = array(
'title' => t('Created month'),
'help' => t('Date in the form of MM (01 - 12).'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_month',
),
);
$data['comment']['created_day'] = array(
'title' => t('Created day'),
'help' => t('Date in the form of DD (01 - 31).'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_day',
),
);
$data['comment']['created_week'] = array(
'title' => t('Created week'),
'help' => t('Date in the form of WW (01 - 53).'),
'argument' => array(
'field' => 'created',
'handler' => 'views_handler_argument_node_created_week',
),
);
// Language field
if (module_exists('locale')) {
@@ -209,7 +262,7 @@ function comment_views_data() {
$data['comments']['timestamp_fulldate']['moved to'] = array('comment', 'changed_fulldata');
$data['comment']['changed_fulldata'] = array(
'title' => t('Created date'),
'title' => t('Changed date'),
'help' => t('Date in the form of CCYYMMDD.'),
'argument' => array(
'field' => 'changed',
@@ -219,7 +272,7 @@ function comment_views_data() {
$data['comments']['timestamp_year_month']['moved to'] = array('comment', 'changed_year_month');
$data['comment']['changed_year_month'] = array(
'title' => t('Created year + month'),
'title' => t('Changed year + month'),
'help' => t('Date in the form of YYYYMM.'),
'argument' => array(
'field' => 'changed',
@@ -229,7 +282,7 @@ function comment_views_data() {
$data['comments']['timestamp_year']['moved to'] = array('comment', 'changed_year');
$data['comment']['changed_year'] = array(
'title' => t('Created year'),
'title' => t('Changed year'),
'help' => t('Date in the form of YYYY.'),
'argument' => array(
'field' => 'changed',
@@ -239,7 +292,7 @@ function comment_views_data() {
$data['comments']['timestamp_month']['moved to'] = array('comment', 'changed_month');
$data['comment']['changed_month'] = array(
'title' => t('Created month'),
'title' => t('Changed month'),
'help' => t('Date in the form of MM (01 - 12).'),
'argument' => array(
'field' => 'changed',
@@ -249,7 +302,7 @@ function comment_views_data() {
$data['comments']['timestamp_day']['moved to'] = array('comment', 'changed_day');
$data['comment']['changed_day'] = array(
'title' => t('Created day'),
'title' => t('Changed day'),
'help' => t('Date in the form of DD (01 - 31).'),
'argument' => array(
'field' => 'changed',
@@ -259,7 +312,7 @@ function comment_views_data() {
$data['comments']['timestamp_week']['moved to'] = array('comment', 'changed_week');
$data['comment']['changed_week'] = array(
'title' => t('Created week'),
'title' => t('Changed week'),
'help' => t('Date in the form of WW (01 - 53).'),
'argument' => array(
'field' => 'changed',

View File

@@ -733,7 +733,7 @@ function node_row_node_view_preprocess_node(&$vars) {
unset($vars['content']['links']);
}
if (!empty($options['comments']) && user_access('access comments') && $node->comment) {
if (module_exists('comment') && !empty($options['comments']) && user_access('access comments') && $node->comment) {
$vars['content']['comments'] = comment_node_page_additions($node);
}
}

View File

@@ -33,7 +33,10 @@ class views_handler_argument_node_created_fulldate extends views_handler_argumen
* Provide a link to the next level of the view
*/
function title() {
return format_date(strtotime($this->argument . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
$timestamp = strtotime($this->argument . " 00:00:00 UTC");
if ($timestamp !== FALSE) {
return format_date($timestamp, 'custom', $this->format, 'UTC');
}
}
}
@@ -77,7 +80,10 @@ class views_handler_argument_node_created_year_month extends views_handler_argum
* Provide a link to the next level of the view
*/
function title() {
return format_date(strtotime($this->argument . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
$timestamp = strtotime($this->argument . "15" . " 00:00:00 UTC");
if ($timestamp !== FALSE) {
return format_date($timestamp, 'custom', $this->format, 'UTC');
}
}
}
@@ -108,7 +114,10 @@ class views_handler_argument_node_created_month extends views_handler_argument_d
*/
function title() {
$month = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
return format_date(strtotime("2005" . $month . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
$timestamp = strtotime("2005" . $month . "15" . " 00:00:00 UTC");
if ($timestamp !== FALSE) {
return format_date($timestamp, 'custom', $this->format, 'UTC');
}
}
function summary_argument($data) {
@@ -145,7 +154,10 @@ class views_handler_argument_node_created_day extends views_handler_argument_dat
*/
function title() {
$day = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
$timestamp = strtotime("2005" . "05" . $day . " 00:00:00 UTC");
if ($timestamp !== FALSE) {
return format_date($timestamp, 'custom', $this->format, 'UTC');
}
}
function summary_argument($data) {

View File

@@ -61,6 +61,7 @@ class views_plugin_row_node_view extends views_plugin_row {
'#type' => 'checkbox',
'#title' => t('Display comments'),
'#default_value' => $this->options['comments'],
'#access' => module_exists('comment'),
);
}
@@ -107,4 +108,4 @@ class views_plugin_row_node_view extends views_plugin_row {
return drupal_render($build);
}
}
}
}

View File

@@ -43,14 +43,14 @@ function search_views_data() {
'left_table' => 'search_index',
'left_field' => 'sid',
'field' => 'sid',
'extra' => 'search_index.type = search_dataset.type',
'extra' => array('search_index.type = search_dataset.type'),
'type' => 'INNER',
),
'users' => array(
'left_table' => 'search_index',
'left_field' => 'sid',
'field' => 'sid',
'extra' => 'search_index.type = search_dataset.type',
'extra' => array('search_index.type = search_dataset.type'),
'type' => 'INNER',
),
);

View File

@@ -42,7 +42,7 @@ class views_handler_argument_search extends views_handler_argument {
}
}
if ($required) {
if ($this->operator == 'required') {
if (isset($this->operator) && ($this->operator == 'required')) {
$this->query->add_where(0, 'FALSE');
}
}

View File

@@ -45,7 +45,7 @@ class views_handler_filter_search extends views_handler_filter {
$form['remove_score'] = array(
'#type' => 'checkbox',
'#title' => t('Remove search score'),
'#description' => t('Check this box to remove the search score from the query. This can help reduce help reduce duplicate search results when using this filter.'),
'#description' => t('Check this box to remove the search score from the query. This can help reduce duplicate search results when using this filter.'),
'#default_value' => $this->options['remove_score'],
);
}

View File

@@ -114,7 +114,7 @@ function taxonomy_views_data() {
'field' => 'tid',
'title' => t('Term'),
'help' => t('Taxonomy terms are attached to nodes.'),
'access query tag' => 'term_access',
'access query tag' => 'taxonomy_term_access',
);
$data['taxonomy_term_data']['table']['entity type'] = 'taxonomy_term';

View File

@@ -38,6 +38,7 @@ class views_handler_argument_term_node_tid extends views_handler_argument_many_t
function title_query() {
$titles = array();
$result = db_select('taxonomy_term_data', 'td')
->addTag('taxonomy_term_access')
->fields('td', array('name'))
->condition('td.tid', $this->value)
->execute();

View File

@@ -22,6 +22,7 @@ class views_handler_field_taxonomy extends views_handler_field {
parent::construct();
$this->additional_fields['vid'] = 'vid';
$this->additional_fields['tid'] = 'tid';
$this->additional_fields['name'] = 'name';
$this->additional_fields['vocabulary_machine_name'] = array(
'table' => 'taxonomy_vocabulary',
'field' => 'machine_name',
@@ -65,10 +66,18 @@ class views_handler_field_taxonomy extends views_handler_field {
$term = new stdClass();
$term->tid = $tid;
$term->vid = $this->get_value($values, 'vid');
$term->name = $this->get_value($values, 'name');
$term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']};
$this->options['alter']['make_link'] = TRUE;
$uri = entity_uri('taxonomy_term', $term);
if (isset($uri['options'])) {
$this->options['alter'] = array_merge($this->options['alter'], $uri['options']);
}
$this->options['alter']['path'] = $uri['path'];
// If entity_uri() returned an options array, use it.
if (isset($uri['options'])) {
$this->options['alter'] = $uri['options'] + $this->options['alter'];
}
}
if (!empty($this->options['convert_spaces'])) {

View File

@@ -104,7 +104,7 @@ class views_handler_field_term_node_tid extends views_handler_field_prerender_li
$query->orderby('td.weight');
$query->orderby('td.name');
$query->condition('tn.nid', $nids);
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
$vocabs = array_filter($this->options['vocabularies']);
if (!empty($this->options['limit']) && !empty($vocabs)) {
$query->condition('tv.machine_name', $vocabs);

View File

@@ -140,7 +140,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
$query->orderby('tv.name');
$query->orderby('td.weight');
$query->orderby('td.name');
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
if ($this->options['limit']) {
$query->condition('tv.machine_name', $vocabulary->machine_name);
}
@@ -275,7 +275,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
// We only validate if they've chosen the text field style.
if ($this->options['type'] != 'textfield') {
if ($form_state['values'][$identifier] != 'All') {
if (isset($form_state['values'][$identifier]) && $form_state['values'][$identifier] != 'All') {
$this->validated_exposed_input = (array) $form_state['values'][$identifier];
}
return;
@@ -328,7 +328,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
$query->fields('td');
$query->condition('td.name', $names);
$query->condition('tv.machine_name', $this->options['vocabulary']);
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
$result = $query->execute();
foreach ($result as $term) {
unset($missing[strtolower($term->name)]);

View File

@@ -76,7 +76,7 @@ class views_handler_relationship_node_term_data extends views_handler_relationsh
$query->addJoin($def['type'], 'taxonomy_index', 'tn', 'tn.tid = td.tid');
$query->condition('tv.machine_name', array_filter($this->options['vocabularies']));
if (empty($this->query->options['disable_sql_rewrite'])) {
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
}
$query->fields('td');
$query->fields('tn', array('nid'));

View File

@@ -97,7 +97,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->fields('td');
$query->condition('td.tid', $argument);
$query->addTag('term_access');
$query->addTag('taxonomy_term_access');
$term = $query->execute()->fetchObject();
if (!$term) {
return FALSE;
@@ -139,6 +139,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
// if unverified tids left - verify them and cache results
if (count($test)) {
$query = db_select('taxonomy_term_data', 'td');
$query->addTag('taxonomy_term_access');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->fields('td');
$query->fields('tv', array('machine_name'));
@@ -167,6 +168,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
case 'name':
case 'convert':
$query = db_select('taxonomy_term_data', 'td');
$query->addTag('taxonomy_term_access');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->fields('td');
$query->fields('tv', array('machine_name'));
@@ -202,6 +204,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
$arg_keys = array_flip($args);
$query = db_select('taxonomy_term_data', 'td');
$query->addTag('taxonomy_term_access');
$query->condition('tid', $args);
$query->addField('td', 'tid', 'tid');
if (!empty($vocabularies)) {

View File

@@ -74,7 +74,7 @@ class views_handler_field_user_name extends views_handler_field_user {
}
}
// If we want a formatted username, do that.
if (!empty($this->options['format_username'])) {
if (!empty($this->options['format_username']) && !is_null($account->uid)) {
return format_username($account);
}
// Otherwise, there's no special handling, so return the data directly.

View File

@@ -34,7 +34,7 @@ class views_plugin_row_user_view extends views_plugin_row {
'#title' => t('View mode'),
'#default_value' => $this->options['view_mode'],
);
$form['help']['#markup'] = t("Display the user with standard user view. It might be necessary to add a user-profile.tpl.php in your themes template folder, because the default <a href=\"@user-profile-api-link\">user-profile</a>e template don't show the username per default.", array('@user-profile-api-link' => url('http://api.drupal.org/api/drupal/modules--user--user-profile.tpl.php/7')));
$form['help']['#markup'] = t("Display the user with standard user view. It might be necessary to add a user-profile.tpl.php in your theme's template folder, because the default <a href=\"@user-profile-api-link\">user-profile</a> template doesn't show the username by default.", array('@user-profile-api-link' => url('http://api.drupal.org/api/drupal/modules--user--user-profile.tpl.php/7')));
}

View File

@@ -109,7 +109,7 @@ function views_views_data() {
$data['views']['combine'] = array(
'title' => t('Combine fields filter'),
'help' => t('Combine two fields together and search by them.'),
'help' => t('Combine multiple fields together and search by them.'),
'filter' => array(
'handler' => 'views_handler_filter_combine',
),

View File

@@ -289,7 +289,14 @@ class views_plugin_cache extends views_plugin {
function get_results_key() {
if (!isset($this->_results_key)) {
$this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . $this->get_cache_key();
$key_data = array();
foreach (array('exposed_info', 'page', 'sort', 'order', 'items_per_page', 'offset') as $key) {
if (isset($_GET[$key])) {
$key_data[$key] = $_GET[$key];
}
}
$this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . $this->get_cache_key($key_data);
}
return $this->_results_key;
@@ -298,6 +305,7 @@ class views_plugin_cache extends views_plugin {
function get_output_key() {
if (!isset($this->_output_key)) {
$key_data = array(
'result' => $this->view->result,
'theme' => $GLOBALS['theme'],
);
$this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . $this->get_cache_key($key_data);

View File

@@ -41,7 +41,7 @@ class views_plugin_cache_time extends views_plugin_cache {
'#maxlength' => '30',
'#description' => t('Length of time in seconds raw query results should be cached.'),
'#default_value' => $this->options['results_lifespan_custom'],
'#process' => array('form_process_select','ctools_dependent_process'),
'#process' => array('ctools_dependent_process'),
'#dependency' => array(
'edit-cache-options-results-lifespan' => array('custom'),
),
@@ -60,7 +60,7 @@ class views_plugin_cache_time extends views_plugin_cache {
'#maxlength' => '30',
'#description' => t('Length of time in seconds rendered HTML output should be cached.'),
'#default_value' => $this->options['output_lifespan_custom'],
'#process' => array('form_process_select','ctools_dependent_process'),
'#process' => array('ctools_dependent_process'),
'#dependency' => array(
'edit-cache-options-output-lifespan' => array('custom'),
),

View File

@@ -365,6 +365,19 @@ class views_plugin_display extends views_plugin {
return FALSE;
}
/**
* Should the enabled display more link being opened in an new window?
*
* @codingStandardsIgnoreStart
*/
function use_more_open_new_window() {
// @codingStandardsIgnoreEnd
if (!empty($this->definition['use more'])) {
return $this->get_option('open_new_window');
}
return FALSE;
}
/**
* Does the display have custom link text?
*/
@@ -414,9 +427,29 @@ class views_plugin_display extends views_plugin {
'hide_admin_links' => array('hide_admin_links'),
'group_by' => array('group_by'),
'query' => array('query'),
'use_more' => array('use_more', 'use_more_always', 'use_more_text'),
'use_more_always' => array('use_more', 'use_more_always', 'use_more_text'),
'use_more_text' => array('use_more', 'use_more_always', 'use_more_text'),
'use_more' => array('use_more',
'use_more_always',
'open_new_window',
'use_more_text',
),
'use_more_always' => array(
'use_more',
'use_more_always',
'open_new_window',
'use_more_text',
),
'use_more_text' => array(
'use_more',
'use_more_always',
'open_new_window',
'use_more_text',
),
'open_new_window' => array(
'use_more',
'use_more_always',
'open_new_window',
'use_more_text',
),
'link_display' => array('link_display', 'link_url'),
// Force these to cascade properly.
@@ -481,6 +514,7 @@ class views_plugin_display extends views_plugin {
'pager_options' => TRUE,
'use_more' => TRUE,
'use_more_always' => TRUE,
'open_new_window' => FALSE,
'use_more_text' => TRUE,
'exposed_form' => TRUE,
'exposed_form_options' => TRUE,
@@ -1061,6 +1095,11 @@ class views_plugin_display extends views_plugin {
$title = $text;
}
// Truncate the path as it is displayed as a link.
if ($section == 'path') {
$text = views_ui_truncate($text, 24);
}
return l($text, 'admin/structure/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title, 'id' => drupal_html_id('views-' . $this->display->id . '-' . $section)), 'html' => TRUE));
}
@@ -1468,7 +1507,7 @@ class views_plugin_display extends views_plugin {
$form['#title'] .= t('The title of this view');
$form['title'] = array(
'#type' => 'textfield',
'#description' => t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.'),
'#description' => t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc. Use &lt;none&gt; to not assign a title; this can allow other modules to control the page title.'),
'#default_value' => $this->get_option('title'),
);
break;
@@ -1524,6 +1563,17 @@ class views_plugin_display extends views_plugin {
'edit-use-more' => array(TRUE),
),
);
$form['open_new_window'] = array(
'#type' => 'checkbox',
'#title' => t("Open 'more' link in new window (target='blank')"),
'#description' => t("Leave this unchecked to open the more link in the same window."),
'#default_value' => $this->get_option('open_new_window'),
'#dependency' => array(
'edit-use-more' => array(TRUE),
),
);
$form['use_more_text'] = array(
'#type' => 'textfield',
'#title' => t('More link text'),
@@ -2381,6 +2431,7 @@ class views_plugin_display extends views_plugin {
case 'use_more':
$this->set_option($section, intval($form_state['values'][$section]));
$this->set_option('use_more_always', !intval($form_state['values']['use_more_always']));
$this->set_option('open_new_window', $form_state['values']['open_new_window']) == '1';
$this->set_option('use_more_text', $form_state['values']['use_more_text']);
case 'distinct':
$this->set_option($section, $form_state['values'][$section]);
@@ -2594,7 +2645,7 @@ class views_plugin_display extends views_plugin {
$path = check_url(url($path, $url_options));
return theme($theme, array('more_url' => $path, '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));
}
}
}
@@ -2798,7 +2849,7 @@ class views_plugin_display extends views_plugin {
}
}
else {
if ($id != $key && $identifier == $handler->options['expose']['identifier']) {
if ($id != $key && isset($handler->options['expose']['identifier']) && $identifier == $handler->options['expose']['identifier']) {
return FALSE;
}
}

View File

@@ -52,7 +52,8 @@ class views_plugin_display_block extends views_plugin_display {
// Prior to this being called, the $view should already be set to this
// display, and arguments should be set on the view.
$info['content'] = $this->view->render();
$info['subject'] = filter_xss_admin($this->view->get_title());
$title = $this->view->get_title();
$info['subject'] = ($title == '<none>') ? '' : filter_xss_admin($title);
if (!empty($this->view->result) || $this->get_option('empty') || !empty($this->view->style_plugin->definition['even empty'])) {
return $info;
}

View File

@@ -118,6 +118,8 @@ class views_plugin_display_page extends views_plugin_display {
'access arguments' => $access_arguments,
// Identify URL embedded arguments and correlate them to a handler
'load arguments' => array($this->view->name, $this->display->id, '%index'),
// Make sure the menu router knows where views_page is.
'module' => 'views',
);
$menu = $this->get_option('menu');
if (empty($menu)) {
@@ -182,6 +184,8 @@ class views_plugin_display_page extends views_plugin_display {
'title' => $tab_options['title'],
'description' => $tab_options['description'],
'menu_name' => $tab_options['name'],
// Make sure the menu router knows where views_page is.
'module' => 'views',
);
switch ($tab_options['type']) {
default:
@@ -231,7 +235,13 @@ class views_plugin_display_page extends views_plugin_display {
// First execute the view so it's possible to get tokens for the title.
// And the title, which is much easier.
drupal_set_title(filter_xss_admin($this->view->get_title()), PASS_THROUGH);
$title = $this->view->get_title();
// Support the core method of using '<none>' to indicate nothing should be
// assigned to the title, so only process the title value if it is not that
// value.
if ($title != '<none>') {
drupal_set_title(filter_xss_admin($title), PASS_THROUGH);
}
return $render;
}
@@ -263,7 +273,7 @@ class views_plugin_display_page extends views_plugin_display {
$options['path'] = array(
'category' => 'page',
'title' => t('Path'),
'value' => views_ui_truncate($path, 24),
'value' => $path,
);
$menu = $this->get_option('menu');

View File

@@ -417,7 +417,7 @@ class views_plugin_pager_full extends views_plugin_pager {
function exposed_form_validate(&$form, &$form_state) {
if (!empty($form_state['values']['offset']) && trim($form_state['values']['offset'])) {
if (!is_numeric($form_state['values']['offset']) || $form_state['values']['offset'] < 0) {
form_set_error('offset', t('Offset must be an number greather or equal than 0.'));
form_set_error('offset', t('Offset must be an number greater or equal than 0.'));
}
}
}

View File

@@ -39,6 +39,9 @@ class views_plugin_query extends views_plugin {
*
* @param $get_count
* Provide a countquery if this is true, otherwise provide a normal query.
*
* @return SelectQuery
* A SelectQuery object.
*/
function query($get_count = FALSE) { }

View File

@@ -1244,6 +1244,9 @@ class views_plugin_query_default extends views_plugin_query {
*
* @param $get_count
* Provide a countquery if this is true, otherwise provide a normal query.
*
* @return SelectQuery
* A SelectQuery object.
*/
function query($get_count = FALSE) {
// Check query distinct value.
@@ -1367,7 +1370,7 @@ class views_plugin_query_default extends views_plugin_query {
}
// Add all query substitutions as metadata.
$query->addMetaData('views_substitutions', module_invoke_all('views_query_substitutions', $this));
$query->addMetaData('views_substitutions', module_invoke_all('views_query_substitutions', $this->view));
if (!$get_count) {
if (!empty($this->limit) || !empty($this->offset)) {

View File

@@ -130,7 +130,7 @@ class views_plugin_style extends views_plugin {
// Explode the value by whitespace, this allows the function to handle
// a single class name and multiple class names that are then tokenized.
foreach(explode(' ', $class) as $token_class) {
$classes[] = strip_tags($this->tokenize_value($token_class, $row_index));
$classes = array_merge($classes, explode(' ', strip_tags($this->tokenize_value($token_class, $row_index))));
}
}
else {
@@ -139,7 +139,7 @@ class views_plugin_style extends views_plugin {
// Convert whatever the result is to a nice clean class name
foreach ($classes as &$class) {
$class = drupal_html_class($class);
$class = drupal_clean_css_identifier($class);
}
return implode(' ', $classes);
}
@@ -237,6 +237,7 @@ class views_plugin_style extends views_plugin {
'#type' => 'checkbox',
'#title' => t('Remove tags from rendered output'),
'#default_value' => $grouping['rendered_strip'],
'#description' => t('Some modules add HTML to the rendered output and prevent the rows from grouping correctly. Stripping the HTML tags should correct this.'),
'#dependency' => array(
'edit-style-options-grouping-' . $i . '-field' => array_keys($field_labels),
)

View File

@@ -146,7 +146,7 @@ class views_plugin_style_jump_menu extends views_plugin_style {
$lookup_options = array();
// We need to check if the path is absolute
// or else language is not taken in account.
if ($this->view->display[$this->view->current_display]->display_options['fields'][$this->options['path']]['absolute']) {
if (!empty($this->view->display[$this->view->current_display]->display_options['fields'][$this->options['path']]['absolute'])) {
$lookup_options['absolute'] = TRUE;
}
$lookup_url = url($_GET['q'], $lookup_options);

View File

@@ -84,7 +84,8 @@ abstract class views_plugin_style_mapping extends views_plugin_style {
// Optionally filter the available fields.
if (isset($mapping[$key]['#filter'])) {
$this->view->init_handlers();
$this::$mapping[$key]['#filter']($field_options);
$filter = $mapping[$key]['#filter'];
$this::$filter($field_options);
unset($mapping[$key]['#filter']);
}

View File

@@ -252,11 +252,11 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase {
foreach ($rows as $row) {
$attributes = $row->attributes();
$class = (string) $attributes['class'][0];
$this->assertTrue(strpos($class, $random_name) !== FALSE, 'Take sure that a custom css class is added to the output.');
$this->assertTrue(strpos($class, $random_name) !== FALSE, 'Make sure that a custom css class is added to the output.');
// Check token replacement.
$name = drupal_html_class($view->field['name']->get_value($view->result[$count]));
$this->assertTrue(strpos($class, "test-token-$name") !== FALSE, 'Take sure that a token in custom css class is replaced.');
$name = drupal_clean_css_identifier($view->field['name']->get_value($view->result[$count]));
$this->assertTrue(strpos($class, "test-token-$name") !== FALSE, 'Make sure that a token in custom css class is replaced.');
$count++;
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* @file
* Definition of ViewsAjaxTest.
*/
/**
* Tests views ajax display.
*/
class ViewsAjaxTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Ajax',
'description' => 'Test views with and without ajax enabled.',
'group' => 'Views Handlers',
);
}
public function setUp() {
parent::setUp('views', 'views_test');
// Create a second node.
$this->drupalCreateNode(array('type' => 'article', 'status' => NODE_PUBLISHED));
}
/**
* Perform a simple AJAX POST HTTP request.
*
* @param string $path
* Drupal path where the request should be POSTed.
* @param string $accept
* The value for the "Accept" header. Usually either 'application/json' or
* 'application/vnd.drupal-ajax'.
* @param array $post
* The POST data. When making a 'application/vnd.drupal-ajax' request, the
* Ajax page state data should be included. Use getAjaxPageStatePostData()
* for that.
*
* @return
* The content returned from the call to curl_exec().
*/
public function simpleAjaxPost($path, $accept, $post = array()) {
$options['absolute'] = TRUE;
foreach ($post as $key => $value) {
// Encode according to application/x-www-form-urlencoded
// Both names and values needs to be urlencoded, according to
// http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
$post[$key] = urlencode($key) . '=' . urlencode($value);
}
$postfields = implode('&', $post);
$headers = array(
'Accept: ' . $accept,
'Content-Type: application/x-www-form-urlencoded',
);
return $this->curlExec(array(
CURLOPT_URL => url($path, $options),
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $postfields,
CURLOPT_HTTPHEADER => $headers,
));
}
/**
* Tests an ajax and non-ajax view.
*/
public function testAjaxView() {
$this->drupalCreateNode();
$this->drupalGet('test_ajax_view');
$drupal_settings = $this->drupalGetSettings();
$this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
$this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
$view_entry = current(array_keys($drupal_settings['views']['ajaxViews']));
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
$post = array(
'view_name' => 'test_ajax_view',
'view_display_id' => 'page_1',
);
$response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
$data = drupal_json_decode($response);
$this->assertTrue(isset($data[0]['settings']['views']['ajaxViews']));
// Ensure that the view insert command is part of the result.
$this->assertEqual($data[1]['command'], 'insert');
$this->assertTrue(strpos($data[1]['selector'], '.view-dom-id-') === 0);
$this->drupalSetContent($data[1]['data']);
$result = $this->xpath('//div[contains(@class, "views-row")]');
$this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.');
$post = array(
'view_name' => 'test_noajax_view',
'view_display_id' => 'default',
);
$response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
$data = drupal_json_decode($response);
// In Drupal 7 we get an ajax response with no commands instead of a 403 if
// the view cannot be accessed.
foreach ($data as $item) {
$this->assertIdentical('settings', $item['command']);
$this->assertTrue(empty($item['data']));
}
}
}

View File

@@ -56,6 +56,38 @@ class ViewsExposedFormTest extends ViewsSqlTest {
$this->helperButtonHasLabel('edit-reset', $expected_label);
}
/**
* Tests that exposed values are correctly stored.
*/
public function testRemember() {
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this->drupalCreateNode();
}
// Set the exposed filter.
$this->drupalGet('test_exposed_remember', array('query' => array('type' => 'page')));
$this->assertFieldByName('type', 'page');
// Request the page again, should still be set.
$this->drupalGet('test_exposed_remember');
$this->assertFieldByName('type', 'page');
// Request the page with an unrelated GET argument, filter should still be set.
$this->drupalGet('test_exposed_remember', array('query' => array('argument' => 'value')));
$this->assertFieldByName('type', 'page');
// Change the remembered exposed value.
$this->drupalGet('test_exposed_remember', array('query' => array('type' => 'article')));
$this->assertFieldByName('type', 'article');
// Request the page again, should have remembered the new value.
$this->drupalGet('test_exposed_remember');
$this->assertFieldByName('type', 'article');
}
/**
* Tests the admin interface of exposed filter and sort items.
*/

View File

@@ -5,9 +5,9 @@ core = 7.x
dependencies[] = views
hidden = TRUE
; Information added by Drupal.org packaging script on 2016-06-15
version = "7.x-3.14"
; Information added by Drupal.org packaging script on 2017-08-23
version = "7.x-3.18"
core = "7.x"
project = "views"
datestamp = "1466019588"
datestamp = "1503495103"

View File

@@ -218,5 +218,113 @@ function views_test_views_default_views() {
$views[$view->name] = $view;
$view = new view();
$view->name = 'test_exposed_remember';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = 'test_exposed_remember';
$view->core = 0;
$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'] = 'none';
$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['exposed_form']['options']['reset_button'] = TRUE;
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* 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';
/* 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']['exposed'] = TRUE;
$handler->display->display_options['filters']['type']['expose']['operator_id'] = 'type_op';
$handler->display->display_options['filters']['type']['expose']['label'] = 'Type';
$handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op';
$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type';
$handler->display->display_options['filters']['type']['expose']['remember'] = TRUE;
$handler->display->display_options['filters']['type']['expose']['remember_roles'] = array(
2 => '2',
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'test_exposed_remember';
$translatables['test_exposed_remember'] = array(
t('Master'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Type'),
t('Page'),
);
$views[$view->name] = $view;
$view = new view();
$view->name = 'test_ajax_view';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = '';
$view->core = 0;
$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_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'test_ajax_view';
$views[$view->name] = $view;
$view = new view();
$view->name = 'test_noajax_view';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = '';
$view->core = 0;
$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_ajax'] = FALSE;
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$views[$view->name] = $view;
return $views;
}

View File

@@ -7,8 +7,11 @@
/**
* Views class tests.
*
* @codingStandardsIgnoreStart
*/
class ViewsViewTest extends ViewsSqlTest {
// @codingStandardsIgnoreEnd
public static function getInfo() {
return array(
'name' => 'Test the view class',
@@ -227,6 +230,8 @@ class ViewsViewTest extends ViewsSqlTest {
'default' => 'default',
'page_1' => 'page_1',
);
// @codingStandardsIgnoreLine
$translatables['test_destroy'] = array(
t('Master'),
t('more'),
@@ -272,6 +277,8 @@ class ViewsViewTest extends ViewsSqlTest {
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
// @codingStandardsIgnoreLine
$translatables['test_view_delete'] = array(
t('Defaults'),
t('more'),

View File

@@ -86,7 +86,7 @@ function template_preprocess_views_view(&$vars) {
$vars['title'] = !empty($view->views_ui_context) ? filter_xss_admin($view->get_title()) : '';
if ($view->display_handler->render_pager()) {
$exposed_input = isset($view->exposed_raw_input) ? $view->exposed_raw_input : NULL;
$exposed_input = $view->get_exposed_input();
$vars['pager'] = $view->query->render_pager($exposed_input);
}
@@ -138,6 +138,10 @@ function template_preprocess_views_view(&$vars) {
),
),
),
// Support for AJAX path validation in core 7.39.
'urlIsAjaxTrusted' => array(
url('views/ajax') => TRUE,
),
);
drupal_add_js($settings, 'setting');

View File

@@ -7,13 +7,16 @@
* - $view: The view object.
* - $more_url: the url for the more link.
* - $link_text: the text for the more link.
* - $new_window: The flag that indicates if link should be opened in a new
* window.
*
* @ingroup views_templates
*/
?>
<div class="more-link">
<a href="<?php print $more_url ?>">
<a href="<?php print $more_url ?>"<?php if (!empty($new_window)) { ?> target="_blank"<?php
} ?>>
<?php print $link_text; ?>
</a>
</div>

View File

@@ -1,45 +0,0 @@
<?php
/**
* @file
* This template handles the printing of fields/filters/sort criteria/arguments or relationships.
*/
?>
<?php print $rearrange; ?>
<?php print $add; ?>
<div class="views-category-title<?php
if ($overridden) {
print ' overridden';
}
if ($defaulted) {
print ' defaulted';
}
?>">
<?php print $item_help_icon; ?>
<?php print $title; ?>
</div>
<div class="views-category-content<?php
if ($overridden) {
print ' overridden';
}
if ($defaulted) {
print ' defaulted';
}
?>">
<?php if (!empty($no_fields)): ?>
<div><?php print t('The style selected does not utilize fields.'); ?></div>
<?php elseif (empty($fields)): ?>
<div><?php print t('None defined'); ?></div>
<?php else: ?>
<?php foreach ($fields as $pid => $field): ?>
<?php if (!empty($field['links'])): ?>
<?php print $field['links']; ?>
<?php endif; ?>
<div class="<?php print $field['class']; if (!empty($field['changed'])) { print ' changed'; } ?>">
<?php print $field['title']; ?>
<?php print $field['info']; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>

View File

@@ -87,7 +87,7 @@
* $this->value_title = t('Node type');
* $types = node_get_types();
* foreach ($types as $type => $info) {
* $options[$type] = $info-&gt;name;
* $options[$type] = $info->name;
* }
* $this->value_options = $options;
* }

View File

@@ -2,7 +2,6 @@ name = Views
description = Create customized lists and queries from your database.
package = Views
core = 7.x
php = 5.2
; Always available CSS
stylesheets[all][] = css/views.css
@@ -302,6 +301,7 @@ files[] = tests/styles/views_plugin_style_unformatted.test
files[] = tests/views_access.test
files[] = tests/views_analyze.test
files[] = tests/views_basic.test
files[] = tests/views_ajax.test
files[] = tests/views_argument_default.test
files[] = tests/views_argument_validator.test
files[] = tests/views_exposed_form.test
@@ -328,9 +328,9 @@ files[] = tests/views_cache.test
files[] = tests/views_view.test
files[] = tests/views_ui.test
; Information added by Drupal.org packaging script on 2016-06-15
version = "7.x-3.14"
; Information added by Drupal.org packaging script on 2017-08-23
version = "7.x-3.18"
core = "7.x"
project = "views"
datestamp = "1466019588"
datestamp = "1503495103"

View File

@@ -44,13 +44,12 @@ function views_schema($caller_function = FALSE) {
// Generate a sorted list of available schema update functions.
if ($get_current || empty($schemas)) {
$get_current = FALSE;
$functions = get_defined_functions();
foreach ($functions['user'] as $function) {
if (strpos($function, 'views_schema_') === 0) {
$version = substr($function, strlen('views_schema_'));
if (is_numeric($version)) {
$schemas[] = $version;
}
// Provide a worst-case scenario range.
$start_schema = 6000;
$end_schema = 7999;
for ($i = $start_schema; $i <= $end_schema; $i++) {
if (function_exists('views_schema_' . $i)) {
$schemas[] = $i;
}
}
if ($schemas) {
@@ -253,8 +252,7 @@ function views_schema_6000() {
),
);
// $schema['cache_views_data'] added in views_schema_6006()
// $schema['cache_views_data'] added in views_schema_6006().
return $schema;
}
@@ -296,8 +294,10 @@ function views_update_6001() {
update_sql("UPDATE {blocks} SET delta = CONCAT(delta, '-block_1') WHERE module = 'views'");
}
// NOTE: Update 6002 removed because it did not always work.
// Update 6004 implements the change correctly.
/*
* NOTE: Update 6002 removed because it did not always work.
* Update 6004 implements the change correctly.
*/
/**
* Add missing unique key.
@@ -488,7 +488,7 @@ function views_update_6011() {
*/
function views_update_6012() {
// There is only one simple query to run.
$update = db_update('blocks')
db_update('blocks')
->condition('module', 'views')
->condition('delta', db_like('-exp-') . '%', 'LIKE')
->fields(array('cache' => DRUPAL_NO_CACHE));

View File

@@ -9,6 +9,32 @@
* incoming page and block requests.
*/
/**
* Implements hook_help().
*/
function views_help($path, $arg) {
switch ($path) {
case 'admin/help#views':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Views module provides a back end to fetch information from content, user accounts, taxonomy terms, and other entities from the database and present it to the user as a grid, HTML list, table, unformatted list, etc. The resulting displays are known generally as views.') . '</p>';
$output .= '<p>' . t('For more information, see the <a href="@views" target="blank">online documentation for the Views</a>.', array('@views' => 'https://www.drupal.org/documentation/modules/views')) . '</p>';
$output .= '<p>' . t('In order to create and modify your own views using the administration and configuration user interface, you will need to enable either the Views UI module in core or a contributed module that provides a user interface for Views. See the <a href="/admin/structure/views">Views UI module help page</a> for more information.') . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Adding functionality to administrative pages') . '</dt>';
$output .= '<dd>' . t('The Views module adds functionality to some core administration pages. For example, <em>admin/content</em> uses Views to filter and sort content. With Views uninstalled, <em>admin/content</em> is more limited.') . '</dd>';
$output .= '<dt>' . t('Expanding Views functionality') . '</dt>';
$output .= '<dd>' . t('Contributed projects that support the Views module can be found in the <a href="@views-related" target="blank">online documentation for Views-related contributed modules.</a>.', array('@views-related' => 'https://www.drupal.org/documentation/modules/views/add-ons')) . '</dd>';
$output .= '<dt>' . t('Improving table accessibility') . '</dt>';
$output .= '<dd>' . t('Views tables include semantic markup to improve accessibility. Data cells are automatically associated with header cells through id and header attributes. To improve the accessibility of your tables you can add descriptive elements within the Views table settings. The caption element can introduce context for a table, making it easier to understand. The summary element can provide an overview of how the data has been organized and how to navigate the table. Both the caption and summary are visible by default and also implemented according to HTML5 guidelines.') . '</dd>';
return $output;
}
}
/**
* Advertise the current views api version
*/
@@ -377,7 +403,7 @@ function views_menu() {
'file' => 'includes/ajax.inc',
);
// Define another taxonomy autocomplete because the default one of drupal
// does not support a vid a argument anymore
// does not support a vid a argument anymore.
$items['admin/views/ajax/autocomplete/taxonomy'] = array(
'page callback' => 'views_ajax_autocomplete_taxonomy',
'theme callback' => 'ajax_base_page_theme',

View File

@@ -48,7 +48,6 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
$url_options['language'] = $options['language'];
}
$sanitize = !empty($options['sanitize']);
$langcode = isset($options['language']) ? $options['language']->language : NULL;
$replacements = array();

View File

@@ -4,12 +4,13 @@ package = Views
core = 7.x
configure = admin/structure/views
dependencies[] = views
# @codingStandardsIgnoreLine
files[] = views_ui.module
files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php
; Information added by Drupal.org packaging script on 2016-06-15
version = "7.x-3.14"
; Information added by Drupal.org packaging script on 2017-08-23
version = "7.x-3.18"
core = "7.x"
project = "views"
datestamp = "1466019588"
datestamp = "1503495103"

View File

@@ -5,6 +5,29 @@
* Provide structure for the administrative interface to Views.
*/
/**
* Implements hook_help().
*/
function views_ui_help($path, $arg) {
switch ($path) {
case 'admin/help#views_ui':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Views UI module provides an interface for managing views for the Views module. For more information, see the <a href="@views" target="blank">online documentation for the Views UI module</a>.', array('@views' => 'https://www.drupal.org/documentation/modules/views')) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Creating and managing views') . '</dt>';
$output .= '<dd>' . t('Views can be created from the <a href="/admin/structure/views">Views list page</a> by using the "Add view" action. Existing views can be managed from the <a href="/admin/structure/views">Views list page</a> by locating the view in the "Enabled" or "Disabled" list and selecting the desired operation action, for example "Edit".') . '</dd>';
$output .= '<dt>' . t('Enabling and disabling views') . '</dt>';
$output .= '<dd>' . t('Views can be enabled or disabled from the <a href="/admin/structure/views">Views list page</a>. To enable a view, find the view within the "Disabled" list and select the "Enable" operation. To disable a view find the view within the "Enabled" list and select the "Disable" operation.') . '</dd>';
$output .= '<dt>' . t('Exporting and importing views') . '</dt>';
$output .= '<dd>' . t('Views can be exported and imported as configuration files by using the Configuration Manager module.') . '</dd>';
return $output;
}
}
/**
* Implements hook_menu().
*/
@@ -96,7 +119,6 @@ function views_ui_menu() {
) + $base;
// Additional pages for acting on a View.
$items['admin/structure/views/view/%views_ui_cache/break-lock'] = array(
'title' => 'Break lock',
'page callback' => 'drupal_get_form',
@@ -143,7 +165,7 @@ function views_ui_menu() {
'type' => MENU_CALLBACK,
) + $base;
// A page in the Reports section to show usage of fields in all views
// A page in the Reports section to show usage of fields in all views.
$items['admin/reports/fields/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
@@ -175,9 +197,17 @@ function views_ui_theme() {
require_once DRUPAL_ROOT . "/$path/includes/admin.inc";
return array(
// edit a view
// Edit a view.
'views_ui_display_tab_setting' => array(
'variables' => array('description' => '', 'link' => '', 'settings_links' => array(), 'overridden' => FALSE, 'defaulted' => FALSE, 'description_separator' => TRUE, 'class' => array()),
'variables' => array(
'description' => '',
'link' => '',
'settings_links' => array(),
'overridden' => FALSE,
'defaulted' => FALSE,
'description_separator' => TRUE,
'class' => array(),
),
'template' => 'views-ui-display-tab-setting',
'path' => "$path/theme",
),
@@ -186,11 +216,6 @@ function views_ui_theme() {
'template' => 'views-ui-display-tab-bucket',
'path' => "$path/theme",
),
'views_ui_edit_item' => array(
'variables' => array('type' => NULL, 'view' => NULL, 'display' => NULL, 'no_fields' => FALSE),
'template' => 'views-ui-edit-item',
'path' => "$path/theme",
),
'views_ui_rearrange_form' => array(
'render element' => 'form',
),
@@ -203,7 +228,7 @@ function views_ui_theme() {
'file' => 'includes/admin.inc',
),
// list views
// List views.
'views_ui_view_info' => array(
'variables' => array('view' => NULL, 'base' => NULL),
'file' => "includes/admin.inc",
@@ -215,7 +240,7 @@ function views_ui_theme() {
'file' => 'includes/admin.inc',
),
// tab themes
// Tab themes.
'views_tabset' => array(
'variables' => array('tabs' => NULL),
),
@@ -227,15 +252,19 @@ function views_ui_theme() {
'file' => 'includes/admin.inc',
),
// On behalf of a plugin
// On behalf of a plugin.
'views_ui_style_plugin_table' => array(
'render element' => 'form',
),
// When previewing a view.
'views_ui_view_preview_section' => array(
'variables' => array('view' => NULL, 'section' => NULL, 'content' => NULL, 'links' => ''),
'variables' => array(
'view' => NULL,
'section' => NULL,
'content' => NULL,
'links' => '',
),
),
// Generic container wrapper, to use instead of theme_container when an id
@@ -279,10 +308,10 @@ function views_ui_edit_page_title($view) {
/**
* Specialized menu callback to load a view and check its locked status.
*
* @param $name
* @param string $name
* The machine name of the view.
*
* @return
* @return object
* The view object, with a "locked" property indicating whether or not
* someone else is already editing the view.
*/
@@ -320,6 +349,8 @@ function views_ui_cache_load($name) {
}
/**
* Cache set.
*
* Specialized cache function to add a flag to our view, include an appropriate
* include, and cache more easily.
*/
@@ -329,7 +360,8 @@ function views_ui_cache_set(&$view) {
return;
}
ctools_include('object-cache');
$view->changed = TRUE; // let any future object know that this view has changed.
// Let any future object know that this view has changed.
$view->changed = TRUE;
if (isset($view->current_display)) {
// Add the knowledge of the changed display, too.
@@ -337,7 +369,7 @@ function views_ui_cache_set(&$view) {
unset($view->current_display);
}
// Unset handlers; we don't want to write these into the cache
// Unset handlers; we don't want to write these into the cache.
unset($view->display_handler);
unset($view->default_display);
$view->query = NULL;
@@ -348,8 +380,9 @@ function views_ui_cache_set(&$view) {
ctools_object_cache_set('view', $view->name, $view);
}
/**
* Default Load.
*
* Specialized menu callback to load a view that is only a default
* view.
*/
@@ -369,7 +402,21 @@ function views_ui_preprocess_views_view(&$vars) {
$view = $vars['view'];
if (!empty($view->views_ui_context) && module_exists('contextual')) {
$view->hide_admin_links = TRUE;
foreach (array('title', 'header', 'exposed', 'rows', 'pager', 'more', 'footer', 'empty', 'attachment_after', 'attachment_before') as $section) {
$sections = array(
'title',
'header',
'exposed',
'rows',
'pager',
'more',
'footer',
'empty',
'attachment_after',
'attachment_before',
);
foreach ($sections as $section) {
if (!empty($vars[$section])) {
$vars[$section] = array(
'#theme' => 'views_ui_view_preview_section',
@@ -397,40 +444,49 @@ function template_preprocess_views_ui_view_preview_section(&$vars) {
$vars['title'] = t('Title');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'title', $vars['title']);
break;
case 'header':
$vars['title'] = t('Header');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
break;
case 'empty':
$vars['title'] = t('No results behavior');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
break;
case 'exposed':
// @todo Sorts can be exposed too, so we may need a better title.
$vars['title'] = t('Exposed Filters');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'exposed_form_options', $vars['title']);
break;
case 'rows':
// @todo The title needs to depend on what is being viewed.
$vars['title'] = t('Content');
$links = views_ui_view_preview_section_rows_links($vars['view']);
break;
case 'pager':
$vars['title'] = t('Pager');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'pager_options', $vars['title']);
break;
case 'more':
$vars['title'] = t('More');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'use_more', $vars['title']);
break;
case 'footer':
$vars['title'] = t('Footer');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
break;
case 'attachment_before':
// @todo: Add links to the attachment configuration page.
$vars['title'] = t('Attachment before');
break;
case 'attachment_after':
// @todo: Add links to the attachment configuration page.
$vars['title'] = t('Attachment after');
@@ -459,18 +515,18 @@ function template_preprocess_views_ui_view_preview_section(&$vars) {
function theme_views_ui_view_preview_section($vars) {
return '<h1 class="section-title">' . $vars['title'] . '</h1>'
. $vars['links']
. '<div class="preview-section">'. $vars['content'] . '</div>';
. '<div class="preview-section">' . $vars['content'] . '</div>';
}
/**
* Returns contextual links for each handler of a certain section.
*
* @param string $title
* Add a bolded title of this section.
*
* @TODO
* Bring in relationships
* Refactor this function to use much stuff of views_ui_edit_form_get_bucket.
*
* @param $title
* Add a bolded title of this section.
*/
function views_ui_view_preview_section_handler_links($view, $type, $title = FALSE) {
$display = $view->display_handler->display;
@@ -521,8 +577,9 @@ function views_ui_view_preview_section_display_category_links($view, $type, $tit
* Returns all contextual links for the main content part of the view.
*/
function views_ui_view_preview_section_rows_links($view) {
$display = $view->display_handler->display;
$links = array();
$links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'filter', TRUE));
$links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'field', TRUE));
$links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'sort', TRUE));
@@ -532,7 +589,6 @@ function views_ui_view_preview_section_rows_links($view) {
return $links;
}
/**
* Implments hook_ctools_plugin_directory().
*
@@ -547,10 +603,10 @@ function views_ui_ctools_plugin_directory($module, $plugin) {
/**
* Fetch metadata on a specific views ui wizard plugin.
*
* @param $wizard_type
* @param string $wizard_type
* Name of a wizard, or name of a base table.
*
* @return
* @return array
* An array with information about the requested wizard type.
*/
function views_ui_get_wizard($wizard_type) {
@@ -576,14 +632,14 @@ function views_ui_get_wizard($wizard_type) {
/**
* Fetch metadata for all content_type plugins.
*
* @return
* @return array
* An array of arrays with information about all available views wizards.
*/
function views_ui_get_wizards() {
ctools_include('plugins');
$wizard_plugins = ctools_get_plugins('views_ui', 'views_wizard');
$wizard_tables = array();
foreach ($wizard_plugins as $name => $info) {
foreach ($wizard_plugins as $info) {
$wizard_tables[$info['base_table']] = TRUE;
}
$base_tables = views_fetch_base_tables();
@@ -604,7 +660,7 @@ function views_ui_get_wizards() {
/**
* Helper function to define the default values for a Views wizard plugin.
*
* @return
* @return array
* An array of defaults for a views wizard.
*/
function views_ui_views_wizard_defaults() {
@@ -612,7 +668,7 @@ function views_ui_views_wizard_defaults() {
// The children may, for example, be a different variant for each node type.
'get children' => NULL,
'get child' => NULL,
// title and base table must be populated. They are empty here just
// Title and base table must be populated. They are empty here just
// so they are documented.
'title' => '',
'base_table' => NULL,
@@ -641,6 +697,9 @@ function views_ui_ctools_plugin_type() {
);
}
/**
* Get form wizard instance.
*/
function views_ui_get_form_wizard_instance($wizard) {
if (isset($wizard['form_wizard_class']['class'])) {
$class = $wizard['form_wizard_class']['class'];
@@ -710,7 +769,7 @@ function views_ui_contextual_links_suppress($set = NULL) {
* @see views_ui_contextual_links_suppress_pop()
*/
function views_ui_contextual_links_suppress_push() {
views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())+1);
views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) + 1);
}
/**
@@ -719,13 +778,16 @@ function views_ui_contextual_links_suppress_push() {
* @see views_ui_contextual_links_suppress_push()
*/
function views_ui_contextual_links_suppress_pop() {
views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())-1);
views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) - 1);
}
/**
* Menu callback; handles AJAX form submissions similar to ajax_form_callback(), but can be used for uncached forms.
* Menu callback.
*
* ajax_form_callback(), the menu callback for the system/ajax path, requires
* Handles AJAX form submissions similar to ajax_form_callback(), but can be
* used for uncached forms.
*
* Ajax_form_callback(), the menu callback for the system/ajax path, requires
* the form to be retrievable from the form cache, because it lacks a trusted
* $form_id argument with which to call drupal_retrieve_form(). When AJAX is
* wanted on a non-cacheable form, #ajax['path'] can be set to a path whose
@@ -765,16 +827,18 @@ function views_ui_ajax_get_form($form_id) {
return $callback($form, $form_state);
}
}
// @todo move these when we can
/**
* @todo move these when we can
*/
/**
* Helper function to get a list of paths assigned to a view.
*
* @param $view
* @param object $view
* The view.
*
* @return
* @return array
* An array of links to this view's display paths.
*/
function _views_ui_get_paths($view) {
@@ -783,14 +847,14 @@ function _views_ui_get_paths($view) {
$all_paths[] = t('Edit this view to add a display.');
}
else {
$view->init_display(); // Make sure all the handlers are set up
// Make sure all the handlers are set up.
$view->init_display();
foreach ($view->display as $display) {
if (!empty($display->handler) && $display->handler->has_path()) {
$one_path = $display->handler->get_option('path');
if (empty($path_sort)) {
$path_sort = strtolower($one_path);
}
if (empty($view->disabled) && strpos($one_path, '%') === FALSE) {
// @codingStandardsIgnoreLine
$all_paths[] = l('/' . $one_path, $one_path);
}
else {
@@ -806,10 +870,10 @@ function _views_ui_get_paths($view) {
/**
* Helper function to get a list of displays included in a view.
*
* @param $view
* @param object $view
* The view.
*
* @return
* @return array
* An array of display types that this view includes.
*/
function _views_ui_get_displays_list($view) {
@@ -828,21 +892,22 @@ function _views_ui_get_displays_list($view) {
}
/**
* This is part of a patch to address a jQueryUI bug. The bug is responsible
* for the inability to scroll a page when a modal dialog is active. If the content
* of the dialog extends beyond the bottom of the viewport, the user is only able
* to scroll with a mousewheel or up/down keyboard keys.
* This is part of a patch to address a jQueryUI bug.
*
* The bug is responsible
* for the inability to scroll a page when a modal dialog is active. If the
* content of the dialog extends beyond the bottom of the viewport, the user is
* only able to scroll with a mousewheel or up/down keyboard keys.
*
* @see http://bugs.jqueryui.com/ticket/4671
* @see https://bugs.webkit.org/show_bug.cgi?id=19033
* @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 remove
* the mousedown, mouseup and click events from the list of events that are bound
* in $.ui.dialog.overlay.create.
* 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.
*/
function views_ui_library_alter(&$libraries, $module) {
if ($module == 'system' && isset($libraries['ui.dialog'])) {
// Only apply the fix, if we don't have an up to date jQueryUI version.