<?php echo $cManager->getJavaScript('memo', 'memo_category') ?>
<form method="post" name="memo" action="memo.php">
<?php Util::pFormInput() ?>
<input type="hidden" name="actionID" value="save_memo" />
<input type="hidden" name="memo" value="<?php echo $memo_id ?>" />
<input type="hidden" name="new_category" value="" />
<input type="hidden" name="memolist_original" value="<?php echo $memolist_id ?>" />
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="left" class="header"><b><?php echo $title ?></b></td></tr>
</table>

<table cellspacing="0" width="100%">
<tr>
    <td class="item" nowrap="nowrap" align="right" valign="top"><b><?php echo Horde::label('memo_body', _("Note _Text")) ?>:</b>&nbsp;</td>
    <td class="item" width="100%">
        <textarea name="memo_body" id="memo_body" cols="80" rows="20"><?php echo htmlspecialchars($memo_body) ?></textarea>
    </td>
</tr>
<?php if (!$prefs->isLocked('default_notepad') && count($notepads) > 1): ?>
<tr>
    <td class="item" nowrap="nowrap" align="right" valign="top"><b><?php echo Horde::label('notepad_target', _("Note_pad")) ?></b>&nbsp;</td>
    <td class="item" width="100%">

    <select id="notepad_target" name="notepad_target">
    <?php
    foreach ($notepads as $id => $notepad) {
        $sel = ($id == $memolist_id) ? ' selected="selected"' : '';
        printf('<option value="%s"%s>%s</option>',
               $id, $sel, $notepad->get('name')) . "\n";
    } ?>
    </select>

    </td>
</tr>
<?php else: ?>
<input type="hidden" name="notepad_target" value="<?php echo htmlspecialchars($memolist_id) ?>" />
<?php endif; ?>
<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('memo_category', _("_Category")) ?></b>&nbsp;</td>
  <td class="item" width="100%"><?php echo $cManager->getSelect('memo_category', $memo_category) ?></td>
</tr>
</table>

<br />
<table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td>
    <input type="submit" class="button" value="<?php echo _("Save") ?>" onclick="return checkCategory();" />&nbsp;
    <?php
    $memourl = Util::addParameter('memo.php', 'memo', $memo_id);
    $memourl = Util::addParameter($memourl, 'memolist', $memolist_id);

    if ($memo_id):
        $share = $GLOBALS['mnemo_shares']->getShare($memolist_id);
        if (!is_a($share, 'PEAR_Error') && $share->hasPermission(Auth::getAuth(), PERMS_DELETE)): ?>
        <input type="button" class="button" value="<?php echo _("Delete") ?>" onclick="window.location='<?php echo addslashes(Horde::applicationUrl(Util::addParameter($memourl, 'actionID', 'delete_memos'))) ?>';" />&nbsp;
        <?php endif; ?>
    <?php endif; ?>
    <input type="reset" class="button" value="<?php echo _("Undo Changes") ?>" />
  </td>
</tr>
</table>
</form>
