You are here

function protected_pages_settings in Protected Pages 7

Same name and namespace in other branches
  1. 7.2 protected_pages.admin.inc \protected_pages_settings()

Callback function for protected pages settings.

1 string reference to 'protected_pages_settings'
protected_pages_menu in ./protected_pages.module
Implements hook_menu().

File

./protected_pages.admin.inc, line 374
Provides page callbacks for configuration page.

Code

function protected_pages_settings() {
  $form['protected_pages_password_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Protected Pages Password Settings'),
    '#description' => t('Configure password related settings.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $global_password_help_text = array();
  $global_password_help_text[] = t('Allow per page password = Only per page password will be accepted. Global password will not be accepted.');
  $global_password_help_text[] = t('Allow per page password or Global password = Per page  password and global password both will be accepted.');
  $global_password_help_text[] = t('Allow Only Global = Only global password will be accepted for each protected page.');
  $form['protected_pages_password_fieldset']['protected_pages_user_global_password'] = array(
    '#type' => 'select',
    '#title' => t('Global Password Setting'),
    '#default_value' => variable_get('protected_pages_user_global_password', 'per_page_or_global'),
    '#options' => array(
      'per_page_password' => t('Allow per page password'),
      'per_page_or_global' => t('Allow per page password or Global password'),
      'only_global' => t('Allow Only Global'),
    ),
    '#description' => t('Please select the appropriate option for protected pages handling.') . '<br />' . theme('item_list', array(
      'items' => $global_password_help_text,
    )),
  );
  $form['protected_pages_password_fieldset']['protected_pages_global_password_field'] = array(
    '#type' => 'password_confirm',
    '#title' => t('Global Password'),
    '#description' => t('The default password for all protected pages. This
      password is necessary if you select the previous checkbox "Allow per page
      password or Global password" or "Allow Only Global" options above.'),
  );
  $form['protected_pages_password_fieldset']['protected_pages_session_expire_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Session Expire Time'),
    '#description' => t('When user enters password a session is created.
      The node will be accessible untill session expire. Once session expires,
      user will need to enter password again. The default session expire time
      is 0 (unlimited).'),
    '#default_value' => variable_get('protected_pages_session_expire_time', 0),
    '#required' => TRUE,
    '#size' => 10,
    '#element_validate' => array(
      'protected_pages_validate_integer_positive',
    ),
    '#field_suffix' => t('in minutes'),
  );
  $form['protected_pages_email_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Protected pages email settings'),
    '#description' => t('The following settings allows admin to send emails to multiple users about protected pages details to access protected pages.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['protected_pages_email_fieldset']['protected_pages_email_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Email subject'),
    '#default_value' => variable_get('protected_pages_email_subject', protected_pages_email_subject()),
    '#description' => t('Enter the subject of the email.'),
  );
  $form['protected_pages_email_fieldset']['protected_pages_email_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Email content'),
    '#rows' => 15,
    '#default_value' => variable_get('protected_pages_email_body', protected_pages_email_body()),
    '#description' => t('Enter the body of the email. Only [protected-page-url] and [site-name] tokens are available.
      Since password is encrypted, therefore we can not provide it by token.'),
  );
  $form['protected_pages_other_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Protected Pages Other Settings'),
    '#description' => t('Configure other settings.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['protected_pages_other_fieldset']['protected_pages_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Password page title'),
    '#default_value' => variable_get('protected_pages_title', t('Protected Page -- Enter password')),
    '#description' => t('Enter the title of the protected page.'),
  );
  $form['protected_pages_other_fieldset']['protected_pages_description'] = array(
    '#type' => 'textarea',
    '#title' => t('Password page description (inside the field set)'),
    '#default_value' => variable_get('protected_pages_description', t('The page you are trying to view is password protected. Please enter the password below to proceed.')),
    '#description' => t('Enter specific description for the protected page. This description is displayed inside the fieldset. HTML is accepted.'),
  );
  $form['protected_pages_other_fieldset']['protected_pages_password_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Password field label'),
    '#default_value' => variable_get('protected_pages_password_label', t('Enter Password')),
    '#description' => t('Enter the text for the password field label.'),
  );
  $form['protected_pages_other_fieldset']['protected_pages_submit_button_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Submit Button Text'),
    '#default_value' => variable_get('protected_pages_submit_button_text', t('Authenticate')),
    '#description' => t('Enter the text for the submit button of enter password form.'),
  );
  $form['#submit'][] = '_protected_pages_settings_submit';
  return system_settings_form($form);
}