Projet

Général

Profil

Révision 950416da

Ajouté par Assos Assos il y a plus de 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/rules/ui/ui.forms.inc
1 1
<?php
2 2

  
3 3
/**
4
 * @file Rules UI forms
4
 * @file
5
 * Rules User Interface forms.
5 6
 */
6 7

  
7 8
/**
......
35 36
}
36 37

  
37 38
/**
38
 * General form submit handler, that rebuilds the form
39
 * General form submit handler, that rebuilds the form.
39 40
 */
40 41
function rules_form_submit_rebuild($form, &$form_state) {
41 42
  $form_state['rebuild'] = TRUE;
......
54 55
}
55 56

  
56 57
/**
57
 * General rules configuration form validation callback. Also populates the
58
 * rules configuration with the form values.
58
 * General rules configuration form validation callback.
59
 *
60
 * Also populates the rules configuration with the form values.
59 61
 */
60 62
function rules_ui_form_rules_config_validate($form, &$form_state) {
61 63
  $form_state['rules_element']->form_validate($form, $form_state);
......
165 167

  
166 168
  switch ($op) {
167 169
    case 'enable':
168
      return array(t('Are you sure you want to enable the %plugin %label?', $vars), '');
170
      return array(
171
        t('Are you sure you want to enable the %plugin %label?', $vars),
172
        '',
173
      );
174

  
169 175
    case 'disable':
170
      return array(t('Are you sure you want to disable the %plugin %label?', $vars), '');
176
      return array(
177
        t('Are you sure you want to disable the %plugin %label?', $vars),
178
        '',
179
      );
180

  
171 181
    case 'revert':
172
      return array(t('Are you sure you want to revert the %plugin %label?', $vars), t('This action cannot be undone.'));
182
      return array(
183
        t('Are you sure you want to revert the %plugin %label?', $vars),
184
        t('This action cannot be undone.'),
185
      );
186

  
173 187
    case 'delete':
174
      return array(t('Are you sure you want to delete the %plugin %label?', $vars), t('This action cannot be undone.'));
188
      return array(
189
        t('Are you sure you want to delete the %plugin %label?', $vars),
190
        t('This action cannot be undone.'),
191
      );
192

  
175 193
    default:
176 194
      return FALSE;
177 195
  }
......
193 211
}
194 212

  
195 213
/**
196
 * Applies the operation and returns the message to show to the user. Also the
197
 * operation is logged to the watchdog. Note that the string is defined two
198
 * times so that the translation extractor can find it.
214
 * Applies the operation and returns the message to show to the user.
215
 *
216
 * The operation is also logged to the watchdog. Note that the string is
217
 * defined two times so that the translation extractor can find it.
199 218
 */
200 219
function rules_ui_confirm_operation_apply($op, $rules_config) {
201 220
  $vars = array('%plugin' => $rules_config->plugin(), '%label' => $rules_config->label());
......
290 309

  
291 310
/**
292 311
 * Add element submit callback.
312
 *
293 313
 * Used for "abstract plugins" to create the initial element object with the
294
 * given implemenation name and rebuild the form.
314
 * given implementation name and rebuild the form.
295 315
 */
296 316
function rules_ui_add_element_submit($form, &$form_state) {
297 317
  $element = rules_plugin_factory($form_state['plugin'], $form_state['values']['element_name']);
......
348 368
    }
349 369
  }
350 370

  
351
  $confirm_question = t('Are you sure you want to delete the %element_plugin %element_name?', array('%element_plugin' => $rules_element->plugin(), '%element_name' => $rules_element->label(), '%plugin' => $rules_config->plugin(), '%label' => $rules_config->label()));
371
  $confirm_question = t('Are you sure you want to delete the %element_plugin %element_name?', array(
372
    '%element_plugin' => $rules_element->plugin(),
373
    '%element_name' => $rules_element->label(),
374
  ));
352 375
  return confirm_form($form, $confirm_question, RulesPluginUI::path($rules_config->name), t('This action cannot be undone.'), t('Delete'), t('Cancel'));
353 376
}
354 377

  
......
363 386
  }
364 387
}
365 388

  
366

  
367 389
/**
368 390
 * Configure a rule element.
369 391
 */
......
487 509
}
488 510

  
489 511
/**
490
 * Form to remove a event from a rule.
512
 * Form to remove an event from a rule.
491 513
 */
492 514
function rules_ui_remove_event($form, &$form_state, $rules_config, $event, $base_path) {
493 515
  RulesPluginUI::$basePath = $base_path;
......
598 620

  
599 621
/**
600 622
 * FAPI process callback for the data selection widget.
623
 *
601 624
 * This finalises the auto completion callback path by appending the form build
602 625
 * id.
603 626
 */
......
657 680
  drupal_json_output($matches);
658 681
}
659 682

  
660

  
661 683
/**
662
 * FAPI validation of an integer element. Copy of the private function
663
 * _element_validate_integer().
684
 * FAPI validation of an integer element.
685
 *
686
 * Copy of the core Drupal private function _element_validate_integer().
664 687
 */
665
function rules_ui_element_integer_validate($element, &$form_state) {;
688
function rules_ui_element_integer_validate($element, &$form_state) {
666 689
  $value = $element['#value'];
667 690
  if (isset($value) && $value !== '' && (!is_numeric($value) || intval($value) != $value)) {
668 691
    form_error($element, t('%name must be an integer value.', array('%name' => isset($element['#title']) ? $element['#title'] : t('Element'))));
......
670 693
}
671 694

  
672 695
/**
673
 * FAPI validation of a decimal element. Improved version of the private
674
 * function _element_validate_number().
696
 * FAPI validation of a decimal element.
697
 *
698
 * Improved version of the private function _element_validate_number().
675 699
 */
676 700
function rules_ui_element_decimal_validate($element, &$form_state) {
677 701
  // Substitute the decimal separator ",".
......
695 719
}
696 720

  
697 721
/**
698
 * FAPI validation of a date element. Makes sure the specified date format is
699
 * correct and converts date values specifiy a fixed (= non relative) date to
700
 * a timestamp. Relative dates are handled by the date input evaluator.
722
 * FAPI validation of a date element.
723
 *
724
 * Makes sure the specified date format is correct and converts date values
725
 * specify a fixed (= non relative) date to a timestamp. Relative dates are
726
 * handled by the date input evaluator.
701 727
 */
702 728
function rules_ui_element_date_validate($element, &$form_state) {
703 729
  $value = $element['#value'];
......
766 792
}
767 793

  
768 794
/**
769
 * Helper function to determine the value for a rules duration form
770
 * element.
795
 * Helper function a rules duration form element.
796
 *
797
 * Determines the value for a rules duration form element.
771 798
 */
772 799
function rules_ui_element_duration_value($element, $input = FALSE) {
773 800
  // This runs before child elements are processed, so we cannot calculate the
......
781 808

  
782 809
/**
783 810
 * FAPI after build callback for the duration parameter type form.
811
 *
784 812
 * Fixes up the form value by applying the multiplier.
785 813
 */
786 814
function rules_ui_element_duration_after_build($element, &$form_state) {
......
810 838
  return $element;
811 839
}
812 840

  
813

  
814 841
/**
815 842
 * FAPI after build callback for specifying a list of values.
816 843
 *
......
877 904

  
878 905
/**
879 906
 * FAPI callback to validate the form for editing variable info.
907
 *
880 908
 * @see RulesPluginUI::getVariableForm()
881 909
 */
882 910
function rules_ui_element_variable_form_validate($elements, &$form_state) {

Formats disponibles : Unified diff