function kaltura_installation_form in Kaltura 6.2
Build registration form.
See also
http://apis.kaltura.org/kalturaJsClient/kaltura-register.html
http://www.kaltura.org/guidelines-kaltura-cms-extensions-development
http://drupal.org/node/1026426
1 string reference to 'kaltura_installation_form'
File
- includes/
kaltura.install.inc, line 26 - Contains functions for installation of Kaltura module.
Code
function kaltura_installation_form(&$form_state = NULL) {
global $base_url;
drupal_add_css(drupal_get_path('module', 'kaltura') . '/style/kaltura.css');
$step = isset($form_state['values']) ? (int) $form_state['storage']['step'] : 0;
$form_state['storage']['step'] = $step + 1;
$form['indicator'] = array(
'#value' => t('Step @step of @steps', array(
'@step' => $form_state['storage']['step'],
'@steps' => KALTURA_INSTALL_STEPS,
)),
'#prefix' => '<p>',
'#suffix' => '</p>',
);
$next = array(
'#type' => 'submit',
'#value' => KALTURA_INSTALL_FWDBUTTON,
);
$prev = array(
'#type' => 'submit',
'#value' => KALTURA_INSTALL_BACKBUTTON,
);
switch ($form_state['storage']['step']) {
case 1:
$desc_items = array(
t('If you wish to use Kaltura\'s hosted service at Kaltura.com, leave the default of <code>http://www.kaltura.com/</code>'),
t('If you have a Kaltura On-Prem or CE installation ready, enter the base URL of that Kaltura server.'),
);
$form['kaltura_server_url'] = array(
'#type' => 'textfield',
'#title' => t('Kaltura Server URL'),
'#default_value' => isset($form_state['storage']['kaltura_server_url']) ? $form_state['storage']['kaltura_server_url'] : KALTURA_SAAS_DEFAULT_URL,
'#description' => t('Enter the base URL of your Kaltura server.') . theme('item_list', $desc_items),
);
//$form['prev'] = $prev;
$form['next'] = $next;
break;
case 2:
$targs = array(
'!kaltura_url' => $form_state['storage']['kaltura_server_url'],
);
$form['intro'] = array(
'#value' => t('Do you have an existing account at !kaltura_url?', $targs),
);
$form['login_register'] = array(
'#type' => 'radios',
'#options' => array(
'register' => t('Register a new !kaltura_url account', $targs),
'login' => t('Log into existing !kaltura_url account', $targs),
),
'#default_value' => isset($form_state['storage']['login_register']) ? $form_state['storage']['login_register'] : 'register',
);
$form['prev'] = $prev;
$form['next'] = $next;
break;
case 3:
switch ($form_state['storage']['login_register']) {
case 'register':
$form['admin_name'] = array(
'#type' => 'textfield',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : '',
'#title' => 'Your Name',
'#description' => '',
);
$form['organisation'] = array(
'#type' => 'textfield',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : '',
'#title' => 'Your Organisation',
'#description' => '',
);
$form['admin_email'] = array(
'#type' => 'textfield',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : '',
'#title' => 'Email',
'#description' => '',
);
$form['cms_password'] = array(
'#type' => 'password',
'#title' => t('Kaltura Password'),
'#description' => t('This will be the password for your new Kaltura account.'),
);
$form['phone'] = array(
'#type' => 'textfield',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : '',
'#title' => 'Phone',
'#description' => '',
);
$form['partner_site_name'] = array(
'#type' => 'textfield',
'#title' => t('Website Name'),
'#default_value' => isset($form_state['storage']['partner_site_name']) ? $form_state['storage']['partner_site_name'] : variable_get('site_name', ''),
'#size' => 60,
'#maxlength' => 256,
);
$form['website'] = array(
'#type' => 'textfield',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : $base_url,
'#title' => 'Website URL',
'#description' => '',
);
$form['notification_url'] = array(
'#type' => 'value',
'#value' => url('kaltura/notification_handler', array(
'absolute' => TRUE,
)),
);
$kcategories = new KalturaContentCategories();
// we use the name, not the key, because one of the keys is 0
foreach ($kcategories->categories as $category) {
$categories[$category] = $category;
}
$form['site_content'] = array(
'#type' => 'checkboxes',
'#default_value' => isset($form_state['storage']['content_categories']) ? $form_state['storage']['content_categories'] : array(),
'#title' => 'Content Categories',
'#description' => 'Check all that apply.',
'#options' => $categories,
'#attributes' => array(
'class' => 'kaltura-install-website-content',
),
);
$form['description'] = array(
'#type' => 'textarea',
'#default_value' => isset($form_state['storage']['']) ? $form_state['storage'][''] : '',
'#title' => 'How do you plan to use Kaltura Platform?',
'#description' => '',
'#required' => TRUE,
);
$form['adult_content'] = array(
'#type' => 'checkboxes',
'#default_value' => isset($form_state['storage']['adult_content']) ? $form_state['storage']['adult_content'] : array(),
'#title' => 'Adult Content',
'#options' => array(
'yes' => t('This site will include adult content.'),
),
);
$terms_options = array(
'agree' => t('I agree to the !terms_of_use', array(
'!terms_of_use' => l('Kaltura Terms of Use', KALTURA_SAAS_TERMS_URL),
)),
);
if ($form_state['storage']['kaltura_server_url'] == KALTURA_SAAS_DEFAULT_URL) {
$form['terms_of_use'] = array(
'#type' => 'checkboxes',
'#default_value' => isset($form_state['storage']['terms_of_use']) ? $form_state['storage']['terms_of_use'] : array(),
'#title' => 'Terms of Use',
'#description' => '',
'#options' => $terms_options,
);
}
break;
case 'login':
$form['kaltura_partner_id'] = array(
'#type' => 'textfield',
'#title' => t('Kaltura Partner ID'),
'#description' => t('Visible under Account » Server Settings » Partner Info in Kaltura console.'),
'#default_value' => $form_state['storage']['kaltura_partner_id'],
);
$form['kaltura_login_email'] = array(
'#type' => 'textfield',
'#title' => t('Kaltura Partner Login'),
'#description' => t('The email address you use to log into Kaltura, visible under Account » Account Overview » Login Info in Kaltura console.'),
'#default_value' => $form_state['storage']['kaltura_login_email'],
);
$form['kaltura_login_password'] = array(
'#type' => 'password',
'#title' => t('Kaltura Password'),
'#default_value' => $form_state['storage']['kaltura_login_password'],
);
$form['notification_url'] = array(
'#type' => 'value',
'#value' => url('kaltura/notification_handler', array(
'absolute' => TRUE,
)),
);
break;
}
$form['prev'] = $prev;
$form['next'] = $next;
break;
case 4:
$form['prev'] = $prev;
$form['next'] = $next;
}
return $form;
}