[dev] Add action icons to nag summary

John Morrissey jwm at horde.net
Mon Mar 10 20:57:58 PST 2003


The attached patch adds action icons to the nag summary so it mimics the
task list save for the delete icon, since I thought one-click delete a bit
dangerous for the summary view.

When completing a task, it will return the user to the portal view, but when
modifying will maintain the current behavior of displaying the task details.
I'm not sure how desirable this is, since the Notification framework will
display a confirmation/error message in the portal view. Thoughts?

Lastly, I didn't bother updating the legacy summary code in lib/api.php;
should I update this too, so the new functionality will be in the
backwards-compatible code?

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__
-------------- next part --------------
Index: nag/task.php
===================================================================
RCS file: /repository/nag/task.php,v
retrieving revision 1.40
diff -u -u -r1.40 task.php
--- nag/task.php	10 Mar 2003 21:03:21 -0000	1.40
+++ nag/task.php	11 Mar 2003 01:51:28 -0000
@@ -18,6 +18,8 @@
     exit;
 }
 
+$url = Horde::getFormData('url');
+
 /* Run through the action handlers. */
 switch ($actionID) {
 case NAG_ADD_TASK:
@@ -272,8 +273,11 @@
         }
     }
 
-    /* Return to the task list. */
-    header('Location: ' . Horde::applicationUrl('list.php', true));
+    if (isset($url)) {
+        header('Location: ' . $url);
+    } else {
+        header('Location: ' . Horde::applicationUrl('list.php', true));
+    }
     exit;
     break;
 
Index: nag/config/prefs.php.dist
===================================================================
RCS file: /repository/nag/config/prefs.php.dist,v
retrieving revision 1.25
diff -u -u -r1.25 prefs.php.dist
--- nag/config/prefs.php.dist	4 Mar 2003 20:47:13 -0000	1.25
+++ nag/config/prefs.php.dist	11 Mar 2003 01:51:28 -0000
@@ -16,15 +16,16 @@
     'label' => _("Display Options"),
     'desc' => _("Change your task sorting and display options."),
     'members' => array('sortby', 'sortdir', 'summary_show_priorities',
-                       'summary_show_due', 'show_completed',
-                       'summary_show_owner', 'showsummaryselect'));
+                       'summary_show_actions', 'summary_show_due',
+                       'show_completed', 'summary_show_owner',
+                       'showsummaryselect'));
 
 $prefGroups['summary'] = array(
     'column' => _("Other Options"),
     'label' => _("Summary Options"),
     'desc' => _("Change your summary display options."),
-    'members' => array('summary_show_priorities', 'summary_show_due',
-                       'summary_show_owner',
+    'members' => array('summary_show_priorities', 'summary_show_actions',
+                       'summary_show_due', 'summary_show_owner',
                        'showsummaryselect','summary_due_format'));
 
 $prefGroups['share'] = array(
@@ -94,6 +95,14 @@
     'shared' => false,
     'type' => 'checkbox',
     'desc' => _("Show priorities in the summary view?"));
+
+// show actions (modify/complete task) in summary?
+$_prefs['summary_show_actions'] = array(
+    'value' => 1,
+    'locked' => false,
+    'shared' => false,
+    'type' => 'checkbox',
+    'desc' => _("Show actions (modify/complete task) in the summary view?"));
 
 // show due dates in summary?
 $_prefs['summary_show_due'] = array(
Index: nag/lib/Block/summary.php
===================================================================
RCS file: /repository/nag/lib/Block/summary.php,v
retrieving revision 1.5
diff -u -u -r1.5 summary.php
--- nag/lib/Block/summary.php	21 Feb 2003 17:47:49 -0000	1.5
+++ nag/lib/Block/summary.php	11 Mar 2003 01:51:28 -0000
@@ -55,8 +55,16 @@
             if ($prefs->getValue('summary_show_priorities')) {
                 $style = 'text' . $task['priority'];
                 $priority_cell = '<td valign="top" width="20" align="center" class="' . $style . '">' . $task['priority'] . '</td>';
-                $spacer_cell = '<td width="3"></td>';
                 $html .= $priority_cell . $spacer_cell;
+            }
+
+            if ($prefs->getValue('summary_show_actions')) {
+                $taskurl = Horde::addParameter('task.php', 'task=' . $task['task_id']);
+                $taskurl = Horde::addParameter($taskurl, 'tasklist=' . $task['tasklist_id']);
+                $taskurl = Horde::addParameter($taskurl, 'url=' . Horde::selfURL(true));
+                $edit_cell = '<td>' . Horde::link(Horde::applicationUrl(Horde::addParameter($taskurl, 'actionID=' . NAG_MODIFY_TASK)), _("Edit Task"), 'widget') . Horde::img('edit.gif', _("Edit Task")) . '</a></td>';
+                $complete_cell = '<td width="18">' . Horde::link(Horde::applicationUrl(Horde::addParameter($taskurl, 'actionID=' . NAG_COMPLETE_TASKS)), _("Complete Task"), 'widget') . Horde::img('complete.gif', _("Complete Task")) . '</a></td>';
+                $html .= $edit_cell . $complete_cell;
             }
 
             $html .= '<td class="text">';


More information about the dev mailing list