You are here

function drupalchat_settings_form in DrupalChat 6

Same name and namespace in other branches
  1. 6.2 drupalchat.admin.inc \drupalchat_settings_form()
  2. 7.2 drupalchat.admin.inc \drupalchat_settings_form()
  3. 7 drupalchat.admin.inc \drupalchat_settings_form()

Callback for admin/settings/drupalchat.

1 string reference to 'drupalchat_settings_form'
drupalchat_menu in ./drupalchat.module
Implementaiton of hook_menu()

File

includes/drupalchat.admin.inc, line 10
Administrative functions to configure DrupalChat.

Code

function drupalchat_settings_form() {

  // Alert the administrator to still required items for basic functionality.
  if (!variable_get('drupalchat_ur_name', NULL) && variable_get('drupalchat_ur_activate', FALSE)) {
    drupal_set_message(t("You must provide the user relationship name in the %info section.", array(
      '%info' => t('User Relationship Name to integrate with'),
    )), 'error');
  }
  $form = array();
  $form['drupalchat'] = array(
    '#type' => 'fieldset',
    '#title' => t('DrupalChat Settings'),
    '#collapsible' => TRUE,
  );
  $form['drupalchat']['drupalchat_refresh_rate'] = array(
    '#type' => 'textfield',
    '#title' => t('Refesh Rate'),
    '#description' => t('It is the time interval after which DrupalChat checks for new messages. The value is in seconds.'),
    '#default_value' => variable_get('drupalchat_refresh_rate', 2),
  );
  $form['drupalchat']['drupalchat_send_rate'] = array(
    '#type' => 'textfield',
    '#title' => t('Delay in sending messages'),
    '#description' => t('It is the delay in sending messages to the server. The value is in seconds.'),
    '#default_value' => variable_get('drupalchat_send_rate', 2),
  );
  $form['drupalchat']['drupalchat_polling_method'] = array(
    '#type' => 'radios',
    '#title' => t('Choose Polling Method'),
    '#default_value' => variable_get('drupalchat_polling_method', 0),
    '#options' => array(
      0 => t('Normal AJAX'),
      1 => t('Long Polling'),
    ),
    '#description' => t('Set the polling method to be used. If unsure don\'t change the default value.'),
    '#weight' => -1,
  );
  $form['drupalchat_ur'] = array(
    '#type' => 'fieldset',
    '#title' => t('DrupalChat UR Settings'),
    '#collapsible' => TRUE,
  );
  $form['drupalchat_ur']['drupalchat_ur_activate'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable integration with User Relationships module'),
    '#default_value' => variable_get('drupalchat_ur_activate', FALSE),
    '#description' => t("If checked, only the users sharing the relationship listed below will be able to chat among themselves."),
  );
  $form['drupalchat_ur']['drupalchat_ur_name'] = array(
    '#type' => 'textfield',
    '#title' => t('User Relationships Role Name to integrate with'),
    '#description' => t('It should be the singular form of User Relationships Role Name. Example: buddy, friend, coworker, spouse.'),
    '#default_value' => variable_get('drupalchat_ur_name', NULL),
  );
  if (!module_exists('drupalchat_ur')) {
    $form['drupalchat_ur']['drupalchat_ur_activate']['#disabled'] = TRUE;
    $form['drupalchat_ur']['drupalchat_ur_name']['#disabled'] = TRUE;
    $form['drupalchat_ur']['drupalchat_ur_activate']['#default_value'] = FALSE;
  }
  return system_settings_form($form);
}