[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nag
Subject:    Re: [nag] task complion
From:       Jon Parise <jon () horde ! org>
Date:       2001-12-09 8:40:30
Message-ID: 20011209034029.B11916 () csh ! rit ! edu
[Download RAW message or body]

On Thu, Dec 06, 2001 at 11:40:00AM -0500, Paul Cooper wrote:

> I've been playing with nag, and I decided to add an extra field - 
> 
> task_completed  smallint default 0
> 
> which I use to indicate whether a task is completed or not (you were 
> guessing right :) See the attached diff(s) - which style is preferred 
> round here -u or -c?
> 
> As it stands it's not great - I haven't yet got round to adding the 
> compeletion status to the task list, so there's no way to see open / 
> closed tasks yet in the list (yet). Also now that I think about it could 
> be more useful to be a percentage rather than a boolean, e.g. Open, 20%, 
> 40%, 60%, 80%, Closed.
 
I cleaned up your patch a little bit and committed it.  Thanks
for the contribution.

-- 
Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
http://www.csh.rit.edu/~jon/  :  Computer Science House Member


> From jon@horde.org Date: Sat,  8 Dec 2001 23:40:42 -0800 (PST)
Return-Path: <jon@csh.rit.edu>
Mailing-List: contact nag-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list nag@lists.horde.org
Received: (qmail 13180 invoked from network); 9 Dec 2001 08:50:16 -0000
Received: from mcp.csh.rit.edu (129.21.60.9)
  by clark.horde.org with SMTP; 9 Dec 2001 08:50:16 -0000
Received: from fury.csh.rit.edu (fury.csh.rit.edu [129.21.60.5])
	by mcp.csh.rit.edu (Postfix) with ESMTP id 46A091FE
	for <nag@lists.horde.org>; Sun,  9 Dec 2001 03:50:15 -0500 (EST)
Received: by fury.csh.rit.edu (Postfix, from userid 37404)
	id 5621E2E079; Sun,  9 Dec 2001 03:50:10 -0500 (EST)
Date: Sun, 9 Dec 2001 03:50:10 -0500
From: Jon Parise <jon@horde.org>
To: nag@lists.horde.org
Message-ID: <20011209035009.C11916@csh.rit.edu>
Mail-Followup-To: nag@lists.horde.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="tThc/1wpZn/ma/RB"
Content-Disposition: inline
User-Agent: Mutt/1.3.12i
Subject: [[cvs] cvs commit: nag task.php nag/docs CHANGES nag_tasks.sql nag/lib \
Storage.php nag/lib/Storage sql.php nag/templates/task task.inc nag/templates/view \
headers.inc (fwd)]



FYI -

-- 
Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
http://www.csh.rit.edu/~jon/  :  Computer Science House Member


Return-Path: <cvs-return-4014-jon=csh.rit.edu@lists.horde.org>
Delivered-To: jon@csh.rit.edu
Received: from clark.horde.org (clark.horde.org [199.175.137.150])
	by mcp.csh.rit.edu (Postfix) with SMTP id F08A41FE
	for <jon@csh.rit.edu>; Sun,  9 Dec 2001 03:49:39 -0500 (EST)
Received: (qmail 13090 invoked by alias); 9 Dec 2001 08:49:38 -0000
Mailing-List: contact cvs-help@lists.horde.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:cvs@lists.horde.org>
List-Help: <mailto:cvs-help@lists.horde.org>
List-Unsubscribe: <mailto:cvs-unsubscribe@lists.horde.org>
List-Subscribe: <mailto:cvs-subscribe@lists.horde.org>
Reply-To: dev@lists.horde.org
Delivered-To: mailing list cvs@lists.horde.org
Received: (qmail 13079 invoked from network); 9 Dec 2001 08:49:38 -0000
To: cvs@lists.horde.org
From: "Jon Parise" <jon@horde.org>
X-Horde-CVS-Branch: HEAD
Message-Id: <20011209074042.687BF40D@arkady.horde.org>
Date: Sat,  8 Dec 2001 23:40:42 -0800 (PST)
Subject: [cvs] cvs commit: nag task.php nag/docs CHANGES nag_tasks.sql nag/lib
         Storage.php nag/lib/Storage sql.php nag/templates/task task.inc
         nag/templates/view headers.inc
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=iso-8859-1

jon         2001/12/08 23:40:42 PST

  Modified files:
    .                    task.php 
    docs                 CHANGES nag_tasks.sql 
    lib                  Storage.php 
    lib/Storage          sql.php 
    templates/task       task.inc 
    templates/view       headers.inc 
  Log:
  Removing task dependencies.
  
  I'm not sure if anyone is actually using these, but they really shouldn't
  be in a simple task management application.
  
  Revision  Changes    Path
  1.40      +2 -1      nag/docs/CHANGES
  1.9       +1 -2      nag/docs/nag_tasks.sql
  1.20      +3 -6      nag/lib/Storage.php
  1.18      +4 -8      nag/lib/Storage/sql.php
  1.18      +2 -7      nag/task.php
  1.9       +1 -7      nag/templates/task/task.inc
  1.11      +3 -13     nag/templates/view/headers.inc

  Chora Links:
  http://cvs.horde.org/diff.php/nag/docs/CHANGES?r1=1.39&r2=1.40&ty=u
  http://cvs.horde.org/diff.php/nag/docs/nag_tasks.sql?r1=1.8&r2=1.9&ty=u
  http://cvs.horde.org/diff.php/nag/lib/Storage.php?r1=1.19&r2=1.20&ty=u
  http://cvs.horde.org/diff.php/nag/lib/Storage/sql.php?r1=1.17&r2=1.18&ty=u
  http://cvs.horde.org/diff.php/nag/task.php?r1=1.17&r2=1.18&ty=u
  http://cvs.horde.org/diff.php/nag/templates/task/task.inc?r1=1.8&r2=1.9&ty=u
  http://cvs.horde.org/diff.php/nag/templates/view/headers.inc?r1=1.10&r2=1.11&ty=u

-- 
To unsubscribe, mail: cvs-unsubscribe@lists.horde.org

[Attachment #4 (--=-gXOUINWrHyO9aucPKTD6)]


On Sun, 2001-12-09 at 03:40, Jon Parise wrote:
> On Thu, Dec 06, 2001 at 11:40:00AM -0500, Paul Cooper wrote:
[snip]
> > As it stands it's not great - I haven't yet got round to adding the 
> > compeletion status to the task list, so there's no way to see open / 
> > closed tasks yet in the list (yet). Also now that I think about it could 
> > be more useful to be a percentage rather than a boolean, e.g. Open, 20%, 
> > 40%, 60%, 80%, Closed.
>  
> I cleaned up your patch a little bit and committed it.  Thanks
> for the contribution.

Thanks. I've completed this task now. Attached is a diff to add a status
column and sort to the task list and a phpdoc cleanup.

Paul 

> -- 
> Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
> http://www.csh.rit.edu/~jon/  :  Computer Science House Member
> 
> -- 
> Nag mailing list: http://horde.org/nag/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: nag-unsubscribe@lists.horde.org


["diff.u" (diff.u)]

? diff.u
Index: lib/Nag.php
===================================================================
RCS file: /repository/nag/lib/Nag.php,v
retrieving revision 1.32
diff -u -r1.32 Nag.php
--- lib/Nag.php	9 Dec 2001 07:30:58 -0000	1.32
+++ lib/Nag.php	10 Dec 2001 16:43:30 -0000
@@ -64,6 +64,7 @@
 
         /* Sort the task list. */
         $sort_functions = array(
+	    SORT_COMPLETION => 'ByCompletion',
             SORT_PRIORITY => 'ByPriority',
             SORT_NAME => 'ByName',
             SORT_ADDED => 'ByAdded',
@@ -362,7 +363,7 @@
     /**
      * Returns the string representation of the given completion status.
      *
-     * @param int $completed    The priority value.
+     * @param int $completed    The completion value.
      *
      * @return string       The string representation of $completed.
      */
@@ -391,6 +392,21 @@
     if ($a['priority'] == $b['priority']) return 0;
     return ($a['priority'] > $b['priority']) ? -1 : 1;
 }
+
+/**
+ * Comparison function for sorting tasks by Completion status.
+ *
+ * @param array $a  Task one.
+ * @param array $b  Task two.
+ *
+ * @return integer  1 if task one is greater, -1 if task two is greater; 0 if they \
are equal. + */
+function _sortByCompletion($a, $b)
+{
+    if ($a['completed'] == $b['completed']) return 0;
+    return ($a['completed'] > $b['completed']) ? -1 : 1;
+}
+
 
 /**
  * Comparison function for reverse sorting tasks by priority.
Index: lib/constants.php
===================================================================
RCS file: /repository/nag/lib/constants.php,v
retrieving revision 1.1
diff -u -r1.1 constants.php
--- lib/constants.php	21 Oct 2001 20:16:24 -0000	1.1
+++ lib/constants.php	10 Dec 2001 16:43:30 -0000
@@ -13,6 +13,8 @@
 /** @const SORT_ADDED Sort by creation date.      */ define('SORT_ADDED', 1);
 /** @const SORT_DUE Sort by due date.             */ define('SORT_DUE', 2);
 /** @const SORT_PRIORITY Sort by priority.        */ define('SORT_PRIORITY', 3);
+/** @const SORT_COMPLETION Sort by priority.        */ define('SORT_COMPLETION', 4);
+
 /** @const SORT_ASCEND Sort in ascending order.   */ define('SORT_ASCEND', 0);
 /** @const SORT_DESCEND Sort in descending order. */ define('SORT_DESCEND', 1);
 
Index: templates/list/task_headers.inc
===================================================================
RCS file: /repository/nag/templates/list/task_headers.inc,v
retrieving revision 1.8
diff -u -r1.8 task_headers.inc
--- templates/list/task_headers.inc	9 Dec 2001 07:10:50 -0000	1.8
+++ templates/list/task_headers.inc	10 Dec 2001 16:43:35 -0000
@@ -9,9 +9,13 @@
         <?= Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_PRIORITY), \
_("Sort by Priority"), 'widget') . _("Priority") ?></a>  </th>
     <td width="0%">&nbsp;</td>
