ToDo-03

  • This recipe was last tested on PmWiki version: 2.0.beta26
  • This recipe requires at least PmWiki version: 2.0.beta26

Question

How can I manage a list of to do items?

Answer

The todo.phpΔ plugin (last update: 2005-09-28, version 0.3.6) will enable the management of to do items. WARNING: Do not use version 0.3.1, it contains a nasty bug that will continually overwrite your first to do item. This problem has been fixed since version 0.3.2.

Notes and Comments

  • This plugin has now been deprecated and replaced by a later version.
  • To enable this plugin, place todo.php in the cookbook directory and add the following line to the local configuration script local/config.php:
        include_once('cookbook/todo.php');
  • To do item categories can be customized by setting the variable $todo_category_names in the local configuration script like this:
        $todo_category_names = array('Personal', 'Business', 'Other');
  • To add the to do entry form to an existing page use the following markup:
        (:todoform:)
  • To add the list of existing to do items to an existing page use the following markup:
        (:todolist category=Other status=Open:)
  • You can also use the alternate, simple view of the same list:
        (:todosimplelist:)

See Also

  • PITS and WikiForms for alternative defect or feature tracking systems.
  • Simple Skin? for a cool skin that I created for PmWiki

Contributors

To Do

  • Add sorting functions. Done, thanks to DidierLebrun.
  • Add selective listing based on other criteria (in addition to status and category).
  • Add the ability to edit existing entries using a form.
  • Use groups other than the fixed TODO group. This is now customizable, although still not based on the containing page's group.

Comments

  • Looks good! It would be great if the script would use the group of the document instead of the fixed TODO group, so you could have TO DO lists for every group. -Uli
  • Good suggestion, Uli, I will add that in my list of to dos... :-) -Julian I. Kamil
  • Excellent ! I was just thinking of doing that sort of plugin when I found it in the cookbook. So I did a bit of your TODO list instead of reinventing the wheel ;) My modified version is here: todo-0.21.phpΔ
    1. Fix URLs in ToDoList()
    2. Sort on any field
    3. Allow any group name (defined in local/config.php)
    4. Allow customized options lists (defined in local/config.php)
    5. Allow custom libels (defined in local/config.php) -DidierLebrun
  • I was not aware of Pm's PITS script when I did this quick hack on your todo.php script. PITS.php code is compact and could be an interesting base too. Maybe, we could merge your approach of the problem with Pm's one in order to make something more generic than PITS, suitable to meet the needs of most kinds of ToDo lists, including issues tracking systems,... and PITS of course ? I actually need that sort of feature for a PmWiki site I'm developping, so I have put it in my todo list with a high priority ;) -DidierLebrun
  • Thanks, Didier... I will merge your changes with mine (done in version 0.3.1) for the next version that I've been working on, which adds simple list view and in-place update of to do status. It's not complete yet because I have been so busy lately with my day job... :-) Regarding PITS, I actually looked at the code and borrowed some ideas from it when creating my to do code. I've also been thinking along the same line as what you've described above, making the code more generic, use an alternative datastore (such as MySQL), and so on. It's a good road map for this plugin. -Julian I. Kamil
  • Hello, Julian... I tried your new version, and explored WikiForms too, and had a second look at PITS. In the end, my opinion was that simply de-specializing PITS code was the best chance to make quickly a fully configurable app that would meet my needs, including i18n. So I did. It took me only a few hours to do the main job, and a few more to solve some subtle problems that arised when trying it. It's become quite generic, and should meet most needs. You'll find this modified PITS in PITS page, where I put it. -DidierLebrun
  • Thanks for your pointers, Didier, I will give the modified PITS a try... -Julian I. Kamil

Hello, Julian! The script is good, but for i18n issues I had to change two parts of it: on lines 551 and 675 the regexp is like this:

 
 preg_match_all(
   //"/(^|\n)([A-Za-z][^:]*):([^\n]*)/", // OLD
   "/(^|\n)([^:]*?):([^\n]*)/", // NEW
   $page['text'],
   $match
  );

This is needed when a category or a description has a first letter in a letter other than A-Z. Also removed the style a{text-decoration:none;} because it changes the whole site. Greetings and thanks for the usefull script. Petko Yotov March 27, 2005, at 09:54 PM

Thanks, Petko, I will integrate your change (done in version 0.3.5) in the next version. I am glad you can benefit from this plugin! :-) -Julian I. Kamil


Hi, Julian. Thanks. When editing a todo, what is needed to make it display as a form? Also, clicking the checkbox on simple display does not change the underlying data, have I disconnected something?

<form method='post'><p><input type='hidden' name='action' value='completetodo' /> <input type='hidden' name='todo-complete-date' value='' /> </p><ul class='todo-simple-list'>

<li><input type='checkbox' name='complete[]' value='TODO.00002' />[3,4] Another thing! <a href='?n=TODO.00002&action=edit'>(edit)</a><input type='hidden' name='todo-original-status' value='Open'/></li> </ul> <p class='vspace'></p><p></form> </p></div>

Sorry, I don't have that feature implemented, yet, but it's been in my to do list for quite a while. I find that using documents for storing to do items is somewhat cumbersome. I want to replace the datastore with SQLite or MySQL, but I'm not sure if a lot of people will appreciate the requirement for a database backend--especially given that PmWiki strives to be very simple. I will need a bit of time to do this well, and perhaps even giving both document- and database-backed storage. -Julian I. Kamil


Hi Julian, Good script! I needed a column for names of the person the todo is assigned to, so I added that (if anyone interested, its todoa.phpΔ) but never quite got the hang of how to complete a todo. The only way I understood was to add a "Completed date:" on the todo page, but I see code for doing it via POST. Care to explain the various ways this is possible? /mac 2005-06-23

Mac, I haven't gotten a chance to finish the in-place editing feature, so as of now, the checkboxes function only as a display and you need to manually add the completed date field to "complete" a to do item. One of these days, I'll get to finish it up... :-) -Julian I. Kamil


Hi Julian and Mac, great script! Thank you for it - found and fixed some little bugs in todoa.php and in todo.php concerning translations and "create date"(if anyone interested, its todoto.phpΔ)- Lots of fun - Peter Waldhaeuser 2006-06-30

Peter, thanks! I'll incorporate your changes in the next revision of the code. -Julian I. Kamil

---

Hi, I included a feature which gives the option to send an email as reminder to each new todo tag. Comes in very handy for us. Can you include it or use my changes? Just send me a note. Cheers Blazej Floch

Category: Functional Extension