TodoApplication Usage

To Add the todo application to any topic, you can use the following TML:

  • %INCLUDE{"System.TodoApplication"}%

todo items can be filtered by category - to set this, change the INCLUDE to

  • %INCLUDE{"System.TodoApplication" CATEGORY="finance"}%

to display todo Items from all categories:

  • %INCLUDE{"System.TodoApplication" CATEGORY="*"}%

urlparams

  • ?category - same as CATEGORY filter above
  • ?state= - filter based on state
  • ?item=FoswikiApplicationData.TodoApplication123 - edit this item inline in the table.

Application definition

TODO's

State Message Date

*
*


view item format

%STARTSECTION{"view_item"}%|\
    %FORMFIELD{"State" topic="%ITEM%"}%    |%FORMFIELD{"Message" topic="%ITEM%"}%    | \
    %FORMFIELD{"Date" topic="%ITEM%"}%    | \
     [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?item=%ITEM%;state=%URLPARAM{"state" default="*"}%][%ICON{uweb-bo}%]]  |%ENDSECTION{"view_item"}%

edit item format

%STARTSECTION{"edit_item"}%| %STARTFORM{
    name="%TOPIC%%BASETOPIC%%CATEGORY%"
    action="save"
    topic="%IF{"defined 'ITEM'" then="%ITEM%" else="FoswikiApplicationData.%TOPIC%AUTOINC0000"}%"
    method="POST"
    redirectto="%BASEWEB%.%BASETOPIC%"
    sep=" "
    showerrors="off"
}% %FORMELEMENT{
    name="State"
    format="<span class='formValue'>  $e $m $h </span>%BR%"
    default="%FORMFIELD{"State" topic="%ITEM%" alttext="new"}%"
    type="select"
    options="new, inprogress, waiting, done"
    title="State"
    size="1"
}% | %FORMELEMENT{
    name="Message"
    mandatory="on"
    format="<span class='formValue'>  $e $m $h </span>%BR%"
    default="%FORMFIELD{"Message" topic="%ITEM%" alttext=""}%"
    type="text"
    title="Message"
    size="70"
}% %FORMERROR{"%TOPIC%%BASETOPIC%%CATEGORY%"}% | %FORMELEMENT{
    name="Date"
    mandatory="on"
    format="<span class='formValue'>  $e $m $h </span>"
    default="%FORMFIELD{"Date" topic="%ITEM%" alttext="%DISPLAYTIME{"$day $month $year"}%"}%"
    type="date"
    dateformat="%e %b %Y"
    title="Date"
    size="8"
}% \
%FORMELEMENT{type="hidden" name="Show" default="%FORMFIELD{"Show" topic="%ITEM%" alttext="show"}%"}% \
%FORMELEMENT{type="hidden" name="Category" default="%FORMFIELD{"Category" topic="%ITEM%" alttext="%CATEGORY%"}%"}% \
%FORMELEMENT{type="hidden" name="formtemplate" default="%WEB%.%TOPIC%"}% \
%FORMELEMENT{type="hidden" name="topicparent" default="%BASEWEB%.%BASETOPIC%"}% \
%FORMELEMENT{type="hidden" name="%IF{"defined 'ITEM'" then="item" else="nothingtoseehere"}%" default="%ITEM%"}% \
 | %FORMELEMENT{
    name="%TOPIC%%BASETOPIC%%CATEGORY%_submit"
    type="submit"
    buttonlabel="Submit"
}% %IF{"defined 'ITEM'" then="<a class='foswikiButton foswikiCancelButton' href='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%'>Cancel</a>" else=""}% %ENDFORM% |%ENDSECTION{"edit_item"}%


widget-todo

Side bar widget for WidgetsSkin
  • EDIT="WEB.EditTopic" - set to the topic that the users to to manipulate these news Items, defaults to the System web's ToDoApplication? (which will lose STOREIN and CATEGORY defaults)
  • LIMIT="2" to show that number of the latest news.
