You are here

function livechat_admin_license_form in LiveChat 7

License installation form.

1 string reference to 'livechat_admin_license_form'
livechat_menu in ./livechat.module
Implements hook_menu().

File

./livechat.admin.inc, line 94
Administration pages for the LiveChat module.

Code

function livechat_admin_license_form($form_state) {
  $module_dir = drupal_get_path('module', 'livechat');
  drupal_add_css($module_dir . '/admin/css/livechat.css');
  drupal_add_js($module_dir . '/admin/js/livechat.js');
  if (livechat_is_installed()) {
    $form['tracking_code'] = array(
      '#type' => 'item',
      '#markup' => '<div class="messages installed_ok">' . t('LiveChat
         is installed.') . '</div>',
    );
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Remove'),
    );
  }
  else {
    $download_text = t('Download LiveChat for your desktop/mobile and start chatting
      with your customers!');
    $download_link = l(t('Download application'), 'http://www.livechatinc.com/product/', array(
      'attributes' => array(
        'external' => TRUE,
      ),
    ));
    $form['download_app'] = array(
      '#type' => 'item',
      '#markup' => '<p>' . $download_text . '</p><p class="btn">' . $download_link . '</p>',
    );

    // New account / Already have a license forms.
    $form['choose_form'] = array(
      '#type' => 'item',
      '#markup' => '<div id="lc_logo"></div>' . '<h3>Already have a LiveChat account?</h3>' . '<ul id="choose_form">' . '<li><input type="radio" name="choose_form"
         id="choose_form_1" checked="checked"> <label for="choose_form_1">Yes,
         I already have a LiveChat account</label></li>' . '<li><input type="radio"
          name="choose_form" id="choose_form_0"><label for="choose_form_0">No,
          I want to create one</label></li>' . '</ul>',
    );

    // General settings.
    $form['general'] = array(
      '#type' => 'fieldset',
      '#collapsible' => FALSE,
      '#prefix' => '<div id="livechat_already_have"><h3>Account details</h3>',
      '#suffix' => '</div>',
    );
    $form['general']['livechat_login'] = array(
      '#type' => 'textfield',
      '#title' => t('LiveChat login'),
      '#default_value' => '',
      '#size' => 30,
      '#maxlength' => 100,
      // Handled by JavaScript validator.
      '#required' => FALSE,
    );
    $form['general']['license_number'] = array(
      '#type' => 'hidden',
      '#value' => '0',
    );
    $form['general']['ajax_message'] = array(
      '#type' => 'item',
      '#markup' => '<p class="ajax_message"></p>',
    );

    // New account form.
    $form['new_account'] = array(
      '#type' => 'fieldset',
      '#collapsible' => FALSE,
      '#prefix' => '<div id="livechat_new_account"><h3>Create a new LiveChat
account</h3>',
      '#suffix' => '</div>',
    );
    $form['new_account']['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Full name'),
      '#size' => 30,
      '#maxlength' => 60,
      // Handled by JavaScript validator.
      '#required' => FALSE,
    );
    $form['new_account']['email'] = array(
      '#type' => 'textfield',
      '#title' => t('E-mail'),
      '#size' => 30,
      '#maxlength' => 70,
      // Handled by JavaScript validator.
      '#required' => FALSE,
    );
    $form['new_account']['password'] = array(
      '#type' => 'password',
      '#title' => t('Password'),
      '#size' => 30,
      '#maxlength' => 70,
      // Handled by JavaScript validator.
      '#required' => FALSE,
    );
    $form['new_account']['password_retype'] = array(
      '#type' => 'password',
      '#title' => t('Retype password'),
      '#size' => 30,
      '#maxlength' => 70,
      // Handled by JavaScript validator.
      '#required' => FALSE,
    );
    $form['new_account']['ajax_message'] = array(
      '#type' => 'item',
      '#markup' => '<p class="ajax_message"></p>',
    );
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  return $form;
}