Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/includes/ajax.inc
25 25

  
26 26
    $commands = array();
27 27

  
28
    // Remove all of this stuff from $_GET so it doesn't end up in pagers and tablesort URLs.
28
    // Remove all of this stuff from $_GET so it doesn't end up in pagers and
29
    // tablesort URLs.
29 30
    foreach (array('view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', 'ajax_html_ids', 'ajax_page_state') as $key) {
30 31
      if (isset($_GET[$key])) {
31 32
        unset($_GET[$key]);
......
46 47
        $_GET['q'] = $path;
47 48
      }
48 49

  
49
      // If page parameter is in the $_POST exclude it from $_GET,
50
      // otherwise support views_ajax requests using $_GET.
50
      // If page parameter is in the $_POST exclude it from $_GET, otherwise
51
      // support views_ajax requests using $_GET.
51 52
      $exclude = isset($_POST['page']) ? array('page') : array();
52
      // Add all $_POST data to $_GET as many things,
53
      // such as tablesorts, exposed filters and paging assume $_GET.
53
      // Add all $_POST data to $_GET as many things, such as tablesorts,
54
      // exposed filters and paging assume $_GET.
54 55
      $_GET = $_POST + drupal_get_query_parameters($_GET, $exclude);
55 56

  
56 57
      // Overwrite the destination.
......
81 82
/**
82 83
 * Creates a Drupal AJAX 'viewsSetForm' command.
83 84
 *
84
 * @param $output
85
 * @param string $output
85 86
 *   The form to display in the modal.
86
 * @param $title
87
 * @param string $title
87 88
 *   The title.
88
 * @param $url
89
 * @param string $url
89 90
 *   An optional URL.
90 91
 *
91
 * @return
92
 * @return array
92 93
 *   An array suitable for use with the ajax_render() function.
93 94
 */
94 95
function views_ajax_command_set_form($output, $title, $url = NULL) {
......
106 107
/**
107 108
 * Creates a Drupal AJAX 'viewsDismissForm' command.
108 109
 *
109
 * @return
110
 * @return array
110 111
 *   An array suitable for use with the ajax_render() function.
111 112
 */
112 113
function views_ajax_command_dismiss_form() {
......
119 120
/**
120 121
 * Creates a Drupal AJAX 'viewsHilite' command.
121 122
 *
122
 * @param $selector
123
 *   The selector to highlight
123
 * @param string $selector
124
 *   The selector to highlight.
124 125
 *
125 126
 * @return
126 127
 *   An array suitable for use with the ajax_render() function.
......
135 136
/**
136 137
 * Creates a Drupal AJAX 'addTab' command.
137 138
 *
138
 * @param $id
139
 * @param string $id
139 140
 *   The DOM ID.
140
 * @param $title
141
 * @param string $title
141 142
 *   The title.
142
 * @param $body
143
 * @param string $body
143 144
 *   The body.
144 145
 *
145
 * @return
146
 * @return array
146 147
 *   An array suitable for use with the ajax_render() function.
147 148
 */
148 149
function views_ajax_command_add_tab($id, $title, $body) {
......
158 159
/**
159 160
 * Scroll to top of the current view.
160 161
 *
161
 * @return
162
 * @return array
162 163
 *   An array suitable for use with the ajax_render() function.
163 164
 */
164 165
function views_ajax_command_scroll_top($selector) {
......
175 176
 * @param bool $changed
176 177
 *   Whether of not the view has changed.
177 178
 *
178
 * @return
179
 * @return array
179 180
 *   An array suitable for use with the ajax_render() function.
180 181
 */
181 182
function views_ajax_command_show_buttons($changed) {
......
189 190
/**
190 191
 * Trigger the Views live preview.
191 192
 *
192
 * @return
193
 * @return array
193 194
 *   An array suitable for use with the ajax_render() function.
194 195
 */
195 196
function views_ajax_command_trigger_preview() {
......
202 203
/**
203 204
 * Replace the page title.
204 205
 *
205
 * @return
206
 * @return array
206 207
 *   An array suitable for use with the ajax_render() function.
207 208
 */
208 209
function views_ajax_command_replace_title($title) {
......
216 217

  
217 218
/**
218 219
 * Return an AJAX error.
220
 *
221
 * @param string $message
222
 *   The message to display.
223
 *
224
 * @return array
225
 *   An array suitable for use with the ajax_render() function.
219 226
 */
220 227
function views_ajax_error($message) {
221 228
  $commands = array();
......
225 232

  
226 233
/**
227 234
 * Wrapper around drupal_build_form to handle some AJAX stuff automatically.
235
 *
228 236
 * This makes some assumptions about the client.
229 237
 */
230 238
function views_ajax_form_wrapper($form_id, &$form_state) {
......
243 251
  $form = drupal_build_form($form_id, $form_state);
244 252
  $output = drupal_render($form);
245 253

  
246
  // These forms have the title built in, so set the title here:
254
  // These forms have the title built in, so set the title here.
247 255
  if (empty($form_state['ajax']) && !empty($form_state['title'])) {
248 256
    drupal_set_title($form_state['title']);
249 257
    drupal_add_css(drupal_get_path('module', 'views_ui') . '/css/views-admin.css');
250 258
  }
251 259

  
252 260
  if (!empty($form_state['ajax']) && (empty($form_state['executed']) || !empty($form_state['rerender']))) {
253
    // If the form didn't execute and we're using ajax, build up a
254
    // Ajax command list to execute.
261
    // If the form didn't execute and we're using ajax, build up a AJAX command
262
    // list to execute.
255 263
    $commands = array();
256 264

  
257 265
    $display = '';
......
279 287
    return $commands;
280 288
  }
281 289

  
282
  // These forms have the title built in, so set the title here:
290
  // These forms have the title built in, so set the title here.
283 291
  if (empty($form_state['ajax']) && !empty($form_state['title'])) {
284 292
    drupal_set_title($form_state['title']);
285 293
  }
......
289 297

  
290 298

  
291 299
/**
292
 * Page callback for views user autocomplete
300
 * Page callback for views user autocomplete.
293 301
 */
294 302
function views_ajax_autocomplete_user($string = '') {
295
  // The user enters a comma-separated list of user name. We only autocomplete the last name.
303
  // The user enters a comma-separated list of user name. We only autocomplete
304
  // the last name.
296 305
  $array = drupal_explode_tags($string);
297 306

  
298
  // Fetch last name
307
  // Fetch last name.
299 308
  $last_string = trim(array_pop($array));
300 309
  $matches = array();
301 310
  if ($last_string != '') {
......
328 337
/**
329 338
 * Page callback for views taxonomy autocomplete.
330 339
 *
331
 * @param $vid
340
 * @param int $vid
332 341
 *   The vocabulary id of the tags which should be returned.
333
 *
334
 * @param $tags_typed
342
 * @param string $tags_typed
335 343
 *   The typed string of the user.
336 344
 *
337 345
 * @see taxonomy_autocomplete()
338 346
 */
339 347
function views_ajax_autocomplete_taxonomy($vid, $tags_typed = '') {
340
  // The user enters a comma-separated list of tags. We only autocomplete the last tag.
348
  // The user enters a comma-separated list of tags. We only autocomplete the
349
  // last tag.
341 350
  $tags_typed = drupal_explode_tags($tags_typed);
342 351
  $tag_last = drupal_strtolower(array_pop($tags_typed));
343 352

  

Formats disponibles : Unified diff