Home
services
clients
about
case studies
careers
helpdesk
---++ %TOPIC% Usage To Add the news application to any topic, you can use the following TML: * =%<nop>INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%= News items can be filtered by category - to set this, change the INCLUDE to * =%<nop>INCLUDE{"%SYSTEMWEB%.%TOPIC%" CATEGORY="finance"}%= to display News Items from _all_ categories: * =%<nop>INCLUDE{"%SYSTEMWEB%.%TOPIC%" CATEGORY="*"}%= ---+++ urlparams * ?showfrom and ?showto - dates to filter output between * ?category - same as CATEGORY filter above * ?item=%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%.NewsApplication123 - edit this item inline in the table. ---+++ <nop>NewsApplicationGroup If you define the %USERSWEB%.NewsApplicationGroup group, they will be the only users that can add new news Items. ---++ Application definition %STARTINCLUDE% %CALC{"$SET(show_from_number, $MIN($TIMEADD($TIME($FORMATTIME($TIME(), $year-$month-1)),-1,month), $TIMEADD($TIME($FORMATTIME($TIME(%URLPARAM{showfrom}%), $year-$month-15)), 3, month)))"}% [[%BASEWEB%.%BASETOPIC%][Latest]] [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?showfrom=%CALC{"$FORMATTIME($GET(show_from_number), $year-$month-1)"}%;showto=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),1,month), $year-$month-1)"}%][%CALC{"$FORMATTIME($GET(show_from_number), $mon $year)"}%]] [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?showfrom=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-1,month), $year-$month-1)"}%;showto=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),0,month), $year-$month-1)"}%][%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-1,month), $mon $year)"}%]] [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?showfrom=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-2,month), $year-$month-1)"}%;showto=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-1,month), $year-$month-1)"}%][%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-2,month), $mon $year)"}%]] [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?showfrom=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-3,month), $year-$month-1)"}%;showto=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-2,month), $year-$month-1)"}%][%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-3,month), $mon $year)"}%]] [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?showfrom=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-4,month), $year-$month-1)"}%;showto=%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-3,month), $year-$month-1)"}%][%CALC{"$FORMATTIME($TIMEADD($GET(show_from_number),-4,month), $mon $year)"}%]] ---+ %IF{"defined HEADER" then="%HEADER%" else="Latest News"}% <style> .formPluginTitle { width:200px; } .formValue { position:absolute;left:220px; } </style> %TABLE{tablewidth="99%" columnwidths="16em,80%,6em" }% %SEARCH{ web="%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%" topic="%TOPIC%*" "form.name~'%WEB%.%TOPIC%' AND fields[name='Show'].value = 'show' AND fields[name='Category'].value ~ '%URLPARAM{"category" default="%CATEGORY%"}%' AND ( ( '%URLPARAM{"showfrom" default=""}%' = '' AND d2n(fields[name='Expiry'].value) >= d2n('%DATE%') ) OR ('%URLPARAM{"showfrom" default=""}%' != '' AND d2n(fields[name='Date'].value) >= d2n('%URLPARAM{"showfrom" default=""}%') AND d2n(fields[name='Date'].value) < d2n('%URLPARAM{"showto" default=""}%') ) )" type="query" nonoise="on" order="formfield(Date)" header="| *Date Posted* | *Message* | ** |" format="$percntINCLUDE{ $quot%WEB%.%TOPIC%$quot nosection=$quotview_item$quot ITEM=$quot$web.$topic$quot section=$quot$percntIF{$quot'$web.$topic' = $item$quot then=$quotedit_item$quot else=$quotview_item$quot}$percnt$quot }$percnt" }% %INCLUDE{ "%WEB%.%TOPIC%" warn="off" section="%IF{" (defined 'item') OR (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="nothing" else="edit_item"}%" }% %STOPINCLUDE% --- ---+++ view item format <verbatim> %STARTSECTION{"view_item"}%| \ %FORMFIELD{"Date" topic="%ITEM%"}% |\ %FORMFIELD{"Message" topic="%ITEM%"}% %FORMFIELD{"Link" topic="%ITEM%"}% | \ %INCLUDE{ "%WEB%.%TOPIC%" section="%IF{" '%ITEM%' allows 'CHANGE' AND context authenticated AND NOT ((istopic '%USERSWEB%.%TOPIC%Group') AND (NOT '%WIKINAME%' ingroup '%TOPIC%Group')) " then="edit_button" else="nothing"}%" warn="off" }% |%ENDSECTION{"view_item"}% </verbatim> ---+++ edit_button <verbatim> %STARTSECTION{"edit_button"}%[[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?item=%ITEM%;showfrom=%URLPARAM{"showfrom" default=""}%;showto=%URLPARAM{"showto" default=""}%][%ICON{uweb-bo}%]] [[%ITEM%][details]] %ENDSECTION{"edit_button"}% </verbatim> ---+++ edit item format <verbatim> %STARTSECTION{"edit_item"}%| %STARTFORM{ name="%TOPIC%%BASETOPIC%%CATEGORY%" action="save" topic="%IF{"defined 'ITEM'" then="%ITEM%" else="%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%.%TOPIC%AUTOINC0000"}%" method="POST" redirectto="%BASEWEB%.%BASETOPIC%" sep=" " showerrors="off" }% %IF{"defined 'ITEM'" then="Edit" else="New"}% Item | %FORMELEMENT{ mandatory="on" format="<span class='formTitle'> $t </span><span class='formValue'> $e $m $h </span>%BR%" default="%FORMFIELD{"Date" topic="%ITEM%" alttext="%DISPLAYTIME{"$day $month $year"}%"}%" type="date" dateformat="%e %b %Y" name="Date" title="Date Posted" size="16" }% %FORMELEMENT{ mandatory="on" format="<span class='formTitle'> $t </span><span class='formValue'> $e $m $h </span> %BR%" default="%FORMFIELD{"Expiry" topic="%ITEM%" alttext="%DISPLAYTIME{"$day $month $year"}%"}%" type="date" dateformat="%e %b %Y" name="Expiry" title="Expiry date" size="16" }% %FORMELEMENT{ mandatory="on" format="<span class='formTitle'> $t </span><span class='formValue'> $e $m $h </span>%BR%" default="%FORMFIELD{"Message" topic="%ITEM%" alttext=""}%" type="text" name="Message" title="Message" size="70" }% %FORMELEMENT{ format="<span class='formTitle'> $t </span><span class='formValue'> $e $m $h </span>%BR%" default="%FORMFIELD{"Link" topic="%ITEM%" alttext=""}%" type="text" name="Link" title="Link" size="70" }% \ %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%"}% \ %FORMERROR{"%TOPIC%%BASETOPIC%%CATEGORY%"}% | %FORMELEMENT{ type="submit" buttonlabel="Submit" }% \ %IF{"defined 'ITEM'" then="<a class='foswikiButton foswikiCancelButton' href='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%'>Cancel</a>" else=""}% \ %ENDFORM% |%ENDSECTION{"edit_item"}% </verbatim> ---+++ widget-news Side bar widget for <nop>WidgetsSkin * =EDIT="WEB.EditTopic"= - set to the topic that the users to to manipulate these news Items, defaults to the System web's NewsApplication (which will lose STOREIN and CATEGORY defaults) * =LIMIT="2"= to show that number of the latest news. <verbatim> %STARTSECTION{"widget-news"}%<div class="widget-archives widget %IF{"defined HEADER" then="%HEADER%" else="latnews"}% "> %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='newsApplicationEditLink'>[[%IF{"defined EDIT" then="%EDIT%" else="%WEB%.%TOPIC%"}%][edit]]</div>" }% <h2 class="widget-header">%IF{"defined HEADER" then="%HEADER%" else="Latest News"}%</h2> <div class="widget-content"> %SEARCH{ web="%IF{"defined STOREIN" then="%STOREIN%" else="FoswikiApplicationData"}%" topic="%TOPIC%*" "form.name~'%WEB%.%TOPIC%' AND fields[name='Show'].value = 'show' AND fields[name='Category'].value ~ '%URLPARAM{"category" default="%CATEGORY%"}%' AND ( d2n(fields[name='Expiry'].value) >= d2n('%DATE%') ) " type="query" nonoise="on" order="formfield(Date)" limit="%IF{"defined LIMIT" then="%LIMIT%" else="2"}%" format="<div class='widget-news-item'>$formfield(Message) ... <div class='readMore'>[[$web.$topic][read more]]</div></div>" }% </div> </div>%ENDSECTION{"widget-news"}% </verbatim> ---+++ DataForm definition | *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* | | Date | date | 16 | | %DATE% | m | | Message | text | 64 | | | m | | Link | text | 64 | | blah blah... | | | Show | checkbox | 1 | show | | | | Expiry | date | 16 | | %CALC{"$FORMATTIME($TIMEADD($TIME(), 1, month), $day $mon $year)"}% | m | | Category | text | 64 | | || ---+++ Defaults for this topic only * Set CATEGORY=* * Set TINYMCEPLUGIN_DISABLE=1
Latest News
Testimonials
Client Login
contact
phone
+61 (2) 90116967
office
Suite 2019,
Level 20 Darling Park,
201 Sussex Street Sydney,
NSW 2000
post
GPO Box 695
Potts Point, NSW 1335
email
info@blackfin.com.au
web
www.blackfin.com.au