    <h1><?php print _('Database Setup') ?></h1>

    <p><?php print _('Please select your database type and enter your database authentication information.  The installer will not create the database for you, so you must create one yourself and enter the database name here.  If you are installing Gallery into a database that already has tables in it, the table and column prefixes will keep Gallery data from conflicting with what you already have.') ?> </p>

    <?php if (isset($templateData['isMultisite']) && $templateData['isMultisite']): ?>
    <div class="warning">
      <?php print _("This is a multisite installation. Remember that each multisite requires its own database tables. Either choose a different database or a different table prefix for each multisite!"); ?>
    </div>
    <?php endif; ?>

    <form method="post" action="<?php generateUrl(sprintf('%s?step=%s', INDEX_PHP, $stepNumber)) ?>">
      <table>
	<tr>
	  <td class="label">
	    <?php print _('Database type:') ?>
	  </td>

	  <td>
	    <select name="type">
	      <?php foreach ($templateData['dbList'] as $key => $value): ?>
	      <option value="<?php print $key ?>"
		<?php if (!empty($templateData['dbSelected'][$key])): ?>
		selected="selected"
		<?php endif; ?>
		><?php print $value ?></option>
	      <?php endforeach; ?>
	    </select>
	  </td>
	</tr>
	<?php if (!empty($templateData['error']['phpDbMissing'])): ?>
	<tr>
	  <td colspan="2">
	    <div class="error">
	      <?php print $templateData['error']['phpDbMissing'] ?>
	    </div>
	  </td>
	</tr>
	<?php endif; ?>

	<tr>
	  <td class="label"><?php print _('DB Hostname:') ?></td>
	  <td>
	    <input name="hostname" type="text" size="30"
	      value="<?php print $templateData['config']['hostname'] ?>" />
	    <input type="hidden" name="action" value="save"/>
	    <input type="hidden" name="confirmReuseTables" value=""/>
	    <input type="hidden" name="confirmCleanInstall" value=""/>
	  </td>
	</tr>
	<tr>
	  <td class="label"><?php print _('DB Username:') ?></td>
	  <td>
	    <input name="username" type="text" size="30"
	      value="<?php print $templateData['config']['username'] ?>" />
	  </td>
	</tr>
	<tr>
	  <td class="label"><?php print _('DB Password:') ?></td>
	  <td>
	    <input name="password" type="password" size="30"
	      value="<?php print $templateData['password'] ?>" />
	  </td>
	</tr>
	<tr>
	  <td class="label"><?php print _('DB Name:') ?></td>
	  <td>
	    <input name="database" type="text" size="30"
	      value="<?php print $templateData['config']['database'] ?>" />
	  </td>
	</tr>
	<tr>
	  <td class="label"><?php print _('Table Prefix:') ?></td>
	  <td>
	    <input name="tablePrefix" type="text" size="30"
	      value="<?php print $templateData['config']['tablePrefix'] ?>" />
	  </td>
	</tr>
	<?php if (!empty($templateData['error']['tablePrefix'])): ?>
	<tr>
	  <td colspan="2">
	    <div  class="error">
	      <?php print $templateData['error']['tablePrefix'] ?>
	    </div>
	  </td>
	</tr>
	<?php endif; ?>
	<tr>
	  <td class="label"><?php print _('Column Prefix:') ?></td>
	  <td>
	    <input name="columnPrefix" type="text" size="30"
	      value="<?php print $templateData['config']['columnPrefix'] ?>" />
	  </td>
	</tr>
	<?php if (!empty($templateData['error']['columnPrefix'])): ?>
	<tr>
	  <td colspan="2">
	    <div class="error">
	      <?php print $templateData['error']['columnPrefix'] ?>
	    </div>
	  </td>
	</tr>
	<?php endif; ?>
      </table>
    </form>

    <?php if (!empty($templateData['errors'])): ?>
    <div class="error">
      <h2>
        <?php print _('We received the following database related errors:') ?>
      </h2>
    </div>
    <div class="debug">
      <?php print $templateData['databaseErrors'] ?>
    </div>
    <?php endif; ?>

    <?php if (!empty($templateData['stackTrace'])): ?>
    <div class="stack_trace">
      <?php print $templateData['stackTrace'] ?>
    </div>
    <?php endif; ?>

    <div class="go">
      <?php if (isset($templateData['showConfirmCleanInstall'])): ?>
	  <div class="btn btn-warn"><span><span><span><span>
	<a href="javascript:document.forms[0].confirmCleanInstall.value='true'; document.forms[0].submit()"><?php print _('Erase Data For A Clean Install') ?></a>
	  </span></span></span></span></div>
      <?php endif; ?>
	  <div class="btn btn-continue"><span><span><span><span>
	<a href="javascript:document.forms[0].submit()"><?php print _('Save') ?></a>
	  </span></span></span></span></div>
      <?php if (isset($templateData['showConfirmReuseTables'])): ?>
	  <div class="btn btn-continue"><span><span><span><span>
	<a href="javascript:document.forms[0].confirmReuseTables.value='true'; document.forms[0].submit()"><?php print _('Reuse Existing Tables') ?></a>
	  </span></span></span></span></div>
      <?php endif; ?>
    </div>

