ENHANCEMENT Added help text for "locale" setting in installer

MINOR Changed <div> hierarchy in config-form.html to allow right-aligned help texts which horizontically align with their respective field sets on the left.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100940 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-03-11 23:02:22 +00:00 committed by Sam Minnee
parent c79a9d5a03
commit 76db86d5cb
2 changed files with 177 additions and 153 deletions

View File

@ -140,166 +140,180 @@
<h4 class="sectionHeading">Database</h4> <h4 class="sectionHeading">Database</h4>
<div id="database_credentials" class="section"> <div id="database_credentials" class="section">
<?php if($envFileExists) { ?> <p id="dbHelp" class="helpText">
<div id="use_environment_field" class="field"> SilverStripe stores its content in a relational SQL database. Please provide the username and password to connect to the server here.
<input id="use_environment" type="checkbox" name="useEnv" <?php if($usingEnv) echo "checked=\"checked\"" ?> onclick="toggleDisabledFields(this);"> If this account has permission to create databases, then we will create the database for you; otherwise, you must give the name of a
<label for="use_environment">Use _ss_environment file for configuration</label> database that already exists.<br><br>
</div> <strong>Other databases:</strong><br>
<?php } ?> Databases in the list that are greyed out cannot currently be used. Click on them for more information and possible remedies.
</p>
<div class="fields">
<?php if($envFileExists) { ?>
<div id="use_environment_field" class="field">
<input id="use_environment" type="checkbox" name="useEnv" <?php if($usingEnv) echo "checked=\"checked\"" ?> onclick="toggleDisabledFields(this);">
<label for="use_environment">Use _ss_environment file for configuration</label>
</div>
<?php } ?>
<div class="field"> <div class="field">
<label>Database type:</label> <label>Database type:</label>
<ul id="database_selection"> <ul id="database_selection">
<?php <?php
foreach($databaseClasses as $class => $details) { foreach($databaseClasses as $class => $details) {
$checked = ($databaseConfig['type'] == $class) ? ' checked="checked"' : ''; $checked = ($databaseConfig['type'] == $class) ? ' checked="checked"' : '';
$disabled = $help = ''; $disabled = $help = '';
if($usingEnv) { if($usingEnv) {
// All are disabled by default when environment is used // All are disabled by default when environment is used
$disabled = 'disabled="disabled"'; $disabled = 'disabled="disabled"';
// If SS_DATABASE_CLASS is specified, check the database in the list // If SS_DATABASE_CLASS is specified, check the database in the list
if(defined('SS_DATABASE_CLASS') && SS_DATABASE_CLASS == $class) { if(defined('SS_DATABASE_CLASS') && SS_DATABASE_CLASS == $class) {
$checked = ' checked="checked"'; $checked = ' checked="checked"';
} }
} else { } else {
$disabled = !$details['supported'] || !$details['hasModule'] ? 'notavailable="true"' : ''; $disabled = !$details['supported'] || !$details['hasModule'] ? 'notavailable="true"' : '';
if ($disabled) { if ($disabled) {
if (!$details['supported'] && !$details['hasModule']) { if (!$details['supported'] && !$details['hasModule']) {
$help = 'PHP does not have the required extension, and SilverStripe does not have the correct module installed'; $help = 'PHP does not have the required extension, and SilverStripe does not have the correct module installed';
$helpText = '<li style="width:auto">'.$details['missingExtensionText'].'</li>'; $helpText = '<li style="width:auto">'.$details['missingExtensionText'].'</li>';
$helpText .= '<li style="width:auto">'.$details['missingModuleText'].'</li>'; $helpText .= '<li style="width:auto">'.$details['missingModuleText'].'</li>';
} else if ($details['supported'] && !$details['hasModule']) { } else if ($details['supported'] && !$details['hasModule']) {
$help = 'PHP has the required extension, but SilverStripe is missing the module'; $help = 'PHP has the required extension, but SilverStripe is missing the module';
$helpText = '<li style="width:auto">'.$details['missingModuleText'].'</li>'; $helpText = '<li style="width:auto">'.$details['missingModuleText'].'</li>';
} else if (!$details['supported'] && $details['hasModule']) { } else if (!$details['supported'] && $details['hasModule']) {
$help = 'SilverStripe has the module installed, but PHP is missing the required extension'; $help = 'SilverStripe has the module installed, but PHP is missing the required extension';
$helpText = '<li style="width:auto">'.$details['missingExtensionText'].'</li>'; $helpText = '<li style="width:auto">'.$details['missingExtensionText'].'</li>';
}
$help .= "<ul>$helpText</ul>";
} }
$help .= "<ul>$helpText</ul>";
} }
echo "<li>";
echo "<input id=\"$class\" class=\"databaseClass\" type=\"radio\" name=\"db[type]\" value=\"$class\"$checked $disabled>";
echo "<label class=\"left\" ".($help ? 'style="font-weight:normal;color:grey" ' : 'style="color:green"')."for=\"$class\">{$details['title']}</label>";
if ($help) {
echo '<div class="error databaseError">'.$help.'</div>';
}
echo "</li>";
} }
echo "<li>"; ?>
echo "<input id=\"$class\" class=\"databaseClass\" type=\"radio\" name=\"db[type]\" value=\"$class\"$checked $disabled>"; </ul>
echo "<label class=\"left\" ".($help ? 'style="font-weight:normal;color:grey" ' : 'style="color:green"')."for=\"$class\">{$details['title']}</label>"; </div>
if ($help) { <div class="field">
echo '<div class="error databaseError">'.$help.'</div>'; <label for="db_server">Database server:</label>
} <span class="middleColumn">
echo "</li>"; <input id="db_server" class="text" type="text" name="db[server]" value="<?php echo $databaseConfig['server']; ?>" <?php if($usingEnv && defined('SS_DATABASE_SERVER')) echo 'disabled="disabled"'; ?>>
} </span>
?> </div>
</ul> <div class="field">
</div> <label for="db_username">Database username:</label>
<div class="field"> <span class="middleColumn">
<label for="db_server">Database server:</label> <input id="db_username" class="text" type="text" name="db[username]" value="<?php echo $databaseConfig['username']; ?>" <?php if($usingEnv && defined('SS_DATABASE_USERNAME')) echo 'disabled="disabled"'; ?>>
<span class="middleColumn"> </span>
<input id="db_server" class="text" type="text" name="db[server]" value="<?php echo $databaseConfig['server']; ?>" <?php if($usingEnv && defined('SS_DATABASE_SERVER')) echo 'disabled="disabled"'; ?>> </div>
</span> <div class="field">
</div> <label for="db_password">Database password:</label>
<div class="field"> <span class="middleColumn">
<label for="db_username">Database username:</label> <input id="db_password" class="text" type="password" name="db[password]" value="<?php echo $databaseConfig['password']; ?>" <?php if($usingEnv && defined('SS_DATABASE_PASSWORD')) echo 'disabled="disabled"'; ?>>
<span class="middleColumn"> </span>
<input id="db_username" class="text" type="text" name="db[username]" value="<?php echo $databaseConfig['username']; ?>" <?php if($usingEnv && defined('SS_DATABASE_USERNAME')) echo 'disabled="disabled"'; ?>> </div>
</span> <div class="field">
</div> <label for="db_database">Database name:</label>
<div class="field"> <span class="middleColumn">
<label for="db_password">Database password:</label> <input id="db_database" class="text" type="text" name="db[database]" value="<?php echo $databaseConfig['database']; ?>" onchange="this.value = this.value.replace(/[\/\\:*?&quot;<>|. \t]+/g,'');">
<span class="middleColumn"> </span>
<input id="db_password" class="text" type="password" name="db[password]" value="<?php echo $databaseConfig['password']; ?>" <?php if($usingEnv && defined('SS_DATABASE_PASSWORD')) echo 'disabled="disabled"'; ?>> </div>
</span> <div class="action">
</div> <input type="submit" class="action" value="Re-check requirements">
<div class="field"> </div>
<label for="db_database">Database name:</label>
<span class="middleColumn">
<input id="db_database" class="text" type="text" name="db[database]" value="<?php echo $databaseConfig['database']; ?>" onchange="this.value = this.value.replace(/[\/\\:*?&quot;<>|. \t]+/g,'');">
</span>
</div>
<div class="action">
<input type="submit" class="action" value="Re-check requirements">
</div> </div>
</div> </div>
<p id="dbHelp" class="helpText">
SilverStripe stores its content in a relational SQL database. Please provide the username and password to connect to the server here.
If this account has permission to create databases, then we will create the database for you; otherwise, you must give the name of a
database that already exists.<br><br>
<strong>Other databases:</strong><br>
Databases in the list that are greyed out cannot currently be used. Click on them for more information and possible remedies.
</p>
<div class="clear"><!-- --></div> <div class="clear"><!-- --></div>
<?php $dbReq->showTable("Database Configuration"); ?> <?php $dbReq->showTable("Database Configuration"); ?>
<h4 class="sectionHeading">SilverStripe Administration Account</h4> <h4 class="sectionHeading">SilverStripe Administration Account</h4>
<div id="AdminAccount" class="section"> <div id="AdminAccount" class="section">
<div class="field"> <p id="adminAcc" class="helpText">
<label for="admin_username">Administrator email:</label> We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd rather log-in with a username instead of an email address, enter that instead.
<span class="middleColumn"> </p>
<input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" <?php if($usingEnv && defined('SS_DEFAULT_ADMIN_USERNAME')) echo 'disabled="disabled"' ?>> <div class="fields">
</span> <div class="field">
</div> <label for="admin_username">Administrator email:</label>
<div class="field"> <span class="middleColumn">
<label for="admin_password">Administrator password:</label> <input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" <?php if($usingEnv && defined('SS_DEFAULT_ADMIN_USERNAME')) echo 'disabled="disabled"' ?>>
<span class="middleColumn"> </span>
<input type="password" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" <?php if($usingEnv && defined('SS_DEFAULT_ADMIN_PASSWORD')) echo 'disabled="disabled"' ?>> </div>
</span> <div class="field">
</div> <label for="admin_password">Administrator password:</label>
<div class="field"> <span class="middleColumn">
<label for="admin_firstname">Administrator first name:</label> <input type="password" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" <?php if($usingEnv && defined('SS_DEFAULT_ADMIN_PASSWORD')) echo 'disabled="disabled"' ?>>
<span class="middleColumn"> </span>
<input type="text" class="text" name="admin[firstname]" id="admin_firstname" value="<?php echo $adminConfig['firstname']; ?>"> </div>
</span> <div class="field">
</div> <label for="admin_firstname">Administrator first name:</label>
<div class="field"> <span class="middleColumn">
<label for="admin_surname">Administrator surname:</label> <input type="text" class="text" name="admin[firstname]" id="admin_firstname" value="<?php echo $adminConfig['firstname']; ?>">
<span class="middleColumn"> </span>
<input type="text" class="text" name="admin[surname]" id="admin_surname" value="<?php echo $adminConfig['surname']; ?>"> </div>
</span> <div class="field">
</div> <label for="admin_surname">Administrator surname:</label>
<div class="action"> <span class="middleColumn">
<input type="submit" class="action" value="Re-check requirements"> <input type="text" class="text" name="admin[surname]" id="admin_surname" value="<?php echo $adminConfig['surname']; ?>">
</span>
</div>
<div class="action">
<input type="submit" class="action" value="Re-check requirements">
</div>
</div> </div>
</div> </div>
<p id="adminAcc" class="helpText">
We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd
rather log-in with a username instead of an email address, enter that instead.
</p>
<h4 class="sectionHeading">Server configuration</h4> <h4 class="sectionHeading">Server configuration</h4>
<div class="section"> <div id="devSection" class="section">
<div class="field"> <div class="fields">
<label for="devsites">Development servers:</label> <div class="field">
<span class="middleColumn"> <label for="devsites">Development servers:</label>
<textarea name="devsites" id="devsites" rows="5" cols="10"> <span class="middleColumn">
<?php if(@$_POST['devsites']) echo $_POST['devsites']; <textarea name="devsites" id="devsites" rows="5" cols="10">
else echo 'localhost <?php if(@$_POST['devsites']) echo $_POST['devsites'];
127.0.0.1'; ?></textarea> else echo 'localhost
</span> 127.0.0.1'; ?></textarea>
</div> </span>
<div class="field"> </div>
<label for="locale">Locale:</label>
<span class="middleColumn">
<select name="locale" id="locale">
<?php
$selectedLocale = isset($_POST['locale']) ? $_POST['locale'] : $defaultLocale;
foreach($locales as $code => $details) {
$selected = $code == $selectedLocale ? ' selected="true"' : '';
echo "<option$selected value=\"$code\">{$details[0]} - {$details[1]}</option>\n";
}
?>
</select>
</span>
</div> </div>
<p id="devHelp" class="helpText">
SilverStripe allows you to run a site in <a href="http://doc.silverstripe.org/doku.php?id=configuration">development mode</a>.
This shows all error messages in the web browser instead of emailing them to the administrator, and allows
the database to be built without logging in as administrator. Please enter the host/domain names for servers
you will be using for development.
</p>
</div> </div>
<p id="devHelp" class="helpText"> <div id="localeSection" class="section">
SilverStripe allows you to run a site in <a href="http://doc.silverstripe.org/doku.php?id=configuration">development mode</a>. <div class="fields">
This shows all error messages in the web browser instead of emailing them to the administrator, and allows <div class="field">
the database to be built without logging in as administrator. Please enter the host/domain names for servers <label for="locale">Default language:</label>
you will be using for development. <span class="middleColumn">
</p> <select name="locale" id="locale">
<?php
$selectedLocale = isset($_POST['locale']) ? $_POST['locale'] : $defaultLocale;
foreach($locales as $code => $details) {
$selected = $code == $selectedLocale ? ' selected="true"' : '';
echo "<option$selected value=\"$code\">{$details[0]} - {$details[1]}</option>\n";
}
?>
</select>
</span>
</div>
</div>
<p id="localeHelp" class="helpText">
Determines the default "locale" settings (for dates, currencies, etc.),
as well as setting the default language of the CMS interface.
This can be customized for any CMS user.
<br />
Caution: Not all aspects of the interface might be localized yet.
</p>
</div>
<h4 id="requirements">Requirements</h4> <h4 id="requirements">Requirements</h4>
<?php $req->showTable(); ?> <?php $req->showTable(); ?>
</form> </form>

