To Do List Project: Part 1

Today I worked out a lot of the JavaScript that might be needed to effect the screen changes I want to have happen as various buttons are pushed. A To Do item against which no time has been expended would look like this:

If the user clicks on the Start button the button is replaced by the current date and time and the End button is made visible in the right-hand cell. If the user also adds a note to the time slice information then the table would look like this:

Finally, if the user clicks on the End button then it should be replaced by the current time, the text input field should be removed and replaced with the raw text that had been entered there, and a new set of rows should be added like this:

If the user checks the Complete checkbox then the last time slice row should be completed if it had been started (as if the user had clicked on the End button) or erased entirely if it had not been started (as if the user had not clicked on the Start button). I haven’t implemented that yet.

All of this actually works in CloudNine but what’s missing is the mechanics of making the requisite database entries for the time slice information as things proceed. What really should happen is the event should be forwarded to the server, where some PHP code would attempt to write the time slice information to the MySQL database. If the operation is successful the local HTML should be updated and if it is not successful an error message should be displayed. Successful operations should also update the values of hours and minutes in the Elapsed Time fields, and that also has not yet been implemented.

The background operations are going to require some AJAX and server-side code, which I’ll look at tomorrow. In the meantime here’s the (ugly) code that performs the raw JavaScript operations. This will have to be changed when I get the whole chain of events put together. The main thing for now is that I’m getting a feel for interactively navigating and modifying the DOM in a way that my previous work hasn’t given me.

This entry was posted in Software and tagged , , . Bookmark the permalink.

Leave a Reply