diff --git a/runtime/twodue/etc/messages.properties b/runtime/twodue/etc/messages.properties index aed2c177..ae65a476 100644 --- a/runtime/twodue/etc/messages.properties +++ b/runtime/twodue/etc/messages.properties @@ -1,6 +1,6 @@ # -*- mode: makefile -*- # -# $Id: messages.properties,v 1.2 2002/11/08 21:49:17 mdb Exp $ +# $Id: messages.properties,v 1.3 2002/11/09 01:40:01 mdb Exp $ # # Translation messages for Two Due application @@ -42,6 +42,7 @@ index.message.task_claimed = Task claimed. index.message.task_completed = Task marked as completed. index.error.invalid_detail_task = Task id specified for inspection not valid. +index.error.no_matching_tasks = No tasks matched that query string. # # edit.wm diff --git a/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java b/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java index 58bb1c3a..6cb1f12d 100644 --- a/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java +++ b/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java @@ -1,5 +1,5 @@ // -// $Id: TaskRepository.java,v 1.2 2002/11/08 21:49:17 mdb Exp $ +// $Id: TaskRepository.java,v 1.3 2002/11/09 01:40:01 mdb Exp $ package com.samskivert.twodue.data; @@ -136,6 +136,19 @@ public class TaskRepository extends JORARepository "ORDER BY PRIORITY DESC"); } + /** + * Loads up and returns all unowned, uncompleted tasks, whose summary + * or category contain the specified string, ordered by priority. + */ + public ArrayList findTasks (String query) + throws PersistenceException + { + return loadTasks("where COMPLETOR IS NULL AND OWNER IS NULL " + + " AND (SUMMARY LIKE '%" + query + + "%' OR CATEGORY LIKE '%" + query + "%') " + + "ORDER BY PRIORITY DESC"); + } + /** * Loads up all owned tasks, ordered by priority. */ diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java index 028b0070..83604ad0 100644 --- a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java +++ b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java @@ -1,5 +1,5 @@ // -// $Id: index.java,v 1.2 2002/11/08 21:49:17 mdb Exp $ +// $Id: index.java,v 1.3 2002/11/09 01:40:01 mdb Exp $ package com.samskivert.twodue.logic; @@ -89,7 +89,15 @@ public class index extends UserLogic // load up outstanding tasks and break them down by complexity String expand = ParameterUtil.getParameter(req, "expand", false); - ArrayList tasks = app.getRepository().loadTasks(); + ArrayList tasks = null; + String query = ParameterUtil.getParameter(req, "query", false); + if (StringUtil.blank(query)) { + tasks = app.getRepository().loadTasks(); + } else { + ctx.put("query", query); + tasks = app.getRepository().findTasks(query); + } + CatList[] xtasks = categorize(tasks, expand, new Categorizer() { public String category (Task task) { return task.complexity; @@ -97,6 +105,10 @@ public class index extends UserLogic }); ctx.put("xtasks", xtasks); + if (!StringUtil.blank(query) && xtasks.length == 0) { + ctx.put("error", "index.error.no_matching_tasks"); + } + // load up owned tasks and break them down by owner tasks = app.getRepository().loadOwnedTasks(); CatList[] otasks = categorize(tasks, null, new Categorizer() { @@ -131,6 +143,10 @@ public class index extends UserLogic protected CatList[] categorize ( ArrayList tasks, String expand, Categorizer catter) { + if (tasks == null) { + return new CatList[0]; + } + HashMap cmap = new HashMap(); int tcount = tasks.size(); for (int ii = 0; ii < tcount; ii++) { @@ -144,7 +160,7 @@ public class index extends UserLogic cmap.put(category, clist); } if (expand == null || clist.tasks.size() < 2 || - (expand.equals(category))) { + expand.equals("all") || expand.equals(category)) { clist.tasks.add(task); } else { clist.pruned++; diff --git a/runtime/twodue/web/index.wm b/runtime/twodue/web/index.wm index 6b9f5a6b..93c2866e 100644 --- a/runtime/twodue/web/index.wm +++ b/runtime/twodue/web/index.wm @@ -6,7 +6,13 @@
| Owned tasks: | -Outstanding tasks: | +#if ($query) +Tasks matching '$query': +#else +Outstanding tasks: +#end + |
|
- +
|