Projet

Général

Profil

Révision bc175c27

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.inc
5 5
 * Administrative page callbacks for the ldap_authorization module.  Consumer configuration form and index.
6 6
 */
7 7

  
8

  
9 8
/**
10
 * index of ldap authorization configurations
9
 * Index of ldap authorization configurations.
11 10
 *
12 11
 * @return string html table
13 12
 */
14

  
15 13
function ldap_authorizations_admin_index() {
16 14

  
17 15
  $consumers = ldap_authorization_get_consumers(NULL, TRUE, FALSE);
......
33 31

  
34 32
}
35 33

  
36

  
37

  
38 34
/**
39
 * form for adding, updating, and deleting a single ldap authorization configuration
35
 * Form for adding, updating, and deleting a single ldap authorization configuration.
40 36
 *
41 37
 * @param form array $form
42 38
 * @param form state array $form_state
43
 * @param string $op (add, edit, or delete)
44
 * @param string $consumer_type e.g. drupal_roles, og_group, etc.  Only needed for adds
39
 * @param string $op
40
 *   (add, edit, or delete)
41
 * @param string $consumer_type
42
 *   e.g. drupal_roles, og_group, etc.  Only needed for adds.
43
 *
45 44
 * @return drupal form array
46 45
 */
47

  
48 46
function ldap_authorization_admin_form($form, &$form_state, $consumer_type, $op = NULL) {
49 47
  ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
50 48
  $consumer = ldap_authorization_get_consumer_object($consumer_type);
......
67 65
    drupal_goto('admin/config/people/ldap/authorization');
68 66
  }
69 67

  
70

  
71 68
  $new = ($op == 'add');
72 69
  $consumer_conf_admin = new LdapAuthorizationConsumerConfAdmin($consumer, $new);
73 70

  
......
78 75

  
79 76
}
80 77

  
81

  
82 78
/**
83
 * validate handler for the ldap_authorization_admin_form
79
 * Validate handler for the ldap_authorization_admin_form.
84 80
 */
85

  
86 81
function ldap_authorization_admin_form_validate($form, &$form_state) {
87 82

  
88
  list($consumer, $op, $op_past, $new)  = _ldap_authorization_admin_parse_form($form, $form_state);
83
  list($consumer, $op, $op_past, $new) = _ldap_authorization_admin_parse_form($form, $form_state);
89 84
  $values = $form_state['values'];
90 85
  ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
91 86
  $consumer_conf_admin = new LdapAuthorizationConsumerConfAdmin($consumer, $new);
......
98 93

  
99 94
}
100 95

  
101

  
102 96
/**
103
 * submit handler function for ldap_authorization_admin_form
97
 * Submit handler function for ldap_authorization_admin_form.
104 98
 */
105

  
106 99
function ldap_authorization_admin_form_submit($form, &$form_state) {
107
  list($consumer, $op, $op_past_tense, $new)  = _ldap_authorization_admin_parse_form($form, $form_state);
100
  list($consumer, $op, $op_past_tense, $new) = _ldap_authorization_admin_parse_form($form, $form_state);
108 101
  $values = $form_state['values'];
109 102
  ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
110 103
  $consumer_conf = new LdapAuthorizationConsumerConfAdmin($consumer, $new);
111
  $consumer_conf->drupalFormSubmit($op, $values);  // add form data to object and save or create
104
  // Add form data to object and save or create.
105
  $consumer_conf->drupalFormSubmit($op, $values);
112 106

  
113 107
  if ($consumer_conf->hasError == FALSE) {
114 108
    drupal_set_message(t('LDAP Authorization %name !verb', array('!verb' => $op_past_tense, '%name' => $consumer->name)), 'status');
......
121 115
}
122 116

  
123 117
/**
124
 * helper function for parsing ldap authorization config form
118
 * Helper function for parsing ldap authorization config form.
125 119
 */
126

  
127 120
function _ldap_authorization_admin_parse_form($form, &$form_state) {
128 121
  $op = drupal_strtolower($form_state['clicked_button']['#value']);
129 122
  $values = $form_state['values'];
......
140 133
    case 'add':
141 134
      $op_past_tense = 'Added';
142 135
      $new = TRUE;
143
    break;
136
      break;
144 137

  
145 138
    case 'save':
146 139
    case 'update':
147 140
    case 'edit':
148 141
      $op_past_tense = 'Updated';
149 142
      $new = FALSE;
150
    break;
143
      break;
151 144

  
152 145
    case 'delete':
153 146
      $op_past_tense = 'Deleted';
154 147
      $new = FALSE;
155
    break;
148
      break;
156 149
  }
157 150

  
158 151
  return array($consumer, $op, $op_past_tense, $new);

Formats disponibles : Unified diff