-    <th class="<?= ($prefs->getValue('sortby') == SORT_NAME) ? 'selected' : 'item' \
?>" width="60%" align="left" nowrap="nowrap"> +    <th class="<?= \
($prefs->getValue('sortby') == SORT_NAME) ? 'selected' : 'item' ?>" width="50%" \
align="left" nowrap="nowrap">  <?= \
Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_NAME . '&sortdir=' . \
abs(1 - $prefs->getValue('sortdir'))), _("Sort Direction"), 'widget') . \
Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', 'alt="' . _("Sort \
                Direction") .  '"') ?></a>
         <?= Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_NAME), \
_("Sort by Name"), 'widget') . _("Name") ?></a> +    </th>
+    <th class="<?= ($prefs->getValue('sortby') == SORT_NAME) ? 'selected' : 'item' \
?>" width="10%" align="left" nowrap="nowrap"> +        <?= \
Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_COMPLETION . '&sortdir=' \
. abs(1 - $prefs->getValue('sortdir'))), _("Sort Direction"), 'widget') . \
Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', 'alt="' . _("Sort \
Direction") .  '"') ?></a> +        <?= \
Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_COMPLETION), _("Sort by \
Completion Status"), 'widget') . _("Status") ?></a>  </th>
     <th class="<?= ($prefs->getValue('sortby') == SORT_ADDED) ? 'selected' : 'item' \
?>" width="15%" align="left" nowrap="nowrap">  <?= \
Horde::link(Horde::applicationUrl('list.php?sortby=' . SORT_ADDED . '&sortdir=' . \
abs(1 - $prefs->getValue('sortdir'))), _("Sort Direction"), 'widget') . \
Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', 'alt="' . _("Sort \
                Direction") .  '"') ?></a>
Index: templates/list/task_summaries.inc
===================================================================
RCS file: /repository/nag/templates/list/task_summaries.inc,v
retrieving revision 1.10
diff -u -r1.10 task_summaries.inc
--- templates/list/task_summaries.inc	1 Sep 2001 16:40:15 -0000	1.10
+++ templates/list/task_summaries.inc	10 Dec 2001 16:43:35 -0000
@@ -9,6 +9,9 @@
     <td nowrap="nowrap">
         <?= Horde::link("view.php?task=$task_id", _("View Task Details")) ?><?= \
htmlspecialchars($task['name']) ?></a>  </td>
+    <td nowrap="nowrap">
+        <?= htmlspecialchars(Nag::formatCompletion($task['completed'])) ?></a>
+    </td>
     <td nowrap="nowrap"><?= strftime($conf['list']['date_format'], $task['added']); \
?></td>  <td nowrap="nowrap">
 <?php



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic