|
Cookbook /
VerySimpleToDoQuestionHow do I manage a list of todo items? AnswerInstall the verysimpletodo.phpΔ plugin (see also lesssimpletodo.phpΔ version for extra features - some notes at bottom). ![]() Notes and CommentsInstallation
// Very simple todo lists
//$TodoDeleteText = "delete";
//$TodoAddText = "New item:";
include_once("
UsageThis 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. StylingAdditionally, 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;
}
TipsThere 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 $
Comments:
Script update: [27.09.2006]
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]
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 See AlsoAnother to-do list implementation: ToDo ContributorsOriginal author: JohnWatson |