Commit 7bcbeab8 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

mostly rewritten admin screens. some other small changes

parent ee18e372
......@@ -45,21 +45,32 @@ EOF;
* Implementation of provision_service()
*/
function provision_mysql_provision_service() {
return t("Mysql database server");
return array("db_server" => t("Mysql database server"));
}
/**
* Implementation of provision_configure
*/
function provision_mysql_provision_configure() {
function provision_mysql_provision_configure($node = null) {
$form['db_type'] = array('#type' => 'hidden', '#value' => 'mysql');
$form['db_host'] = array(
'#type' => 'textfield',
'#title' => t('Mysql server hostname'),
'#description' => t('The mysql server to connect to.'),
'#size' => 30,
'#default_value' => variable_get('provision_db_host', 'localhost'),
'#default_value' => ($node->db_host) ? $node->db_host : variable_get('provision_db_host', 'localhost'),
'#maxlength' => 64,
);
$form['ip_address'] = array(
'#type' => 'textfield',
'#title' => t('IP address'),
'#default_value' => $node->ip_address,
'#size' => 15,
'#maxlength' => 15,
'#description' => t("The IP address the server can be accessed by.<br />If this is empty, the hostname will be used instead.")
);
$form['db_user'] = array(
'#type' => 'textfield',
......@@ -67,7 +78,7 @@ function provision_mysql_provision_configure() {
'#title' => t('Mysql user account'),
'#description' => t('The user that will be used to create users and databases for new sites.'),
'#size' => 40,
'#default_value' => variable_get('provision_db_user', 'root'),
'#default_value' => ($node->db_user) ? $node->db_user : variable_get('provision_db_user', 'root'),
'#maxlength' => 255,
);
$form['db_passwd'] = array(
......
......@@ -170,7 +170,8 @@ function provision_help_requirements() {
$output .= t('<p>Some of the features of the system also require the ability to create symlinks, which means that it needs to run on a unix-like operating system. There are no plans currently to add windows support.</p>');
$modules = module_implements('provision_service');
foreach ($modules as $module) {
$name = module_invoke($module, 'provision_service');
$service = module_invoke($module, 'provision_service');
$name = current($service);
$help = module_invoke($module, 'help', 'admin/help/provision#requirements');
if ($name && $help) {
$output .= '<a href="requirements-$module"></a><h3>' . t($name) . '</h3>';
......@@ -189,10 +190,14 @@ function provision_help_requirements() {
*/
function provision_configure() {
$form['services'] = array('#type' => 'value');
foreach (module_implements('provision_configure') as $module) {
$data = module_invoke($module, 'provision_service');
list($service, $title) = $data;
$form[$name] = array(
$service = key($data);
$title = current($data);
$form['services']['#value'][] = $service;
$form[$service] = array(
'#type' => 'fieldset',
'#title' => $title,
'#collapsible' => TRUE,
......@@ -200,7 +205,7 @@ function provision_configure() {
'#access' => user_access('administer $service provisioning'),
'#tree' => true
);
$form[$service] = array_merge($form[$module], module_invoke($module, "provision_configure"));
$form[$service] = array_merge($form[$service], module_invoke($module, "provision_configure"));
}
$form['submit'] = array(
'#type' => 'submit',
......@@ -208,7 +213,15 @@ function provision_configure() {
);
return $form;
}
}
function provision_configure_submit($form_id, $values) {
foreach ($values['services'] as $service) {
foreach ($values[$service] as $key => $value) {
variable_set('provision_' . $key, $value);
}
}
}
/**
* @} End of "defgroup provisionui"
......
......@@ -82,20 +82,15 @@ EOF;
* Hook into central configuration form for provisioning framework.
*/
function provision_apache_provision_configure($node = null) {
$form['ip_address'] = array(
'#type' => 'textfield',
'#title' => t('IP address'),
'#default_value' => $node->ip_address,
'#description' => t("The IP address the server can be accessed by. If this is empty, the hostname field will be used instead.")
);
// We need to define form elements for the node's title and body.
$form['script_user'] = array(
'#type' => 'textfield',
'#title' => t('System account'),
'#required' => TRUE,
'#description' => t('The system account that the hosted files will belong to, for security reasons, this should be a different to the account the web server is running as.'),
'#description' => t('The system account that the hosted files will belong to, for security reasons.<br />This should be a different to the account the web server is running as.'),
'#default_value' => ($node->script_user) ? $node->script_user : provision_get_script_owner(),
'#size' => 40,
'#size' => 20,
'#maxlength' => 255,
);
......@@ -103,10 +98,10 @@ function provision_apache_provision_configure($node = null) {
'#type' => 'textfield',
'#title' => t('Web server group'),
'#required' => TRUE,
'#description' => t('The group that the hosted files will belong to. Should be the group the web server is running as.'),
'#description' => t('The group that the hosted files will belong to.<br />This should be the group the web server is running as.'),
'#default_value' => ($node->web_group) ? $node->web_group : provision_get_group_name(),
'#size' => 40,
'#maxlength' => 255,
'#size' => 20,
'#maxlength' => 75,
);
$form['config_path'] = array(
......@@ -115,7 +110,7 @@ function provision_apache_provision_configure($node = null) {
'#required' => TRUE,
'#size' => 40,
'#default_value' => ($node->config_path) ? $node->config_path : _provision_config_path(),
'#description' => t("The path on the server where configuration files will be stored.
'#description' => t("The path on the server where configuration files will be stored.<br />
It is essential that this directory should not be accessible via a web browser."),
'#maxlength' => 255,
);
......@@ -126,7 +121,7 @@ function provision_apache_provision_configure($node = null) {
'#required' => TRUE,
'#size' => 40,
'#default_value' => ($node->backup_path) ? $node->backup_path : _provision_backup_path(),
'#description' => t("The path on the server where backups will be stored.
'#description' => t("The path on the server where backups will be stored.<br />
It is essential that this directory should not be accessible via a web browser."),
'#maxlength' => 255,
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment