From e5de6871422f40f34fd8c51827d4f525a9c90d4d Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 12 Mar 2005 07:56:36 +0000 Subject: [PATCH] TwoDue has been in its own separate repository for a while. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1614 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- runtime/twodue/.cvsignore | 2 - runtime/twodue/build.xml | 71 ----- runtime/twodue/etc/.cvsignore | 2 - runtime/twodue/etc/exceptionmap.properties | 6 - runtime/twodue/etc/messages.properties | 75 ----- runtime/twodue/etc/user.properties.dist | 15 - runtime/twodue/etc/velocity.properties | 16 - runtime/twodue/etc/web.xml | 45 --- runtime/twodue/lib/.cvsignore | 1 - runtime/twodue/lib/REQUIRED_LIBS | 6 - .../src/java/com/samskivert/twodue/Log.java | 42 --- .../java/com/samskivert/twodue/TwoDueApp.java | 102 ------ .../java/com/samskivert/twodue/data/Task.java | 93 ------ .../twodue/data/TaskRepository.java | 296 ------------------ .../com/samskivert/twodue/logic/CatList.java | 87 ----- .../samskivert/twodue/logic/UserLogic.java | 39 --- .../com/samskivert/twodue/logic/bulkedit.java | 107 ------- .../samskivert/twodue/logic/bycategory.java | 170 ---------- .../com/samskivert/twodue/logic/detail.java | 85 ----- .../com/samskivert/twodue/logic/edit.java | 116 ------- .../com/samskivert/twodue/logic/index.java | 203 ------------ .../com/samskivert/twodue/logic/tasks.java | 146 --------- runtime/twodue/src/sql/tasks-schema.sql | 77 ----- runtime/twodue/web/app_footer.wm | 5 - runtime/twodue/web/bulkedit.wm | 77 ----- runtime/twodue/web/bycategory.wm | 118 ------- runtime/twodue/web/detail.wm | 44 --- runtime/twodue/web/edit.wm | 135 -------- runtime/twodue/web/footer.wm | 16 - runtime/twodue/web/header.wm | 27 -- runtime/twodue/web/images/claim.png | Bin 461 -> 0 bytes runtime/twodue/web/images/complete.png | Bin 472 -> 0 bytes runtime/twodue/web/images/completed.png | Bin 731 -> 0 bytes runtime/twodue/web/images/edit.png | Bin 546 -> 0 bytes runtime/twodue/web/index.wm | 125 -------- runtime/twodue/web/style.css | 28 -- runtime/twodue/web/tasks.wm | 69 ---- 37 files changed, 2446 deletions(-) delete mode 100644 runtime/twodue/.cvsignore delete mode 100644 runtime/twodue/build.xml delete mode 100644 runtime/twodue/etc/.cvsignore delete mode 100644 runtime/twodue/etc/exceptionmap.properties delete mode 100644 runtime/twodue/etc/messages.properties delete mode 100644 runtime/twodue/etc/user.properties.dist delete mode 100644 runtime/twodue/etc/velocity.properties delete mode 100644 runtime/twodue/etc/web.xml delete mode 100644 runtime/twodue/lib/.cvsignore delete mode 100644 runtime/twodue/lib/REQUIRED_LIBS delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/Log.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/TwoDueApp.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/data/Task.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/data/TaskRepository.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/CatList.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/UserLogic.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/bulkedit.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/bycategory.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/detail.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/edit.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/index.java delete mode 100644 runtime/twodue/src/java/com/samskivert/twodue/logic/tasks.java delete mode 100644 runtime/twodue/src/sql/tasks-schema.sql delete mode 100644 runtime/twodue/web/app_footer.wm delete mode 100644 runtime/twodue/web/bulkedit.wm delete mode 100644 runtime/twodue/web/bycategory.wm delete mode 100644 runtime/twodue/web/detail.wm delete mode 100644 runtime/twodue/web/edit.wm delete mode 100644 runtime/twodue/web/footer.wm delete mode 100644 runtime/twodue/web/header.wm delete mode 100644 runtime/twodue/web/images/claim.png delete mode 100644 runtime/twodue/web/images/complete.png delete mode 100644 runtime/twodue/web/images/completed.png delete mode 100644 runtime/twodue/web/images/edit.png delete mode 100644 runtime/twodue/web/index.wm delete mode 100644 runtime/twodue/web/style.css delete mode 100644 runtime/twodue/web/tasks.wm 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/runtime/twodue/etc/.cvsignore b/runtime/twodue/etc/.cvsignore deleted file mode 100644 index 2ba40480..00000000 --- a/runtime/twodue/etc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -repository.properties -user.properties diff --git a/runtime/twodue/etc/exceptionmap.properties b/runtime/twodue/etc/exceptionmap.properties deleted file mode 100644 index 7d7db4a4..00000000 --- a/runtime/twodue/etc/exceptionmap.properties +++ /dev/null @@ -1,6 +0,0 @@ -# -# $Id: exceptionmap.properties,v 1.1 2002/11/08 09:14:20 mdb Exp $ -# -# Maps exceptions to friendly error messages - -java.sql.SQLException: A database error has occurred: {m} diff --git a/runtime/twodue/etc/messages.properties b/runtime/twodue/etc/messages.properties deleted file mode 100644 index 065af633..00000000 --- a/runtime/twodue/etc/messages.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -*- mode: makefile -*- -# -# $Id: messages.properties,v 1.6 2003/12/10 20:33:42 mdb Exp $ -# -# Translation messages for Two Due application - -# -# common translations - -app_name=Two Due - -error.no_such_task = No task exists with that task id. - -# -# header.wm - -header.combined_title={0}: {1} -header.title={0} - -# -# app_footer.wm - -app_footer.summary_link=Task status -app_footer.tasks_link=By priority -app_footer.bycategory_link=By category -app_footer.account_link=Login/out - -# -# General task editing messages - -task.error.missing_summary = No summary provided for task. -task.error.missing_category = No category provided for task. -task.error.missing_complexity = No complexity selection for task. -task.error.invalid_priority = No priority selection for task. -task.error.invalid_creator = Creator not specified. -task.error.missing_taskid = Internal error. No task id provided. - -# -# index.wm - -index.title=Task Summary - -index.message.task_created = Task created. -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 - -edit.title = Edit Task - -edit.message.task_updated = Task updated. -edit.message.note_added = Note added. -edit.message.notes_updated = Notes updated. -edit.message.task_deleted = Task deleted. - -edit.error.missing_note = Can\'t add blank note. - -# -# detail.wm - -detail.title = Task Details - -# -# bulkedit.wm - -bulkedit.title = Bulk task update -bulkedit.no_tasks = No tasks at this priority. - -bulkedit.message.task_updated = Task updated. -bulkedit.message.tasks_updated = Tasks updated. -bulkedit.message.nothing_updated = No updates were detected. diff --git a/runtime/twodue/etc/user.properties.dist b/runtime/twodue/etc/user.properties.dist deleted file mode 100644 index 3ae65a2c..00000000 --- a/runtime/twodue/etc/user.properties.dist +++ /dev/null @@ -1,15 +0,0 @@ -# -# $Id: user.properties.dist,v 1.1 2003/11/15 22:55:32 mdb Exp $ -# -# Configuration parameters for the Two Due web appication - -# -# These are standard configurations that you probably don't want to change - -login_url = /register/login.wm?from=%R -access_denied_url = access_denied.wm - -# -# The name of the auth cookie - -auth_cookie.name = id_ diff --git a/runtime/twodue/etc/velocity.properties b/runtime/twodue/etc/velocity.properties deleted file mode 100644 index 0d6ea626..00000000 --- a/runtime/twodue/etc/velocity.properties +++ /dev/null @@ -1,16 +0,0 @@ -# -# $Id: velocity.properties,v 1.2 2002/11/08 21:54:50 mdb Exp $ -# -# Velocity engine configuration overrides - -#---------------------------------------------------------------------------- -# F O R E A C H P R O P E R T I E S -#---------------------------------------------------------------------------- -# These properties control how the counter is accessed in the #foreach -# directive. By default the reference $velocityCount will be available -# in the body of the #foreach directive. The default starting value -# for this reference is 1. -#---------------------------------------------------------------------------- - -directive.foreach.counter.name = vidx -directive.foreach.counter.initial.value = 0 diff --git a/runtime/twodue/etc/web.xml b/runtime/twodue/etc/web.xml deleted file mode 100644 index f6308d51..00000000 --- a/runtime/twodue/etc/web.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - dispatcher - com.samskivert.velocity.DispatcherServlet - - org.apache.velocity.properties - /velocity.properties - - - app_class - com.samskivert.twodue.TwoDueApp - - - logic_package - com.samskivert.twodue.logic - - - messages_path - messages - - - site_jar_path - /export/threerings/webapps/site-data - - - site_messages_path - site_messages - - - - - dispatcher - *.wm - - - - index.wm - - diff --git a/runtime/twodue/lib/.cvsignore b/runtime/twodue/lib/.cvsignore deleted file mode 100644 index d392f0e8..00000000 --- a/runtime/twodue/lib/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.jar diff --git a/runtime/twodue/lib/REQUIRED_LIBS b/runtime/twodue/lib/REQUIRED_LIBS deleted file mode 100644 index 9d7ab619..00000000 --- a/runtime/twodue/lib/REQUIRED_LIBS +++ /dev/null @@ -1,6 +0,0 @@ -commons-collections.jar -commons-lang.jar -jakarta-regexp-1.2.jar -mm.mysql-2.0.14-bin.jar -samskivert.jar -velocity-1.4-dev.jar diff --git a/runtime/twodue/src/java/com/samskivert/twodue/Log.java b/runtime/twodue/src/java/com/samskivert/twodue/Log.java deleted file mode 100644 index 27ee00df..00000000 --- a/runtime/twodue/src/java/com/samskivert/twodue/Log.java +++ /dev/null @@ -1,42 +0,0 @@ -// -// $Id: Log.java,v 1.1 2002/11/08 09:14:21 mdb Exp $ - -package com.samskivert.twodue; - -/** - * A placeholder class that contains a reference to the log object used by - * this package. - */ -public class Log -{ - /** - * This is the log instance that will be used to log all messages for - * this package. - */ - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("twodue"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } -} diff --git a/runtime/twodue/src/java/com/samskivert/twodue/TwoDueApp.java b/runtime/twodue/src/java/com/samskivert/twodue/TwoDueApp.java deleted file mode 100644 index d3a16027..00000000 --- a/runtime/twodue/src/java/com/samskivert/twodue/TwoDueApp.java +++ /dev/null @@ -1,102 +0,0 @@ -// -// $Id: TwoDueApp.java,v 1.2 2003/11/15 22:55:32 mdb Exp $ - -package com.samskivert.twodue; - -import java.util.Properties; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; - -import com.samskivert.io.PersistenceException; -import com.samskivert.jdbc.ConnectionProvider; -import com.samskivert.jdbc.StaticConnectionProvider; - -import com.samskivert.servlet.JDBCTableSiteIdentifier; -import com.samskivert.servlet.SiteIdentifier; -import com.samskivert.servlet.user.UserManager; -import com.samskivert.util.ConfigUtil; -import com.samskivert.util.ServiceUnavailableException; -import com.samskivert.velocity.Application; - -import com.samskivert.twodue.data.TaskRepository; - -/** - * Contains references to application-wide resources (like the database - * repository) and handles initialization and cleanup for those resources. - */ -public class TwoDueApp extends Application -{ - /** Returns the connection provider in use by this application. */ - public final ConnectionProvider getConnectionProvider () - { - return _conprov; - } - - /** Returns the task repository in use by the application. */ - public TaskRepository getRepository () - { - return _taskrep; - } - - /** Returns the user manager in use by the application. */ - public UserManager getUserManager () - { - return _usermgr; - } - - protected void willInit (ServletConfig config) - { - super.willInit(config); - - try { - // create a static connection provider - _conprov = new StaticConnectionProvider(CONN_CONFIG); - - // load up our configuration properties - Properties props = ConfigUtil.loadProperties("user.properties"); - _usermgr = new UserManager(props, _conprov); - - // initialize the task repository - _taskrep = new TaskRepository(_conprov); - - Log.info("TwoDue application initialized."); - - } catch (Throwable t) { - Log.warning("Error initializing application: " + t); - } - } - - public void shutdown () - { - try { - _usermgr.shutdown(); - Log.info("TwoDue application shutdown."); - - } catch (Throwable t) { - Log.warning("Error shutting down repository: " + t); - } - } - - /** We want a special site identifier. */ - protected SiteIdentifier createSiteIdentifier (ServletContext ctx) - { - try { - return new JDBCTableSiteIdentifier(_conprov); - } catch (PersistenceException pe) { - throw new ServiceUnavailableException( - "Can't access site database.", pe); - } - } - - /** A reference to our connection provider. */ - protected ConnectionProvider _conprov; - - /** A reference to our user manager. */ - protected UserManager _usermgr; - - /** A reference to our task repository. */ - protected TaskRepository _taskrep; - - /** The path to our database configuration file. */ - protected static final String CONN_CONFIG = "repository.properties"; -} diff --git a/runtime/twodue/src/java/com/samskivert/twodue/data/Task.java b/runtime/twodue/src/java/com/samskivert/twodue/data/Task.java deleted file mode 100644 index 16f98254..00000000 --- a/runtime/twodue/src/java/com/samskivert/twodue/data/Task.java +++ /dev/null @@ -1,93 +0,0 @@ -// -// $Id: Task.java,v 1.8 2003/12/11 00:13:48 mdb Exp $ - -package com.samskivert.twodue.data; - -import java.sql.Date; -import java.util.ArrayList; - -import com.samskivert.util.StringUtil; - -/** - * Contains the basic data associated with a task. - */ -public class Task -{ - public static final String[] COMPLEXITIES = { - "Simple hack", "Minor feature", "Major feature", - "Subsystem", "Major refactor", - }; - - public static final int[] COMPLEXITY_VALUES = { - 5, 10, 15, 20, 25, - }; - - public int taskId; - - public String summary; - - public String category; - - public String complexity; - - public int priority; - - public String creator; - - public Date creation; - - public String owner; - - public String completor; - - public Date completion; - - public String notes; - - /** - * Converts numerical priority to a string. - */ - public String getPriorityName () - { - if (priority > 25) { - return "Urgent"; - } else if (priority > 15) { - return "Next up"; - } else if (priority > 10) { - return "Near term"; - } else if (priority > 5) { - return "Medium term"; - } else if (priority > 1) { - return "Long term"; - } else { - return "On the list"; - } - } - - /** - * Converts string complexity to a value, lower meaning less complex, - * higher meaning more complex. - */ - public int getComplexityValue () - { - for (int ii = 0; ii < COMPLEXITIES.length; ii++) { - if (COMPLEXITIES[ii].equals(complexity)) { - return COMPLEXITY_VALUES[ii]; - } - } - return 50; - } - - public String getDisplayCategory () - { - return StringUtil.replace(category, ",", "
"); - } - - /** - * 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  -
-Priority: - -$form.submit("submit", "Go") -
-
- -

- - -Outstanding tasks: - - -

-$form.hidden("priority", $priority) -$form.hidden("action", "update") -#if ($data.length($xtasks) > 0) -#foreach ($xtask in $xtasks) - - -$xcats.clear() -#foreach ($task in $xtask.tasks) -#set ($id = $task.taskId) - - - - - - - - - -#end -
$task.summary   -[$task.creator] -#if (!$string.blank($task.notes)) -  [...] -#end -$form.text("category$id", "size='10'", $task.category) -
-#end -#else -

$i18n.xlate("bulkedit.no_tasks") -#end - -

$form.submit("submit", "Update")
-
- -#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 
Filter:  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) -

- - - - -$xcats.clear() -#foreach ($task in $xtask.tasks) -#if ($xcats.checkCategory($task.complexity)) - - #set ($border = "") - #else - #set ($border = 'style="border-top: 1px solid"') - #end - - - - - - - -#end -
-$xtask.name -($xtask.tasks.size()) 
$task.complexity
-Claim this task$task.summary   -[$task.creator] - #if (!$string.blank($task.notes)) -  [...] - #end -$task.getPriorityName() -Edit this task
-

-#end -#end - -#else -
- - -#foreach ($xtask in $xtasks) -#if ($vidx == $break) -
-
  - -#else -#if ($vidx > 0) - -#end -#end - - - -$xcats.clear() -#foreach ($task in $xtask.tasks) - -#if ($xcats.checkCategory($task.complexity)) - -#set ($border = "") -#else -#set ($border = 'style="border-top: 1px solid"') -#end - - - - - - - -#end -#end -
 
-$xtask.name -($xtask.tasks.size()) 
$task.complexity
-Claim this task$task.summary   -[$task.creator] -#if (!$string.blank($task.notes)) -  [...] -#end -$task.getPriorityName() -Edit this task
-
-#end - -#import ("/footer.wm") diff --git a/runtime/twodue/web/detail.wm b/runtime/twodue/web/detail.wm deleted file mode 100644 index 90d0c44d..00000000 --- a/runtime/twodue/web/detail.wm +++ /dev/null @@ -1,44 +0,0 @@ -#set ($title = $i18n.xlate("detail.title")) -#import ("/header.wm") - -

- - - - - -$form.fixedHidden("task", "$task.taskId") - - - - - - - - -#if (!$string.blank($notes)) - - - - -#end - - -
$task.complexity
-#if ($task.owner) -#if ($username == $task.owner) -$form.imageSubmit("submit", "", "images/complete.png", "Mark as completed") -#else -  -#end -#else -$form.imageSubmit("action", "claim", "images/claim.png", "Claim this task") -#end -$task.summary   -[$task.creator] -$task.category -
 
Notes
  -
$notes
-
- -#import ("/footer.wm") diff --git a/runtime/twodue/web/edit.wm b/runtime/twodue/web/edit.wm deleted file mode 100644 index 1bc8d137..00000000 --- a/runtime/twodue/web/edit.wm +++ /dev/null @@ -1,135 +0,0 @@ -#set ($title = $i18n.xlate("edit.title")) -#import ("/header.wm") - -#if ($task) - -

