Révision 8be7bf84
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/views/css/ie/views-admin.ie7.css | ||
---|---|---|
17 | 17 |
|
18 | 18 |
/** |
19 | 19 |
* IE7 has no idea how large this container should be and it doesn't |
20 |
* apply has-layout. Expand it's width to 100% and trigger has-layout.
|
|
20 |
* apply has-layout. Expand its width to 100% and trigger has-layout. |
|
21 | 21 |
*/ |
22 | 22 |
.views-edit-view .views-displays { |
23 | 23 |
height: 1%; |
drupal7/sites/all/modules/views/css/views-admin.css | ||
---|---|---|
312 | 312 |
|
313 | 313 |
/* @end */ |
314 | 314 |
|
315 |
|
|
316 |
|
|
317 |
/* @group Javascript dependent styling */ |
|
315 |
/* @group JavaScript dependent styling */ |
|
318 | 316 |
|
319 | 317 |
.js-only { |
320 | 318 |
display: none; |
drupal7/sites/all/modules/views/drush/views.drush.inc | ||
---|---|---|
119 | 119 |
* Callback function for views-revert command. |
120 | 120 |
*/ |
121 | 121 |
function views_revert_views() { |
122 |
$args = func_get_args(); |
|
123 |
// The provided views names specified in the command. |
|
124 |
$viewnames = _convert_csv_to_array($args); |
|
122 | 125 |
$views = views_get_all_views(); |
123 | 126 |
$i = 0; |
124 |
// The provided views names specified in the command. |
|
125 |
$viewnames = _convert_csv_to_array(func_get_args()); |
|
126 | 127 |
|
127 | 128 |
// Find all overridden views. |
128 | 129 |
foreach ($views as $view) { |
drupal7/sites/all/modules/views/handlers/views_handler_area_result.inc | ||
---|---|---|
101 | 101 |
$replacements["@$item"] = ${$item}; |
102 | 102 |
} |
103 | 103 |
// Send the output. |
104 |
if (!empty($total)) { |
|
104 |
if (!empty($total) || !empty($this->options['empty'])) {
|
|
105 | 105 |
$output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format)); |
106 | 106 |
} |
107 | 107 |
return $output; |
drupal7/sites/all/modules/views/handlers/views_handler_argument.inc | ||
---|---|---|
14 | 14 |
/** |
15 | 15 |
* Base class for arguments. |
16 | 16 |
* |
17 |
* The basic argument works for very simple arguments such as nid and uid |
|
17 |
* The basic argument works for very simple arguments such as nid and uid.
|
|
18 | 18 |
* |
19 | 19 |
* Definition terms for this handler: |
20 | 20 |
* - name field: The field to use for the name to use in the summary, which is |
... | ... | |
158 | 158 |
} |
159 | 159 |
|
160 | 160 |
/** |
161 |
* Determine if the argument can generate a breadcrumb |
|
161 |
* Determine if the argument can generate a breadcrumb.
|
|
162 | 162 |
* |
163 | 163 |
* @return bool |
164 |
* Indicates whether the argument can generate a breadcrumb. |
|
164 | 165 |
*/ |
165 | 166 |
public function uses_breadcrumb() { |
166 | 167 |
$info = $this->default_actions($this->options['default_action']); |
... | ... | |
195 | 196 |
* Determine if the argument needs a style plugin. |
196 | 197 |
* |
197 | 198 |
* @return bool |
199 |
* the argument needs a plugin style. |
|
198 | 200 |
*/ |
199 | 201 |
public function needs_style_plugin() { |
200 | 202 |
$info = $this->default_actions($this->options['default_action']); |
... | ... | |
527 | 529 |
} |
528 | 530 |
|
529 | 531 |
/** |
530 |
* Provide a list of default behaviors for this argument if the argument |
|
531 |
* is not present. |
|
532 |
* List of default behaviors for this argument if the argument is not present. |
|
532 | 533 |
* |
533 | 534 |
* Override this method to provide additional (or fewer) default behaviors. |
534 | 535 |
*/ |
... | ... | |
657 | 658 |
} |
658 | 659 |
|
659 | 660 |
/** |
660 |
* Provide a form for selecting further summary options when the default |
|
661 |
* action is set to display one. |
|
661 |
* Form for selecting further summary options. |
|
662 |
* |
|
663 |
* Only used when the default action is set to display one. |
|
662 | 664 |
*/ |
663 | 665 |
public function default_summary_form(&$form, &$form_state) { |
664 | 666 |
$style_plugins = views_fetch_plugin_data('style'); |
... | ... | |
795 | 797 |
} |
796 | 798 |
|
797 | 799 |
/** |
798 |
* Default action: empty |
|
800 |
* Default action: empty.
|
|
799 | 801 |
* |
800 | 802 |
* If an argument was expected and was not given, in this case, display the |
801 |
* view's empty text |
|
803 |
* view's empty text.
|
|
802 | 804 |
*/ |
803 | 805 |
public function default_empty() { |
804 | 806 |
// We return with no query; this will force the empty text. |
... | ... | |
967 | 969 |
* |
968 | 970 |
* @param string $order |
969 | 971 |
* The order selected in the UI. |
972 |
* @param string $by |
|
973 |
* Optional alias for this field. |
|
970 | 974 |
*/ |
971 | 975 |
public function summary_sort($order, $by = NULL) { |
972 | 976 |
$this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias)); |
... | ... | |
1116 | 1120 |
} |
1117 | 1121 |
|
1118 | 1122 |
/** |
1119 |
* Set the input for this argument |
|
1123 |
* Set the input for this argument.
|
|
1120 | 1124 |
* |
1121 | 1125 |
* @return bool |
1122 | 1126 |
* TRUE if it successfully validates; FALSE if it does not. |
drupal7/sites/all/modules/views/handlers/views_handler_argument_date.inc | ||
---|---|---|
17 | 17 |
* Definitions terms: |
18 | 18 |
* - many to one: If true, the "many to one" helper will be used. |
19 | 19 |
* - invalid input: A string to give to the user for obviously invalid input. |
20 |
* This is deprecated in favor of argument validators.
|
|
20 |
* This is deprecated in favor of argument validators. |
|
21 | 21 |
* |
22 | 22 |
* @see views_many_to_one_helper() |
23 | 23 |
* |
... | ... | |
26 | 26 |
class views_handler_argument_date extends views_handler_argument_formula { |
27 | 27 |
|
28 | 28 |
/** |
29 |
* |
|
29 |
* @var string
|
|
30 | 30 |
*/ |
31 | 31 |
public $option_name = 'default_argument_date'; |
32 | 32 |
|
33 | 33 |
/** |
34 |
* |
|
34 |
* @var string
|
|
35 | 35 |
*/ |
36 | 36 |
public $arg_format = 'Y-m-d'; |
37 | 37 |
|
... | ... | |
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
/** |
49 |
* Set the empty argument value to the current date,
|
|
49 |
* Set the empty argument value to the current date.
|
|
50 | 50 |
* |
51 |
* formatted appropriately for this argument.
|
|
51 |
* Formatted appropriately for this argument.
|
|
52 | 52 |
* |
53 | 53 |
* @return string |
54 | 54 |
* The default argument. |
drupal7/sites/all/modules/views/handlers/views_handler_argument_string.inc | ||
---|---|---|
38 | 38 |
$options['path_case'] = array('default' => 'none'); |
39 | 39 |
$options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE); |
40 | 40 |
$options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE); |
41 |
$options['not'] = array('default' => FALSE, 'bool' => TRUE); |
|
41 | 42 |
|
42 | 43 |
if (!empty($this->definition['many to one'])) { |
43 | 44 |
$options['add_table'] = array('default' => FALSE, 'bool' => TRUE); |
... | ... | |
132 | 133 |
'#default_value' => !empty($this->options['break_phrase']), |
133 | 134 |
'#fieldset' => 'more', |
134 | 135 |
); |
136 |
$form['not'] = array( |
|
137 |
'#type' => 'checkbox', |
|
138 |
'#title' => t('Exclude'), |
|
139 |
'#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), |
|
140 |
'#default_value' => !empty($this->options['not']), |
|
141 |
'#fieldset' => 'more', |
|
142 |
); |
|
135 | 143 |
} |
136 | 144 |
|
137 | 145 |
/** |
... | ... | |
207 | 215 |
} |
208 | 216 |
|
209 | 217 |
if (count($this->value) > 1) { |
210 |
$operator = 'IN';
|
|
218 |
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
|
|
211 | 219 |
$argument = $this->value; |
212 | 220 |
} |
213 | 221 |
else { |
214 |
$operator = '=';
|
|
222 |
$operator = empty($this->options['not']) ? '=' : '!=';
|
|
215 | 223 |
} |
216 | 224 |
|
217 | 225 |
if ($formula) { |
218 | 226 |
$placeholder = $this->placeholder(); |
219 |
if ($operator == 'IN') { |
|
220 |
$field .= " IN($placeholder)"; |
|
221 |
} |
|
222 |
else { |
|
223 |
$field .= ' = ' . $placeholder; |
|
227 |
if (count($this->value) > 1) { |
|
228 |
$placeholder = "($placeholder)"; |
|
224 | 229 |
} |
230 |
$field .= " $operator $placeholder"; |
|
225 | 231 |
$placeholders = array( |
226 | 232 |
$placeholder => $argument, |
227 | 233 |
); |
drupal7/sites/all/modules/views/handlers/views_handler_field.inc | ||
---|---|---|
68 | 68 |
|
69 | 69 |
/** |
70 | 70 |
* @var array |
71 |
* Stores additional fields which get's added to the query.
|
|
71 |
* Stores additional fields which get added to the query. |
|
72 | 72 |
* The generated aliases are stored in $aliases. |
73 | 73 |
*/ |
74 | 74 |
public $additional_fields = array(); |
... | ... | |
424 | 424 |
'absolute' => array('default' => FALSE, 'bool' => TRUE), |
425 | 425 |
'external' => array('default' => FALSE, 'bool' => TRUE), |
426 | 426 |
'replace_spaces' => array('default' => FALSE, 'bool' => TRUE), |
427 |
'unwanted_characters' => array('default' => ''), |
|
427 | 428 |
'path_case' => array('default' => 'none', 'translatable' => FALSE), |
428 | 429 |
'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE), |
429 | 430 |
'alt' => array('default' => '', 'translatable' => TRUE), |
... | ... | |
744 | 745 |
'edit-options-alter-make-link' => array(1), |
745 | 746 |
), |
746 | 747 |
); |
748 |
$form['alter']['unwanted_characters'] = array( |
|
749 |
'#type' => 'textfield', |
|
750 |
'#title' => t('Remove unwanted characters'), |
|
751 |
'#description' => t('Space-separated list of characters to remove from the URL path'), |
|
752 |
'#default_value' => $this->options['alter']['unwanted_characters'], |
|
753 |
'#dependency' => array( |
|
754 |
'edit-options-alter-make-link' => array(1) |
|
755 |
), |
|
756 |
'#maxlength' => 255, |
|
757 |
); |
|
747 | 758 |
$form['alter']['path_case'] = array( |
748 | 759 |
'#type' => 'select', |
749 | 760 |
'#title' => t('Transform the case'), |
... | ... | |
782 | 793 |
'#title' => t('Rel Text'), |
783 | 794 |
'#type' => 'textfield', |
784 | 795 |
'#default_value' => $this->options['alter']['rel'], |
785 |
'#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'),
|
|
796 |
'#description' => t('Include Rel attribute for use in lightbox2 or other JavaScript utility.'),
|
|
786 | 797 |
'#dependency' => array( |
787 | 798 |
'edit-options-alter-make-link' => array(1), |
788 | 799 |
), |
... | ... | |
1234 | 1245 |
* Render this field as altered text, from a fieldset set by the user. |
1235 | 1246 |
*/ |
1236 | 1247 |
public function render_altered($alter, $tokens) { |
1237 |
// Filter this right away as our substitutions are already sanitized. |
|
1238 |
$value = filter_xss_admin($alter['text']); |
|
1248 |
// We trust admins so we allow any tag content. This is important for |
|
1249 |
// displays such as XML where we should not mess with tags. |
|
1250 |
$value = $alter['text']; |
|
1239 | 1251 |
$value = strtr($value, $tokens); |
1240 | 1252 |
|
1241 | 1253 |
return $value; |
... | ... | |
1287 | 1299 |
if (!empty($alter['replace_spaces'])) { |
1288 | 1300 |
$path = str_replace(' ', '-', $path); |
1289 | 1301 |
} |
1302 |
|
|
1303 |
if (!empty($alter['unwanted_characters'])) { |
|
1304 |
foreach (explode(' ', $alter['unwanted_characters']) as $unwanted) { |
|
1305 |
$path = str_replace($unwanted, '', $path); |
|
1306 |
} |
|
1307 |
} |
|
1290 | 1308 |
} |
1291 | 1309 |
|
1292 | 1310 |
// Parse the URL and move any query and fragment parameters out of the path. |
drupal7/sites/all/modules/views/handlers/views_handler_field_date.inc | ||
---|---|---|
8 | 8 |
/** |
9 | 9 |
* A handler to provide proper displays for dates. |
10 | 10 |
* |
11 |
* This may be used on table fields that hold either UNIX timestamps or SQL |
|
12 |
* datetime strings. |
|
13 |
* |
|
11 | 14 |
* @ingroup views_field_handlers |
12 | 15 |
*/ |
13 | 16 |
class views_handler_field_date extends views_handler_field { |
... | ... | |
138 | 141 |
*/ |
139 | 142 |
public function render($values) { |
140 | 143 |
$value = $this->get_value($values); |
144 |
|
|
145 |
if (!is_numeric($value)) { |
|
146 |
// If the value isn't numeric, assume it's an SQL DATETIME. |
|
147 |
$value = strtotime($value); |
|
148 |
} |
|
149 |
|
|
141 | 150 |
$format = $this->options['date_format']; |
142 | 151 |
if (in_array($format, $this->supported_date_types())) { |
143 | 152 |
$custom_format = $this->options['custom_date_format']; |
drupal7/sites/all/modules/views/handlers/views_handler_field_entity.inc | ||
---|---|---|
41 | 41 |
|
42 | 42 |
// Initialize the entity-type used. |
43 | 43 |
$table_data = views_fetch_data($this->table); |
44 |
$this->entity_type = $table_data['table']['entity type']; |
|
44 |
if (isset($table_data['table']['entity type'])) { |
|
45 |
$this->entity_type = $table_data['table']['entity type']; |
|
46 |
} |
|
45 | 47 |
} |
46 | 48 |
|
47 | 49 |
/** |
drupal7/sites/all/modules/views/handlers/views_handler_field_links.inc | ||
---|---|---|
64 | 64 |
public function options_submit(&$form, &$form_state) { |
65 | 65 |
// Remove unselected options. |
66 | 66 |
$form_state['values']['options']['fields'] = array_filter($form_state['values']['options']['fields']); |
67 |
parent::options_submit($form, $form_state); |
|
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
/** |
drupal7/sites/all/modules/views/handlers/views_handler_field_numeric.inc | ||
---|---|---|
118 | 118 |
public function render($values) { |
119 | 119 |
$value = $this->get_value($values); |
120 | 120 |
|
121 |
// Output nothing if the value is null. |
|
122 |
if (is_null($value)) { |
|
123 |
return ''; |
|
124 |
} |
|
125 |
|
|
121 | 126 |
// Hiding should happen before rounding or adding prefix/suffix. |
122 | 127 |
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) { |
123 | 128 |
return ''; |
... | ... | |
127 | 132 |
$value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']); |
128 | 133 |
} |
129 | 134 |
else { |
130 |
$remainder = abs($value) - intval(abs($value)); |
|
135 |
$point_position = strpos($value, '.'); |
|
136 |
$remainder = ($point_position === FALSE) ? '' : substr($value, $point_position + 1); |
|
131 | 137 |
$value = $value > 0 ? floor($value) : ceil($value); |
132 | 138 |
$value = number_format($value, 0, '', $this->options['separator']); |
133 | 139 |
if ($remainder) { |
134 | 140 |
// The substr may not be locale safe. |
135 |
$value .= $this->options['decimal'] . substr($remainder, 2);
|
|
141 |
$value .= $this->options['decimal'] . $remainder;
|
|
136 | 142 |
} |
137 | 143 |
} |
138 | 144 |
|
drupal7/sites/all/modules/views/handlers/views_handler_filter.inc | ||
---|---|---|
15 | 15 |
* available as standard operators. |
16 | 16 |
* |
17 | 17 |
* Object flags: |
18 |
* You can set some specific behavior by setting up the following flags on |
|
19 |
* your custom class. |
|
20 |
* |
|
21 |
* - always_multiple: |
|
22 |
* Disable the possibility to force a single value. |
|
23 |
* - no_operator: |
|
24 |
* Disable the possibility to use operators. |
|
25 |
* - always_required: |
|
26 |
* Disable the possibility to allow a exposed input to be optional. |
|
18 |
* It's possible to set specific behavior using the following flags on the |
|
19 |
* custom class: |
|
20 |
* - always_multiple: |
|
21 |
* Disable the possibility to force a single value. |
|
22 |
* - no_operator: |
|
23 |
* Disable the possibility to use operators. |
|
24 |
* - always_required: |
|
25 |
* Disable the possibility to allow a exposed input to be optional. |
|
27 | 26 |
*/ |
28 | 27 |
|
29 | 28 |
/** |
... | ... | |
34 | 33 |
class views_handler_filter extends views_handler { |
35 | 34 |
|
36 | 35 |
/** |
37 |
* Contains the actual value of the field,either configured in the views ui |
|
38 |
* or entered in the exposed filters. |
|
36 |
* Contains the actual value of the field. |
|
37 |
* |
|
38 |
* This will be either configured in the views UI or entered in the exposed |
|
39 |
* filters. |
|
39 | 40 |
* |
40 | 41 |
* @var mixed |
41 | 42 |
*/ |
... | ... | |
135 | 136 |
'use_operator' => array('default' => FALSE, 'bool' => TRUE), |
136 | 137 |
'operator_label' => array('default' => '', 'translatable' => TRUE), |
137 | 138 |
'operator' => array('default' => ''), |
139 |
'limit_operators' => array('default' => FALSE, 'bool' => TRUE), |
|
140 |
'available_operators' => array('default' => array()), |
|
138 | 141 |
'identifier' => array('default' => ''), |
139 | 142 |
'required' => array('default' => FALSE, 'bool' => TRUE), |
140 | 143 |
'remember' => array('default' => FALSE, 'bool' => TRUE), |
141 | 144 |
'multiple' => array('default' => FALSE, 'bool' => TRUE), |
142 |
'remember_roles' => array('default' => array( |
|
143 |
DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID, |
|
144 |
)), |
|
145 |
'remember_roles' => array( |
|
146 |
'default' => array( |
|
147 |
DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID, |
|
148 |
), |
|
149 |
), |
|
145 | 150 |
), |
146 | 151 |
); |
147 | 152 |
|
... | ... | |
205 | 210 |
/** |
206 | 211 |
* Provide the basic form which calls through to subforms. |
207 | 212 |
* |
208 |
* If overridden, it is best to call through to the parent, |
|
209 |
* or to at least make sure all of the functions in this form |
|
210 |
* are called. |
|
213 |
* If overridden, it is best to call through to the parent, or to at least |
|
214 |
* make sure all of the functions in this form are called. |
|
211 | 215 |
*/ |
212 | 216 |
public function options_form(&$form, &$form_state) { |
213 | 217 |
parent::options_form($form, $form_state); |
... | ... | |
248 | 252 |
} |
249 | 253 |
|
250 | 254 |
/** |
251 |
* Simple validate handler |
|
255 |
* Simple validate handler.
|
|
252 | 256 |
*/ |
253 | 257 |
public function options_validate(&$form, &$form_state) { |
254 | 258 |
$this->operator_validate($form, $form_state); |
... | ... | |
274 | 278 |
$this->value_submit($form, $form_state); |
275 | 279 |
} |
276 | 280 |
if (!empty($this->options['exposed'])) { |
281 |
$options = &$form_state['values']['options']['expose']; |
|
282 |
$options['available_operators'] = (!empty($options['use_operator']) && !empty($options['limit_operators'])) ? array_filter($options['available_operators']) : array(); |
|
277 | 283 |
$this->expose_submit($form, $form_state); |
278 | 284 |
} |
279 | 285 |
if ($this->is_a_group()) { |
... | ... | |
293 | 299 |
/** |
294 | 300 |
* Options form subform for setting the operator. |
295 | 301 |
* |
296 |
* This may be overridden by child classes, and it must |
|
297 |
* define $form['operator'];
|
|
302 |
* This may be overridden by child classes, and it must define
|
|
303 |
* $form['operator'].
|
|
298 | 304 |
* |
299 | 305 |
* @see options_form() |
300 | 306 |
*/ |
301 | 307 |
public function operator_form(&$form, &$form_state) { |
302 | 308 |
$options = $this->operator_options(); |
303 | 309 |
if (!empty($options)) { |
310 |
$available = $this->options['expose']['available_operators']; |
|
311 |
if ($this->options['expose']['limit_operators'] && count($available)) { |
|
312 |
foreach ($options as $key => $value) { |
|
313 |
if (!isset($available[$key])) { |
|
314 |
unset($options[$key]); |
|
315 |
} |
|
316 |
} |
|
317 |
|
|
318 |
// Make sure we have a valid default value if the current one is |
|
319 |
// excluded. |
|
320 |
if (!isset($options[$this->operator])) { |
|
321 |
// Just choose the first. |
|
322 |
$this->operator = key($options); |
|
323 |
} |
|
324 |
} |
|
304 | 325 |
$form['operator'] = array( |
305 | 326 |
'#type' => count($options) < 10 ? 'radios' : 'select', |
306 | 327 |
'#title' => t('Operator'), |
... | ... | |
313 | 334 |
/** |
314 | 335 |
* Provide a list of options for the default operator form. |
315 | 336 |
* |
316 |
* Should be overridden by classes that don't override operator_form |
|
337 |
* Should be overridden by classes that don't override operator_form.
|
|
317 | 338 |
*/ |
318 | 339 |
public function operator_options() { |
319 | 340 |
return array(); |
... | ... | |
511 | 532 |
'#title' => t('Required'), |
512 | 533 |
'#default_value' => $this->options['expose']['required'], |
513 | 534 |
); |
535 |
|
|
536 |
$operator_options = $this->operator_options(); |
|
537 |
if (count($operator_options)) { |
|
538 |
$form['expose']['limit_operators'] = array( |
|
539 |
'#type' => 'checkbox', |
|
540 |
'#title' => t('Limit operators'), |
|
541 |
'#description' => t('When checked, the operator will be exposed to the user'), |
|
542 |
'#default_value' => !empty($this->options['expose']['limit_operators']), |
|
543 |
'#dependency' => array( |
|
544 |
'edit-options-expose-use-operator' => array(1), |
|
545 |
), |
|
546 |
'#description' => t('Restrict which operators will be available to select in the exposed operator form.'), |
|
547 |
); |
|
548 |
|
|
549 |
$form['expose']['available_operators'] = array( |
|
550 |
'#type' => 'checkboxes', |
|
551 |
'#title' => t('Limit the exposed operators'), |
|
552 |
'#default_value' => $this->options['expose']['available_operators'], |
|
553 |
'#prefix' => '<div id="edit-options-expose-available-operators-wrapper"><div id="edit-options-expose-available-operators">', |
|
554 |
'#suffix' => '</div></div>', |
|
555 |
'#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.'), |
|
556 |
'#options' => $operator_options, |
|
557 |
'#dependency' => array( |
|
558 |
'edit-options-expose-limit-operators' => array(1), |
|
559 |
), |
|
560 |
); |
|
561 |
} |
|
514 | 562 |
} |
515 | 563 |
else { |
516 | 564 |
$form['expose']['required'] = array( |
... | ... | |
533 | 581 |
); |
534 | 582 |
|
535 | 583 |
if (!empty($form['operator']['#type'])) { |
536 |
// Increase the width of the left (operator) column.
|
|
584 |
// Increase the width of the left (operator) column. |
|
537 | 585 |
$form['operator']['#prefix'] = '<div class="views-group-box views-left-40">'; |
538 | 586 |
$form['operator']['#suffix'] = '</div>'; |
539 | 587 |
$form['value']['#prefix'] = '<div class="views-group-box views-right-60">'; |
... | ... | |
552 | 600 |
'#size' => 40, |
553 | 601 |
'#description' => t('This will appear before your operator select field.'), |
554 | 602 |
'#dependency' => array( |
555 |
'edit-options-expose-use-operator' => array(1) |
|
603 |
'edit-options-expose-use-operator' => array(1),
|
|
556 | 604 |
), |
557 | 605 |
); |
558 | 606 |
$form['expose']['operator_id'] = array( |
... | ... | |
562 | 610 |
'#size' => 40, |
563 | 611 |
'#description' => t('This will appear in the URL after the ? to identify this operator.'), |
564 | 612 |
'#dependency' => array( |
565 |
'edit-options-expose-use-operator' => array(1) |
|
613 |
'edit-options-expose-use-operator' => array(1),
|
|
566 | 614 |
), |
567 | 615 |
'#fieldset' => 'more', |
568 | 616 |
); |
... | ... | |
629 | 677 |
if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) { |
630 | 678 |
form_error($form['expose']['identifier'], t('This identifier is used by another handler.')); |
631 | 679 |
} |
680 |
|
|
681 |
// Filter out roles which weren't selected, so that they aren't exported. |
|
682 |
// This is purely cosmetic. |
|
683 |
if (!empty($form_state['values']['options']['expose']['remember_roles'])) { |
|
684 |
$form_state['values']['options']['expose']['remember_roles'] = array_filter($form_state['values']['options']['expose']['remember_roles']); |
|
685 |
} |
|
632 | 686 |
} |
633 | 687 |
|
634 | 688 |
/** |
... | ... | |
657 | 711 |
if (empty($group['remove'])) { |
658 | 712 |
// Check if the title is defined but value wasn't defined. |
659 | 713 |
if (!empty($group['title'])) { |
660 |
if ((!is_array($group['value']) && trim($group['value']) == "") || |
|
661 |
(is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) { |
|
662 |
form_error($form['group_info']['group_items'][$id]['value'], |
|
663 |
t('The value is required if title for this item is defined.')); |
|
714 |
// No value is needed for 'empty' and 'not empty' operator. |
|
715 |
if (!in_array($group['operator'], array('empty', 'not empty'))) { |
|
716 |
if ((!is_array($group['value']) && trim($group['value']) == "") || |
|
717 |
(is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) { |
|
718 |
form_error($form['group_info']['group_items'][$id]['value'], |
|
719 |
t('The value is required if title for this item is defined.')); |
|
720 |
} |
|
664 | 721 |
} |
665 | 722 |
} |
666 | 723 |
|
... | ... | |
786 | 843 |
} |
787 | 844 |
} |
788 | 845 |
|
789 |
|
|
790 | 846 |
/** |
791 |
* Render our chunk of the exposed filter form when selecting |
|
847 |
* Render our chunk of the exposed filter form when selecting.
|
|
792 | 848 |
* |
793 | 849 |
* You can override this if it doesn't do what you expect. |
794 | 850 |
*/ |
... | ... | |
802 | 858 |
$operator = $this->options['expose']['operator_id']; |
803 | 859 |
$this->operator_form($form, $form_state); |
804 | 860 |
$form[$operator] = $form['operator']; |
805 |
$form[$operator]['#title'] = $this->options['expose']['operator_label'];
|
|
861 |
$form[$operator]['#title'] = $this->options['expose']['operator_label']; |
|
806 | 862 |
$form[$operator]['#title_display'] = 'invisible'; |
807 | 863 |
|
808 | 864 |
$this->exposed_translate($form[$operator], 'operator'); |
... | ... | |
813 | 869 |
// Build the form and set the value based on the identifier. |
814 | 870 |
if (!empty($this->options['expose']['identifier'])) { |
815 | 871 |
$value = $this->options['expose']['identifier']; |
816 |
$this->value_form($form, $form_state); |
|
872 |
if ($this->operator == 'empty' || $this->operator == 'not empty') { |
|
873 |
$boolean = new views_handler_filter_boolean_operator(); |
|
874 |
$boolean->value = $this->value = 'All'; |
|
875 |
$boolean->value_value = $this->value_value = ''; |
|
876 |
$boolean->value_options = $this->value_options = array( |
|
877 |
1 => t('Yes'), |
|
878 |
0 => t('No'), |
|
879 |
); |
|
880 |
$boolean->value_form($form, $form_state); |
|
881 |
} |
|
882 |
else { |
|
883 |
$this->value_form($form, $form_state); |
|
884 |
} |
|
817 | 885 |
$form[$value] = $form['value']; |
818 | 886 |
|
819 | 887 |
if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') { |
... | ... | |
955 | 1023 |
|
956 | 1024 |
// The string '- Any -' will not be rendered. |
957 | 1025 |
// @see theme_views_ui_build_group_filter_form() |
958 |
$groups = array('All' => '- Any -');
|
|
1026 |
$groups = array('All' => '- Any -'); |
|
959 | 1027 |
|
960 | 1028 |
// Provide 3 options to start when we are in a new group. |
961 | 1029 |
if (count($this->options['group_info']['group_items']) == 0) { |
... | ... | |
968 | 1036 |
if (!empty($form_state['values']['options']['group_info']['group_items'][$item_id]['remove'])) { |
969 | 1037 |
continue; |
970 | 1038 |
} |
1039 |
|
|
971 | 1040 |
// Each rows contains three widgets: |
972 | 1041 |
// a) The title, where users define how they identify a pair of operator |
973 | 1042 |
// | value. |
... | ... | |
979 | 1048 |
$row = array(); |
980 | 1049 |
$groups[$item_id] = ''; |
981 | 1050 |
$this->operator_form($row, $form_state); |
982 |
// Force the operator form to be a select box. Some handlers uses |
|
983 |
// radios and they occupy a lot of space in a table row.
|
|
1051 |
// Force the operator form to be a select box. Some handlers uses radios
|
|
1052 |
// and they occupy a lot of space in a table row. |
|
984 | 1053 |
$row['operator']['#type'] = 'select'; |
985 | 1054 |
$row['operator']['#title'] = ''; |
986 | 1055 |
$this->value_form($row, $form_state); |
987 | 1056 |
|
988 | 1057 |
// Fix the dependencies to update value forms when operators changes. |
989 |
// This is needed because forms are inside a new form and their ids
|
|
1058 |
// This is needed because forms are inside a new form and their IDs
|
|
990 | 1059 |
// changes. Dependencies are used when operator changes from to |
991 | 1060 |
// 'Between', 'Not Between', etc, and two or more widgets are displayed. |
992 | 1061 |
$without_children = TRUE; |
... | ... | |
1041 | 1110 |
), |
1042 | 1111 |
); |
1043 | 1112 |
} |
1113 |
|
|
1044 | 1114 |
// From all groups, let chose which is the default. |
1045 | 1115 |
$form['group_info']['default_group'] = array( |
1046 | 1116 |
'#type' => 'radios', |
... | ... | |
1049 | 1119 |
'#required' => TRUE, |
1050 | 1120 |
'#attributes' => array( |
1051 | 1121 |
'class' => array('default-radios'), |
1052 |
) |
|
1122 |
),
|
|
1053 | 1123 |
); |
1124 |
|
|
1054 | 1125 |
// From all groups, let chose which is the default. |
1055 | 1126 |
$form['group_info']['default_group_multiple'] = array( |
1056 | 1127 |
'#type' => 'checkboxes', |
... | ... | |
1058 | 1129 |
'#default_value' => $this->options['group_info']['default_group_multiple'], |
1059 | 1130 |
'#attributes' => array( |
1060 | 1131 |
'class' => array('default-checkboxes'), |
1061 |
) |
|
1132 |
),
|
|
1062 | 1133 |
); |
1063 | 1134 |
|
1064 | 1135 |
$form['group_info']['add_group'] = array( |
... | ... | |
1086 | 1157 |
} |
1087 | 1158 |
} |
1088 | 1159 |
|
1089 |
|
|
1090 | 1160 |
/** |
1091 | 1161 |
* Make some translations to a form item to make it more suitable to exposing. |
1092 | 1162 |
*/ |
... | ... | |
1190 | 1260 |
/** |
1191 | 1261 |
* Transform the input from a grouped filter into a standard filter. |
1192 | 1262 |
* |
1193 |
* When a filter is a group, find the set of operator and values |
|
1194 |
* that the choosed item represents, and inform views that a normal
|
|
1195 |
* filter was submitted by telling the operator and the value selected.
|
|
1263 |
* When a filter is a group, find the set of operator and values that the
|
|
1264 |
* choosen item represents, and inform views that a normal filter was
|
|
1265 |
* submitted by telling the operator and the value selected. |
|
1196 | 1266 |
* |
1197 | 1267 |
* The param $selected_group_id is only passed when the filter uses the |
1198 |
* checkboxes widget, and this function will be called for each item |
|
1199 |
* choosed in the checkboxes.
|
|
1268 |
* checkboxes widget, and this function will be called for each item choosen
|
|
1269 |
* in the checkboxes. |
|
1200 | 1270 |
*/ |
1201 | 1271 |
public function convert_exposed_input(&$input, $selected_group_id = NULL) { |
1202 | 1272 |
if ($this->is_a_group()) { |
... | ... | |
1234 | 1304 |
} |
1235 | 1305 |
|
1236 | 1306 |
/** |
1237 |
* Returns the options available for a grouped filter that users checkboxes |
|
1238 |
* as widget, and therefore has to be applied several times, one per |
|
1239 |
* item selected. |
|
1307 |
* Options available for a grouped filter which uses checkboxes. |
|
1308 |
* |
|
1309 |
* Note: has to be applied several times, one per item selected. |
|
1310 |
* |
|
1311 |
* @return array |
|
1312 |
* The options available for a grouped filter. |
|
1240 | 1313 |
*/ |
1241 | 1314 |
public function group_multiple_exposed_input(&$input) { |
1242 | 1315 |
if (!empty($input[$this->options['group_info']['identifier']])) { |
... | ... | |
1246 | 1319 |
} |
1247 | 1320 |
|
1248 | 1321 |
/** |
1249 |
* |
|
1322 |
* Indicate whether users can select multiple group items.
|
|
1250 | 1323 |
* |
1251 | 1324 |
* @return bool |
1252 | 1325 |
* TRUE if users can select multiple groups items of a grouped exposed |
... | ... | |
1258 | 1331 |
|
1259 | 1332 |
/** |
1260 | 1333 |
* If set to remember exposed input in the session, store it there. |
1261 |
* This function is similar to store_exposed_input but modified to |
|
1262 |
* work properly when the filter is a group. |
|
1334 |
* |
|
1335 |
* This function is similar to store_exposed_input but modified to work |
|
1336 |
* properly when the filter is a group. |
|
1263 | 1337 |
*/ |
1264 | 1338 |
public function store_group_input($input, $status) { |
1265 | 1339 |
if (!$this->is_a_group() || empty($this->options['group_info']['identifier'])) { |
... | ... | |
1312 | 1386 |
|
1313 | 1387 |
// Various ways to check for the absence of non-required input. |
1314 | 1388 |
if (empty($this->options['expose']['required'])) { |
1315 |
if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') { |
|
1316 |
$value = ' '; |
|
1389 |
if ($this->operator == 'empty' || $this->operator == 'not empty') { |
|
1390 |
$value = is_array($value) ? $value['value'] : $value; |
|
1391 |
$this->operator = ($this->operator == 'empty' && empty($value)) || ($this->operator == 'not empty' && !empty($value)) ? 'not empty' : 'empty'; |
|
1317 | 1392 |
} |
1318 | 1393 |
|
1319 |
if ($this->operator != 'empty' && $this->operator != 'not empty') { |
|
1320 |
if ($value == 'All' || $value === array()) { |
|
1321 |
return FALSE; |
|
1322 |
} |
|
1394 |
if ($value == 'All' || $value === array()) { |
|
1395 |
return FALSE; |
|
1323 | 1396 |
} |
1324 | 1397 |
|
1325 | 1398 |
if (!empty($this->always_multiple) && $value === '') { |
... | ... | |
1342 | 1415 |
} |
1343 | 1416 |
|
1344 | 1417 |
/** |
1345 |
* |
|
1418 |
* Store the exposed input for processing later.
|
|
1346 | 1419 |
*/ |
1347 | 1420 |
public function store_exposed_input($input, $status) { |
1348 | 1421 |
if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) { |
... | ... | |
1392 | 1465 |
$session[$this->options['expose']['operator_id']] = $input[$this->options['expose']['operator_id']]; |
1393 | 1466 |
} |
1394 | 1467 |
|
1395 |
$session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']]; |
|
1468 |
if (isset($input[$this->options['expose']['identifier']])) { |
|
1469 |
$session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']]; |
|
1470 |
} |
|
1396 | 1471 |
} |
1397 | 1472 |
} |
1398 | 1473 |
|
... | ... | |
1419 | 1494 |
* @return bool |
1420 | 1495 |
* Whether the filter can be used in OR groups. |
1421 | 1496 |
*/ |
1422 |
public function can_group() {
|
|
1423 |
return TRUE;
|
|
1424 |
}
|
|
1497 |
public function can_group() { |
|
1498 |
return TRUE; |
|
1499 |
} |
|
1425 | 1500 |
|
1426 | 1501 |
} |
1427 | 1502 |
|
... | ... | |
1476 | 1551 |
* Filter by no empty values, though allow to use "0". |
1477 | 1552 |
* |
1478 | 1553 |
* @param string $var |
1554 |
* The string to check. |
|
1479 | 1555 |
* |
1480 | 1556 |
* @return bool |
1557 |
* Indicates if the argument is an empty string. |
|
1481 | 1558 |
*/ |
1482 | 1559 |
function _views_array_filter_zero($var) { |
1483 |
return trim($var) != "";
|
|
1560 |
return trim($var) != '';
|
|
1484 | 1561 |
} |
1485 | 1562 |
|
1486 |
|
|
1487 | 1563 |
/** |
1488 | 1564 |
* @} |
1489 | 1565 |
*/ |
drupal7/sites/all/modules/views/handlers/views_handler_filter_combine.inc | ||
---|---|---|
73 | 73 |
// Always add the table of the selected fields to be sure a table alias |
74 | 74 |
// exists. |
75 | 75 |
$field->ensure_my_table(); |
76 |
if (!empty($field->field_alias) && !empty($field->field_alias)) {
|
|
76 |
if (!empty($field->table_alias) && !empty($field->real_field)) {
|
|
77 | 77 |
$fields[] = "$field->table_alias.$field->real_field"; |
78 | 78 |
} |
79 | 79 |
} |
... | ... | |
198 | 198 |
$this->query->add_where_expression($this->options['group'], "$field RLIKE $placeholder", array($placeholder => $this->value)); |
199 | 199 |
} |
200 | 200 |
|
201 |
/** |
|
202 |
* |
|
203 |
*/ |
|
204 |
public function op_not_regex($field) { |
|
205 |
$placeholder = $this->placeholder(); |
|
206 |
$this->query->add_where_expression($this->options['group'], "$field NOT RLIKE $placeholder", array($placeholder => $this->value)); |
|
207 |
} |
|
208 |
|
|
201 | 209 |
/** |
202 | 210 |
* |
203 | 211 |
*/ |
drupal7/sites/all/modules/views/handlers/views_handler_filter_date.inc | ||
---|---|---|
158 | 158 |
return FALSE; |
159 | 159 |
} |
160 | 160 |
} |
161 |
else { |
|
161 |
elseif ($operators[$operator]['values'] == 2) {
|
|
162 | 162 |
if ($this->value['min'] == '' || $this->value['max'] == '') { |
163 | 163 |
return FALSE; |
164 | 164 |
} |
drupal7/sites/all/modules/views/handlers/views_handler_filter_numeric.inc | ||
---|---|---|
116 | 116 |
'method' => 'op_regex', |
117 | 117 |
'values' => 1, |
118 | 118 |
), |
119 |
'not_regular_expression' => array( |
|
120 |
'title' => t('Not regular expression'), |
|
121 |
'short' => t('not regex'), |
|
122 |
'method' => 'op_not_regex', |
|
123 |
'values' => 1, |
|
124 |
), |
|
119 | 125 |
); |
120 | 126 |
} |
121 | 127 |
|
... | ... | |
159 | 165 |
// not rendered, we can't render dependencies; instead we only |
160 | 166 |
// render the form items we need. |
161 | 167 |
$which = 'all'; |
168 |
$limit_operators = !empty($this->options['expose']['limit_operators']) && (count($this->options['expose']['available_operators']) > 0); |
|
169 |
$use_value = FALSE; |
|
170 |
$use_minmax = FALSE; |
|
171 |
|
|
162 | 172 |
if (!empty($form['operator'])) { |
163 | 173 |
$source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; |
164 | 174 |
} |
165 | 175 |
|
166 | 176 |
if (!empty($form_state['exposed'])) { |
177 |
$operator_values_with_1_values = $this->operator_values(1); |
|
178 |
$operator_values_with_2_values = $this->operator_values(2); |
|
179 |
if ($limit_operators) { |
|
180 |
// If limit operators is enabled, check that at least one operator |
|
181 |
// with two values is enabled to display the min max widgets |
|
182 |
foreach ($operator_values_with_2_values as $operator) { |
|
183 |
if (isset($this->options['expose']['available_operators'][$operator])) { |
|
184 |
$use_minmax = TRUE; |
|
185 |
break; |
|
186 |
} |
|
187 |
} |
|
188 |
// the same for operators with one value |
|
189 |
foreach ($operator_values_with_1_values as $operator) { |
|
190 |
if (isset($this->options['expose']['available_operators'][$operator])) { |
|
191 |
$use_value = TRUE; |
|
192 |
break; |
|
193 |
} |
|
194 |
} |
|
195 |
} |
|
196 |
else { |
|
197 |
$use_minmax = $use_value = TRUE; |
|
198 |
} |
|
167 | 199 |
$identifier = $this->options['expose']['identifier']; |
168 | 200 |
|
169 | 201 |
if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { |
170 | 202 |
// exposed and locked. |
171 |
$which = in_array($this->operator, $this->operator_values(2)) ? 'minmax' : 'value';
|
|
203 |
$which = in_array($this->operator, $operator_values_with_2_values) ? 'minmax' : 'value';
|
|
172 | 204 |
} |
173 | 205 |
else { |
174 | 206 |
$source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); |
175 | 207 |
} |
176 | 208 |
} |
209 |
else { |
|
210 |
$use_minmax = $use_value = TRUE; |
|
211 |
} |
|
177 | 212 |
|
178 |
if ($which == 'all') { |
|
179 |
$form['value']['value'] = array( |
|
180 |
'#type' => 'textfield', |
|
181 |
'#title' => empty($form_state['exposed']) ? t('Value') : '', |
|
182 |
'#size' => 30, |
|
183 |
'#default_value' => $this->value['value'], |
|
184 |
'#dependency' => array($source => $this->operator_values(1)), |
|
185 |
); |
|
186 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) { |
|
187 |
$form_state['input'][$identifier]['value'] = $this->value['value']; |
|
213 |
if ($use_value) { |
|
214 |
if ($which == 'all') { |
|
215 |
$form['value']['value'] = array( |
|
216 |
'#type' => 'textfield', |
|
217 |
'#title' => empty($form_state['exposed']) ? t('Value') : '', |
|
218 |
'#size' => 30, |
|
219 |
'#default_value' => $this->value['value'], |
|
220 |
'#dependency' => array($source => $this->operator_values(1)), |
|
221 |
); |
|
222 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) { |
|
223 |
$form_state['input'][$identifier]['value'] = $this->value['value']; |
|
224 |
} |
|
188 | 225 |
} |
189 |
}
|
|
190 |
elseif ($which == 'value') {
|
|
191 |
// When exposed we drop the value-value and just do value if
|
|
192 |
// the operator is locked.
|
|
193 |
$form['value'] = array(
|
|
194 |
'#type' => 'textfield',
|
|
195 |
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
|
196 |
'#size' => 30,
|
|
197 |
'#default_value' => $this->value['value'],
|
|
198 |
);
|
|
199 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
|
|
200 |
$form_state['input'][$identifier] = $this->value['value'];
|
|
226 |
elseif ($which == 'value') {
|
|
227 |
// When exposed we drop the value-value and just do value if
|
|
228 |
// the operator is locked.
|
|
229 |
$form['value'] = array(
|
|
230 |
'#type' => 'textfield',
|
|
231 |
'#title' => empty($form_state['exposed']) ? t('Value') : '',
|
|
232 |
'#size' => 30,
|
|
233 |
'#default_value' => $this->value['value'],
|
|
234 |
);
|
|
235 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
|
|
236 |
$form_state['input'][$identifier] = $this->value['value'];
|
|
237 |
}
|
|
201 | 238 |
} |
202 | 239 |
} |
203 | 240 |
|
204 | 241 |
if ($which == 'all' || $which == 'minmax') { |
205 |
$form['value']['min'] = array( |
|
206 |
'#type' => 'textfield', |
|
207 |
'#title' => empty($form_state['exposed']) ? t('Min') : '', |
|
208 |
'#size' => 30, |
|
209 |
'#default_value' => $this->value['min'], |
|
210 |
); |
|
211 |
$form['value']['max'] = array( |
|
212 |
'#type' => 'textfield', |
|
213 |
'#title' => empty($form_state['exposed']) ? t('And max') : t('And'), |
|
214 |
'#size' => 30, |
|
215 |
'#default_value' => $this->value['max'], |
|
216 |
); |
|
217 |
if ($which == 'all') { |
|
218 |
$dependency = array( |
|
219 |
'#dependency' => array($source => $this->operator_values(2)), |
|
242 |
if ($use_minmax) { |
|
243 |
$form['value']['min'] = array( |
|
244 |
'#type' => 'textfield', |
|
245 |
'#title' => empty($form_state['exposed']) ? t('Min') : '', |
|
246 |
'#size' => 30, |
|
247 |
'#default_value' => $this->value['min'], |
|
220 | 248 |
); |
221 |
$form['value']['min'] += $dependency; |
|
222 |
$form['value']['max'] += $dependency; |
|
249 |
$form['value']['max'] = array( |
|
250 |
'#type' => 'textfield', |
|
251 |
'#title' => empty($form_state['exposed']) ? t('And max') : t('And'), |
|
252 |
'#size' => 30, |
|
253 |
'#default_value' => $this->value['max'], |
|
254 |
); |
|
255 |
|
|
256 |
if ($which == 'all') { |
|
257 |
$dependency = array( |
|
258 |
'#dependency' => array($source => $this->operator_values(2)), |
|
259 |
); |
|
260 |
|
|
261 |
$form['value']['min'] += $dependency; |
|
262 |
$form['value']['max'] += $dependency; |
|
263 |
} |
|
223 | 264 |
} |
224 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min'])) { |
|
265 |
|
|
266 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min']) && $use_minmax) { |
|
225 | 267 |
$form_state['input'][$identifier]['min'] = $this->value['min']; |
226 | 268 |
} |
227 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max'])) { |
|
269 |
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max']) && $use_minmax) {
|
|
228 | 270 |
$form_state['input'][$identifier]['max'] = $this->value['max']; |
229 | 271 |
} |
230 | 272 |
|
... | ... | |
291 | 333 |
$this->query->add_where($this->options['group'], $field, $this->value['value'], 'RLIKE'); |
292 | 334 |
} |
293 | 335 |
|
336 |
/** |
|
337 |
* {@inheritdoc} |
|
338 |
*/ |
|
339 |
public function op_not_regex($field) { |
|
340 |
$this->query->add_where($this->options['group'], $field, $this->value['value'], 'NOT RLIKE'); |
|
341 |
} |
|
342 |
|
|
294 | 343 |
/** |
295 | 344 |
* {@inheritdoc} |
296 | 345 |
*/ |
drupal7/sites/all/modules/views/handlers/views_handler_filter_string.inc | ||
---|---|---|
135 | 135 |
'method' => 'op_regex', |
136 | 136 |
'values' => 1, |
137 | 137 |
), |
138 |
'not_regular_expression' => array( |
|
139 |
'title' => t('Not regular expression'), |
|
140 |
'short' => t('not regex'), |
|
141 |
'method' => 'op_not_regex', |
|
142 |
'values' => 1, |
|
143 |
), |
|
138 | 144 |
); |
139 | 145 |
} |
140 | 146 |
|
... | ... | |
274 | 280 |
* {@inheritdoc} |
275 | 281 |
*/ |
276 | 282 |
public function op_contains($field) { |
277 |
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE'); |
|
283 |
if (!empty($this->value)) { |
|
284 |
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE'); |
|
285 |
} |
|
278 | 286 |
} |
279 | 287 |
|
280 | 288 |
/** |
... | ... | |
371 | 379 |
$this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE'); |
372 | 380 |
} |
373 | 381 |
|
382 |
/** |
|
383 |
* {@inheritdoc} |
|
384 |
*/ |
|
385 |
public function op_not_regex($field) { |
|
386 |
$this->query->add_where($this->options['group'], $field, $this->value, 'NOT RLIKE'); |
|
387 |
} |
|
388 |
|
|
374 | 389 |
/** |
375 | 390 |
* {@inheritdoc} |
376 | 391 |
*/ |
drupal7/sites/all/modules/views/help/about.html | ||
---|---|---|
19 | 19 |
|
20 | 20 |
<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> |
21 | 21 |
|
22 |
<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>
|
|
22 |
<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> |
|
23 | 23 |
|
24 |
<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>
|
|
24 |
<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> |
|
25 | 25 |
|
26 | 26 |
|
27 | 27 |
</ul> |
drupal7/sites/all/modules/views/help/ui-crashes.html | ||
---|---|---|
1 | 1 |
<h2>Troubleshooting UI crashes</h2> |
2 | 2 |
|
3 |
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.
|
|
3 |
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.
|
|
4 | 4 |
|
5 | 5 |
To get the most timely and accurate help in the issue queue, please try to gather this information: |
6 | 6 |
|
7 |
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.
|
|
7 |
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.
|
|
8 | 8 |
|
9 | 9 |
|
10 | 10 |
<h3>JSON prepends data with jQuery, causing editing and preview problems.</h3> |
drupal7/sites/all/modules/views/includes/admin.inc | ||
---|---|---|
691 | 691 |
} |
692 | 692 |
|
693 | 693 |
/** |
694 |
* Non-Javascript fallback for updating the add view form.
|
|
694 |
* Non-JavaScript fallback for updating the add view form.
|
|
695 | 695 |
*/ |
696 | 696 |
function views_ui_nojs_submit($form, &$form_state) { |
697 | 697 |
$form_state['rebuild'] = TRUE; |
... | ... | |
1598 | 1598 |
$is_enabled = $display->handler->get_option('enabled'); |
1599 | 1599 |
|
1600 | 1600 |
if (!$is_display_deleted && $is_deletable && !$is_default) { |
1601 |
$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">';
|
|
1601 |
$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">';
|
|
1602 | 1602 |
$suffix = '</ul></div></div>'; |
1603 | 1603 |
$item_element = 'li'; |
1604 | 1604 |
} |
... | ... | |
2987 | 2987 |
* together. |
2988 | 2988 |
*/ |
2989 | 2989 |
function views_ui_ajax_form($js, $key, $view, $display_id = '') { |
2990 |
$args = func_get_args(); |
|
2991 |
// Remove the known args. |
|
2992 |
array_splice($args, 0, 4); |
|
2993 |
|
|
2990 | 2994 |
// Reset the cache of IDs. Drupal rather aggressively prevents id duplication |
2991 | 2995 |
// but this causes it to remember IDs that are no longer even being used. |
2992 | 2996 |
if (isset($_POST['ajax_html_ids'])) { |
... | ... | |
2999 | 3003 |
} |
3000 | 3004 |
|
3001 | 3005 |
views_include('ajax'); |
3002 |
$args = func_get_args(); |
|
3003 |
// Remove the known args. |
|
3004 |
array_splice($args, 0, 4); |
|
3005 | 3006 |
|
3006 | 3007 |
$form_state = views_ui_build_form_state($js, $key, $view, $display_id, $args); |
3007 | 3008 |
// check to see if this is the top form of the stack. If it is, pop |
... | ... | |
3044 | 3045 |
$stack = $view->stack; |
3045 | 3046 |
$top = array_shift($stack); |
3046 | 3047 |
$top[0] = $js; |
3048 |
|
|
3049 |
// Change view into a reference. |
|
3050 |
$stepview = $top[2]; |
|
3051 |
$top[2] = &$stepview; |
|
3052 |
|
|
3047 | 3053 |
$form_state = call_user_func_array('views_ui_build_form_state', $top); |
3048 | 3054 |
$form_state['input'] = array(); |
3049 | 3055 |
$form_state['url'] = url(views_ui_build_form_url($form_state)); |
... | ... | |
3165 | 3171 |
$form['#title'] = t('Displays Reorder'); |
3166 | 3172 |
$form['#section'] = 'reorder'; |
3167 | 3173 |
|
3168 |
// Add javascript settings that will be added via $.extend for tabledragging.
|
|
3174 |
// Add JavaScript settings that will be added via $.extend for tabledragging.
|
|
3169 | 3175 |
$form['#js']['tableDrag']['reorder-displays']['weight'][0] = array( |
3170 | 3176 |
'target' => 'weight', |
3171 | 3177 |
'source' => NULL, |
... | ... | |
3548 | 3554 |
); |
3549 | 3555 |
} |
3550 | 3556 |
|
3551 |
// Add javascript settings that will be added via $.extend for tabledragging.
|
|
3557 |
// Add JavaScript settings that will be added via $.extend for tabledragging.
|
|
3552 | 3558 |
$form['#js']['tableDrag']['arrange']['weight'][0] = array( |
3553 | 3559 |
'target' => 'weight', |
3554 | 3560 |
'source' => NULL, |
... | ... | |
5036 | 5042 |
$form['debug']['views_no_javascript'] = array( |
5037 | 5043 |
'#type' => 'checkbox', |
5038 | 5044 |
'#title' => t('Disable JavaScript with Views'), |
5039 |
'#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."),
|
|
5045 |
'#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."),
|
|
5040 | 5046 |
'#default_value' => variable_get('views_no_javascript', FALSE), |
5041 | 5047 |
); |
5042 | 5048 |
|
drupal7/sites/all/modules/views/includes/ajax.inc | ||
---|---|---|
18 | 18 |
if (isset($_REQUEST['view_name']) && isset($_REQUEST['view_display_id'])) { |
19 | 19 |
$name = $_REQUEST['view_name']; |
20 | 20 |
$display_id = $_REQUEST['view_display_id']; |
21 |
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array();
|
|
22 |
$path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL;
|
|
21 |
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', htmlspecialchars_decode($_REQUEST['view_args'], ENT_QUOTES)) : array();
|
|
22 |
$path = isset($_REQUEST['view_path']) ? htmlspecialchars_decode($_REQUEST['view_path'], ENT_QUOTES) : NULL;
|
|
23 | 23 |
$dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL; |
24 | 24 |
$pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL; |
25 | 25 |
|
... | ... | |
72 | 72 |
// Reuse the same DOM id so it matches that in Drupal.settings. |
73 | 73 |
$view->dom_id = $dom_id; |
74 | 74 |
|
75 |
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, $view->preview($display_id, $args)); |
|
75 |
// Always return HTML with the same DOM ID that was sent by the browser. |
|
76 |
$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)); |
|
76 | 77 |
} |
77 | 78 |
drupal_alter('views_ajax_data', $commands, $view); |
78 | 79 |
return array('#type' => 'ajax', '#commands' => $commands); |
drupal7/sites/all/modules/views/includes/handlers.inc | ||
---|---|---|
278 | 278 |
return $title; |
279 | 279 |
} |
280 | 280 |
$title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title']; |
281 |
if (empty($this->definition['group'])) { |
|
282 |
return $title; |
|
283 |
} |
|
281 | 284 |
return t('!group: !title', array('!group' => $this->definition['group'], '!title' => $title)); |
282 | 285 |
} |
283 | 286 |
|
... | ... | |
418 | 421 |
'#collapsed' => TRUE, |
419 | 422 |
'#weight' => 150, |
420 | 423 |
); |
424 |
|
|
421 | 425 |
// Allow to alter the default values brought into the form. |
422 |
drupal_alter('views_handler_options', $this->options, $view); |
|
426 |
// Triggers hook_views_handler_options_alter(). |
|
427 |
drupal_alter('views_handler_options', $this->options, $this); |
|
423 | 428 |
} |
424 | 429 |
|
425 | 430 |
/** |
... | ... | |
1001 | 1006 |
|
1002 | 1007 |
// Clone the join for each table: |
1003 | 1008 |
$this->handler->table_aliases = array(); |
1004 |
foreach ($this->handler->value as $value) { |
|
1009 |
$values = $this->handler->operator === 'not' ? array($this->handler->value) : $this->handler->value; |
|
1010 |
foreach ($values as $value) { |
|
1005 | 1011 |
$join = $this->get_join(); |
1006 | 1012 |
if ($this->handler->operator == 'and') { |
1007 | 1013 |
$join->type = 'INNER'; |
... | ... | |
1014 | 1020 |
'value' => $value, |
1015 | 1021 |
'numeric' => !empty($this->handler->definition['numeric']), |
1016 | 1022 |
); |
1023 |
if (($this->handler->is_a_group() && is_array($value)) || $this->handler->operator === 'not') { |
|
1024 |
$value = serialize($value); |
|
1025 |
} |
|
1017 | 1026 |
// The table alias needs to be unique to this value across the |
1018 | 1027 |
// multiple times the filter or argument is called by the view. |
1019 | 1028 |
if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) { |
... | ... | |
1028 | 1037 |
$this->handler->table_alias = $alias; |
1029 | 1038 |
} |
1030 | 1039 |
} |
1040 |
else { |
|
1041 |
$this->handler->table_aliases[$value] = $this->handler->view->many_to_one_aliases[$field][$value]; |
|
1042 |
} |
|
1031 | 1043 |
} |
1032 | 1044 |
} |
1033 | 1045 |
return $this->handler->table_alias; |
... | ... | |
1068 | 1080 |
} |
1069 | 1081 |
else { |
1070 | 1082 |
$value = is_array($value) ? array_pop($value) : $value; |
1071 |
$operator = '='; |
|
1083 |
if (is_array($value) && count($value) > 1) { |
|
1084 |
$operator = 'IN'; |
|
1085 |
} |
|
1086 |
else { |
|
1087 |
$operator = '='; |
|
1088 |
} |
|
1072 | 1089 |
} |
1073 | 1090 |
$add_condition = FALSE; |
1074 | 1091 |
} |
... | ... | |
1675 | 1692 |
} |
1676 | 1693 |
|
1677 | 1694 |
if (is_array($info['value'])) { |
1695 |
$value_placeholders = array(); |
|
1696 |
|
|
1678 | 1697 |
// With an array of values, we need multiple placeholders and the |
1679 | 1698 |
// 'IN' operator is implicit. |
1680 | 1699 |
foreach ($info['value'] as $value) { |
1681 | 1700 |
$placeholder_i = $view_query->placeholder('views_join_condition_'); |
1701 |
$value_placeholders[] = $placeholder_i; |
|
1682 | 1702 |
$arguments[$placeholder_i] = $value; |
1683 | 1703 |
} |
1684 | 1704 |
|
1685 | 1705 |
$operator = !empty($info['operator']) ? $info['operator'] : 'IN'; |
1686 |
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
|
|
1706 |
$placeholder = '( ' . implode(', ', $value_placeholders) . ' )';
|
|
1687 | 1707 |
} |
1688 | 1708 |
else { |
1689 | 1709 |
// With a single value, the '=' operator is implicit. |
drupal7/sites/all/modules/views/includes/view.inc | ||
---|---|---|
843 | 843 |
|
844 | 844 |
$argument->set_relationship(); |
845 | 845 |
|
846 |
$arg = isset($this->args[$position]) ? $this->args[$position] : NULL; |
|
846 |
$arg = NULL; |
|
847 |
if (isset($this->args[$position]) && $this->args[$position] !== '') { |
|
848 |
$arg = $this->args[$position]; |
|
849 |
} |
|
850 |
|
|
847 | 851 |
$argument->position = $position; |
848 | 852 |
|
849 | 853 |
if (isset($arg) || $argument->has_default_argument()) { |
... | ... | |
1575 | 1579 |
/** |
1576 | 1580 |
* Override the view's current title. |
1577 | 1581 |
* |
1578 |
* The tokens in the title get's replaced before rendering.
|
|
1582 |
* The tokens in the title get replaced before rendering. |
|
1579 | 1583 |
*/ |
1580 | 1584 |
public function set_title($title) { |
1581 | 1585 |
$this->build_info['title'] = $title; |
... | ... | |
2008 | 2012 |
public function clone_view() { |
2009 | 2013 |
$clone = clone $this; |
2010 | 2014 |
|
2011 |
$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'); |
|
2015 |
$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');
|
|
2012 | 2016 |
foreach ($keys as $key) { |
2013 | 2017 |
if (isset($clone->{$key})) { |
2014 | 2018 |
unset($clone->{$key}); |
drupal7/sites/all/modules/views/js/ajax_view.js | ||
---|---|---|
20 | 20 |
Drupal.views.instances = {}; |
21 | 21 |
|
22 | 22 |
/** |
23 |
* Javascript object for a certain view.
|
|
23 |
* JavaScript object for a certain view.
|
|
24 | 24 |
*/ |
25 | 25 |
Drupal.views.ajaxView = function(settings) { |
26 | 26 |
var selector = '.view-dom-id-' + settings.view_dom_id; |
... | ... | |
69 | 69 |
|
70 | 70 |
// Add the ajax to pagers. |
71 | 71 |
this.$view |
72 |
// Don't attach to nested views. Doing so would attach multiple behaviors |
|
73 |
// to a given element. |
|
74 |
.filter(jQuery.proxy(this.filterNestedViews, this)) |
|
75 | 72 |
.once(jQuery.proxy(this.attachPagerAjax, this)); |
76 | 73 |
|
77 | 74 |
// Add a trigger to update this view specifically. In order to trigger a |
... | ... | |
100 | 97 |
this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); |
101 | 98 |
}; |
102 | 99 |
|
103 |
Drupal.views.ajaxView.prototype.filterNestedViews = function() { |
|
104 |
// If there is at least one parent with a view class, this view |
|
105 |
// is nested (e.g., an attachment). Bail. |
|
106 |
return !this.$view.parents('.view').length; |
|
107 |
}; |
|
108 |
|
|
109 | 100 |
/** |
110 | 101 |
* Attach the ajax behavior to each link. |
111 | 102 |
*/ |
... | ... | |
119 | 110 |
*/ |
120 | 111 |
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { |
121 | 112 |
var $link = $(link); |
113 |
// Don't attach to pagers inside nested views. |
|
114 |
if ($link.closest('.view')[0] !== this.$view[0]) { |
|
115 |
return; |
|
116 |
} |
|
122 | 117 |
var viewData = {}; |
123 | 118 |
var href = $link.attr('href'); |
119 |
|
|
120 |
// Provide a default page if none has been set. This must be done |
|
121 |
// prior to merging with settings to avoid accidentally using the |
|
122 |
// page landed on instead of page 1. |
|
123 |
if (typeof(viewData.page) === 'undefined') { |
|
124 |
viewData.page = 0; |
|
125 |
} |
|
126 |
|
|
124 | 127 |
// Construct an object using the settings defaults and then overriding |
125 | 128 |
// with data specific to the link. |
126 | 129 |
$.extend( |
drupal7/sites/all/modules/views/js/jquery.ui.dialog.patch.js | ||
---|---|---|
10 | 10 |
* @see views_ui.module |
11 | 11 |
* @see js/jquery.ui.dialog.min.js |
12 | 12 |
* |
13 |
* This javascript patch overwrites the $.ui.dialog.overlay.events object to remove
|
|
13 |
* This JavaScript patch overwrites the $.ui.dialog.overlay.events object to remove
|
|
14 | 14 |
* the mousedown, mouseup and click events from the list of events that are bound |
15 | 15 |
* in $.ui.dialog.overlay.create |
16 | 16 |
* |
drupal7/sites/all/modules/views/js/views-admin.js | ||
---|---|---|
981 | 981 |
var difference = 0; |
982 | 982 |
difference += parseInt($scroll.css('padding-top')); |
983 | 983 |
difference += parseInt($scroll.css('padding-bottom')); |
984 |
difference += $('.views-override').outerHeight(true); |
|
985 |
difference += $('.views-messages').outerHeight(true); |
|
986 |
difference += $('#views-ajax-title').outerHeight(true); |
|
987 |
difference += $('.views-add-form-selected').outerHeight(true); |
|
988 |
difference += $('.form-buttons', $modal).outerHeight(true); |
|
984 |
difference += $('.views-override').outerHeight(true) || 0;
|
|
985 |
difference += $('.views-messages').outerHeight(true) || 0;
|
|
986 |
difference += $('#views-ajax-title').outerHeight(true) || 0;
|
|
987 |
difference += $('.views-add-form-selected').outerHeight(true) || 0;
|
|
988 |
difference += $('.form-buttons', $modal).outerHeight(true) || 0;
|
|
989 | 989 |
|
990 | 990 |
height = scrollHeight + difference; |
991 | 991 |
|
drupal7/sites/all/modules/views/js/views-contextual.js | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* @file |
3 |
* Javascript related to contextual links.
|
|
3 |
* JavaScript related to contextual links.
|
|
4 | 4 |
*/ |
5 | 5 |
(function ($) { |
6 | 6 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules