Révision e9f59589
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/cas/cas.admin.inc | ||
---|---|---|
212 | 212 |
'#collapsed' => TRUE, |
213 | 213 |
); |
214 | 214 |
|
215 |
$form['pages']['cas_check_first'] = array(
|
|
216 |
'#type' => 'checkbox',
|
|
215 |
$form['pages']['cas_check_frequency'] = array(
|
|
216 |
'#type' => 'radios',
|
|
217 | 217 |
'#title' => t('Check with the CAS server to see if the user is already logged in?'), |
218 |
'#default_value' => variable_get('cas_check_first', 0), |
|
219 |
'#description' => t('This implements the <a href="@cas-gateway">Gateway feature</a> of the CAS Protocol. The check is only performed the first time a user visits your site, so that the local drupal logout is still useful for site admins.', array('@cas-gateway' => 'https://wiki.jasig.org/display/CAS/gateway')), |
|
218 |
'#default_value' => variable_get('cas_check_frequency', CAS_CHECK_NEVER), |
|
219 |
'#options' => array( |
|
220 |
CAS_CHECK_NEVER => 'Never', |
|
221 |
CAS_CHECK_ONCE => 'Once per browser session', |
|
222 |
CAS_CHECK_ALWAYS => 'Always (every page load)', |
|
223 |
), |
|
224 |
'#description' => t('This implements the') . ' <a href="https://wiki.jasig.org/display/CAS/gateway">Gateway feature</a> ' . t('of the CAS Protocol.') . ' <strong>WARNING:</strong> ' . t('Enabling it at all will') . ' <em>' . t('completely disable page caching') . '</em>' . t(', and will prevent users from logging out locally unless also logged out of CAS. Setting it to "Always" will perform redirects on EVERY page load unless the user is already logged in, and is not recommended in most circumstances.'), |
|
220 | 225 |
); |
221 | 226 |
|
222 | 227 |
$form['pages']['cas_access'] = array( |
... | ... | |
337 | 342 |
|
338 | 343 |
$form['advanced']['cas_debugfile'] = array( |
339 | 344 |
'#type' => 'textfield', |
340 |
'#title' => t('CAS debugging output filename'),
|
|
345 |
'#title' => t('CAS debugging output file'), |
|
341 | 346 |
'#default_value' => variable_get('cas_debugfile', ''), |
342 | 347 |
'#maxlength' => 255, |
343 |
'#description' => t("Leave empty if you don't want debugging output."),
|
|
348 |
'#description' => "<p>" . t("A file system path and filename where the CAS debug log will be written. May be either a full path or a path relative to the Drupal installation root. The directory and file must be writable by Drupal.") . "</p> <p>" . t("Leave blank to disable logging.") . "</p> <p><strong>" . t("Debugging should not be enabled on production systems.") . "</strong></p>",
|
|
344 | 349 |
); |
345 | 350 |
|
346 | 351 |
return system_settings_form($form); |
drupal7/sites/all/modules/cas/cas.batch.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Provides CAS batch functions. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* CAS user creation batch callback. |
|
10 |
* |
|
11 |
* @param $cas_name |
|
12 |
* The name of the CAS user. |
|
13 |
*/ |
|
14 |
function cas_batch_user_add($cas_name, &$context) { |
|
15 |
$options = array( |
|
16 |
'invoke_cas_user_presave' => TRUE, |
|
17 |
); |
|
18 |
|
|
19 |
// Remove any whitespace around usernames. |
|
20 |
$cas_name = trim($cas_name); |
|
21 |
|
|
22 |
// Check if the account already exists. |
|
23 |
$existing_account = cas_user_load_by_name($cas_name); |
|
24 |
|
|
25 |
if ($existing_account == TRUE){ |
|
26 |
$uri = entity_uri('user', $existing_account); |
|
27 |
$context['results']['messages']['already_exist'][] = t('<a href="@url">%name</a>', array('@url' => url($uri['path'], $uri['options']), '%name' => $existing_account->name));; |
|
28 |
return; |
|
29 |
} |
|
30 |
|
|
31 |
$account = cas_user_register($cas_name, $options); |
|
32 |
|
|
33 |
// Display error if user creation fails. |
|
34 |
if (!$account) { |
|
35 |
$context['results']['messages']['error'][] = t("@cas_name", array('@cas_name' => $cas_name)); |
|
36 |
} |
|
37 |
else { |
|
38 |
$uri = entity_uri('user', $account); |
|
39 |
$context['results']['messages']['newly_created'][] = t('<a href="@url">%name</a>', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)); |
|
40 |
return $account; |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* CAS user creation 'finished' callback. |
|
46 |
* Consolidates message output. |
|
47 |
*/ |
|
48 |
function cas_batch_user_finished($success, $results, $operations) { |
|
49 |
if ($success) { |
|
50 |
if (!empty($results['messages']['error'])) { |
|
51 |
drupal_set_message(t('Error occurred during account creation of %count CAS username(s): !usernames', array('%count' => count($results['messages']['error']), '!usernames' => implode(', ', $results['messages']['error']))), 'warning'); |
|
52 |
} |
|
53 |
if (!empty($results['messages']['already_exist'])) { |
|
54 |
drupal_set_message(t('The following %count CAS username(s) are already in use on this site: !usernames', array('%count' => count($results['messages']['already_exist']), '!usernames' => implode(', ', $results['messages']['already_exist']))), 'warning'); |
|
55 |
} |
|
56 |
if (!empty($results['messages']['newly_created'])) { |
|
57 |
drupal_set_message(t('The following %count CAS usernames were created: !usernames', array('%count' => count($results['messages']['newly_created']), '!usernames' => implode(', ', $results['messages']['newly_created'])))); |
|
58 |
} |
|
59 |
} |
|
60 |
else { |
|
61 |
// An error occurred. |
|
62 |
// $operations contains the operations that remained unprocessed. |
|
63 |
$error_operation = reset($operations); |
|
64 |
drupal_set_message(t('An error occurred while processing @operation with arguments : @args', array('@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE)))); |
|
65 |
} |
|
66 |
} |
drupal7/sites/all/modules/cas/cas.info | ||
---|---|---|
7 | 7 |
files[] = cas.test |
8 | 8 |
files[] = includes/views/handlers/cas_handler_field_cas_name.inc |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2014-04-02
|
|
11 |
version = "7.x-1.3"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
11 |
version = "7.x-1.4"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "cas" |
14 |
datestamp = "1396458247"
|
|
14 |
datestamp = "1402318728"
|
|
15 | 15 |
|
drupal7/sites/all/modules/cas/cas.install | ||
---|---|---|
80 | 80 |
variable_del('cas_auto_assigned_role'); |
81 | 81 |
variable_del('cas_cert'); |
82 | 82 |
variable_del('cas_changePasswordURL'); |
83 |
variable_del('cas_check_first');
|
|
83 |
variable_del('cas_check_frequency');
|
|
84 | 84 |
variable_del('cas_debugfile'); |
85 | 85 |
variable_del('cas_domain'); |
86 | 86 |
variable_del('cas_exclude'); |
... | ... | |
108 | 108 |
|
109 | 109 |
// And old (un-used) variables. |
110 | 110 |
variable_del('cas_cert_verify'); |
111 |
variable_del('cas_check_first'); |
|
111 | 112 |
variable_del('cas_first_login'); |
112 | 113 |
variable_del('cas_hijack_user'); |
113 | 114 |
variable_del('cas_ldap_email_attribute'); |
... | ... | |
349 | 350 |
$moved_deltas = array(); |
350 | 351 |
update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas); |
351 | 352 |
} |
353 |
|
|
354 |
/** |
|
355 |
* Use variable 'cas_check_frequency' instead of 'cas_gateway'. |
|
356 |
*/ |
|
357 |
function cas_update_7101() { |
|
358 |
if (variable_get('cas_check_first', NULL) === NULL) { |
|
359 |
// The old variable was not set, nothing to do. |
|
360 |
return; |
|
361 |
} |
|
362 |
|
|
363 |
if (variable_get('cas_check_first', FALSE)) { |
|
364 |
// Check once, but not again until login. |
|
365 |
variable_set('cas_check_frequency', -1); |
|
366 |
} |
|
367 |
else { |
|
368 |
// Check never. |
|
369 |
variable_set('cas_check_frequency', -2); |
|
370 |
} |
|
371 |
variable_del('cas_check_first'); |
|
372 |
} |
drupal7/sites/all/modules/cas/cas.module | ||
---|---|---|
15 | 15 |
define('CAS_LOGIN_REDIR_MESSAGE', 'You will be redirected to the secure CAS login page.'); |
16 | 16 |
define('CAS_EXCLUDE', 'services/*'); |
17 | 17 |
|
18 |
// Frequency of CAS Gateway checking. |
|
19 |
define('CAS_CHECK_NEVER', -2); |
|
20 |
define('CAS_CHECK_ONCE', -1); |
|
21 |
define('CAS_CHECK_ALWAYS', 0); |
|
22 |
|
|
18 | 23 |
/** |
19 | 24 |
* Implements hook_init(). |
20 | 25 |
* |
... | ... | |
36 | 41 |
if (!$user->uid) { |
37 | 42 |
$force_authentication = _cas_force_login(); |
38 | 43 |
$check_authentication = _cas_allow_check_for_login(); |
39 |
if ($force_authentication || $check_authentication) { |
|
44 |
$request_type = $_SERVER['REQUEST_METHOD']; |
|
45 |
$perform_login_check = $force_authentication || ($check_authentication && ($request_type == 'GET')); |
|
46 |
if ($perform_login_check) { |
|
40 | 47 |
cas_login_check($force_authentication); |
41 | 48 |
} |
42 | 49 |
} |
... | ... | |
76 | 83 |
} |
77 | 84 |
else { |
78 | 85 |
$logged_in = phpCAS::checkAuthentication(); |
79 |
// Set the login tested cookie |
|
80 |
setcookie('cas_login_checked', 'true'); |
|
81 | 86 |
|
82 | 87 |
// We're done cause we're not logged in. |
83 | 88 |
if (!$logged_in) { |
... | ... | |
173 | 178 |
drupal_set_message(t('You will remain logged in on this computer even after you close your browser.')); |
174 | 179 |
} |
175 | 180 |
|
176 |
cas_login_page($cas_first_login); |
|
181 |
_cas_redirect_after_login($cas_first_login); |
|
182 |
|
|
177 | 183 |
} |
178 | 184 |
else { |
179 | 185 |
$user = drupal_anonymous_user(); |
186 |
unset($_SESSION['phpCAS']); |
|
187 |
|
|
180 | 188 |
// Only display error messages only if the user intended to log in. |
181 | 189 |
if ($force_authentication) { |
182 | 190 |
drupal_set_message(t('No account found for %cas_name.', array('%cas_name' => $cas_name)), 'error'); |
... | ... | |
280 | 288 |
phpCAS::setNoCasServerValidation(); |
281 | 289 |
} |
282 | 290 |
|
283 |
$service = isset($_GET['q']) ? $_GET['q'] : 'cas';
|
|
284 |
phpCAS::setFixedServiceURL(url($service, array('query' => cas_login_destination(), 'absolute' => TRUE)));
|
|
291 |
phpCAS::setFixedServiceURL(url(current_path(), array('query' => drupal_get_query_parameters(), 'absolute' => TRUE)));
|
|
292 |
phpCAS::setCacheTimesForAuthRecheck((int) variable_get('cas_check_frequency', CAS_CHECK_NEVER));
|
|
285 | 293 |
|
286 | 294 |
// Allow other modules to call phpCAS routines. We do not call |
287 | 295 |
// drupal_alter() since there are no parameters to pass. |
... | ... | |
334 | 342 |
'weight' => -10, |
335 | 343 |
); |
336 | 344 |
$items['admin/people/cas/create'] = array( |
337 |
'title' => 'Add CAS user', |
|
345 |
'title' => 'Add CAS user(s)',
|
|
338 | 346 |
'page callback' => 'drupal_get_form', |
339 | 347 |
'page arguments' => array('cas_add_user_form'), |
340 | 348 |
'access arguments' => array('administer users'), |
... | ... | |
416 | 424 |
} |
417 | 425 |
} |
418 | 426 |
|
419 |
/** |
|
420 |
* Helper function to rewrite the destination to avoid redirecting to login page after login. |
|
421 |
* |
|
422 |
* Instead of the login page, we redirect to the front page. |
|
423 |
*/ |
|
424 |
function cas_login_destination() { |
|
425 |
$destination = user_login_destination(); |
|
426 |
if ($destination['destination'] == 'cas') { |
|
427 |
$destination['destination'] = ''; |
|
428 |
} |
|
429 |
return $destination; |
|
430 |
} |
|
431 |
|
|
432 | 427 |
/** |
433 | 428 |
* Implements hook_user_operations(). |
434 | 429 |
*/ |
... | ... | |
631 | 626 |
} |
632 | 627 |
|
633 | 628 |
/** |
634 |
* Redirects to appropriate page based on user settings. |
|
629 |
* This is the page callback for the /cas page, which is used only to |
|
630 |
* trigger a forced CAS authentication. |
|
635 | 631 |
* |
636 |
* @param $cas_first_login
|
|
637 |
* TRUE if the user was just registered and they should be redirected to the
|
|
638 |
* configured 'Initial login landing page'.
|
|
632 |
* In almost all cases, the user will have been redirected before even
|
|
633 |
* hitting this page (see hook_init implementation). But as a stop gap
|
|
634 |
* just redirect to the homepage.
|
|
639 | 635 |
*/ |
640 |
function cas_login_page($cas_first_login = FALSE) { |
|
641 |
global $user; |
|
642 |
$destination = ''; |
|
643 |
$query = array(); |
|
644 |
// If it is the user's first CAS login and initial login redirection is enabled, go to the set page |
|
645 |
if ($cas_first_login && variable_get('cas_first_login_destination', '')) { |
|
646 |
$destination = variable_get('cas_first_login_destination', ''); |
|
647 |
if (isset($_GET['destination'])) |
|
648 |
$query['destination'] = $_GET['destination']; |
|
649 |
unset($_GET['destination']); |
|
650 |
} |
|
651 |
|
|
652 |
// Respect the query string, if transmitted. |
|
653 |
drupal_goto($destination, array('query' => $query)); |
|
636 |
function cas_login_page() { |
|
637 |
drupal_goto(''); |
|
654 | 638 |
} |
655 | 639 |
|
656 | 640 |
/** |
... | ... | |
770 | 754 |
* authenticated, FALSE otherwise. |
771 | 755 |
*/ |
772 | 756 |
function _cas_allow_check_for_login() { |
773 |
if (!variable_get('cas_check_first', 0)) {
|
|
774 |
// The user has disabled the feature.
|
|
757 |
// Do not process in maintenance mode.
|
|
758 |
if (variable_get('maintenance_mode', 0)) {
|
|
775 | 759 |
return FALSE; |
776 | 760 |
} |
777 | 761 |
|
778 |
// Check to see if we already have.
|
|
779 |
if (!empty($_COOKIE['cas_login_checked'])) {
|
|
762 |
if (variable_get('cas_check_frequency', CAS_CHECK_NEVER) == CAS_CHECK_NEVER) {
|
|
763 |
// The user has disabled the feature.
|
|
780 | 764 |
return FALSE; |
781 | 765 |
} |
782 | 766 |
|
... | ... | |
850 | 834 |
return TRUE; |
851 | 835 |
} |
852 | 836 |
|
837 |
// Do not process in maintenance mode. |
|
838 |
if (variable_get('maintenance_mode', 0)) { |
|
839 |
return FALSE; |
|
840 |
} |
|
841 |
|
|
853 | 842 |
// Do not force login for XMLRPC, Cron, or Drush. |
854 | 843 |
if (stristr($_SERVER['SCRIPT_FILENAME'], 'xmlrpc.php')) { |
855 | 844 |
return FALSE; |
... | ... | |
1073 | 1062 |
$namespaces = $cas_logout_request_xml->getNameSpaces(); |
1074 | 1063 |
$xsearch = 'SessionIndex'; |
1075 | 1064 |
if (isset($namespaces['samlp'])) { |
1076 |
$cas_logout_request_xml->registerXPathNamespace('samlp', $namespaces['samlp']); |
|
1077 |
$xsearch = 'samlp:SessionIndex'; |
|
1065 |
$cas_session_indexes = $cas_logout_request_xml->children($namespaces['samlp'])->SessionIndex; |
|
1066 |
} |
|
1067 |
else { |
|
1068 |
$cas_session_indexes = $cas_logout_request_xml->xpath($xsearch); |
|
1078 | 1069 |
} |
1079 |
$cas_session_indexes = $cas_logout_request_xml->xpath($xsearch); |
|
1080 | 1070 |
if ($cas_session_indexes) { |
1081 | 1071 |
$cas_session_index = (string)$cas_session_indexes[0]; |
1082 | 1072 |
// Log them out now. |
... | ... | |
1305 | 1295 |
'path' => drupal_get_path('module', 'cas') . '/includes/views', |
1306 | 1296 |
); |
1307 | 1297 |
} |
1298 |
|
|
1299 |
/** |
|
1300 |
* Redirect a user after they have logged into the website through CAS |
|
1301 |
* |
|
1302 |
* @param $cas_first_login - TRUE if this is the first time the CAS user |
|
1303 |
* logged into the site |
|
1304 |
*/ |
|
1305 |
function _cas_redirect_after_login($cas_first_login) { |
|
1306 |
// When users first log in, we may want to redirect them to a special page if specified |
|
1307 |
if ($cas_first_login && variable_get('cas_first_login_destination', '')) { |
|
1308 |
$destination = variable_get('cas_first_login_destination', ''); |
|
1309 |
drupal_goto($destination); |
|
1310 |
} |
|
1311 |
else { |
|
1312 |
// If logged in through forced authentication ('/cas'), then redirect user to the |
|
1313 |
// homepage, or to wherever the current "destination" parameter points. |
|
1314 |
if (current_path() == 'cas') { |
|
1315 |
drupal_goto(''); |
|
1316 |
} |
|
1317 |
// If logged in through gateway feature, then just reload the current path |
|
1318 |
// and preserve any query string args that were set |
|
1319 |
else { |
|
1320 |
drupal_goto(current_path(), array('query' => drupal_get_query_parameters())); |
|
1321 |
} |
|
1322 |
} |
|
1323 |
} |
drupal7/sites/all/modules/cas/cas.test | ||
---|---|---|
35 | 35 |
$this->admin_user = $this->drupalCreateUser(array('administer users', 'administer cas')); |
36 | 36 |
|
37 | 37 |
// Download and extract in PHPCAS. |
38 |
$this->downloadExtractPhpCas('1.3.1');
|
|
38 |
$this->downloadExtractPhpCas('1.3.2');
|
|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
/** |
... | ... | |
332 | 332 |
function testCasUserAdd() { |
333 | 333 |
$this->drupalLogin($this->admin_user); |
334 | 334 |
|
335 |
// Add a CAS user. |
|
336 |
$edit = array( |
|
337 |
'cas_name' => $this->randomName(), |
|
338 |
); |
|
339 |
$this->drupalPost('admin/people/cas/create', $edit, t('Create new account')); |
|
340 |
$this->assertText(t('Created a new user account for @name. No e-mail has been sent.', array('@name' => $edit['cas_name'])), 'User created'); |
|
335 |
// Add 3 CAS users. |
|
336 |
$edit = array(); |
|
337 |
for ($i = 0; $i < 3; $i++) { |
|
338 |
$cas_names[] = $this->randomName(); |
|
339 |
} |
|
340 |
$edit['cas_name'] = implode("\n", $cas_names); |
|
341 |
$this->drupalPost('admin/people/cas/create', $edit, t('Create new account(s)')); |
|
342 |
$this->assertText(t('The following 3 CAS usernames were created: @cas_names', array('@cas_names' => implode(', ', $cas_names))), 'Users created'); |
|
341 | 343 |
|
342 |
// Verify the user shows up in the list of all users.
|
|
344 |
// Verify the users show up in the list of all users.
|
|
343 | 345 |
$this->drupalGet('admin/people'); |
344 |
$this->assertNoUniqueText($edit['cas_name'], 'User and CAS username found in list of users'); |
|
346 |
foreach ($cas_names as $cas_name) { |
|
347 |
$this->assertNoUniqueText($cas_name, 'User and CAS username found in list of users'); |
|
348 |
} |
|
345 | 349 |
|
346 |
// Attempt to add the user again and see that it fails. |
|
347 |
$this->drupalPost('admin/people/cas/create', $edit, t('Create new account')); |
|
350 |
// Attempt to add one of the users again and see that it fails. |
|
351 |
$edit['cas_name'] = $cas_names[0]; |
|
352 |
$this->drupalPost('admin/people/cas/create', $edit, t('Create new account(s)')); |
|
348 | 353 |
$this->assertText(t('The CAS username is already in use on this site.'), 'CAS username already in use.'); |
349 | 354 |
} |
350 | 355 |
} |
... | ... | |
374 | 379 |
$this->drupalGet('cas'); |
375 | 380 |
$this->assertRaw(t('No account found for %cas_name.', array('%cas_name' => $cas_name))); |
376 | 381 |
|
382 |
// Ensure that the login result is not cached. |
|
383 |
$cas_name = $this->randomName(); |
|
384 |
$this->setCasUser($cas_name); |
|
385 |
$this->drupalGet('cas'); |
|
386 |
$this->assertRaw(t('No account found for %cas_name.', array('%cas_name' => $cas_name))); |
|
387 |
|
|
377 | 388 |
// Test that the user is automatically registered. |
378 | 389 |
variable_set('cas_user_register', TRUE); |
379 | 390 |
$this->drupalGet('cas'); |
... | ... | |
593 | 604 |
variable_set('cas_first_login_destination', "node/$node->nid"); |
594 | 605 |
$cas_name = $this->randomName(); |
595 | 606 |
$account = $this->casLogin($cas_name); |
596 |
$this->assertUrl("node/$node->nid", array('query' => array('destination' => '')));
|
|
607 |
$this->assertUrl("node/$node->nid"); |
|
597 | 608 |
$this->drupalLogout(); |
598 | 609 |
|
599 | 610 |
// The second login should not be redirected. |
... | ... | |
605 | 616 |
// destination. |
606 | 617 |
$account = $this->casCreateUser(); |
607 | 618 |
$this->casLogin($account); |
608 |
$this->assertUrl("node/$node->nid", array('query' => array('destination' => '')));
|
|
619 |
$this->assertUrl("node/$node->nid"); |
|
609 | 620 |
$this->drupalLogout(); |
610 | 621 |
|
611 | 622 |
// The second login should not be redirected. |
... | ... | |
670 | 681 |
|
671 | 682 |
function setUp() { |
672 | 683 |
parent::setUp(); |
673 |
variable_set('cas_check_first', TRUE); |
|
674 | 684 |
} |
675 | 685 |
|
676 | 686 |
/** |
677 | 687 |
* Test the CAS Gateway functionality of the user is not logged in. |
678 | 688 |
*/ |
679 | 689 |
function testCasGatewayLoggedOut() { |
690 |
$node1 = $this->drupalCreateNode(); |
|
691 |
|
|
692 |
variable_set('cas_check_frequency', CAS_CHECK_ONCE); |
|
680 | 693 |
$this->drupalGet(''); |
681 |
$this->assertTrue($this->redirect_count > 1, 'Polled CAS server on first request.');
|
|
694 |
$this->assertTrue($this->redirect_count == 2, 'Polled CAS server on first request.');
|
|
682 | 695 |
$this->drupalGet(''); |
683 | 696 |
$this->assertEqual($this->redirect_count, 0, 'Did not poll CAS server on second request.'); |
684 |
$this->drupalGet('node');
|
|
697 |
$this->drupalGet('node/' . $node1->nid);
|
|
685 | 698 |
$this->assertEqual($this->redirect_count, 0, 'Did not poll CAS server on third request.'); |
699 |
$this->assertFalse($this->loggedInUser); |
|
700 |
|
|
701 |
variable_set('cas_check_frequency', CAS_CHECK_ALWAYS); |
|
702 |
$this->drupalGet(''); |
|
703 |
$this->assertTrue($this->redirect_count == 2, 'Polled CAS server on first request'); |
|
704 |
$this->drupalGet(''); |
|
705 |
$this->assertTrue($this->redirect_count == 2, 'Polled CAS server on second request'); |
|
706 |
$this->drupalGet('node/' . $node1->nid); |
|
707 |
$this->assertEqual($this->redirect_count == 2, 'Polled CAS server on third request'); |
|
708 |
$this->assertFalse($this->loggedInUser); |
|
686 | 709 |
} |
687 | 710 |
|
688 | 711 |
/** |
... | ... | |
694 | 717 |
$account = $this->casCreateUser($cas_name); |
695 | 718 |
$this->setCasUser($cas_name); |
696 | 719 |
|
697 |
$this->drupalGet('node'); |
|
720 |
variable_set('cas_check_frequency', CAS_CHECK_ONCE); |
|
721 |
$this->drupalGet(''); |
|
722 |
$this->assertLoggedIn($account); |
|
723 |
// Logging out should immediately log a user back in |
|
724 |
$this->drupalGet('user/logout'); |
|
725 |
$this->assertLoggedIn($account); |
|
726 |
|
|
727 |
variable_set('cas_check_frequency', CAS_CHECK_ALWAYS); |
|
728 |
$this->drupalGet(''); |
|
729 |
$this->assertLoggedIn($account); |
|
730 |
// Logging out should immediately log a user back in |
|
731 |
$this->drupalGet('user/logout'); |
|
698 | 732 |
$this->assertLoggedIn($account); |
699 | 733 |
} |
700 | 734 |
} |
... | ... | |
754 | 788 |
$account = $this->casCreateUser(); |
755 | 789 |
$this->setCasUser($account); |
756 | 790 |
|
757 |
variable_set('cas_check_first', TRUE);
|
|
791 |
variable_set('cas_check_frequency', CAS_CHECK_ONCE);
|
|
758 | 792 |
variable_set('cas_exclude', "node/$node->nid"); |
759 | 793 |
|
760 | 794 |
// Visit an excluded page and ensure we did not try to log in. |
drupal7/sites/all/modules/cas/cas.user.inc | ||
---|---|---|
12 | 12 |
$form = array(); |
13 | 13 |
|
14 | 14 |
$form['account']['cas_name'] = array( |
15 |
'#type' => 'textfield',
|
|
16 |
'#title' => t('CAS username'), |
|
15 |
'#type' => 'textarea',
|
|
16 |
'#title' => t('CAS username(s)'),
|
|
17 | 17 |
'#required' => TRUE, |
18 | 18 |
'#default_value' => '', |
19 |
'#description' => t('Registration will proceed as if the user with the specified CAS username just logged in.'),
|
|
19 |
'#description' => t('Enter a single username, or multiple usernames, one per line. Registration will proceed as if the user(s) with the specified CAS username just logged in.'),
|
|
20 | 20 |
'#element_validate' => array('_cas_name_element_validate'), |
21 | 21 |
'#weight' => -10, |
22 | 22 |
); |
... | ... | |
24 | 24 |
$form['actions'] = array('#type' => 'actions'); |
25 | 25 |
$form['actions']['submit'] = array( |
26 | 26 |
'#type' => 'submit', |
27 |
'#value' => t('Create new account'), |
|
27 |
'#value' => t('Create new account(s)'),
|
|
28 | 28 |
); |
29 | 29 |
return $form; |
30 | 30 |
} |
31 | 31 |
|
32 | 32 |
function cas_add_user_form_submit($form, &$form_state) { |
33 |
$options = array( |
|
34 |
'invoke_cas_user_presave' => TRUE, |
|
35 |
); |
|
36 |
$account = cas_user_register($form_state['values']['cas_name'], $options); |
|
33 |
$cas_names = preg_split('/[\n\r|\r|\n]+/', $form_state['values']['cas_name']); |
|
37 | 34 |
|
38 |
// Terminate if an error occurred while registering the user. |
|
39 |
if (!$account) { |
|
40 |
drupal_set_message(t("Error saving user account."), 'error'); |
|
41 |
$form_state['redirect'] = ''; |
|
42 |
return; |
|
35 |
foreach ($cas_names as $cas_name) { |
|
36 |
$operations[] = array('cas_batch_user_add', array($cas_name)); |
|
43 | 37 |
} |
44 | 38 |
|
45 |
// Set these in case another module needs the values. |
|
46 |
$form_state['user'] = $account; |
|
47 |
$form_state['values']['uid'] = $account->uid; |
|
39 |
$batch = array( |
|
40 |
'title' => t('Creating users...'), |
|
41 |
'operations' => $operations, |
|
42 |
'finished' => 'cas_batch_user_finished', |
|
43 |
'progress_message' => t('Processed @current out of @total.'), |
|
44 |
'file' => drupal_get_path('module', 'cas') . '/cas.batch.inc', |
|
45 |
); |
|
48 | 46 |
|
49 |
$uri = entity_uri('user', $account); |
|
50 |
drupal_set_message(t('Created a new user account for <a href="@url">%name</a>. No e-mail has been sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name))); |
|
47 |
batch_set($batch); |
|
51 | 48 |
} |
drupal7/sites/all/modules/cas/cas_server.info | ||
---|---|---|
3 | 3 |
core = 7.x |
4 | 4 |
description = "Provides protocol compliant CAS Server" |
5 | 5 |
|
6 |
; Information added by Drupal.org packaging script on 2014-04-02
|
|
7 |
version = "7.x-1.3"
|
|
6 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
7 |
version = "7.x-1.4"
|
|
8 | 8 |
core = "7.x" |
9 | 9 |
project = "cas" |
10 |
datestamp = "1396458247"
|
|
10 |
datestamp = "1402318728"
|
|
11 | 11 |
|
drupal7/sites/all/modules/cas/cas_server.install | ||
---|---|---|
83 | 83 |
); |
84 | 84 |
|
85 | 85 |
$ret = array(); |
86 |
db_create_table('cas_server_tickets', $schema['cas_server_tickets']); |
|
86 |
if (!db_table_exists('cas_server_tickets')) { |
|
87 |
db_create_table('cas_server_tickets', $schema['cas_server_tickets']); |
|
88 |
} |
|
87 | 89 |
return $ret; |
88 | 90 |
} |
89 | 91 |
|
... | ... | |
91 | 93 |
* Adds valid field to indicate when ticket is valid for reuse. |
92 | 94 |
*/ |
93 | 95 |
function cas_server_update_7101() { |
94 |
db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, )); |
|
96 |
if (!db_field_exists('cas_server_tickets', 'valid')) { |
|
97 |
db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, )); |
|
98 |
} |
|
95 | 99 |
} |
drupal7/sites/all/modules/cas/tests/cas_test.info | ||
---|---|---|
8 | 8 |
; code duplication we use several themes defined by that module. |
9 | 9 |
dependencies[] = cas_server |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2014-04-02
|
|
12 |
version = "7.x-1.3"
|
|
11 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
12 |
version = "7.x-1.4"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "cas" |
15 |
datestamp = "1396458247"
|
|
15 |
datestamp = "1402318728"
|
|
16 | 16 |
|
drupal7/sites/all/modules/cas/tests/cas_test.module | ||
---|---|---|
251 | 251 |
foreach ($tickets as $ticket) { |
252 | 252 |
// Generate posting: |
253 | 253 |
$data = array( |
254 |
'logoutRequest' => t("<samlp:LogoutRequest ID=\"!id\" Version=\"2.0\" IssueInstant=\"!time\">\n<saml:NameID>@NOT_USED@</saml:NameID>\n<samlp:SessionIndex>!ticket</samlp:SessionIndex>\n</samlp:LogoutRequest>", array('!id' => user_password(10), '!time' => time(), '!ticket' => $ticket)), |
|
254 |
'logoutRequest' => t("<samlp:LogoutRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"!id\" Version=\"2.0\" IssueInstant=\"!time\">\n<saml:NameID>@NOT_USED@</saml:NameID>\n<samlp:SessionIndex>!ticket</samlp:SessionIndex>\n</samlp:LogoutRequest>", array('!id' => user_password(10), '!time' => time(), '!ticket' => $ticket)),
|
|
255 | 255 |
); |
256 | 256 |
|
257 | 257 |
if ($double_encode) { |
drupal7/sites/all/modules/commerce_price_flexyformatter/commerce_price_flexyformatter.info | ||
---|---|---|
5 | 5 |
core = 7.x |
6 | 6 |
|
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2014-04-08
|
|
8 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
9 | 9 |
version = "7.x-1.x-dev" |
10 | 10 |
core = "7.x" |
11 | 11 |
project = "commerce_price_flexyformatter" |
12 |
datestamp = "1396991954"
|
|
12 |
datestamp = "1402351750"
|
|
13 | 13 |
|
drupal7/sites/all/modules/commerce_price_flexyformatter/commerce_price_flexyformatter.module | ||
---|---|---|
350 | 350 |
drupal_add_css(drupal_get_path('module', 'commerce_price_flexyformatter') . '/commerce_price_flexyformatter.css'); |
351 | 351 |
foreach ($variables as $key => $variable) { |
352 | 352 |
if (isset($variable['weight']) && is_numeric($variable['weight']) && ($key == 'base' || $variable['enabled'])) { |
353 |
$output .= '<span class=flexy-item' . ($variable['class']?' ' . $variable['class']:'') . '><span class"flexy-title">' . $variable['label'] . '</span><span class="flexy-amount">' . ($variables['raw'] == false ? commerce_currency_format($variable['amount'], $variables['currency_code']): commerce_currency_amount_to_decimal($variable['amount'], $variables['currency_code'])) . '</span></span> ';
|
|
353 |
$output .= '<span class=flexy-item' . ($variable['class']?' ' . $variable['class']:'') . '><span class"flexy-title">' . $variable['label'] . '</span><span class="flexy-amount">' . ($variables['raw'] == false ? commerce_currency_format($variable['amount'], $variables['currency_code']): commerce_price_flexyformatter_raw_format($variable['amount'], $variables['currency_code'])) . '</span></span>';
|
|
354 | 354 |
} |
355 | 355 |
} |
356 | 356 |
|
357 | 357 |
return $output; |
358 | 358 |
} |
359 |
/** |
|
360 |
* Calculate raw |
|
361 |
*/ |
|
362 |
function commerce_price_flexyformatter_raw_format($amount, $currency_code){ |
|
363 |
$currency = commerce_currency_load($currency_code); |
|
364 |
$amount = commerce_currency_amount_to_decimal($amount, $currency_code); |
|
365 |
return number_format($amount, $currency['decimals'], $currency['decimal_separator'], ''); |
|
366 |
} |
|
359 | 367 |
/** |
360 | 368 |
* Calculate amount to be displayed. |
361 | 369 |
* |
drupal7/sites/all/modules/field_group/CHANGELOG.txt | ||
---|---|---|
1 | 1 |
/* $Id*/ |
2 | 2 |
CHANGELOG for field_group for Drupal 7 |
3 | 3 |
|
4 |
Field_group 7.x-1.x-dev |
|
5 |
o Issue #1095316: Field Groups disappear when Content Type is renamed. |
|
6 |
o Issue #1095316 by swentel: Support for Entity API. |
|
7 |
o Issue #1095002 by animelion: Upgrading removes all existing field groups. |
|
8 |
o Issue #1095130 by willvincent: Features export not working with rc2. |
|
9 |
|
|
4 |
Field_group 7.x-1.3 |
|
5 |
o Issue #2077695 by FreekVR | ChoY: Fixed field group entity display bug after update. |
|
6 |
o Issue #2078201 by DeFr, eneko1907 | cmriley: Fixed Started getting a ton of notices. |
|
7 |
o Issue #2085137 by ar-jan: Fixed Collapse speed no longer works with field_group() 1.2 |
|
8 |
o Issue #2085225 by dtarc: Fixed Featurized Field Groups no longer have classes since marked optional. |
|
9 |
o Issue #2080645 by bassthiam: Fixed Warning: Illegal string offset 'label' in field_group_unpack() line 1682 of field_group()/field_group().module. |
|
10 |
o Issue #1942676 by Harlor | El Bandito: Added Change the text 'Mark group for required fields.'. |
|
11 |
o Issue #1358430 by FriedJam: Fixed JS 'Error: uncaught exception: Syntax error, unrecognized expression:". |
|
12 |
o Issue #2084999 by activelink: Fixed Empty field groups aren't being suppressed since move to 7.x-1.2. |
|
13 |
o Issue #1557258 by Mark Trapp | Chris Gillis: Fixed Existing field groups disappear and Add Field Group UI is disabled when no fields are available. |
|
14 |
o Issue #2000110 by bigjim: Fixed Comments on field_group_read_groups() wrong |
|
15 |
o Issue #1169146 by ankur, Nephele | jeffrey.dalton: Fixed upgrade from 7.x-1.0-rc2 to 7.x-1.0 deletes all field_groups(). |
|
16 |
o Vertical tabs always appear when children elements have no access |
|
17 |
o #1966624 Feature 7.x-2.0-beta2 defines fields in a new way |
|
18 |
o #2090415 Make horizontal tabs not dependent on form.js. Also change drupal_add_x to #attached |
|
19 |
o |
|
20 |
|
|
10 | 21 |
Field_group 7.x-1.0-rc2 |
11 | 22 |
o Ran through coder, minor. |
12 | 23 |
o Issue #1033036 by Stalski, swentel: Create a field_group.api.php. |
... | ... | |
20 | 31 |
o #1045526 by stalski: Make formatter options more user-friendly and logical. |
21 | 32 |
o #1041880 by robertgarrigos: duplicated entries in field_group table. |
22 | 33 |
o #1043834 by amsri: Field Group module just does not work with profiles 2. |
23 |
|
|
34 |
|
|
24 | 35 |
Field_group 7.x-1.0-rc1 |
25 | 36 |
o #1006464 Change #groups to #fieldgroups because of name collapsing with form_process_fieldset |
26 | 37 |
o #1024184 fix collapsible when mode is set to open |
... | ... | |
34 | 45 |
o #961106 Fixed notice on entity type and bundle check. |
35 | 46 |
o #962072 by mori: Improve CSS for horizontal tabs & accordion. |
36 | 47 |
o Changed Fieldgroup API: defaults and instance_settings are now merged. |
37 |
o Changed save action so everything is gathered during form_state to
|
|
48 |
o Changed save action so everything is gathered during form_state to |
|
38 | 49 |
postpone saving until the save button is hit. |
39 | 50 |
o Changed some important variable name, so it makes more sense and easier to read. |
40 | 51 |
o Add basic crud functions. |
drupal7/sites/all/modules/field_group/field_group.api.php | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Hooks provided by the Field group module.
|
|
5 |
* Hooks provided by the Field Group module.
|
|
6 | 6 |
* |
7 | 7 |
* Fieldgroup is a module that will wrap fields and other fieldgroups. Nothing more, nothing less. |
8 | 8 |
* For this there are formatters we can create on forms and view modes. |
drupal7/sites/all/modules/field_group/field_group.info | ||
---|---|---|
1 |
name = Fieldgroup
|
|
2 |
description = Fieldgroup
|
|
1 |
name = Field Group
|
|
2 |
description = "Provides the ability to group your fields on both form and display."
|
|
3 | 3 |
package = Fields |
4 | 4 |
dependencies[] = field |
5 | 5 |
dependencies[] = ctools |
6 | 6 |
core = 7.x |
7 |
files[] = field_group.install |
|
8 |
files[] = field_group.module |
|
9 |
files[] = field_group.field_ui.inc |
|
10 |
files[] = field_group.form.inc |
|
11 |
files[] = field_group.features.inc |
|
12 | 7 |
files[] = tests/field_group.ui.test |
13 | 8 |
files[] = tests/field_group.display.test |
14 |
; Information added by drupal.org packaging script on 2013-09-25
|
|
15 |
version = "7.x-1.3"
|
|
9 |
; Information added by Drupal.org packaging script on 2014-06-04
|
|
10 |
version = "7.x-1.4"
|
|
16 | 11 |
core = "7.x" |
17 | 12 |
project = "field_group" |
18 |
datestamp = "1380124361"
|
|
13 |
datestamp = "1401918529"
|
|
19 | 14 |
|
drupal7/sites/all/modules/field_group/field_group.install | ||
---|---|---|
310 | 310 |
|
311 | 311 |
// Only update feature field_groups this time. |
312 | 312 |
// Don't touch the fieldgroups in db. |
313 |
|
|
313 | 314 |
if ($row->export_type == EXPORT_IN_CODE) { |
314 |
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']); |
|
315 |
$classes = array(); |
|
316 |
|
|
317 |
if (isset($row->data['format_settings'], $row->data['format_settings']['instance_settings'], $row->data['format_settings']['instance_settings']['classes'])) { |
|
318 |
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']); |
|
319 |
} |
|
320 |
|
|
315 | 321 |
$optional_classes = array(str_replace("_", "-", $row->group_name), 'field-group-' . $row->data['format_type']); |
316 | 322 |
foreach ($optional_classes as $optional_class) { |
317 | 323 |
if (!in_array($optional_class, $classes)) { |
... | ... | |
325 | 331 |
} |
326 | 332 |
|
327 | 333 |
} |
334 |
|
|
335 |
/** |
|
336 |
* Id attributes are now a setting. This update will insert the old id in the setting so old |
|
337 |
* markup doesn't get broken. If you don't want an attribute, you can delete |
|
338 |
* them on the fieldgroup settings. |
|
339 |
*/ |
|
340 |
function field_group_update_7007() { |
|
341 |
|
|
342 |
ctools_include("export"); |
|
343 |
|
|
344 |
// Migrate the field groups so they have a unique identifier. |
|
345 |
$field_groups = ctools_export_load_object("field_group"); |
|
346 |
foreach ($field_groups as $row) { |
|
347 |
if ($row->data['format_type'] == 'div' || $row->data['format_type'] == 'html5' || $row->data['format_type'] == 'html-element') { |
|
348 |
|
|
349 |
// If mode is default, we don't know what view mode it was. Take full then. |
|
350 |
$view_mode = $row->mode == 'default' ? 'full' : $row->mode; |
|
351 |
$id = $row->entity_type . '_' . $row->bundle . '_' . $view_mode . '_' . $row->group_name; |
|
352 |
$row->data['format_settings']['instance_settings']['id'] = $id; |
|
353 |
} |
|
354 |
|
|
355 |
if ($row->export_type == EXPORT_IN_CODE) { |
|
356 |
unset($row->id); |
|
357 |
drupal_write_record('field_group', $row); |
|
358 |
} |
|
359 |
else { |
|
360 |
drupal_write_record('field_group', $row, array('id')); |
|
361 |
} |
|
362 |
} |
|
363 |
} |
drupal7/sites/all/modules/field_group/field_group.js | ||
---|---|---|
183 | 183 |
*/ |
184 | 184 |
Drupal.behaviors.fieldGroup = { |
185 | 185 |
attach: function (context, settings) { |
186 |
settings.field_group = settings.field_group || Drupal.settings.field_group; |
|
186 | 187 |
if (settings.field_group == undefined) { |
187 | 188 |
return; |
188 | 189 |
} |
drupal7/sites/all/modules/field_group/field_group.module | ||
---|---|---|
244 | 244 |
* Implements hook_field_attach_form(). |
245 | 245 |
*/ |
246 | 246 |
function field_group_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) { |
247 |
|
|
247 | 248 |
$form['#attached']['css'][] = drupal_get_path('module', 'field_group') . '/field_group.field_ui.css'; |
248 | 249 |
field_group_attach_groups($form, 'form', $form_state); |
249 | 250 |
$form['#pre_render'][] = 'field_group_form_pre_render'; |
... | ... | |
291 | 292 |
'html-element' => array( |
292 | 293 |
'label' => t('HTML element'), |
293 | 294 |
'description' => t('This fieldgroup renders the inner content in a HTML element with classes and attributes.'), |
294 |
'instance_settings' => array('element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1), |
|
295 |
'instance_settings' => array('element' => 'div', 'show_label' => 0, 'label_element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
|
295 | 296 |
), |
296 | 297 |
'div' => array( |
297 | 298 |
'label' => t('Div'), |
... | ... | |
303 | 304 |
'html5' => array( |
304 | 305 |
'label' => t('HTML5'), |
305 | 306 |
'description' => t('This fieldgroup renders the inner content in a semantic HTML5 wrapper'), |
306 |
'instance_settings' => array('wrapper' => '', 'classes' => ''), |
|
307 |
'instance_settings' => array('wrapper' => '', 'classes' => '', 'id' => ''),
|
|
307 | 308 |
), |
308 | 309 |
'fieldset' => array( |
309 | 310 |
'label' => t('Fieldset'), |
... | ... | |
365 | 366 |
'html-element' => array( |
366 | 367 |
'label' => t('HTML element'), |
367 | 368 |
'description' => t('This fieldgroup renders the inner content in a HTML element with classes and attributes.'), |
368 |
'instance_settings' => array('element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1), |
|
369 |
'instance_settings' => array('element' => 'div', 'show_label' => 0, 'label_element' => 'div', 'classes' => '', 'attributes' => '', 'required_fields' => 1),
|
|
369 | 370 |
), |
370 | 371 |
'div' => array( |
371 | 372 |
'label' => t('Div'), |
372 | 373 |
'description' => t('This fieldgroup renders the inner content in a simple div with the title as legend.'), |
373 | 374 |
'format_types' => array('open', 'collapsible', 'collapsed'), |
374 |
'instance_settings' => array('description' => '', 'show_label' => 1, 'label_element' => 'h3', 'effect' => 'none', 'speed' => 'fast', 'classes' => ''), |
|
375 |
'instance_settings' => array('description' => '', 'show_label' => 1, 'label_element' => 'h3', 'effect' => 'none', 'speed' => 'fast', 'classes' => '', 'id' => ''),
|
|
375 | 376 |
'default_formatter' => 'collapsible', |
376 | 377 |
), |
377 | 378 |
'html5' => array( |
378 | 379 |
'label' => t('HTML5'), |
379 | 380 |
'description' => t('This fieldgroup renders the inner content in a semantic HTML5 wrapper'), |
380 |
'instance_settings' => array('wrapper' => '', 'classes' => ''), |
|
381 |
'instance_settings' => array('wrapper' => '', 'classes' => '', 'id' => ''),
|
|
381 | 382 |
), |
382 | 383 |
'fieldset' => array( |
383 | 384 |
'label' => t('Fieldset'), |
... | ... | |
452 | 453 |
'#type' => 'select', |
453 | 454 |
'#options' => drupal_map_assoc($formatter['format_types']), |
454 | 455 |
'#default_value' => isset($group->format_settings['formatter']) ? $group->format_settings['formatter'] : $formatter['default_formatter'], |
455 |
'#weight' => 1,
|
|
456 |
'#weight' => -4,
|
|
456 | 457 |
); |
457 | 458 |
} |
458 | 459 |
|
... | ... | |
470 | 471 |
'#title' => t('ID'), |
471 | 472 |
'#type' => 'textfield', |
472 | 473 |
'#default_value' => isset($group->format_settings['instance_settings']['id']) ? $group->format_settings['instance_settings']['id'] : (isset($formatter['instance_settings']['id']) ? $formatter['instance_settings']['id'] : ''), |
473 |
'#weight' => 3,
|
|
474 |
'#weight' => 10,
|
|
474 | 475 |
'#element_validate' => array('field_group_validate_id'), |
475 | 476 |
); |
476 | 477 |
} |
... | ... | |
479 | 480 |
'#title' => t('Extra CSS classes'), |
480 | 481 |
'#type' => 'textfield', |
481 | 482 |
'#default_value' => isset($group->format_settings['instance_settings']['classes']) ? $group->format_settings['instance_settings']['classes'] : (isset($formatter['instance_settings']['classes']) ? $formatter['instance_settings']['classes'] : ''), |
482 |
'#weight' => 4,
|
|
483 |
'#weight' => 11,
|
|
483 | 484 |
'#element_validate' => array('field_group_validate_css_class'), |
484 | 485 |
); |
485 | 486 |
} |
... | ... | |
501 | 502 |
'#type' => 'textfield', |
502 | 503 |
'#default_value' => isset($group->format_settings['instance_settings']['element']) ? $group->format_settings['instance_settings']['element'] : $formatter['instance_settings']['element'], |
503 | 504 |
'#description' => t('E.g. div, section, aside etc.'), |
505 |
'#weight' => 1, |
|
506 |
); |
|
507 |
|
|
508 |
$form['instance_settings']['show_label'] = array( |
|
509 |
'#title' => t('Show label'), |
|
510 |
'#type' => 'select', |
|
511 |
'#options' => array(0 => t('No'), 1 => t('Yes')), |
|
512 |
'#default_value' => isset($group->format_settings['instance_settings']['show_label']) ? $group->format_settings['instance_settings']['show_label'] : $formatter['instance_settings']['show_label'], |
|
504 | 513 |
'#weight' => 2, |
505 | 514 |
); |
506 | 515 |
|
516 |
$form['instance_settings']['label_element'] = array( |
|
517 |
'#title' => t('Label element'), |
|
518 |
'#type' => 'textfield', |
|
519 |
'#default_value' => isset($group->format_settings['instance_settings']['label_element']) ? $group->format_settings['instance_settings']['label_element'] : $formatter['instance_settings']['label_element'], |
|
520 |
'#weight' => 3, |
|
521 |
); |
|
522 |
|
|
507 | 523 |
$form['instance_settings']['attributes'] = array( |
508 | 524 |
'#title' => t('Attributes'), |
509 | 525 |
'#type' => 'textfield', |
... | ... | |
533 | 549 |
'#type' => 'select', |
534 | 550 |
'#options' => array('none' => t('None'), 'blind' => t('Blind')), |
535 | 551 |
'#default_value' => isset($group->format_settings['instance_settings']['effect']) ? $group->format_settings['instance_settings']['effect'] : $formatter['instance_settings']['effect'], |
536 |
'#weight' => 2,
|
|
552 |
'#weight' => 3,
|
|
537 | 553 |
); |
538 | 554 |
$form['instance_settings']['speed'] = array( |
539 | 555 |
'#title' => t('Speed'), |
... | ... | |
617 | 633 |
$classes = _field_group_get_html_classes($group); |
618 | 634 |
|
619 | 635 |
$group->classes = implode(' ', $classes->required); |
620 |
$group->description = isset($group->format_settings['instance_settings']['description']) ? filter_xss_admin(t($group->format_settings['instance_settings']['description'])) : '';
|
|
636 |
$group->description = !empty($group->format_settings['instance_settings']['description']) ? filter_xss_admin(t($group->format_settings['instance_settings']['description'])) : '';
|
|
621 | 637 |
|
622 | 638 |
} |
623 | 639 |
|
... | ... | |
627 | 643 |
* @param Array $elements by address. |
628 | 644 |
* @param Object $group The Field group info. |
629 | 645 |
*/ |
630 |
function field_group_field_group_pre_render(& $element, &$group, & $form) {
|
|
646 |
function field_group_field_group_pre_render(&$element, &$group, & $form) { |
|
631 | 647 |
|
632 | 648 |
field_group_pre_render_prepare($group); |
633 | 649 |
|
... | ... | |
640 | 656 |
); |
641 | 657 |
|
642 | 658 |
if (isset($group->format_settings['instance_settings']['id']) && !empty($group->format_settings['instance_settings']['id'])) { |
643 |
$element['#id'] = $group->format_settings['instance_settings']['id']; |
|
644 |
} |
|
645 |
else { |
|
646 |
$element['#id'] = $form['#entity_type'] . '_' . $form['#bundle'] . '_' . $view_mode . '_' . $group->group_name; |
|
659 |
$element['#id'] = drupal_html_id($group->format_settings['instance_settings']['id']); |
|
647 | 660 |
} |
648 | 661 |
|
649 | 662 |
$element['#weight'] = $group->weight; |
... | ... | |
691 | 704 |
*/ |
692 | 705 |
function field_group_pre_render_html_element(&$element, $group, &$form) { |
693 | 706 |
$html_element = isset($group->format_settings['instance_settings']['element']) ? $group->format_settings['instance_settings']['element'] : 'div'; |
707 |
$show_label = isset($group->format_settings['instance_settings']['show_label']) ? $group->format_settings['instance_settings']['show_label'] : 0; |
|
708 |
$label_element = isset($group->format_settings['instance_settings']['label_element']) ? $group->format_settings['instance_settings']['label_element'] : 'div'; |
|
694 | 709 |
$attributes = isset($group->format_settings['instance_settings']['attributes']) ? ' ' . $group->format_settings['instance_settings']['attributes'] : ''; |
695 | 710 |
$group->classes = trim($group->classes); |
696 | 711 |
|
... | ... | |
715 | 730 |
$attributes = drupal_attributes($element_attributes); |
716 | 731 |
|
717 | 732 |
$element['#prefix'] = '<' . $html_element . $attributes . '>'; |
733 |
if ($show_label) { |
|
734 |
$element['#prefix'] .= '<' . $label_element . '><span>' . check_plain(t($group->label)) . '</span></' . $label_element . '>'; |
|
735 |
} |
|
718 | 736 |
$element['#suffix'] = '</' . $html_element . '>'; |
719 | 737 |
} |
720 | 738 |
|
... | ... | |
733 | 751 |
$effect = isset($group->format_settings['instance_settings']['effect']) ? $group->format_settings['instance_settings']['effect'] : 'none'; |
734 | 752 |
|
735 | 753 |
$element['#type'] = 'markup'; |
754 |
$id = isset($element['#id']) ? ' id="' . $element['#id'] . '"' : ''; |
|
755 |
|
|
736 | 756 |
if ($group->format_settings['formatter'] != 'open') { |
737 |
$element['#prefix'] = '<div id="' . $element['#id'] . '" class="' . $group->classes . '"> |
|
757 |
|
|
758 |
$element['#prefix'] = '<div' . $id . ' class="' . $group->classes . '"> |
|
738 | 759 |
<' . $label_element . '><span class="field-group-format-toggler">' . check_plain(t($group->label)) . '</span></' . $label_element . '> |
739 | 760 |
<div class="field-group-format-wrapper" style="display: ' . (!empty($group->collapsed) ? 'none' : 'block') . ';">'; |
740 | 761 |
$element['#suffix'] = '</div></div>'; |
741 | 762 |
} |
742 | 763 |
else { |
743 |
$class_attribute = ''; |
|
744 |
if (!empty($group->classes)) { |
|
745 |
$class_attribute = 'class = "' . $group->classes . '"'; |
|
746 |
} |
|
747 |
$element['#prefix'] = '<div id="' . $element['#id'] . '"' . $class_attribute . '>'; |
|
764 |
$class_attribute = !empty($group->classes) ? ' class="' . $group->classes . '"' : ''; |
|
765 |
|
|
766 |
$element['#prefix'] = '<div' . $id . $class_attribute . '>'; |
|
748 | 767 |
if ($show_label) { |
749 | 768 |
$element['#prefix'] .= '<' . $label_element . '><span>' . check_plain(t($group->label)) . '</span></' . $label_element . '>'; |
750 | 769 |
} |
... | ... | |
769 | 788 |
* @param $form The root element or form. |
770 | 789 |
*/ |
771 | 790 |
function field_group_pre_render_html5(&$element, $group, &$form) { |
791 |
$id = !empty($element['#id']) ? ' id="' . $element['#id'] . '"' : ''; |
|
792 |
$class = !empty($group->classes) ? ' class="' . $group->classes . '"' : ''; |
|
772 | 793 |
$element += array( |
773 | 794 |
'#type' => 'markup', |
774 |
'#prefix' => '<' . $group->format_settings['instance_settings']['wrapper'] . ' id="' . $element['#id'] . '" class="' . $group->classes . '">',
|
|
795 |
'#prefix' => '<' . $group->format_settings['instance_settings']['wrapper'] . $id . $class . '>',
|
|
775 | 796 |
'#suffix' => '</' . $group->format_settings['instance_settings']['wrapper'] . '>', |
776 | 797 |
); |
777 | 798 |
} |
... | ... | |
1113 | 1134 |
$hasChildren = FALSE; |
1114 | 1135 |
if (count($children)) { |
1115 | 1136 |
foreach ($children as $childname) { |
1137 |
|
|
1116 | 1138 |
if (in_array($childname, $groups)) { |
1117 | 1139 |
field_group_remove_empty_form_groups($childname, $element[$childname], $groups, $form_groups, $entity); |
1118 | 1140 |
} |
1119 | 1141 |
$exception = $entity . '__' . $childname; |
1120 |
$hasChildren = $hasChildren ? TRUE : (isset($element[$childname]['#type']) || in_array($exception, $exceptions)); |
|
1142 |
$hasChildren = $hasChildren ? TRUE : (isset($element[$childname]['#type']) || isset($element[$childname]['#markup']) || in_array($exception, $exceptions)); |
|
1143 |
|
|
1121 | 1144 |
} |
1122 | 1145 |
} |
1123 | 1146 |
|
... | ... | |
1443 | 1466 |
'#default_value' => $element['#default_control'], |
1444 | 1467 |
'#attributes' => array('class' => array('multipage-active-control')), |
1445 | 1468 |
); |
1446 |
|
|
1469 |
|
|
1447 | 1470 |
return $element; |
1448 | 1471 |
} |
1449 | 1472 |
|
... | ... | |
1566 | 1589 |
$groups = $cached->data; |
1567 | 1590 |
} |
1568 | 1591 |
else { |
1569 |
drupal_static_reset('ctools_export_load_object'); |
|
1570 |
drupal_static_reset('ctools_export_load_object_all'); |
|
1592 |
$ctools_export_load_object = &drupal_static('ctools_export_load_object'); |
|
1593 |
$ctools_export_load_object_all = &drupal_static('ctools_export_load_object_all'); |
|
1594 |
unset($ctools_export_load_object['field_group']); |
|
1595 |
unset($ctools_export_load_object_all['field_group']); |
|
1571 | 1596 |
$groups = field_group_read_groups(); |
1572 | 1597 |
cache_set('field_groups', $groups, 'cache_field'); |
1573 | 1598 |
} |
... | ... | |
1680 | 1705 |
* Field group object. |
1681 | 1706 |
*/ |
1682 | 1707 |
function field_group_unpack($packed_group) { |
1683 |
if (!isset($packed_group->data)) {
|
|
1708 |
if (empty($packed_group->data)) {
|
|
1684 | 1709 |
return $packed_group; |
1685 | 1710 |
} |
1686 | 1711 |
|
... | ... | |
1847 | 1872 |
/** |
1848 | 1873 |
* Pre render callback for rendering groups. |
1849 | 1874 |
* @see field_group_field_attach_form |
1850 |
* @param $element Form that is beïng rendered.
|
|
1875 |
* @param $element Form that is being rendered.
|
|
1851 | 1876 |
*/ |
1852 | 1877 |
function field_group_form_pre_render(&$element) { |
1853 | 1878 |
return field_group_build_entity_groups($element, 'form'); |
... | ... | |
1860 | 1885 |
* @see field_group_theme_registry_alter |
1861 | 1886 |
* @see field_group_fields_nest() |
1862 | 1887 |
* @param $vars preprocess vars or form element |
1863 |
* @param $type The type of object beïng rendered
|
|
1888 |
* @param $type The type of object being rendered
|
|
1864 | 1889 |
* @return $element Array with re-arranged fields in forms. |
1865 | 1890 |
*/ |
1866 | 1891 |
function field_group_build_entity_groups(&$vars, $type) { |
... | ... | |
1890 | 1915 |
return $element; |
1891 | 1916 |
} |
1892 | 1917 |
|
1918 |
// No groups on the entity. Prerender removed empty field groups. |
|
1919 |
if (empty($element['#fieldgroups'])) { |
|
1920 |
return $element; |
|
1921 |
} |
|
1922 |
|
|
1893 | 1923 |
// Put groups inside content if we are rendering an entity_view. |
1894 |
foreach ($element['#groups'] as $group) { |
|
1924 |
foreach ($element['#fieldgroups'] as $group) {
|
|
1895 | 1925 |
if (!empty($element[$group->group_name]) && $type != 'user_profile') { |
1896 | 1926 |
$vars['content'][$group->group_name] = $element[$group->group_name]; |
1897 | 1927 |
} |
... | ... | |
1914 | 1944 |
* @param Array $element |
1915 | 1945 |
* The current element to analyse for grouping. |
1916 | 1946 |
* @param Array $vars |
1917 |
* Rendering vars from the entity beïng viewed.
|
|
1947 |
* Rendering vars from the entity being viewed.
|
|
1918 | 1948 |
*/ |
1919 | 1949 |
function field_group_fields_nest(&$element, &$vars = NULL) { |
1920 | 1950 |
|
... | ... | |
1947 | 1977 |
// Entity being viewed |
1948 | 1978 |
if ($vars) { |
1949 | 1979 |
// If not a group, check vars['content'] for empty field. |
1950 |
if (!isset($element['#groups'][$child_name]) && isset($vars['content'][$child_name])) { |
|
1980 |
if (!isset($element['#fieldgroups'][$child_name]) && isset($vars['content'][$child_name])) {
|
|
1951 | 1981 |
$group_references[$parent_name][$child_name] = $vars['content'][$child_name]; |
1952 | 1982 |
unset($vars['content'][$child_name]); |
1953 | 1983 |
} |
1954 |
elseif (!isset($element['#groups'][$child_name]) && isset($vars['user_profile'][$child_name])) { |
|
1984 |
elseif (!isset($element['#fieldgroups'][$child_name]) && isset($vars['user_profile'][$child_name])) {
|
|
1955 | 1985 |
$group_references[$parent_name][$child_name] = $vars['user_profile'][$child_name]; |
1956 | 1986 |
unset($vars['user_profile'][$child_name]); |
1957 | 1987 |
} |
drupal7/sites/all/modules/field_group/horizontal-tabs/horizontal-tabs.js | ||
---|---|---|
50 | 50 |
if (!tab_focus) { |
51 | 51 |
// If the current URL has a fragment and one of the tabs contains an |
52 | 52 |
// element that matches the URL fragment, activate that tab. |
53 |
if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) { |
|
53 |
var hash = window.location.hash.replace(/[=%;,\/]/g, ""); |
|
54 |
if (hash !== '#' && $(hash, this).length) { |
|
54 | 55 |
tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane'); |
55 | 56 |
} |
56 | 57 |
else { |
drupal7/sites/all/modules/field_group/multipage/multipage.js | ||
---|---|---|
1 | 1 |
(function ($) { |
2 | 2 |
|
3 | 3 |
/** |
4 |
* This script transforms a set of wrappers into a stack of multipage pages.
|
|
4 |
* This script transforms a set of wrappers into a stack of multipage pages. |
|
5 | 5 |
* Another pane can be entered by clicking next/previous. |
6 | 6 |
* |
7 | 7 |
*/ |
... | ... | |
24 | 24 |
|
25 | 25 |
// Transform each div.multipage-pane into a multipage with controls. |
26 | 26 |
$panes.each(function () { |
27 |
|
|
27 |
|
|
28 | 28 |
$controls = $('<div class="multipage-controls-list clearfix"></div>'); |
29 | 29 |
$(this).append($controls); |
30 |
|
|
30 |
|
|
31 | 31 |
// Check if the submit button needs to move to the latest pane. |
32 | 32 |
if (Drupal.settings.field_group.multipage_move_submit && $('.form-actions').length) { |
33 | 33 |
$('.form-actions', $form).remove().appendTo($($controls, $panes.last())); |
34 | 34 |
} |
35 |
|
|
35 |
|
|
36 | 36 |
var multipageControl = new Drupal.multipageControl({ |
37 | 37 |
title: $('> .multipage-pane-title', this).text(), |
38 | 38 |
wrapper: $(this), |
39 | 39 |
has_next: $(this).next().length, |
40 | 40 |
has_previous: $(this).prev().length |
41 | 41 |
}); |
42 |
|
|
42 |
|
|
43 | 43 |
$controls.append(multipageControl.item); |
44 | 44 |
$(this) |
45 | 45 |
.addClass('multipage-pane') |
... | ... | |
48 | 48 |
if (this.id == focusID) { |
49 | 49 |
paneWithFocus = $(this); |
50 | 50 |
} |
51 |
|
|
51 |
|
|
52 | 52 |
}); |
53 | 53 |
|
54 | 54 |
if (paneWithFocus === undefined) { |
55 | 55 |
// If the current URL has a fragment and one of the tabs contains an |
56 | 56 |
// element that matches the URL fragment, activate that tab. |
57 |
if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) { |
|
57 |
var hash = window.location.hash.replace(/[=%;,\/]/g, ""); |
|
58 |
if (hash !== '#' && $(hash, this).length) { |
|
58 | 59 |
paneWithFocus = $(window.location.hash, this).closest('.multipage-pane'); |
59 | 60 |
} |
60 | 61 |
else { |
... | ... | |
85 | 86 |
self.nextPage(); |
86 | 87 |
return false; |
87 | 88 |
}); |
88 |
|
|
89 |
|
|
89 | 90 |
this.previousLink.click(function () { |
90 | 91 |
self.previousPage(); |
91 | 92 |
return false; |
92 | 93 |
}); |
93 |
|
|
94 |
|
|
94 | 95 |
/* |
95 | 96 |
// Keyboard events added: |
96 | 97 |
// Pressing the Enter key will open the tab pane. |
... | ... | |
116 | 117 |
}; |
117 | 118 |
|
118 | 119 |
Drupal.multipageControl.prototype = { |
119 |
|
|
120 |
|
|
120 | 121 |
/** |
121 | 122 |
* Displays the tab's content pane. |
122 | 123 |
*/ |
... | ... | |
135 | 136 |
$('#active-multipage-control').remove(); |
136 | 137 |
this.nextLink.after('<span id="active-multipage-control" class="element-invisible">' + Drupal.t('(active page)') + '</span>'); |
137 | 138 |
}, |
138 |
|
|
139 |
|
|
139 | 140 |
/** |
140 | 141 |
* Continues to the next page or step in the form. |
141 | 142 |
*/ |
... | ... | |
143 | 144 |
this.wrapper.next().data('multipageControl').focus(); |
144 | 145 |
$('html, body').scrollTop(this.wrapper.parents('.field-group-multipage-group-wrapper').offset().top); |
145 | 146 |
}, |
146 |
|
|
147 |
|
|
147 | 148 |
/** |
148 | 149 |
* Returns to the previous page or step in the form. |
149 | 150 |
*/ |
... | ... | |
210 | 211 |
|
211 | 212 |
var controls = {}; |
212 | 213 |
controls.item = $('<span class="multipage-button"></span>'); |
213 |
|
|
214 |
|
|
214 | 215 |
controls.previousLink = $('<input type="button" class="form-submit multipage-link-previous" value="" />'); |
215 | 216 |
controls.previousTitle = Drupal.t('Previous page'); |
216 |
controls.item.append(controls.previousLink.val(controls.previousTitle));
|
|
217 |
|
|
217 |
controls.item.append(controls.previousLink.val(controls.previousTitle)); |
|
218 |
|
|
218 | 219 |
controls.nextLink = $('<input type="button" class="form-submit multipage-link-next" value="" />'); |
219 | 220 |
controls.nextTitle = Drupal.t('Next page'); |
220 | 221 |
controls.item.append(controls.nextLink.val(controls.nextTitle)); |
221 |
|
|
222 |
|
|
222 | 223 |
if (!settings.has_next) { |
223 | 224 |
controls.nextLink.hide(); |
224 | 225 |
} |
225 | 226 |
if (!settings.has_previous) { |
226 | 227 |
controls.previousLink.hide(); |
227 | 228 |
} |
228 |
|
|
229 |
|
|
229 | 230 |
return controls; |
230 | 231 |
}; |
231 | 232 |
|
... | ... | |
239 | 240 |
Drupal.FieldGroup.Effects.processMultipage = { |
240 | 241 |
execute: function (context, settings, type) { |
241 | 242 |
if (type == 'form') { |
242 |
|
|
243 |
|
|
243 | 244 |
var $firstErrorItem = false; |
244 |
|
|
245 |
|
|
245 | 246 |
// Add required fields mark to any element containing required fields |
246 | 247 |
$('div.multipage-pane').each(function(i){ |
247 | 248 |
if ($('.error', $(this)).length) { |
248 |
|
|
249 |
|
|
249 | 250 |
// Save first error item, for focussing it. |
250 | 251 |
if (!$firstErrorItem) { |
251 | 252 |
$firstErrorItem = $(this).data('multipageControl'); |
252 |
}
|
|
253 |
|
|
253 |
} |
|
254 |
|
|
254 | 255 |
Drupal.FieldGroup.setGroupWithfocus($(this)); |
255 | 256 |
$(this).data('multipageControl').focus(); |
256 | 257 |
} |
... | ... | |
260 | 261 |
if ($firstErrorItem) { |
261 | 262 |
$firstErrorItem.focus(); |
262 | 263 |
} |
263 |
|
|
264 |
|
|
264 | 265 |
} |
265 | 266 |
} |
266 | 267 |
} |
drupal7/sites/all/modules/field_group/tests/field_group.ui.test | ||
---|---|---|
13 | 13 |
public static function getInfo() { |
14 | 14 |
return array( |
15 | 15 |
'name' => 'UI tests', |
16 |
'description' => 'Test the field group UI.',
|
|
17 |
'group' => 'Field group',
|
|
16 |
'description' => 'Test the Field Group UI.',
|
|
17 |
'group' => 'Field Group',
|
|
18 | 18 |
); |
19 | 19 |
} |
20 | 20 |
|
drupal7/sites/all/modules/field_group/tests/field_group_test.info | ||
---|---|---|
1 |
name = "Fieldgroup Test"
|
|
2 |
description = "Test module for fieldgroup"
|
|
1 |
name = "Field Group Test"
|
|
2 |
description = "Test module for Field Group"
|
|
3 | 3 |
core = "7.x" |
4 |
package = "Fieldgroup" |
|
4 |
package = Fields |
|
5 |
hidden = TRUE |
|
5 | 6 |
|
6 | 7 |
|
7 |
; Information added by drupal.org packaging script on 2013-09-25
|
|
8 |
version = "7.x-1.3"
|
|
8 |
; Information added by Drupal.org packaging script on 2014-06-04
|
|
9 |
version = "7.x-1.4"
|
|
9 | 10 |
core = "7.x" |
10 | 11 |
project = "field_group" |
11 |
datestamp = "1380124361"
|
|
12 |
datestamp = "1401918529"
|
|
12 | 13 |
|
drupal7/sites/all/modules/piwik/piwik.admin.inc | ||
---|---|---|
83 | 83 |
// Page specific visibility configurations. |
84 | 84 |
$php_access = user_access('use PHP for tracking visibility'); |
85 | 85 |
$visibility = variable_get('piwik_visibility_pages', 0); |
86 |
$pages = variable_get('piwik_pages', '');
|
|
86 |
$pages = variable_get('piwik_pages', PIWIK_PAGES);
|
|
87 | 87 |
|
88 | 88 |
$form['tracking']['page_vis_settings'] = array( |
89 | 89 |
'#type' => 'fieldset', |
... | ... | |
175 | 175 |
'#type' => 'fieldset', |
176 | 176 |
'#title' => t('Links and downloads'), |
177 | 177 |
); |
178 |
$form['tracking']['linktracking']['piwik_trackmailto'] = array( |
|
179 |
'#type' => 'checkbox', |
|
180 |
'#title' => t('Track clicks on mailto links'), |
|
181 |
'#default_value' => variable_get('piwik_trackmailto', 1), |
|
182 |
); |
|
178 | 183 |
$form['tracking']['linktracking']['piwik_track'] = array( |
179 | 184 |
'#type' => 'checkbox', |
180 | 185 |
'#title' => t('Track clicks on outbound links and downloads (clicks on file links) for the following extensions'), |
... | ... | |
184 | 189 |
'#title' => t('List of download file extensions'), |
185 | 190 |
'#title_display' => 'invisible', |
186 | 191 |
'#type' => 'textfield', |
187 |
'#default_value' => variable_get('piwik_trackfiles_extensions', PK_TRACKFILES_EXTENSIONS), |
|
188 |
'#description' => t('A file extension list separated by the | character that will be tracked when clicked. Regular expressions are supported. For example: !extensions', array('!extensions' => PK_TRACKFILES_EXTENSIONS)), |
|
192 |
'#default_value' => variable_get('piwik_trackfiles_extensions', PIWIK_TRACKFILES_EXTENSIONS),
|
|
193 |
'#description' => t('A file extension list separated by the | character that will be tracked when clicked. Regular expressions are supported. For example: !extensions', array('!extensions' => PIWIK_TRACKFILES_EXTENSIONS)),
|
|
189 | 194 |
'#maxlength' => 255, |
195 |
'#states' => array( |
|
196 |
'enabled' => array( |
|
197 |
':input[name="piwik_track"]' => array('checked' => TRUE), |
|
198 |
), |
|
199 |
# Note: Form required marker is not visible as title is invisible. |
|
200 |
'required' => array( |
|
201 |
':input[name="piwik_track"]' => array('checked' => TRUE), |
|
202 |
), |
|
203 |
), |
|
204 |
); |
|
205 |
|
|
206 |
// Message specific configurations. |
|
207 |
$form['tracking']['messagetracking'] = array( |
|
208 |
'#type' => 'fieldset', |
|
209 |
'#title' => t('Messages'), |
|
210 |
); |
|
211 |
$form['tracking']['messagetracking']['piwik_trackmessages'] = array( |
|
212 |
'#type' => 'checkboxes', |
|
213 |
'#title' => t('Track messages of type'), |
|
214 |
'#default_value' => variable_get('piwik_trackmessages', array()), |
|
215 |
'#description' => t('This will track the selected message types shown to users. Tracking of form validation errors may help you identifying usability issues in your site. Every message is tracked as one individual event. Messages from excluded pages cannot tracked.'), |
|
216 |
'#options' => array( |
|
217 |
'status' => t('Status message'), |
|
218 |
'warning' => t('Warning message'), |
|
219 |
'error' => t('Error message'), |
|
220 |
), |
|
190 | 221 |
); |
191 | 222 |
|
192 | 223 |
$form['tracking']['search'] = array( |
... | ... | |
358 | 389 |
$form['advanced']['piwik_js_scope'] = array( |
359 | 390 |
'#type' => 'select', |
360 | 391 |
'#title' => t('JavaScript scope'), |
361 |
'#description' => t("<strong>Warning:</strong> Adding the external JavaScript files to the footer region is recommended for performance reasons."),
|
|
392 |
'#description' => t("Piwik recommends adding the tracking code to the header for performance reasons."),
|
|
362 | 393 |
'#options' => array( |
363 | 394 |
'footer' => t('Footer'), |
364 | 395 |
'header' => t('Header'), |
365 | 396 |
), |
366 |
'#default_value' => variable_get('piwik_js_scope', 'footer'),
|
|
397 |
'#default_value' => variable_get('piwik_js_scope', 'header'),
|
|
367 | 398 |
); |
368 | 399 |
|
369 | 400 |
return system_settings_form($form); |
drupal7/sites/all/modules/piwik/piwik.admin.js | ||
---|---|---|
66 | 66 |
|
67 | 67 |
$('fieldset#edit-linktracking', context).drupalSetSummary(function (context) { |
68 | 68 |
var vals = []; |
69 |
if ($('input#edit-piwik-trackmailto', context).is(':checked')) { |
|
70 |
vals.push(Drupal.t('Mailto links')); |
|
71 |
} |
|
69 | 72 |
if ($('input#edit-piwik-track', context).is(':checked')) { |
70 | 73 |
vals.push(Drupal.t('Outbound links')); |
71 | 74 |
vals.push(Drupal.t('Downloads')); |
... | ... | |
75 | 78 |
} |
76 | 79 |
return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); |
77 | 80 |
}); |
78 |
|
|
81 |
|
|
82 |
$('fieldset#edit-messagetracking', context).drupalSetSummary(function (context) { |
|
83 |
var vals = []; |
|
84 |
$('input[type="checkbox"]:checked', context).each(function () { |
|
85 |
vals.push($.trim($(this).next('label').text())); |
|
86 |
}); |
|
87 |
if (!vals.length) { |
|
88 |
return Drupal.t('Not tracked'); |
|
89 |
} |
|
90 |
return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); |
|
91 |
}); |
|
92 |
|
|
79 | 93 |
$('fieldset#edit-search', context).drupalSetSummary(function (context) { |
80 | 94 |
var vals = []; |
81 | 95 |
if ($('input#edit-piwik-site-search', context).is(':checked')) { |
drupal7/sites/all/modules/piwik/piwik.info | ||
---|---|---|
1 |
name = "Piwik Web analytics"
|
|
1 |
name = "Piwik Web Analytics"
|
|
2 | 2 |
description = Adds Piwik javascript tracking code to all your site's pages. |
3 | 3 |
core = 7.x |
4 | 4 |
package = Statistics |
5 | 5 |
configure = admin/config/system/piwik |
6 | 6 |
files[] = piwik.test |
7 | 7 |
test_dependencies[] = token |
8 |
; Information added by drupal.org packaging script on 2012-11-24 |
|
9 |
version = "7.x-2.4" |
|
8 |
; Information added by Drupal.org packaging script on 2014-06-07 |
|
9 |
version = "7.x-2.5" |
Formats disponibles : Unified diff
Weekly update of contrib modules