[nag] new search option
Christoph Schindler
e9525429 at student.tuwien.ac.at
Tue Jun 10 12:08:16 PDT 2003
Hi!
Following a request from my boss I hacked up this quick&dirty patch to
search for category names in nag...
Code for limiting the display of tasks to a specific category will
follow later, i hope ;)
cu!hop
Index: list.php
===================================================================
RCS file: /repository/nag/list.php,v
retrieving revision 1.54
diff -u -r1.54 list.php
--- list.php 4 Jun 2003 03:18:33 -0000 1.54
+++ list.php 10 Jun 2003 18:51:06 -0000
@@ -46,12 +46,18 @@
$pattern = Horde::getFormData('search_pattern');
$search_name = (Horde::getFormData('search_name') == 'on');
$search_desc = (Horde::getFormData('search_desc') == 'on');
+ $search_category = (Horde::getFormData('search_category') == 'on');
- if (!empty($pattern) && ($search_name || $search_desc)) {
+ if (!empty($pattern) && $search_category) {
+ $categories = Nag::listCategories();
+ }
+
+ if (!empty($pattern) && ($search_name || $search_desc || $search_category)) {
$search_results = array();
foreach ($tasks as $task_id => $task) {
if (($search_name && preg_match("/$pattern/i", $task['name'])) ||
- ($search_desc && preg_match("/$pattern/i", $task['desc']))) {
+ ($search_desc && preg_match("/$pattern/i", $task['desc'])) ||
+ ($search_category && preg_match("/$pattern/i", $categories[$task['category']]))) {
$search_results[$task_id] = $task;
}
}
Index: templates/search/search.inc
===================================================================
RCS file: /repository/nag/templates/search/search.inc,v
retrieving revision 1.4
diff -u -r1.4 search.inc
--- templates/search/search.inc 15 Jun 2002 05:04:41 -0000 1.4
+++ templates/search/search.inc 10 Jun 2003 18:51:07 -0000
@@ -14,6 +14,7 @@
<td class="item" width="100%">
<input name="search_name" type="checkbox" checked="checked" /><?php echo _("Name") ?>
<input name="search_desc" type="checkbox" /><?php echo _("Description") ?>
+ <input name="search_category" type="checkbox" /><?php echo _("Category") ?>
</td>
</tr>
</table>
--
pathological-techno-fetishist-with-social-deficit
More information about the nag
mailing list