MINOR: Fixed newlines and set svn:eol-style to native

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79478 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-17 23:14:40 +00:00
parent 6bd759b4ca
commit 610232f19c
5 changed files with 753 additions and 753 deletions

View File

@ -1,231 +1,231 @@
<?php <?php
/** /**
* Base class for URL access to development tools. Currently supports the * Base class for URL access to development tools. Currently supports the
* ; and TaskRunner. * ; and TaskRunner.
* *
* @todo documentation for how to add new unit tests and tasks * @todo documentation for how to add new unit tests and tasks
* @package sapphire * @package sapphire
* @subpackage dev * @subpackage dev
*/ */
class DevelopmentAdmin extends Controller { class DevelopmentAdmin extends Controller {
static $url_handlers = array( static $url_handlers = array(
'' => 'index', '' => 'index',
'$Action' => '$Action', '$Action' => '$Action',
'$Action//$Action/$ID' => 'handleAction', '$Action//$Action/$ID' => 'handleAction',
); );
function init() { function init() {
parent::init(); parent::init();
// We allow access to this controller regardless of live-status or ADMIN permission only // We allow access to this controller regardless of live-status or ADMIN permission only
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN. // if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
$canAccess = ( $canAccess = (
Director::isDev() Director::isDev()
|| Director::is_cli() || Director::is_cli()
|| Permission::check("ADMIN") || Permission::check("ADMIN")
); );
if(!$canAccess) { if(!$canAccess) {
return Security::permissionFailure($this, return Security::permissionFailure($this,
"This page is secured and you need administrator rights to access it. " . "This page is secured and you need administrator rights to access it. " .
"Enter your credentials below and we will send you right along."); "Enter your credentials below and we will send you right along.");
} }
// check for valid url mapping // check for valid url mapping
// lacking this information can cause really nasty bugs, // lacking this information can cause really nasty bugs,
// e.g. when running Director::test() from a FunctionalTest instance // e.g. when running Director::test() from a FunctionalTest instance
global $_FILE_TO_URL_MAPPING; global $_FILE_TO_URL_MAPPING;
if(Director::is_cli()) { if(Director::is_cli()) {
if(isset($_FILE_TO_URL_MAPPING)) { if(isset($_FILE_TO_URL_MAPPING)) {
$fullPath = $testPath = $_SERVER['SCRIPT_FILENAME']; $fullPath = $testPath = $_SERVER['SCRIPT_FILENAME'];
while($testPath && $testPath != "/") { while($testPath && $testPath != "/") {
$matched = false; $matched = false;
if(isset($_FILE_TO_URL_MAPPING[$testPath])) { if(isset($_FILE_TO_URL_MAPPING[$testPath])) {
$matched = true; $matched = true;
break; break;
} }
$testPath = dirname($testPath); $testPath = dirname($testPath);
} }
if(!$matched) { if(!$matched) {
echo 'Warning: You probably want to define '. echo 'Warning: You probably want to define '.
'an entry in $_FILE_TO_URL_MAPPING that covers "' . Director::baseFolder() . '"' . "\n"; 'an entry in $_FILE_TO_URL_MAPPING that covers "' . Director::baseFolder() . '"' . "\n";
} }
} }
else { else {
echo 'Warning: You probably want to define $_FILE_TO_URL_MAPPING in '. echo 'Warning: You probably want to define $_FILE_TO_URL_MAPPING in '.
'your _ss_environment.php as instructed on the "sake" page of the doc.silverstripe.com wiki' . "\n"; 'your _ss_environment.php as instructed on the "sake" page of the doc.silverstripe.com wiki' . "\n";
} }
} }
} }
function index() { function index() {
$actions = array( $actions = array(
"build" => "Build/rebuild this environment (formerly db/build). Call this whenever you have updated your project sources", "build" => "Build/rebuild this environment (formerly db/build). Call this whenever you have updated your project sources",
"reset" => "Reset this environment - truncate the database and rebuild. This is useful after testing to start with a fresh working copy", "reset" => "Reset this environment - truncate the database and rebuild. This is useful after testing to start with a fresh working copy",
"tests" => "See a list of unit tests to run", "tests" => "See a list of unit tests to run",
"tests/all" => "Run all tests", "tests/all" => "Run all tests",
"jstests" => "See a list of JavaScript tests to run", "jstests" => "See a list of JavaScript tests to run",
"jstests/all" => "Run all JavaScript tests", "jstests/all" => "Run all JavaScript tests",
"modules/add" => "Add a module, for example, 'sake dev/modules/add ecommerce'", "modules/add" => "Add a module, for example, 'sake dev/modules/add ecommerce'",
"tasks" => "See a list of build tasks to run", "tasks" => "See a list of build tasks to run",
"viewcode" => "Read source code in a literate programming style", "viewcode" => "Read source code in a literate programming style",
); );
// Web mode // Web mode
if(!Director::is_cli()) { if(!Director::is_cli()) {
// This action is sake-only right now. // This action is sake-only right now.
unset($actions["modules/add"]); unset($actions["modules/add"]);
$renderer = new DebugView(); $renderer = new DebugView();
$renderer->writeHeader(); $renderer->writeHeader();
$renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL()); $renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL());
$base = Director::baseURL(); $base = Director::baseURL();
echo '<div class="options"><ul>'; echo '<div class="options"><ul>';
foreach($actions as $action => $description) { foreach($actions as $action => $description) {
echo "<li><a href=\"{$base}dev/$action\"><b>/dev/$action:</b> $description</a></li>\n"; echo "<li><a href=\"{$base}dev/$action\"><b>/dev/$action:</b> $description</a></li>\n";
} }
$renderer->writeFooter(); $renderer->writeFooter();
// CLI mode // CLI mode
} else { } else {
echo "SAPPHIRE DEVELOPMENT TOOLS\n--------------------------\n\n"; echo "SAPPHIRE DEVELOPMENT TOOLS\n--------------------------\n\n";
echo "You can execute any of the following commands:\n\n"; echo "You can execute any of the following commands:\n\n";
foreach($actions as $action => $description) { foreach($actions as $action => $description) {
echo " sake dev/$action: $description\n"; echo " sake dev/$action: $description\n";
} }
echo "\n\n"; echo "\n\n";
} }
} }
function tests($request) { function tests($request) {
return new TestRunner(); return new TestRunner();
} }
function jstests($request) { function jstests($request) {
return new JSTestRunner(); return new JSTestRunner();
} }
function tasks() { function tasks() {
return new TaskRunner(); return new TaskRunner();
} }
function modules() { function modules() {
return new ModuleManager(); return new ModuleManager();
} }
function viewmodel() { function viewmodel() {
return new ModelViewer(); return new ModelViewer();
} }
function build() { function build() {
if(Director::is_cli()) { if(Director::is_cli()) {
$da = new DatabaseAdmin(); $da = new DatabaseAdmin();
$da->build(); $da->build();
} else { } else {
$renderer = new DebugView(); $renderer = new DebugView();
$renderer->writeHeader(); $renderer->writeHeader();
$renderer->writeInfo("Environment Builder (formerly db/build)", Director::absoluteBaseURL()); $renderer->writeInfo("Environment Builder (formerly db/build)", Director::absoluteBaseURL());
echo "<div style=\"margin: 0 2em\">"; echo "<div style=\"margin: 0 2em\">";
$da = new DatabaseAdmin(); $da = new DatabaseAdmin();
$da->build(); $da->build();
echo "</div>"; echo "</div>";
$renderer->writeFooter(); $renderer->writeFooter();
} }
} }
function reset() { function reset() {
global $databaseConfig; global $databaseConfig;
$databaseName = $databaseConfig['database']; $databaseName = $databaseConfig['database'];
if(Director::is_cli()) { if(Director::is_cli()) {
echo "\nPlease run dev/reset from your web browser.\n"; echo "\nPlease run dev/reset from your web browser.\n";
} else { } else {
$renderer = new DebugView(); $renderer = new DebugView();
$renderer->writeHeader(); $renderer->writeHeader();
$renderer->writeInfo('Database reset', 'Completely truncate and rebuild the current database'); $renderer->writeInfo('Database reset', 'Completely truncate and rebuild the current database');
echo '<div style="margin: 0 2em">'; echo '<div style="margin: 0 2em">';
if(isset($_GET['done'])) { if(isset($_GET['done'])) {
echo "<p style=\"color: green\"><b>$databaseName</b> has been completely truncated and rebuilt.</p>"; echo "<p style=\"color: green\"><b>$databaseName</b> has been completely truncated and rebuilt.</p>";
echo "<p>Note: If you had <i>SS_DEFAULT_ADMIN_USERNAME</i> and <i>SS_DEFAULT_ADMIN_PASSWORD</i> echo "<p>Note: If you had <i>SS_DEFAULT_ADMIN_USERNAME</i> and <i>SS_DEFAULT_ADMIN_PASSWORD</i>
defined in your <b>_ss_environment.php</b> file, a default admin Member record has been created defined in your <b>_ss_environment.php</b> file, a default admin Member record has been created
with those credentials.</p>"; with those credentials.</p>";
} else { } else {
echo $this->ResetForm()->renderWith('Form'); echo $this->ResetForm()->renderWith('Form');
} }
echo '</div>'; echo '</div>';
$renderer->writeFooter(); $renderer->writeFooter();
} }
} }
function ResetForm() { function ResetForm() {
global $databaseConfig; global $databaseConfig;
$databaseName = $databaseConfig['database']; $databaseName = $databaseConfig['database'];
if(!Session::get('devResetRandNumber')) { if(!Session::get('devResetRandNumber')) {
$rand = rand(5,500); $rand = rand(5,500);
Session::set('devResetRandNumber', $rand); Session::set('devResetRandNumber', $rand);
} else { } else {
$rand = Session::get('devResetRandNumber'); $rand = Session::get('devResetRandNumber');
} }
$form = new Form( $form = new Form(
$this, $this,
'ResetForm', 'ResetForm',
new FieldSet( new FieldSet(
new LiteralField('ResetWarning', "<p style=\"color: red\">WARNING: This will completely new LiteralField('ResetWarning', "<p style=\"color: red\">WARNING: This will completely
destroy ALL existing data in <b>$databaseName</b>! &nbsp; Press the button below to destroy ALL existing data in <b>$databaseName</b>! &nbsp; Press the button below to
confirm this action.</p>"), confirm this action.</p>"),
new HiddenField('devResetRandNumber', '', $rand) new HiddenField('devResetRandNumber', '', $rand)
), ),
new FieldSet( new FieldSet(
new FormAction('doReset', 'Reset and completely rebuild the database') new FormAction('doReset', 'Reset and completely rebuild the database')
) )
); );
$form->setFormAction(Director::absoluteBaseURL() . 'dev/ResetForm'); $form->setFormAction(Director::absoluteBaseURL() . 'dev/ResetForm');
return $form; return $form;
} }
function doReset($data, $form, $request) { function doReset($data, $form, $request) {
if(!isset($data['devResetRandNumber'])) { if(!isset($data['devResetRandNumber'])) {
Director::redirectBack(); Director::redirectBack();
return false; return false;
} }
// Avoid accidental database resets by checking the posted number to the one in session // Avoid accidental database resets by checking the posted number to the one in session
if(Session::get('devResetRandNumber') != $data['devResetRandNumber']) { if(Session::get('devResetRandNumber') != $data['devResetRandNumber']) {
Director::redirectBack(); Director::redirectBack();
return false; return false;
} }
$da = new DatabaseAdmin(); $da = new DatabaseAdmin();
$da->clearAllData(); $da->clearAllData();
// If _ss_environment.php has some constants set for default admin, set these up in the request // If _ss_environment.php has some constants set for default admin, set these up in the request
$_REQUEST['username'] = defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : null; $_REQUEST['username'] = defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : null;
$_REQUEST['password'] = defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : null; $_REQUEST['password'] = defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : null;
$da->build(); $da->build();
Session::clear('devResetRandNumber'); Session::clear('devResetRandNumber');
Director::redirect(Director::absoluteBaseURL() . 'dev/reset?done=1'); Director::redirect(Director::absoluteBaseURL() . 'dev/reset?done=1');
} }
function errors() { function errors() {
Director::redirect("Debug_"); Director::redirect("Debug_");
} }
function viewcode($request) { function viewcode($request) {
return new CodeViewer(); return new CodeViewer();
} }
} }
?> ?>

