<?php echo $cManager->getJavaScript('task', 'task_category') ?>
<form method="post" name="task" action="task.php">
<?php Util::pformInput() ?>
<input type="hidden" name="actionID" value="save_task" />
<input type="hidden" name="task" value="<?php echo $task_id ?>" />
<input type="hidden" name="tasklist_original" value="<?php echo $tasklist_id ?>" />
<input type="hidden" name="new_category" value="" />
<div class="header"><?php echo htmlspecialchars($title) ?></div>

<table cellspacing="0" width="100%">
<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('task_name', _("N_ame")) ?></b>&nbsp;</td>
  <td class="item" width="100%">
    <input id="task_name" name="task_name" type="text" value="<?php echo htmlspecialchars($task_name) ?>" size="50" maxlength="100" />
  </td>
</tr>

<?php if (!$prefs->isLocked('default_tasklist') && count($tasklists) > 1): ?>
<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('tasklist_target', _("_Task List")) ?></b>&nbsp;</td>
  <td class="item" width="100%">

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

  </td>
</tr>
<?php else: ?>
<input type="hidden" name="tasklist_target" value="<?php echo htmlspecialchars($tasklist_id) ?>" />
<?php endif; ?>

<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('task_category', _("_Category")) ?></b>&nbsp;</td>
  <td class="item" width="100%"><?php echo $cManager->getSelect('task_category', $task_category) ?></td>
</tr>
<tr>
  <td class="item" align="right" valign="top" nowrap="nowrap"><b><?php echo Horde::label('due_type_none', _("Due _By")) ?></b>&nbsp;</td>
  <td class="item" width="100%">
    <input id="due_type_none" name="due_type" type="radio" value="none" <?php echo $none_checked ?> />
    <?php echo Horde::label('due_type_none', _("No due date.")) ?><br />

    <table cellspacing="0">
    <tr><td rowspan="2" valign="top">
      <input name="due_type" type="radio" value="specified" <?php echo $specified_checked ?>/>
    </td>
    <td>
      <?php echo $day_widget . ' ' . $month_widget . ' ' . $year_widget ?>
      <?php if ($GLOBALS['browser']->hasFeature('javascript')) {
                Horde::addScriptFile('open_calendar.js', 'horde');
                echo '<div id="goto" class="control" style="position:absolute;visibility:hidden;padding:1px"></div>';
                echo Horde::link('', _("Select a date"), '', '', 'openCalendar(\'dueimg\', \'due\', \'document.task.due_type[1].checked = true;\'); return false;') . Horde::img('calendar.png', _("Calendar"), 'align="top" id="dueimg"', $GLOBALS['registry']->getImageDir('horde')) . '</a>';
            } ?>
    </td></tr>
    <tr><td>
      <?php echo $hour_widget . ' ' . $minute_widget . ' ' . $am_pm_widget ?>
    </td></tr></table>
  </td>
</tr>

<!-- alarm -->
<tr>
 <td align="right" class="item"><b><?php echo Horde::label('noalarm', _("Ala_rm")) ?>&nbsp;&nbsp;</b></td>
 <td class="item" align="left" valign="top" colspan="3">
  <input id="noalarm" name="alarm" type="radio" value="0"<?php if (!$alarm_set) echo ' checked="checked"' ?>/>
  <?php echo Horde::label('noalarm', _("None")) ?><br />
  <input name="alarm" type="radio" value="1"<?php if ($alarm_set) echo ' checked="checked"' ?> />
  <input type="text" size="2" name="alarm_value" value="<?php echo $alarm_value ?>" onchange="document.task.alarm[1].checked=true" />&nbsp;
  <select name="alarm_unit" onchange="document.task.alarm[1].checked=true">
   <option value="1"<?php echo ($alarm_unit == 'min') ? ' selected="selected"' : '' ?>><?php echo _("Minute(s)") ?></option>
   <option value="60"<?php echo ($alarm_unit == 'hour') ? ' selected="selected"' : '' ?>><?php echo _("Hour(s)") ?></option>
   <option value="1440"<?php echo ($alarm_unit == 'day') ? ' selected="selected"' : '' ?>><?php echo _("Day(s)") ?></option>
   <option value="10080"<?php echo ($alarm_unit == 'week') ? ' selected="selected"' : '' ?>><?php echo _("Week(s)") ?></option>
  </select>
 </td>
</tr>
<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('task_priority', _("_Priority")) ?></b>&nbsp;</td>
  <td class="item" width="100%">
    <?php echo Nag::buildPriorityWidget('task_priority', $task_priority) ?>
  </td>
</tr>
<tr>
  <td class="item" align="right" valign="top" nowrap="nowrap"><b><?php echo Horde::label('task_completed', _("Co_mpleted?")) ?></b>&nbsp;</td>
  <td class="item" width="100%">
    <?php echo Nag::buildCompletionWidget('task_completed', $task_completed) ?>
  </td>
</tr>
<tr>
  <td class="item" align="right" valign="top"><b><?php echo Horde::label('task_desc', _("_Description")) ?></b>&nbsp;</td>
  <td class="item" width="100%">
    <textarea id="task_desc" name="task_desc" cols="50" rows="5"><?php echo htmlspecialchars($task_desc) ?></textarea>
  </td>
</tr>
</table>

<p>
 <input type="submit" class="button" value="<?php echo _("Save Task") ?>" onclick="return checkCategory();" />&nbsp;
 <input type="reset" class="button" value="<?php echo _("Undo Changes") ?>" />
</p>
</form>
