From 7712c8e996b50a91c4e157ebcc920f890210fc09 Mon Sep 17 00:00:00 2001 From: mdb Date: Wed, 21 May 2003 02:40:13 +0000 Subject: [PATCH] Show our tasks at the top; allow a task to be edited immediately following creation. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1136 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/twodue/logic/index.java | 24 +++++++++++++++---- runtime/twodue/web/index.wm | 5 ++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java index dbd97501..6f49191f 100644 --- a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java +++ b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java @@ -1,5 +1,5 @@ // -// $Id: index.java,v 1.9 2003/01/23 21:37:13 mdb Exp $ +// $Id: index.java,v 1.10 2003/05/21 02:40:13 mdb Exp $ package com.samskivert.twodue.logic; @@ -67,10 +67,15 @@ public class index extends UserLogic // insert the task into the repository app.getRepository().createTask(task); - // flip back to this same page minus our query parameters to - // clear out the creation form - throw new RedirectException( - "index.wm?msg=index.message.task_created"); + // 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( @@ -127,6 +132,15 @@ public class index extends UserLogic 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()); diff --git a/runtime/twodue/web/index.wm b/runtime/twodue/web/index.wm index 72b64a4b..9af1a1ca 100644 --- a/runtime/twodue/web/index.wm +++ b/runtime/twodue/web/index.wm @@ -187,8 +187,9 @@ $form.text("category", "size='10'", "") -$form.checkbox("claim", false) -Claim created task + +$form.checkbox("claim", false) Claim created task   +$form.checkbox("edit", false) Edit created task $form.submit("submit", "Create")