Révision 8d02775b
Ajouté par Assos Assos il y a environ 4 ans
drupal7/sites/all/modules/webform/components/email.inc | ||
---|---|---|
155 | 155 |
'#attributes' => $component['extra']['attributes'], |
156 | 156 |
'#element_validate' => array('_webform_validate_email'), |
157 | 157 |
'#theme_wrappers' => array('webform_element'), |
158 |
'#translatable' => array('title', 'description'), |
|
158 |
'#translatable' => array('title', 'description', 'placeholder'),
|
|
159 | 159 |
); |
160 | 160 |
|
161 | 161 |
if ($component['required']) { |
... | ... | |
275 | 275 |
'#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'), |
276 | 276 |
'#format' => $format, |
277 | 277 |
'#value' => isset($value[0]) ? $value[0] : '', |
278 |
'#translatable' => array('title'), |
|
278 |
'#translatable' => array('title', 'placeholder'),
|
|
279 | 279 |
); |
280 | 280 |
} |
281 | 281 |
|
drupal7/sites/all/modules/webform/components/grid.inc | ||
---|---|---|
764 | 764 |
*/ |
765 | 765 |
function _webform_grid_header(array $element, $right_titles) { |
766 | 766 |
$titles = explode('|', $element['#title'], 2); |
767 |
$title_left = $titles[0]; |
|
767 | 768 |
$header = array( |
768 | 769 |
array( |
769 |
'data' => _webform_grid_header_title($element, $titles[0]),
|
|
770 |
'data' => _webform_grid_header_title($element, $title_left),
|
|
770 | 771 |
'class' => array('webform-grid-question'), |
772 |
'scope' => 'col', |
|
771 | 773 |
), |
772 | 774 |
); |
773 | 775 |
foreach ($element['#grid_options'] as $option) { |
... | ... | |
778 | 780 |
); |
779 | 781 |
} |
780 | 782 |
if ($right_titles) { |
783 |
$title_right = isset($titles[1]) ? $titles[1] : $title_left; |
|
781 | 784 |
$header[] = array( |
782 |
'data' => _webform_grid_header_title($element, isset($titles[1]) ? $titles[1] : ''),
|
|
785 |
'data' => _webform_grid_header_title($element, $title_right),
|
|
783 | 786 |
'class' => array('webform-grid-question'), |
787 |
'scope' => 'col', |
|
784 | 788 |
); |
785 | 789 |
} |
786 | 790 |
return $header; |
... | ... | |
792 | 796 |
function _webform_grid_header_title($element, $title) { |
793 | 797 |
$header_title = ''; |
794 | 798 |
if ($element['#title_display'] == 'internal') { |
795 |
$variables = array('element' => $element); |
|
796 |
$variables['element']['#title_display'] = 'before'; |
|
797 |
$variables['element']['#title'] = $title; |
|
798 |
$header_title = theme('form_element_label', $variables); |
|
799 |
$header_title = $title; |
|
799 | 800 |
} |
800 | 801 |
return $header_title; |
801 | 802 |
} |
drupal7/sites/all/modules/webform/components/number.inc | ||
---|---|---|
305 | 305 |
'#point' => $component['extra']['point'], |
306 | 306 |
'#separator' => $component['extra']['separator'], |
307 | 307 |
'#decimals' => $component['extra']['decimals'], |
308 |
'#translatable' => array('title', 'description', 'field_prefix', 'field_suffix'), |
|
308 |
'#translatable' => array('title', 'description', 'field_prefix', 'field_suffix', 'placeholder'),
|
|
309 | 309 |
); |
310 | 310 |
|
311 | 311 |
if ($component['required']) { |
... | ... | |
404 | 404 |
'#field_suffix' => $empty ? '' : $component['extra']['field_suffix'], |
405 | 405 |
'#format' => $format, |
406 | 406 |
'#value' => $empty ? '' : _webform_number_format($component, $value[0]), |
407 |
'#translatable' => array('title'), |
|
407 |
'#translatable' => array('title', 'placeholder'),
|
|
408 | 408 |
); |
409 | 409 |
} |
410 | 410 |
|
drupal7/sites/all/modules/webform/components/textarea.inc | ||
---|---|---|
123 | 123 |
// MUST be FALSE to disable. |
124 | 124 |
'#resizable' => (bool) $component['extra']['resizable'], |
125 | 125 |
'#theme_wrappers' => array('webform_element'), |
126 |
'#translatable' => array('title', 'description'), |
|
126 |
'#translatable' => array('title', 'description', 'placeholder'),
|
|
127 | 127 |
); |
128 | 128 |
|
129 | 129 |
if ($component['required']) { |
... | ... | |
162 | 162 |
'#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'), |
163 | 163 |
'#format' => $format, |
164 | 164 |
'#value' => isset($value[0]) ? $value[0] : '', |
165 |
'#translatable' => array('title'), |
|
165 |
'#translatable' => array('title', 'placeholder'),
|
|
166 | 166 |
); |
167 | 167 |
} |
168 | 168 |
|
drupal7/sites/all/modules/webform/components/textfield.inc | ||
---|---|---|
163 | 163 |
'description', |
164 | 164 |
'field_prefix', |
165 | 165 |
'field_suffix', |
166 |
'placeholder', |
|
166 | 167 |
), |
167 | 168 |
); |
168 | 169 |
|
... | ... | |
220 | 221 |
'#field_suffix' => $component['extra']['field_suffix'], |
221 | 222 |
'#format' => $format, |
222 | 223 |
'#value' => isset($value[0]) ? $value[0] : '', |
223 |
'#translatable' => array('title', 'field_prefix', 'field_suffix'), |
|
224 |
'#translatable' => array('title', 'field_prefix', 'field_suffix', 'placeholder'),
|
|
224 | 225 |
); |
225 | 226 |
} |
226 | 227 |
|
drupal7/sites/all/modules/webform/includes/webform.components.inc | ||
---|---|---|
453 | 453 |
'#weight' => 8, |
454 | 454 |
); |
455 | 455 |
if (webform_component_feature($component['type'], 'title_display')) { |
456 |
if (webform_component_feature($component['type'], 'title_inline')) { |
|
456 |
$inline_option = webform_component_feature($component['type'], 'title_inline') ? array('inline' => t('Inline')) : array(); |
|
457 |
$internal_option = webform_component_feature($component['type'], 'title_internal') ? array('internal' => t('Inside the component')) : array(); |
|
458 |
if ($inline_option || $internal_option) { |
|
457 | 459 |
$form['display']['title_display'] = array( |
458 | 460 |
'#type' => 'select', |
459 | 461 |
'#title' => t('Label display'), |
460 | 462 |
'#default_value' => !empty($component['extra']['title_display']) ? $component['extra']['title_display'] : 'before', |
461 |
'#options' => array( |
|
462 |
'before' => t('Above'), |
|
463 |
'inline' => t('Inline'), |
|
464 |
'none' => t('None'), |
|
465 |
), |
|
463 |
'#options' => array('before' => t('Above')) + |
|
464 |
$inline_option + |
|
465 |
$internal_option + |
|
466 |
array('none' => t('None')), |
|
466 | 467 |
'#description' => t("Determines the placement of the component's label."), |
467 | 468 |
); |
468 | 469 |
} |
... | ... | |
998 | 999 |
'title' => TRUE, |
999 | 1000 |
'title_display' => TRUE, |
1000 | 1001 |
'title_inline' => TRUE, |
1002 |
'title_internal' => FALSE, |
|
1001 | 1003 |
'conditional' => TRUE, |
1002 | 1004 |
'conditional_action_set' => FALSE, |
1003 | 1005 |
'spam_analysis' => FALSE, |
drupal7/sites/all/modules/webform/includes/webform.conditionals.inc | ||
---|---|---|
233 | 233 |
} |
234 | 234 |
} |
235 | 235 |
foreach ($conditional['rules'] as $rule_key => $rule) { |
236 |
if (!is_numeric($rule_key)) { |
|
237 |
continue; |
|
238 |
} |
|
239 |
$source_cid = isset($rule['source']['#value']) ? $rule['source']['#value'] : NULL; |
|
236 | 240 |
// Validate component rules, but not conditional_start/end rules. |
237 |
if (is_numeric($rule_key) && $rule['source_type']['#value'] == 'component' && isset($targets[$rule['source']['#value']])) {
|
|
241 |
if ($source_cid && $rule['source_type']['#value'] == 'component' && isset($targets[$source_cid])) {
|
|
238 | 242 |
form_set_error('conditionals][' . $conditional_key . '][rules][' . $rule_key . '][source', |
239 | 243 |
t('The subject of the conditional cannot be the same as the component that is changed (%target).', |
240 |
array('%target' => $components[$rule['source']['#value']]['name']))); |
|
244 |
array('%target' => $components[$source_cid]['name']))); |
|
245 |
} |
|
246 |
if ($source_cid && $components[$source_cid]['type'] === 'date' && strtotime($rule['value']['#value']) === FALSE) { |
|
247 |
form_set_error('conditionals][' . $conditional_key . '][rules][' . $rule_key . '][value', t('The conditional comparison value must be a valid date.')); |
|
241 | 248 |
} |
242 | 249 |
} |
243 | 250 |
} |
drupal7/sites/all/modules/webform/includes/webform.report.inc | ||
---|---|---|
1921 | 1921 |
*/ |
1922 | 1922 |
function webform_download_sids_query($nid, array $range_options, $uid = NULL) { |
1923 | 1923 |
$query = db_select('webform_submissions', 'ws') |
1924 |
->condition('nid', $nid) |
|
1924 |
->condition('ws.nid', $nid)
|
|
1925 | 1925 |
->addTag('webform_download_sids'); |
1926 | 1926 |
|
1927 | 1927 |
switch ($range_options['range_type']) { |
... | ... | |
1987 | 1987 |
if (isset($range_options['batch_number']) && !empty($range_options['batch_size'])) { |
1988 | 1988 |
$query->range($range_options['batch_number'] * $range_options['batch_size'], $range_options['batch_size']); |
1989 | 1989 |
} |
1990 |
|
|
1991 |
drupal_alter('webform_download_sids_query', $query); |
|
1992 |
|
|
1990 | 1993 |
return $query; |
1991 | 1994 |
} |
1992 | 1995 |
|
drupal7/sites/all/modules/webform/includes/webform.submissions.inc | ||
---|---|---|
231 | 231 |
* @param $emails |
232 | 232 |
* (optional) An array of specific e-mail settings to be used. If omitted, all |
233 | 233 |
* e-mails in $node->webform['emails'] will be sent. |
234 |
* @param bool $send_disabled |
|
235 |
* (optional) When TRUE, send all emails, even those that are disabled. |
|
234 | 236 |
* |
235 | 237 |
* @return int |
236 | 238 |
* Number of mail sent. |
237 | 239 |
*/ |
238 |
function webform_submission_send_mail($node, $submission, $emails = NULL) { |
|
240 |
function webform_submission_send_mail($node, $submission, $emails = NULL, $send_disabled = FALSE) {
|
|
239 | 241 |
// Get the list of e-mails we'll be sending. |
240 | 242 |
$emails = isset($emails) ? $emails : $node->webform['emails']; |
241 | 243 |
|
242 | 244 |
// Create a themed message for mailing. |
243 | 245 |
$send_count = 0; |
244 | 246 |
foreach ($emails as $eid => $email) { |
247 |
if (!$send_disabled && !$email['status']) { |
|
248 |
continue; |
|
249 |
} |
|
245 | 250 |
$mail = _webform_submission_prepare_mail($node, $submission, $email); |
246 | 251 |
if (!$mail) { |
247 | 252 |
continue; |
... | ... | |
280 | 285 |
function _webform_submission_prepare_mail($node, $submission, &$email) { |
281 | 286 |
global $user; |
282 | 287 |
|
283 |
// Don't process disabled emails. |
|
284 |
if (!$email['status']) { |
|
285 |
return; |
|
286 |
} |
|
287 |
|
|
288 | 288 |
// Set the HTML property based on availablity of MIME Mail. |
289 | 289 |
$email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable')); |
290 | 290 |
|
... | ... | |
331 | 331 |
'!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'], |
332 | 332 |
'!site_name' => $default_from_name, |
333 | 333 |
)); |
334 |
$from_name = str_replace('"', "'", $from_name); |
|
334 | 335 |
$from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name))); |
335 | 336 |
$email['from'] = '"' . $from_name . '" <' . $email['from'] . '>'; |
336 | 337 |
} |
... | ... | |
617 | 618 |
$emails[] = $form['#node']->webform['emails'][$eid]; |
618 | 619 |
} |
619 | 620 |
} |
620 |
$sent_count = webform_submission_send_mail($node, $submission, $emails); |
|
621 |
$sent_count = webform_submission_send_mail($node, $submission, $emails, TRUE);
|
|
621 | 622 |
if ($sent_count) { |
622 | 623 |
drupal_set_message(format_plural($sent_count, |
623 | 624 |
'Successfully re-sent submission #@sid to 1 recipient.', |
drupal7/sites/all/modules/webform/tests/WebformComponentsTestCase.test | ||
---|---|---|
189 | 189 |
$for = $this->xpath("//*[@id=':id']", array(':id' => $label['for'])); |
190 | 190 |
$this->assertTrue($for, 'Label with @for "' . $label['for'] . '" points to an element.'); |
191 | 191 |
} |
192 |
|
|
193 |
// Test grid headers. |
|
194 |
$grid_headers = $this->xpath('//th[@class="webform-grid-question"]'); |
|
195 |
$this->assertIdentical(count($grid_headers), 3, 'There are three table headers with class "webform-grid-question".'); |
|
196 |
$grid_headers = $this->xpath('//th[@class="webform-grid-question"]/text()'); |
|
197 |
$this->assertIdentical(count($grid_headers), 2, 'There are two non-empty table headers with class "webform-grid-question".'); |
|
198 |
$this->assertIdentical((string) $grid_headers[0], 'Grid Keyed', 'The value of the left non-empty header is "Grid Keyed".'); |
|
199 |
$this->assertIdentical((string) $grid_headers[1], 'Grid Keyed', 'The value of the right non-empty header is the same as the left.'); |
|
192 | 200 |
} |
193 | 201 |
|
194 | 202 |
} |
drupal7/sites/all/modules/webform/tests/WebformSubmissionTestCase.test | ||
---|---|---|
39 | 39 |
|
40 | 40 |
// Counting the anonymous submission doesn't work because |
41 | 41 |
// $_SESSION['webform_submission'] is not populated in testing. |
42 |
|
|
43 |
// Test _webform_submission_prepare_mail(). |
|
44 |
$node = node_load($this->webformForm()->nid); |
|
45 |
$submission = webform_get_submissions($node->nid); |
|
46 |
$submission = array_pop($submission); |
|
47 |
$email = array( |
|
48 |
'status' => TRUE, |
|
49 |
'html' => FALSE, |
|
50 |
'template' => 'default', |
|
51 |
'from_address' => 'Test From', |
|
52 |
'from_name' => 'from@example.com', |
|
53 |
'subject' => 'Test Subject', |
|
54 |
'email' => 'to@example.com', |
|
55 |
); |
|
56 |
variable_set('webform_email_replyto', TRUE); |
|
57 |
variable_set('webform_email_address_format', 'long'); |
|
58 |
variable_set('webform_default_from_name', 'Default "From" Name'); |
|
59 |
variable_set('webform_default_from_address', 'default-from@example.com'); |
|
60 |
$prepared_email = _webform_submission_prepare_mail($node, $submission, $email); |
|
61 |
$this->assertIdentical($prepared_email['mail_params']['email']['from'], '"from@example.com via Default \'From\' Name" <default-from@example.com>', 'From address is correctly set in _webform_submission_prepare_mail().'); |
|
42 | 62 |
} |
43 | 63 |
|
44 | 64 |
/** |
drupal7/sites/all/modules/webform/tests/WebformTestCase.test | ||
---|---|---|
185 | 185 |
'value' => '', |
186 | 186 |
'extra' => array( |
187 | 187 |
// Left side. |
188 |
'questions' => "one|What's your option?\ntwo|Agåin?\nthree|One more time!", |
|
188 |
'questions' => "one|What's your option?\ntwo|Agåin?|Again, right text\nthree|One more time!",
|
|
189 | 189 |
// Top. |
190 | 190 |
'options' => "one|Option one\ntwo|Option 2\nthree| Three is me", |
191 |
'title_display' => 'internal', |
|
191 | 192 |
), |
192 | 193 |
'required' => '0', |
193 | 194 |
'pid' => '0', |
drupal7/sites/all/modules/webform/webform.api.php | ||
---|---|---|
820 | 820 |
} |
821 | 821 |
} |
822 | 822 |
|
823 |
/** |
|
824 |
* Alter the query that will produce the list of submission IDs to be |
|
825 |
* downloaded. |
|
826 |
* |
|
827 |
* @param object $query |
|
828 |
* The query object that is being built up to provide the list of submission |
|
829 |
* IDs. |
|
830 |
* |
|
831 |
* @see webform_download_sids_query() |
|
832 |
*/ |
|
833 |
function hook_webform_download_sids_query_alter(&$query) { |
|
834 |
global $user; |
|
835 |
|
|
836 |
// check if component value matches a node ID and author of that node. |
|
837 |
$query->join('webform_submitted_data', 'wsd', 'ws.sid = wsd.sid'); |
|
838 |
$query->condition('wsd.cid', 2); |
|
839 |
$query->join('node', 'n', 'wsd.data = n.nid'); |
|
840 |
$query->condition('n.uid', $user->uid); |
|
841 |
} |
|
842 |
|
|
823 | 843 |
/** |
824 | 844 |
* @} |
825 | 845 |
*/ |
... | ... | |
876 | 896 |
* The form state array. |
877 | 897 |
* |
878 | 898 |
* @return array |
879 |
* An array of form items to be displayed on the edit component page
|
|
899 |
* Return $form with whatever changes are desired.
|
|
880 | 900 |
*/ |
881 |
function _webform_edit_component(array $component, array &$form, array &$form_state) {
|
|
901 |
function _webform_edit_component(array $component, array $form, array $form_state) {
|
|
882 | 902 |
// Disabling the description if not wanted. |
883 | 903 |
$form['description']['#access'] = FALSE; |
884 | 904 |
|
drupal7/sites/all/modules/webform/webform.info | ||
---|---|---|
40 | 40 |
files[] = tests/WebformTestCase.test |
41 | 41 |
files[] = tests/WebformUnitTestCase.test |
42 | 42 |
|
43 |
; Information added by Drupal.org packaging script on 2019-12-11
|
|
44 |
version = "7.x-4.21"
|
|
43 |
; Information added by Drupal.org packaging script on 2020-02-14
|
|
44 |
version = "7.x-4.22"
|
|
45 | 45 |
core = "7.x" |
46 | 46 |
project = "webform" |
47 |
datestamp = "1576092840" |
|
47 |
datestamp = "1581709525" |
drupal7/sites/all/modules/webform/webform.module | ||
---|---|---|
1245 | 1245 |
'conditional' => FALSE, |
1246 | 1246 |
'default_value' => FALSE, |
1247 | 1247 |
'attachment' => TRUE, |
1248 |
'file_usage' => TRUE, |
|
1248 | 1249 |
), |
1249 | 1250 |
'file' => 'components/file.inc', |
1250 | 1251 |
); |
... | ... | |
1331 | 1332 |
$renameable = array(); |
1332 | 1333 |
|
1333 | 1334 |
foreach ($node->webform['components'] as $cid => $component) { |
1334 |
if ($component['type'] == 'file') {
|
|
1335 |
if (webform_component_feature($component['type'], 'file_usage')) {
|
|
1335 | 1336 |
$has_file_components = TRUE; |
1336 | 1337 |
if (!empty($submission->data[$cid])) { |
1337 | 1338 |
foreach ($submission->data[$cid] as $key => $value) { |
... | ... | |
1354 | 1355 |
$old_submission = webform_get_submission($node->nid, $submission->sid); |
1355 | 1356 |
|
1356 | 1357 |
foreach ($node->webform['components'] as $cid => $component) { |
1357 |
if ($component['type'] == 'file') {
|
|
1358 |
if (webform_component_feature($component['type'], 'file_usage')) {
|
|
1358 | 1359 |
if (!empty($old_submission->data[$cid])) { |
1359 | 1360 |
$old_fids = array_merge($old_fids, $old_submission->data[$cid]); |
1360 | 1361 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules