- Status Closed
- Percent Complete
- Task Type Feature Request
- Category Backend/Core
- Assigned To No-one
- Operating System All
- Severity Low
- Priority Very Low
- Reported Version 0.9.9.1
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#1330 - Categories tasklist column
I've kludged (in 0.9.9.1) a change that allows categories to be seen in the tasklist. Right now we can see category, but we do not see its possible parent categories. This can be highly useful, depending on the situation.
The approach is to pre-calculate the categories string into a new column in the list_category table during the update of a category in pm.cat (this means that a "dumb" update must be forced after adding a new category)
Another approach might be somehow generating such a categories string on the fly in class.backend.php in the get_task_list() function, but my brain exploded when I attempted to concoct the SQL :p
The files I kludged are:
includes/modify.inc.php – actual kludge: precalc the string
after case 'update_category'
after $listowners
$phil_kludge = $db→FetchAllArray(
$db->Query('SELECT * FROM {list_category} WHERE project_id = ? order by lft', $proj->id) );
$phil_temp_r = $phil_temp_pr = 9999; should be max(rgt)
$phil_temp_l = 0;
$phil_parent = array();
$phil_temp_c = '';
foreach ($phil_kludge as $phil_i ⇒ $phil_row) if ($phil_i > 0) skip root
{ if ($phil_temp_r > $phil_row['rgt']) { if ($phil_temp_c) $phil_parent[] = $phil_temp_c; $phil_temp_pr = $phil_temp_r; } else if ($phil_temp_pr < $phil_row['rgt']) array_pop($phil_parent);
// this if clause should be simplified if (count($phil_parent) > 0) $listfullname[$phil_row['category_id']] = implode(' - ',$phil_parent).' - '.$phil_row['category_name']; else $listfullname[$phil_row['category_id']] = $phil_row['category_name'];
$phil_temp_r = $phil_row['rgt']; $phil_temp_c = $phil_row['category_name']; }
END THIS KLUDGE, more below
and then modify the $update string below accordingly to add one new column
includes/class.backend.php – bookkeeping: load the precalced string in get_task_list
the 'allcat' is probably superfluous, as the old category search is inclusive?
if (array_get($args, 'allcat') || in_array('categories', $visible)) {
$from .= ' LEFT JOIN {list_category} lc2 ON t.product_category = lc2.category_id ';
$select .= ' lc2.category_full_name AS category_full_name, ';
$groupby .= 'lc2.category_full_name, ';
}
dont forget to add to $order_keys later in the func
scripts/index.php – add to $indexes in tpl_draw_cell()
templates/pm.prefs.tpl – add to $columnnames
other files possibly needing modify:
includes/modify.inc.php – to further integrate it into "add a new category" code
?/setup.php* – to implement the database change into setup/migrate/etc script
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
Pooh, the formatting got screwed up a little bit
That uses too much width in the task list column I'd say. For 1.0 there will be a somewhat more useful sorting though, so that tasks are sorted keeping the hierarchy.