View Full Version : Customise task priority
First - cool product for its price :-). We've just started using it for managing the development of our own open source product.
I want to change the task priorities, ideally to use Must/Should/Could/Would from the DSDM project management approach. Looking at postings in V1 customisation I guess I could dive into code and hack it - but I'd be happier knowing which files need changing.
Another approach is just to relabel low/normal/high to could/should/must in the locale file - but there are warnings about doing this by hand. Am I safe to assume that modifying an exiting item in the same location in the file (line no.) that it will work ok? Otherwsie how are other locales created?
The DSDM approach uses timeboxes, so it would be very cool if a project could have a timebox aspect incorporated somehow without too much coding - if anyone has already done something like this, let me know.
Cheers
Paul
price? what price? have you been robbed? :)
The task priorities options are defined in the System Admin, System Lookup Values, SelectList, TaskPriority, click the notepad on the left, edit to your hearts contempt.
So don't dive in the code or the only thing you will get is ... wet in dry land.
Enjoy your new DSDM system.
Pedro A.
I paid nothing for it :lol:
I tried editing the TaskPriority changing it to:
1|Must
0|Should
-1|Could
But this had no effect whatsoever. In the 1.x forum there was a message that it had to be changed here as well as in a couple of places in the source.
If you've managed to change it just using the TaskPriority, then there must be some other step I've missed out.
Cheers
Paul.
Hi again,
Sorry I just shoot my own foot, so besides that you should also, change:
lines 120, 121, 122 (and more if you like) of file modules/tasks/organize.php
lines 124, 125, 126 (and more if you like) of file modules/tasks/todo.php
lines 206, 208, 210 (and more if you like) of file modules/tasks/view.php
and last but not least
lines 21, 22, 23 (and more if you like) of file functions/tasks_func.php
By the way the code says that any task with priority > 0 is visually considered high <0 vis.considered low. Not that you asked, but I am on a chating mood.
Tested it myself, gonna revert though.
Pedro A.
Hi!
Is there a way to have priorities be like 1 to 10 instead of the current scenario?
Thanks!
Amit
The ...(and more if you like)... means whatever you like,
try
'-4' => '1'
'-3' => '2'
'-2' => '3'
'-1' => '4'
'0' => '5'
'1' => '6'
'2' => '7'
'3' => '8'
'4' => '9'
'5' => '10'
Maybe,
Pedro A.
As I am loathe to go changing code to achieve this (I don't want to do it on each upgrade), I thought I'd try the translations (localizations) approach. So, in system admin translations I switched to the Tasks and modified normal, high and low to be should, must and could. But it made no difference whatever.
Are the task priorities hardcoded in the UI? Tasks/view.php seems to be calling $AppUI, and arraySelect is being called with Translate=true. So I must be missing something about how the translations admin works. Anyone help?
Thanks
Paul.
Hi Pedroa!
Changing things as you say, wouldn't need any other change?
And where do I need to make these changes? In locales?
Thanks!
Regards,
Amit K
Hi again,
Sorry not to post sonner but I've been in a out of tech. vacation in Brazil and I am getting used to this new interface.
Paulhh:
Files modules/tasks/organize.php, modules/tasks/todo.php functions/tasks_func.php and modules/tasks/view.php are all served by the translation mechanism, file modules/tasks/tasksperuser_sub.php gets the priority names from the System Lookup Values on System Admin (table sysvals).
They should be equally defined on the lines and places I refered earlier.
tasks/view.php is only about viewing the task and not about everything else (like editing, organizing, viewing by user, and so on...). I myself am using a Portuguese translation of dP and it is using my translated text instead of the english one so the whole translation mechanism is working ok. If you see arraySelect function it gets pass
the AppUI too so it should work. Watch the lines I spoke before because they define the $priority array (it defines each translation value and it is case sensitive).
Amitk:
If you saw a post of mine before I told you what lines you should change in order to change things in the core:
Change those 4 files, change the System Lookup Values for the TaskPriority, eventually change the translation to your taste (language).
Locales are for translation only, and nothing but that, logic is within the files I spoke of.
So if you add a priority level, for example "Extremely High"
Change the 4 lines in those 4 files (follow the logic there), add the new priority to the System Lookup Values too, add the "Extremely High", expression to the locales/en/tasks.inc (this is the file used to link the translated text, follow the file logic), and when you change to your locale translation you will be able to translate the Extremely High expression to your country's text ("Muito Alta", "Mui Alta", etc).
Pedro A.
Hi Pedroa!
Thanks a ton! It seems it will work for sure. Let me try it as soon I get back and then I will tell you how it works! Thanks again for enlightening me!
Regards,
Amit K
beach_defender
23-06-05, 11:26 PM
Hi,
I'm working with a customer that requires a customised set of TaskPriorities.
I not at all keen to have to edit add hardwired priorities into the code.
It would seem to me that we should be able to use something along the lines of:
$priorities = dPgetSysVal('TaskPriority');
and instead of
<?php
if ($obj->task_priority == 0) {
echo $AppUI->_('normal');
} else if ($obj->task_priority < 0){
echo $AppUI->_('low');
} else {
echo $AppUI->_('high');
}
?>
have some form of lookup function to display the correct TaskPriority for each task.
I am currently working on the code and any advice would be greatly accepted.
I'll post any mods for your verdict.
Barry
That is a nice idea.
If you know how array_keys and array_values works, with the info you have here I think you can manage it.
Pedro A.
beach_defender
24-06-05, 12:04 AM
This works for me:
Replace the hardcoded arrays with :
$priority=dPgetSysVal('TaskPriority');
in the files that use the selectArray
and then I added the following to View.php
function displayTaskPriority($obj)
{
$priorities=dPgetSysVal('TaskPriority');
return $priorities[$obj->task_priority];
}
And then ...
<?php
// if ($obj->task_priority == 0) {
// echo $AppUI->_('normal');
// } else if ($obj->task_priority < 0){
// echo $AppUI->_('low');
// } else {
// echo $AppUI->_('high');
// }
echo $AppUI->_(displayTaskPriority($obj));
?>
on lines whatever.
What do you think?
The code is ok, $obj->task_priority helds the key.
Why do you need a function and in what file are you digging? Are you extending the CTask class? if so you should make $priorities a global and then displayTaskPriority would be a method like:
Before class definition
$priorities=dPgetSysVal('TaskPriority');
and after the class definition, its properties and its constructor:
function displayTaskPriority()
{
return $priorities[$this->task_priority];
}
It's just another idea, ok? take it as you will.
Caution, I didn't tested this.
There are 4 files affected by task priorities so beware of that.
You are going in the right way, by the way...
Pedro A.
beach_defender
24-06-05, 12:43 AM
hi again,
I agree that extending the class is a preferrable way to go.
I was just playing with the code tonight.
I'm a big fan of Smarty and would like to extend the class(es) to do something like
function getDisplayAttribute($attributeNameList=null)
such that $obj->getDisplayAttributes($attributeNameList)
when null => return associative array of Task attributes and then
$page = new Smarty();
$page->assign('Task',$obj->getDisplayAttributes());
$page->display($templatefile);
The way I told you, you would call the function exactly this way:
$obj->getDisplayAttributes()
I think you allready have figured it out.
The Smarty will have to wait thought.
Pedro A.
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.