فهرست منبع

update to 7.x-3.6

Signed-off-by: bachy <git@g-u-i.net>
bachy 11 سال پیش
والد
کامیت
578adab53b

+ 1 - 1
handlers/views_handler_area_text.inc

@@ -56,7 +56,7 @@ class views_handler_area_text extends views_handler_area {
         if (!empty($options[$type])) {
           $items = array();
           foreach ($options[$type] as $key => $value) {
-            $items[] = $key . ' == ' . $value;
+            $items[] = $key . ' == ' . check_plain($value);
           }
           $output .= theme('item_list',
             array(

+ 2 - 2
handlers/views_handler_field.inc

@@ -372,7 +372,7 @@ class views_handler_field extends views_handler {
    *   Optional name of the field where the value is stored.
    */
   function get_value($values, $field = NULL) {
-    $alias = isset($field) && isset($this->aliases[$field]) ? $this->aliases[$field] : $this->field_alias;
+    $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
     if (isset($values->{$alias})) {
       return $values->{$alias};
     }
@@ -814,7 +814,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
           if (!empty($options[$type])) {
             $items = array();
             foreach ($options[$type] as $key => $value) {
-              $items[] = $key . ' == ' . $value;
+              $items[] = $key . ' == ' . check_plain($value);
             }
             $output .= theme('item_list',
               array(

+ 31 - 2
handlers/views_handler_field_boolean.inc

@@ -25,6 +25,8 @@ class views_handler_field_boolean extends views_handler_field {
   function option_definition() {
     $options = parent::option_definition();
     $options['type'] = array('default' => 'yes-no');
+    $options['type_custom_true'] = array('default' => '', 'translatable' => TRUE);
+    $options['type_custom_false'] = array('default' => '', 'translatable' => TRUE);
     $options['not'] = array('definition bool' => 'reverse');
 
     return $options;
@@ -42,7 +44,8 @@ class views_handler_field_boolean extends views_handler_field {
       'unicode-yes-no' => array('✔', '✖'),
     );
     $output_formats = isset($this->definition['output formats']) ? $this->definition['output formats'] : array();
-    $this->formats = array_merge($default_formats, $output_formats);
+    $custom_format = array('custom' => array(t('Custom')));
+    $this->formats = array_merge($default_formats, $output_formats, $custom_format);
   }
 
   function options_form(&$form, &$form_state) {
@@ -56,6 +59,29 @@ class views_handler_field_boolean extends views_handler_field {
       '#options' => $options,
       '#default_value' => $this->options['type'],
     );
+
+    $form['type_custom_true'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom output for TRUE'),
+      '#default_value' => $this->options['type_custom_true'],
+      '#states' => array(
+        'visible' => array(
+          'select[name="options[type]"]' => array('value' => 'custom'),
+        ),
+      ),
+    );
+
+    $form['type_custom_false'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom output for FALSE'),
+      '#default_value' => $this->options['type_custom_false'],
+      '#states' => array(
+        'visible' => array(
+          'select[name="options[type]"]' => array('value' => 'custom'),
+        ),
+      ),
+    );
+
     $form['not'] = array(
       '#type' => 'checkbox',
       '#title' => t('Reverse'),
@@ -71,7 +97,10 @@ class views_handler_field_boolean extends views_handler_field {
       $value = !$value;
     }
 
-    if (isset($this->formats[$this->options['type']])) {
+    if ($this->options['type'] == 'custom') {
+      return $value ? filter_xss_admin($this->options['type_custom_true']) : filter_xss_admin($this->options['type_custom_false']);
+    }
+    else if (isset($this->formats[$this->options['type']])) {
       return $value ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
     }
     else {

+ 1 - 1
handlers/views_handler_filter_numeric.inc

@@ -258,7 +258,7 @@ class views_handler_filter_numeric extends views_handler_filter {
   }
 
   function op_regex($field) {
-    $this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
+    $this->query->add_where($this->options['group'], $field, $this->value['value'], 'RLIKE');
   }
 
   function admin_summary() {

+ 12 - 12
includes/admin.inc

@@ -835,10 +835,10 @@ function theme_views_ui_view_info($variables) {
   }
 
   $output = '';
-  $output .= '<div class="views-ui-view-title">' . $title . "</div>\n";
+  $output .= '<div class="views-ui-view-title">' . check_plain($title) . "</div>\n";
   $output .= '<div class="views-ui-view-displays">' . $displays . "</div>\n";
   $output .= '<div class="views-ui-view-storage">' . $type . "</div>\n";
-  $output .= '<div class="views-ui-view-base">' . t('Type') . ': ' . $variables['base']. "</div>\n";
+  $output .= '<div class="views-ui-view-base">' . t('Type') . ': ' . check_plain($variables['base']). "</div>\n";
   return $output;
 }
 
@@ -2214,7 +2214,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
   switch ($type) {
     case 'filter':
       $rearrange_url = "admin/structure/views/nojs/rearrange-$type/$view->name/$display->id/$type";
-      $rearrange_text = t('and/or, rearrange');
+      $rearrange_text = t('And/Or, Rearrange');
       // TODO: Add another class to have another symbol for filter rearrange.
       $class = 'icon compact rearrange';
       break;
@@ -2233,7 +2233,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
 
     default:
       $rearrange_url = "admin/structure/views/nojs/rearrange/$view->name/$display->id/$type";
-      $rearrange_text = t('rearrange');
+      $rearrange_text = t('Rearrange');
       $class = 'icon compact rearrange';
   }
 
@@ -2241,16 +2241,16 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
   $actions = array();
   $count_handlers = count($display->handler->get_handlers($type));
   $actions['add'] = array(
-    'title' => t('add'),
+    'title' => t('Add'),
     'href' => "admin/structure/views/nojs/add-item/$view->name/$display->id/$type",
-    'attributes'=> array('class' => array('icon compact add', 'views-ajax-link'), 'title' => t('add'), 'id' => 'views-add-' . $type),
+    'attributes'=> array('class' => array('icon compact add', 'views-ajax-link'), 'title' => t('Add'), 'id' => 'views-add-' . $type),
     'html' => TRUE,
   );
   if ($count_handlers > 0) {
     $actions['rearrange'] = array(
       'title' => $rearrange_text,
       'href' => $rearrange_url,
-      'attributes' => array('class' => array($class, 'views-ajax-link'), 'title' => $rearrange_text, 'id' => 'views-rearrange-' . $type),
+      'attributes' => array('class' => array($class, 'views-ajax-link'), 'title' => t('Rearrange'), 'id' => 'views-rearrange-' . $type),
       'html' => TRUE,
     );
   }
@@ -3038,7 +3038,7 @@ function views_ui_reorder_displays_form($form, &$form_state) {
 
   foreach ($view->display as $display) {
     $form[$display->id] = array(
-      'title'  => array('#markup' => $display->display_title),
+      'title'  => array('#markup' => check_plain($display->display_title)),
       'weight' => array(
         '#type' => 'weight',
         '#value' => $display->position,
@@ -4122,8 +4122,8 @@ function views_ui_add_item_form($form, &$form_state) {
         $zebra_class = ($zebra % 2) ? 'odd' : 'even';
         $form['options']['name'][$key] = array(
           '#type' => 'checkbox',
-          '#title' => t('!group: !field', array('!group' => $option['group'], '!field' => $option['title'])),
-          '#description' => $option['help'],
+          '#title' => t('!group: !field', array('!group' => check_plain($option['group']), '!field' => check_plain($option['title']))),
+          '#description' => filter_xss_admin($option['help']),
           '#return_value' => $key,
           '#prefix' => "<div class='$zebra_class filterable-option'>",
           '#suffix' => '</div>',
@@ -5047,7 +5047,7 @@ function views_ui_autocomplete_tag($string = '') {
   $views = views_get_all_views();
   foreach ($views as $view) {
     if (!empty($view->tag) && strpos($view->tag, $string) === 0) {
-      $matches[$view->tag] = $view->tag;
+      $matches[$view->tag] = check_plain($view->tag);
       if (count($matches) >= 10) {
         break;
       }
@@ -5267,7 +5267,7 @@ function theme_views_ui_style_plugin_table($variables) {
   $rows = array();
   foreach (element_children($form['columns']) as $id) {
     $row = array();
-    $row[] = drupal_render($form['info'][$id]['name']);
+    $row[] = check_plain(drupal_render($form['info'][$id]['name']));
     $row[] = drupal_render($form['columns'][$id]);
     $row[] = drupal_render($form['info'][$id]['align']);
     $row[] = drupal_render($form['info'][$id]['separator']);

+ 2 - 2
includes/base.inc

@@ -346,8 +346,8 @@ class views_object {
       $value = $options;
       // Build source data and add to the array
       $format = NULL;
-      if (isset($definition['format_key']) && isset($options[$definition['format_key']])) {
-        $format = $options[$definition['format_key']];
+      if (isset($definition['format_key']) && isset($storage[$definition['format_key']])) {
+        $format = $storage[$definition['format_key']];
       }
       $translatable[] = array(
         'value' => $value,

+ 5 - 3
includes/cache.inc

@@ -28,9 +28,11 @@ function _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) {
         $cache[$table] = $data->data;
       }
       else {
-        // No cache entry, rebuild.
-        $cache = _views_fetch_data_build();
-        $fully_loaded = TRUE;
+        if (!$fully_loaded) {
+          // No cache entry, rebuild.
+          $cache = _views_fetch_data_build();
+          $fully_loaded = TRUE;
+        }
       }
     }
     if (isset($cache[$table])) {

+ 1 - 1
js/ajax_view.js

@@ -69,7 +69,7 @@ Drupal.views.ajaxView = function(settings) {
 };
 
 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() {
-  var button = $('input[type=submit], input[type=image]', this.$exposed_form);
+  var button = $('input[type=submit], button[type=submit], input[type=image]', this.$exposed_form);
   button = button[0];
 
   this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings);

+ 1 - 1
js/views-admin.js

@@ -209,7 +209,7 @@ Drupal.viewsUi.addItemForm.prototype.handleCheck = function (event) {
  */
 Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function() {
   // Perhaps we should precache the text div, too.
-  this.$selected_div.find('.views-selected-options').html(this.checkedItems.join(', '));
+  this.$selected_div.find('.views-selected-options').html(Drupal.checkPlain(this.checkedItems.join(', ')));
   Drupal.viewsUi.resizeModal('', true);
 }
 

+ 2 - 2
modules/aggregator/views_handler_argument_aggregator_iid.inc

@@ -18,9 +18,9 @@ class views_handler_argument_aggregator_iid extends views_handler_argument_numer
     $titles = array();
     $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
 
-    $result = db_select('aggregator_item')
+    $result = db_select('aggregator_item', 'ai')
       ->condition('iid', $this->value, 'IN')
-      ->fields(array('title'))
+      ->fields('ai', array('title'))
       ->execute();
     foreach ($result as $term) {
       $titles[] = check_plain($term->title);

+ 6 - 4
modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc

@@ -103,7 +103,8 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
         if (!$term) {
           return FALSE;
         }
-        $this->argument->validated_title = check_plain($term->name);
+        $term = taxonomy_term_load($term->tid);
+        $this->argument->validated_title = check_plain(entity_label('taxonomy_term', $term));
         return empty($vocabularies) || !empty($vocabularies[$term->machine_name]);
 
       case 'tids':
@@ -151,8 +152,8 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
               $validated_cache[$term->tid] = FALSE;
               return FALSE;
             }
-
-            $titles[] = $validated_cache[$term->tid] = check_plain($term->name);
+            $term = taxonomy_term_load($term->tid);
+            $titles[] = $validated_cache[$term->tid] = check_plain(entity_label('taxonomy_term', $term));
             unset($test[$term->tid]);
           }
         }
@@ -185,7 +186,8 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument
           if ($type == 'convert') {
             $this->argument->argument = $term->tid;
           }
-          $this->argument->validated_title = check_plain($term->name);
+          $term = taxonomy_term_load($term->tid);
+          $this->argument->validated_title = check_plain(entity_label('taxonomy_term', $term));
           return TRUE;
         }
         return FALSE;

+ 1 - 1
plugins/views_plugin_display.inc

@@ -476,7 +476,7 @@ class views_plugin_display extends views_plugin {
           'display_description' => FALSE,
           'use_ajax' => TRUE,
           'hide_attachment_summary' => TRUE,
-          'hide_admin_links' => FALSE,
+          'hide_admin_links' => TRUE,
           'pager' => TRUE,
           'pager_options' => TRUE,
           'use_more' => TRUE,

+ 8 - 0
plugins/views_plugin_style_jump_menu.inc

@@ -19,6 +19,7 @@ class views_plugin_style_jump_menu extends views_plugin_style {
     $options['text'] = array('default' => 'Go', 'translatable' => TRUE);
     $options['label'] = array('default' => '', 'translatable' => TRUE);
     $options['choose'] = array('default' => '- Choose -', 'translatable' => TRUE);
+    $options['inline'] = array('default' => TRUE, 'bool' => TRUE);
     $options['default_value'] = array('default' => FALSE, 'bool' => TRUE);
 
     return $options;
@@ -83,6 +84,12 @@ class views_plugin_style_jump_menu extends views_plugin_style {
       '#description' => t('The text that will appear as the selected option in the jump menu.'),
     );
 
+    $form['inline'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Set this field to display inline'),
+      '#default_value' => !empty($this->options['inline']),
+    );
+
     $form['default_value'] = array(
       '#type' => 'checkbox',
       '#title' => t('Select the current contextual filter value'),
@@ -145,6 +152,7 @@ class views_plugin_style_jump_menu extends views_plugin_style {
       'button' => $this->options['text'],
       'title' => $this->options['label'],
       'choose' => $this->options['choose'],
+      'inline' => $this->options['inline'],
       'default_value' => $default_value,
     );
 

+ 8 - 0
plugins/views_plugin_style_summary_jump_menu.inc

@@ -20,6 +20,7 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style {
     $options['text'] = array('default' => 'Go', 'translatable' => TRUE);
     $options['label'] = array('default' => '', 'translatable' => TRUE);
     $options['choose'] = array('default' => '- Choose -', 'translatable' => TRUE);
+    $options['inline'] = array('default' => TRUE, 'bool' => TRUE);
     $options['default_value'] = array('default' => FALSE, 'bool' => TRUE);
 
     return $options;
@@ -78,6 +79,12 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style {
       '#description' => t('The text that will appear as the selected option in the jump menu.'),
     );
 
+    $form['inline'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Set this field to display inline'),
+      '#default_value' => !empty($this->options['inline']),
+    );
+
     $form['default_value'] = array(
       '#type' => 'checkbox',
       '#title' => t('Select the current contextual filter value'),
@@ -129,6 +136,7 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style {
       'button' => $this->options['text'],
       'title' => $this->options['label'],
       'choose' => $this->options['choose'],
+      'inline' => $this->options['inline'],
       'default_value' => $default_value,
     );
 

+ 33 - 1
tests/handlers/views_handler_field_boolean.test

@@ -66,11 +66,43 @@ class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
     $this->assertEqual('✖', $view->field['age']->advanced_render($view->result[0]));
     $this->assertEqual('✔', $view->field['age']->advanced_render($view->result[1]));
 
-    // Set a custom output format.
+    // Set a custom output format programmatically.
     $view->field['age']->formats['test'] = array(t('Test-True'), t('Test-False'));
     $view->field['age']->options['type'] = 'test';
     $this->assertEqual(t('Test-False'), $view->field['age']->advanced_render($view->result[0]));
     $this->assertEqual(t('Test-True'), $view->field['age']->advanced_render($view->result[1]));
 
+    // Set a custom output format through the UI using plain-text inputs.
+    $view->field['age']->options['type'] = 'custom';
+    $values = array(
+      'false' => 'Nay',
+      'true' => 'Yay',
+    );
+    $view->field['age']->options['type_custom_false'] = $values['false'];
+    $view->field['age']->options['type_custom_true'] = $values['true'];
+    $this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+    $this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
+
+    // Set a custom output format through the UI using valid HTML inputs.
+    $view->field['age']->options['type'] = 'custom';
+    $values = array(
+      'false' => '<div class="bar">Nay</div>',
+      'true' => '<div class="foo">Yay</div>',
+    );
+    $view->field['age']->options['type_custom_false'] = $values['false'];
+    $view->field['age']->options['type_custom_true'] = $values['true'];
+    $this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+    $this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
+
+    // Set a custom output format through the UI using unsafe inputs.
+    $view->field['age']->options['type'] = 'custom';
+    $values = array(
+      'false' => '<script>alert("Nay");</script>',
+      'true' => '<script>alert("Yay");</script>',
+    );
+    $view->field['age']->options['type_custom_false'] = $values['false'];
+    $view->field['age']->options['type_custom_true'] = $values['true'];
+    $this->assertNotEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
+    $this->assertNotEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
   }
 }

+ 3 - 3
tests/views_test.info

@@ -5,9 +5,9 @@ core = 7.x
 dependencies[] = views
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2013-02-04
-version = "7.x-3.5+38-dev"
+; Information added by drupal.org packaging script on 2013-03-20
+version = "7.x-3.6"
 core = "7.x"
 project = "views"
-datestamp = "1359942791"
+datestamp = "1363810217"
 

+ 22 - 1
tests/views_translatable.test

@@ -114,7 +114,6 @@ class ViewsTranslatableTest extends ViewsSqlTest {
         'more1' => array('use_more_text'),
         'Reset1' => array('exposed_form', 'reset_button_label'),
         'Offset1' => array('pager', 'expose', 'offset_label'),
-        'Master1' => array('title'),
         'title1' => array('title'),
         'Tag first1' => array('pager', 'tags', 'first'),
         'Tag prev1' => array('pager', 'tags', 'previous'),
@@ -124,9 +123,23 @@ class ViewsTranslatableTest extends ViewsSqlTest {
         'fieldlabel1' => array('field', 'node', 'nid', 'label'),
         'filterlabel1' => array('filter', 'node', 'nid', 'expose', 'label'),
         '- All -' => array('pager', 'expose', 'items_per_page_options_all_label'),
+        'Header1' => array('header', 'views', 'area', 'content'),
+      );
+
+      $formats = array(
+        'Header1' => 'filtered_html',
       );
+
       foreach ($translatables as $translatable) {
         $this->assertEqual($translatable['keys'], $this->string_keys[$translatable['value']]);
+
+        // Make sure the format is correct.
+        if (isset($formats[$translatable['value']])) {
+          $this->assertEqual($translatable['format'], $formats[$translatable['value']]);
+        }
+        else {
+          $this->assertNull($translatable['format'], 'No format defined');
+        }
       }
     }
   }
@@ -169,6 +182,14 @@ class ViewsTranslatableTest extends ViewsSqlTest {
     $handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Offset1';
     $handler->display->display_options['style_plugin'] = 'default';
     $handler->display->display_options['row_plugin'] = 'fields';
+    /* Global: Header */
+    $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']['empty'] = FALSE;
+    $handler->display->display_options['header']['area']['content'] = 'Header1';
+    $handler->display->display_options['header']['area']['format'] = 'filtered_html';
+    $handler->display->display_options['header']['area']['tokenize'] = 0;
     /* Field: Content: Nid */
     $handler->display->display_options['fields']['nid']['id'] = 'nid';
     $handler->display->display_options['fields']['nid']['table'] = 'node';

+ 3 - 3
views.info

@@ -312,9 +312,9 @@ files[] = tests/views_cache.test
 files[] = tests/views_view.test
 files[] = tests/views_ui.test
 
-; Information added by drupal.org packaging script on 2013-02-04
-version = "7.x-3.5+38-dev"
+; Information added by drupal.org packaging script on 2013-03-20
+version = "7.x-3.6"
 core = "7.x"
 project = "views"
-datestamp = "1359942791"
+datestamp = "1363810217"
 

+ 2 - 0
views.module

@@ -341,10 +341,12 @@ function views_permission() {
     'administer views' => array(
       'title' => t('Administer views'),
       'description' => t('Access the views administration pages.'),
+      'restrict access' => TRUE,
     ),
     'access all views' => array(
       'title' => t('Bypass views access control'),
       'description' => t('Bypass access control when accessing views.'),
+      'restrict access' => TRUE,
     ),
   );
 }

+ 3 - 3
views_ui.info

@@ -7,9 +7,9 @@ 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 2013-02-04
-version = "7.x-3.5+38-dev"
+; Information added by drupal.org packaging script on 2013-03-20
+version = "7.x-3.6"
 core = "7.x"
 project = "views"
-datestamp = "1359942791"
+datestamp = "1363810217"
 

+ 2 - 1
views_ui.module

@@ -845,7 +845,8 @@ function _views_ui_get_displays_list($view) {
 
 function views_ui_library_alter(&$libraries, $module) {
   if ($module == 'system' && isset($libraries['ui.dialog'])) {
-    if (version_compare($libraries['ui.dialog']['version'], '1.7.2', '>=')) {
+    // Only apply the fix, if we don't have an up to date jQueryUI version.
+    if (version_compare($libraries['ui.dialog']['version'], '1.7.2', '>=') && version_compare($libraries['ui.dialog']['version'], '1.10.0', '<')) {
       $libraries['ui.dialog']['js'][drupal_get_path('module', 'views') . '/js/jquery.ui.dialog.patch.js'] = array();
     }
   }