View File

@ -103,7 +103,8 @@ table.testResults {
clear: both; clear: both;
} }
#adminAcc, #adminAcc,
#devHelp { #devHelp,
#localeHelp {
padding-top: 20px; padding-top: 20px;
} }
@ -111,14 +112,29 @@ table.testResults {
float: right; float: right;
padding-right: 40px; padding-right: 40px;
width: 290px; width: 290px;
margin-bottom: 0;
} }
div.section { .section {
width: 330px;
float: left; float: left;
overflow: hidden; overflow: hidden;
} }
.fields {
float: left;
margin-right: 20px;
}
#localeHelp,
#localeSection {
height: 15em;
}
#devHelp,
#devSection {
height: 18em;
}
#Layout input.action { #Layout input.action {
text-align: center; text-align: center;
font-size: 13px; font-size: 13px;
@ -139,34 +155,28 @@ div.section {
#database_credentials { #database_credentials {
margin: 0; margin: 0;
line-height: 1; line-height: 1;
width: 400px;
} }
#database_selection { #database_selection {
width: 400px;
overflow: hidden; overflow: hidden;
margin: 0; margin: 0;
margin-top: 15px; margin-top: 15px;
} }
#database_selection li { #database_selection li {
float: left;
width: 430px;
} }
#database_selection li input { #database_selection li input {
float: left; margin-right: 5px;;
} }
#database_selection li label { #database_selection li label {
float: left; display: inline;
margin: 0 6px 0 0;
margin-left: 5px;
font-weight: bold; font-weight: bold;
} }
.databaseError { .databaseError {
clear:both; clear:both;
overflow: hidden; overflow: hidden;
width: 350px; width: 250px;
margin: 25px; margin: 10px;
margin-bottom: 0; margin-bottom: 0;
display: none; display: none;
} }