You are here

ldap_help.module in Lightweight Directory Access Protocol (LDAP) 7

The ldaphelp module is a module to help admins debug ldap_integration modules.

File

ldap_help/ldap_help.module
View source
<?php

// $Id: ldap_help.module,v 1.1.2.1 2011/02/08 06:14:20 johnbarclay Exp $

/**
 * @file
 * The ldaphelp module is a module to help admins debug ldap_integration modules.
 *
 */

/**
 * Implements hook_init().
 */
function ldap_help_init() {
  drupal_add_css(drupal_get_path('module', 'ldap_help') . '/ldap_help.css', 'module');
}

/**
 * Implements hook_menu().
 */
function ldap_help_menu() {
  $items = array();
  $items['admin/config/people/ldap/help'] = array(
    'title' => 'Help',
    'type' => MENU_LOCAL_TASK,
    'weight' => 9,
    'description' => 'Debugging and Configuration Help with LDAP',
    'file' => 'ldap_help.resources.inc',
    'page callback' => 'ldap_help_main',
    'access arguments' => array(
      'administer site configuration',
    ),
  );
  $items['admin/config/people/ldap/help/intro'] = array(
    'title' => 'Resources',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/people/ldap/help/status'] = array(
    'title' => 'Status',
    'description' => 'LDAP status page',
    'page callback' => 'ldap_help_status',
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'ldap_help.status.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 4,
  );
  $items['admin/config/people/ldap/help/watchdog'] = array(
    'title' => 'Watchdog',
    'description' => 'LDAP watchdog logs',
    'page callback' => 'ldap_help_watchdog',
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'ldap_help.watchdog.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 5,
  );
  $items['admin/config/people/ldap/help/issues'] = array(
    'title' => 'Issue Reporting',
    'description' => 'Creating LDAP Issue Queue Items',
    'page callback' => 'ldap_help_issues',
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'ldap_help.issues.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 7,
  );
  return $items;
}
function ldap_help_form_ldap_servers_settings_alter(&$form, &$form_state) {
  $form['watchdog_detail'] = array(
    '#type' => 'fieldset',
    '#title' => t('Log detailed LDAP Actions'),
  );
  $form['watchdog_detail']['watchdog_detail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enabled Detailed LDAP Watchdog logging.  This is generally for
       debugging and reporting issues with the ldap modules and should not be left
       on.'),
    '#default_value' => variable_get('ldap_help_watchdog_detail', 0),
  );
  $form['#submit'][] = 'ldap_help_watchdog_detail_submit';
}
function ldap_help_watchdog_detail_submit($form, &$form_state) {
  if ($form_state['submitted']) {
    $watchdog_detail = $form_state['values']['watchdog_detail'];
    if ($watchdog_detail != variable_get('ldap_help_watchdog_detail', 0)) {
      variable_set('ldap_help_watchdog_detail', $watchdog_detail);
    }
  }
}