Projet

Général

Profil

Révision 01d522a6

Ajouté par Assos Assos il y a presque 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/webform/components/date.inc
25 25
      'datepicker' => 1,
26 26
      'title_display' => 0,
27 27
      'description' => '',
28
      'description_above' => FALSE,
28 29
      'private' => FALSE,
29 30
      'analysis' => FALSE,
30 31
    ),
drupal7/sites/all/modules/webform/components/email.inc
24 24
      'disabled' => 0,
25 25
      'title_display' => 0,
26 26
      'description' => '',
27
      'description_above' => FALSE,
27 28
      'placeholder' => '',
28 29
      'attributes' => array(),
29 30
      'private' => FALSE,
......
335 336
  return check_plain(empty($value[0]) ? '' : $value[0]);
336 337
}
337 338

  
339
/**
340
 * Implements _webform_action_set_component().
341
 */
342
function _webform_action_set_email($component, &$element, &$form_state, $value) {
343
  $element['#value'] = $value;
344
  form_set_value($element, $value, $form_state);
345
}
338 346

  
339 347
/**
340 348
 * Implements _webform_csv_headers_component().
drupal7/sites/all/modules/webform/components/fieldset.inc
19 19
      'collapsible' => 0,
20 20
      'collapsed' => 0,
21 21
      'description' => '',
22
      'description_above' => FALSE,
22 23
      'private' => FALSE,
23 24
    ),
24 25
  );
drupal7/sites/all/modules/webform/components/file.inc
27 27
      'progress_indicator' => 'throbber',
28 28
      'title_display' => 0,
29 29
      'description' => '',
30
      'description_above' => FALSE,
30 31
      'attributes' => array(),
31 32
      'private' => FALSE,
32 33
      'analysis' => FALSE,
drupal7/sites/all/modules/webform/components/grid.inc
30 30
      'custom_question_keys' => 0,
31 31
      'sticky' => TRUE,
32 32
      'description' => '',
33
      'description_above' => FALSE,
33 34
      'private' => FALSE,
34 35
      'analysis' => TRUE,
35 36
    ),
drupal7/sites/all/modules/webform/components/markup.inc
44 44
    '#type' => 'text_format',
45 45
    '#title' => t('Value'),
46 46
    '#default_value' => $component['value'],
47
    '#description' => t('Markup allows you to enter custom HTML into your form.') . theme('webform_token_help', array('groups' => array('node', 'submission'))),
47
    '#description' => t('Markup allows you to enter custom HTML into your form.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
48 48
    '#weight' => -1,
49 49
    '#format' => $component['extra']['format'],
50 50
    '#element_validate' => array('_webform_edit_markup_validate'),
......
107 107
 *
108 108
 * Required to have access to current form values from $form_state.
109 109
 */
