[TodoListApp]
[email protected] (simon)
| Newsgroups | gmane.comp.web.zope.zwiki |
|---|---|
| Message-ID | <20080502143217-0700__47348.918594844$1209770488$gmane$org@zwiki.org> |
A little demo app for tralala. This allows you to add items to a todo list, lists the pending items, and makes it easy to mark items done. It uses one dtml page for display and logic and one plaintext page for storage. Save in DTMLCookbook.
<!-- add form and handler -->
<form action="&dtml-pageUrl;">Add a request: <input name="text"></form>
<dtml-if "REQUEST.form.get('text')"><dtml-call "TodoListAppItems.append(REQUEST.form.get('text'), separator='\n')"></dtml-if>
<!-- pending list/mark done form and handler. Handle form before showing list. -->
<dtml-if "REQUEST.form.get('done')">
<dtml-in "REQUEST.form.get('done')" prefix=d>
<dtml-call "TodoListAppItems.edit(text=TodoListAppItems.text().replace('\n'+d_item, '\n'+d_item+' - done'))">
</dtml-in>
</dtml-if>
Pending <a href="TodoListAppItems">items</a>:
<form action="&dtml-pageUrl;">
<dtml-in "[r for r in TodoListAppItems.text().strip().split('\n') if not r.endswith('done')]" prefix=r>
<input type="checkbox" name="done:list" value="&dtml-r_item;"> &dtml-r_item; <br>
</dtml-in>
<input type="submit" value="mark done">
</form>
--
forwarded from http://zwiki.org/TodoListApp#[email protected]