<?cs # $Id$ ?>

<style type="text/css"><?cs include:Data.Plugins.partition.StyleSheetFile ?></style>

<?cs # show nothing if the harddisk is not partitionable (e.g. still active) ?>
<?cs if:(Data.Plugins.partition.availSize > 0) || (subcount(Data.Plugins.partition.Parts) > 0) ?>

<h1><?cs var:html_escape(Lang.Plugins.partition.Title.Partition) ?></h1>

<?cs call:handle_messages() ?>

<div align="center">
<table class="partition">
	<tr>
		<th><?cs var:html_escape(Lang.Plugins.partition.Text.PartNum) ?></th>
		<th><?cs var:html_escape(Lang.Plugins.partition.Text.Size) ?></th>
		<th><?cs var:html_escape(Lang.Plugins.partition.Text.PartType) ?></th>
		<th></th>
	</tr>

<?cs loop: x = #0, subcount(Data.Plugins.partition.Parts)-1, #1 ?>
<tr>
	<td><?cs var:x ?></td>
	<td><?cs var:Data.Plugins.partition.Parts[x].Size ?></td>
	<td><?cs var:Data.Plugins.partition.Parts[x].Type ?></td>
	<td>
		<?cs call:print_form_header("part_del_" + x, "partition") ?>
		<?cs include:Settings.PluginDir + "/partition/current_partition_info.cs" ?>
		<input type="hidden" name="step" value="del_partition" />
		<input type="hidden" name="del_num" value="<?cs var:x ?>" />
		<button type="submit"><?cs var:html_escape(Lang.Plugins.partition.Button.DelPartition) ?></button>
		</form>
	</td>
</tr>
<?cs /loop ?></p>

<?cs # new partition input if space is available ?>
<?cs if:Data.Plugins.partition.availSize > 0 ?>
<tr>
	<?cs call:print_form_header("part_add", "partition") ?>
	<?cs include:Settings.PluginDir + "/partition/current_partition_info.cs" ?>
	<input type="hidden" name="step" value="add_partition" />
	<?cs set: x = subcount(Data.Plugins.partition.Parts) ?>
	<td><?cs var:x ?></td>
	<td><input type="text" name="part<?cs var:x ?>_size" size="8" value="<?cs var:Data.Plugins.partition.availSize ?>" tabindex="1" /></td>
	<td><select name="part<?cs var:x ?>_type" tabindex="2" size="0"><?cs each: t = Data.Plugins.partition.Types ?><option <?cs if:t == "windows" ?>selected="selected"<?cs /if ?>><?cs var:t ?></option>
		<?cs /each ?></select></td>
	<td>
		<button type="submit" tabindex="3"><?cs var:html_escape(Lang.Plugins.partition.Button.AddPartition) ?></button>
	</td>
	</form>
</tr>
<?cs /if ?>
</table>

</div>

<?cs if:Data.Plugins.partition.CreateConfigPartition ?><p><?cs var:html_escape(Lang.Plugins.partition.Text.CreateConfigPartition) ?></p><?cs /if ?>

<?cs if:subcount(Data.Plugins.partition.Parts) > 0 ?>
	<?cs call:hint("Plugins.partition.DeviceDataIsLost") ?>

	<?cs call:print_form_header("part_finish", "partition") ?>
		<?cs include:Settings.PluginDir + "/partition/current_partition_info.cs" ?>
		<input type="hidden" name="step" value="finish" />
		<button type="submit"><?cs var:html_escape(Lang.Plugins.partition.Button.SavePartitions) ?></button>
	</form>
<?cs /if ?>

<?cs if:subcount(Data.Plugins.partition.ExistingContainers) ?>
	<p align="left"><?cs var:html_escape(Lang.Plugins.partition.Text.RemovalContainers) ?>:
	<ul>
		<?cs each:item = Data.Plugins.partition.ExistingContainers ?>
			<li><?cs var:html_escape(item.name) ?> (<?cs var:html_escape(item.size) ?>)</li>
		<?cs /each ?>
	</ul></p>
<?cs /if ?>

<?cs call:help_link("CryptoBoxUserConfiguration") ?>

<?cs /if ?>

