<? if ($saved): ?>
<h2>Ãndringar sparade!</h2>
<? else: ?>
<form action="?p=d&a=e" method="post">
<fieldset>
<legend>Redigera dokument</legend>
<div>
<input type="hidden" name="id" value="<?=$document['id']?>" />
<label for="documentTitle">Titel:</label>
<input type="text" name="title" id="documentTitle" value="<?=$document['title']?>" class="text" />
</div>
<div>
<?php
include('js/fckeditor/fckeditor.php');
$oFCKeditor = new FCKeditor('body');
$oFCKeditor->BasePath = 'js/fckeditor/';
$oFCKeditor->Value = $document['body'];
$oFCKeditor->ToolbarSet = "custom";
$oFCKeditor->Height = "400";
$oFCKeditor->Width = "650";
$oFCKeditor->Create() ;
?>
</div>
<div>
<? if (!$document['is_locked']): ?>
<label for="parent">Placering:</label>
<select name="parent" id="parent">
<option value="0">[Topp]</option>
<? foreach ($menu as $item): if ($item['id'] != $document['id']): ?>
<option value="<?= $item['id'] ?>"
<?= $item['id'] == $document['parent_id'] ? 'selected="selected"' : '' ?>>
<?= str_repeat('-', $item['level'] + 1) ?> <?= $item['title'] ?>
</option>
<? endif; endforeach; ?>
</select>
<? else: ?>
<input type="hidden" name="parent" value="<?=$document['parent_id']?>" />
<? endif; ?>
</div>
<? if (!$document['is_locked']): ?>
<div>
<label for="visible">Synlig:</label>
<input type="checkbox" name="visible" id="visible" <?=($document['is_visible'] ? 'checked' : '')?> />
</div>
<? else: ?>
<input type="hidden" name="visible" value="on" />
<? endif; ?>
<div>
<input type="submit" value="Spara ändringar" />
<? if (!$document['is_locked']): ?>
, <a href="?p=d&a=r&id=<?=$document['id']?>" onclick="return confirm('Ãr du säker?')">Ta bort</a>
<? endif; ?>
eller <a href="?p=d">Avbryt</a>
</div>
</fieldset>
</form>
<? endif; ?>