updated i18n, views, imagestyleflush, field_group
patch views_rss_media
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
/**
|
||||
* IE7 has no idea how large this container should be and it doesn't
|
||||
* apply has-layout. Expand it's width to 100% and trigger has-layout.
|
||||
* apply has-layout. Expand its width to 100% and trigger has-layout.
|
||||
*/
|
||||
.views-edit-view .views-displays {
|
||||
height: 1%;
|
||||
|
@@ -312,9 +312,7 @@ div.form-item-options-value-all {
|
||||
|
||||
/* @end */
|
||||
|
||||
|
||||
|
||||
/* @group Javascript dependent styling */
|
||||
/* @group JavaScript dependent styling */
|
||||
|
||||
.js-only {
|
||||
display: none;
|
||||
|
@@ -119,10 +119,11 @@ function views_drush_command() {
|
||||
* Callback function for views-revert command.
|
||||
*/
|
||||
function views_revert_views() {
|
||||
$args = func_get_args();
|
||||
// The provided views names specified in the command.
|
||||
$viewnames = _convert_csv_to_array($args);
|
||||
$views = views_get_all_views();
|
||||
$i = 0;
|
||||
// The provided views names specified in the command.
|
||||
$viewnames = _convert_csv_to_array(func_get_args());
|
||||
|
||||
// Find all overridden views.
|
||||
foreach ($views as $view) {
|
||||
|
@@ -101,7 +101,7 @@ class views_handler_area_result extends views_handler_area {
|
||||
$replacements["@$item"] = ${$item};
|
||||
}
|
||||
// Send the output.
|
||||
if (!empty($total)) {
|
||||
if (!empty($total) || !empty($this->options['empty'])) {
|
||||
$output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format));
|
||||
}
|
||||
return $output;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
/**
|
||||
* Base class for arguments.
|
||||
*
|
||||
* The basic argument works for very simple arguments such as nid and uid
|
||||
* The basic argument works for very simple arguments such as nid and uid.
|
||||
*
|
||||
* Definition terms for this handler:
|
||||
* - name field: The field to use for the name to use in the summary, which is
|
||||
@@ -158,9 +158,10 @@ class views_handler_argument extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the argument can generate a breadcrumb
|
||||
* Determine if the argument can generate a breadcrumb.
|
||||
*
|
||||
* @return bool
|
||||
* Indicates whether the argument can generate a breadcrumb.
|
||||
*/
|
||||
public function uses_breadcrumb() {
|
||||
$info = $this->default_actions($this->options['default_action']);
|
||||
@@ -195,6 +196,7 @@ class views_handler_argument extends views_handler {
|
||||
* Determine if the argument needs a style plugin.
|
||||
*
|
||||
* @return bool
|
||||
* the argument needs a plugin style.
|
||||
*/
|
||||
public function needs_style_plugin() {
|
||||
$info = $this->default_actions($this->options['default_action']);
|
||||
@@ -527,8 +529,7 @@ class views_handler_argument extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a list of default behaviors for this argument if the argument
|
||||
* is not present.
|
||||
* List of default behaviors for this argument if the argument is not present.
|
||||
*
|
||||
* Override this method to provide additional (or fewer) default behaviors.
|
||||
*/
|
||||
@@ -657,8 +658,9 @@ class views_handler_argument extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a form for selecting further summary options when the default
|
||||
* action is set to display one.
|
||||
* Form for selecting further summary options.
|
||||
*
|
||||
* Only used when the default action is set to display one.
|
||||
*/
|
||||
public function default_summary_form(&$form, &$form_state) {
|
||||
$style_plugins = views_fetch_plugin_data('style');
|
||||
@@ -795,10 +797,10 @@ class views_handler_argument extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Default action: empty
|
||||
* Default action: empty.
|
||||
*
|
||||
* If an argument was expected and was not given, in this case, display the
|
||||
* view's empty text
|
||||
* view's empty text.
|
||||
*/
|
||||
public function default_empty() {
|
||||
// We return with no query; this will force the empty text.
|
||||
@@ -967,6 +969,8 @@ class views_handler_argument extends views_handler {
|
||||
*
|
||||
* @param string $order
|
||||
* The order selected in the UI.
|
||||
* @param string $by
|
||||
* Optional alias for this field.
|
||||
*/
|
||||
public function summary_sort($order, $by = NULL) {
|
||||
$this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
|
||||
@@ -1116,7 +1120,7 @@ class views_handler_argument extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the input for this argument
|
||||
* Set the input for this argument.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if it successfully validates; FALSE if it does not.
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* Definitions terms:
|
||||
* - many to one: If true, the "many to one" helper will be used.
|
||||
* - invalid input: A string to give to the user for obviously invalid input.
|
||||
* This is deprecated in favor of argument validators.
|
||||
* This is deprecated in favor of argument validators.
|
||||
*
|
||||
* @see views_many_to_one_helper()
|
||||
*
|
||||
@@ -26,12 +26,12 @@
|
||||
class views_handler_argument_date extends views_handler_argument_formula {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $option_name = 'default_argument_date';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $arg_format = 'Y-m-d';
|
||||
|
||||
@@ -46,9 +46,9 @@ class views_handler_argument_date extends views_handler_argument_formula {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the empty argument value to the current date,
|
||||
* Set the empty argument value to the current date.
|
||||
*
|
||||
* formatted appropriately for this argument.
|
||||
* Formatted appropriately for this argument.
|
||||
*
|
||||
* @return string
|
||||
* The default argument.
|
||||
|
@@ -38,6 +38,7 @@ class views_handler_argument_string extends views_handler_argument {
|
||||
$options['path_case'] = array('default' => 'none');
|
||||
$options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE);
|
||||
$options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
|
||||
$options['not'] = array('default' => FALSE, 'bool' => TRUE);
|
||||
|
||||
if (!empty($this->definition['many to one'])) {
|
||||
$options['add_table'] = array('default' => FALSE, 'bool' => TRUE);
|
||||
@@ -132,6 +133,13 @@ class views_handler_argument_string extends views_handler_argument {
|
||||
'#default_value' => !empty($this->options['break_phrase']),
|
||||
'#fieldset' => 'more',
|
||||
);
|
||||
$form['not'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Exclude'),
|
||||
'#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'),
|
||||
'#default_value' => !empty($this->options['not']),
|
||||
'#fieldset' => 'more',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,21 +215,19 @@ class views_handler_argument_string extends views_handler_argument {
|
||||
}
|
||||
|
||||
if (count($this->value) > 1) {
|
||||
$operator = 'IN';
|
||||
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
|
||||
$argument = $this->value;
|
||||
}
|
||||
else {
|
||||
$operator = '=';
|
||||
$operator = empty($this->options['not']) ? '=' : '!=';
|
||||
}
|
||||
|
||||
if ($formula) {
|
||||
$placeholder = $this->placeholder();
|
||||
if ($operator == 'IN') {
|
||||
$field .= " IN($placeholder)";
|
||||
}
|
||||
else {
|
||||
$field .= ' = ' . $placeholder;
|
||||
if (count($this->value) > 1) {
|
||||
$placeholder = "($placeholder)";
|
||||
}
|
||||
$field .= " $operator $placeholder";
|
||||
$placeholders = array(
|
||||
$placeholder => $argument,
|
||||
);
|
||||
|
@@ -68,7 +68,7 @@ class views_handler_field extends views_handler {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* Stores additional fields which get's added to the query.
|
||||
* Stores additional fields which get added to the query.
|
||||
* The generated aliases are stored in $aliases.
|
||||
*/
|
||||
public $additional_fields = array();
|
||||
@@ -424,6 +424,7 @@ class views_handler_field extends views_handler {
|
||||
'absolute' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'external' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'replace_spaces' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'unwanted_characters' => array('default' => ''),
|
||||
'path_case' => array('default' => 'none', 'translatable' => FALSE),
|
||||
'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'alt' => array('default' => '', 'translatable' => TRUE),
|
||||
@@ -744,6 +745,16 @@ class views_handler_field extends views_handler {
|
||||
'edit-options-alter-make-link' => array(1),
|
||||
),
|
||||
);
|
||||
$form['alter']['unwanted_characters'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Remove unwanted characters'),
|
||||
'#description' => t('Space-separated list of characters to remove from the URL path'),
|
||||
'#default_value' => $this->options['alter']['unwanted_characters'],
|
||||
'#dependency' => array(
|
||||
'edit-options-alter-make-link' => array(1)
|
||||
),
|
||||
'#maxlength' => 255,
|
||||
);
|
||||
$form['alter']['path_case'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Transform the case'),
|
||||
@@ -782,7 +793,7 @@ class views_handler_field extends views_handler {
|
||||
'#title' => t('Rel Text'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => $this->options['alter']['rel'],
|
||||
'#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'),
|
||||
'#description' => t('Include Rel attribute for use in lightbox2 or other JavaScript utility.'),
|
||||
'#dependency' => array(
|
||||
'edit-options-alter-make-link' => array(1),
|
||||
),
|
||||
@@ -1234,8 +1245,9 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
|
||||
* Render this field as altered text, from a fieldset set by the user.
|
||||
*/
|
||||
public function render_altered($alter, $tokens) {
|
||||
// Filter this right away as our substitutions are already sanitized.
|
||||
$value = filter_xss_admin($alter['text']);
|
||||
// We trust admins so we allow any tag content. This is important for
|
||||
// displays such as XML where we should not mess with tags.
|
||||
$value = $alter['text'];
|
||||
$value = strtr($value, $tokens);
|
||||
|
||||
return $value;
|
||||
@@ -1287,6 +1299,12 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
|
||||
if (!empty($alter['replace_spaces'])) {
|
||||
$path = str_replace(' ', '-', $path);
|
||||
}
|
||||
|
||||
if (!empty($alter['unwanted_characters'])) {
|
||||
foreach (explode(' ', $alter['unwanted_characters']) as $unwanted) {
|
||||
$path = str_replace($unwanted, '', $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the URL and move any query and fragment parameters out of the path.
|
||||
|
@@ -8,6 +8,9 @@
|
||||
/**
|
||||
* A handler to provide proper displays for dates.
|
||||
*
|
||||
* This may be used on table fields that hold either UNIX timestamps or SQL
|
||||
* datetime strings.
|
||||
*
|
||||
* @ingroup views_field_handlers
|
||||
*/
|
||||
class views_handler_field_date extends views_handler_field {
|
||||
@@ -138,6 +141,12 @@ class views_handler_field_date extends views_handler_field {
|
||||
*/
|
||||
public function render($values) {
|
||||
$value = $this->get_value($values);
|
||||
|
||||
if (!is_numeric($value)) {
|
||||
// If the value isn't numeric, assume it's an SQL DATETIME.
|
||||
$value = strtotime($value);
|
||||
}
|
||||
|
||||
$format = $this->options['date_format'];
|
||||
if (in_array($format, $this->supported_date_types())) {
|
||||
$custom_format = $this->options['custom_date_format'];
|
||||
|
@@ -41,7 +41,9 @@ class views_handler_field_entity extends views_handler_field {
|
||||
|
||||
// Initialize the entity-type used.
|
||||
$table_data = views_fetch_data($this->table);
|
||||
$this->entity_type = $table_data['table']['entity type'];
|
||||
if (isset($table_data['table']['entity type'])) {
|
||||
$this->entity_type = $table_data['table']['entity type'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -64,6 +64,7 @@ class views_handler_field_links extends views_handler_field {
|
||||
public function options_submit(&$form, &$form_state) {
|
||||
// Remove unselected options.
|
||||
$form_state['values']['options']['fields'] = array_filter($form_state['values']['options']['fields']);
|
||||
parent::options_submit($form, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -118,6 +118,11 @@ class views_handler_field_numeric extends views_handler_field {
|
||||
public function render($values) {
|
||||
$value = $this->get_value($values);
|
||||
|
||||
// Output nothing if the value is null.
|
||||
if (is_null($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Hiding should happen before rounding or adding prefix/suffix.
|
||||
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
|
||||
return '';
|
||||
@@ -127,12 +132,13 @@ class views_handler_field_numeric extends views_handler_field {
|
||||
$value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
|
||||
}
|
||||
else {
|
||||
$remainder = abs($value) - intval(abs($value));
|
||||
$point_position = strpos($value, '.');
|
||||
$remainder = ($point_position === FALSE) ? '' : substr($value, $point_position + 1);
|
||||
$value = $value > 0 ? floor($value) : ceil($value);
|
||||
$value = number_format($value, 0, '', $this->options['separator']);
|
||||
if ($remainder) {
|
||||
// The substr may not be locale safe.
|
||||
$value .= $this->options['decimal'] . substr($remainder, 2);
|
||||
$value .= $this->options['decimal'] . $remainder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,15 +15,14 @@
|
||||
* available as standard operators.
|
||||
*
|
||||
* Object flags:
|
||||
* You can set some specific behavior by setting up the following flags on
|
||||
* your custom class.
|
||||
*
|
||||
* - always_multiple:
|
||||
* Disable the possibility to force a single value.
|
||||
* - no_operator:
|
||||
* Disable the possibility to use operators.
|
||||
* - always_required:
|
||||
* Disable the possibility to allow a exposed input to be optional.
|
||||
* It's possible to set specific behavior using the following flags on the
|
||||
* custom class:
|
||||
* - always_multiple:
|
||||
* Disable the possibility to force a single value.
|
||||
* - no_operator:
|
||||
* Disable the possibility to use operators.
|
||||
* - always_required:
|
||||
* Disable the possibility to allow a exposed input to be optional.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -34,8 +33,10 @@
|
||||
class views_handler_filter extends views_handler {
|
||||
|
||||
/**
|
||||
* Contains the actual value of the field,either configured in the views ui
|
||||
* or entered in the exposed filters.
|
||||
* Contains the actual value of the field.
|
||||
*
|
||||
* This will be either configured in the views UI or entered in the exposed
|
||||
* filters.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
@@ -135,13 +136,17 @@ class views_handler_filter extends views_handler {
|
||||
'use_operator' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'operator_label' => array('default' => '', 'translatable' => TRUE),
|
||||
'operator' => array('default' => ''),
|
||||
'limit_operators' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'available_operators' => array('default' => array()),
|
||||
'identifier' => array('default' => ''),
|
||||
'required' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'remember' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'multiple' => array('default' => FALSE, 'bool' => TRUE),
|
||||
'remember_roles' => array('default' => array(
|
||||
DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
|
||||
)),
|
||||
'remember_roles' => array(
|
||||
'default' => array(
|
||||
DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -205,9 +210,8 @@ class views_handler_filter extends views_handler {
|
||||
/**
|
||||
* Provide the basic form which calls through to subforms.
|
||||
*
|
||||
* If overridden, it is best to call through to the parent,
|
||||
* or to at least make sure all of the functions in this form
|
||||
* are called.
|
||||
* If overridden, it is best to call through to the parent, or to at least
|
||||
* make sure all of the functions in this form are called.
|
||||
*/
|
||||
public function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
@@ -248,7 +252,7 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple validate handler
|
||||
* Simple validate handler.
|
||||
*/
|
||||
public function options_validate(&$form, &$form_state) {
|
||||
$this->operator_validate($form, $form_state);
|
||||
@@ -274,6 +278,8 @@ class views_handler_filter extends views_handler {
|
||||
$this->value_submit($form, $form_state);
|
||||
}
|
||||
if (!empty($this->options['exposed'])) {
|
||||
$options = &$form_state['values']['options']['expose'];
|
||||
$options['available_operators'] = (!empty($options['use_operator']) && !empty($options['limit_operators'])) ? array_filter($options['available_operators']) : array();
|
||||
$this->expose_submit($form, $form_state);
|
||||
}
|
||||
if ($this->is_a_group()) {
|
||||
@@ -293,14 +299,29 @@ class views_handler_filter extends views_handler {
|
||||
/**
|
||||
* Options form subform for setting the operator.
|
||||
*
|
||||
* This may be overridden by child classes, and it must
|
||||
* define $form['operator'];
|
||||
* This may be overridden by child classes, and it must define
|
||||
* $form['operator'].
|
||||
*
|
||||
* @see options_form()
|
||||
*/
|
||||
public function operator_form(&$form, &$form_state) {
|
||||
$options = $this->operator_options();
|
||||
if (!empty($options)) {
|
||||
$available = $this->options['expose']['available_operators'];
|
||||
if ($this->options['expose']['limit_operators'] && count($available)) {
|
||||
foreach ($options as $key => $value) {
|
||||
if (!isset($available[$key])) {
|
||||
unset($options[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we have a valid default value if the current one is
|
||||
// excluded.
|
||||
if (!isset($options[$this->operator])) {
|
||||
// Just choose the first.
|
||||
$this->operator = key($options);
|
||||
}
|
||||
}
|
||||
$form['operator'] = array(
|
||||
'#type' => count($options) < 10 ? 'radios' : 'select',
|
||||
'#title' => t('Operator'),
|
||||
@@ -313,7 +334,7 @@ class views_handler_filter extends views_handler {
|
||||
/**
|
||||
* Provide a list of options for the default operator form.
|
||||
*
|
||||
* Should be overridden by classes that don't override operator_form
|
||||
* Should be overridden by classes that don't override operator_form.
|
||||
*/
|
||||
public function operator_options() {
|
||||
return array();
|
||||
@@ -511,6 +532,33 @@ class views_handler_filter extends views_handler {
|
||||
'#title' => t('Required'),
|
||||
'#default_value' => $this->options['expose']['required'],
|
||||
);
|
||||
|
||||
$operator_options = $this->operator_options();
|
||||
if (count($operator_options)) {
|
||||
$form['expose']['limit_operators'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Limit operators'),
|
||||
'#description' => t('When checked, the operator will be exposed to the user'),
|
||||
'#default_value' => !empty($this->options['expose']['limit_operators']),
|
||||
'#dependency' => array(
|
||||
'edit-options-expose-use-operator' => array(1),
|
||||
),
|
||||
'#description' => t('Restrict which operators will be available to select in the exposed operator form.'),
|
||||
);
|
||||
|
||||
$form['expose']['available_operators'] = array(
|
||||
'#type' => 'checkboxes',
|
||||
'#title' => t('Limit the exposed operators'),
|
||||
'#default_value' => $this->options['expose']['available_operators'],
|
||||
'#prefix' => '<div id="edit-options-expose-available-operators-wrapper"><div id="edit-options-expose-available-operators">',
|
||||
'#suffix' => '</div></div>',
|
||||
'#description' => t('Select which operators will be available to select in the exposed operator form. If none are selected, all the operators listed here will be used.'),
|
||||
'#options' => $operator_options,
|
||||
'#dependency' => array(
|
||||
'edit-options-expose-limit-operators' => array(1),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form['expose']['required'] = array(
|
||||
@@ -533,7 +581,7 @@ class views_handler_filter extends views_handler {
|
||||
);
|
||||
|
||||
if (!empty($form['operator']['#type'])) {
|
||||
// Increase the width of the left (operator) column.
|
||||
// Increase the width of the left (operator) column.
|
||||
$form['operator']['#prefix'] = '<div class="views-group-box views-left-40">';
|
||||
$form['operator']['#suffix'] = '</div>';
|
||||
$form['value']['#prefix'] = '<div class="views-group-box views-right-60">';
|
||||
@@ -552,7 +600,7 @@ class views_handler_filter extends views_handler {
|
||||
'#size' => 40,
|
||||
'#description' => t('This will appear before your operator select field.'),
|
||||
'#dependency' => array(
|
||||
'edit-options-expose-use-operator' => array(1)
|
||||
'edit-options-expose-use-operator' => array(1),
|
||||
),
|
||||
);
|
||||
$form['expose']['operator_id'] = array(
|
||||
@@ -562,7 +610,7 @@ class views_handler_filter extends views_handler {
|
||||
'#size' => 40,
|
||||
'#description' => t('This will appear in the URL after the ? to identify this operator.'),
|
||||
'#dependency' => array(
|
||||
'edit-options-expose-use-operator' => array(1)
|
||||
'edit-options-expose-use-operator' => array(1),
|
||||
),
|
||||
'#fieldset' => 'more',
|
||||
);
|
||||
@@ -629,6 +677,12 @@ class views_handler_filter extends views_handler {
|
||||
if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) {
|
||||
form_error($form['expose']['identifier'], t('This identifier is used by another handler.'));
|
||||
}
|
||||
|
||||
// Filter out roles which weren't selected, so that they aren't exported.
|
||||
// This is purely cosmetic.
|
||||
if (!empty($form_state['values']['options']['expose']['remember_roles'])) {
|
||||
$form_state['values']['options']['expose']['remember_roles'] = array_filter($form_state['values']['options']['expose']['remember_roles']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -657,10 +711,13 @@ class views_handler_filter extends views_handler {
|
||||
if (empty($group['remove'])) {
|
||||
// Check if the title is defined but value wasn't defined.
|
||||
if (!empty($group['title'])) {
|
||||
if ((!is_array($group['value']) && trim($group['value']) == "") ||
|
||||
(is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) {
|
||||
form_error($form['group_info']['group_items'][$id]['value'],
|
||||
t('The value is required if title for this item is defined.'));
|
||||
// No value is needed for 'empty' and 'not empty' operator.
|
||||
if (!in_array($group['operator'], array('empty', 'not empty'))) {
|
||||
if ((!is_array($group['value']) && trim($group['value']) == "") ||
|
||||
(is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) {
|
||||
form_error($form['group_info']['group_items'][$id]['value'],
|
||||
t('The value is required if title for this item is defined.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -786,9 +843,8 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render our chunk of the exposed filter form when selecting
|
||||
* Render our chunk of the exposed filter form when selecting.
|
||||
*
|
||||
* You can override this if it doesn't do what you expect.
|
||||
*/
|
||||
@@ -802,7 +858,7 @@ class views_handler_filter extends views_handler {
|
||||
$operator = $this->options['expose']['operator_id'];
|
||||
$this->operator_form($form, $form_state);
|
||||
$form[$operator] = $form['operator'];
|
||||
$form[$operator]['#title'] = $this->options['expose']['operator_label'];
|
||||
$form[$operator]['#title'] = $this->options['expose']['operator_label'];
|
||||
$form[$operator]['#title_display'] = 'invisible';
|
||||
|
||||
$this->exposed_translate($form[$operator], 'operator');
|
||||
@@ -813,7 +869,19 @@ class views_handler_filter extends views_handler {
|
||||
// Build the form and set the value based on the identifier.
|
||||
if (!empty($this->options['expose']['identifier'])) {
|
||||
$value = $this->options['expose']['identifier'];
|
||||
$this->value_form($form, $form_state);
|
||||
if ($this->operator == 'empty' || $this->operator == 'not empty') {
|
||||
$boolean = new views_handler_filter_boolean_operator();
|
||||
$boolean->value = $this->value = 'All';
|
||||
$boolean->value_value = $this->value_value = '';
|
||||
$boolean->value_options = $this->value_options = array(
|
||||
1 => t('Yes'),
|
||||
0 => t('No'),
|
||||
);
|
||||
$boolean->value_form($form, $form_state);
|
||||
}
|
||||
else {
|
||||
$this->value_form($form, $form_state);
|
||||
}
|
||||
$form[$value] = $form['value'];
|
||||
|
||||
if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') {
|
||||
@@ -955,7 +1023,7 @@ class views_handler_filter extends views_handler {
|
||||
|
||||
// The string '- Any -' will not be rendered.
|
||||
// @see theme_views_ui_build_group_filter_form()
|
||||
$groups = array('All' => '- Any -');
|
||||
$groups = array('All' => '- Any -');
|
||||
|
||||
// Provide 3 options to start when we are in a new group.
|
||||
if (count($this->options['group_info']['group_items']) == 0) {
|
||||
@@ -968,6 +1036,7 @@ class views_handler_filter extends views_handler {
|
||||
if (!empty($form_state['values']['options']['group_info']['group_items'][$item_id]['remove'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Each rows contains three widgets:
|
||||
// a) The title, where users define how they identify a pair of operator
|
||||
// | value.
|
||||
@@ -979,14 +1048,14 @@ class views_handler_filter extends views_handler {
|
||||
$row = array();
|
||||
$groups[$item_id] = '';
|
||||
$this->operator_form($row, $form_state);
|
||||
// Force the operator form to be a select box. Some handlers uses
|
||||
// radios and they occupy a lot of space in a table row.
|
||||
// Force the operator form to be a select box. Some handlers uses radios
|
||||
// and they occupy a lot of space in a table row.
|
||||
$row['operator']['#type'] = 'select';
|
||||
$row['operator']['#title'] = '';
|
||||
$this->value_form($row, $form_state);
|
||||
|
||||
// Fix the dependencies to update value forms when operators changes.
|
||||
// This is needed because forms are inside a new form and their ids
|
||||
// This is needed because forms are inside a new form and their IDs
|
||||
// changes. Dependencies are used when operator changes from to
|
||||
// 'Between', 'Not Between', etc, and two or more widgets are displayed.
|
||||
$without_children = TRUE;
|
||||
@@ -1041,6 +1110,7 @@ class views_handler_filter extends views_handler {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// From all groups, let chose which is the default.
|
||||
$form['group_info']['default_group'] = array(
|
||||
'#type' => 'radios',
|
||||
@@ -1049,8 +1119,9 @@ class views_handler_filter extends views_handler {
|
||||
'#required' => TRUE,
|
||||
'#attributes' => array(
|
||||
'class' => array('default-radios'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
// From all groups, let chose which is the default.
|
||||
$form['group_info']['default_group_multiple'] = array(
|
||||
'#type' => 'checkboxes',
|
||||
@@ -1058,7 +1129,7 @@ class views_handler_filter extends views_handler {
|
||||
'#default_value' => $this->options['group_info']['default_group_multiple'],
|
||||
'#attributes' => array(
|
||||
'class' => array('default-checkboxes'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$form['group_info']['add_group'] = array(
|
||||
@@ -1086,7 +1157,6 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make some translations to a form item to make it more suitable to exposing.
|
||||
*/
|
||||
@@ -1190,13 +1260,13 @@ class views_handler_filter extends views_handler {
|
||||
/**
|
||||
* Transform the input from a grouped filter into a standard filter.
|
||||
*
|
||||
* When a filter is a group, find the set of operator and values
|
||||
* that the choosed item represents, and inform views that a normal
|
||||
* filter was submitted by telling the operator and the value selected.
|
||||
* When a filter is a group, find the set of operator and values that the
|
||||
* choosen item represents, and inform views that a normal filter was
|
||||
* submitted by telling the operator and the value selected.
|
||||
*
|
||||
* The param $selected_group_id is only passed when the filter uses the
|
||||
* checkboxes widget, and this function will be called for each item
|
||||
* choosed in the checkboxes.
|
||||
* checkboxes widget, and this function will be called for each item choosen
|
||||
* in the checkboxes.
|
||||
*/
|
||||
public function convert_exposed_input(&$input, $selected_group_id = NULL) {
|
||||
if ($this->is_a_group()) {
|
||||
@@ -1234,9 +1304,12 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the options available for a grouped filter that users checkboxes
|
||||
* as widget, and therefore has to be applied several times, one per
|
||||
* item selected.
|
||||
* Options available for a grouped filter which uses checkboxes.
|
||||
*
|
||||
* Note: has to be applied several times, one per item selected.
|
||||
*
|
||||
* @return array
|
||||
* The options available for a grouped filter.
|
||||
*/
|
||||
public function group_multiple_exposed_input(&$input) {
|
||||
if (!empty($input[$this->options['group_info']['identifier']])) {
|
||||
@@ -1246,7 +1319,7 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicate whether users can select multiple group items.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if users can select multiple groups items of a grouped exposed
|
||||
@@ -1258,8 +1331,9 @@ class views_handler_filter extends views_handler {
|
||||
|
||||
/**
|
||||
* If set to remember exposed input in the session, store it there.
|
||||
* This function is similar to store_exposed_input but modified to
|
||||
* work properly when the filter is a group.
|
||||
*
|
||||
* This function is similar to store_exposed_input but modified to work
|
||||
* properly when the filter is a group.
|
||||
*/
|
||||
public function store_group_input($input, $status) {
|
||||
if (!$this->is_a_group() || empty($this->options['group_info']['identifier'])) {
|
||||
@@ -1312,14 +1386,13 @@ class views_handler_filter extends views_handler {
|
||||
|
||||
// Various ways to check for the absence of non-required input.
|
||||
if (empty($this->options['expose']['required'])) {
|
||||
if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') {
|
||||
$value = ' ';
|
||||
if ($this->operator == 'empty' || $this->operator == 'not empty') {
|
||||
$value = is_array($value) ? $value['value'] : $value;
|
||||
$this->operator = ($this->operator == 'empty' && empty($value)) || ($this->operator == 'not empty' && !empty($value)) ? 'not empty' : 'empty';
|
||||
}
|
||||
|
||||
if ($this->operator != 'empty' && $this->operator != 'not empty') {
|
||||
if ($value == 'All' || $value === array()) {
|
||||
return FALSE;
|
||||
}
|
||||
if ($value == 'All' || $value === array()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!empty($this->always_multiple) && $value === '') {
|
||||
@@ -1342,7 +1415,7 @@ class views_handler_filter extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Store the exposed input for processing later.
|
||||
*/
|
||||
public function store_exposed_input($input, $status) {
|
||||
if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) {
|
||||
@@ -1392,7 +1465,9 @@ class views_handler_filter extends views_handler {
|
||||
$session[$this->options['expose']['operator_id']] = $input[$this->options['expose']['operator_id']];
|
||||
}
|
||||
|
||||
$session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']];
|
||||
if (isset($input[$this->options['expose']['identifier']])) {
|
||||
$session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1419,9 +1494,9 @@ class views_handler_filter extends views_handler {
|
||||
* @return bool
|
||||
* Whether the filter can be used in OR groups.
|
||||
*/
|
||||
public function can_group() {
|
||||
return TRUE;
|
||||
}
|
||||
public function can_group() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1476,14 +1551,15 @@ class views_handler_filter_broken extends views_handler_filter {
|
||||
* Filter by no empty values, though allow to use "0".
|
||||
*
|
||||
* @param string $var
|
||||
* The string to check.
|
||||
*
|
||||
* @return bool
|
||||
* Indicates if the argument is an empty string.
|
||||
*/
|
||||
function _views_array_filter_zero($var) {
|
||||
return trim($var) != "";
|
||||
return trim($var) != '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@@ -73,7 +73,7 @@ class views_handler_filter_combine extends views_handler_filter_string {
|
||||
// Always add the table of the selected fields to be sure a table alias
|
||||
// exists.
|
||||
$field->ensure_my_table();
|
||||
if (!empty($field->field_alias) && !empty($field->field_alias)) {
|
||||
if (!empty($field->table_alias) && !empty($field->real_field)) {
|
||||
$fields[] = "$field->table_alias.$field->real_field";
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,14 @@ class views_handler_filter_combine extends views_handler_filter_string {
|
||||
$this->query->add_where_expression($this->options['group'], "$field RLIKE $placeholder", array($placeholder => $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function op_not_regex($field) {
|
||||
$placeholder = $this->placeholder();
|
||||
$this->query->add_where_expression($this->options['group'], "$field NOT RLIKE $placeholder", array($placeholder => $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@@ -158,7 +158,7 @@ class views_handler_filter_date extends views_handler_filter_numeric {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
elseif ($operators[$operator]['values'] == 2) {
|
||||
if ($this->value['min'] == '' || $this->value['max'] == '') {
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -116,6 +116,12 @@ class views_handler_filter_numeric extends views_handler_filter {
|
||||
'method' => 'op_regex',
|
||||
'values' => 1,
|
||||
),
|
||||
'not_regular_expression' => array(
|
||||
'title' => t('Not regular expression'),
|
||||
'short' => t('not regex'),
|
||||
'method' => 'op_not_regex',
|
||||
'values' => 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,72 +165,108 @@ class views_handler_filter_numeric extends views_handler_filter {
|
||||
// not rendered, we can't render dependencies; instead we only
|
||||
// render the form items we need.
|
||||
$which = 'all';
|
||||
$limit_operators = !empty($this->options['expose']['limit_operators']) && (count($this->options['expose']['available_operators']) > 0);
|
||||
$use_value = FALSE;
|
||||
$use_minmax = FALSE;
|
||||
|
||||
if (!empty($form['operator'])) {
|
||||
$source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
|
||||
}
|
||||
|
||||
if (!empty($form_state['exposed'])) {
|
||||
$operator_values_with_1_values = $this->operator_values(1);
|
||||
$operator_values_with_2_values = $this->operator_values(2);
|
||||
if ($limit_operators) {
|
||||
// If limit operators is enabled, check that at least one operator
|
||||
// with two values is enabled to display the min max widgets
|
||||
foreach ($operator_values_with_2_values as $operator) {
|
||||
if (isset($this->options['expose']['available_operators'][$operator])) {
|
||||
$use_minmax = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// the same for operators with one value
|
||||
foreach ($operator_values_with_1_values as $operator) {
|
||||
if (isset($this->options['expose']['available_operators'][$operator])) {
|
||||
$use_value = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$use_minmax = $use_value = TRUE;
|
||||
}
|
||||
$identifier = $this->options['expose']['identifier'];
|
||||
|
||||
if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
|
||||
// exposed and locked.
|
||||
$which = in_array($this->operator, $this->operator_values(2)) ? 'minmax' : 'value';
|
||||
$which = in_array($this->operator, $operator_values_with_2_values) ? 'minmax' : 'value';
|
||||
}
|
||||
else {
|
||||
$source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($which == 'all') {
|
||||
$form['value']['value'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['value'],
|
||||
'#dependency' => array($source => $this->operator_values(1)),
|
||||
);
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) {
|
||||
$form_state['input'][$identifier]['value'] = $this->value['value'];
|
||||
}
|
||||
else {
|
||||
$use_minmax = $use_value = TRUE;
|
||||
}
|
||||
elseif ($which == 'value') {
|
||||
// When exposed we drop the value-value and just do value if
|
||||
// the operator is locked.
|
||||
$form['value'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['value'],
|
||||
);
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
|
||||
$form_state['input'][$identifier] = $this->value['value'];
|
||||
|
||||
if ($use_value) {
|
||||
if ($which == 'all') {
|
||||
$form['value']['value'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['value'],
|
||||
'#dependency' => array($source => $this->operator_values(1)),
|
||||
);
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) {
|
||||
$form_state['input'][$identifier]['value'] = $this->value['value'];
|
||||
}
|
||||
}
|
||||
elseif ($which == 'value') {
|
||||
// When exposed we drop the value-value and just do value if
|
||||
// the operator is locked.
|
||||
$form['value'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['value'],
|
||||
);
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
|
||||
$form_state['input'][$identifier] = $this->value['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($which == 'all' || $which == 'minmax') {
|
||||
$form['value']['min'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Min') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['min'],
|
||||
);
|
||||
$form['value']['max'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('And max') : t('And'),
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['max'],
|
||||
);
|
||||
if ($which == 'all') {
|
||||
$dependency = array(
|
||||
'#dependency' => array($source => $this->operator_values(2)),
|
||||
if ($use_minmax) {
|
||||
$form['value']['min'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('Min') : '',
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['min'],
|
||||
);
|
||||
$form['value']['min'] += $dependency;
|
||||
$form['value']['max'] += $dependency;
|
||||
$form['value']['max'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => empty($form_state['exposed']) ? t('And max') : t('And'),
|
||||
'#size' => 30,
|
||||
'#default_value' => $this->value['max'],
|
||||
);
|
||||
|
||||
if ($which == 'all') {
|
||||
$dependency = array(
|
||||
'#dependency' => array($source => $this->operator_values(2)),
|
||||
);
|
||||
|
||||
$form['value']['min'] += $dependency;
|
||||
$form['value']['max'] += $dependency;
|
||||
}
|
||||
}
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min'])) {
|
||||
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min']) && $use_minmax) {
|
||||
$form_state['input'][$identifier]['min'] = $this->value['min'];
|
||||
}
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max'])) {
|
||||
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max']) && $use_minmax) {
|
||||
$form_state['input'][$identifier]['max'] = $this->value['max'];
|
||||
}
|
||||
|
||||
@@ -291,6 +333,13 @@ class views_handler_filter_numeric extends views_handler_filter {
|
||||
$this->query->add_where($this->options['group'], $field, $this->value['value'], 'RLIKE');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function op_not_regex($field) {
|
||||
$this->query->add_where($this->options['group'], $field, $this->value['value'], 'NOT RLIKE');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@@ -135,6 +135,12 @@ class views_handler_filter_string extends views_handler_filter {
|
||||
'method' => 'op_regex',
|
||||
'values' => 1,
|
||||
),
|
||||
'not_regular_expression' => array(
|
||||
'title' => t('Not regular expression'),
|
||||
'short' => t('not regex'),
|
||||
'method' => 'op_not_regex',
|
||||
'values' => 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -274,7 +280,9 @@ class views_handler_filter_string extends views_handler_filter {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function op_contains($field) {
|
||||
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE');
|
||||
if (!empty($this->value)) {
|
||||
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,6 +379,13 @@ class views_handler_filter_string extends views_handler_filter {
|
||||
$this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function op_not_regex($field) {
|
||||
$this->query->add_where($this->options['group'], $field, $this->value, 'NOT RLIKE');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@@ -19,9 +19,9 @@ The "building block" design of the views system provides power and flexibility,
|
||||
|
||||
<li><a href="topic:views/header">Header</a>, which allow you to add by default one or more text area above the views output. </li>
|
||||
|
||||
<li><a href="topic:views/footer">Footer</a>, which allow you to add by default one or more text area beneath the views output. </li>
|
||||
<li><a href="topic:views/footer">Footer</a>, which allow you to add by default one or more text area beneath the views output. </li>
|
||||
|
||||
<li>The <a href="topic:views/footer">Emtpy Text</a> content will be displayed, when you choose in the Arguments Section "Action to take if argument is not present" the option "Display empty text".</li>
|
||||
<li>The <a href="topic:views/footer">Emtpy Text</a> content will be displayed, when you choose in the Arguments Section "Action to take if argument is not present" the option "Display empty text".</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<h2>Troubleshooting UI crashes</h2>
|
||||
|
||||
There are a number of reasons why the Views UI may crash; the most common state or result of a crash is either a white screen (everyone's favorite WSOD), or a screen of what looks like garbage text. This is generally a javascript crash of some fashion.
|
||||
There are a number of reasons why the Views UI may crash; the most common state or result of a crash is either a white screen (everyone's favorite WSOD), or a screen of what looks like garbage text. This is generally JavaScript crash of some fashion.
|
||||
|
||||
To get the most timely and accurate help in the issue queue, please try to gather this information:
|
||||
|
||||
Check your javascript console. In Firefox, you can hit ctrl-shift-j or use firebug. Copy this information into the issue, or attach it as a text file. Really - this is the single biggest thing you can do to help figure out where the crash is coming from.
|
||||
Check your JavaScript console. In Firefox, you can hit ctrl-shift-j or use firebug. Copy this information into the issue, or attach it as a text file. Really - this is the single biggest thing you can do to help figure out where the crash is coming from.
|
||||
|
||||
|
||||
<h3>JSON prepends data with jQuery, causing editing and preview problems.</h3>
|
||||
|
@@ -691,7 +691,7 @@ function views_ui_ajax_update_form($form, $form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-Javascript fallback for updating the add view form.
|
||||
* Non-JavaScript fallback for updating the add view form.
|
||||
*/
|
||||
function views_ui_nojs_submit($form, &$form_state) {
|
||||
$form_state['rebuild'] = TRUE;
|
||||
@@ -1598,7 +1598,7 @@ function views_ui_get_display_tab_details($view, $display) {
|
||||
$is_enabled = $display->handler->get_option('enabled');
|
||||
|
||||
if (!$is_display_deleted && $is_deletable && !$is_default) {
|
||||
$prefix = '<div class="ctools-no-js ctools-button ctools-dropbutton"><div class="ctools-link"><a href="#" class="ctools-twisty ctools-text">open</a></div><div class="ctools-content"><ul class="horizontal right actions">';
|
||||
$prefix = '<div class="ctools-no-js ctools-button ctools-dropbutton"><div class="ctools-link"><a href="#" class="ctools-twisty ctools-text"><span class="element-invisible">open</span></a></div><div class="ctools-content"><ul class="horizontal right actions">';
|
||||
$suffix = '</ul></div></div>';
|
||||
$item_element = 'li';
|
||||
}
|
||||
@@ -2987,6 +2987,10 @@ function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FAL
|
||||
* together.
|
||||
*/
|
||||
function views_ui_ajax_form($js, $key, $view, $display_id = '') {
|
||||
$args = func_get_args();
|
||||
// Remove the known args.
|
||||
array_splice($args, 0, 4);
|
||||
|
||||
// Reset the cache of IDs. Drupal rather aggressively prevents id duplication
|
||||
// but this causes it to remember IDs that are no longer even being used.
|
||||
if (isset($_POST['ajax_html_ids'])) {
|
||||
@@ -2999,9 +3003,6 @@ function views_ui_ajax_form($js, $key, $view, $display_id = '') {
|
||||
}
|
||||
|
||||
views_include('ajax');
|
||||
$args = func_get_args();
|
||||
// Remove the known args.
|
||||
array_splice($args, 0, 4);
|
||||
|
||||
$form_state = views_ui_build_form_state($js, $key, $view, $display_id, $args);
|
||||
// check to see if this is the top form of the stack. If it is, pop
|
||||
@@ -3044,6 +3045,11 @@ function views_ui_ajax_form($js, $key, $view, $display_id = '') {
|
||||
$stack = $view->stack;
|
||||
$top = array_shift($stack);
|
||||
$top[0] = $js;
|
||||
|
||||
// Change view into a reference.
|
||||
$stepview = $top[2];
|
||||
$top[2] = &$stepview;
|
||||
|
||||
$form_state = call_user_func_array('views_ui_build_form_state', $top);
|
||||
$form_state['input'] = array();
|
||||
$form_state['url'] = url(views_ui_build_form_url($form_state));
|
||||
@@ -3165,7 +3171,7 @@ function views_ui_reorder_displays_form($form, &$form_state) {
|
||||
$form['#title'] = t('Displays Reorder');
|
||||
$form['#section'] = 'reorder';
|
||||
|
||||
// Add javascript settings that will be added via $.extend for tabledragging.
|
||||
// Add JavaScript settings that will be added via $.extend for tabledragging.
|
||||
$form['#js']['tableDrag']['reorder-displays']['weight'][0] = array(
|
||||
'target' => 'weight',
|
||||
'source' => NULL,
|
||||
@@ -3548,7 +3554,7 @@ function views_ui_rearrange_form($form, &$form_state) {
|
||||
);
|
||||
}
|
||||
|
||||
// Add javascript settings that will be added via $.extend for tabledragging.
|
||||
// Add JavaScript settings that will be added via $.extend for tabledragging.
|
||||
$form['#js']['tableDrag']['arrange']['weight'][0] = array(
|
||||
'target' => 'weight',
|
||||
'source' => NULL,
|
||||
@@ -5036,7 +5042,7 @@ function views_ui_admin_settings_advanced() {
|
||||
$form['debug']['views_no_javascript'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Disable JavaScript with Views'),
|
||||
'#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without javascript; it's just not as good."),
|
||||
'#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without JavaScript; it's just not as good."),
|
||||
'#default_value' => variable_get('views_no_javascript', FALSE),
|
||||
);
|
||||
|
||||
|
@@ -18,8 +18,8 @@ function views_ajax() {
|
||||
if (isset($_REQUEST['view_name']) && isset($_REQUEST['view_display_id'])) {
|
||||
$name = $_REQUEST['view_name'];
|
||||
$display_id = $_REQUEST['view_display_id'];
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL;
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', htmlspecialchars_decode($_REQUEST['view_args'], ENT_QUOTES)) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? htmlspecialchars_decode($_REQUEST['view_path'], ENT_QUOTES) : NULL;
|
||||
$dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL;
|
||||
$pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL;
|
||||
|
||||
@@ -72,7 +72,8 @@ function views_ajax() {
|
||||
// Reuse the same DOM id so it matches that in Drupal.settings.
|
||||
$view->dom_id = $dom_id;
|
||||
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, $view->preview($display_id, $args));
|
||||
// Always return HTML with the same DOM ID that was sent by the browser.
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, preg_replace('/view-dom-id-[a-zA-Z0-9_-]+/', 'view-dom-id-' . $view->dom_id, $view->preview($display_id, $args), 1));
|
||||
}
|
||||
drupal_alter('views_ajax_data', $commands, $view);
|
||||
return array('#type' => 'ajax', '#commands' => $commands);
|
||||
|
@@ -278,6 +278,9 @@ class views_handler extends views_object {
|
||||
return $title;
|
||||
}
|
||||
$title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title'];
|
||||
if (empty($this->definition['group'])) {
|
||||
return $title;
|
||||
}
|
||||
return t('!group: !title', array('!group' => $this->definition['group'], '!title' => $title));
|
||||
}
|
||||
|
||||
@@ -418,8 +421,10 @@ class views_handler extends views_object {
|
||||
'#collapsed' => TRUE,
|
||||
'#weight' => 150,
|
||||
);
|
||||
|
||||
// Allow to alter the default values brought into the form.
|
||||
drupal_alter('views_handler_options', $this->options, $view);
|
||||
// Triggers hook_views_handler_options_alter().
|
||||
drupal_alter('views_handler_options', $this->options, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1001,7 +1006,8 @@ class views_many_to_one_helper {
|
||||
|
||||
// Clone the join for each table:
|
||||
$this->handler->table_aliases = array();
|
||||
foreach ($this->handler->value as $value) {
|
||||
$values = $this->handler->operator === 'not' ? array($this->handler->value) : $this->handler->value;
|
||||
foreach ($values as $value) {
|
||||
$join = $this->get_join();
|
||||
if ($this->handler->operator == 'and') {
|
||||
$join->type = 'INNER';
|
||||
@@ -1014,6 +1020,9 @@ class views_many_to_one_helper {
|
||||
'value' => $value,
|
||||
'numeric' => !empty($this->handler->definition['numeric']),
|
||||
);
|
||||
if (($this->handler->is_a_group() && is_array($value)) || $this->handler->operator === 'not') {
|
||||
$value = serialize($value);
|
||||
}
|
||||
// The table alias needs to be unique to this value across the
|
||||
// multiple times the filter or argument is called by the view.
|
||||
if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) {
|
||||
@@ -1028,6 +1037,9 @@ class views_many_to_one_helper {
|
||||
$this->handler->table_alias = $alias;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->handler->table_aliases[$value] = $this->handler->view->many_to_one_aliases[$field][$value];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->handler->table_alias;
|
||||
@@ -1068,7 +1080,12 @@ class views_many_to_one_helper {
|
||||
}
|
||||
else {
|
||||
$value = is_array($value) ? array_pop($value) : $value;
|
||||
$operator = '=';
|
||||
if (is_array($value) && count($value) > 1) {
|
||||
$operator = 'IN';
|
||||
}
|
||||
else {
|
||||
$operator = '=';
|
||||
}
|
||||
}
|
||||
$add_condition = FALSE;
|
||||
}
|
||||
@@ -1675,15 +1692,18 @@ class views_join {
|
||||
}
|
||||
|
||||
if (is_array($info['value'])) {
|
||||
$value_placeholders = array();
|
||||
|
||||
// With an array of values, we need multiple placeholders and the
|
||||
// 'IN' operator is implicit.
|
||||
foreach ($info['value'] as $value) {
|
||||
$placeholder_i = $view_query->placeholder('views_join_condition_');
|
||||
$value_placeholders[] = $placeholder_i;
|
||||
$arguments[$placeholder_i] = $value;
|
||||
}
|
||||
|
||||
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
|
||||
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
|
||||
$placeholder = '( ' . implode(', ', $value_placeholders) . ' )';
|
||||
}
|
||||
else {
|
||||
// With a single value, the '=' operator is implicit.
|
||||
|
@@ -843,7 +843,11 @@ class view extends views_db_object {
|
||||
|
||||
$argument->set_relationship();
|
||||
|
||||
$arg = isset($this->args[$position]) ? $this->args[$position] : NULL;
|
||||
$arg = NULL;
|
||||
if (isset($this->args[$position]) && $this->args[$position] !== '') {
|
||||
$arg = $this->args[$position];
|
||||
}
|
||||
|
||||
$argument->position = $position;
|
||||
|
||||
if (isset($arg) || $argument->has_default_argument()) {
|
||||
@@ -1575,7 +1579,7 @@ class view extends views_db_object {
|
||||
/**
|
||||
* Override the view's current title.
|
||||
*
|
||||
* The tokens in the title get's replaced before rendering.
|
||||
* The tokens in the title get replaced before rendering.
|
||||
*/
|
||||
public function set_title($title) {
|
||||
$this->build_info['title'] = $title;
|
||||
@@ -2008,7 +2012,7 @@ class view extends views_db_object {
|
||||
public function clone_view() {
|
||||
$clone = clone $this;
|
||||
|
||||
$keys = array('current_display', 'display_handler', 'build_info', 'built', 'executed', 'attachment_before', 'attachment_after', 'field', 'argument', 'filter', 'sort', 'relationship', 'header', 'footer', 'empty', 'query', 'inited', 'style_plugin', 'plugin_name', 'exposed_data', 'exposed_input', 'exposed_widgets', 'many_to_one_tables', 'feed_icon');
|
||||
$keys = array('current_display', 'display_handler', 'build_info', 'built', 'executed', 'attachment_before', 'attachment_after', 'field', 'argument', 'filter', 'sort', 'relationship', 'header', 'footer', 'empty', 'query', 'inited', 'style_plugin', 'plugin_name', 'exposed_data', 'exposed_input', 'exposed_widgets', 'many_to_one_aliases', 'many_to_one_tables', 'feed_icon');
|
||||
foreach ($keys as $key) {
|
||||
if (isset($clone->{$key})) {
|
||||
unset($clone->{$key});
|
||||
|
@@ -20,7 +20,7 @@
|
||||
Drupal.views.instances = {};
|
||||
|
||||
/**
|
||||
* Javascript object for a certain view.
|
||||
* JavaScript object for a certain view.
|
||||
*/
|
||||
Drupal.views.ajaxView = function(settings) {
|
||||
var selector = '.view-dom-id-' + settings.view_dom_id;
|
||||
@@ -69,9 +69,6 @@
|
||||
|
||||
// Add the ajax to pagers.
|
||||
this.$view
|
||||
// Don't attach to nested views. Doing so would attach multiple behaviors
|
||||
// to a given element.
|
||||
.filter(jQuery.proxy(this.filterNestedViews, this))
|
||||
.once(jQuery.proxy(this.attachPagerAjax, this));
|
||||
|
||||
// Add a trigger to update this view specifically. In order to trigger a
|
||||
@@ -100,12 +97,6 @@
|
||||
this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings);
|
||||
};
|
||||
|
||||
Drupal.views.ajaxView.prototype.filterNestedViews = function() {
|
||||
// If there is at least one parent with a view class, this view
|
||||
// is nested (e.g., an attachment). Bail.
|
||||
return !this.$view.parents('.view').length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach the ajax behavior to each link.
|
||||
*/
|
||||
@@ -119,8 +110,20 @@
|
||||
*/
|
||||
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) {
|
||||
var $link = $(link);
|
||||
// Don't attach to pagers inside nested views.
|
||||
if ($link.closest('.view')[0] !== this.$view[0]) {
|
||||
return;
|
||||
}
|
||||
var viewData = {};
|
||||
var href = $link.attr('href');
|
||||
|
||||
// Provide a default page if none has been set. This must be done
|
||||
// prior to merging with settings to avoid accidentally using the
|
||||
// page landed on instead of page 1.
|
||||
if (typeof(viewData.page) === 'undefined') {
|
||||
viewData.page = 0;
|
||||
}
|
||||
|
||||
// Construct an object using the settings defaults and then overriding
|
||||
// with data specific to the link.
|
||||
$.extend(
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* @see views_ui.module
|
||||
* @see js/jquery.ui.dialog.min.js
|
||||
*
|
||||
* This javascript patch overwrites the $.ui.dialog.overlay.events object to remove
|
||||
* This JavaScript patch overwrites the $.ui.dialog.overlay.events object to remove
|
||||
* the mousedown, mouseup and click events from the list of events that are bound
|
||||
* in $.ui.dialog.overlay.create
|
||||
*
|
||||
|
@@ -981,11 +981,11 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) {
|
||||
var difference = 0;
|
||||
difference += parseInt($scroll.css('padding-top'));
|
||||
difference += parseInt($scroll.css('padding-bottom'));
|
||||
difference += $('.views-override').outerHeight(true);
|
||||
difference += $('.views-messages').outerHeight(true);
|
||||
difference += $('#views-ajax-title').outerHeight(true);
|
||||
difference += $('.views-add-form-selected').outerHeight(true);
|
||||
difference += $('.form-buttons', $modal).outerHeight(true);
|
||||
difference += $('.views-override').outerHeight(true) || 0;
|
||||
difference += $('.views-messages').outerHeight(true) || 0;
|
||||
difference += $('#views-ajax-title').outerHeight(true) || 0;
|
||||
difference += $('.views-add-form-selected').outerHeight(true) || 0;
|
||||
difference += $('.form-buttons', $modal).outerHeight(true) || 0;
|
||||
|
||||
height = scrollHeight + difference;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* Javascript related to contextual links.
|
||||
* JavaScript related to contextual links.
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* Javascript related to the main view list.
|
||||
* JavaScript related to the main view list.
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
|
@@ -11,12 +11,12 @@
|
||||
class views_plugin_row_aggregator_rss extends views_plugin_row {
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $base_table = 'aggregator_item';
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $base_field = 'iid';
|
||||
|
||||
@@ -52,8 +52,8 @@ class views_plugin_row_aggregator_rss extends views_plugin_row {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render($row) {
|
||||
$iid = $row->{$this->field_alias};
|
||||
$sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, ";
|
||||
$iid = $row->{$this->field_alias};
|
||||
$sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, ";
|
||||
$sql .= "ai.timestamp, ai.guid, af.title AS feed_title, ai.link AS feed_LINK ";
|
||||
$sql .= "FROM {aggregator_item} ai LEFT JOIN {aggregator_feed} af ON ai.fid = af.fid ";
|
||||
$sql .= "WHERE ai.iid = :iid";
|
||||
@@ -72,7 +72,7 @@ class views_plugin_row_aggregator_rss extends views_plugin_row {
|
||||
array(
|
||||
'key' => 'guid',
|
||||
'value' => $item->guid,
|
||||
'attributes' => array('isPermaLink' => 'false')
|
||||
'attributes' => array('isPermaLink' => 'false'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ class views_plugin_row_aggregator_rss extends views_plugin_row {
|
||||
return theme($this->theme_functions(), array(
|
||||
'view' => $this->view,
|
||||
'options' => $this->options,
|
||||
'row' => $item
|
||||
'row' => $item,
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -133,8 +133,8 @@ function comment_views_data() {
|
||||
|
||||
// Email address.
|
||||
$data['comment']['mail'] = array(
|
||||
'title' => t('Mail'),
|
||||
'help' => t('Email of user that posted the comment. Will be empty if the author is a registered user.'),
|
||||
'title' => t('E-mail'),
|
||||
'help' => t('E-mail of user that posted the comment. Will be empty if the author is a registered user.'),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field',
|
||||
'click sortable' => TRUE,
|
||||
@@ -320,7 +320,7 @@ function comment_views_data() {
|
||||
|
||||
// Status (approved or not).
|
||||
$data['comment']['status'] = array(
|
||||
'title' => t('Approved'),
|
||||
'title' => t('Approved status'),
|
||||
'help' => t('Whether the comment is approved (or still in the moderation queue).'),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field_boolean',
|
||||
@@ -331,7 +331,7 @@ function comment_views_data() {
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_boolean_operator',
|
||||
'label' => t('Approved comment'),
|
||||
'label' => t('Approved comment status'),
|
||||
'type' => 'yes-no',
|
||||
),
|
||||
'sort' => array(
|
||||
@@ -342,7 +342,7 @@ function comment_views_data() {
|
||||
// Link to view comment.
|
||||
$data['comment']['view_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('View link'),
|
||||
'title' => t('Link to comment'),
|
||||
'help' => t('Provide a simple link to view the comment.'),
|
||||
'handler' => 'views_handler_field_comment_link',
|
||||
),
|
||||
@@ -351,7 +351,7 @@ function comment_views_data() {
|
||||
// Link to edit comment.
|
||||
$data['comment']['edit_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Edit link'),
|
||||
'title' => t('Link to edit comment'),
|
||||
'help' => t('Provide a simple link to edit the comment.'),
|
||||
'handler' => 'views_handler_field_comment_link_edit',
|
||||
),
|
||||
@@ -360,7 +360,7 @@ function comment_views_data() {
|
||||
// Link to delete comment.
|
||||
$data['comment']['delete_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Delete link'),
|
||||
'title' => t('Link to delete comment'),
|
||||
'help' => t('Provide a simple link to delete the comment.'),
|
||||
'handler' => 'views_handler_field_comment_link_delete',
|
||||
),
|
||||
@@ -369,7 +369,7 @@ function comment_views_data() {
|
||||
// Link to approve comment.
|
||||
$data['comment']['approve_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Approve link'),
|
||||
'title' => t('Link to approve comment'),
|
||||
'help' => t('Provide a simple link to approve the comment.'),
|
||||
'handler' => 'views_handler_field_comment_link_approve',
|
||||
),
|
||||
@@ -378,7 +378,7 @@ function comment_views_data() {
|
||||
// Link to reply to comment.
|
||||
$data['comment']['replyto_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Reply-to link'),
|
||||
'title' => t('Link to reply-to comment'),
|
||||
'help' => t('Provide a simple link to reply to the comment.'),
|
||||
'handler' => 'views_handler_field_comment_link_reply',
|
||||
),
|
||||
@@ -419,6 +419,20 @@ function comment_views_data() {
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment']['cid'] = array(
|
||||
'title' => t('Comment id'),
|
||||
'help' => t('Unique identifier for the comment.'),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_numeric',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_numeric',
|
||||
),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field_numeric',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment']['uid'] = array(
|
||||
'title' => t('Author uid'),
|
||||
'help' => t('If you need more fields than the uid add the comment: author relationship'),
|
||||
@@ -544,7 +558,7 @@ function comment_views_data() {
|
||||
'title' => t('Last comment CID'),
|
||||
'help' => t('Display the last comment of a node'),
|
||||
'relationship' => array(
|
||||
'title' => t('Last Comment'),
|
||||
'title' => t('Last comment'),
|
||||
'help' => t('The last comment of a node.'),
|
||||
'group' => t('Comment'),
|
||||
'base' => 'comment',
|
||||
|
@@ -16,7 +16,7 @@ class views_handler_field_comment_link_approve extends views_handler_field_comme
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function access() {
|
||||
//needs permission to administer comments in general
|
||||
// Needs permission to administer comments in general.
|
||||
return user_access('administer comments');
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class views_handler_field_comment_link_approve extends views_handler_field_comme
|
||||
}
|
||||
|
||||
$text = !empty($this->options['text']) ? $this->options['text'] : t('approve');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
|
||||
$this->options['alter']['make_link'] = TRUE;
|
||||
$this->options['alter']['path'] = "comment/" . $cid . "/approve";
|
||||
|
@@ -25,7 +25,7 @@ class views_handler_field_comment_link_delete extends views_handler_field_commen
|
||||
*/
|
||||
public function render_link($data, $values) {
|
||||
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
|
||||
$this->options['alter']['make_link'] = TRUE;
|
||||
$this->options['alter']['path'] = "comment/" . $cid . "/delete";
|
||||
|
@@ -25,8 +25,8 @@ class views_handler_field_comment_link_reply extends views_handler_field_comment
|
||||
*/
|
||||
public function render_link($data, $values) {
|
||||
$text = !empty($this->options['text']) ? $this->options['text'] : t('reply');
|
||||
$nid = $this->get_value($values, 'nid');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
$nid = $this->get_value($values, 'nid');
|
||||
$cid = $this->get_value($values, 'cid');
|
||||
|
||||
$this->options['alter']['make_link'] = TRUE;
|
||||
$this->options['alter']['path'] = "comment/reply/" . $nid . '/' . $cid;
|
||||
|
@@ -127,7 +127,7 @@ class views_handler_field_field extends views_handler_field {
|
||||
*/
|
||||
public function access() {
|
||||
$base_table = $this->get_base_table();
|
||||
return field_access('view', $this->field_info, $this->definition['entity_tables'][$base_table]);
|
||||
return isset($this->definition['entity_tables'][$base_table]) && field_access('view', $this->field_info, $this->definition['entity_tables'][$base_table]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,6 +537,7 @@ class views_handler_field_field extends views_handler_field {
|
||||
'ul' => t('Unordered list'),
|
||||
'ol' => t('Ordered list'),
|
||||
'separator' => t('Simple separator'),
|
||||
'count' => t('Count'),
|
||||
),
|
||||
'#dependency' => array('edit-options-group-rows' => array(TRUE)),
|
||||
'#default_value' => $this->options['multi_type'],
|
||||
@@ -727,6 +728,9 @@ class views_handler_field_field extends views_handler_field {
|
||||
if ($this->options['multi_type'] == 'separator') {
|
||||
return implode(filter_xss_admin($this->options['separator']), $items);
|
||||
}
|
||||
elseif ($this->options['multi_type'] == 'count') {
|
||||
return count($items);
|
||||
}
|
||||
else {
|
||||
return theme('item_list',
|
||||
array(
|
||||
|
@@ -155,7 +155,7 @@ function node_views_data() {
|
||||
|
||||
// Published status.
|
||||
$data['node']['status'] = array(
|
||||
'title' => t('Published'),
|
||||
'title' => t('Published status'),
|
||||
'help' => t('Whether or not the content is published.'),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field_boolean',
|
||||
@@ -166,7 +166,7 @@ function node_views_data() {
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_boolean_operator',
|
||||
'label' => t('Published'),
|
||||
'label' => t('Published status'),
|
||||
'type' => 'yes-no',
|
||||
'use equal' => TRUE,
|
||||
// Use status = 1 instead of status <> 0 in WHERE statment.
|
||||
@@ -178,18 +178,18 @@ function node_views_data() {
|
||||
|
||||
// Published status + extra.
|
||||
$data['node']['status_extra'] = array(
|
||||
'title' => t('Published or admin'),
|
||||
'title' => t('Published status or admin user'),
|
||||
'help' => t('Filters out unpublished content if the current user cannot view it.'),
|
||||
'filter' => array(
|
||||
'field' => 'status',
|
||||
'handler' => 'views_handler_filter_node_status',
|
||||
'label' => t('Published or admin'),
|
||||
'label' => t('Published status or admin user'),
|
||||
),
|
||||
);
|
||||
|
||||
// Promote status.
|
||||
$data['node']['promote'] = array(
|
||||
'title' => t('Promoted to front page'),
|
||||
'title' => t('Promoted to front page status'),
|
||||
'help' => t('Whether or not the content is promoted to the front page.'),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field_boolean',
|
||||
@@ -200,7 +200,7 @@ function node_views_data() {
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_boolean_operator',
|
||||
'label' => t('Promoted to front page'),
|
||||
'label' => t('Promoted to front page status'),
|
||||
'type' => 'yes-no',
|
||||
),
|
||||
'sort' => array(
|
||||
@@ -211,7 +211,7 @@ function node_views_data() {
|
||||
// Sticky.
|
||||
$data['node']['sticky'] = array(
|
||||
// The item it appears as on the UI,
|
||||
'title' => t('Sticky'),
|
||||
'title' => t('Sticky status'),
|
||||
// The help that appears on the UI,
|
||||
'help' => t('Whether or not the content is sticky.'),
|
||||
// Information for displaying a title as a field.
|
||||
@@ -224,7 +224,7 @@ function node_views_data() {
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_boolean_operator',
|
||||
'label' => t('Sticky'),
|
||||
'label' => t('Sticky status'),
|
||||
'type' => 'yes-no',
|
||||
),
|
||||
'sort' => array(
|
||||
@@ -241,7 +241,7 @@ function node_views_data() {
|
||||
$data['node']['view_node']['moved to'] = array('views_entity_node', 'view_node');
|
||||
$data['views_entity_node']['view_node'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link'),
|
||||
'title' => t('Link to content'),
|
||||
'help' => t('Provide a simple link to the content.'),
|
||||
'handler' => 'views_handler_field_node_link',
|
||||
),
|
||||
@@ -250,7 +250,7 @@ function node_views_data() {
|
||||
$data['node']['edit_node']['moved to'] = array('views_entity_node', 'edit_node');
|
||||
$data['views_entity_node']['edit_node'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Edit link'),
|
||||
'title' => t('Link to edit content'),
|
||||
'help' => t('Provide a simple link to edit the content.'),
|
||||
'handler' => 'views_handler_field_node_link_edit',
|
||||
),
|
||||
@@ -259,7 +259,7 @@ function node_views_data() {
|
||||
$data['node']['delete_node']['moved to'] = array('views_entity_node', 'delete_node');
|
||||
$data['views_entity_node']['delete_node'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Delete link'),
|
||||
'title' => t('Link to delete content'),
|
||||
'help' => t('Provide a simple link to delete the content.'),
|
||||
'handler' => 'views_handler_field_node_link_delete',
|
||||
),
|
||||
@@ -387,7 +387,7 @@ function node_views_data() {
|
||||
'title' => t('Author uid'),
|
||||
'help' => t('The user authoring the content. If you need more fields than the uid add the content: author relationship'),
|
||||
'relationship' => array(
|
||||
'title' => t('Author'),
|
||||
'title' => t('Content author'),
|
||||
'help' => t('Relate content to the user who created it.'),
|
||||
'handler' => 'views_handler_relationship',
|
||||
'base' => 'users',
|
||||
@@ -606,7 +606,7 @@ function node_views_data() {
|
||||
|
||||
$data['node_revision']['link_to_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link'),
|
||||
'title' => t('Link to revision'),
|
||||
'help' => t('Provide a simple link to the revision.'),
|
||||
'handler' => 'views_handler_field_node_revision_link',
|
||||
),
|
||||
@@ -614,7 +614,7 @@ function node_views_data() {
|
||||
|
||||
$data['node_revision']['revert_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Revert link'),
|
||||
'title' => t('Link to revert revision'),
|
||||
'help' => t('Provide a simple link to revert to the revision.'),
|
||||
'handler' => 'views_handler_field_node_revision_link_revert',
|
||||
),
|
||||
@@ -622,7 +622,7 @@ function node_views_data() {
|
||||
|
||||
$data['node_revision']['delete_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Delete link'),
|
||||
'title' => t('Link to delete revision'),
|
||||
'help' => t('Provide a simple link to delete the content revision.'),
|
||||
'handler' => 'views_handler_field_node_revision_link_delete',
|
||||
),
|
||||
|
@@ -17,7 +17,7 @@ function taxonomy_views_data() {
|
||||
// 'taxonomy_vocabulary' table.
|
||||
$data['vocabulary']['moved to'] = 'taxonomy_vocabulary';
|
||||
$data['taxonomy_vocabulary']['table']['group'] = t('Taxonomy vocabulary');
|
||||
|
||||
$data['taxonomy_vocabulary']['table']['entity type'] = 'taxonomy_vocabulary';
|
||||
$data['taxonomy_vocabulary']['table']['join'] = array(
|
||||
// Vocabulary links to taxonomy_term_data directly via vid.
|
||||
'taxonomy_term_data' => array(
|
||||
|
@@ -59,20 +59,26 @@ class views_handler_field_term_link_edit extends views_handler_field {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render($values) {
|
||||
// Check there is an actual value, as on a relationship there may not be.
|
||||
if ($tid = $this->get_value($values, 'tid')) {
|
||||
// Mock a term object for taxonomy_term_edit_access(). Use machine name
|
||||
// and vid to ensure compatibility with vid based and machine name based
|
||||
// access checks. See http://drupal.org/node/995156
|
||||
$term = new stdClass();
|
||||
$term->vid = $values->{$this->aliases['vid']};
|
||||
$term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']};
|
||||
if (taxonomy_term_edit_access($term)) {
|
||||
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
|
||||
$tid = $this->get_value($values, 'tid');
|
||||
return l($text, 'taxonomy/term/' . $tid . '/edit', array('query' => drupal_get_destination()));
|
||||
}
|
||||
function render($values) {
|
||||
$value = $this->get_value($values, 'tid');
|
||||
return $this->render_link($this->sanitize_value($value), $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function render_link($data, $values) {
|
||||
// Mock a term object for taxonomy_term_edit_access(). Use machine name and
|
||||
// vid to ensure compatibility with vid based and machine name based
|
||||
// access checks. See http://drupal.org/node/995156
|
||||
$term = new stdClass();
|
||||
$term->vid = $values->{$this->aliases['vid']};
|
||||
$term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']};
|
||||
if ($data && taxonomy_term_edit_access($term)) {
|
||||
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
|
||||
$this->options['alter']['path'] = "taxonomy/term/$data/edit";
|
||||
$this->options['alter']['query'] = drupal_get_destination();
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
|
||||
$options['vocabulary'] = array('default' => 0);
|
||||
$options['hierarchy'] = array('default' => 0);
|
||||
$options['error_message'] = array('default' => TRUE, 'bool' => TRUE);
|
||||
$options['optgroups'] = array('default' => 0);
|
||||
|
||||
return $options;
|
||||
}
|
||||
@@ -106,6 +107,14 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
|
||||
'#default_value' => !empty($this->options['hierarchy']),
|
||||
'#dependency' => array('radio:options[type]' => array('select')),
|
||||
);
|
||||
|
||||
$form['optgroups'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show groups in dropdown'),
|
||||
'#default_value' => !empty($this->options['optgroups']),
|
||||
'#dependency' => array('radio:options[type]' => array('select')),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,15 +154,22 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
|
||||
else {
|
||||
if (!empty($this->options['hierarchy']) && $this->options['limit']) {
|
||||
$tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
|
||||
$options = array();
|
||||
|
||||
if ($tree) {
|
||||
// Translation system needs full entity objects, so we have access to
|
||||
// label.
|
||||
foreach ($tree as $term) {
|
||||
$choice = new stdClass();
|
||||
$choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term));
|
||||
$options[] = $choice;
|
||||
if (!empty($tree)) {
|
||||
if (!empty($this->options['optgroups'])) {
|
||||
foreach ($tree as $term) {
|
||||
$term_name = entity_label('taxonomy_term', $term);
|
||||
if ($term->parents[0] == 0) {
|
||||
$parent_name = $term_name;
|
||||
}
|
||||
else {
|
||||
$options[$parent_name][$term->tid] = str_repeat('-', $term->depth - 1) . $term_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($tree as $term) {
|
||||
$options[$term->tid] = str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -227,7 +227,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
|
||||
|
||||
$query = db_select('taxonomy_term_data', 'td');
|
||||
$query->addTag('taxonomy_term_access');
|
||||
$query->condition('tid', $args);
|
||||
$query->condition('td.tid', $args);
|
||||
$query->addField('td', 'tid', 'tid');
|
||||
if (!empty($vocabularies)) {
|
||||
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
|
||||
|
@@ -20,7 +20,7 @@ class views_handler_field_node_link_translate extends views_handler_field_node_l
|
||||
$node = $this->get_value($values);
|
||||
$node->status = 1;
|
||||
// unpublished nodes ignore access control.
|
||||
if (empty($node->language) || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) {
|
||||
if ($node->language == LANGUAGE_NONE || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,19 @@ function user_views_data() {
|
||||
),
|
||||
);
|
||||
|
||||
// Comments authored.
|
||||
$data['users']['uid_comment'] = array(
|
||||
'relationship' => array(
|
||||
'title' => t('Comments authored'),
|
||||
'help' => t('Relate comments to the user who created it. This relationship will create one record for each comment created by the user.'),
|
||||
'handler' => 'views_handler_relationship',
|
||||
'base' => 'comment',
|
||||
'base field' => 'uid',
|
||||
'field' => 'uid',
|
||||
'label' => t('comments'),
|
||||
),
|
||||
);
|
||||
|
||||
// User name.
|
||||
$data['users']['name'] = array(
|
||||
// The item it appears as on the UI,
|
||||
@@ -139,7 +152,7 @@ function user_views_data() {
|
||||
// The item it appears as on the UI,
|
||||
'title' => t('E-mail'),
|
||||
// The help that appears on the UI,
|
||||
'help' => t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.'),
|
||||
'help' => t('E-mail address for a given user. This field is normally not shown to users, so be cautious when using it.'),
|
||||
'field' => array(
|
||||
'handler' => 'views_handler_field_user_mail',
|
||||
'click sortable' => TRUE,
|
||||
@@ -200,7 +213,7 @@ function user_views_data() {
|
||||
// Link.
|
||||
$data['users']['view_user'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link'),
|
||||
'title' => t('Link to user'),
|
||||
'help' => t('Provide a simple link to the user.'),
|
||||
'handler' => 'views_handler_field_user_link',
|
||||
),
|
||||
@@ -318,7 +331,7 @@ function user_views_data() {
|
||||
// Active status.
|
||||
$data['users']['status'] = array(
|
||||
// The item it appears as on the UI,
|
||||
'title' => t('Active'),
|
||||
'title' => t('Active status'),
|
||||
// The help that appears on the UI,
|
||||
'help' => t('Whether a user is active or blocked.'),
|
||||
// Information for displaying a title as a field.
|
||||
@@ -357,7 +370,7 @@ function user_views_data() {
|
||||
|
||||
$data['users']['edit_node'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Edit link'),
|
||||
'title' => t('Link to edit user'),
|
||||
'help' => t('Provide a simple link to edit the user.'),
|
||||
'handler' => 'views_handler_field_user_link_edit',
|
||||
),
|
||||
@@ -365,7 +378,7 @@ function user_views_data() {
|
||||
|
||||
$data['users']['cancel_node'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Cancel link'),
|
||||
'title' => t('Link to cancel user'),
|
||||
'help' => t('Provide a simple link to cancel the user.'),
|
||||
'handler' => 'views_handler_field_user_link_cancel',
|
||||
),
|
||||
|
@@ -17,9 +17,7 @@ class views_handler_field_user extends views_handler_field {
|
||||
*/
|
||||
public function init(&$view, &$data) {
|
||||
parent::init($view, $data);
|
||||
if (!empty($this->options['link_to_user'])) {
|
||||
$this->additional_fields['uid'] = 'uid';
|
||||
}
|
||||
$this->additional_fields['uid'] = 'uid';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -35,12 +35,4 @@ class views_handler_field_user_language extends views_handler_field_user {
|
||||
return $this->sanitize_value($lang->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render($values) {
|
||||
$value = $this->get_value($values);
|
||||
return $this->render_link($this->sanitize_value($value), $values);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,16 +12,6 @@
|
||||
*/
|
||||
class views_handler_field_user_name extends views_handler_field_user {
|
||||
|
||||
/**
|
||||
* Add uid in the query so we can test for anonymous if needed.
|
||||
*/
|
||||
public function init(&$view, &$data) {
|
||||
parent::init($view, $data);
|
||||
if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) {
|
||||
$this->additional_fields['uid'] = 'uid';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -73,6 +63,10 @@ class views_handler_field_user_name extends views_handler_field_user {
|
||||
$account = new stdClass();
|
||||
$account->uid = $this->get_value($values, 'uid');
|
||||
$account->name = $this->get_value($values);
|
||||
// If we don't have a UID, we can't format anything.
|
||||
if (!isset($account->uid)) {
|
||||
return $data;
|
||||
}
|
||||
if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
|
||||
if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
|
||||
// This is an anonymous user, and we're overriting the text.
|
||||
|
@@ -364,6 +364,8 @@ class views_ui extends ctools_export_ui {
|
||||
*
|
||||
*/
|
||||
function clone_page($js, $input, $item, $step = NULL) {
|
||||
$args = func_get_args();
|
||||
|
||||
drupal_set_title($this->get_page_title('clone', $item));
|
||||
|
||||
$name = $item->{$this->plugin['export']['key']};
|
||||
@@ -380,7 +382,7 @@ class views_ui extends ctools_export_ui {
|
||||
'no_redirect' => TRUE,
|
||||
'step' => $step,
|
||||
// Store these in case additional args are needed.
|
||||
'function args' => func_get_args(),
|
||||
'function args' => $args,
|
||||
);
|
||||
|
||||
$output = drupal_build_form('views_ui_clone_form', $form_state);
|
||||
|
@@ -181,7 +181,7 @@ class views_plugin_cache extends views_plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start caching javascript, css and other out of band info.
|
||||
* Start caching JavaScript, css and other out of band info.
|
||||
*
|
||||
* This takes a snapshot of the current system state so that we don't
|
||||
* duplicate it. Later on, when gather_headers() is run, this information
|
||||
@@ -214,10 +214,10 @@ class views_plugin_cache extends views_plugin {
|
||||
$css_start = isset($this->storage['css']) ? $this->storage['css'] : array();
|
||||
$this->storage['css'] = $this->assetDiff($css, $css_start, $array_mapping_func);
|
||||
|
||||
// Get javascript after/before views renders.
|
||||
// Get JavaScript after/before views renders.
|
||||
$js = drupal_add_js();
|
||||
$js_start = isset($this->storage['js']) ? $this->storage['js'] : array();
|
||||
// If there are any differences between the old and the new javascript then
|
||||
// If there are any differences between the old and the new JavaScript then
|
||||
// store them to be added later.
|
||||
$this->storage['js'] = $this->assetDiff($js, $js_start, $array_mapping_func);
|
||||
|
||||
@@ -353,8 +353,15 @@ class views_plugin_cache extends views_plugin {
|
||||
// If the default query back-end is used generate SQL query strings from
|
||||
// the query objects.
|
||||
if ($build_info[$index] instanceof SelectQueryInterface) {
|
||||
$query = clone $build_info[$index];
|
||||
$query->preExecute();
|
||||
$query = $build_info[$index];
|
||||
|
||||
// If the query was not yet prepared, work on a clone and run
|
||||
// preExecute().
|
||||
if (!$query->isPrepared()) {
|
||||
$query = clone $build_info[$index];
|
||||
$query->preExecute();
|
||||
}
|
||||
|
||||
$key_data['build_info'][$index] = array(
|
||||
'sql' => (string) $query,
|
||||
'arguments' => $query->getArguments(),
|
||||
|
@@ -32,12 +32,16 @@ class views_plugin_display extends views_plugin {
|
||||
public $view = NULL;
|
||||
|
||||
/**
|
||||
* List of handlers for this display.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $handlers = array();
|
||||
|
||||
/**
|
||||
* Stores all available display extenders.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $extender = array();
|
||||
|
||||
@@ -131,7 +135,7 @@ class views_plugin_display extends views_plugin {
|
||||
$pager = array(
|
||||
'type' => $type,
|
||||
'options' => array(
|
||||
'offset' => intval($offset)
|
||||
'offset' => intval($offset),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -143,8 +147,8 @@ class views_plugin_display extends views_plugin {
|
||||
$pager['options']['id'] = $id;
|
||||
}
|
||||
|
||||
// Unset the previous options
|
||||
// After edit and save the view they will be erased
|
||||
// Unset the previous options. After edit and save the view they will be
|
||||
// erased.
|
||||
$this->set_option('items_per_page', NULL);
|
||||
$this->set_option('offset', NULL);
|
||||
$this->set_option('use_pager', NULL);
|
||||
@@ -152,10 +156,9 @@ class views_plugin_display extends views_plugin {
|
||||
$changed = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Plugable headers, footer and empty texts are
|
||||
// not compatible with previous version of views
|
||||
// This code converts old values into a configured handler for each area
|
||||
// Plugable headers, footer and empty texts are not compatible with
|
||||
// previous version of views. This code converts old values into a
|
||||
// configured handler for each area.
|
||||
foreach (array('header', 'footer', 'empty') as $area) {
|
||||
$converted = FALSE;
|
||||
if (isset($this->options[$area]) && !is_array($this->options[$area])) {
|
||||
@@ -182,7 +185,7 @@ class views_plugin_display extends views_plugin {
|
||||
$changed = TRUE;
|
||||
}
|
||||
}
|
||||
// Ensure that options are at least an empty array
|
||||
// Ensure that options are at least an empty array.
|
||||
if (!$converted) {
|
||||
$this->set_option($area, array());
|
||||
}
|
||||
@@ -195,7 +198,7 @@ class views_plugin_display extends views_plugin {
|
||||
$query_settings = $this->get_option('query');
|
||||
$query_settings['options']['distinct'] = $distinct;
|
||||
$this->set_option('query', $query_settings);
|
||||
// Clear the values
|
||||
// Clear the values.
|
||||
$this->set_option('distinct', NULL);
|
||||
$changed = TRUE;
|
||||
}
|
||||
@@ -217,10 +220,10 @@ class views_plugin_display extends views_plugin {
|
||||
// Convert filter groups.
|
||||
$filter_groups = $this->get_option('filter_groups');
|
||||
// Only convert if it wasn't converted yet, which is the case if there is a
|
||||
// 0 group.
|
||||
// '0' group.
|
||||
if (isset($filter_groups['groups'][0])) {
|
||||
// Update filter groups.
|
||||
$filter_groups ['groups'] = views_array_key_plus($filter_groups['groups']);
|
||||
$filter_groups['groups'] = views_array_key_plus($filter_groups['groups']);
|
||||
$this->set_option('filter_groups', $filter_groups);
|
||||
// Update the filter group on each filter.
|
||||
$filters = $this->get_option('filters');
|
||||
@@ -285,16 +288,19 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this display is the 'default' display which contains
|
||||
* fallback settings
|
||||
* If this display is the 'default' display which contains fallback settings.
|
||||
*
|
||||
* @return bool
|
||||
* This is the default display and contains fallback settings.
|
||||
*/
|
||||
public function is_default_display() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this display uses exposed filters, so the view
|
||||
* will know whether or not to build them.
|
||||
* Does this display uses exposed filters?
|
||||
*
|
||||
* So the view will know whether or not to build them.
|
||||
*/
|
||||
public function uses_exposed() {
|
||||
if (!isset($this->has_exposed)) {
|
||||
@@ -319,13 +325,12 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this display should display the exposed
|
||||
* filters widgets, so the view will know whether or not
|
||||
* to render them.
|
||||
* Determine if this display should display the exposed filters widgets.
|
||||
*
|
||||
* Regardless of what this function
|
||||
* returns, exposed filters will not be used nor
|
||||
* displayed unless uses_exposed() returns TRUE.
|
||||
* If so, the view will know whether or not to render them.
|
||||
*
|
||||
* Regardless of what this function returns, exposed filters will not be used
|
||||
* nor displayed unless uses_exposed() returns TRUE.
|
||||
*/
|
||||
public function displays_exposed() {
|
||||
return TRUE;
|
||||
@@ -422,8 +427,7 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Static member function to list which sections are defaultable
|
||||
* and what items each section contains.
|
||||
* List which sections are defaultable and what items each section contains.
|
||||
*/
|
||||
public function defaultable_sections($section = NULL) {
|
||||
$sections = array(
|
||||
@@ -464,10 +468,30 @@ class views_plugin_display extends views_plugin {
|
||||
'link_display' => array('link_display', 'link_url'),
|
||||
|
||||
// Force these to cascade properly.
|
||||
'style_plugin' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'),
|
||||
'style_options' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'),
|
||||
'row_plugin' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'),
|
||||
'row_options' => array('style_plugin', 'style_options', 'row_plugin', 'row_options'),
|
||||
'style_plugin' => array(
|
||||
'style_plugin',
|
||||
'style_options',
|
||||
'row_plugin',
|
||||
'row_options',
|
||||
),
|
||||
'style_options' => array(
|
||||
'style_plugin',
|
||||
'style_options',
|
||||
'row_plugin',
|
||||
'row_options',
|
||||
),
|
||||
'row_plugin' => array(
|
||||
'style_plugin',
|
||||
'style_options',
|
||||
'row_plugin',
|
||||
'row_options',
|
||||
),
|
||||
'row_options' => array(
|
||||
'style_plugin',
|
||||
'style_options',
|
||||
'row_plugin',
|
||||
'row_options',
|
||||
),
|
||||
|
||||
'pager' => array('pager', 'pager_options'),
|
||||
'pager_options' => array('pager', 'pager_options'),
|
||||
@@ -475,7 +499,7 @@ class views_plugin_display extends views_plugin {
|
||||
'exposed_form' => array('exposed_form', 'exposed_form_options'),
|
||||
'exposed_form_options' => array('exposed_form', 'exposed_form_options'),
|
||||
|
||||
// These guys are special
|
||||
// These guys are special.
|
||||
'header' => array('header'),
|
||||
'footer' => array('footer'),
|
||||
'empty' => array('empty'),
|
||||
@@ -636,42 +660,60 @@ class views_plugin_display extends views_plugin {
|
||||
// therefore need special handling.
|
||||
'access' => array(
|
||||
'contains' => array(
|
||||
'type' => array('default' => 'none', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'),
|
||||
),
|
||||
'type' => array(
|
||||
'default' => 'none',
|
||||
'export' => 'export_plugin',
|
||||
'unpack_translatable' => 'unpack_plugin',
|
||||
),
|
||||
),
|
||||
),
|
||||
'cache' => array(
|
||||
'contains' => array(
|
||||
'type' => array('default' => 'none', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'),
|
||||
),
|
||||
'type' => array(
|
||||
'default' => 'none',
|
||||
'export' => 'export_plugin',
|
||||
'unpack_translatable' => 'unpack_plugin',
|
||||
),
|
||||
),
|
||||
),
|
||||
'query' => array(
|
||||
'contains' => array(
|
||||
'type' => array('default' => 'views_query', 'export' => 'export_plugin'),
|
||||
'type' => array(
|
||||
'default' => 'views_query',
|
||||
'export' => 'export_plugin',
|
||||
),
|
||||
'options' => array('default' => array(), 'export' => FALSE),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Note that exposed_form plugin has options in a separate array,
|
||||
// while access and cache do not. access and cache are legacy and
|
||||
// that pattern should not be repeated, but it is left as is to
|
||||
// reduce the need to modify older views. Let's consider the
|
||||
// pattern used here to be the template from which future plugins
|
||||
// should be copied.
|
||||
// Note that exposed_form plugin has options in a separate array, while
|
||||
// access and cache do not. access and cache are legacy and that pattern
|
||||
// should not be repeated, but it is left as is to reduce the need to
|
||||
// modify older views. Let's consider the pattern used here to be the
|
||||
// template from which future plugins should be copied.
|
||||
'exposed_form' => array(
|
||||
'contains' => array(
|
||||
'type' => array('default' => 'basic', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'),
|
||||
'type' => array(
|
||||
'default' => 'basic',
|
||||
'export' => 'export_plugin',
|
||||
'unpack_translatable' => 'unpack_plugin',
|
||||
),
|
||||
'options' => array('default' => array(), 'export' => FALSE),
|
||||
),
|
||||
),
|
||||
),
|
||||
'pager' => array(
|
||||
'contains' => array(
|
||||
'type' => array('default' => 'full', 'export' => 'export_plugin', 'unpack_translatable' => 'unpack_plugin'),
|
||||
'type' => array(
|
||||
'default' => 'full',
|
||||
'export' => 'export_plugin',
|
||||
'unpack_translatable' => 'unpack_plugin',
|
||||
),
|
||||
'options' => array('default' => array(), 'export' => FALSE),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Note that the styles have their options completely independent.
|
||||
// Like access and cache above, this is a legacy pattern and
|
||||
// should not be repeated.
|
||||
// Note that the styles have their options completely independent. Like
|
||||
// access and cache above, this is a legacy pattern and should not be
|
||||
// repeated.
|
||||
'style_plugin' => array(
|
||||
'default' => 'default',
|
||||
'export' => 'export_style',
|
||||
@@ -817,7 +859,7 @@ class views_plugin_display extends views_plugin {
|
||||
else {
|
||||
return $display_id;
|
||||
}
|
||||
// fall-through returns NULL
|
||||
// Fall-through returns NULL.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -898,6 +940,7 @@ class views_plugin_display extends views_plugin {
|
||||
* The name of the plugin defined in hook_views_plugins.
|
||||
*
|
||||
* @return views_plugin|FALSE
|
||||
* FALSE if no plugin, otherwise the requested instance of a plugin.
|
||||
*/
|
||||
public function get_plugin($type = 'style', $name = NULL) {
|
||||
static $cache = array();
|
||||
@@ -931,7 +974,7 @@ class views_plugin_display extends views_plugin {
|
||||
$plugin = views_get_plugin($type, $name);
|
||||
|
||||
if (!$plugin) {
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
if ($type != 'query') {
|
||||
$plugin->init($this->view, $this->display, $options);
|
||||
@@ -1033,13 +1076,13 @@ class views_plugin_display extends views_plugin {
|
||||
/**
|
||||
* List of fields for the current display with the associated relationship.
|
||||
*
|
||||
* @param $groupable_only
|
||||
* Return only an array of field labels from handler that return TRUE
|
||||
* from use_string_group_by method.
|
||||
* @param bool $groupable_only
|
||||
* Return only an array of field labels from handler that return TRUE from
|
||||
* use_string_group_by method.
|
||||
*/
|
||||
public function get_field_labels() {
|
||||
// Use func_get_arg so the function signature isn't amended but we can
|
||||
// still pass TRUE into the function to filter by groupable handlers.
|
||||
// Use func_get_arg so the function signature isn't amended but we can still
|
||||
// pass TRUE into the function to filter by groupable handlers.
|
||||
$args = func_get_args();
|
||||
$groupable_only = isset($args[0]) ? $args[0] : FALSE;
|
||||
|
||||
@@ -1080,9 +1123,8 @@ class views_plugin_display extends views_plugin {
|
||||
return $this->default_display->set_option($option, $value);
|
||||
}
|
||||
|
||||
// Set this in two places: On the handler where we'll notice it
|
||||
// but also on the display object so it gets saved. This should
|
||||
// only be a temporary fix.
|
||||
// Set this in two places: On the handler where we'll notice it but also on
|
||||
// the display object so it gets saved. This should only be a temporary fix.
|
||||
$this->display->display_options[$option] = $value;
|
||||
return $this->options[$option] = $value;
|
||||
}
|
||||
@@ -1118,14 +1160,24 @@ class views_plugin_display extends views_plugin {
|
||||
$text = views_ui_truncate($text, 24);
|
||||
}
|
||||
|
||||
return l($text, 'admin/structure/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title, 'id' => drupal_html_id('views-' . $this->display->id . '-' . $section)), 'html' => TRUE));
|
||||
return l($text,
|
||||
'admin/structure/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section,
|
||||
array(
|
||||
'attributes' => array(
|
||||
'class' => 'views-ajax-link ' . $class,
|
||||
'title' => $title,
|
||||
'id' => drupal_html_id('views-' . $this->display->id . '-' . $section),
|
||||
),
|
||||
'html' => TRUE,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns to tokens for arguments.
|
||||
*
|
||||
* This function is similar to views_handler_field::get_render_tokens()
|
||||
* but without fields tokens.
|
||||
* This function is similar to views_handler_field::get_render_tokens() but
|
||||
* without fields tokens.
|
||||
*/
|
||||
public function get_arguments_tokens() {
|
||||
$tokens = array();
|
||||
@@ -1344,9 +1396,9 @@ class views_plugin_display extends views_plugin {
|
||||
);
|
||||
|
||||
$languages = array(
|
||||
'***CURRENT_LANGUAGE***' => t("Current user's language"),
|
||||
'***DEFAULT_LANGUAGE***' => t("Default site language"),
|
||||
LANGUAGE_NONE => t('Language neutral'),
|
||||
'***CURRENT_LANGUAGE***' => t("Current user's language"),
|
||||
'***DEFAULT_LANGUAGE***' => t("Default site language"),
|
||||
LANGUAGE_NONE => t('Language neutral'),
|
||||
);
|
||||
if (module_exists('locale')) {
|
||||
$languages = array_merge($languages, locale_language_list());
|
||||
@@ -1361,7 +1413,7 @@ class views_plugin_display extends views_plugin {
|
||||
|
||||
$access_plugin = $this->get_plugin('access');
|
||||
if (!$access_plugin) {
|
||||
// default to the no access control plugin.
|
||||
// Default to the no access control plugin.
|
||||
$access_plugin = views_get_plugin('access', 'none');
|
||||
}
|
||||
|
||||
@@ -1381,7 +1433,7 @@ class views_plugin_display extends views_plugin {
|
||||
|
||||
$cache_plugin = $this->get_plugin('cache');
|
||||
if (!$cache_plugin) {
|
||||
// default to the no cache control plugin.
|
||||
// Default to the no cache control plugin.
|
||||
$cache_plugin = views_get_plugin('cache', 'none');
|
||||
}
|
||||
|
||||
@@ -1406,7 +1458,7 @@ class views_plugin_display extends views_plugin {
|
||||
if ($this->uses_link_display()) {
|
||||
$display_id = $this->get_link_display();
|
||||
$link_display = empty($this->view->display[$display_id]) ? t('None') : check_plain($this->view->display[$display_id]->display_title);
|
||||
$link_display = $this->get_option('link_display') == 'custom_url' ? t('Custom URL') : $link_display;
|
||||
$link_display = $this->get_option('link_display') == 'custom_url' ? t('Custom URL') : $link_display;
|
||||
$options['link_display'] = array(
|
||||
'category' => 'other',
|
||||
'title' => t('Link display'),
|
||||
@@ -1478,10 +1530,9 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
$form['#title'] = check_plain($this->display->display_title) . ': ';
|
||||
|
||||
// Set the 'section' to highlight on the form.
|
||||
// If it's the item we're looking at is pulling from the default display,
|
||||
// reflect that. Don't use is_defaulted since we want it to show up even
|
||||
// on the default display.
|
||||
// Set the 'section' to highlight on the form. If it's the item we're
|
||||
// looking at is pulling from the default display, reflect that. Don't use
|
||||
// is_defaulted since we want it to show up even on the default display.
|
||||
if (!empty($this->options['defaults'][$form_state['section']])) {
|
||||
$form['#section'] = 'default-' . $form_state['section'];
|
||||
}
|
||||
@@ -1587,9 +1638,9 @@ class views_plugin_display extends views_plugin {
|
||||
'#title' => t("Display 'more' link only if there is more content"),
|
||||
'#description' => t("Leave this unchecked to display the 'more' link even if there are no more items to display."),
|
||||
'#default_value' => !$this->get_option('use_more_always'),
|
||||
'#dependency' => array(
|
||||
'edit-use-more' => array(TRUE),
|
||||
),
|
||||
'#dependency' => array(
|
||||
'edit-use-more' => array(TRUE),
|
||||
),
|
||||
);
|
||||
$form['open_new_window'] = array(
|
||||
'#type' => 'checkbox',
|
||||
@@ -1629,7 +1680,7 @@ class views_plugin_display extends views_plugin {
|
||||
'#tree' => TRUE,
|
||||
);
|
||||
$access = $this->get_option('access');
|
||||
$form['access']['type'] = array(
|
||||
$form['access']['type'] = array(
|
||||
'#type' => 'radios',
|
||||
'#options' => views_fetch_plugin_names('access', NULL, array($this->view->base_table)),
|
||||
'#default_value' => $access['type'],
|
||||
@@ -1674,7 +1725,7 @@ class views_plugin_display extends views_plugin {
|
||||
'#tree' => TRUE,
|
||||
);
|
||||
$cache = $this->get_option('cache');
|
||||
$form['cache']['type'] = array(
|
||||
$form['cache']['type'] = array(
|
||||
'#type' => 'radios',
|
||||
'#options' => views_fetch_plugin_names('cache', NULL, array($this->view->base_table)),
|
||||
'#default_value' => $cache['type'],
|
||||
@@ -1784,7 +1835,7 @@ class views_plugin_display extends views_plugin {
|
||||
case 'style_plugin':
|
||||
$form['#title'] .= t('How should this view be styled');
|
||||
$form['#help_topic'] = 'style';
|
||||
$form['style_plugin'] = array(
|
||||
$form['style_plugin'] = array(
|
||||
'#type' => 'radios',
|
||||
'#options' => views_fetch_plugin_names('style', $this->get_style_type(), array($this->view->base_table)),
|
||||
'#default_value' => $this->get_option('style_plugin'),
|
||||
@@ -1832,7 +1883,7 @@ class views_plugin_display extends views_plugin {
|
||||
case 'row_plugin':
|
||||
$form['#title'] .= t('How should each row in this view be styled');
|
||||
$form['#help_topic'] = 'style-row';
|
||||
$form['row_plugin'] = array(
|
||||
$form['row_plugin'] = array(
|
||||
'#type' => 'radios',
|
||||
'#options' => views_fetch_plugin_names('row', $this->get_style_type(), array($this->view->base_table)),
|
||||
'#default_value' => $this->get_option('row_plugin'),
|
||||
@@ -1884,7 +1935,7 @@ class views_plugin_display extends views_plugin {
|
||||
$output .= theme('item_list',
|
||||
array(
|
||||
'items' => $items,
|
||||
'type' => $type
|
||||
'type' => $type,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1946,14 +1997,14 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// include non-engine theme files
|
||||
// Include non-engine theme files.
|
||||
foreach ($base_theme as $base) {
|
||||
// Include the theme file or the engine.
|
||||
if (!empty($base->owner)) {
|
||||
include_once DRUPAL_ROOT . '/' . $base->owner;
|
||||
}
|
||||
}
|
||||
// and our theme gets one too.
|
||||
// And our theme gets one too.
|
||||
if (!empty($theme->owner)) {
|
||||
include_once DRUPAL_ROOT . '/' . $theme->owner;
|
||||
}
|
||||
@@ -1972,15 +2023,15 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
|
||||
$funcs = array();
|
||||
// Get theme functions for the display. Note that some displays may
|
||||
// not have themes. The 'feed' display, for example, completely
|
||||
// delegates to the style.
|
||||
// Get theme functions for the display. Note that some displays may not
|
||||
// have themes. The 'feed' display, for example, completely delegates to
|
||||
// the style.
|
||||
if (!empty($this->definition['theme'])) {
|
||||
$funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions());
|
||||
$funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions());
|
||||
$themes = $this->additional_theme_functions();
|
||||
if ($themes) {
|
||||
foreach ($themes as $theme) {
|
||||
$funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme);
|
||||
$funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1991,7 +2042,7 @@ class views_plugin_display extends views_plugin {
|
||||
$themes = $plugin->additional_theme_functions();
|
||||
if ($themes) {
|
||||
foreach ($themes as $theme) {
|
||||
$funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme);
|
||||
$funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2002,7 +2053,7 @@ class views_plugin_display extends views_plugin {
|
||||
$themes = $row_plugin->additional_theme_functions();
|
||||
if ($themes) {
|
||||
foreach ($themes as $theme) {
|
||||
$funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme);
|
||||
$funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2158,8 +2209,8 @@ class views_plugin_display extends views_plugin {
|
||||
|
||||
$output .= '<p>' . t('This is the default theme template used for this row style.') . '</p>';
|
||||
|
||||
// Field templates aren't registered the normal way...and they're always
|
||||
// this one, anyhow.
|
||||
// Field templates aren't registered the normal way... and they're
|
||||
// always this one, anyhow.
|
||||
$output .= '<pre>' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '</pre>';
|
||||
|
||||
$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 = '<strong title="'. $hint .'">' . $template . '</strong>';
|
||||
$template = '<strong title="' . $hint . '">' . $template . '</strong>';
|
||||
}
|
||||
else {
|
||||
$template = '<strong class="error">' . $template . ' ' . t('(File not found, in folder @template-path)', array('@template-path' => $template_path)) . '</strong>';
|
||||
@@ -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.'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -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':
|
||||
|
@@ -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' => '<span dir="ltr">' . url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
|
||||
'#field_suffix' => '</span>‎',
|
||||
'#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' => '<div class="views-left-30">',
|
||||
'#suffix' => '</div>',
|
||||
@@ -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;
|
||||
}
|
||||
|
@@ -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),
|
||||
|
@@ -50,7 +50,7 @@ class views_plugin_pager extends views_plugin {
|
||||
* most pagers will not need to override this method.
|
||||
*/
|
||||
public function get_items_per_page() {
|
||||
return isset($this->options['items_per_page']) ? $this->options['items_per_page'] : 0;
|
||||
return isset($this->options['items_per_page']) ? (int) $this->options['items_per_page'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ class views_plugin_pager extends views_plugin {
|
||||
* This is mostly used for things that will override the value.
|
||||
*/
|
||||
public function set_items_per_page($items) {
|
||||
$this->options['items_per_page'] = $items;
|
||||
$this->options['items_per_page'] = (int) $items;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,14 +69,14 @@ class views_plugin_pager extends views_plugin {
|
||||
* so few pagers will need to override this method.
|
||||
*/
|
||||
public function get_offset() {
|
||||
return isset($this->options['offset']) ? $this->options['offset'] : 0;
|
||||
return isset($this->options['offset']) ? (int) $this->options['offset'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the page offset, or how many items to skip.
|
||||
*/
|
||||
public function set_offset($offset) {
|
||||
$this->options['offset'] = $offset;
|
||||
$this->options['offset'] = (int) $offset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -252,7 +252,7 @@ class views_plugin_pager_full extends views_plugin_pager {
|
||||
public function query() {
|
||||
if ($this->items_per_page_exposed()) {
|
||||
if (!empty($_GET['items_per_page']) && $_GET['items_per_page'] > 0) {
|
||||
$this->options['items_per_page'] = $_GET['items_per_page'];
|
||||
$this->options['items_per_page'] = (int) $_GET['items_per_page'];
|
||||
}
|
||||
elseif (!empty($_GET['items_per_page']) && $_GET['items_per_page'] == 'All' && $this->options['expose']['items_per_page_options_all']) {
|
||||
$this->options['items_per_page'] = 0;
|
||||
@@ -260,16 +260,15 @@ class views_plugin_pager_full extends views_plugin_pager {
|
||||
}
|
||||
if ($this->offset_exposed()) {
|
||||
if (isset($_GET['offset']) && $_GET['offset'] >= 0) {
|
||||
$this->options['offset'] = $_GET['offset'];
|
||||
$this->options['offset'] = (int) $_GET['offset'];
|
||||
}
|
||||
}
|
||||
|
||||
$limit = $this->options['items_per_page'];
|
||||
$offset = $this->current_page * $this->options['items_per_page'] + $this->options['offset'];
|
||||
$limit = $this->get_items_per_page();
|
||||
$offset = $this->current_page * $limit + $this->get_offset();
|
||||
if (!empty($this->options['total_pages'])) {
|
||||
if ($this->current_page >= $this->options['total_pages']) {
|
||||
$limit = $this->options['items_per_page'];
|
||||
$offset = $this->options['total_pages'] * $this->options['items_per_page'];
|
||||
$offset = $this->options['total_pages'] * $limit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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' => '<div class="messages warning sql-rewrite-warning js-hide">'
|
||||
. 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.')
|
||||
. '</div>',
|
||||
);
|
||||
// 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' => '<div class="messages warning sql-rewrite-warning' . ($disable_rewrite ? '' : ' js-hide') . '">'
|
||||
. 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))
|
||||
. '</div>',
|
||||
);
|
||||
}
|
||||
}
|
||||
$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))) {
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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(
|
||||
|
@@ -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(
|
||||
|
@@ -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(
|
||||
|
@@ -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();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -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';
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
277
sites/all/modules/contrib/views/views/tests/views_clone.test
Normal file
277
sites/all/modules/contrib/views/views/tests/views_clone.test
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests cloning a view.
|
||||
*/
|
||||
class ViewsCloneTest extends ViewsSqlTest {
|
||||
|
||||
/**
|
||||
* Provide the test's meta information.
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => '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;
|
||||
}
|
||||
|
||||
}
|
@@ -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 = "<pre>\n" . print_r($message, TRUE) . "\n</pre>\n";
|
||||
}
|
||||
|
||||
// Optional title to go before the output.
|
||||
if (!empty($title)) {
|
||||
$title = '<h2>' . check_plain($title) . "</h2>\n";
|
||||
}
|
||||
|
||||
parent::verbose($title . $message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,8 +5,8 @@ core = 7.x
|
||||
dependencies[] = views
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2019-04-03
|
||||
version = "7.x-3.22"
|
||||
; Information added by Drupal.org packaging script on 2019-05-10
|
||||
version = "7.x-3.23"
|
||||
core = "7.x"
|
||||
project = "views"
|
||||
datestamp = "1554307093"
|
||||
datestamp = "1557505389"
|
||||
|
@@ -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] = '';
|
||||
}
|
||||
|
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Template for the primary view editing window.
|
||||
*/
|
||||
?>
|
||||
<div class="views-edit-view">
|
||||
<?php if ($locked): ?>
|
||||
<div class="view-locked">
|
||||
<?php print t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.',
|
||||
array('!user' => $locked, '!age' => $lock_age, '!break' => $break)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="views-basic-info clearfix<?php if (!empty($view->changed)): ?> changed<?php endif; ?>">
|
||||
<?php if (!is_numeric($view->vid)): ?>
|
||||
<div class="view-changed view-new"><?php print t('New view'); ?></div>
|
||||
<?php else: ?>
|
||||
<div class="view-changed"><?php print t('Changed view'); ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="views-quick-links">
|
||||
<?php print $quick_links ?>
|
||||
</div>
|
||||
<?php print t('View %name, displaying items of type <strong>@base</strong>.',
|
||||
array('%name' => $view->name, '@base' => $base_table)); ?>
|
||||
</div>
|
||||
|
||||
<?php print $tabs; ?>
|
||||
|
||||
<div id="views-ajax-form">
|
||||
<div id="views-ajax-title">
|
||||
<?php
|
||||
// This is initially empty. ?>
|
||||
</div>
|
||||
<div id="views-ajax-pad">
|
||||
<?php /* This is sent in because it is also sent out through settings and
|
||||
needs to be consistent. */ ?>
|
||||
<?php print $message; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php print $save_button ?>
|
||||
|
||||
<h2><?php print t('Live preview'); ?></h2>
|
||||
<div id='views-live-preview'>
|
||||
<?php print $preview ?>
|
||||
</div>
|
||||
</div>
|
@@ -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.
|
||||
|
@@ -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-04-03
|
||||
version = "7.x-3.22"
|
||||
; Information added by Drupal.org packaging script on 2019-05-10
|
||||
version = "7.x-3.23"
|
||||
core = "7.x"
|
||||
project = "views"
|
||||
datestamp = "1554307093"
|
||||
datestamp = "1557505389"
|
||||
|
@@ -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.
|
||||
|
@@ -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-04-03
|
||||
version = "7.x-3.22"
|
||||
; Information added by Drupal.org packaging script on 2019-05-10
|
||||
version = "7.x-3.23"
|
||||
core = "7.x"
|
||||
project = "views"
|
||||
datestamp = "1554307093"
|
||||
datestamp = "1557505389"
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user