• Status Closed
  • Percent Complete
  • Task Type TODO
  • Category Backend/Core
  • Assigned To
  • Operating System All
  • Severity Medium
  • Priority Very Low
  • Reported Version 0.9.8-devel
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Flyspray
Opened by eelco - 30.03.2005
Last edited by MadCoder - 09.11.2005

FS#503 - Rewrite the code using functions instead of if-elseif-else

There's a good reason structured programming was invented. I would like to see the code being rewritten using functions instead of big if-elseif-else.

The pros: the code will be cleaner and more clear, calling the functions can be done with a switch and permission can be handled cascadingly at the start of the file. You will be able to do more than one thing in a call (I ran into this when I tried making a checkbox next to the assigned field that would add the assignee to the notifications list). I'm willing to help.

The cons: it's a hell of a job, and it's not very necessary.

The task blocks this from closing
ID Project Summary Priority Severity Assigned To Progress
601 Flyspray  FS#601 - Templating backend  Low Low MadCoder
Closed by  Anonymous Submitter
07.01.2006 20:13
Reason for closing:  Complete
Additional comments about closing:  

Pierre has 'refactored' the code. Much of it has been moved into classes, and the rest of it cleaned up.

Anonymous Submitter commented on 31.03.2005 09:01

I wholeheartedly agree that the current use of if/elseif statements is a bit antiquated and messy, and I would happily have it rewritten in the way you suggest.

As for the checkbox for adding the assignee to the notification list - totally not necessary, as the notification code automagically includes the assignee in any notifications about the task.

Anonymous Submitter commented on 31.03.2005 09:47

If you would like to do this task, I suggest starting on the file that was giving you trouble - scripts/details.php. I would like to hear how you plan on tackling this file. Perhaps if you posted to the mailing list, everyone who _isn’t_ watching this task could also read and perhaps provide feedback on your proposal...

eelco commented on 31.03.2005 12:53

Ah, I was unaware of that. Maybe then I should file a bug to make that behaviour more clear :) Maybe the assignee can be shown on the notifications list but without the ability to remove him/her? I’ve now been adding assignees to the notification lists manualy (and superflously apparently ;)

As for the rewrite: will do that.

Anonymous Submitter commented on 31.03.2005 22:42

I would like to hear more about how you plan to change the code before you go ahead and do it.

eelco commented on 01.04.2005 15:10

Sorry, that’s what I meant with ‘will do that’, I will post to the mailinglist first.

this is totally unneeded IMHO.

I’ve already rewrited most of the pages to be like that :

if (error) {

 // eventually some treatement
 $fs->redirect(...) // does an exit


// code for the page

there is no more if/then/else for most of the reasonable (meaning not details / modify e.g.) pages. and modify/details will have their own special treatement during templating.

all in functions is harmfull. pages are in themselves already “functions”. So my guess is, let’s templatize, and we will see if such a rewrite is needed. my guess is, it won’t


Available keyboard shortcuts


Task Details

Task Editing