- - -
- - -#if ($task.completor) - -$form.fixedHidden("action", "reopen") - - - - - -#end - - -$form.fixedHidden("action", "update") - - - - - - - - - - - - - - - - - -
-Task is completed. -
-$form.submit("submit", "Reopen")
 
Summary:
- -
Category:
-$form.text("category", "size='10'", $task.category) -
Complexity:
- -
Creator:
-$form.text("creator", "size='10'", $task.creator) -
Priority:
- -
Owner:
-#if ($task.owner) -$form.text("owner", "size='10'", $task.owner) -#else -$form.text("owner", "size='10'", "") -#end -
 
-$form.submit("submit", "Update")
- -
  - - - - -
Other actions:
- -
-$form.fixedHidden("action", "delete") - -$form.submit("submit", "Delete") -
- -
- -
- -

- - - -$form.fixedHidden("action", "addnote") - - - - - - - - - - -$form.fixedHidden("action", "editnotes") - - - - - - - -
Add a note:
- - - -
-$form.submit("submit", "Add")
 
Notes:
- - - -
-$form.submit("submit", "Update")
- -#end - -#import ("/footer.wm") diff --git a/runtime/twodue/web/footer.wm b/runtime/twodue/web/footer.wm deleted file mode 100644 index 989f5a1d..00000000 --- a/runtime/twodue/web/footer.wm +++ /dev/null @@ -1,16 +0,0 @@ -

