VerySimpleToDo

Summary: A very simple ToDo list
Version:
Prerequisites:
Status:
Maintainer:
Categories: PIM
Users: (View? / Edit)

Question

How do I manage a list of todo items?

Answer

Install the verysimpletodo.phpΔ plugin (see also lesssimpletodo.phpΔ version for extra features - some notes at bottom).

Notes and Comments

Installation

  • Save verysimpletodo.php in your cookbook directory
  • Add the following to your local/config.php:
        // Very simple todo lists
        //$TodoDeleteText = "delete";
        //$TodoAddText = "New item:";
        include_once("$FarmD/cookbook/verysimpletodo.php");
  • $TodoDeleteText is the string used as the text of the delete link.
  • $TodoAddText is the label placed in front of the input box for new items.

Usage

This recipe works by creating input forms that know how to modify the content of the current page by adding or removing a single item. Multiple forms on a single page are supported by identifying each form with a unique name

	(:todo-add-<uniquename> <above|below> <symbol>:)

When items are added to the page, they are either added above or below the form and are prefixed with the symbols given in the last argument. For example:

	(:todo-add-list1 above *:)

creates an input form that adds new lines above it prefixed with *, creating a bulleted list entry form. The <uniquename> can only contain letters and numbers.

This creates a numbered list form:

	(:todo-add-list1 above #:)

And this creates a heading list form:

	(:todo-add-list1 above !!:)

When an item is added using the form, markup is automatically added to the end of the item

	(:todo-delete-<id>:)

that is rendered as a delete link. When clicked, the link will remove the item from the page. The <id> is generated as an md5 hash of the line being added but can be anything as long as it is unique and contains only letters and numbers. This allows one to add the (:todo-delete-<id>:) markup to existing lines by hand if desired.

Styling

Additionally, you can style the components using the classes "todoform" for the input form and "tododelete" for the delete link. For example, this was used to render the list shown in the screenshot:

	.todoform {
		color: #999;
		font-size: 80%;
		margin: 0;
		padding: 0;
	}

	.todoform input {
		font-weight: normal;
		border: 0;
		border-bottom: 1px solid #eee;
		width: 400px;
	}

	a.tododelete {
		color: #999 !important;
		text-transform: lowercase;
		font-size: 70%;
		text-decoration: none !important;
	}

	a:hover.tododelete {
		color: #999 !important;
		text-transform: lowercase;
		font-size: 70%;
		text-decoration: underline !important;
	}

Tips

There is a side effect to how this recipe behaves that allowed me to play a bit. I edited the script so that between the todo and the delete there is a colon ":". Then, I put into the todo (where you would put * or #): ":" I then add the same code as is used for Cookbook to move the delete to the far right of the list. BenWilson February 07, 2006, at 08:50 AM

This recipe doesn't use the standard PmWiki edit sequence, and so the NotifyUpdate() function is never called. In other words, changes made through this recipe do not trigger notifications by notify.php Luigi from a Pm comment on the mailing lists - 05 September 2006

Versions

$Id: verysimpletodo.php,v 1.3 2005/09/21 21:19:01 John Exp $

  • This recipe was last tested on PmWiki version: Version 2.0.6 (16-Sep-2005)
  • This recipe requires at least PmWiki version: 2.0

Comments:

  • I was trying to get this to work on my wiki at pmwiki.tiltech.net and no new entries would appear. It turns out to have been a problem with my clean URLs setup. In the verysimpletodo.php file I added the following line:
    $ScriptUrl2 = $ScriptUrl + '/pmwiki.php'; eg "http://www.tiltech.net/pmwiki"
    and changed the two references to $ScriptUrl to $ScriptUrl2 in the first markup section. Now it works well.
  • I'm not sure why there's a -&gt; at the beginning of (:todo-...:)'s replacement string; looking at the screenshot I presume it should be simply ->? ~Mateusz
  • It would be great if there were two options at the end of each task item. One to delete, which works as it current does; the other to Complete, which would change the text in some way (strikethrough would be great), and possibly move it to the bottom of the task list. This way the list can show not only what you are working on, but what has been accomplished. Important in a team environment where this list may be the only way task completion is being communicated.
  • September 26, 2008
    I installed the lesssimpletodo recipe today and it works perfectly for my purposes. The verysimpletodo recipe worked great but I like the extra functionality that the less simple version provides. Thank you for this wonderful recipe. Ian MacGregor

Script update: [27.09.2006]

  • I've made a few additions to the original script based around the notes above. This lesssimpletodo.phpΔ modified version adds a 'done'|'undo' option at the end of the entry which will strikethrough/unstrikethrough the entry. I've also added a 'Clean List' button on the end of the 'New Item' line that will remove all 'done' items. The look of the extras are all managed by extra css entries as described in the file.
  • Wow! How lucky am I that just today I decided to look to see if you had updated the script. Once thing you might want to change in the script itself is your include line to be for lesssimpletodo.php, instead of verysimpletodo.php.

I'm trying it out now and running into an error. The software works, but the error is annoying:

 Warning: Cannot modify header information - headers already sent by (output started at 
 C:\Program Files\xampplite\htdocs\wiki\cookbook\lesssimpletodo.php:275) in C:\Program 
 Files\xampplite\htdocs\wiki\pmwiki.php on line 870

This error appears at the top of every wiki page right now, and a similar issue, but related to lines 874 and 875 appears each time I add, delete, done, or undo a task item. It just flashes on the screen just briefly before loading the page. I'm using the Simple skin, if that matters.

Script update: [17.10.2006]

  • Uploaded a new version of lesssimpletodo.phpΔ with fix to the include line as mentioned above. As regards the error, obviously I'm not seeing that. I'm running pmwiki 2.1.26 if that is anything to do with it. I suppose it might depend on where you are trying to put the include list, is it outside the main document area?
  • I've got the same problem, same warning. A solution is to ensure that lesssimpeltodo.php has got only ONE blank line at the end. After deleting two lines at zhe end, the warning disapeared.
  • The extra blank line at the end of lesssimpletodo.php breaks all rss feeds, so be sure to remove it!

Can you update this to work with the 2.2.0-beta versions of PmWiki and, specifically, with the relative page links for included pages? The issue is that when the todo list is included in a separate "including" page the delete link no longer works: it expects to find the todo item in the current "including" page.

Pico October 09, 2007, at 09:56 AM

what WOULD be involved in getting this to work on included pages? OtherMichael Aug 25, 2008
is it possible to style the todo items and not just the form? McBainUK? Aug 25, 2008

See Also

  • Another to-do list implementation: ToDo
  • Flipbox -- Flippable checkboxes and checklists

Contributors

Original author: JohnWatson