%STARTSECTION{"widget-todo"}%<div class="widget-archives widget todo">
%IF{"
    (NOT context authenticated) OR
    (NOT '%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%.NoTopicWithThisName' allows 'CHANGE') OR
    ((istopic '%USERSWEB%.%TOPIC%Group') AND (NOT '%WIKINAME%' ingroup '%TOPIC%Group'))
   " 
   then="" 
   else="<div class='todoApplicationEditLink foswikiRight'>[[%IF{"defined EDIT" then="%EDIT%" else="%WEB%.%TOPIC%"}%][manage]]</div>"
}%   <h2 class="widget-header">Todo's</h2>
   <div class="widget-content">
<style>
.widget-todo-item .formInputField {
   width: 89%;
} 
</style>
%SEARCH{
    web="%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%"
    topic="%TOPIC%*"
    "form.name~'%WEB%.%TOPIC%' AND 
    fields[name='Category'].value ~ '%URLPARAM{"category" default="%CATEGORY%"}%' AND
    fields[name='State'].value ~ '%URLPARAM{"state" default="*"}%'
    "
    type="query"
    nonoise="on"
    order="formfield(Date)"
    limit="%IF{"defined LIMIT" then="%LIMIT%" else="2"}%"
    VIEWformat="<div class='widget-todo-item'>$formfield(Message) ... <span class='readMore'>[[$web.$topic][edit]]</span></div>"
    format="<div class='widget-todo-item' >$percntINCLUDE{$quot%WEB%.%TOPIC%$quot section=$quotwidget_add_item$quot ITEM=$quot$web.$topic$quot}$percnt</div>"
}%
%INCLUDE{
   "%WEB%.%TOPIC%"
   section="%IF{"defined 'item'" then="nothing" else="widget_add_item"}%"
   warn="off"
}%
  </div>
</div>%ENDSECTION{"widget-todo"}%

widget_add_item format

%STARTSECTION{"widget_add_item"}% %STARTFORM{
    name="%TOPIC%%BASETOPIC%%CATEGORY%%ITEM%"
    action="save"
    topic="%IF{"defined 'ITEM'" then="%ITEM%" else="FoswikiApplicationData.%TOPIC%AUTOINC0000"}%"
    method="POST"
    redirectto="%BASEWEB%.%BASETOPIC%"
    sep=" "
    showerrors="off"
}%  %FORMELEMENT{
    name="Message"
    mandatory="on"
    format="<span class='formValue %FORMFIELD{"State" topic="%ITEM%" alttext="new"}%State'>$e</span>"
    default="%FORMFIELD{"Message" topic="%ITEM%" alttext=""}%"
    type="text"
    title="Message"
    size="30"
}% %FORMELEMENT{type="hidden" name="State" default="%FORMFIELD{"State" topic="%ITEM%" alttext="new"}%"
}% %FORMELEMENT{type="hidden" name="Date" default="%FORMFIELD{"Date" topic="%ITEM%" alttext="%DISPLAYTIME{"$day $month $year"}%"}%"
}% %FORMELEMENT{type="hidden" name="Category" default="%FORMFIELD{"Category" topic="%ITEM%" alttext="%CATEGORY%"}%"
}% %FORMELEMENT{type="hidden" name="formtemplate" default="%WEB%.%TOPIC%"
}% %FORMELEMENT{type="hidden" name="topicparent" default="%BASEWEB%.%BASETOPIC%"
}% %FORMELEMENT{type="hidden" name="%IF{"defined 'ITEM'" then="item" else="nothingtoseehere"}%" default="%ITEM%"
}% %ENDFORM% %ENDSECTION{"widget_add_item"}%

DataForm? definition

Name Type Size Values Tooltip message Attributes
Date date 16   09 Sep 2010 m
Message text 64     m
State select 1 new, inprogress, waiting, done   m
Category text 64    

Defaults for this topic only

  • Set CATEGORY=*
Topic revision: r2 - 14 Feb 2009 - 05:10:17 - AdminUser
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Sven Dowideit's testing Foswiki? Send feedback