- - - - -
-#import ("app_footer.wm") -
- - - diff --git a/runtime/twodue/web/header.wm b/runtime/twodue/web/header.wm deleted file mode 100644 index a5c48c51..00000000 --- a/runtime/twodue/web/header.wm +++ /dev/null @@ -1,27 +0,0 @@ -## This is the header and footer color -#set ($hcolor = "#CCCCCC") -## These colors are used for common UI elements -#set ($tcolor = "#99CCFF") -#set ($scolor = "#CCCCCC") -#set ($fcolor = "#000000") - - - -$i18n.xlate("header.combined_title", $i18n.xlate("app_name"), $title) - - - - - - - -
-$i18n.xlate("header.title", $i18n.xlate("app_name"))
-$title
- -#if ($error) -

- - -
$i18n.xlate($error)
-#end diff --git a/runtime/twodue/web/images/claim.png b/runtime/twodue/web/images/claim.png deleted file mode 100644 index 8e3aedfc531ea5de7b443f5d6a718edcbc326e9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 461 zcmV;;0W$uHP)N#N`A~=r2csyn}d}TBmC0k#=-AMf*Zw6JZR>k-I zAM`v=JkOI}uP1S^00000NkvXXu0mjf DEc(aI diff --git a/runtime/twodue/web/images/complete.png b/runtime/twodue/web/images/complete.png deleted file mode 100644 index d13b85344ddc6b1c577f402fbd76241061de7909..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmV;}0Vn>6P)3Ybbkm3S6rMx<_Z^EfKt0}dwRlpwIK7%+|6Ty&0$_|OB;E_U?9_Jg zpMv#p7>+K_uBX-j9uT`M0$?y0kcBCwP|8LoA{b+sjO}8B=a|<@23C{@-S++|FfZA^Y##n1+ zCYF`KTu)0si%JC)*^thS=KDTz91}$mU^5XBwAP3Sp63D3>2y{D)a&(y6LU2;0~cTm z*yd~VENUqYykU=tnaWR=1iF@tMf%kMG4P&@--2-ota2Zupkl}HpQ=xIjC8%a()NM? O0000s5AMS+WmL4_dO z1+~c*28FZ;Y$a4sfi1*Ut7;KJ?E;CU2#io#rQ;}LI`28ohnn-8nfF@sW)PXlnQ#>y zxV*c$=XcKi|IdB!Kgx$FZscw!zSQ6S7EpkCfV$mG-g~oqT8k|^0Y8ucQnEsOvc^@{ z+uuE<#g-4Pul`&GngM6I4g_GBA$+BC_D3|{CiaMh@i(7u0~Syyr-1;lEUT&& zUtXdkd=h;z(YCR^@#)?3_t$|8umr6CQG-+}MG*!dr9{f#^#~!bEQ`C32FPvZNGz>P zO^i)G0g^xz&;Vmc7Yz>I;d0+a(&;pYVPIJnQc7m#zccW#pSkEfT1;nRY;qJx19Nur zZ1Jiq0v$#1}L?4lftZbd~h6J#UnApsWONyWO<3v~abn5AWXn1l#?jlPO#% zoIf3=si}$9*4E;Y%}VyJsDZ=bps}%$U@*wFo*NwWsMH$@;d4Fsd_F><5UQ${Zgs~; zX$!DmSr*xBwq(a_HjA$7Xqtu)fdx>h(scP2k`lPwZ5cgEdURo z0u8oCqKf2eK&~2*g$;GtUr|N%7Ld1xEWdrwL^SqVs^M{vM!540Y9_tDO z5D`IZjfkL>!gbwKr<@A-)ZAmo|Aw>wlPB*E0SqGs<4dE_h)+f8`hX z(BaVO@bLA?3#C+TFc@Il_KJ;*XrxjpL~yQXHqaWRfJ) - - - - - -
- -Owned tasks: - - -#foreach ($otask in $otasks) -#if ($vidx > 0) - -#end - - -$ocats.clear() -#foreach ($task in $otask.tasks) -#if ($ocats.checkCategory($task.complexity)) - -#set ($border = "") -#else -#set ($border = 'style="border-top: 1px solid"') -#end - - - - - -#end -#end -
 
