mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Added checkbox to switch off using the environment during install if it's available
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98677 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
130290a8f2
commit
627c106a77
@ -3,13 +3,47 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>SilverStripe CMS Installation</title>
|
<title>SilverStripe CMS Installation</title>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
<script type="text/js">
|
<script type="text/javascript">
|
||||||
function show(id) {
|
function show(id) {
|
||||||
document.getElementById(id).style.display = '';
|
document.getElementById(id).style.display = '';
|
||||||
}
|
}
|
||||||
function hide(id) {
|
function hide(id) {
|
||||||
document.getElementById(id).style.display = 'none';
|
document.getElementById(id).style.display = 'none';
|
||||||
}
|
}
|
||||||
|
function getElementsByClassName(classname, node) {
|
||||||
|
if(!node) node = document.getElementsByTagName("body")[0];
|
||||||
|
var a = [];
|
||||||
|
var re = new RegExp('\\b' + classname + '\\b');
|
||||||
|
var els = node.getElementsByTagName("*");
|
||||||
|
for(var i=0,j=els.length; i<j; i++)
|
||||||
|
if(re.test(els[i].className))a.push(els[i]);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
function toggleDisabledFields(el) {
|
||||||
|
if(!el.checked) {
|
||||||
|
// Go through each environment supported field and enable
|
||||||
|
document.getElementById('db_server').disabled = '';
|
||||||
|
document.getElementById('db_username').disabled = '';
|
||||||
|
document.getElementById('db_password').disabled = '';
|
||||||
|
document.getElementById('admin_username').disabled = '';
|
||||||
|
document.getElementById('admin_password').disabled = '';
|
||||||
|
var dbs = getElementsByClassName('databaseClass');
|
||||||
|
for(var i = 0; i < dbs.length; i++) {
|
||||||
|
dbs[i].disabled = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Go through each environment supported field and disable
|
||||||
|
document.getElementById('db_server').disabled = 'disabled';
|
||||||
|
document.getElementById('db_username').disabled = 'disabled';
|
||||||
|
document.getElementById('db_password').disabled = 'disabled';
|
||||||
|
document.getElementById('admin_username').disabled = 'disabled';
|
||||||
|
document.getElementById('admin_password').disabled = 'disabled';
|
||||||
|
var dbs = getElementsByClassName('databaseClass');
|
||||||
|
for(var i = 0; i < dbs.length; i++) {
|
||||||
|
dbs[i].disabled = 'disabled';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" type="text/css" href="themes/blackcandy/css/layout.css">
|
<link rel="stylesheet" type="text/css" href="themes/blackcandy/css/layout.css">
|
||||||
<link rel="stylesheet" type="text/css" href="themes/blackcandy/css/typography.css">
|
<link rel="stylesheet" type="text/css" href="themes/blackcandy/css/typography.css">
|
||||||
@ -85,7 +119,7 @@
|
|||||||
|
|
||||||
<h4 class="sectionHeading">Database</h4>
|
<h4 class="sectionHeading">Database</h4>
|
||||||
<?php if($dbReq->hasErrors()) { ?>
|
<?php if($dbReq->hasErrors()) { ?>
|
||||||
<p class="error"><!-- class="error" -->
|
<p class="error">
|
||||||
These database details don't appear to be correct. Please enter the correct details before installing.
|
These database details don't appear to be correct. Please enter the correct details before installing.
|
||||||
</p>
|
</p>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -95,14 +129,21 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div id="database_credentials" class="section">
|
<div id="database_credentials" class="section">
|
||||||
|
<?php if($usingEnv) { ?>
|
||||||
|
<div id="use_environment_field" class="field">
|
||||||
|
<input id="use_environment" type="checkbox" name="useEnv" <?php if($shouldUseEnv) echo "checked=\"checked\""?> onclick="toggleDisabledFields(this);">
|
||||||
|
<label for="use_environment">Use _ss_environment file for configuration</label>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
<label>Database type:</label>
|
<label>Database type:</label>
|
||||||
<ul id="database_selection" class="field">
|
<ul id="database_selection">
|
||||||
<?php
|
<?php
|
||||||
foreach($foundDatabaseClasses as $class => $title) {
|
foreach($foundDatabaseClasses as $class => $title) {
|
||||||
$checked = ($databaseConfig['type'] == $class) ? ' checked="checked"' : '';
|
$checked = ($databaseConfig['type'] == $class) ? ' checked="checked"' : '';
|
||||||
$disabled = '';
|
$disabled = '';
|
||||||
global $usingEnv;
|
if($usingEnv && $shouldUseEnv) {
|
||||||
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
|
||||||
@ -111,28 +152,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "<li>";
|
echo "<li>";
|
||||||
echo "<input id=\"$class\" type=\"radio\" name=\"db[type]\" value=\"$class\"$checked $disabled>";
|
echo "<input id=\"$class\" class=\"databaseClass\" type=\"radio\" name=\"db[type]\" value=\"$class\"$checked $disabled>";
|
||||||
echo "<label class=\"left\" for=\"$class\">$title</label>";
|
echo "<label class=\"left\" for=\"$class\">$title</label>";
|
||||||
echo "</li>";
|
echo "</li>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="db_server">Database server:</label>
|
<label for="db_server">Database server:</label>
|
||||||
<span class="middleColumn">
|
<span class="middleColumn">
|
||||||
<input id="db_server" class="text" type="text" name="db[server]" value="<?php echo $databaseConfig['server']; ?>" <?php if(defined('SS_DATABASE_SERVER')) echo 'disabled="disabled"'; ?>>
|
<input id="db_server" class="text" type="text" name="db[server]" value="<?php echo $databaseConfig['server']; ?>" <?php if($shouldUseEnv && defined('SS_DATABASE_SERVER')) echo 'disabled="disabled"'; ?>>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="db_username">Database username:</label>
|
<label for="db_username">Database username:</label>
|
||||||
<span class="middleColumn">
|
<span class="middleColumn">
|
||||||
<input id="db_username" class="text" type="text" name="db[username]" value="<?php echo $databaseConfig['username']; ?>" <?php if(defined('SS_DATABASE_USERNAME')) echo 'disabled="disabled"'; ?>>
|
<input id="db_username" class="text" type="text" name="db[username]" value="<?php echo $databaseConfig['username']; ?>" <?php if($shouldUseEnv && defined('SS_DATABASE_USERNAME')) echo 'disabled="disabled"'; ?>>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="db_password">Database password:</label>
|
<label for="db_password">Database password:</label>
|
||||||
<span class="middleColumn">
|
<span class="middleColumn">
|
||||||
<input id="db_password" class="text" type="password" name="db[password]" value="<?php echo $databaseConfig['password']; ?>" <?php if(defined('SS_DATABASE_PASSWORD')) echo 'disabled="disabled"'; ?>>
|
<input id="db_password" class="text" type="password" name="db[password]" value="<?php echo $databaseConfig['password']; ?>" <?php if($shouldUseEnv && defined('SS_DATABASE_PASSWORD')) echo 'disabled="disabled"'; ?>>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
@ -159,13 +201,13 @@
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="admin_username">Administrator email:</label>
|
<label for="admin_username">Administrator email:</label>
|
||||||
<span class="middleColumn">
|
<span class="middleColumn">
|
||||||
<input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" <?php if(defined('SS_DEFAULT_ADMIN_USERNAME')) echo 'disabled="disabled"' ?>>
|
<input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" <?php if($shouldUseEnv && defined('SS_DEFAULT_ADMIN_USERNAME')) echo 'disabled="disabled"' ?>>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="admin_password">Administrator password:</label>
|
<label for="admin_password">Administrator password:</label>
|
||||||
<span class="middleColumn">
|
<span class="middleColumn">
|
||||||
<input type="password" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" <?php if(defined('SS_DEFAULT_ADMIN_PASSWORD')) echo 'disabled="disabled"' ?>>
|
<input type="password" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" <?php if($shouldUseEnv && defined('SS_DEFAULT_ADMIN_PASSWORD')) echo 'disabled="disabled"' ?>>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
@ -127,6 +127,11 @@ div.section {
|
|||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#use_environment_field input {
|
||||||
|
float: left;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
#database_credentials {
|
#database_credentials {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user