Flyspray - The bug killer!

  • Status Unconfirmed
  • Percent Complete
    100%
  • Task Type Information
  • Category User Interface
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 1.0-rc
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Flyspray - The bug killer!
Opened by Jugaru Gabi - 12.10.2016

FS#2210 - Tasklist color for due date

Hello,

I was wondering if there is a way to make the task more visible if it wasn’t completed due to the date that was selected by a user - let’s say a yellowish background in tasklist, just like the ones from custom css based on severity, but that will take color if the task has the due date passed.

Project Manager
peterdd commented on 13.10.2016 07:27

Yes, that is possible by adapting the template themes/CleanFS/templates/index.tpl a bit.
We calculate if the task is overdue and add a class overdue to the task row:

Search where the output loop begins (near line 366 a the current flyspray 1.0-rc3) and insert the overdue calculation (I just got inspired from details.view.tpl):

<?php foreach ($tasks as $task):
$overdue=''; # reset after each row
if($task['due_date'] > 0){
        $days = floor((strtotime(date('c', $task['due_date'])) - strtotime(date("Y-m-d"))) / (60 * 60 * 24));
        if($days < 0){$overdue=' overdue';}
}
?>
<tr id="task<?php echo $task['task_id']; ?>" class="severity<?php echo $task['task_severity'];
        echo $task['is_closed'] ==1 ? ' closed': '';
        echo $overdue;
        ?>" onmouseover=....

and add some css to your custom css:

tr.overdue:not(.closed) td { background-color: red !important;}

!important for overwriting any severity background color. Other solutions like a pattern overlay over the severity background or icons are possible e.g. see https://css-tricks.com/stacking-order-of-multiple-backgrounds/

Maybe I add the overdue calculation to Flypray source if people wish this feature and so no need to fiddle with the template needed.

Definition of duedate status required. ('overdue', maybe 'duetoday' and others)

Edit: Fixed error from copy&pasting from details.view.tpl - $task instead of $task_details for the index.tpl

Jugaru Gabi commented on 15.10.2016 18:05

I have copied the code for index.tpl but when I save the tpl file and browse the tracker, I am receiving the follown errors ahead of task list:

Notice: Undefined variable: task_details in C:\xampp\htdocs\tichet\themes\CleanFS\templates\index.tpl on line 370

I am not very good on programming and I cannot seem to understand where I have to define duedate status in the php code.

A little help to understand this, please?

Jugaru Gabi commented on 16.10.2016 15:22

Besides the error, the code is working but it highlights all of the tasks that have due date set. I need that the task which has due date equal to system date or smaller than system date should be highlighted.

If I change {$overdue=' overdue';} to {$overdue=' duetoday';} the code isn't working anymore.

Jugaru Gabi commented on 16.10.2016 15:23

Also, if I change if($days < 0) to if($days = 0) or if($days > 0) or even if($days <> 0), code isn't working anymore.

Project Manager
peterdd commented on 16.10.2016 17:26

My code example had a typo which is fixed now. $task - while details.view.tpl uses variable $task_details .

Use if($days == 0) instead of if($days = 0) for comparing $days with 0 .

$days = 0 just assigns the value 0 to variable $days . This type of mistake can be easily overseen by reviewing code.

http://php.net/manual/en/language.operators.comparison.php

You may extend it similiar to details.view.tpl:

if($days < 0){$overdue=' overdue';}
elseif($days === 0){$overdue=' duetoday';}
Jugaru Gabi commented on 17.10.2016 04:43

It worked like a charm now.

Thanks mate.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing