Skip to content

Commit

Permalink
MDL-45167 install: Improve styling of installation process
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 1, 2014
1 parent 5077d63 commit 395e5e5
Show file tree
Hide file tree
Showing 3 changed files with 322 additions and 106 deletions.
68 changes: 35 additions & 33 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@

install_print_header($config, 'config.php',
get_string('configurationcompletehead', 'install'),
get_string('configurationcompletesub', 'install').get_string('configfilenotwritten', 'install'));
get_string('configurationcompletesub', 'install').get_string('configfilenotwritten', 'install'), 'alert-error');
echo '<div class="configphp"><pre>';
echo p($configphp);
echo '</pre></div>';
Expand Down Expand Up @@ -442,39 +442,41 @@
echo '<div class="userinput">';

$disabled = empty($distro->dbhost) ? '' : 'disabled="disabled';
echo '<div class="formrow"><label for="id_dbhost" class="formlabel">'.$strdbhost.'</label>';
echo '<input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbhost">'.$strdbhost.'</label></div>';
echo '<div class="fitemelement"><input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_dbname" class="formlabel">'.$strdbname.'</label>';
echo '<input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="50" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbname">'.$strdbname.'</label></div>';
echo '<div class="fitemelement"><input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="50" /></div>';
echo '</div>';

$disabled = empty($distro->dbuser) ? '' : 'disabled="disabled';
echo '<div class="formrow"><label for="id_dbuser" class="formlabel">'.$strdbuser.'</label>';
echo '<input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="50" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbuser">'.$strdbuser.'</label></div>';
echo '<div class="fitemelement"><input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="50" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_dbpass" class="formlabel">'.$strdbpass.'</label>';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbpass">'.$strdbpass.'</label></div>';
// no password field here, the password may be visible in config.php if we can not write it to disk
echo '<input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="50" class="forminput" />';
echo '<div class="fitemelement"><input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="50" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_prefix" class="formlabel">'.$strprefix.'</label>';
echo '<input id="id_prefix" name="prefix" type="text" value="'.s($config->prefix).'" size="10" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strprefix.'</label></div>';
echo '<div class="fitemelement"><input id="id_prefix" name="prefix" type="text" value="'.s($config->prefix).'" size="10" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_prefix" class="formlabel">'.$strdbport.'</label>';
echo '<input id="id_dbport" name="dbport" type="text" value="'.s($config->dbport).'" size="10" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strdbport.'</label></div>';
echo '<div class="fitemelement"><input id="id_dbport" name="dbport" type="text" value="'.s($config->dbport).'" size="10" /></div>';
echo '</div>';

if (!(stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin'))) {
echo '<div class="formrow"><label for="id_dbsocket" class="formlabel">'.$strdbsocket.'</label>';
echo '<input id="id_dbsocket" name="dbsocket" type="text" value="'.s($config->dbsocket).'" size="50" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbsocket">'.$strdbsocket.'</label></div>';
echo '<div class="fitemelement"><input id="id_dbsocket" name="dbsocket" type="text" value="'.s($config->dbsocket).'" size="50" /></div>';
echo '</div>';
}

echo '<div class="hint">'.$hint_database.'</div>';
if ($hint_database !== '') {
echo '<div class="alert alert-error">'.$hint_database.'</div>';
}
echo '</div>';
install_print_footer($config);
die;
Expand All @@ -498,8 +500,8 @@
);

echo '<div class="userinput">';
echo '<div class="formrow"><label class="formlabel" for="dbtype">'.get_string('dbtype', 'install').'</label>';
echo '<select id="dbtype" name="dbtype" class="forminput">';
echo '<div class="fitem"><div class="fitemtitle"><label for="dbtype">'.get_string('dbtype', 'install').'</label></div>';
echo '<div class="fitemelement"><select id="dbtype" name="dbtype">';
$disabled = array();
$options = array();
foreach ($databases as $type=>$database) {
Expand All @@ -516,7 +518,7 @@
}
echo '</optgroup>';
}
echo '</select></div>';
echo '</select></div></div>';
echo '</div>';

install_print_footer($config);
Expand Down Expand Up @@ -577,27 +579,27 @@
$stradmindirname = get_string('admindirname', 'install');

echo '<div class="userinput">';
echo '<div class="formrow"><label for="id_wwwroot" class="formlabel">'.$paths['wwwroot'].'</label>';
echo '<input id="id_wwwroot" name="wwwroot" type="text" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_wwwroot">'.$paths['wwwroot'].'</label></div>';
echo '<div class="fitemelement"><input id="id_wwwroot" name="wwwroot" type="text" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_dirroot" class="formlabel">'.$paths['dirroot'].'</label>';
echo '<input id="id_dirroot" name="dirroot" type="text" value="'.s($CFG->dirroot).'" disabled="disabled" size="70"class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dirroot">'.$paths['dirroot'].'</label></div>';
echo '<div class="fitemelement"><input id="id_dirroot" name="dirroot" type="text" value="'.s($CFG->dirroot).'" disabled="disabled" size="70" /></div>';
echo '</div>';

echo '<div class="formrow"><label for="id_dataroot" class="formlabel">'.$paths['dataroot'].'</label>';
echo '<input id="id_dataroot" name="dataroot" type="text" value="'.s($config->dataroot).'" size="70" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dataroot">'.$paths['dataroot'].'</label></div>';
echo '<div class="fitemelement"><input id="id_dataroot" name="dataroot" type="text" value="'.s($config->dataroot).'" size="70" /></div>';
if ($hint_dataroot !== '') {
echo '<div class="hint">'.$hint_dataroot.'</div>';
echo '<div class="alert alert-error">'.$hint_dataroot.'</div>';
}
echo '</div>';


if (!file_exists("$CFG->dirroot/admin/environment.xml")) {
echo '<div class="formrow"><label for="id_admin" class="formlabel">'.$paths['admindir'].'</label>';
echo '<input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" class="forminput" />';
echo '<div class="fitem"><div class="fitemtitle"><label for="id_admin">'.$paths['admindir'].'</label></div>';
echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" /></div>';
if ($hint_admindir !== '') {
echo '<div class="hint">'.$hint_admindir.'</div>';
echo '<div class="alert alert-error">'.$hint_admindir.'</div>';
}
echo '</div>';
}
Expand All @@ -619,7 +621,7 @@

install_print_header($config, get_string('language'),
get_string('chooselanguagehead', 'install'),
$sub);
$sub, 'alert-success');

} else {
install_print_header($config, get_string('language'),
Expand All @@ -629,13 +631,13 @@

$languages = get_string_manager()->get_list_of_translations();
echo '<div class="userinput">';
echo '<div class="formrow"><label class="formlabel" for="langselect">'.get_string('language').'</label>';
echo '<select id="langselect" name="lang" class="forminput" onchange="this.form.submit()">';
echo '<div class="fitem"><div class="fitemtitle"><label for="langselect">'.get_string('language').'</label></div>';
echo '<div class="fitemelement"><select id="langselect" name="lang" onchange="this.form.submit()">';
foreach ($languages as $name=>$value) {
$selected = ($name == $CFG->lang) ? 'selected="selected"' : '';
echo '<option value="'.s($name).'" '.$selected.'>'.$value.'</option>';
}
echo '</select></div>';
echo '</select></div></div>';
echo '</div>';

install_print_footer($config);
Expand Down
Loading

0 comments on commit 395e5e5

Please sign in to comment.