<html>
<head>
	<title>Diamentis Framework Installation</title>
	<link rel="StyleSheet" href="styles/default.css" type="text/css">
	<script language="JavaScript">
		function testDB(frm) {ldelim}
			window.open('install2.php?op=dbtest&db_type=' + frm.db_type.options[frm.db_type.selectedIndex].value +
				'&db_host=' + frm.db_host.value + '&db_database=' + frm.db_database.value +
				'&db_user=' + frm.db_user.value + '&db_pass=' + frm.db_pass.value,
				'iwin', 'dependent=yes,width=450,height=300,scrollbars=1');
		{rdelim}
	</script>
</head>
<body bgcolor="#ffffff" link="#006699" vlink="#006699" alink="#006699">
<form action="{$smarty.server.PHP_SELF}" method="post">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<!--<td width="200" valign="top"><br><img src="logo.jpg"></td> -->
		<td valign="top" align="center">
			<div class="banner">Diamentis Framework Installation</div>
			{if $error}<div class="error">{$error}</div>{/if}
			<table border="0" cellpadding="0" cellspacing="3">
				<tr>
					<th colspan="2">Database Options</th>
				</tr>
				<tr>
					<td width="150">Type:</td>
					<td><select name="db_type">{build_select selected=$mdb2_type}</select></td>
				</tr>
				<tr>
					<td width="150">Host:</td>
					<td><input type="text" name="db_host" value="{$mdb2_host|default:localhost}"></td>
				</tr>
				<tr>
					<td width="150">
						Database Name:
					</td>
					<td valign="top"><input type="text" name="db_database" value="{$mdb2_database|default:diachange}"></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><b>(This database must already exist with charset utf8-bin)</b></td>
				</tr>
				<tr>
					<td width="150">User:</td>
					<td><input type="text" name="db_user" value="{$mdb2_user|default:root}"></td>
				</tr>
				<tr>
					<td width="150">Password:</td>
					<td><input type="password" name="db_pass" value="{$mdb2_pass}"></td>
				</tr>
				<tr>
					<td width="150">Table Prefix:</td>
					<td><input type="text" name="tbl_prefix" value="{$tbl_prefix|default:dia1_}"></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<input type="button" value="Test Database Connection" onClick="testDB(this.form)">
					</td>
				</tr>
				<tr>
					<th colspan="2">Configuration</th>
				</tr>
				<tr>
					<td width="150">
						M+ Email:
						<br>
						(The email address used for sending bug updates, etc.)
					</td>
					<td valign="top"><input type="text" name="phpbt_email" value="{$phpbt_email|default:$default_email}"></td>
				</tr>
				<tr>
					<td width="150">
						Admin Login:
						<br>
						(Must be a valid email address)
					</td>
					<td valign="top"><input type="text" name="admin_login" value="{$admin_login}"></td>
				</tr>
				<tr>
					<td width="150">Admin Password:</td>
					<td><input type="password" name="admin_pass" value=""></td>
				</tr>
				<tr>
					<td width="150">Confirm Password:</td>
					<td><input type="password" name="admin_pass2" value=""></td>
				</tr>
				<tr>
					<td width="150">Encrypt Passwords in DB:</td>
					<td>
						<input type="radio" name="encrypt_pass" value="1"> Yes
						<input type="radio" name="encrypt_pass" value="0" checked> No
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<hr size="1" width="220">
						{if @is_writeable('config.php')}
							When you submit the form, the database tables will be created
							and config.php will be saved to disk.  You will then be able
							to login and use the Diamentis Application.
							<input type="hidden" name="op" value="save_config_file">
						{else}
							Since config.php is not writeable by this script, when you
							submit this form you will be prompted to save config.php.  Copy
							this file to the location of the directory of the application, and then you will
							be able to <a href="index.php">login to the Diamentis Application</a>.  From
							the home page you can go to the Admin Tools and customize your
							installation via the Configuration link.  Once you have
							completed the configuration, you will be ready to customize or add a project and
							start manage your process!
							<input type="hidden" name="op" value="dump_config_file">
						{/if}
						<br>
						<br>
						<input type="submit" value="Save Options">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>
