|
Cookbook /
FoxSimpleTodoListSummary: An example of how to use Fox to setup a simple 'todo list'.
Version: 2007-04-03a
Prerequisites: Fox
Status: Functional
Maintainer:
Questions answered by this recipeHow do I use Fox to setup a simple no frills "todo" style list? As presented this recipe should leave you ending up with a todo list looking something like this:
Something like this anyway; It is a bulleted list with the description left aligned and the time/author/delete/etc rfloat aligned; Regardless, you can set it up to appear as you wish. Description(:An example of how to use Fox to setup a simple todo list.:) You can use the excellent Fox form processor to setup a very simple but functional todo list with (optional) author recognition. Note that the author recognition is totally optional and as presented requires the following in your config in someplace: # add conditional markup: (:if authorid AUTHID:) $Conditions['authorid'] = "\$GLOBALS['AuthId']==\$condparm"; All this does is add a new conditional that allows you to compare the currently logged in user's Fox allows many options on the placement of the added items, however for my uses I chose to place them on the same page as my input form both for ease of use and simplicity. To do this we place the input form on the page you wish the todo list to be present on; Feel free to place this on any page, as long as you have edit rights, it does not matter which. On the page of your choice add your form:
(:if auth edit:)
(:fox messageform template=Main.ToDoListEntryTemplate:)
(:input hidden postnr value='{{*$FullName}$FoxCountInc}':)
(:input hidden author value="{$AuthId}":)
(:table align=center:)
(:cell:)Description: (:input text description size=60:) (:input submit post Add:)
(:tableend:)
(:foxend messageform:)
(:ifend:)
An then add Note, as presented the form will only show if the viewer has edit rights. As presented we tell Fox to use a template page, Main.ToDoListEntryTemplate. The contents of this page are as follows:
#foxbegin#
*%rfloat%[-{$$(date Y.m.d - H:i)}-] — '''#{$$postnr}''' — {$$author}(:foxcount:)
(:if expr ( auth admin ) OR ( authorid {$$author} ) :) — {[foxdelrange]}(:if:)%%{$$description}
#foxend#
This is the format of each todo entry as they are entered into the page by Fox. This means that if you change this later the older entries will not reflect the change, however all subsequently added entries will. As an example:On my main index page:
!TODO
(:foxappend messageform:)
(:if auth edit:)
(:fox messageform template=Main.ToDoListEntryTemplate:)
(:input hidden postnr value='{{*$FullName}$FoxCountInc}':)
(:input hidden author value="{$AuthId}":)
(:table align=center:)
(:cell:)Description: (:input text description size=60:)(:input submit post Add:)
(:tableend:)
(:foxend messageform:)
>>>right<<<
[--[[Main.ToDoListEntryTemplate]]--]
>>><<<
(:ifend:)
The template: (Main.ToDoListEntryTemplate)
#foxbegin#
*%rfloat%[-{$$(date Y.m.d - H:i)}-] — '''#{$$postnr}''' — {$$author}(:foxcount:)
(:if expr ( auth admin ) OR ( authorid {$$author} ) :) — {[foxdelrange]}(:if:)%%{$$description}
#foxend#
Example: (on one line)
An alternative template:
#foxbegin#
(:table width=100% border=1:)
(:cell class=messageitem align=left:){$$description}
(:cell width=160px class=messagehead align=right:)
[-{$$(date Y.m.d - H:i)}-] {$$author} - (:foxcount:)
(:if expr ( auth admin ) OR ( authorid $author ) :){[foxdelrange]} - (:if:)'''#{$$postnr}'''
(:tableend:)
#foxend#
Example:
Note that the comment: Fox will use all of the template. The markers are used by Fox to create range identities on the target page, which in turn are used by Fox's range delete, so the delete action knows what to delete, i.e. a specific range. - HansB
NotesRelease Notes
CommentsSee AlsoContributors
|