<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CiviCRM Installer</title>
<script>
function show(id) {
	document.getElementById(id).style.display = '';
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}
</script>
<link rel="stylesheet" type="text/css" href="template.css" />
</head>

<body>
<div id="All">
<p style="float: right"><b>Version <?php echo $civicrm_version ?></b></p>
<h1>CiviCRM Installer</h1>
<p>Thanks for choosing to use CiviCRM!  Please follow the instructions below to get CiviCRM
installed.</p>

<form action="index.php" method="post">

<?php if(isset($hasErrorOtherThanDatabase)) { ?>
<p class="error">You aren't currently able to install the software.  Please <a style="color: #CCF" href="#requirements">see below</a> for details.</p>
<?php } else { ?>
<?php if($req->hasWarnings()) { ?>
<p class="warning">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.</p>

<?php } else if(!$dbReq->hasErrors()) { ?>
<p class="good">You're ready to install! &nbsp;&nbsp; 
</p>

<?php } ?>

<p>
	<input id="install_button" type="submit" name="go" value="Check Requirements and Install CiviCRM" onclick="document.getElementById('saving_top').style.display = ''; this.value = 'Installing CiviCRM...'" />
	
	<span id="saving_top" style="display: none">
	&nbsp;
	<img src="network-save.gif" />
	(this will take a few minutes)
	</span>
</p>
<?php } ?>


<input type="hidden" name="database" value="MySQLDatabase" />

<h2>Database Version and Connection Settings</h2>
<p>
CiviCRM 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>

<?php if($dbReq->hasErrors()) { ?>
<p class="error">Your database settings don't appear to be correct. Please check the <strong><a href="#dbDetails" style="color: white;">Database Details</a></strong> below for specific errors.</p>
<?php } else { ?>
<p class="good">Database version and connection settings have been verified and look correct!</p>
<?php } ?>

<h4>CiviCRM Database Settings</h4>
<p style="margin-left: 2em" id="mysql_credentials" > <!--style="display: none"-->
	<label for="mysql_server"> <span>MySQL server:</span> <input id="mysql_server" type="text" name="mysql[server]" value="<?php echo $databaseConfig['server'] ?>" /></label> <br />
	<label for="mysql_username"> <span>MySQL username:</span> <input id="mysql_username" type="text" name="mysql[username]" value="<?php echo $databaseConfig['username'] ?>"  /></label> <br />
	<label for="mysql_password"> <span>MySQL password:</span> <input id="mysql_password" type="password" name="mysql[password]" value="<?php echo $databaseConfig['password'] ?>" /></label> <br />
	<label for="mysql_database"><span>MySQL database:</span> <input id="mysql_database" type="text" name="mysql[database]" value="<?php echo $databaseConfig['database'] ?>" /></label> <br />
</p>

<h4>Drupal Database Settings</h4>
<p style="margin-left: 2em" id="drupal_credentials" > <!--style="display: none"-->
	<label for="drupal_server"> <span>MySQL server:</span> <input id="drupal_server" type="text" name="drupal[server]" value="<?php echo $drupalConfig['server'] ?>" /></label> <br />
	<label for="drupal_username"> <span>MySQL username:</span> <input id="drupal_username" type="text" name="drupal[username]" value="<?php echo $drupalConfig['username'] ?>"  /></label> <br />
	<label for="drupal_password"> <span>MySQL password:</span> <input id="drupal_password" type="password" name="drupal[password]" value="<?php echo $drupalConfig['password'] ?>" /></label> <br />
	<label for="drupal_database"><span>MySQL database:</span> <input id="drupal_database" type="text" name="drupal[database]" value="<?php echo $drupalConfig['database'] ?>" /></label> <br />
</p>

<h4>Other Settings</h4>
<p style="margin-left: 2em" id="misc_credentials" > 
<!--style="display: none"-->
    <label for="loadGenerated"><span>Load sample data:</span><input id="loadGenerated" type="checkbox" name="loadGenerated" value=1 <?php if ( $loadGenerated == 1 ) { echo "checked='checked'"; } ?></label> <br />
    <span class="testResults">Check this box to pre-populate CiviCRM with sample contact records, online contribution pages, profile forms, etc. These examples can help you learn about CiviCRM features.</span><br /> 
</p>

<p style="margin-left: 2em"><input type="submit" value="Re-check requirements" /></p>

<a name="dbDetails">
<h4>CiviCRM Database Details</h4>
<?php $dbReq->showTable("MySQL CiviCRM Configuration"); ?>

<h4>Drupal Database Details</h4>
<?php $dbReq->showTable("MySQL Drupal Configuration"); ?>

<br /><hr />

<h2 id="requirements">Requirements</h2>
<?php
$req->showTable();
?>

</form>
</div>
</body>
</html>