110
function _webform_render_markup_after_build($form_element, &$form_state){
110
function _webform_render_markup_after_build($form_element, &$form_state) {
111 111
  global $user;
112 112
  $node = node_load($form_element['#webform_nid']);
113 113
  $submission = NULL;
114 114

  
115
  // Convert existing submitted data to an in-progress submission.
116
  if (!empty($form_state['storage']['submitted'])) {
117
    module_load_include('inc', 'webform', 'includes/webform.submissions');
118
    $submission = webform_submission_create($node, $user, $form_state, TRUE, $form_element['#webform_submission']);
119
  }
115
  // Convert existing submission data to an in-progress submission.
116
  $form_state_for_submission = $form_state;
117
  $form_state_for_submission['values']['submitted'] = $form_state['#conditional_values'];
118
  module_load_include('inc', 'webform', 'includes/webform.submissions');
119
  $submission = webform_submission_create($node, $user, $form_state_for_submission, TRUE, $form_element['#webform_submission']);
120 120

  
121 121
  // Replace tokens using the current or generated submission.
122 122
  $value = webform_replace_tokens($form_element['#markup'], $node, $submission, NULL, $form_element['#webform_format']);
......
125 125
  $component = $form_element['#webform_component'];
126 126
  if ($node) {
127 127
    $sorter = webform_get_conditional_sorter($node);
128
    // If the form was retrieved from the form cache, the conditionals may not
129
    // have been executed yet.
130
    if (!$sorter->isExecuted()) {
131
      $sorter->executeConditionals(isset($submission) ? $submission->data : array());
132
    }
128 133
    $conditional_value = $sorter->componentMarkup($component['cid'], $component['page_num']);
129 134
    if (isset($conditional_value)) {
130 135
      // Provide original value, should conditional logic no longer set the value.
drupal7/sites/all/modules/webform/components/number.inc
24 24
      'unique' => 0,
25 25
      'title_display' => 0,
26 26
      'description' => '',
27
      'description_above' => FALSE,
27 28
      'attributes' => array(),
28 29
      'private' => FALSE,
29 30
      'analysis' => FALSE,
drupal7/sites/all/modules/webform/components/select.inc
26 26
      'other_text' => t('Other...'),
27 27
      'title_display' => 0,
28 28
      'description' => '',
29
      'description_above' => FALSE,
29 30
      'custom_keys' => FALSE,
30 31
      'options_source' => '',
31 32
      'private' => FALSE,
......
749 750
  // Set the value as an array for multiple select or single value otherwise.
750 751
  if ($element['#type'] == 'checkboxes') {
751 752
    $checkbox_values = $element['#options'];
752
    array_walk($checkbox_values, function(&$value, $key) use ($value) {
753
    array_walk($checkbox_values, function(&$value, $key) use($value) {
753 754
      $value = (int)(strval($key) === $value);
754 755
    });
755 756
  }
......
816 817

  
817 818
  if ($component['extra']['multiple']) {
818 819
    foreach ($options as $key => $item) {
819
      $index = array_search($key, (array) $value);
820
      // Strict search is needed to avoid a key of 0 from matching an empty
821
      // value.
822
      $index = array_search((string)$key, (array)$value, TRUE);
820 823
      if ($index !== FALSE) {
821 824
        if ($export_options['select_format'] == 'separate') {
822 825
          $return[] = 'X';
drupal7/sites/all/modules/webform/components/textarea.inc
23 23
      'resizable' => 1,
24 24
      'disabled' => 0,
25 25
      'description' => '',
26
      'description_above' => FALSE,
26 27
      'placeholder' => '',
27 28
      'attributes' => array(),
28 29
      'private' => FALSE,
drupal7/sites/all/modules/webform/components/textfield.inc
25 25
      'unique' => 0,
26 26
      'title_display' => 0,
27 27
      'description' => '',
28
      'description_above' => FALSE,
28 29
      'placeholder' => '',
29 30
      'attributes' => array(),
30 31
      'private' => FALSE,
drupal7/sites/all/modules/webform/components/time.inc
27 27
      'minuteincrements' => 1,
28 28
      'title_display' => 0,
29 29
      'description' => '',
30
      'description_above' => FALSE,
30 31
      'private' => FALSE,
31 32
      'analysis' => FALSE,
32 33
    ),
drupal7/sites/all/modules/webform/includes/exporters/webform_exporter_delimited.inc
6 6
 */
7 7

  
8 8
class webform_exporter_delimited extends webform_exporter {
9
  public $line_ending;
9 10
  public $delimiter;
10 11

  
11 12
  function __construct($options) {
13
    $this->line_ending = webform_variable_get('webform_csv_line_ending');
12 14
    $this->delimiter = isset($options['delimiter']) ? $options['delimiter'] : ',';
13 15
    // Convert tabs.
14 16
    if ($this->delimiter == '\t') {
......
26 28
      // Remove <script> tags, which mysteriously cause Excel not to import.
27 29
      $data[$key] = preg_replace('!<(/?script.*?)>!', '[$1]', $data[$key]);
28 30
    }
29
    $row = implode($this->delimiter, $data) . "\n";
31
    $row = implode($this->delimiter, $data) . $this->line_ending;
30 32

  
31 33
    @fwrite($file_handle, $row);
32 34
  }
drupal7/sites/all/modules/webform/includes/webform.components.inc
386 386
  drupal_set_title(t('Edit component: @name', array('@name' => $component['name'])), PASS_THROUGH);
387 387

  
388 388
  $form['#node'] = $node;
389
  $form['#attached']['library'][] = array('webform', 'admin');
390 389
  $form['#tree'] = TRUE;
391 390

  
392 391
  // Print the correct field type specification.
......
475 474
    $form['display']['title_display']['#parents'] = array('extra', 'title_display');
476 475
  }
477 476

  
477
  if (webform_component_feature($component['type'], 'description')) {
478
    $form['display']['description_above'] = array(
479
      '#type' => 'checkbox',
480
      '#default_value' => !empty($component['extra']['description_above']),
481
      '#title' => t('Description above field'),
482
      '#description' => t('Place the description above &mdash; rather than below &mdash; the field.'),
483
      '#weight' => 8.5,
484
      '#parents' => array('extra', 'description_above'),
485
    );
486
  }
487

  
478 488
  if (webform_component_feature($component['type'], 'private')) {
479 489
    // May user mark fields as Private?
480 490
    $form['display']['private'] = array(
......
590 600
    unset($form['validation']);
591 601
  }
592 602
  $form = array_merge($form, $additional_form_elements);
603
  // Ensure that the webform admin library is attached, possibly in addition to
604
  // component-specific attachments.
605
  $form['#attached']['library'][] = array('webform', 'admin');
593 606

  
594 607
  // Add the submit button.
595 608
  $form['actions'] = array(
drupal7/sites/all/modules/webform/includes/webform.webformconditionals.inc
322 322
      $this->setMap = $this->requiredMap;
323 323
      $this->markupMap = $this->requiredMap;
324 324

  
325
    } else {
325
    } 
326
    else {
326 327
      array_walk($this->visibilityMap[$page_num], function (&$status) {
327 328
        $status = WebformConditionals::componentShown;
328 329
      });
......
414 415
              if ($action_result && empty($targetLocked[$target])) {
415 416
                if ($components[$target]['type'] == 'markup') {
416 417
                  $this->markupMap[$page_num][$target] = $action['argument'];
417
                } else {
418
                } 
419
                else {
418 420
                  $input_values[$target] = isset($input_values[$target]) && is_array($input_values[$target])
419 421
                                              ? array($action['argument'])
420 422
                                              : $action['argument'];
......
432 434
    return $input_values;
433 435
  }
434 436

  
437
  /**
438
   * Returns whether the conditionals have been executed yet.
439
   */
440
  function isExecuted() {
441
    return (boolean)($this->visibilityMap);
442
  }
443

  
435 444
  /**
436 445
   * Returns whether a given component is always hidden, always shown, or might
437 446
   * be shown depending upon other sources on the same page.
......
449 458
    if (!$this->visibilityMap) {
450 459
      // The conditionals have not yet been executed on a submission.
451 460
      $this->executeConditionals(array(), 0);
452
      watchdog('webform', 'WebformConditionals::componentVisibility called prior to evaluating a submission.', 'error');
461
      watchdog('webform', 'WebformConditionals::componentVisibility called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
453 462
    }
454 463
    return isset($this->visibilityMap[$page_num][$cid]) ? $this->visibilityMap[$page_num][$cid] : self::componentShown;
455 464
  }
......
469 478
    $result = self::componentHidden;
470 479
    if ($page_num == 1 || empty($this->visibilityMap[$page_num])) {
471 480
      $result = self::componentShown;
472
    } elseif (($page_map = $this->pageMap[$page_num]) && $this->componentVisibility(reset($page_map), $page_num)) {
481
    } 
482
    elseif (($page_map = $this->pageMap[$page_num]) && $this->componentVisibility(reset($page_map), $page_num)) {
473 483
      while ($cid = next($page_map)) {
474 484
        if ($this->componentVisibility($cid, $page_num) != self::componentHidden) {
475 485
          $result = self::componentShown;
......
497 507
    if (!$this->requiredMap) {
498 508
      // The conditionals have not yet been executed on a submission.
499 509
      $this->executeConditionals(array(), 0);
500
      watchdog('webform', 'WebformConditionals::componentRequired called prior to evaluating a submission.', 'error');
510
      watchdog('webform', 'WebformConditionals::componentRequired called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
501 511
    }
502 512
    return isset($this->requiredMap[$page_num][$cid]) ? $this->requiredMap[$page_num][$cid] : NULL;
503 513
  }
......
518 528
    if (!$this->setMap) {
519 529
      // The conditionals have not yet been executed on a submission.
520 530
      $this->executeConditionals(array(), 0);
521
      watchdog('webform', 'WebformConditionals::componentSet called prior to evaluating a submission.', 'error');
531
      watchdog('webform', 'WebformConditionals::componentSet called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
522 532
    }
523 533
    return isset($this->setMap[$page_num][$cid]) ? $this->setMap[$page_num][$cid] : NULL;
524 534
  }
......
539 549
    if (!$this->markupMap) {
540 550
      // The conditionals have not yet been executed on a submission.
541 551
      $this->executeConditionals(array(), 0);
542
      watchdog('webform', 'WebformConditionals::componentMarkup called prior to evaluating a submission.', 'error');
552
      watchdog('webform', 'WebformConditionals::componentMarkup called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
543 553
    }
544 554
    return isset($this->markupMap[$page_num][$cid]) ? $this->markupMap[$page_num][$cid] : NULL;
545 555
  }
drupal7/sites/all/modules/webform/js/webform.js
526 526
  };
527 527

  
528 528
  /**
529
   * Utility function to calculate a millisecond timestamp from a time field.
529
   * Utility function to calculate a second-based timestamp from a time field.
530 530
   */
531 531
  Drupal.webform.dateValue = function (element, existingValue) {
532 532
    var value = false;
drupal7/sites/all/modules/webform/webform.api.php
835 835
      'optrand' => 0,
836 836
      'qrand' => 0,
837 837
      'description' => '',
838
      'description_above' => FALSE,
838 839
      'private' => FALSE,
839 840
      'analysis' => TRUE,
840 841
    ),
......
1356 1357
  }
1357 1358
}
1358 1359

  
1360
/**
1361
 * Define a list of webform exporters.
1362
 *
1363
 * @return array
1364
 *   A list of the available exporters provided by the module.
1365
 *
1366
 * @see webform_webform_exporters()
1367
 */
1368
function hook_webform_exporters() {
1369
  $exporters = array(
1370
    'webform_exporter_custom' => array(
1371
      'title' => t('Webform exporter name'),
1372
      'description' => t('The description for this exporter.'),
1373
      'handler' => 'webform_exporter_custom',
1374
      'file' => drupal_get_path('module', 'yourmodule') . '/includes/webform_exporter_custom.inc',
1375
      'weight' => 10,
1376
    ),
1377
  );
1378

  
1379
  return $exporters;
1380
}
1381

  
1382
/**
1383
 * Modify the list of webform exporters definitions.
1384
 *
1385
 * @param  array &$exporters
1386
 *   A list of all available webform exporters.
1387
 */
1388
function hook_webform_exporters_alter(&$exporters) {
1389
  $exporters['excel']['handler'] = 'customized_excel_exporter';
1390
  $exporters['excel']['file'] = drupal_get_path('module', 'yourmodule') . '/includes/customized_excel_exporter.inc';
1391
}
1392

  
1359 1393
/**
1360 1394
 * @}
1361 1395
 */
drupal7/sites/all/modules/webform/webform.info
40 40
files[] = tests/submission.test
41 41
files[] = tests/webform.test
42 42

  
43
; Information added by Drupal.org packaging script on 2015-07-16
44
version = "7.x-4.10"
43
; Information added by Drupal.org packaging script on 2015-09-22
44
version = "7.x-4.11"
45 45
core = "7.x"
46 46
project = "webform"
47
datestamp = "1437076446"
47
datestamp = "1442953145"
48 48

  
drupal7/sites/all/modules/webform/webform.install
787 787
  variable_del('webform_date_type');
788 788
  variable_del('webform_export_format');
789 789
  variable_del('webform_csv_delimiter');
790
  variable_del('webform_csv_line_ending');
790 791
  variable_del('webform_export_wordwrap');
791 792
  variable_del('webform_excel_legacy_exporter');
792 793
  variable_del('webform_progressbar_style');
drupal7/sites/all/modules/webform/webform.module
616 616

  
617 617
  $token_access = $submission && isset($_GET['token']) && $_GET['token'] == webform_get_submission_access_token($submission);
618 618

  
619
  // If access is granted via a token, then allow subsequent submission access
620
  // for anonymous users.
621
  if (!$user->uid && $token_access) {
622
    $_SESSION['webform_submission'][$submission->sid] = $node->nid;
623
  }
624

  
619 625
  $general_access = $access_all || $access_own_submission || $access_node_submissions || $token_access;
620 626

  
621 627
  // Disable the page cache for anonymous users in this access callback,
......
2259 2265
        '#node' => $node,
2260 2266
        '#sid' => $_SESSION['webform_confirmation'][$nid]['sid'],
2261 2267
      );
2262
    } elseif (strlen(trim(strip_tags($node->webform['confirmation'])))) {
2268
    } 
2269
    elseif (strlen(trim(strip_tags($node->webform['confirmation'])))) {
2263 2270
      // Display confirmation link drupal status messages, but in the block.
2264 2271
      $message = webform_replace_tokens($node->webform['confirmation'],
2265 2272
                                        $node,
......
2407 2414
  form_load_include($form_state, 'inc', 'webform', 'includes/webform.components');
2408 2415
  form_load_include($form_state, 'inc', 'webform', 'includes/webform.submissions');
2409 2416

  
2417
  // For ajax requests, $form_state['values']['details'] is missing. Restore
2418
  // from storage, if available, for multi-page forms.
2419
  if (empty($form_state['values']['details']) && !empty($form_state['storage']['details'])) {
2420
    $form_state['values']['details'] = $form_state['storage']['details'];
2421
  }
2422

  
2410 2423
  // If in a multi-step form, a submission ID may be specified in form state.
2411 2424
  // Load this submission. This allows anonymous users to use auto-save.
2412 2425
  if (empty($submission) && !empty($form_state['values']['details']['sid'])) {
......
2513 2526
    // Allow values from other pages to be sent to browser for conditionals.
2514 2527
    $form['#conditional_values'] = $input_values;
2515 2528

  
2529
    // Allow components access to most up-to-date values.
2530
    $form_state['#conditional_values'] = $input_values;
2531

  
2516 2532
    // For resuming a previous draft, find the next page after the last
2517 2533
    // validated page.
2518 2534
    if (!isset($form_state['storage']['page_num']) && $submission && $submission->is_draft && $submission->highest_valid_page) {
......
2529 2545
        // Force a preview to avert an unintended submission via Next.
2530 2546
        $form_state['webform']['preview'] = TRUE;
2531 2547
        $form_state['webform']['page_count']++;
2532
        // The form hasn't been submitted (ever) and the preview code will
2533
        // expect $form_state['values']['submitted'] to be set from a previous
2534
        // submission, so provide these values here.
2535
        $form_state['values']['submitted'] = $input_values;
2536 2548
      }
2549
      // The form hasn't been submitted (ever) and the preview code will
2550
      // expect $form_state['values']['submitted'] to be set from a previous
2551
      // submission, so provide these values here.
2552
      $form_state['values']['submitted'] = $input_values;
2537 2553
      $form_state['storage']['submitted'] = $input_values;
2538 2554
    }
2539 2555

  
......
3238 3254
  // exist, but webform_get_submission() will not find the draft. So, make a new
3239 3255
  // submission.
3240 3256
  if ($sid && $submission = webform_get_submission($node->webform['nid'], $sid)) {
3257
    // Store original data on object for use in update hook.
3258
    $submission->original = clone $submission;
3259

  
3241 3260
    // Merge with new submission data. The + operator maintains numeric keys.
3242 3261
    // This maintains existing data with just-submitted data when a user resumes
3243 3262
    // a submission previously saved as a draft.
......
3279 3298
    $form_state['values']['details']['sid'] = $sid = webform_submission_insert($node, $submission);
3280 3299
    $form_state['values']['details']['is_new'] = TRUE;
3281 3300

  
3301
    // Save the new details in storage. When ajax calls for file upload/remove,
3302
    // $form_state['values']['details'] is missing. This allows the proper
3303
    // submission to be retrieved in webform_client_form. See #2562703.
3304
    $form_state['storage']['details'] = $form_state['values']['details'];
3305

  
3282 3306
    // Set a cookie including the server's submission time. The cookie expires
3283 3307
    // in the length of the interval plus a day to compensate for timezones.
3284 3308
    $tracking_mode = webform_variable_get('webform_tracking_mode');
......
3292 3316
    // Save session information about this submission for anonymous users,
3293 3317
    // allowing them to access or edit their submissions.
3294 3318
    if (!$user->uid && user_access('access own webform submissions')) {
3295
      $_SESSION['webform_submission'][$form_state['values']['details']['sid']] = $node->nid;
3319
      $_SESSION['webform_submission'][$sid] = $node->nid;
3296 3320
    }
3297 3321
  }
3298 3322
  else {
......
3603 3627
  $prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . webform_filter_xss($element['#field_prefix']) . '</span> ' : '';
3604 3628
  $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . webform_filter_xss($element['#field_suffix']) . '</span>' : '';
3605 3629

  
3630
  // Generate description for above or below the field.
3631
  $above = !empty($element['#webform_component']['extra']['description_above']);
3632
  $description = array(
3633
    FALSE => '',
3634
    TRUE => !empty($element['#description']) ? ' <div class="description">' . $element['#description'] . "</div>\n" : '',
3635
  );
3636

  
3606 3637
  switch ($element['#title_display']) {
3607 3638
    case 'inline':
3639
      $output .= $description[$above];
3640
      $description[$above] = '';
3641
      // FALL THRU.
3608 3642
    case 'before':
3609 3643
    case 'invisible':
3610 3644
      $output .= ' ' . theme('form_element_label', $variables);
3611
      $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
3645
      $output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix . "\n";
3612 3646
      break;
3613 3647

  
3614 3648
    case 'after':
3615
      $output .= ' ' . $prefix . $element['#children'] . $suffix;
3649
      $output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix;
3616 3650
      $output .= ' ' . theme('form_element_label', $variables) . "\n";
3617 3651
      break;
3618 3652

  
3619 3653
    case 'none':
3620 3654
    case 'attribute':
3621 3655
      // Output no label and no required marker, only the children.
3622
      $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
3656
      $output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix . "\n";
3623 3657
      break;
3624 3658
  }
3625 3659

  
3626
  if (!empty($element['#description'])) {
3627
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
3628
  }
3629

  
3660
  $output .= $description[!$above];
3630 3661
  $output .= "</div>\n";
3631 3662

  
3632 3663
  return $output;
......
4167 4198
    case 'webform_csv_delimiter':
4168 4199
      $result = variable_get('webform_csv_delimiter', '\t');
4169 4200
      break;
4201
    case 'webform_csv_line_ending':
4202
      $result = variable_get('webform_csv_line_ending', "\n");
4203
      break;
4170 4204
    case 'webform_export_wordwrap':
4171 4205
      $result = variable_get('webform_export_wordwrap', 0);
4172 4206
      break;
......
4315 4349
      if (webform_component_implements($component['type'], 'options')) {
4316 4350
        $options = webform_component_invoke($component['type'], 'options', $component);
4317 4351
        foreach ($name as &$one_name) {
4318
          $name = isset($options[$one_name]) ? $options[$one_name] : $name;
4352
          $one_name = isset($options[$one_name]) ? $options[$one_name] : $one_name;
4319 4353
        }
4320 4354
        unset($one_name); // Drop PHP reference.
4321 4355
      }

Formats disponibles : Unified diff