$otask.name
$task.complexity
-#if ($username == $task.owner) - -Mark as completed -#else -  -#end -$task.summary -#if (!$string.blank($task.notes)) -  [...] -#end -$task.getDisplayCategory() -Edit this task
- -
  - -Recent completed tasks: - -#foreach ($task in $dtasks) -#if ($vidx%2 == 0) -#set ($rowcolor = "#EEEEEE") -#else -#set ($rowcolor = "#FFFFFF") -#end - - - - - - -#end -
$task.completion
[$task.completor]
$task.summary -#if (!$string.blank($task.notes)) -  [...] -#end -$task.getDisplayCategory() -Edit this task
- -

Browse:  by category -  by priority - -

Create new task: -

-$form.fixedHidden("action", "create") - - - - - - - - - - - - - - - -
 
Summary:
- -
Category:
-$form.text("category", "size='10'", "") -
Complexity:
- -
Priority:
- -
-$form.checkbox("claim", false) Claim created task   -$form.checkbox("edit", false) Edit created task -$form.submit("submit", "Create")
-
- -
- -#import ("/footer.wm") diff --git a/runtime/twodue/web/style.css b/runtime/twodue/web/style.css deleted file mode 100644 index 098beb28..00000000 --- a/runtime/twodue/web/style.css +++ /dev/null @@ -1,28 +0,0 @@ -body { - font-family: Arial, Helvetica, sans-serif; -} - -i, em { - font-style: italic; -} - -th, td, center, div { /* ns 4 */ - font-family: Arial, Helvetica, sans-serif; -} - -pre, code { - font-family: Courier; -} - -.big { - font-size: x-large; -} - -.small { - font-size: small; -} - -table { - border-collapse: collapse; - border-width: 0; -} diff --git a/runtime/twodue/web/tasks.wm b/runtime/twodue/web/tasks.wm deleted file mode 100644 index 5fa12e80..00000000 --- a/runtime/twodue/web/tasks.wm +++ /dev/null @@ -1,69 +0,0 @@ -#set ($title = $i18n.xlate("index.title")) -#import ("/header.wm") - -

- - - - - - - - - - -
Task summary By category 
Filter:  Click the wrench to claim a task.
- -

- - -#if ($query) -Tasks matching '$query': -#else -Outstanding tasks: -#end - - -
- -#foreach ($xtask in $xtasks) - - - - -$xcats.clear() -#foreach ($task in $xtask.tasks) - -#if ($xcats.checkCategory($task.category)) - -#set ($border = "") -#else -#set ($border = 'style="border-top: 1px solid"') -#end - - - - - - - -#end -
$xtask.name 
$task.category
-Claim this task$task.summary   -[$task.creator] -#if (!$string.blank($task.notes)) -  [...] -#end -$task.complexity -Edit this task
- -#if ($vidx%2 == 1) -
-#else -  -#end -#end -
- - -#import ("/footer.wm")