View File

@ -1,173 +1,173 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>SilverStripe CMS Installation</title> <title>SilverStripe CMS Installation</title>
<script type="text/js"> <script type="text/js">
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';
} }
</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" />
<link rel="stylesheet" type="text/css" href="themes/blackcandy/css/form.css" /> <link rel="stylesheet" type="text/css" href="themes/blackcandy/css/form.css" />
<link rel="stylesheet" type="text/css" href="sapphire/dev/install/install.css" /> <link rel="stylesheet" type="text/css" href="sapphire/dev/install/install.css" />
<link rel="shortcut icon" href="favicon.ico" /> <link rel="shortcut icon" href="favicon.ico" />
</head> </head>
<body> <body>
<div id="BgContainer"> <div id="BgContainer">
<div id="Container"> <div id="Container">
<div id="Header"> <div id="Header">
<h1>SilverStripe CMS Installation</h1> <h1>SilverStripe CMS Installation</h1>
<p>Version <?php echo $silverstripe_version; ?></p> <p>Version <?php echo $silverstripe_version; ?></p>
</div> </div>
<div id="Navigation">&nbsp;</div> <div id="Navigation">&nbsp;</div>
<div class="clear"><!-- --></div> <div class="clear"><!-- --></div>
<div id="Layout"> <div id="Layout">
<div class="typography"> <div class="typography">
<h1>Welcome to SilverStripe</h1> <h1>Welcome to SilverStripe</h1>
<p>Thanks for choosing to use SilverStripe! Please follow the instructions below to get SilverStripe installed.</p> <p>Thanks for choosing to use SilverStripe! Please follow the instructions below to get SilverStripe installed.</p>
<form action="install.php" method="post"> <form action="install.php" method="post">
<?php if(isset($hasErrorOtherThanDatabase)) { ?> <?php if(isset($hasErrorOtherThanDatabase)) { ?>
<p class="error"> <p class="error">
You aren't currently able to install the software. Please <a href="#requirements">see below</a> for details.<br /> 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.com/doku.php?id=server-requirements">server requirements wiki page</a>. If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.com/doku.php?id=server-requirements">server requirements wiki page</a>.
</p> </p>
<?php } else { ?> <?php } else { ?>
<?php if($req->hasWarnings()) { ?> <?php if($req->hasWarnings()) { ?>
<p class="warning"> <p class="warning">
There are some issues that we recommend you look at before installing, however, you are still able to install the software. There are some issues that we recommend you look at before installing, however, you are still able to install the software.
Please see below for details.<br /> Please see below for details.<br />
If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.com/doku.php?id=server-requirements">server requirements wiki page</a>. If you are having problems meeting the requirements, see the <a href="http://doc.silverstripe.com/doku.php?id=server-requirements">server requirements wiki page</a>.
</p> </p>
<?php } else if(!$dbReq->hasErrors()) { ?> <?php } else if(!$dbReq->hasErrors()) { ?>
<p class="good"> <p class="good">
You're ready to install! &nbsp;&nbsp; You're ready to install! &nbsp;&nbsp;
</p> </p>
<?php } ?> <?php } ?>
<p> <p>
<b>Template to install:</b> <b>Template to install:</b>
</p> </p>
<ul id="Themes"> <ul id="Themes">
<li><input type="radio" name="template" value="blackcandy" id="BlackCandy" <?php if(!isset($_POST['template']) || $_POST['template'] == 'blackcandy') {?>checked="checked"<?php }?> /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li> <li><input type="radio" name="template" value="blackcandy" id="BlackCandy" <?php if(!isset($_POST['template']) || $_POST['template'] == 'blackcandy') {?>checked="checked"<?php }?> /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li>
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial') {?>checked="checked"<?php }?>/><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li> <li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial') {?>checked="checked"<?php }?>/><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li>
</ul> </ul>
<p>You can change the template or download another from the SilverStripe website after installation.</p> <p>You can change the template or download another from the SilverStripe website after installation.</p>
<input type="checkbox" id="stats" name="stats" checked="checked"><label for="stats">Send information on my webserver to SilverStripe (this is only version information, used for statistical purposes)</label><br /> <input type="checkbox" id="stats" name="stats" checked="checked"><label for="stats">Send information on my webserver to SilverStripe (this is only version information, used for statistical purposes)</label><br />
<?php if($alreadyInstalled) { ?> <?php if($alreadyInstalled) { ?>
<p class="warning"> <p class="warning">
<strong>Note:</strong> It seems as though SilverStripe is already installed here. If you ask me to install, I will overwrite <strong>Note:</strong> It seems as though SilverStripe is already installed here. If you ask me to install, I will overwrite
the <strong>.htaccess</strong> and <strong>mysite/_config.php</strong> files. the <strong>.htaccess</strong> and <strong>mysite/_config.php</strong> files.
<br /> <br />
<input type="checkbox" id="ReIn" name="force_reinstall" onclick="document.getElementById('install_button').disabled = !this.checked" /><label for="ReIn">That's okay, please re-install SilverStripe and overwrite these files.</label> <input type="checkbox" id="ReIn" name="force_reinstall" onclick="document.getElementById('install_button').disabled = !this.checked" /><label for="ReIn">That's okay, please re-install SilverStripe and overwrite these files.</label>
</p> </p>
<?php } ?> <?php } ?>
<p> <p>
<?php if($alreadyInstalled) { ?> <?php if($alreadyInstalled) { ?>
<input id="install_button" type="submit" disabled="disabled" class="action" name="go" value="Install SilverStripe" onclick="document.getElementById('saving_top').style.display = ''; this.value = 'Installing SilverStripe...'" /> <input id="install_button" type="submit" disabled="disabled" class="action" name="go" value="Install SilverStripe" onclick="document.getElementById('saving_top').style.display = ''; this.value = 'Installing SilverStripe...'" />
<?php } else { ?> <?php } else { ?>
<input id="install_button" type="submit" class="action" name="go" value="Install SilverStripe" onclick="document.getElementById('saving_top').style.display = ''; this.value = 'Installing SilverStripe...'" /> <input id="install_button" type="submit" class="action" name="go" value="Install SilverStripe" onclick="document.getElementById('saving_top').style.display = ''; this.value = 'Installing SilverStripe...'" />
<?php } ?> <?php } ?>
<span id="saving_top" style="display: none"> <span id="saving_top" style="display: none">
&nbsp; &nbsp;
<img src="cms/images/network-save.gif" /> <img src="cms/images/network-save.gif" />
(this will take a minute or so) (this will take a minute or so)
</span> </span>
</p> </p>
<?php } ?> <?php } ?>
<input type="hidden" name="database" value="MySQLDatabase" /> <input type="hidden" name="database" value="MySQLDatabase" />
<h4>MySQL Database</h4> <h4>MySQL Database</h4>
<?php if($dbReq->hasErrors()) { ?> <?php if($dbReq->hasErrors()) { ?>
<p class="error"><!-- class="error" --> <p class="error"><!-- 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 { ?>
<p class="good"> <p class="good">
These database details look all good! These database details look all good!
</p> </p>
<?php } ?> <?php } ?>
<p id="mysql_credentials"> <p id="mysql_credentials">
<label for="mysql_server">MySQL server:</label> <label for="mysql_server">MySQL server:</label>
<span class="middleColumn"><input id="mysql_server" class="text" type="text" name="mysql[server]" value="<?php echo $databaseConfig['server']; ?>" /></span> <span class="middleColumn"><input id="mysql_server" class="text" type="text" name="mysql[server]" value="<?php echo $databaseConfig['server']; ?>" /></span>
<label for="mysql_username">MySQL username:</label> <label for="mysql_username">MySQL username:</label>
<span class="middleColumn"><input id="mysql_username" class="text" type="text" name="mysql[username]" value="<?php echo $databaseConfig['username']; ?>" /></span> <span class="middleColumn"><input id="mysql_username" class="text" type="text" name="mysql[username]" value="<?php echo $databaseConfig['username']; ?>" /></span>
<label for="mysql_password">MySQL password:</label> <label for="mysql_password">MySQL password:</label>
<span class="middleColumn"><input id="mysql_password" class="text" type="password" name="mysql[password]" value="<?php echo $databaseConfig['password']; ?>" /></span> <span class="middleColumn"><input id="mysql_password" class="text" type="password" name="mysql[password]" value="<?php echo $databaseConfig['password']; ?>" /></span>
<label for="mysql_database">MySQL database:</label> <label for="mysql_database">MySQL database:</label>
<span class="middleColumn"><input id="mysql_database" class="text" type="text" name="mysql[database]" value="<?php echo $databaseConfig['database']; ?>" onchange="this.value = this.value.replace(/[\/\\:*?&quot;<>|. \t]+/g,'');" /></span> <span class="middleColumn"><input id="mysql_database" class="text" type="text" name="mysql[database]" value="<?php echo $databaseConfig['database']; ?>" onchange="this.value = this.value.replace(/[\/\\:*?&quot;<>|. \t]+/g,'');" /></span>
<input type="submit" class="action" value="Re-check requirements" /> <input type="submit" class="action" value="Re-check requirements" />
</p> </p>
<p class="mysql">SilverStripe stores its content in a MySQL 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.</p> <p class="mysql">SilverStripe stores its content in a MySQL 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.</p>
<div class="clear"><!-- --></div> <div class="clear"><!-- --></div>
<h5>Details</h5> <h5>Details</h5>
<?php $dbReq->showTable("MySQL Configuration"); ?> <?php $dbReq->showTable("MySQL Configuration"); ?>
<br /> <br />
<h4>SilverStripe Administration Account</h4> <h4>SilverStripe Administration Account</h4>
<p id="AdminAccount"> <p id="AdminAccount">
<label for="admin_username">Administrator email:</label> <label for="admin_username">Administrator email:</label>
<span class="middleColumn"><input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" /></span>
<label for="admin_password">Administrator password:</label> <label for="admin_password">Administrator password:</label>
<span class="middleColumn"><input type="text" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" /></span>
<label for="admin_firstname">Administrator first name:</label> <label for="admin_firstname">Administrator first name:</label>
<span class="middleColumn"><input type="text" class="text" name="admin[firstname]" id="admin_firstname" value="<?php echo $adminConfig['firstname']; ?>" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[firstname]" id="admin_firstname" value="<?php echo $adminConfig['firstname']; ?>" /></span>
<label for="admin_surname">Administrator surname:</label> <label for="admin_surname">Administrator surname:</label>
<span class="middleColumn"><input type="text" class="text" name="admin[surname]" id="admin_surname" value="<?php echo $adminConfig['surname']; ?>" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[surname]" id="admin_surname" value="<?php echo $adminConfig['surname']; ?>" /></span>
</p> </p>
<p class="adminAcc"> <p class="adminAcc">
We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd 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. rather log-in with a username instead of an email address, enter that instead.
</p> </p>
<br /> <br />
<h4>Development Servers</h4> <h4>Development Servers</h4>
<p id="DevSites"> <p id="DevSites">
<label for="devsites">Development servers:</label> <label for="devsites">Development servers:</label>
<span class="middleColumn"><textarea name="devsites" id="devsites" rows="5" />localhost <span class="middleColumn"><textarea name="devsites" id="devsites" rows="5" />localhost
127.0.0.1</textarea></span> 127.0.0.1</textarea></span>
</p> </p>
<p class="devHelp"> <p class="devHelp">
SilverStripe allows you to run a site in <a href="http://doc.silverstripe.com/doku.php?id=devmode">development mode</a>. SilverStripe allows you to run a site in <a href="http://doc.silverstripe.com/doku.php?id=devmode">development mode</a>.
This shows all error messages in the web browser instead of emailing them to the administrator, and allows 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 the database to be built without logging in as administrator. Please enter the host/domain names for servers
you will be using for development. you will be using for development.
</p> </p>
<br /> <br />
<h4 id="requirements">Requirements</h4> <h4 id="requirements">Requirements</h4>
<?php <?php
$req->showTable(); $req->showTable();
?> ?>
</form> </form>
</div> </div>
</div> </div>
<div class="clear"><!-- --></div> <div class="clear"><!-- --></div>
</div> </div>
<div id="Footer"> <div id="Footer">
<div class="footerTop"><!-- --></div> <div class="footerTop"><!-- --></div>
<p><a href="http://www.silverstripe.com">SilverStripe Open Source CMS</a> | Copyright &copy; 2008 SilverStripe Limited</p> <p><a href="http://www.silverstripe.com">SilverStripe Open Source CMS</a> | Copyright &copy; 2008 SilverStripe Limited</p>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,118 +1,118 @@
body { body {
text-align: center; text-align: center;
} }
#Container * { #Container * {
text-align: left; text-align: left;
} }
ul#Themes{ ul#Themes{
list-style: none; list-style: none;
margin: 5px; margin: 5px;
} }
ul#Themes li { ul#Themes li {
clear: both; clear: both;
padding: 3px 0; padding: 3px 0;
} }
ul#Themes input { ul#Themes input {
float: left; float: left;
width: 10px; width: 10px;
height: 10px; height: 10px;
} }
ul#Themes label { ul#Themes label {
margin: -2px 5px 0 15px; margin: -2px 5px 0 15px;
} }
.good td { .good td {
color: green; color: green;
} }
.warning td { .warning td {
color: #ef7f24; color: #ef7f24;
} }
.testResults .error td { .testResults .error td {
border: 1px #CCC solid; border: 1px #CCC solid;
color: red; color: red;
} }
p.error { p.error {
padding: 0.5em; padding: 0.5em;
background-color: #ffe9e9; background-color: #ffe9e9;
border: 1px #ff8e8e solid; border: 1px #ff8e8e solid;
color: #f03838; color: #f03838;
} }
p.warning { p.warning {
padding: 0.5em; padding: 0.5em;
background-color: #fef1e1; background-color: #fef1e1;
border: 1px #ffc28b solid; border: 1px #ffc28b solid;
color: #cb6a1c; color: #cb6a1c;
} }
p.warning label { p.warning label {
display: inline; display: inline;
margin-left: 5px; margin-left: 5px;
color: #cb6a1c color: #cb6a1c
} }
p.good { p.good {
padding: 0.5em; padding: 0.5em;
background-color: #e2fee1; background-color: #e2fee1;
border: 1px #43cb3e solid; border: 1px #43cb3e solid;
color: #359318; color: #359318;
} }
p.error a, p.error a,
p.warning a, p.warning a,
p.good a { p.good a {
color: inherit; color: inherit;
text-decoration: underline; text-decoration: underline;
} }
p.error a:hover { p.error a:hover {
text-decoration: none; text-decoration: none;
} }
span.middleColumn { span.middleColumn {
width: 312px; width: 312px;
margin-right: 0; margin-right: 0;
padding: 4px; padding: 4px;
} }
input.text, textarea, select { input.text, textarea, select {
padding: 2px; padding: 2px;
border: 1px solid #A7A7A7; border: 1px solid #A7A7A7;
color: #000; color: #000;
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
width: 305px; width: 305px;
} }
#stats { #stats {
float: left; float: left;
margin: 5px; margin: 5px;
}
table.testResults {
border-collapse: collapse;
width: 100%;
margin: 10px 0;
}
#Layout h4 {
font-size: 2em;
clear: left;
}
.testResults td {
border: 1px #CCC solid;
width: 400px;
padding: 4px;
}
.clear {
clear: both;
}
p.mysql,
p.adminAcc,
p.devHelp {
padding-top: 20px;
} }
p#mysql_credentials, table.testResults {
border-collapse: collapse;
width: 100%;
margin: 10px 0;
}
#Layout h4 {
font-size: 2em;
clear: left;
}
.testResults td {
border: 1px #CCC solid;
width: 400px;
padding: 4px;
}
.clear {
clear: both;
}
p.mysql,
p.adminAcc,
p.devHelp {
padding-top: 20px;
}
p#mysql_credentials,
p#AdminAccount, p#AdminAccount,
p#DevSites { p#DevSites {
width: 330px; width: 330px;
margin-top: 0; margin-top: 0;
float: left; float: left;
} }
#Layout input.action { #Layout input.action {
text-align: center; text-align: center;
width: 160px; width: 160px;
font-size: 1em; font-size: 1em;
} }

