Re: Distinction between shared task lists
Brian Keifer <[email protected]>
| Newsgroups | gmane.comp.horde.nag |
|---|---|
| Message-ID | <[email protected]> |
> ----- Message from [email protected] --------- > > This one? :-) > > Jan. > > ----- End message from [email protected] ----- /me mutters. Am I the only one who browses for the attachment in IMP and then forgets to hit the attach button? It's becoming a chronic problem -- maybe I'll make the button bright pink or something... Anyway, there's a diff attached to this message. I promise. =) Well, that's my daily reality check. Thanks Jan. =) -Brian -- Nag mailing list Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]
nag_usernames_v2.diff
(application/octet-stream, 9.1 KB)
Index: config/prefs.php.dist
===================================================================
RCS file: /repository/nag/config/prefs.php.dist,v
retrieving revision 1.17
diff -u -r1.17 prefs.php.dist
--- config/prefs.php.dist 29 Sep 2002 03:18:27 -0000 1.17
+++ config/prefs.php.dist 7 Nov 2002 18:30:36 -0000
@@ -14,7 +14,7 @@
'column' => _("Other Options"),
'label' => _("Display Options"),
'desc' => _("Change your task sorting and display options."),
- 'members' => array('sortby', 'sortdir', 'summary_show_priorities', 'summary_show_due', 'show_completed'));
+ 'members' => array('group_by_username', 'sortby', 'sortdir', 'summary_show_priorities', 'summary_show_due', 'show_completed', 'summary_show_usernames'));
$prefGroups['share'] = array(
'column' => _("Other Options"),
@@ -37,6 +37,14 @@
'type' => 'select',
'desc' => _("Select your preferred language:"));
+// group tasks by username?
+$_prefs['group_by_username'] = array(
+ 'value' => 1,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("Group tasks by username?"));
+
// user preferred sorting column
$_prefs['sortby'] = array(
'value' => NAG_SORT_PRIORITY,
@@ -86,6 +94,15 @@
'shared' => false,
'type' => 'checkbox',
'desc' => _("Show due dates in the summary view?"));
+
+// show task list name in summary?
+$_prefs['summary_show_usernames'] = array(
+ 'value' => 1,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("Show usernames in the summary view?"));
+
// user task categories
$_prefs['task_categories'] = array(
Index: lib/Nag.php
===================================================================
RCS file: /repository/nag/lib/Nag.php,v
retrieving revision 1.55
diff -u -r1.55 Nag.php
--- lib/Nag.php 1 Nov 2002 15:50:04 -0000 1.55
+++ lib/Nag.php 7 Nov 2002 18:30:36 -0000
@@ -42,6 +42,15 @@
global $prefs, $conf;
$tasks = array();
+ /* Sorting criteria for the task list. */
+ $sort_functions = array(
+ NAG_SORT_PRIORITY => 'ByPriority',
+ NAG_SORT_NAME => 'ByName',
+ NAG_SORT_CATEGORY => 'ByCategory',
+ NAG_SORT_DUE => 'ByDue',
+ NAG_SORT_COMPLETION => 'ByCompletion'
+ );
+
foreach ($GLOBALS['display_tasklists'] as $tasklist) {
/* Create a Nag storage instance. */
$storage = &Nag_Driver::singleton($conf['storage']['driver'], $tasklist,
@@ -66,23 +75,21 @@
}
}
}
+
+ if ($prefs->getValue('group_by_username')) {
+ $prefix = ($sortdir == NAG_SORT_DESCEND) ? '_rsort' : '_sort';
+ uasort($newtasks, $prefix . $sort_functions[$sortby]);
+ }
$tasks = array_merge($tasks, $newtasks);
}
- /* Sort the task list. */
- $sort_functions = array(
- NAG_SORT_PRIORITY => 'ByPriority',
- NAG_SORT_NAME => 'ByName',
- NAG_SORT_CATEGORY => 'ByCategory',
- NAG_SORT_DUE => 'ByDue',
- NAG_SORT_COMPLETION => 'ByCompletion'
- );
-
- /* Sort the array if we have a sort function defined for this field. */
- if (array_key_exists($sortby, $sort_functions)) {
- $prefix = ($sortdir == NAG_SORT_DESCEND) ? '_rsort' : '_sort';
- uasort($tasks, $prefix . $sort_functions[$sortby]);
+ /* Sort the array if we have a sort function defined for this field and haven't done so already. */
+ if (!$prefs->getValue('group_by_username')) {
+ if (array_key_exists($sortby, $sort_functions)) {
+ $prefix = ($sortdir == NAG_SORT_DESCEND) ? '_rsort' : '_sort';
+ uasort($tasks, $prefix . $sort_functions[$sortby]);
+ }
}
return $tasks;
Index: lib/api.php
===================================================================
RCS file: /repository/nag/lib/api.php,v
retrieving revision 1.26
diff -u -r1.26 api.php
--- lib/api.php 15 Oct 2002 17:10:28 -0000 1.26
+++ lib/api.php 7 Nov 2002 18:30:36 -0000
@@ -75,6 +75,7 @@
foreach ($tasks as $id => $task) {
$due_begin = $due_end = '';
$closed_begin = $closed_end = '';
+ $username = '';
$html .= ' <tr>';
@@ -88,7 +89,14 @@
$html .= '<td class="text">';
$viewurl = Horde::addParameter('view.php', 'task=' . $task['task_id']);
$viewurl = Horde::addParameter($viewurl, 'tasklist=' . $task['tasklist_id']);
- $row = Horde::link(Horde::applicationUrl($viewurl), $task['name']) . htmlspecialchars($task['name']) . '</a>';
+ $row = Horde::link(Horde::applicationUrl($viewurl), $task['name']);
+
+ if ($prefs->getValue('summary_show_usernames')) {
+ $username = $task['tasklist_id'] . ' - ';
+ }
+
+ $row .= htmlspecialchars($task['name']) . '</a>';
+
if (!empty($task['completed'])) {
$closed_begin = '<strike>';
$closed_end = '</strike>';
@@ -100,7 +108,7 @@
if (!empty($task['due']) && empty($task['completed']) && $prefs->getValue('summary_show_due')) {
$due_begin .= '(' . strftime('%c', $task['due']) . ') ';
}
- $html .= $closed_begin . $due_begin . $row . $due_end . $closed_end;
+ $html .= $closed_begin . $username . $due_begin . $row . $due_end . $closed_end;
$html .= "</td></tr>\n";
}
$html .= '</table></td></tr></table>';
Index: lib/constants.php
===================================================================
RCS file: /repository/nag/lib/constants.php,v
retrieving revision 1.6
diff -u -r1.6 constants.php
--- lib/constants.php 15 Aug 2002 18:49:56 -0000 1.6
+++ lib/constants.php 7 Nov 2002 18:30:36 -0000
@@ -19,6 +19,7 @@
/** @const NAG_SORT_DUE Sort by due date. */ define('NAG_SORT_DUE', 2);
/** @const NAG_SORT_COMPLETION Sort by completion. */ define('NAG_SORT_COMPLETION', 3);
/** @const NAG_SORT_CATEGORY Sort by category. */ define('NAG_SORT_CATEGORY', 4);
+/** @const NAG_SORT_USERNAME Sort by username. */ define('NAG_SORT_USERNAME', 5);
/** @const NAG_SORT_ASCEND Sort in ascending order. */ define('NAG_SORT_ASCEND', 0);
/** @const NAG_SORT_DESCEND Sort in descending order. */ define('NAG_SORT_DESCEND', 1);
Index: templates/list/task_headers.inc
===================================================================
RCS file: /repository/nag/templates/list/task_headers.inc,v
retrieving revision 1.15
diff -u -r1.15 task_headers.inc
--- templates/list/task_headers.inc 20 Sep 2002 15:57:34 -0000 1.15
+++ templates/list/task_headers.inc 7 Nov 2002 18:30:36 -0000
@@ -12,6 +12,10 @@
<?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby=' . NAG_SORT_COMPLETION)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")) ?></a>
<?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby=' . NAG_SORT_COMPLETION)), _("Sort by Completion Status"), 'widget') . Horde::img('complete.gif', _("Completed?")) ?></a>
</th>
+ <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_USERNAME) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
+ <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby=' . NAG_SORT_USERNAME)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")) ?></a>
+ <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby=' . NAG_SORT_USERNAME)), _("Sort by User Name"), 'widget') . _('Username') ?></a>
+ </th>
<th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_PRIORITY) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
<?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby=' . NAG_SORT_PRIORITY)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")) ?></a>
<?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby=' . NAG_SORT_PRIORITY)), _("Sort by Priority"), 'widget') . _("Pri") ?></a>
Index: templates/list/task_summaries.inc
===================================================================
RCS file: /repository/nag/templates/list/task_summaries.inc,v
retrieving revision 1.22
diff -u -r1.22 task_summaries.inc
--- templates/list/task_summaries.inc 22 Sep 2002 04:06:57 -0000 1.22
+++ templates/list/task_summaries.inc 7 Nov 2002 18:30:36 -0000
@@ -14,6 +14,7 @@
</td>
<td align="center" nowrap="nowrap"><?php echo htmlspecialchars(Nag::formatCompletion($task['completed'])) ?></a></td>
+ <td align="center"><?php echo $task['tasklist_id'] ?></td>
<td align="center"><?php echo $task['priority'] ?></td>
<td nowrap="nowrap"><?php echo Horde::link(Horde::applicationUrl($viewurl), _("View Task Details"), '', '', '', $task['desc']) ?><?php echo htmlspecialchars($task['name']) ?></a></td>
<td nowrap="nowrap">