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 03:53:10 -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 03:53:11 -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 03:53:11 -0000 @@ -88,7 +88,14 @@ $html .= '