View File

@ -29,15 +29,15 @@ RelationComplexTableField.prototype = {
//if( checkedListNameArray == null ) { //if( checkedListNameArray == null ) {
checkedListNameArray = []; checkedListNameArray = [];
checkedListNameArray.push( checkedListName ); checkedListNameArray.push( checkedListName );
checkedArray = []; checkedArray = [];
if( checkedList.getAttribute( 'value' ) ) if( checkedList.getAttribute( 'value' ) )
checkedArray.push( checkedList.getAttribute( 'value' ).split( ',' ) ); checkedArray.push( checkedList.getAttribute( 'value' ).split( ',' ) );
//} //}
/* /*
else if( checkedListNameArray.indexOf( checkedListName ) < 0 ) { else if( checkedListNameArray.indexOf( checkedListName ) < 0 ) {
checkedListNameArray.push( checkedListName ); checkedListNameArray.push( checkedListName );
if( checkedList.getAttribute( 'value' ) ) if( checkedList.getAttribute( 'value' ) )
checkedArray[ checkedListNameArray.length - 1 ] = checkedList.getAttribute( 'value' ).split( ',' ); checkedArray[ checkedListNameArray.length - 1 ] = checkedList.getAttribute( 'value' ).split( ',' );
} }
else { else {
@ -56,7 +56,7 @@ RelationComplexTableField.prototype = {
if( checkedArray[ index ] && checkedArray[ index ].indexOf( markingInput.getAttribute( 'value' ) ) > -1 ) { if( checkedArray[ index ] && checkedArray[ index ].indexOf( markingInput.getAttribute( 'value' ) ) > -1 ) {
markingInput.setAttribute( 'checked', 'checked' );} markingInput.setAttribute( 'checked', 'checked' );}
else else
markingInput.removeAttribute( 'checked' ); markingInput.removeAttribute( 'checked' );
} }
} */ } */
@ -75,7 +75,7 @@ RelationComplexTableField.prototype = {
for( var i = 0; i < inputs.length; i++ ) { for( var i = 0; i < inputs.length; i++ ) {
var checkedList = inputs[ i ]; var checkedList = inputs[ i ];
if( checkedList.getAttribute( 'name' ) == checkedListName ) if( checkedList.getAttribute( 'name' ) == checkedListName )
break; break;
} }
var index = checkedListNameArray.indexOf( checkedListName ); var index = checkedListNameArray.indexOf( checkedListName );
@ -104,8 +104,8 @@ RelationComplexTableField.prototype = {
// 3) Update The Hidden Input Field // 3) Update The Hidden Input Field
checkedList.setAttribute( 'value', checkedArray[ index ] ); checkedList.setAttribute( 'value', checkedArray[ index ] );
} }
}; };
Behaviour.register( rules ); Behaviour.register( rules );

