You are here

function deploy_ahah_auth_form in Deploy - Content Staging 6

A generic AHAH form callback that returns the authentication form for a server or a authentication type.

1 string reference to 'deploy_ahah_auth_form'
deploy_menu in ./deploy.module
Implementation of hook_menu().

File

./deploy.module, line 927
Deployment API which enables modules to deploy items between servers.

Code

function deploy_ahah_auth_form() {
  $cached_form_state = array();
  $cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state);
  $server = isset($_POST['sid']) ? deploy_get_server($_POST['sid']) : array();
  if (isset($_POST['auth_type'])) {
    $auth_type = $_POST['auth_type'];
  }
  elseif (isset($server['auth_type'])) {
    $auth_type = $server['auth_type'];
  }

  // If we've got a server and an auth type, add the appropriate form.
  if (!empty($server) && !empty($auth_type)) {
    $settings = deploy_auth_invoke($auth_type, 'form callback', $server);
    $cached_form['auth_wrapper']['settings'] = $settings;
  }
  else {
    unset($cached_form['auth_wrapper']['settings']);
  }
  form_set_cache($_POST['form_build_id'], $cached_form, $cached_form_state);
  $form_state = array(
    'submitted' => FALSE,
  );
  $options = form_builder('deploy_ahah_auth_form', $cached_form['auth_wrapper'], $form_state);
  $output = drupal_render($options);
  print drupal_to_js(array(
    'status' => TRUE,
    'data' => $output,
  ));
  exit;
}