silverstripe-framework/src/Dev/Install/config-form.html

294 lines
15 KiB
HTML

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<title>SilverStripe CMS / Framework Installation</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="application/javascript" src="//code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="application/javascript" src="<?=FRAMEWORK_NAME; ?>/src/Dev/Install/client/js/install.js"></script>
<link rel="stylesheet" type="text/css" href="<?=FRAMEWORK_NAME; ?>/src/Dev/Install/client/styles/install.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div id="BgContainer">
<div id="Container">
<div id="Header">
<h1>SilverStripe</h1>
<div class="left">
<h2>CMS / Framework Installation <?php if($silverstripe_version) echo "<small>Version $silverstripe_version</small>"; ?></h2>
<p>Thanks for choosing to use SilverStripe! Please follow the instructions below and you should be up in running in no time.<br>
If you get stuck, head over to the <a href="http://silverstripe.org/community/forums/installing-silverstripe" target="_blank">installation forum</a>, or check out our page of <a href="http://www.silverstripe.org/hosting" target="_blank">suggested web hosting options</a> known to work with SilverStripe.
</p>
</div>
</div>
<div id="Navigation">&nbsp;</div>
<div class="clear"><!-- --></div>
<div id="Layout">
<div class="typography">
<form action="install.php" method="post">
<?php if($hasErrorOtherThanDatabase): ?>
<p class="message error">
You aren't currently able to install the software. Please <a href="#requirements">see below</a> for details.<br>
If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.org/framework/en/installation/server-requirements" target="_blank">server requirements</a>.
</p>
<?php if ($phpIniLocation): ?>
<p class="message warning">Your php.ini file is located at <?=$phpIniLocation; ?></p>
<?php endif; ?>
<?php else: ?>
<?php if($alreadyInstalled): ?>
<div class="message warning">
<p><strong>Note:</strong> SilverStripe is already installed here.<br>
If you wish to reinstall SilverStripe, please delete the <strong>mysite/_config.php</strong> file first.</p>
</div>
<?php elseif($req->hasWarnings()): ?>
<div class="message warning">
<p>There are some issues that we recommend you look at before installing, however, you are still able to install the software.
<br>Please see below for details. If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.org/framework/en/installation/server-requirements" target="_blank">server requirements</a>.</p>
</div>
<?php elseif(!$dbReq->hasErrors() && !$adminReq->hasErrors()): ?>
<div class="message goodInstall"><p>You're ready to install! Please confirm the configuration options below. <a href="#install">Install SilverStripe</a></p>
</div>
<?php endif; ?>
<?php if($dbReq->hasErrors()): ?>
<div class="message error">
<p>The database details don't appear to be correct. Please <a href="#database_credentials">review and correct</a> before installing.</p>
</div>
<?php endif; ?>
<?php if($adminReq->hasErrors()): ?>
<div class="message error">
<p>Please <a href="#AdminAccount">enter an email address and password</a> for the default administrator account before installing.</p>
</div>
<?php endif; ?>
<?php endif; ?>
<h3 class="sectionHeading" id="requirements">Requirements <small>Step 1 of 5</small></h3>
<?php $req->showTable(); ?>
<?php $dbReq->showTable(); ?>
<p class="helpText requirementsHelpText">
Read more about our <a href="http://doc.silverstripe.org/framework/en/installation/server-requirements" target="_blank">server requirements</a>.
</p>
<div class="action">
<input type="submit" class="action" value="Re-check requirements">
</div>
<div class="clear"><!-- --></div>
<h3 class="sectionHeading">Database Configuration <small>Step 2 of 5</small></h3>
<div id="database_credentials" class="section">
<?php $dbReq->showTable("Database Configuration"); ?>
<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="fields">
<div class="field">
<ul id="database_selection">
<?php
foreach($databaseClasses as $class => $details) {
$checked = ($databaseConfig['type'] == $class || $type == $class) ? ' checked="checked"' : '';
$disabled = $help = '';
if($usingEnv) {
// All are disabled by default when environment is used
$disabled = 'disabled="disabled"';
// If SS_DATABASE_CLASS is specified, check the database in the list
if(getenv('SS_DATABASE_CLASS') == $class) {
$checked = ' checked="checked"';
}
} else {
$disabled = !$details['supported'] || !$details['hasModule'] ? 'notavailable="true"' : '';
if ($disabled) {
if (!$details['supported'] && !$details['hasModule']) {
$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['missingModuleText'].'</li>';
} else if ($details['supported'] && !$details['hasModule']) {
$help = 'PHP has the required extension, but SilverStripe is missing the module';
$helpText = '<li style="width:auto">'.$details['missingModuleText'].'</li>';
} else if (!$details['supported'] && $details['hasModule']) {
$help = 'SilverStripe has the module installed, but PHP is missing the required extension';
$helpText = '<li style="width:auto">'.$details['missingExtensionText'].'</li>';
}
$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 || $disabled ? 'style="font-weight:normal;color:grey" ' : 'style="color:green"')."for=\"$class\">{$details['title']}</label>";
if ($help) {
echo '<div class="message error databaseError"><p>'.$help.'</p></div>';
}
// generate db-specific config fields
echo '<div class="dbfields">';
if(isset($details['fields'])) foreach($details['fields'] as $fieldName => $fieldSpec) {
$fieldTitle = $fieldSpec['title'];
$fieldType = ($fieldName == 'password') ? 'password' : 'text';
// values
$defaultValue = (isset($fieldSpec['default'])) ? $fieldSpec['default'] : null;
if($usingEnv && isset($fieldSpec['envVar']) && $envVar = getenv($fieldSpec['envVar'])) {
$value = $envVar;
} else {
$value = (isset($databaseConfig[$fieldName]) && $databaseConfig['type'] == $class) ? $databaseConfig[$fieldName] : $defaultValue;
}
// attributes
$attrs = array(
'id' => "db_{$class}_{$fieldName}",
'class' => 'text',
'type' => $fieldType,
'name' => "db[$class][$fieldName]",
'value' => $value,
);
if($usingEnv && isset($fieldSpec['envVar']) && getenv($fieldSpec['envVar'])) {
$attrs['disabled'] = 'disabled';
}
if(isset($fieldSpec['envVar'])) {
$attrs['class'] .= ' configured-by-env';
}
$attrHTML = '';
foreach($attrs as $attrName => $attrValue) $attrHTML .= "$attrName=\"" . htmlspecialchars($attrValue) . '"';
if(isset($fieldSpec['attributes'])) $attrs = array_merge($attrs, $fieldSpec['attributes']);
// html
echo "<div class=\"field\">";
echo "<label for=\"db_{$class}_$fieldName\">$fieldTitle:</label>";
echo "<span class=\"middleColumn\">";
echo "<input $attrHTML>";
echo "</span>";
echo "</div>";
}
echo '</div>';
echo "</li>";
}
?>
</ul>
<div id="use_environment_field" class="field">
<input id="use_environment" type="checkbox" name="useEnv" <?php if($usingEnv) echo "checked=\"checked\"" ?>>
<label for="use_environment">Use environment variables for configuration (<a href="http://doc.silverstripe.org/framework/en/topics/environment-management" target="_blank">?</a>)</label>
</div>
</div>
</div>
</div>
<div class="clear"><!-- --></div>
<div class="action">
<input type="submit" class="action" value="Re-check requirements">
</div>
<h3 class="sectionHeading">CMS Admin Account <small>Step 3 of 5</small></h3>
<div id="AdminAccount" class="section">
<div class="form__fieldGroup">
<p class="helpText">We will set up the first administrator account for you automatically. You can change these details later in the "Security" section within the CMS.</p>
<div class="field">
<label for="admin_username">Email:</label>
<span class="middleColumn">
<input type="text" class="text configured-by-env" name="admin[username]" id="admin_username" value="<?=htmlspecialchars($adminConfig['username'], ENT_QUOTES, 'UTF-8'); ?>" <?php if($usingEnv && getenv('SS_DEFAULT_ADMIN_USERNAME')) echo 'disabled="disabled"' ?>>
</span>
</div>
<div class="field">
<label for="admin_password">Password:</label>
<span class="middleColumn">
<input type="password" class="text configured-by-env" name="admin[password]" id="admin_password" value="<?=htmlspecialchars($adminConfig['password'], ENT_QUOTES, 'UTF-8'); ?>" <?php if($usingEnv && getenv('SS_DEFAULT_ADMIN_PASSWORD')) echo 'disabled="disabled"' ?>>
</span>
</div>
</div>
<div class="form__fieldGroup">
<p class="helpText">
"Default language" determines the default locale settings
(for dates, currencies, etc.), as well as the default language
of the CMS interface. This can be changed for each user.
<br>
<strong>Warning:</strong> The CMS interface may be missing translations in certain locales.
</p>
<div class="field">
<label for="locale">Default language:</label>
<span class="middleColumn">
<select name="locale" id="locale">
<?php
$selectedLocale = isset($_POST['locale']) ? $_POST['locale'] : $defaultLocale;
foreach($locales as $code => $title) {
$selected = $code == $selectedLocale ? ' selected="selected"' : '';
echo "<option$selected value=\"$code\">{$title}</option>\n";
}
?>
</select>
</span>
</div>
<div class="clear"><!-- --></div>
</div>
</div>
<div class="action">
<input type="submit" class="action" value="Re-check requirements">
</div>
<h3 class="sectionHeading">Theme selection <small>Step 4 of 5</small></h3>
<p class="helpText">You can change the theme or <a href="http://addons.silverstripe.org/add-ons?type=theme">download</a> another from the SilverStripe website after installation.</p>
<ul id="Themes">
<li><input type="radio" name="template" value="simple" id="Simple"
<?php if(!isset($_POST['template']) || $_POST['template'] == 'simple'): ?>checked="checked"<?php endif; ?>><label for="Simple"><a href="https://github.com/silverstripe-themes/silverstripe-simple">Simple</a> - our default theme ready to use, or begin the <a href="http://www.silverstripe.org/learn/lessons" target="_blank">lessons</a>.</label></li>
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial'): ?>checked="checked"<?php endif; ?>><label for="EmptyTemplate">Empty template</label></li>
</ul>
<h3 class="sectionHeading" id="install">Confirm Install <small>Step 5 of 5</small></h3>
<?php if($hasErrorOtherThanDatabase): ?>
<p class="error">
You aren't currently able to install the software. Please <a href="#requirements">see above</a> for details.<br>
If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.org/doku.php?id=server-requirements">server requirements page</a>.
</p>
<?php else: ?>
<p id="stats-container">
<input type="checkbox" id="stats" name="stats" checked="checked">
<label for="stats">Send information about my webserver to silverstripe.org<br />
<small>(anonymous version information, used for statistical purposes)</small>
</label><p>
<p>
<?php if($alreadyInstalled): ?>
<input id="install_button" type="submit" disabled="disabled" class="action" name="go" value="Install SilverStripe">
<?php else: ?>
<input id="install_button" type="submit" class="action" name="go" value="Install SilverStripe">
<?php endif; ?>
<span id="saving_top" style="display: none">
&nbsp;
<img src="<?=FRAMEWORK_NAME; ?>/images/network-save.gif" alt="Saving">
(this will take a minute or so)
</span>
</p>
<?php endif ?>
</form>
</div>
</div>
<div class="clear"><!-- --></div>
</div>
<div id="Footer">
<div class="footerTop"><!-- --></div>
<p><a href="http://silverstripe.org">SilverStripe Open Source CMS / Framework</a> | Copyright &copy; <?=date('Y'); ?> SilverStripe Limited</p>
</div>
</div>
</body>
</html>