You are here

function kaltura_registration_form in Kaltura 7.3

Same name and namespace in other branches
  1. 7.2 includes/kaltura.admin.inc \kaltura_registration_form()

Determines how the general settings form will look like.

Return value

mixed one of 2 states of forms: 1) registration form (if variables do not exist in the DB) either as SaaS or Kaltura CE 2) notifications settings + configuration test + settings form

1 string reference to 'kaltura_registration_form'
kaltura_menu in ./kaltura.module
Implements hook_menu().

File

includes/kaltura.admin.inc, line 152
Contains functions for administration use of the kaltura core module.

Code

function kaltura_registration_form() {
  global $base_url;
  drupal_add_css(drupal_get_path('module', 'kaltura') . '/style/kaltura_reg_form.css');
  drupal_add_js(drupal_get_path('module', 'kaltura') . '/js/jquery.validate.min.js', array(
    'group' => JS_LIBRARY,
  ));
  drupal_add_js(drupal_get_path('module', 'kaltura') . '/js/additional-methods.js', array(
    'group' => JS_LIBRARY,
  ));

  // Check if we are already registered if so show status page and partner info.
  if (variable_get('kaltura_partner_id')) {
    return kaltura_status_form();
  }

  // Load locale include file to get a country list from it.
  include_once DRUPAL_ROOT . '/includes/locale.inc';
  $form['first_set'] = array(
    '#type' => 'fieldset',
    '#title' => t('Server settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['first_set']['server_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Server URL'),
    '#default_value' => variable_get('kaltura_server_url', 'http://www.kaltura.com'),
    '#description' => t('If you are working against Kaltura SaaS, leave this setting as it is. Otherwise, if you are working against a Kaltura CE or Kaltura On-Prem server, type the server URL here.'),
  );
  $form['first_set']['kaltura_partner_url2'] = array(
    '#type' => 'textfield',
    '#title' => t('Notification URL'),
    '#default_value' => variable_get('kaltura_partner_url2', $base_url),
    '#description' => t('server notifications allows the Kaltura video platform to update your Drupal server about the status of the media content. This is especially useful when uploading content in various formats that needs to be transcoded. In order to support server side notifications, your server must be publicly available on the internet. The notification URL is where notifications are sent to and where a notification handler script resides.'),
  );
  $form['first_set']['new_partner'] = array(
    '#type' => 'radios',
    '#title' => t('Partner'),
    '#options' => array(
      'new' => t('New'),
      'existing' => t('Existing'),
    ),
    '#default_value' => t('new'),
  );
  $form['ex_partner'] = array(
    '#type' => 'fieldset',
    '#title' => t('Existing partner registration'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#states' => array(
      'visible' => array(
        ':input[name="new_partner"]' => array(
          'value' => 'existing',
        ),
      ),
    ),
  );
  $form['ex_partner']['ex_partner_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Partner ID'),
    '#size' => 10,
  );
  $form['ex_partner']['ex_email'] = array(
    '#type' => 'textfield',
    '#title' => t('E-Mail'),
  );
  $form['ex_partner']['ex_password'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#maxlength' => 64,
  );
  $form['registration'] = array(
    '#type' => 'fieldset',
    '#title' => t('New partner registration'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#states' => array(
      'visible' => array(
        ':input[name="new_partner"]' => array(
          'value' => 'new',
        ),
      ),
    ),
  );
  $form['registration']['first_name'] = array(
    '#type' => 'textfield',
    '#title' => t('First Name'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['last_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Last Name'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['email'] = array(
    '#type' => 'textfield',
    '#title' => t('E-Mail'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['company'] = array(
    '#type' => 'textfield',
    '#title' => t('Company'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['website'] = array(
    '#type' => 'textfield',
    '#title' => t('Website'),
    '#size' => 30,
  );
  $form['registration']['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Job Title'),
    '#size' => 30,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['vertical'] = array(
    '#type' => 'select',
    '#title' => t('Describe yourself'),
    // '#description' => t('/* description */'),
    '#options' => array(
      'Enterprise' => t('Enterprise / Small Business / Government Agency'),
      'Education' => t('Education Organization'),
      'Media' => t('Media Company / Agency'),
      'Service Provider' => t('CDN / ISP / Integrator / Hosting'),
      'Other' => t('Other'),
    ),
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['country'] = array(
    '#type' => 'select',
    '#title' => t('Country'),
    // '#description' => t('/* description */'),
    '#options' => country_get_list(),
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['registration']['state'] = array(
    '#type' => 'select',
    '#title' => t('State / Province'),
    // '#description' => t('/* description */'),
    '#options' => kaltura_us_states(),
    '#states' => array(
      'visible' => array(
        ':input[name="country"]' => array(
          'value' => 'US',
        ),
      ),
    ),
    '#default_value' => 'Not Applicable',
  );
  $form['registration']['would_you_like_to_be_contacted'] = array(
    '#type' => 'select',
    '#title' => t('Would you like a Kaltura Video Expert to contact you?'),
    // '#description' => t('/* description */'),
    '#options' => array(
      'yes' => t('Yes'),
      'no' => t('Not right now'),
    ),
    '#states' => array(
      'visible' => array(
        ':input[name="server_url"]' => array(
          'value' => 'http://www.kaltura.com',
        ),
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
    '#default_value' => 'yes',
  );
  $form['registration']['k_description'] = array(
    '#type' => 'textarea',
    '#title' => t('How do you plan to use Kaltura\'s video platform?'),
    '#cols' => 60,
  );
  $form['terms'] = array(
    '#type' => 'checkbox',
    '#title' => t('I accept !terms_of_use', array(
      '!terms_of_use' => l(t('The Kaltura service Terms of Use'), 'http://corp.kaltura.com/terms_of_use_drupal'),
    )),
    '#required' => TRUE,
    '#attributes' => array(
      'class' => array(
        'required',
      ),
      'title' => t('This field is required.'),
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('save'),
  );
  return $form;
}