diff --git a/runtime/twodue/.cvsignore b/runtime/twodue/.cvsignore
deleted file mode 100644
index 10580090..00000000
--- a/runtime/twodue/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-twodue.war
-.jde-project.el
diff --git a/runtime/twodue/build.xml b/runtime/twodue/build.xml
deleted file mode 100644
index 8bee2b6c..00000000
--- a/runtime/twodue/build.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
");
- }
-
- /**
- * Returns a string representation of this instance.
- */
- public String toString ()
- {
- return StringUtil.fieldsToString(this);
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java b/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java
deleted file mode 100644
index 3e0d493b..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java
+++ /dev/null
@@ -1,296 +0,0 @@
-//
-// $Id: TaskRepository.java,v 1.5 2003/01/23 21:22:56 mdb Exp $
-
-package com.samskivert.twodue.data;
-
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import com.samskivert.io.PersistenceException;
-import com.samskivert.jdbc.ConnectionProvider;
-import com.samskivert.jdbc.DatabaseLiaison;
-import com.samskivert.jdbc.JDBCUtil;
-import com.samskivert.jdbc.JORARepository;
-import com.samskivert.jdbc.jora.Cursor;
-import com.samskivert.jdbc.jora.Session;
-import com.samskivert.jdbc.jora.Table;
-
-/**
- * Provides access to the task table.
- */
-public class TaskRepository extends JORARepository
-{
- /**
- * The database identifier that the repository will use when fetching
- * a connection from the connection provider. The value is
- * twodue which you'll probably need to know to properly
- * configure your connection provider.
- */
- public static final String REPOSITORY_DB_IDENT = "twodue";
-
- /**
- * Creates the repository and opens the task database. A connection
- * provider should be supplied that will be used to obtain the
- * necessary database connection. The database identifier used to
- * obtain our connection is documented by {@link
- * #REPOSITORY_DB_IDENT}.
- *
- * @param provider a connection provider via which the repository will
- * get its database connection.
- */
- public TaskRepository (ConnectionProvider provider)
- throws PersistenceException
- {
- super(provider, REPOSITORY_DB_IDENT);
-
- // make sure we can get our database connection
- Connection conn = provider.getConnection(REPOSITORY_DB_IDENT);
- provider.releaseConnection(REPOSITORY_DB_IDENT, conn);
- }
-
- // documented inherited
- protected void createTables (Session session)
- {
- // create our table objects
- _ttable = new Table(Task.class.getName(),
- "TASKS", session, "TASK_ID", true);
- }
-
- /**
- * Creates a task and inserts it into the repository.
- *
- * @return the newly created task.
- */
- public Task createTask (String summary, String category, String complexity,
- int priority, String creator)
- throws PersistenceException
- {
- // create and configure a task instance
- Task task = new Task();
- task.summary = summary;
- task.category = category;
- task.complexity = complexity;
- task.priority = priority;
- task.creator = creator;
- task.notes = "";
- createTask(task);
- return task;
- }
-
- /**
- * Inserts the supplied (properly populated) new task into the task
- * repository.
- */
- public void createTask (final Task task)
- throws PersistenceException
- {
- task.creation = new Date(System.currentTimeMillis());
- execute(new Operation() {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- // insert the task into the entry table
- _ttable.insert(task);
- // update the taskId now that it's known
- task.taskId = liaison.lastInsertedId(conn);
- return null;
- }
- });
- }
-
- /**
- * Loads up the specified task.
- *
- * @return the requested task or null if no tasks exists with that id.
- */
- public Task loadTask (final int taskId)
- throws PersistenceException
- {
- return (Task)execute(new Operation () {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- String query = "where TASK_ID = " + taskId;
- Cursor ec = _ttable.select(query);
- Task task = (Task)ec.next();
- if (task != null) {
- // call next() again to cause the cursor to close itself
- ec.next();
- }
- return task;
- }
- });
- }
-
- /**
- * Loads up and returns all unowned, uncompleted tasks.
- */
- public ArrayList loadTasks ()
- throws PersistenceException
- {
- return loadTasks("where COMPLETOR IS NULL AND OWNER IS NULL");
- }
-
- /**
- * Loads up and returns all unowned, uncompleted tasks, whose summary
- * or category contain the specified string.
- */
- 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 + "%')");
- }
-
- /**
- * Loads up all owned tasks, ordered by priority.
- */
- public ArrayList loadOwnedTasks ()
- throws PersistenceException
- {
- return loadTasks("where COMPLETOR IS NULL AND OWNER IS NOT NULL " +
- "ORDER BY PRIORITY DESC");
- }
-
- /**
- * Loads up and returns all completed tasks, sorted by completion
- * date.
- *
- * @param start the offset into the sorted list of completed tasks to
- * start returning tasks.
- * @param limit the limit to the number of tasks to be returned, or -1
- * if all completed should be returned.
- */
- public ArrayList loadCompletedTasks (int start, int limit)
- throws PersistenceException
- {
- String query = "where COMPLETOR IS NOT NULL " +
- "ORDER BY COMPLETION DESC LIMIT " + start;
- if (limit != -1) {
- query += (", " + limit);
- }
- return loadTasks(query);
- }
-
- /** Loads lists of tasks. */
- protected ArrayList loadTasks (final String query)
- throws PersistenceException
- {
- return (ArrayList)execute(new Operation () {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- Cursor tc = _ttable.select(query);
- return tc.toArrayList();
- }
- });
- }
-
- /**
- * Marks the specified task as completed by the specified user.
- */
- public void completeTask (final int taskId, final String completor)
- throws PersistenceException
- {
- execute(new Operation () {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- String query = "update TASKS " +
- "set COMPLETOR = ?, COMPLETION = ? where TASK_ID = ?";
- PreparedStatement stmt = null;
-
- try {
- stmt = conn.prepareStatement(query);
- stmt.setString(1, completor);
- stmt.setDate(2, new Date(System.currentTimeMillis()));
- stmt.setInt(3, taskId);
- JDBCUtil.checkedUpdate(stmt, 1);
-
- } finally {
- JDBCUtil.close(stmt);
- }
-
- return null;
- }
- });
- }
-
- /**
- * Marks the specified task as owned by the specified user.
- */
- public void claimTask (final int taskId, final String owner)
- throws PersistenceException
- {
- execute(new Operation () {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- String query = "update TASKS " +
- "set OWNER = ? where TASK_ID = ?";
- PreparedStatement stmt = null;
-
- try {
- stmt = conn.prepareStatement(query);
- stmt.setString(1, owner);
- stmt.setInt(2, taskId);
- JDBCUtil.checkedUpdate(stmt, 1);
-
- } finally {
- JDBCUtil.close(stmt);
- }
-
- return null;
- }
- });
- }
-
- /**
- * Deletes the specified task.
- */
- public void deleteTask (final int taskId)
- throws PersistenceException
- {
- execute(new Operation () {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- String query = "delete from TASKS where TASK_ID = ?";
- PreparedStatement stmt = null;
-
- try {
- stmt = conn.prepareStatement(query);
- stmt.setInt(1, taskId);
- JDBCUtil.checkedUpdate(stmt, 1);
-
- } finally {
- JDBCUtil.close(stmt);
- }
-
- return null;
- }
- });
- }
-
- /**
- * Updates a task that was previously loaded from the repository.
- */
- public void updateTask (final Task task)
- throws PersistenceException
- {
- execute(new Operation() {
- public Object invoke (Connection conn, DatabaseLiaison liaison)
- throws PersistenceException, SQLException
- {
- _ttable.update(task);
- return null;
- }
- });
- }
-
- protected Table _ttable;
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/CatList.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/CatList.java
deleted file mode 100644
index 44bc39f6..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/CatList.java
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// $Id: CatList.java,v 1.1 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import com.samskivert.twodue.data.Task;
-
-/**
- * Used to categorize tasks.
- */
-public class CatList
- implements Comparable
-{
- /** This indicates which task to which a category belongs. */
- public static interface Categorizer
- {
- public String category (Task task);
- }
-
- /** Used to ease category generation in UI. */
- public static class CategoryTool
- {
- public boolean checkCategory (String category)
- {
- if (category.equals(_category)) {
- return false;
- } else {
- _category = category;
- return true;
- }
- }
-
- public void clear ()
- {
- _category = null;
- }
-
- protected String _category;
- }
-
- /** The name of the category. */
- public String name;
-
- /** The tasks within it. */
- public ArrayList tasks;
-
- // documentation inherited from interface
- public int compareTo (Object other)
- {
- return name.compareTo(((CatList)other).name);
- }
-
- /**
- * Categorizes a list of tasks.
- */
- public static CatList[] categorize (ArrayList tasks, Categorizer catter)
- {
- if (tasks == null) {
- return new CatList[0];
- }
-
- ArrayList cats = new ArrayList();
- HashMap cmap = new HashMap();
- int tcount = tasks.size();
- for (int ii = 0; ii < tcount; ii++) {
- Task task = (Task)tasks.get(ii);
- String category = catter.category(task);
- CatList clist = (CatList)cmap.get(category);
- if (clist == null) {
- clist = new CatList();
- clist.name = category;
- clist.tasks = new ArrayList();
- cats.add(clist);
- cmap.put(category, clist);
- }
- clist.tasks.add(task);
- }
-
- CatList[] ctasks = new CatList[cats.size()];
- cats.toArray(ctasks);
-
- return ctasks;
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/UserLogic.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/UserLogic.java
deleted file mode 100644
index 5cbbdceb..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/UserLogic.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// $Id: UserLogic.java,v 1.2 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import com.samskivert.servlet.user.User;
-import com.samskivert.velocity.Application;
-import com.samskivert.velocity.InvocationContext;
-import com.samskivert.velocity.Logic;
-
-import com.samskivert.twodue.TwoDueApp;
-
-/**
- * A base logic class for pages that require an authenticated user.
- */
-public abstract class UserLogic implements Logic
-{
- /**
- * Logic classes should implement this method to perform their normal
- * duties.
- *
- * @param ctx the context in which the request is being invoked.
- * @param app the web application.
- * @param user the user record for the authenticated user.
- */
- public abstract void invoke (
- InvocationContext ctx, TwoDueApp app, User user)
- throws Exception;
-
- // documentation inherited from interface
- public void invoke (Application app, InvocationContext ctx)
- throws Exception
- {
- TwoDueApp tdapp = (TwoDueApp)app;
- User user = tdapp.getUserManager().requireUser(ctx.getRequest());
- ctx.put("username", user.username);
- invoke(ctx, tdapp, user);
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/bulkedit.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/bulkedit.java
deleted file mode 100644
index 4ecc27e6..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/bulkedit.java
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// $Id: bulkedit.java,v 1.1 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.util.StringUtil;
-
-import com.samskivert.servlet.RedirectException;
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Allows the bulk update of task properties.
- */
-public class bulkedit extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- // display any message we've been asked to display
- String msg = ParameterUtil.getParameter(req, "message", true);
- if (!StringUtil.blank(msg)) {
- ctx.put("error", msg);
- }
-
- // load up our tasks
- ArrayList tasks = app.getRepository().loadTasks();
-
- // if they've submitted the form, we update the task database
- if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "update")) {
- int updated = 0;
- for (Iterator iter = tasks.iterator(); iter.hasNext(); ) {
- Task task = (Task)iter.next();
- // check to see if category or priority have been updated
- int nprio = ParameterUtil.getIntParameter(
- req, "priority" + task.taskId, task.priority,
- "bulkedit.error.invalid_task_priority");
- String ncat = ParameterUtil.getParameter(
- req, "category" + task.taskId, false);
- if (nprio != task.priority ||
- (!StringUtil.blank(ncat) && !ncat.equals(task.category))) {
- task.priority = nprio;
- task.category = ncat;
- app.getRepository().updateTask(task);
- updated++;
- }
- }
- String rspmsg;
- switch (updated) {
- case 0: rspmsg = "bulkedit.message.nothing_updated"; break;
- case 1: rspmsg = "bulkedit.message.task_updated"; break;
- default: rspmsg = "bulkedit.message.tasks_updated"; break;
- }
- ctx.put("error", rspmsg);
- }
-
- // now filter them
- int priority = ParameterUtil.getIntParameter(
- req, "priority", 10, "bulkedit.error.invalid_priority");
- ctx.put("priority", priority);
- for (Iterator iter = tasks.iterator(); iter.hasNext(); ) {
- Task task = (Task)iter.next();
- if (task.priority != priority) {
- iter.remove();
- }
- }
- Collections.sort(tasks, TASK_PARATOR);
-
- CatList[] xtasks = CatList.categorize(tasks, new CatList.Categorizer() {
- public String category (Task task) {
- return task.getPriorityName();
- }
- });
- ctx.put("xtasks", xtasks);
- ctx.put("xcats", new CatList.CategoryTool());
- }
-
- protected static final Comparator TASK_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort first by reverse priority, then by category, then complexity
- if (t1.priority == t2.priority) {
- if (t1.category.equals(t2.category)) {
- return t1.getComplexityValue() - t2.getComplexityValue();
- } else {
- return t1.category.compareTo(t2.category);
- }
- } else {
- return t2.priority - t1.priority;
- }
- }
- };
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/bycategory.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/bycategory.java
deleted file mode 100644
index 0bf4a1d1..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/bycategory.java
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// $Id: bycategory.java,v 1.3 2003/12/10 21:57:31 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.util.StringUtil;
-
-import com.samskivert.servlet.RedirectException;
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Displays a summary of unclaimed tasks by category.
- */
-public class bycategory extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- // display any message we've been asked to display
- String msg = ParameterUtil.getParameter(req, "message", true);
- if (!StringUtil.blank(msg)) {
- ctx.put("error", msg);
- }
-
- // put any filter into the context
- ctx.put("filter", ParameterUtil.getParameter(req, "filter", false));
-
- 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);
- }
-
- // sort the tasks by priority, then complexity
- Collections.sort(tasks, OPEN_PARATOR);
-
- CatList[] xtasks = categorize(tasks, new Categorizer() {
- public String category (Task task) {
- return task.category;
- }
- });
- ctx.put("xtasks", xtasks);
- ctx.put("xcats", new CategoryTool());
-
- // figure out where to start the second column
- int total = 0, current = 0;
- for (int ii = 0; ii < xtasks.length; ii++) {
- total += xtasks[ii].tasks.size();
- }
- for (int ii = 0; ii < xtasks.length; ii++) {
- current += xtasks[ii].tasks.size();
- if (current >= total/2) {
- ctx.put("break", ii);
- break;
- }
- }
-
- if (!StringUtil.blank(query) && xtasks.length == 0) {
- ctx.put("error", "index.error.no_matching_tasks");
- }
- }
-
- protected static class CatList
- implements Comparable
- {
- public String name;
- public ArrayList tasks;
- public int compareTo (Object other)
- {
- return name.compareTo(((CatList)other).name);
- }
- }
-
- protected static interface Categorizer
- {
- public String category (Task task);
- }
-
- protected CatList[] categorize (ArrayList tasks, Categorizer catter)
- {
- if (tasks == null) {
- return new CatList[0];
- }
-
- ArrayList cats = new ArrayList();
- HashMap cmap = new HashMap();
- int tcount = tasks.size();
- for (int ii = 0; ii < tcount; ii++) {
- Task task = (Task)tasks.get(ii);
- String category = catter.category(task);
- CatList clist = (CatList)cmap.get(category);
- if (clist == null) {
- clist = new CatList();
- clist.name = category;
- clist.tasks = new ArrayList();
- cats.add(clist);
- cmap.put(category, clist);
- }
- clist.tasks.add(task);
- }
-
- CatList[] ctasks = new CatList[cats.size()];
- cats.toArray(ctasks);
-
- return ctasks;
- }
-
- protected static final Comparator OPEN_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort first by category, then reverse priority, then by complexity
- if (t1.category.equals(t2.category)) {
- if (t1.priority == t2.priority) {
- return t1.getComplexityValue() - t2.getComplexityValue();
- } else {
- return t2.priority - t1.priority;
- }
- } else {
- return t1.category.compareTo(t2.category);
- }
- }
- };
-
- protected static final Comparator OWNED_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort by complexity
- return t1.getComplexityValue() - t2.getComplexityValue();
- }
- };
-
- // used to easy category generation in UI
- public static class CategoryTool
- {
- public boolean checkCategory (String category)
- {
- if (category.equals(_category)) {
- return false;
- } else {
- _category = category;
- return true;
- }
- }
-
- public void clear ()
- {
- _category = null;
- }
-
- protected String _category;
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/detail.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/detail.java
deleted file mode 100644
index e0e56e5e..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/detail.java
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// $Id: detail.java,v 1.3 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.StringTokenizer;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.util.StringUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Displays the details of a single task.
- */
-public class detail extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- int taskId = ParameterUtil.requireIntParameter(
- ctx.getRequest(), "task", "task.error.missing_taskid");
-
- // load up the task in question
- Task task = app.getRepository().loadTask(taskId);
- if (task == null) {
- ctx.put("error", "error.no_such_task");
- } else {
- // format the notes and stuff those in the context
- ctx.put("notes", formatNotes(task.notes));
- // stick the task in the context
- ctx.put("task", task);
- }
- }
-
- protected String formatNotes (String notes)
- {
- if (StringUtil.blank(notes)) {
- return notes;
- }
-
- StringBuffer fnotes = new StringBuffer();
- StringTokenizer tok = new StringTokenizer(notes, "\n", true);
- boolean excepting = false, eatnewline = false;
-
- while (tok.hasMoreTokens()) {
- String line = tok.nextToken();
- boolean sawexcept = false;
- if (line.indexOf("Exception:") != -1) {
- sawexcept = true;
- fnotes.append("
\n");
- }
-
- if (line.equals("\n")) {
- if (!eatnewline) {
- fnotes.append("\n");
- } else {
- eatnewline = false;
- }
- // no further processing on newlines
- continue;
-
- } else {
- fnotes.append(line).append("\n");
- eatnewline = true;
- }
-
- if (excepting && line.indexOf(" at ") == -1) {
- excepting = false;
- fnotes.append("
");
- }
- if (sawexcept) {
- excepting = true;
- }
- }
- return fnotes.toString();
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/edit.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/edit.java
deleted file mode 100644
index 950b8e1e..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/edit.java
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// $Id: edit.java,v 1.2 2003/01/23 21:22:56 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.util.QuickSort;
-import com.samskivert.util.StringUtil;
-
-import com.samskivert.servlet.RedirectException;
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Allows a single task to be edited.
- */
-public class edit extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- int taskId = ParameterUtil.requireIntParameter(
- ctx.getRequest(), "task", "task.error.missing_taskid");
-
- // load up the task in question
- Task task = app.getRepository().loadTask(taskId);
- if (task == null) {
- ctx.put("error", "error.no_such_task");
- return;
- }
-
- // stick the task in the context
- ctx.put("task", task);
-
- // if they've submitted the form, we update the task database
- if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "update")) {
- // extract our fields
- task.summary = ParameterUtil.requireParameter(
- ctx.getRequest(), "summary", "task.error.missing_summary");
- // remove extra spaces introduced by our friend the textarea
- task.summary = task.summary.trim();
-
- task.category = ParameterUtil.requireParameter(
- ctx.getRequest(), "category",
- "task.error.missing_category");
- task.complexity = ParameterUtil.requireParameter(
- ctx.getRequest(), "complexity",
- "task.error.missing_complexity");
- task.priority = ParameterUtil.requireIntParameter(
- ctx.getRequest(), "priority",
- "task.error.invalid_priority");
- task.creator = ParameterUtil.requireParameter(
- ctx.getRequest(), "creator",
- "task.error.missing_creator");
-
- // preserve the null-status of non-owned tasks
- String owner = ParameterUtil.getParameter(
- ctx.getRequest(), "owner", true);
- task.owner = (StringUtil.blank(owner)) ? null : owner;
-
- app.getRepository().updateTask(task);
- ctx.put("error", "edit.message.task_updated");
-
- } else if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "delete")) {
- app.getRepository().deleteTask(taskId);
- ctx.put("error", "edit.message.task_deleted");
- ctx.remove("task"); // clear out the task
-
- } else if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "reopen")) {
- // clear out the completor and completion dates
- task.completor = null;
- task.completion = null;
-
- app.getRepository().updateTask(task);
- ctx.put("error", "edit.message.task_reopened");
-
- } else if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "addnote")) {
- // extract our fields
- String note = ParameterUtil.requireParameter(
- ctx.getRequest(), "note", "edit.error.missing_note");
- // prefix the note with a creator identifier
- note = "[" + user.username + "] " + note.trim();
-
- if (StringUtil.blank(task.notes)) {
- task.notes = note;
- } else {
- task.notes += "\n\n" + note;
- }
-
- app.getRepository().updateTask(task);
- ctx.put("error", "edit.message.note_added");
-
- } else if (ParameterUtil.parameterEquals(
- ctx.getRequest(), "action", "editnotes")) {
- task.notes = ParameterUtil.getParameter(
- ctx.getRequest(), "notes", false).trim();
- app.getRepository().updateTask(task);
- ctx.put("error", "edit.message.notes_updated");
- }
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java
deleted file mode 100644
index 7fc9af76..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java
+++ /dev/null
@@ -1,203 +0,0 @@
-//
-// $Id: index.java,v 1.12 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.util.StringUtil;
-
-import com.samskivert.servlet.RedirectException;
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Displays a summary out outstanding and completed tasks.
- */
-public class index extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- // display any message we've been asked to display
- String msg = ParameterUtil.getParameter(req, "message", true);
- if (!StringUtil.blank(msg)) {
- ctx.put("error", msg);
- }
-
- // if they've submitted the form, we create a new task and stick
- // it into the dataabse
- if (ParameterUtil.parameterEquals(req, "action", "create")) {
- // set the creator from the username of the calling user
- Task task = new Task();
- task.creator = user.username;
- // if they requested to do so, claim the task for them
- if (ParameterUtil.isSet(req, "claim")) {
- task.owner = user.username;
- }
- task.notes = ""; // no notes to start
-
- // parse our fields
- task.summary = ParameterUtil.requireParameter(
- req, "summary", "task.error.missing_summary");
- task.category = ParameterUtil.requireParameter(
- req, "category", "task.error.missing_category");
- task.complexity = ParameterUtil.requireParameter(
- req, "complexity",
- "task.error.missing_complexity");
- task.priority = ParameterUtil.requireIntParameter(
- req, "priority", "task.error.invalid_priority");
-
- // insert the task into the repository
- app.getRepository().createTask(task);
-
- // if they want to edit this task, shoot them to the edit
- // page, otherwise flip back to this same page minus our query
- // parameters to clear out the creation form
- if (ParameterUtil.isSet(req, "edit")) {
- throw new RedirectException("edit.wm?task=" + task.taskId);
- } else {
- throw new RedirectException(
- "index.wm?msg=index.message.task_created");
- }
-
- } else if (ParameterUtil.parameterEquals(req, "action", "complete")) {
- int taskId = ParameterUtil.requireIntParameter(
- req, "task", "task.error.missing_taskid");
- app.getRepository().completeTask(taskId, user.username);
-
- // let the user know we updated the database
- ctx.put("error", "index.message.task_completed");
-
- } else if (ParameterUtil.parameterEquals(req, "action", "claim")) {
- int taskId = ParameterUtil.requireIntParameter(
- req, "task", "task.error.missing_taskid");
- app.getRepository().claimTask(taskId, user.username);
-
- // let the user know we updated the database
- ctx.put("error", "index.message.task_claimed");
- }
-
- // load up owned tasks and break them down by owner
- ArrayList tasks = app.getRepository().loadOwnedTasks();
- Collections.sort(tasks, OWNED_PARATOR);
- CatList[] otasks = categorize(tasks, new Categorizer() {
- public String category (Task task) {
- return task.owner;
- }
- });
- // look for our name and swap that into the zeroth position
- for (int ii = 0; ii < otasks.length; ii++) {
- if (otasks[ii].name.equals(user.username)) {
- CatList tlist = otasks[0];
- otasks[0] = otasks[ii];
- otasks[ii] = tlist;
- break;
- }
- }
- ctx.put("otasks", otasks);
- ctx.put("ocats", new CategoryTool());
-
- // load up recently completed tasks
- tasks = app.getRepository().loadCompletedTasks(0, 6);
- ctx.put("dtasks", tasks);
- }
-
- protected static class CatList
- implements Comparable
- {
- public String name;
- public ArrayList tasks;
- public int compareTo (Object other)
- {
- return name.compareTo(((CatList)other).name);
- }
- }
-
- protected static interface Categorizer
- {
- public String category (Task task);
- }
-
- protected CatList[] categorize (ArrayList tasks, Categorizer catter)
- {
- if (tasks == null) {
- return new CatList[0];
- }
-
- ArrayList cats = new ArrayList();
- HashMap cmap = new HashMap();
- int tcount = tasks.size();
- for (int ii = 0; ii < tcount; ii++) {
- Task task = (Task)tasks.get(ii);
- String category = catter.category(task);
- CatList clist = (CatList)cmap.get(category);
- if (clist == null) {
- clist = new CatList();
- clist.name = category;
- clist.tasks = new ArrayList();
- cats.add(clist);
- cmap.put(category, clist);
- }
- clist.tasks.add(task);
- }
-
- CatList[] ctasks = new CatList[cats.size()];
- cats.toArray(ctasks);
-
- return ctasks;
- }
-
- protected static final Comparator OPEN_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort first by reverse priority, then by complexity
- if (t1.priority == t2.priority) {
- return t1.getComplexityValue() - t2.getComplexityValue();
- } else {
- return t2.priority - t1.priority;
- }
- }
- };
-
- protected static final Comparator OWNED_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort by complexity
- return t1.getComplexityValue() - t2.getComplexityValue();
- }
- };
-
- // used to easy category generation in UI
- public static class CategoryTool
- {
- public boolean checkCategory (String category)
- {
- if (category.equals(_category)) {
- return false;
- } else {
- _category = category;
- return true;
- }
- }
-
- public void clear ()
- {
- _category = null;
- }
-
- protected String _category;
- }
-}
diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/tasks.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/tasks.java
deleted file mode 100644
index 0e4f8cc0..00000000
--- a/runtime/twodue/src/java/com/samskivert/twodue/logic/tasks.java
+++ /dev/null
@@ -1,146 +0,0 @@
-//
-// $Id: tasks.java,v 1.3 2003/12/10 20:33:42 mdb Exp $
-
-package com.samskivert.twodue.logic;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import javax.servlet.http.HttpServletRequest;
-
-import com.samskivert.util.StringUtil;
-
-import com.samskivert.servlet.RedirectException;
-import com.samskivert.servlet.user.User;
-import com.samskivert.servlet.util.ParameterUtil;
-import com.samskivert.velocity.InvocationContext;
-
-import com.samskivert.twodue.Log;
-import com.samskivert.twodue.TwoDueApp;
-import com.samskivert.twodue.data.Task;
-
-/**
- * Displays a summary of unclaimed tasks.
- */
-public class tasks extends UserLogic
-{
- public void invoke (InvocationContext ctx, TwoDueApp app, User user)
- throws Exception
- {
- HttpServletRequest req = ctx.getRequest();
-
- // display any message we've been asked to display
- String msg = ParameterUtil.getParameter(req, "message", true);
- if (!StringUtil.blank(msg)) {
- ctx.put("error", msg);
- }
-
- 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);
- }
-
- // sort the tasks by priority, then complexity
- Collections.sort(tasks, TASK_PARATOR);
-
- CatList[] xtasks = categorize(tasks, new Categorizer() {
- public String category (Task task) {
- return task.getPriorityName();
- }
- });
- ctx.put("xtasks", xtasks);
- ctx.put("xcats", new CategoryTool());
-
- if (!StringUtil.blank(query) && xtasks.length == 0) {
- ctx.put("error", "index.error.no_matching_tasks");
- }
- }
-
- protected static class CatList
- implements Comparable
- {
- public String name;
- public ArrayList tasks;
- public int compareTo (Object other)
- {
- return name.compareTo(((CatList)other).name);
- }
- }
-
- protected static interface Categorizer
- {
- public String category (Task task);
- }
-
- protected CatList[] categorize (ArrayList tasks, Categorizer catter)
- {
- if (tasks == null) {
- return new CatList[0];
- }
-
- ArrayList cats = new ArrayList();
- HashMap cmap = new HashMap();
- int tcount = tasks.size();
- for (int ii = 0; ii < tcount; ii++) {
- Task task = (Task)tasks.get(ii);
- String category = catter.category(task);
- CatList clist = (CatList)cmap.get(category);
- if (clist == null) {
- clist = new CatList();
- clist.name = category;
- clist.tasks = new ArrayList();
- cats.add(clist);
- cmap.put(category, clist);
- }
- clist.tasks.add(task);
- }
-
- CatList[] ctasks = new CatList[cats.size()];
- cats.toArray(ctasks);
-
- return ctasks;
- }
-
- protected static final Comparator TASK_PARATOR = new Comparator() {
- public int compare (Object o1, Object o2) {
- Task t1 = (Task)o1, t2 = (Task)o2;
- // sort first by reverse priority, then by category, then complexity
- if (t1.priority == t2.priority) {
- if (t1.category.equals(t2.category)) {
- return t1.getComplexityValue() - t2.getComplexityValue();
- } else {
- return t1.category.compareTo(t2.category);
- }
- } else {
- return t2.priority - t1.priority;
- }
- }
- };
-
- // used to easy category generation in UI
- public static class CategoryTool
- {
- public boolean checkCategory (String category)
- {
- if (category.equals(_category)) {
- return false;
- } else {
- _category = category;
- return true;
- }
- }
-
- public void clear ()
- {
- _category = null;
- }
-
- protected String _category;
- }
-}
diff --git a/runtime/twodue/src/sql/tasks-schema.sql b/runtime/twodue/src/sql/tasks-schema.sql
deleted file mode 100644
index 8ab5d807..00000000
--- a/runtime/twodue/src/sql/tasks-schema.sql
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * $Id: tasks-schema.sql,v 1.2 2002/11/08 21:49:18 mdb Exp $
- *
- * Schema for the Two Due tasks and notes table.
- */
-
-drop table if exists TASKS;
-
-/**
- * Contains basic data for every task in the system.
- */
-CREATE TABLE TASKS
-(
- /**
- * A unique identifier for this task.
- */
- TASK_ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
-
- /**
- * The summary description of this task.
- */
- SUMMARY VARCHAR(255) NOT NULL,
-
- /**
- * The comma separated list of categories occupied by this task.
- */
- CATEGORY VARCHAR(255) NOT NULL,
-
- /**
- * The complexity identifier for this task.
- */
- COMPLEXITY VARCHAR(32) NOT NULL,
-
- /**
- * The priority of this task.
- */
- PRIORITY INTEGER UNSIGNED NOT NULL,
-
- /**
- * The user to which this task is currently assigned.
- */
- OWNER VARCHAR(255),
-
- /**
- * The name of the creator of this task.
- */
- CREATOR VARCHAR(255) NOT NULL,
-
- /**
- * The time of creation of this task.
- */
- CREATION DATE NOT NULL,
-
- /**
- * The name of the completor(s) of this task.
- */
- COMPLETOR VARCHAR(255),
-
- /**
- * The time of completion of this task.
- */
- COMPLETION DATE,
-
- /**
- * Free form notes associated with this task.
- */
- NOTES TEXT NOT NULL,
-
- /**
- * Defines our table keys.
- */
- PRIMARY KEY (TASK_ID),
- KEY (CATEGORY),
- KEY (PRIORITY),
- KEY (CREATION),
- KEY (COMPLETION)
-);
diff --git a/runtime/twodue/web/app_footer.wm b/runtime/twodue/web/app_footer.wm
deleted file mode 100644
index bc49be3c..00000000
--- a/runtime/twodue/web/app_footer.wm
+++ /dev/null
@@ -1,5 +0,0 @@
-Two Due:
-$i18n.xlate("app_footer.summary_link") |
-$i18n.xlate("app_footer.tasks_link") |
-$i18n.xlate("app_footer.bycategory_link") |
-$i18n.xlate("app_footer.account_link")
diff --git a/runtime/twodue/web/bulkedit.wm b/runtime/twodue/web/bulkedit.wm
deleted file mode 100644
index a534057f..00000000
--- a/runtime/twodue/web/bulkedit.wm
+++ /dev/null
@@ -1,77 +0,0 @@
-#set ($title = $i18n.xlate("bulkedit.title"))
-#import ("/header.wm")
-
--
| Task summary | -- | By category | -- | - - | - -
- - -Outstanding tasks: - - -
- -#import ("/footer.wm") diff --git a/runtime/twodue/web/bycategory.wm b/runtime/twodue/web/bycategory.wm deleted file mode 100644 index 419161a5..00000000 --- a/runtime/twodue/web/bycategory.wm +++ /dev/null @@ -1,118 +0,0 @@ -#set ($title = $i18n.xlate("index.title")) -#import ("/header.wm") - --
| Task summary | -- | By priority | -- - | - | Click the wrench to claim a task. | -
- - -#if ($query) -Tasks matching '$query': -#else -Outstanding tasks: -#end - - -#if ($filter != "") -all -#foreach ($xtask in $xtasks) -$xtask.name -#end - -#foreach ($xtask in $xtasks) -#if ($filter == $xtask.name) -
-
| -$xtask.name -($xtask.tasks.size()) | -|||
| $task.complexity | |||
-![]() |
-$task.summary -[$task.creator] - #if (!$string.blank($task.notes)) - [...] - #end - | -$task.getPriorityName() | -
-![]() |
-
|
-
- |
-
| |||||||||||||||||
- -
| $task.complexity |
-
|
- |
-
-
|
-
-
| -#import ("app_footer.wm") - | - -