View File

@ -1,233 +1,233 @@
/** /**
* On-demand JavaScript handler * On-demand JavaScript handler
* Based on http://plugins.jquery.com/files/issues/jquery.ondemand.js_.txt and modified to integrate with Sapphire * Based on http://plugins.jquery.com/files/issues/jquery.ondemand.js_.txt and modified to integrate with Sapphire
*/ */
(function($){ (function($){
function isExternalScript(url){ function isExternalScript(url){
re = new RegExp('(http|https)://'); re = new RegExp('(http|https)://');
return re.test(url); return re.test(url);
}; };
$.extend({ $.extend({
requireConfig : { requireConfig : {
routeJs : '', // empty default paths give more flexibility and user has routeJs : '', // empty default paths give more flexibility and user has
routeCss : '' // choice of using this config or full path in scriptUrl argument routeCss : '' // choice of using this config or full path in scriptUrl argument
}, // previously were useless for users which don't use '_js/' and '_css/' folders. (by PGA) }, // previously were useless for users which don't use '_js/' and '_css/' folders. (by PGA)
queue : [], queue : [],
pending : null, pending : null,
loaded_list : null, // loaded files list - to protect against loading existed file again (by PGA) loaded_list : null, // loaded files list - to protect against loading existed file again (by PGA)
// Added by SRM: Initialise the loaded_list with the scripts included on first load // Added by SRM: Initialise the loaded_list with the scripts included on first load
initialiseItemLoadedList : function() { initialiseItemLoadedList : function() {
if(this.loaded_list == null) { if(this.loaded_list == null) {
$this = this; $this = this;
$this.loaded_list = {}; $this.loaded_list = {};
$('script').each(function() { $('script').each(function() {
if($(this).attr('src')) $this.loaded_list[ $(this).attr('src') ] = 1; if($(this).attr('src')) $this.loaded_list[ $(this).attr('src') ] = 1;
}); });
$('link[@rel="stylesheet"]').each(function() { $('link[@rel="stylesheet"]').each(function() {
if($(this).attr('href')) $this.loaded_list[ $(this).attr('href') ] = 1; if($(this).attr('href')) $this.loaded_list[ $(this).attr('href') ] = 1;
}); });
} }
}, },
/** /**
* Returns true if the given CSS or JS script has already been loaded * Returns true if the given CSS or JS script has already been loaded
*/ */
isItemLoaded : function(scriptUrl) { isItemLoaded : function(scriptUrl) {
this.initialiseItemLoadedList(); this.initialiseItemLoadedList();
return this.loaded_list[scriptUrl] != undefined; return this.loaded_list[scriptUrl] != undefined;
}, },
requireJs : function(scriptUrl, callback, opts, obj, scope) requireJs : function(scriptUrl, callback, opts, obj, scope)
{ {
if(opts != undefined || opts == null){ if(opts != undefined || opts == null){
$.extend($.requireConfig, opts); $.extend($.requireConfig, opts);
} }
var _request = { var _request = {
url : scriptUrl, url : scriptUrl,
callback : callback, callback : callback,
opts : opts, opts : opts,
obj : obj, obj : obj,
scope : scope scope : scope
} }
if(this.pending) if(this.pending)
{ {
this.queue.push(_request); this.queue.push(_request);
return; return;
} }
this.pending = _request; this.pending = _request;
this.initialiseItemLoadedList(); this.initialiseItemLoadedList();
if (this.loaded_list[this.pending.url] != undefined) { // if required file exists (by PGA) if (this.loaded_list[this.pending.url] != undefined) { // if required file exists (by PGA)
this.requestComplete(); // => request complete this.requestComplete(); // => request complete
return; return;
} }
var _this = this; var _this = this;
var _url = (isExternalScript(scriptUrl)) ? scriptUrl : $.requireConfig.routeJs + scriptUrl; var _url = (isExternalScript(scriptUrl)) ? scriptUrl : $.requireConfig.routeJs + scriptUrl;
var _head = document.getElementsByTagName('head')[0]; var _head = document.getElementsByTagName('head')[0];
var _scriptTag = document.createElement('script'); var _scriptTag = document.createElement('script');
// Firefox, Opera // Firefox, Opera
$(_scriptTag).bind('load', function(){ $(_scriptTag).bind('load', function(){
_this.requestComplete(); _this.requestComplete();
}); });
// IE // IE
_scriptTag.onreadystatechange = function(){ _scriptTag.onreadystatechange = function(){
if(this.readyState === 'loaded' || this.readyState === 'complete'){ if(this.readyState === 'loaded' || this.readyState === 'complete'){
_this.requestComplete(); _this.requestComplete();
} }
} }
_scriptTag.type = "text/javascript"; _scriptTag.type = "text/javascript";
_scriptTag.src = _url; _scriptTag.src = _url;
_head.appendChild(_scriptTag); _head.appendChild(_scriptTag);
}, },
requestComplete : function() requestComplete : function()
{ {
if(this.pending.callback){ if(this.pending.callback){
if(this.pending.obj){ if(this.pending.obj){
if(this.pending.scope){ if(this.pending.scope){
this.pending.callback.call(this.pending.obj); this.pending.callback.call(this.pending.obj);
} else { } else {
this.pending.callback.call(window, this.pending.obj); this.pending.callback.call(window, this.pending.obj);
} }
} else { } else {
this.pending.callback.call(); this.pending.callback.call();
} }
} }
this.loaded_list[this.pending.url] = 1; // adding loaded file to loaded list (by PGA) this.loaded_list[this.pending.url] = 1; // adding loaded file to loaded list (by PGA)
this.pending = null; this.pending = null;
if(this.queue.length > 0) if(this.queue.length > 0)
{ {
var request = this.queue.shift(); var request = this.queue.shift();
this.requireJs(request.url, request.callback, request.opts, request.obj, request.scope); this.requireJs(request.url, request.callback, request.opts, request.obj, request.scope);
} }
}, },
requireCss : function(styleUrl, media){ requireCss : function(styleUrl, media){
if(media == null) media = 'all'; if(media == null) media = 'all';
// Don't double up on loading scripts // Don't double up on loading scripts
if(this.isItemLoaded(styleUrl)) return; if(this.isItemLoaded(styleUrl)) return;
if(document.createStyleSheet){ if(document.createStyleSheet){
var ss = document.createStyleSheet($.requireConfig.routeCss + styleUrl); var ss = document.createStyleSheet($.requireConfig.routeCss + styleUrl);
ss.media = media; ss.media = media;
} else { } else {
var styleTag = document.createElement('link'); var styleTag = document.createElement('link');
$(styleTag).attr({ $(styleTag).attr({
href : $.requireConfig.routeCss + styleUrl, href : $.requireConfig.routeCss + styleUrl,
type : 'text/css', type : 'text/css',
media : media, media : media,
rel : 'stylesheet' rel : 'stylesheet'
}).appendTo($('head').get(0)); }).appendTo($('head').get(0));
} }
this.loaded_list[styleUrl] = 1; this.loaded_list[styleUrl] = 1;
} }
}) })
/** /**
* Sapphire extensions * Sapphire extensions
* Ajax requests are amended to look for X-Include-JS and X-Include-CSS headers * Ajax requests are amended to look for X-Include-JS and X-Include-CSS headers
*/ */
_originalAjax = $.ajax; _originalAjax = $.ajax;
$.ajax = function(s) { $.ajax = function(s) {
var _complete = s.complete; var _complete = s.complete;
var _success = s.success; var _success = s.success;
var _dataType = s.dataType; var _dataType = s.dataType;
// This replaces the usual ajax success & complete handlers. They are called after any on demand JS is loaded. // This replaces the usual ajax success & complete handlers. They are called after any on demand JS is loaded.
var _ondemandComplete = function(xml) { var _ondemandComplete = function(xml) {
var status = jQuery.httpSuccess(xml) ? 'success' : 'error'; var status = jQuery.httpSuccess(xml) ? 'success' : 'error';
if(status == 'success') { if(status == 'success') {
data = jQuery.httpData(xml, _dataType); data = jQuery.httpData(xml, _dataType);
if(_success) _success(data, status, xml); if(_success) _success(data, status, xml);
} }
if(_complete) _complete(xml, status); if(_complete) _complete(xml, status);
} }
// We remove the success handler and take care of calling it outselves within _ondemandComplete // We remove the success handler and take care of calling it outselves within _ondemandComplete
s.success = null; s.success = null;
s.complete = function(xml, status) { s.complete = function(xml, status) {
processOnDemandHeaders(xml, _ondemandComplete); processOnDemandHeaders(xml, _ondemandComplete);
} }
return _originalAjax(s); return _originalAjax(s);
} }
})(jQuery); })(jQuery);
/** /**
* This is the on-demand handler used by our patched version of prototype. * This is the on-demand handler used by our patched version of prototype.
* once we get rid of all uses of prototype, we can remove this * once we get rid of all uses of prototype, we can remove this
*/ */
function prototypeOnDemandHandler(xml, callback) { function prototypeOnDemandHandler(xml, callback) {
processOnDemandHeaders(xml, callback); processOnDemandHeaders(xml, callback);
} }
/** /**
* Process the X-Include-CSS and X-Include-JS headers provided by the Requirements class * Process the X-Include-CSS and X-Include-JS headers provided by the Requirements class
*/ */
function processOnDemandHeaders(xml, _ondemandComplete) { function processOnDemandHeaders(xml, _ondemandComplete) {
var i; var i;
// CSS // CSS
if(xml.getResponseHeader('X-Include-CSS')) { if(xml.getResponseHeader('X-Include-CSS')) {
var cssIncludes = xml.getResponseHeader('X-Include-CSS').split(','); var cssIncludes = xml.getResponseHeader('X-Include-CSS').split(',');
for(i=0;i<cssIncludes.length;i++) { for(i=0;i<cssIncludes.length;i++) {
// Syntax 1: "URL:##:media" // Syntax 1: "URL:##:media"
if(cssIncludes[i].match(/^(.*):##:(.*)$/)) { if(cssIncludes[i].match(/^(.*):##:(.*)$/)) {
jQuery.requireCss(RegExp.$1, RegExp.$2); jQuery.requireCss(RegExp.$1, RegExp.$2);
// Syntax 2: "URL" // Syntax 2: "URL"
} else { } else {
jQuery.requireCss(cssIncludes[i]); jQuery.requireCss(cssIncludes[i]);
} }
} }
} }
// JavaScript // JavaScript
var newIncludes = []; var newIncludes = [];
if(xml.getResponseHeader('X-Include-JS')) { if(xml.getResponseHeader('X-Include-JS')) {
var jsIncludes = xml.getResponseHeader('X-Include-JS').split(','); var jsIncludes = xml.getResponseHeader('X-Include-JS').split(',');
for(i=0;i<jsIncludes.length;i++) { for(i=0;i<jsIncludes.length;i++) {
if(!jQuery.isItemLoaded(jsIncludes[i])) { if(!jQuery.isItemLoaded(jsIncludes[i])) {
newIncludes.push(jsIncludes[i]); newIncludes.push(jsIncludes[i]);
} }
} }
} }
// We make an array of the includes that are actually new, and attach the callback to the last one // We make an array of the includes that are actually new, and attach the callback to the last one
// They are placed in a queue and will be included in order. This means that the callback will // They are placed in a queue and will be included in order. This means that the callback will
// be able to execute script in the new includes (such as a livequery update) // be able to execute script in the new includes (such as a livequery update)
if(newIncludes.length > 0) { if(newIncludes.length > 0) {
for(i=0;i<jsIncludes.length;i++) { for(i=0;i<jsIncludes.length;i++) {
jQuery.requireJs(jsIncludes[i], (i == jsIncludes.length-1) ? function() { _ondemandComplete(xml); } : null); jQuery.requireJs(jsIncludes[i], (i == jsIncludes.length-1) ? function() { _ondemandComplete(xml); } : null);
} }
// If there aren't any new includes, then we can just call the callbacks ourselves // If there aren't any new includes, then we can just call the callbacks ourselves
} else { } else {
_ondemandComplete(xml, status); _ondemandComplete(xml, status);
} }
} }