From 1e46dbbc840dd364f726ed2e0902d72de8179fc7 Mon Sep 17 00:00:00 2001
From: Josh Leder <josh@ha.cr>
Date: Tue, 9 Jul 2013 19:40:01 -0600
Subject: [PATCH 4/5] show tasklist list on quick add form

---
 nag/quick.php           |    7 ++++++-
 nag/templates/quick.inc |   13 +++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/nag/quick.php b/nag/quick.php
index 40a46f6..58a86c9 100644
--- a/nag/quick.php
+++ b/nag/quick.php
@@ -4,8 +4,13 @@ require_once __DIR__ . '/lib/Application.php';
 Horde_Registry::appInit('nag');
 
 if ($quickText = Horde_Util::getPost('quickText')) {
+    $taskList = Horde_Util::getPost('list', '');
+    if (empty($taskList)) {
+        $taskList = Nag::getDefaultTasklist(Horde_Perms::EDIT);
+    }
+
     try {
-        $result = Nag::createTasksFromText($quickText, Nag::getDefaultTasklist(Horde_Perms::EDIT));
+        $result = Nag::createTasksFromText($quickText, $taskList);
     } catch (Nag_Exception $e) {
         $notification->push($e->getMessage());
     }
diff --git a/nag/templates/quick.inc b/nag/templates/quick.inc
index 71c6ac6..52ce77b 100644
--- a/nag/templates/quick.inc
+++ b/nag/templates/quick.inc
@@ -5,6 +5,19 @@
   <p><?php echo _("Enter one task per line. Create child tasks by indenting them below their parent task. Include due dates like \"laundry tomorrow\" or \"get dry cleaning next Thursday\". Tags may be added by prefixing them with the \"#\" character.") ?></p>
   <textarea name="quickText" id="quickText"></textarea>
   <p>
+    <label>
+    <?php echo _('Task List'); ?>:
+      <select name="list" id="list">
+      <?php $default = Nag::getDefaultTasklist(Horde_Perms::EDIT); ?>
+      <?php foreach (Nag::listTasklists(false, Horde_Perms::EDIT) as $id => $list): ?>
+        <option value="<?php echo htmlentities($id) ?>" <?php echo $id == $default ? 'selected' : ''; ?>>
+          <?php echo Nag::getLabel($list); ?>
+        </option>
+      <?php endforeach; ?>
+      </select>
+    </label>
+  </p>
+  <p>
    <input type="submit" class="horde-default" value="<?php echo _("Create") ?>" />
    <input type="button" class="horde-cancel" onclick="RedBox.close();RedBox.getWindow().down().remove();" value="<?php echo _("Cancel") ?>" />
   </p>
-- 
1.7.7.5 (Apple Git-26)