<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}
	
.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
<<importTiddlers>>
Just to document the breeding dates for StoneFace Farm goats for the year 2012 and their respective due dates for 2013

!2012 herd breeding/due dates
|Name|Date Bred|Due Date|
|Connie|11/14/2012|4/13/2013|
|~JuneCarter|11/16/2012|4/15/2013|
|Loretta|11/25/2012|4/24/2013|
|Dolly|12/10/2012|5/9/2013|
|Skeeter D|12/10/2012|5/9/2013|
The guest goat was taken back on the 26. Her name, it turns out was Dolly. The Vet. (Milo) said he would let me know when the kids are born. Their family has no interest in keeping the kids they just need the mother's milk for their bum lambs.

Yesterday, I tried putting Rascal in with the girls. Abby is in heat and Rosie just finished. They both pushed him around and head butted him. harassed him all day and I ended up putting him back in his own shelter for the night. He is one tough little guy. He kept going back at them like he knows is his job. I think towards the end of the day he learned to back off and walk away when he saw they were just going to butt him again. I may try putting him in the pen again this morning. Not sure.

I have a loose schedule of how to dry off the girls, I need to have them done with milking by the end of January, so I start every other day on the 5th, every third day on the 19th and quit on the 31st.

it has been snowing here since Christmas day. the snow came down for 2 days just soft and easy. No wind to blow and drift it. I remember snow like this from childhood. Now the wind has picked up just a bit I'm sure it will drift and I don't have the tractor started to plow the driveway with. Snow shovel anyone?
Finished drying off the goats on  Jan 31, probably using the last of the milk today. I will miss this. I have to build a new hay feeder for the big boys. they destroyed their feeder by standing on it.

Loretta and Skeeter both have abcesses now and I need to get them both into the vet to have those removed. need to get the "kits" ready for kidding season, repair the greenhouse..... the list is long and I can't think right now.

I must plan the garden if I am going to have one at all this year. make a list of what, plot out where and when. Find a better spot for the compost and finish cleaning the whole area.

so many interrelated tasks that they all become tangled in my mind and some days I don't remember where I was or know where to start. It can be enough to make me give up and try again the next day.

I just completed the usda agricultural survey for 2013 and in doing so  had to figure all of the costs associated with this "hobby" farm. I spent a lot on feed, veterinarian and maintenence. Somehow I have to make this profitable. or at least less costly.
This notebook attempts to capture the essence of a [["kinkless" GTD system|http://www.kinkless.com]] using TiddlyWiki. It is using the <<gtdVersion>> version of the GTD plugins, by Tom Otvos, and is based on version <<version>> of the [[TiddlyWiki|http://www.tiddlywiki.com]] stand-alone wiki project, by Jeremy Ruston. For customization info, see [[GTD TiddlyWiki|http://groups.google.com/group/GTD-TiddlyWiki]] and [[TiddlyWikiDev|http://www.tiddlywiki.com/dev/]].
!Welcome to version 1.3.0 of d-cubed

This is a minor update to the previous 1.2 release of d-cubed, providing compatibility with the latest (2.4.1 as of this writing) version of TiddlyWiki. This release does not introduce any new features beyond the greatly expanded capabilities of TiddlyWiki itself. It does fix several minor bugs, including:
* fix if two contexts are open, and action in first context is complete, then other context will not show next action correctly
* no longer rely on NewerTiddlerPlugin in GTDMenu, avoiding compatibility bugs
* removed obsolete plugins, including TWUpdate and NewerTiddlerPlugin
* updated GTDMenu to include sliders for "reference" and "someday" tiddlers
''Important note to upgraders:'' Because of the changes to TiddlyWiki, it is not possible to upgrade to this new version from version 1.2 using the normal UpdateApplication you are familiar with. Indeed, the only way to get this new version is to start with an empty d-cubed document, and import your projects, actions, and contexts from your existing d-cubed document. If you are reading this tiddler, you have taken the first step! For the full upgrade procedure, please read [[Upgrading from version 1.2]].

----
If you are a regular user of d-cubed and would like contribute in some way, there is now a "tip jar" available. Just click on the button below:

<html>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYArqELycEhlEeU4Ikv7/arlOM92IKDYe4nhYuHcGQlAg7wtuL0XiBzeUog47f9Bh6mOch2fYU739g1LRdmPCGXFC+/FUhiHtC0WzzoM9Ze5brDxX55ZMRYcSW8r+F/+8f1fbjQLKQOweWzfB87c9atRjhIivYizx582Z10qJEN3uDELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIWXCtKBKQVOqAgaApYeMrVxuoRQ/0OILmlaCiziXXCg0VMf39lT6qFy12dsom2u/b56rCay/s/vyWzdDZgpdV3wUqChgTrHIjaaJUIQ15ITyskbYDDWMMEwp5f5UEy6Y/fDtugF7sGknAvEL+G6QtQv8su4Nlqu1EWOptSlvuuPokBBwKM6J2elMzds4x1ug/9L7WAheCNKXP1bR+VOskaCKnT71m23cfyceHoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDcwMjEzMjIyODI4WjAjBgkqhkiG9w0BCQQxFgQUT2cBzuxL2aED6PhQaLoEbTd+PEYwDQYJKoZIhvcNAQEBBQAEgYAZfdUgTGt3yxXci0obaP0sP7CmwzdmlqYu92W24sITRc1j/+gNvyqLpCtRkRHFT0FFZqqukwopZPE4/VCM496TqcVaQMXZAi9jVyrniLA3BEKY8VCrLYqW3pnf87TLfLOe9Y65FlT3Sx4EKwLCNIhYwojgx6lZXo+TNVCWhMBmHQ==-----END PKCS7-----
">
</form>
</html>
No pressure, no obligation, but thank you if you do!

//This tiddler will only open automatically the first time you run d-cubed after an update. After that, you can freely delete it, or save it for future reference. If this is a new d-cubed document, it may not go away until after you edit DefaultTiddlers.//
! Next actions for active contexts
<<gtdActionList @>>
To make this system operate more efficiently, you should periodically archive completed projects and actions. When a project or action is archived, it is merely tagged in a special way to get it "out of sight", but all the information in the project and action tiddlers is preserved. This is important if you need to go back and find something. Click one of these buttons to view the current <<tag project-archive>> or <<tag action-archive>>.

** Click <<gtdArchive archive>> if you would like to archive all completed projects and actions now.
** Click <<gtdArchive unarchive>> if you would like to unarchive all previously archived projects and actions now.

If you are sure that you do not want to retain archived projects and actions, you can purge them completely from the system. //Once these archived items are removed, the only way they can be put back in is through manual importing or copy/paste.// ''For your safety, your file will be saved and a backup file will be automatically generated before an archive purge is performed.''

** Click <<gtdArchive purge>> if you would like to purge your archive now.
The outcome for this project is to have a useable building
<<gtdAction "clean out the building" "unfiled">>
<<gtdAction "replace the roof" "unfiled">>
<<gtdAction "Replace the floor" "unfiled">>
<<gtdAction "Replace and add Windows and Doors" "unfiled">>
<<gtdAction "Excavate and (re) build foundation" "unfiled">>
<<gtdAction "Insulate and install siding" "unfiled">>
<<gtdAction "Install heating and Cooling" "unfiled">>
/***
|Name|CalendarPlugin|
|Source|http://www.TiddlyTools.com/#CalendarPlugin|
|Version|2008.06.17|
|Author|Eric Shulman|
|Original Author|SteveRumsby|
|License|unknown|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|display monthly and yearly calendars|

NOTE: For enhanced date display (including popups), you must also install [[DatePlugin]]
!!!!!Usage:
<<<
|{{{<<calendar>>}}}|Produce a full-year calendar for the current year|
|{{{<<calendar year>>}}}|Produce a full-year calendar for the given year|
|{{{<<calendar year month>>}}}|Produce a one-month calendar for the given month and year|
|{{{<<calendar thismonth>>}}}|Produce a one-month calendar for the current month|
|{{{<<calendar lastmonth>>}}}|Produce a one-month calendar for last month|
|{{{<<calendar nextmonth>>}}}|Produce a one-month calendar for next month|
<<<
!!!!!Configuration:
<<<
|''First day of week:''<br>{{{config.options.txtCalFirstDay}}}|<<option txtCalFirstDay>>|(Monday = 0, Sunday = 6)|
|''First day of weekend:''<br>{{{config.options.txtCalStartOfWeekend}}}|<<option txtCalStartOfWeekend>>|(Monday = 0, Sunday = 6)|

<<option chkDisplayWeekNumbers>> Display week numbers //(note: Monday will be used as the start of the week)//
|''Week number display format:''<br>{{{config.options.txtWeekNumberDisplayFormat }}}|<<option txtWeekNumberDisplayFormat >>|
|''Week number link format:''<br>{{{config.options.txtWeekNumberLinkFormat }}}|<<option txtWeekNumberLinkFormat >>|
<<<
!!!!!Revisions
<<<
2008.06.17: added support for config.macros.calendar.todaybg
2008.02.27: in handler(), DON'T set hard-coded default date format, so that *customized* value (pre-defined in config.macros.calendar.journalDateFmt is used.
2008.02.17: in createCalendarYear(), fix next/previous year calculation (use parseInt() to convert to numeric value).  Also, use journalDateFmt for date linking when NOT using [[DatePlugin]].
2008.02.16: in createCalendarDay(), week numbers now created as TiddlyLinks, allowing quick creation/navigation to 'weekly' journals (based on request from Kashgarinn)
2008.01.08: in createCalendarMonthHeader(), "month year" heading is now created as TiddlyLink, allowing quick creation/navigation to 'month-at-a-time' journals
2007.11.30: added "return false" to onclick handlers (prevent IE from opening blank pages)
2006.08.23: added handling for weeknumbers (code supplied by Martin Budden (see "wn**" comment marks).  Also, incorporated updated by Jeremy Sheeley to add caching for reminders (see [[ReminderMacros]], if installed)
2005.10.30: in config.macros.calendar.handler(), use "tbody" element for IE compatibility.  Also, fix year calculation for IE's getYear() function (which returns '2005' instead of '105'). Also, in createCalendarDays(), use showDate() function (see [[DatePlugin]], if installed) to render autostyled date with linked popup.  Updated calendar stylesheet definition: use .calendar class-specific selectors, add text centering and margin settings
2006.05.29: added journalDateFmt handling
<<<
***/
/***
!!!!!Code section:
***/
//{{{
version.extensions.calendar = { major: 0, minor: 7, revision: 0, date: new Date(2008, 6, 17)};

if(config.options.txtCalFirstDay == undefined)
  config.options.txtCalFirstDay = 0;
if(config.options.txtCalStartOfWeekend == undefined)
  config.options.txtCalStartOfWeekend = 5;
if(config.options.chkDisplayWeekNumbers == undefined)//wn**
  config.options.chkDisplayWeekNumbers = false;
if(config.options.chkDisplayWeekNumbers)
  config.options.txtCalFirstDay = 0;
if(config.options.txtWeekNumberDisplayFormat == undefined)//wn**
  config.options.txtWeekNumberDisplayFormat = "w0WW";
if(config.options.txtWeekNumberLinkFormat == undefined)//wn**
  config.options.txtWeekNumberLinkFormat = "YYYY-w0WW";

config.macros.calendar = {};
config.macros.calendar.monthnames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
config.macros.calendar.daynames = ["M", "T", "W", "T", "F", "S", "S"];
config.macros.calendar.todaybg = "#ccccff";
config.macros.calendar.weekendbg = "#c0c0c0";
config.macros.calendar.monthbg = "#e0e0e0";
config.macros.calendar.holidaybg = "#ffc0c0";
config.macros.calendar.journalDateFmt = "DD MMM YYYY";
config.macros.calendar.monthdays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
config.macros.calendar.holidays = [ ]; // Not sure this is required anymore - use reminders instead
//}}}
//{{{
function calendarIsHoliday(date) // Is the given date a holiday?
{
	var longHoliday = date.formatString("0DD/0MM/YYYY");
	var shortHoliday = date.formatString("0DD/0MM");
	for(var i = 0; i < config.macros.calendar.holidays.length; i++) {
		if(config.macros.calendar.holidays[i] == longHoliday || config.macros.calendar.holidays[i] == shortHoliday)
			return true;
	}
	return false;
}
//}}}
//{{{
config.macros.calendar.handler = function(place,macroName,params) {
	var calendar = createTiddlyElement(place, "table", null, "calendar", null);
	var tbody = createTiddlyElement(calendar, "tbody", null, null, null);
	var today = new Date();
	var year = today.getYear();
	if (year<1900) year+=1900;

 	// get format for journal link by reading from SideBarOptions (ELS 5/29/06 - based on suggestion by Martin Budden)
	var text = store.getTiddlerText("SideBarOptions");
	var re = new RegExp("<<(?:newJournal)([^>]*)>>","mg"); var fm = re.exec(text);
	if (fm && fm[1]!=null) { var pa=fm[1].readMacroParams(); if (pa[0]) this.journalDateFmt = pa[0]; }

	if (params[0] == "thismonth") {
		cacheReminders(new Date(year, today.getMonth(), 1, 0, 0), 31);
		createCalendarOneMonth(tbody, year, today.getMonth());
	} 
	else if (params[0] == "lastmonth") {
		var month = today.getMonth()-1; if (month==-1) { month=11; year--; }
		cacheReminders(new Date(year, month, 1, 0, 0), 31);
		createCalendarOneMonth(tbody, year, month);
	}
	else if (params[0] == "nextmonth") {
		var month = today.getMonth()+1; if (month>11) { month=0; year++; }
		cacheReminders(new Date(year, month, 1, 0, 0), 31);
		createCalendarOneMonth(tbody, year, month);
	} else {
		if (params[0]) year = params[0];
		if(params[1]) {
			cacheReminders(new Date(year, params[1]-1, 1, 0, 0), 31);
			createCalendarOneMonth(tbody, year, params[1]-1);
		} else {
			cacheReminders(new Date(year, 0, 1, 0, 0), 366);
			createCalendarYear(tbody, year);
		}
	}
	window.reminderCacheForCalendar = null;
}
//}}}
//{{{
//This global variable is used to store reminders that have been cached
//while the calendar is being rendered.  It will be renulled after the calendar is fully rendered.
window.reminderCacheForCalendar = null;
//}}}
//{{{
function cacheReminders(date, leadtime)
{
	if (window.findTiddlersWithReminders == null) return;
	window.reminderCacheForCalendar = {};
	var leadtimeHash = [];
	leadtimeHash [0] = 0;
	leadtimeHash [1] = leadtime;
	var t = findTiddlersWithReminders(date, leadtimeHash, null, 1);
	for(var i = 0; i < t.length; i++) {
		//just tag it in the cache, so that when we're drawing days, we can bold this one.
		window.reminderCacheForCalendar[t[i]["matchedDate"]] = "reminder:" + t[i]["params"]["title"]; 
	}
}
//}}}
//{{{
function createCalendarOneMonth(calendar, year, mon)
{
	var row = createTiddlyElement(calendar, "tr", null, null, null);
	createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, true, year, mon);
	row = createTiddlyElement(calendar, "tr", null, null, null);
	createCalendarDayHeader(row, 1);
	createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}
//{{{
function createCalendarMonth(calendar, year, mon)
{
	var row = createTiddlyElement(calendar, "tr", null, null, null);
	createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, false, year, mon);
	row = createTiddlyElement(calendar, "tr", null, null, null);
	createCalendarDayHeader(row, 1);
	createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}
//{{{
function createCalendarYear(calendar, year)
{
	var row;
	row = createTiddlyElement(calendar, "tr", null, null, null);
	var back = createTiddlyElement(row, "td", null, null, null);
	var backHandler = function() {
		removeChildren(calendar);
		createCalendarYear(calendar, parseInt(year)-1);
		return false; // consume click
	};
	createTiddlyButton(back, "<", "Previous year", backHandler);
	back.align = "center";
	var yearHeader = createTiddlyElement(row, "td", null, "calendarYear", year);
	yearHeader.align = "center";
	yearHeader.setAttribute("colSpan",config.options.chkDisplayWeekNumbers?22:19);//wn**
	var fwd = createTiddlyElement(row, "td", null, null, null);
	var fwdHandler = function() {
		removeChildren(calendar);
		createCalendarYear(calendar, parseInt(year)+1);
		return false; // consume click
	};
	createTiddlyButton(fwd, ">", "Next year", fwdHandler);
	fwd.align = "center";
	createCalendarMonthRow(calendar, year, 0);
	createCalendarMonthRow(calendar, year, 3);
	createCalendarMonthRow(calendar, year, 6);
	createCalendarMonthRow(calendar, year, 9);
}
//}}}
//{{{
function createCalendarMonthRow(cal, year, mon)
{
	var row = createTiddlyElement(cal, "tr", null, null, null);
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon], false, year, mon);
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+1], false, year, mon);
	createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+2], false, year, mon);
	row = createTiddlyElement(cal, "tr", null, null, null);
	createCalendarDayHeader(row, 3);
	createCalendarDayRows(cal, year, mon);
}
//}}}
//{{{
function createCalendarMonthHeader(cal, row, name, nav, year, mon)
{
	var month;
	if (nav) {
		var back = createTiddlyElement(row, "td", null, null, null);
		back.align = "center";
		back.style.background = config.macros.calendar.monthbg;

		var backMonHandler = function() {
			var newyear = year;
			var newmon = mon-1;
			if(newmon == -1) { newmon = 11; newyear = newyear-1;}
			removeChildren(cal);
			cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
			createCalendarOneMonth(cal, newyear, newmon);
			return false; // consume click
		};
		createTiddlyButton(back, "<", "Previous month", backMonHandler);
		month = createTiddlyElement(row, "td", null, "calendarMonthname")
		createTiddlyLink(month,name,true);
		month.setAttribute("colSpan", config.options.chkDisplayWeekNumbers?6:5);//wn**
		var fwd = createTiddlyElement(row, "td", null, null, null);
		fwd.align = "center";
		fwd.style.background = config.macros.calendar.monthbg; 

		var fwdMonHandler = function() {
			var newyear = year;
			var newmon = mon+1;
			if(newmon == 12) { newmon = 0; newyear = newyear+1;}
			removeChildren(cal);
			cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
			createCalendarOneMonth(cal, newyear, newmon);
			return false; // consume click
		};
		createTiddlyButton(fwd, ">", "Next month", fwdMonHandler);
	} else {
		month = createTiddlyElement(row, "td", null, "calendarMonthname", name)
		month.setAttribute("colSpan",config.options.chkDisplayWeekNumbers?8:7);//wn**
	}
	month.align = "center";
	month.style.background = config.macros.calendar.monthbg;
}
//}}}
//{{{
function createCalendarDayHeader(row, num)
{
	var cell;
	for(var i = 0; i < num; i++) {
		if (config.options.chkDisplayWeekNumbers) createTiddlyElement(row, "td");//wn**
		for(var j = 0; j < 7; j++) {
			var d = j + (config.options.txtCalFirstDay - 0);
			if(d > 6) d = d - 7;
			cell = createTiddlyElement(row, "td", null, null, config.macros.calendar.daynames[d]);
			if(d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))
				cell.style.background = config.macros.calendar.weekendbg;
		}
	}
}
//}}}
//{{{
function createCalendarDays(row, col, first, max, year, mon) {
	var i;
	if (config.options.chkDisplayWeekNumbers){
		if (first<=max) {
			var ww = new Date(year,mon,first);
			var td=createTiddlyElement(row, "td");//wn**
			var link=createTiddlyLink(td,ww.formatString(config.options.txtWeekNumberLinkFormat),false);
			link.appendChild(document.createTextNode(ww.formatString(config.options.txtWeekNumberDisplayFormat)));
		}
		else createTiddlyElement(row, "td", null, null, null);//wn**
	}
	for(i = 0; i < col; i++)
		createTiddlyElement(row, "td", null, null, null);
	var day = first;
	for(i = col; i < 7; i++) {
		var d = i + (config.options.txtCalFirstDay - 0);
		if(d > 6) d = d - 7;
		var daycell = createTiddlyElement(row, "td", null, null, null);
		var isaWeekend = ((d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))? true:false);
		if(day > 0 && day <= max) {
			var celldate = new Date(year, mon, day);
			// ELS 2005.10.30: use <<date>> macro's showDate() function to create popup
			// ELS 5/29/06 - use journalDateFmt 
			if (window.showDate)
				showDate(daycell,celldate,"popup","DD",config.macros.calendar.journalDateFmt,true, isaWeekend);
			else {
				if(isaWeekend) daycell.style.background = config.macros.calendar.weekendbg;
				var title = celldate.formatString(config.macros.calendar.journalDateFmt);
				if(calendarIsHoliday(celldate))
					daycell.style.background = config.macros.calendar.holidaybg;
				var now=new Date();
				if ((now-celldate>=0) && (now-celldate<86400000)) // is today?
					daycell.style.background = config.macros.calendar.todaybg;
				if(window.findTiddlersWithReminders == null) {
					var link = createTiddlyLink(daycell, title, false);
					link.appendChild(document.createTextNode(day));
				} else
					var button = createTiddlyButton(daycell, day, title, onClickCalendarDate);
			}
		}
		day++;
	}
}
//}}}
//{{{
// We've clicked on a day in a calendar - create a suitable pop-up of options.
// The pop-up should contain:
//  * a link to create a new entry for that date
//  * a link to create a new reminder for that date
//  * an <hr>
//  * the list of reminders for that date
// NOTE: The following code is only used when [[DatePlugin]] is not present
function onClickCalendarDate(e)
{
	var button = this;
	var date = button.getAttribute("title");
	var dat = new Date(date.substr(6,4), date.substr(3,2)-1, date.substr(0, 2));

	date = dat.formatString(config.macros.calendar.journalDateFmt);
	var popup = createTiddlerPopup(this);
	popup.appendChild(document.createTextNode(date));
	var newReminder = function() {
		var t = store.getTiddlers(date);
		displayTiddler(null, date, 2, null, null, false, false);
		if(t) {
			document.getElementById("editorBody" + date).value += "\n<<reminder day:" + dat.getDate() +
				" month:" + (dat.getMonth()+1) + " year:" + (dat.getYear()+1900) + " title: >>";
		} else {
			document.getElementById("editorBody" + date).value = "<<reminder day:" + dat.getDate() +
				" month:" + (dat.getMonth()+1) +" year:" + (dat.getYear()+1900) + " title: >>";
		}
		return false; // consume click
	};
	var link = createTiddlyButton(popup, "New reminder", null, newReminder); 
	popup.appendChild(document.createElement("hr"));
	var t = findTiddlersWithReminders(dat, [0,14], null, 1);
	for(var i = 0; i < t.length; i++) {
		link = createTiddlyLink(popup, t[i].tiddler, false);
		link.appendChild(document.createTextNode(t[i].tiddler));
	}
	return false; // consume click
}
//}}}
//{{{
function calendarMaxDays(year, mon)
{
	var max = config.macros.calendar.monthdays[mon];
	if(mon == 1 && (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0)) max++;
	return max;
}
//}}}
//{{{
function createCalendarDayRows(cal, year, mon)
{
	var row = createTiddlyElement(cal, "tr", null, null, null);
	var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first1 < 0) first1 = first1 + 7;
	var day1 = -first1 + 1;
	var first2 = (new Date(year, mon+1, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first2 < 0) first2 = first2 + 7;
	var day2 = -first2 + 1;
	var first3 = (new Date(year, mon+2, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first3 < 0) first3 = first3 + 7;
	var day3 = -first3 + 1;

	var max1 = calendarMaxDays(year, mon);
	var max2 = calendarMaxDays(year, mon+1);
	var max3 = calendarMaxDays(year, mon+2);

	while(day1 <= max1 || day2 <= max2 || day3 <= max3) {
		row = createTiddlyElement(cal, "tr", null, null, null);
		createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
		createCalendarDays(row, 0, day2, max2, year, mon+1); day2 += 7;
		createCalendarDays(row, 0, day3, max3, year, mon+2); day3 += 7;
	}
}
//}}}
//{{{
function createCalendarDayRowsSingle(cal, year, mon)
{
	var row = createTiddlyElement(cal, "tr", null, null, null);
	var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
	if(first1 < 0) first1 = first1+ 7;
	var day1 = -first1 + 1;
	var max1 = calendarMaxDays(year, mon);
	while(day1 <= max1) {
		row = createTiddlyElement(cal, "tr", null, null, null);
		createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
	}
}
//}}}
//{{{
setStylesheet(".calendar, .calendar table, .calendar th, .calendar tr, .calendar td { text-align:center; } .calendar, .calendar a { margin:0px !important; padding:0px !important; }", "calendarStyles");
//}}}
These configuration options enable you to customize the default behaviour of this wiki. They are saved locally as cookies, just like other TiddlyWiki configuration options. Note that in some cases, you will need to reload the document for the changes to take effect.

!!Action display settings
This value, if specified, is a semi-colon-delimited list of tags that are used to prioritize projects and actions for those projects. If left blank, the single priority tag "important" is used to sort projects. Otherwise, the specified tags are used in the listed order of importance, the first tag being most important (you will need to reload the document to see your change):
<<option txtGTDProjectPriorities>>

This value, if specified, is the number of days to keep completed actions in context and review action lists (leave blank to show all unarchived, completed actions):
<<option txtGTDActionAging>>

!!Magic tags
The following tag is used for the "reference" context, used to identify tiddlers that show up in the [[Reference]] list: 
<<option txtGTDReferenceContext>>

The following tag is used for the "someday-maybe" context, used to identify tiddlers that show up in the [[Someday-Maybe]] list:
<<option txtGTDSomedayContext>>

The following tag is used for the "unfiled" context, used to tag actions when the context is not known (such as orphaned actions from a deleted context):
<<option txtGTDUnfiledContext>>

!!Miscellaneous functionality
<<option chkGTDLazyAutoSave>> Use this checkbox to enable or disable "lazy" autosaving of changes to your document. If turned on, then the autosave will fire every <<option txtGTDLazyAutoSaveInterval>> seconds.


/***
|Name|CoreTweaks|
|Source|http://www.TiddlyTools.com/#CoreTweaks|
|Version|n/a|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.2.4|
|Type|plugin|
|Requires||
|Overrides|various|
|Description|a small collection of overrides to TW core functions|
This tiddler contains some quick tweaks and modifications to TW core functions to provide minor changes in standard features or behavior.  It is hoped that some of these tweaks may be incorporated into later versions of the TW core, so that these adjustments will be available without needing these add-on definitions. ''Note: the changes contained in this tiddler are generally applicable for the current version of TiddlyWiki (<<version>>)./% Please view [[CoreTweaksArchive]] for tweaks and modifications that may be used with earlier versions of TiddlyWiki.%/''

To install //all// of these tweaks, import (or copy/paste) this tiddler into your document.  To include only //some// of the tweaks, you can edit the imported tiddler to remove the tweaks that you don't want.  Alternatively, you could copy/paste a few selected tweaks from this tiddler into a tiddler that you create in your own document.  Be certain to tag that tiddler with<<tag systemConfig>> (i.e., a plugin tiddler) and then save-and-reload for the tweaks to take effect.
***/
/***
!!! Ticketed Tweaks
***/
// // {{groupbox small{
/***
!!FireFox3 Import bug: "browse" button replacement
http://trac.tiddlywiki.org/ticket/683 - OPEN
see also http://trac.tiddlywiki.org/ticket/604 - cross-platform askForFilename()
The web standard "type=file" input control that has been used as a local path/file picker for TiddlyWiki no longer works as expected in FireFox3, which has, for "security" reasons, limited javascript access to this control so that *no* local filesystem path information can be revealed, even when it is intentional and necessary, as it is with TiddlyWiki.  This tweak provides alternative HTML source that patches the backstage import panel.  It replaces the "type=file" input control with a text+button combination of controls that invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
***/
//{{{
if (window.Components) {
	var fixhtml='<input name="txtBrowse" style="width:30em"><input type="button" value="..."'
		+' onClick="window.browseForFilename(this.previousSibling,true)">';
	var cmi=config.macros.importTiddlers;
	cmi.step1Html=cmi.step1Html.replace(/<input type='file' size=50 name='txtBrowse'>/,fixhtml);
}

merge(config.messages,{selectFile:"Please enter or select a file"}); // ready for I18N translation

window.browseForFilename=function(target,mustExist) { // note: both params are optional
	var msg=config.messages.selectFile;
	if (target && target.title) msg=target.title; // use target field tooltip (if any) as dialog prompt text
	// get local path for current document
	var path=getLocalPath(document.location.href);
	var p=path.lastIndexOf("/"); if (p==-1) p=path.lastIndexOf("\\"); // Unix or Windows
	if (p!=-1) path=path.substr(0,p+1); // remove filename, leave trailing slash
	var file=""
	var result=window.askForFilename(msg,path,file,mustExist); // requires #604
	if (target && result.length) // set target field and trigger handling
		{ target.value=result; target.onchange(); }
	return result; 
}
//}}}
// // }}}
// // {{groupbox small{
/***
!!cross-platform askForFilename()
http://trac.tiddlywiki.org/ticket/604 - OPEN
invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
***/
//{{{
window.askForFilename=function(msg,path,file,mustExist) {
	var r = window.mozAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = window.ieAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = window.javaAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = prompt(msg,path+file);
	return r||"";
}

window.mozAskForFilename=function(msg,path,file,mustExist) {
	if(!window.Components) return false;
	try {
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
		var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
		picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
		var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
		thispath.initWithPath(path);
		picker.displayDirectory=thispath;
		picker.defaultExtension='html';
		picker.defaultString=file;
		picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
		if (picker.show()!=nsIFilePicker.returnCancel)
			var result=picker.file.persistentDescriptor;
	}
	catch(ex) { displayMessage(ex.toString()); }
	return result;
}

window.ieAskForFilename=function(msg,path,file,mustExist) {
	if(!config.browser.isIE) return false;
	try {
		var s = new ActiveXObject('UserAccounts.CommonDialog');
		s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
		s.FilterIndex=3; // default to HTML files;
		s.InitialDir=path;
		s.FileName=file;
		return s.showOpen()?s.FileName:"";
	}
	catch(ex) { displayMessage(ex.toString()); }
	return result;
}

window.javaAskForFilename=function(msg,path,file,mustExist) {
	if(!document.applets["TiddlySaver"]) return false;
	// TBD: implement java-based askFile(...) function
	try { return document.applets["TiddlySaver"].askFile(msg,path,file,mustExist); } 
	catch(ex) { displayMessage(ex.toString()); }
}
//}}}
// // }}}
// // {{groupbox small{
/***
!!#story:... paramifier
http://trac.tiddlywiki.org/ticket/676 - OPEN
scan the specified 'story' tiddler content for embedded links, rather than simply parsing the content as a space-separated bracketed list.  This allows links from ''any'' tiddler to be used as a story, regardless of other wiki-syntax contained in that tiddler.  If specified tiddler is a shadow, fallback to using parseParams() to extract the list of links.
***/
//{{{
config.paramifiers.story = {
	onstart: function(v) {
		var t=store.getTiddler(v); if (t) t.changed();
		var list=t?t.links:store.getTiddlerText(v,"").parseParams("open",null,false);
		story.displayTiddlers(null,list);
	}
};
//}}}
// // }}}
// // {{groupbox small{
/***
!!Loose links (case-folded/space-folded wiki words)
http://trac.tiddlywiki.org/ticket/664 - OPEN
This tweak matches non-WikiWord variations of mixed-case and/or added/omitted spaces within double-bracketed text with titles of //existing// tiddlers, using a "loose" (case-folded/space-folded) comparison.  This allows text that occurs in normal prose to be more easily linked to tiddler titles by using double-brackets without the full "pretty link" syntax.  For example:
{{{
[[CoreTweaks]], [[coreTweaks]], [[core tweaks]],
[[CORE TWEAKS]], [[CoRe TwEaKs]], [[coreTWEAKS]]
}}}
>[[CoreTweaks]], [[coreTweaks]], [[core tweaks]],
>[[CORE TWEAKS]], [[CoRe TwEaKs]], [[coreTWEAKS]]
Configuration:
><<option chkLooseLinks>> Allow case-folded and/or space-folded text to link to existing tiddler titles
>{{{usage: <<option chkLooseLinks>>}}}
***/
//{{{
if (!config.options.chkLooseLinks)
	config.options.chkLooseLinks=false; // default to standard behavior
window.caseFold_createTiddlyLink = window.createTiddlyLink;
window.createTiddlyLink = function(place,title,includeText,className) {
	var btn=window.caseFold_createTiddlyLink.apply(this,arguments); // create core link
	if (!config.options.chkLooseLinks) return btn;
	if (store.getTiddlerText(title)) return btn; // matching tiddler (or shadow) exists
	var target=title.toLowerCase().replace(/\s/g,"");
	var tids=store.getTiddlers("title");
	for (var t=0; t<tids.length; t++) {
		if (tids[t].title.toLowerCase().replace(/\s/g,"")==target) {
			var i=getTiddlyLinkInfo(tids[t].title,className);
			btn.setAttribute("tiddlyLink",tids[t].title);
			btn.title=i.subTitle;
			btn.className=i.classes;
			break;
		}
	}
	return btn;
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/657 - OPEN
// // This tweak inserts an extra space element following each tab, allowing them to wrap onto multiple lines if needed.
//{{{
config.macros.tabs.handler = function(place,macroName,params)
{
	var cookie = params[0];
	var numTabs = (params.length-1)/3;
	var wrapper = createTiddlyElement(null,"div",null,"tabsetWrapper " + cookie);
	var tabset = createTiddlyElement(wrapper,"div",null,"tabset");
	tabset.setAttribute("cookie",cookie);
	var validTab = false;
	for(var t=0; t<numTabs; t++) {
		var label = params[t*3+1];
		var prompt = params[t*3+2];
		var content = params[t*3+3];
		var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,"tab tabUnselected");
		createTiddlyElement(tab,"span",null,null," ",{style:"font-size:0pt;line-height:0px"}); // ELS
		tab.setAttribute("tab",label);
		tab.setAttribute("content",content);
		tab.title = prompt;
		if(config.options[cookie] == label)
			validTab = true;
	}
	if(!validTab)
		config.options[cookie] = params[1];
	place.appendChild(wrapper);
	this.switchTab(tabset,config.options[cookie]);
};
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/637 - OPEN
// // This tweak modifies the tooltip format that appears when you mouseover a link to a tiddler.  It adds an option to control the date format, as well as displaying the size of the tiddler (in bytes)
// //
// // Tiddler link tooltip format:
// // {{stretch{<<option txtTiddlerLinkTootip>>}}}
// // ^^where: %0=title, %1=username, %2=modification date, %3=size in bytes^^
// // Tiddler link tooltip date format:
// // {{stretch{<<option txtTiddlerLinkTooltipDate>>}}}
//{{{
config.messages.tiddlerLinkTooltip="%0 - %1, %2 (%3 bytes)";
config.messages.tiddlerLinkTooltipDate="DDD, MMM DDth YYYY 0hh12:0mm AM";

config.options.txtTiddlerLinkTootip=
	config.options.txtTiddlerLinkTootip||config.messages.tiddlerLinkTooltip;
config.options.txtTiddlerLinkTooltipDate=
	config.options.txtTiddlerLinkTooltipDate||config.messages.tiddlerLinkTooltipDate;

Tiddler.prototype.getSubtitle = function() {
	var modifier = this.modifier;
	if(!modifier) modifier = config.messages.subtitleUnknown;
	var modified = this.modified;
	if(modified) modified = modified.formatString(config.options.txtTiddlerLinkTooltipDate);
	else modified = config.messages.subtitleUnknown;
	return config.options.txtTiddlerLinkTootip.format([this.title,modifier,modified,this.text.length]);
};
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/628 - OPEN
// // When invoking a macro that is not defined, this tweak prevents the display of the "error in macro... no such macro" message.  This is useful when rendering tiddler content or templates that reference macros that are defined by //optional// plugins that have not been installed in the current document.
// //
// // <<option chkHideMissingMacros>> hide "no such macro" error messages
//{{{
if (config.options.chkHideMissingMacros===undefined)
	config.options.chkHideMissingMacros=false;

window.coreTweaks_missingMacro_invokeMacro = window.invokeMacro;
window.invokeMacro = function(place,macro,params,wikifier,tiddler) {
	if (!config.macros[macro] || !config.macros[macro].handler)
		if (config.options.chkHideMissingMacros) return;
	window.coreTweaks_missingMacro_invokeMacro.apply(this,arguments);
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/609 - OPEN (separators)
// // http://trac.tiddlywiki.org/ticket/610 - OPEN (wikify tiddler/slice/section content)
// // These tweaks extend the {{{<<toolbar>>}}} macro to permit use of "|" as separators, as well as recognizing references to tiddlernames, slices, or sections and rendering their content inline within the toolbar
// // ''see [[ToolbarCommands]] for examples of how these features can be used''
//{{{
merge(config.macros.toolbar,{
	separator: "|"
	});
config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	for(var t=0; t<params.length; t++) {
		var c = params[t];
		switch(c) {
			case '|':  // ELS - SEPARATOR
			case '!':  // ELS - SEPARATOR (alternative for use in tiddler slices)
				createTiddlyText(place,this.separator); // ELS
				break; // ELS
			case '>':
				var btn = createTiddlyButton(place,this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore);
				addClass(btn,"moreCommand");
				var e = createTiddlyElement(place,"span",null,"moreCommand");
				e.style.display = "none";
				place = e;
				break;
			default:
				var theClass = "";
				switch(c.substr(0,1)) {
					case "+":
						theClass = "defaultCommand";
						c = c.substr(1);
						break;
					case "-":
						theClass = "cancelCommand";
						c = c.substr(1);
						break;
				}
				if(c in config.commands)
					this.createCommand(place,c,tiddler,theClass);
				else { // ELS - WIKIFY TIDDLER/SLICE/SECTION
					if (c.substr(0,1)=="~") c=c.substr(1); // ignore leading ~
					var txt=store.getTiddlerText(c);
					if (txt) {
						txt=txt.replace(/^\n*/,"").replace(/\n*$/,""); // trim any leading/trailing newlines
						txt=txt.replace(/^\{\{\{\n/,"").replace(/\n\}\}\}$/,""); // trim PRE format wrapper if any
						wikify(txt,createTiddlyElement(place,"span"),null,tiddler);
					}
				} // ELS - end WIKIFY CONTENT
				break;
		}
	}
};
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/608 - OPEN
// // This tweak extends the {{{<<toolbar>>}}} macro to make the ">" (more) a //toggle// between more/less with the additional toolbar commands displayed on a separate line.
//{{{
merge(config.macros.toolbar,{
	moreLabel: 'more',
	morePrompt: "Show additional commands",
	lessLabel: 'less',
	lessPrompt: "Hide additional commands"
});
config.macros.toolbar.onClickMore = function(ev)
{
	var e = this.nextSibling;
	var showing=e.style.display=="block";
	e.style.display = showing?"none":"block";
	this.innerHTML=showing?config.macros.toolbar.moreLabel:config.macros.toolbar.lessLabel;
	this.title=showing?config.macros.toolbar.morePrompt:config.macros.toolbar.lessPrompt;
	return false;
};
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/607 - OPEN
// // This tweak automatically sets the HREF for the 'permaview' sidebar command link so you can use the 'right click' context menu for faster, easier bookmarking.  Note that this does ''not'' automatically set the permaview in the browser's current location URL... it just sets the HREF on the command link.  You still have to click the link to apply the permaview.
//{{{
config.macros.permaview.handler = function(place)
{
	var btn=createTiddlyButton(place,this.label,this.prompt,this.onClick);
	addEvent(btn,"mouseover",this.setHREF);
	addEvent(btn,"focus",this.setHREF);
};
config.macros.permaview.setHREF = function(event){
	var links = [];
	story.forEachTiddler(function(title,element) {
		links.push(String.encodeTiddlyLink(title));
	});
	var newURL=document.location.href;
	var hashPos=newURL.indexOf("#");
	if (hashPos!=-1) newURL=newURL.substr(0,hashPos);
	this.href=newURL+"#"+encodeURIComponent(links.join(" "));
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/529 - OPEN
// // This tweak hijacks the standard browser function, document.getElementById(), to work-around the case-INsensitivity error in Internet Explorer (all versions up to and including IE7) //''Note: This tweak is only applied when using IE, and only for lookups of rendered tiddler elements within the containing "tiddlerDisplay" element.''//
//{{{
if (config.browser.isIE) {
document.coreTweaks_coreGetElementById=document.getElementById;
document.getElementById=function(id) {
	var e=document.coreTweaks_coreGetElementById(id);
	if (!e || !e.parentNode || e.parentNode.id!="tiddlerDisplay") return e;
	for (var i=0; i<e.parentNode.childNodes.length; i++)
		if (id==e.parentNode.childNodes[i].id) return e.parentNode.childNodes[i];
	return null;
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/471 - OPEN
// // This tweak HIJACKS the core's saveTiddler() function to automatically add a "creator" field to a tiddler when it is FIRST created. You can use {{{<<view creator>>}}} (or {{{<<view creator wikified>>}}} if you prefer) to show this value embedded directly within the tiddler content, or {{{<span macro="view creator"></span>}}} in the ViewTemplate and/or EditTemplate to display the creator value in each tiddler.  
//{{{
// hijack saveTiddler()
TiddlyWiki.prototype.CoreTweaks_creatorSaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler=function(title,newTitle,newBody,modifier,modified,tags,fields)
{
	var existing=store.tiddlerExists(title);
	var tiddler=this.CoreTweaks_creatorSaveTiddler.apply(this,arguments);
	if (!existing) store.setValue(title,"creator",config.options.txtUserName);
	return tiddler;
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/458 - CLOSED: WON'T FIX
// // This tweak assigns a "permalink"-like HREF to internal Tiddler links (which normally do not have any HREF defined).  This permits the link's context menu (right-click) to include 'open link in another window/tab' command.  Based on a request from Dustin Spicuzza.
//{{{
window.coreTweaks_createTiddlyLink=window.createTiddlyLink;
window.createTiddlyLink=function(place,title,includeText,theClass,isStatic,linkedFromTiddler,noToggle)
{
	// create the core button, then add the HREF (to internal links only)
	var link=window.coreTweaks_createTiddlyLink.apply(this,arguments);
	if (!isStatic)
		link.href=document.location.href.split("#")[0]+"#"+encodeURIComponent(String.encodeTiddlyLink(title));
	return link;
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/444 - OPEN
// // When invoking a macro, this tweak makes the current containing tiddler object and DOM rendering location available as global variables (window.tiddler and window.place, respectively).  These globals can then be used within "computed macro parameters" to retrieve tiddler-relative and/or DOM-relative values or perform tiddler-specific side-effect functionality.
//{{{
window.coreTweaks_invokeMacro = window.invokeMacro;
window.invokeMacro = function(place,macro,params,wikifier,tiddler) {
	var here=story.findContainingTiddler(place);
	window.tiddler=here?store.getTiddler(here.getAttribute("tiddler")):null;
	window.place=place;
	window.coreTweaks_invokeMacro.apply(this,arguments);
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/401 - CLOSED: WON'T FIX
// // This tweak allows definition of an optional [[PageTitle]] tiddler that, when present, provides alternative text for display in the browser window's titlebar, instead of using the combined text content from [[SiteTitle]] and [[SiteSubtitle]] (which will still be displayed as usual in the TiddlyWiki document header area)
//{{{
window.coreTweaks_getPageTitle=window.getPageTitle;
window.getPageTitle=function() { 
	var txt=wikifyPlain("PageTitle"); if (txt.length) return txt;
	return window.coreTweaks_getPageTitle.apply(this,arguments);
}
store.addNotification("PageTitle",refreshPageTitle); // so title stays in sync with tiddler changes
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/67 - OPEN
// // The "missing links" list includes items contained within "quoted" text (i.e., content that will not render as wiki-syntax, and so CANNOT create any tiddler links, even if the quoted text matches valid link syntax).  This tweak removes content contained between certain delimiters before scanning tiddler source for possible links.
/***
Delimiters include:
{{{
/%...%/
{{{...}}}
"""..."""
<nowiki>...</nowiki>
<html>...</html>
<script>...</script>
}}}
***/
//{{{
Tiddler.prototype.coreTweaks_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	var savedtext=this.text;
	// remove 'quoted' text before scanning tiddler source
	this.text=this.text.replace(/\/%((?:.|\n)*?)%\//g,""); // /%...%/
	this.text=this.text.replace(/\{{3}((?:.|\n)*?)\}{3}/g,""); // {{{...}}}
	this.text=this.text.replace(/"{3}((?:.|\n)*?)"{3}/g,""); // """..."""
	this.text=this.text.replace(/\<nowiki\>((?:.|\n)*?)\<\/nowiki\>/g,""); // <nowiki>...</nowiki>
	this.text=this.text.replace(/\<html\>((?:.|\n)*?)\<\/html\>/g,""); // <html>...</html>
	this.text=this.text.replace(/\<script((?:.|\n)*?)\<\/script\>/g,""); // <script>...</script>
	this.coreTweaks_changed.apply(this,arguments);
	// restore quoted text to tiddler source
	this.text=savedtext;
};
//}}}
// // }}}
/***
!!! Fixed in current release (TW<<version>>)
***/
// // {{groupbox small{
// // calculate version number for conditional inclusion of tweaks below...
//{{{
var ver=version.major+version.minor/10+version.revision/100;
//}}}
// // }}}
// // {{groupbox small{
/***
!!#filter:"..." paramifier
http://trac.tiddlywiki.org/ticket/678 - FIXED IN TW241
displays all tiddlers that match any filter criteria (including tag-matching), using the {{{store.filterTiddlers()}}} syntax.  Note use of double-quotes to enclose value to ensure that square-brackets within filter syntax are passed through for processing.
***/
//{{{
if (ver<2.41) {
config.paramifiers.filter = {
	onstart: function(v) {
		var tagged = store.filterTiddlers(v);
		story.displayTiddlers(null,tagged,null,false,null);
	}
};
}
//}}}
// // }}}
// // {{groupbox small{
/***
!!#tag:... paramifier
http://trac.tiddlywiki.org/ticket/677 - FIXED IN TW241
use {{{store.filterTiddlers()}}} instead of {{{store.getTaggedTiddlers()}}}.  This permits enhanced tag-matching logic (such as boolean expression processing provided by [[MatchTagsPlugin]]) to be used, e.g., {{{#tag:"tag1 OR (tag2 AND NOT tag3)"}}}, instead of simply matching a single tag value.
***/
//{{{
if (ver<2.41) {
config.paramifiers.tag = {
	onstart: function(v) {
		var tagged = store.filterTiddlers("[tag["+v+"]]");
		story.displayTiddlers(null,tagged,null,false,null);
	}
};
}
//}}}
// // }}}
// // {{groupbox small{
/***
!!#recent:... paramifier
http://trac.tiddlywiki.org/ticket/675 - FIXED IN TW241
automatically display the N most recently changed tiddlers.  N is, of course, an integer number.  If N=0 (or is not a numeric value), the regular [[DefaultTiddlers]] will be displayed.
***/
//{{{
if (ver<2.41) {
config.paramifiers.recent= {
	onstart: function(v) {
		var titles=[];
		var tids=store.getTiddlers("modified","excludeLists").reverse();
		for (var t=0; t<v && t<tids.length; t++) titles.push(tids[t].title);
		story.displayTiddlers(null,titles); 
	}
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/635 - FIXED IN TW241
// // When using backstage>import "browse" button, resulting URL is improperly formed with "file://" prefix instead of "file:///" prefix.  This causes errors when using Firefox 3 (beta) or when running under Windows Vista OS.
// // http://trac.tiddlywiki.org/ticket/638 - FIXED IN TW241
// // When entering text directly into path/file field, each keystroke is displayed and then discarded, preventing manual entry of path/file.
// // http://trac.tiddlywiki.org/ticket/639 - FIXED IN TW241
// // Pressing "enter" from URL or Browse input field immediately reloads the current document.  Instead, it should trigger the "open" button for the import wizard (if a URL has been entered)
//{{{
if (ver<2.41) {
// #635 and #638
config.macros.importTiddlers.onBrowseChange = function(e)
{
	var wizard = new Wizard(this);
	var fileInput = wizard.getElement("txtPath");
	fileInput.value = config.macros.importTiddlers.getURLFromLocalPath(this.value); // #635
	var serverType = wizard.getElement("selTypes");
	serverType.value = "file";
	return true; // #638
};
// #635 - fixup local path/file to form absolute URL reference
config.macros.importTiddlers.getURLFromLocalPath = function(v)
{
	if (!v||!v.length) return v;
	v=v.replace(/\\/g,"/"); // use "/" for cross-platform consistency
	var t=v.split(":"); p=t[1]||t[0]; // remove drive letter (if any)
	if (t[1] && (t[0]=="http"||t[0]=="https"||t[0]=="file")) { // input is already a URL
		var u=v;
	} else if (p.substr(0,1)=="/") { // path is absolute, add protocol+domain+extra slash (if drive letter)
		var u=document.location.protocol+"//"+document.location.hostname+(t[1]?"/":"")+v;
	} else { // path is relative, add current document protocol+domain+path
		var c=document.location.href.replace(/\\/g,"/");
		var pos=c.lastIndexOf("/"); if (pos!=-1) c=c.substr(0,pos); // remove filename
		var u=c+"/"+p;
	}
	return u;
}
// #639 - prevent form action and click "open" button if ENTER is pressed
config.macros.importTiddlers.coreTweaks_restart = config.macros.importTiddlers.restart;
config.macros.importTiddlers.restart = function(wizard)
{
	config.macros.importTiddlers.coreTweaks_restart.apply(this,arguments);
	wizard.formElem.action="javascript:;"
	wizard.formElem.onsubmit=function() {
		if (this.txtPath.value.length)
			this.lastChild.firstChild.onclick();  // press "open" button
	}
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/623 - FIXED IN TW241
/***
This tweak allows date format strings to contain backslash-quoted characters that bypass date format replacement.  This allows sequences such as "s\s", "m\m" or "a\m" to be used so that "ss", "mm" or "am" can appears as literal text within journal titles or other date-formatted values.

For example:
>{{{<<today "withhold less hummingbirds - YYYY.0MM.0DD 0hh:0mm:0ss">>}}}
>results in: <<today "withhold less hummingbirds - YYYY.0MM.0DD 0hh:0mm:0ss">>
while:
>{{{<<today "with\hold les\s hum\mingbirds - YYYY.0MM.0DD 0hh:0mm:0ss">>}}}
>results in: <<today "with\hold les\s hum\mingbirds - YYYY.0MM.0DD 0hh:0mm:0ss">>
***/
//{{{
if (ver<2.41) {
Date.prototype.coreTweaks_formatString = Date.prototype.formatString;
Date.prototype.formatString = function(template) {
	var t = Date.prototype.coreTweaks_formatString.apply(this,arguments);
	t = t.replace(/\\/g,""); // strip backslashes used to quote formats
	return t;
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/578 - FIXED IN TW240
// // This tweak trims any leading whitespace/newline and the trailing newline from tiddler sections
//{{{
if (ver<2.4) {
TiddlyWiki.prototype.coreTweaks_getTiddlerText = TiddlyWiki.prototype.getTiddlerText;
TiddlyWiki.prototype.getTiddlerText = function(title,defaultText)
{
	var r=TiddlyWiki.prototype.coreTweaks_getTiddlerText.apply(this,arguments);
	if (r&&title.indexOf(config.textPrimitives.sectionSeparator)!=-1)
		r=r.replace(/^[ \t]*\n/,"").replace(/\n$/,""); // trim any leading/trailing newlines
	return r;
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/541 - FIXED IN TW240
// // This tweak adds a conditional check to the core's 'open' paramifier, so that when the document is viewed in readOnly mode, non-existent tiddlers specified using a permalink/permaview (i.e. "#TiddlerName" in the document URL) will not be displayed as an empty tiddler (which shows the "double-click to create" default text).
//{{{
if (ver<2.4) {
config.paramifiers.open = { 
onstart: function(v) { 
		if(!readOnly || store.tiddlerExists(v) || store.isShadowTiddler(v)) 
			story.displayTiddler("bottom",v,null,false,null); 
	} 
}; 
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/470 - FIXED IN TW240
// // This tweak lets you set an alternative initial focus field when editing a tiddler (default field is "text")
// // Enter initial focus field name: <<option txtEditorFocus>> (//usage:// {{{<<option txtEditorFocus>>}}})
//{{{
if (ver<2.4) {
config.commands.editTiddler.coreTweaks_handler = config.commands.editTiddler.handler;
config.commands.editTiddler.handler = function(event,src,title)
{
	if (config.options.txtEditorFocus==undefined) config.options.txtEditorFocus="text";
	this.coreTweaks_handler.apply(this,arguments);
	story.focusTiddler(title,config.options.txtEditorFocus);
	return false;
};
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/468 - FIXED IN TW240
// // This tweak extends the core's {{{<<tag>>}}} macro to accept additional parameters for specifying alternative label and tooltip text for the tag popup "button" link (i.e., "`PrettyTags").  Based on a suggestion by ~PBee.
//{{{
// hijack tag handler()
if (ver<2.4) {
config.macros.tag.CoreTweaks_handler=config.macros.tag.handler;
config.macros.tag.handler = function(place,macroName,params)
{
	this.CoreTweaks_handler.apply(this,arguments);
	var btn=place.lastChild;
	if (params[1]) btn.innerHTML=params[1];
	if (params[2]) btn.title=params[2];
}
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/320 - FIXED IN TW240
// // This tweak updates the core's forceReflow() function to fix a Firefox rendering problem, whereby the contents of the a tiddler editor text area can be incorrectly displayed (overlapping other content) when more than one tiddler is in edit mode.
//{{{
if (ver<2.4) {
function forceReflow()
{
	if(config.browser.isGecko) {
		setStylesheet("body {top:-0px;margin-top:0px;}");
		setTimeout('setStylesheet("")',1); // invoke async to bypass browser optimization
	}
}
}
//}}}
// // }}}
// // {{groupbox small{
// // http://trac.tiddlywiki.org/ticket/42 - FIXED IN TW240
// // This tweak adjusts the left position of a TW popup so that it won't overlap with the browser window's vertical scrollbar, when present.
//{{{
if (ver<2.4) {
Popup.place = function(root,popup,offset)
{
	if(!offset) var offset = {x:0, y:0};
	var rootLeft = findPosX(root);
	var rootTop = findPosY(root);
	var rootHeight = root.offsetHeight;
	var popupLeft = rootLeft + offset.x;
	var popupTop = rootTop + rootHeight + offset.y;
	var winWidth = findWindowWidth();
	if(popup.offsetWidth > winWidth*0.75)
		popup.style.width = winWidth*0.75 + "px";
	var popupWidth = popup.offsetWidth;
	// ELS: leave space for vertical scrollbar
	var scrollWidth=winWidth-document.body.offsetWidth;
	if(popupLeft+popupWidth > winWidth-scrollWidth-1)
		popupLeft = winWidth-popupWidth-scrollWidth-1;
	popup.style.left = popupLeft + "px";
	popup.style.top = popupTop + "px";
	popup.style.display = "block";
};
}
//}}}
// // }}}
/***
!!!Unticketed Tweaks
***/
// // {{groupbox small{
/***
!!#animate:... paramifier
http://trac.tiddlywiki.org/ticket/TBD - TBD
This tweak provides a paramifier to turn on/off animation
***/
//{{{
config.paramifiers.animate= {
	onstart: function(v) {
		config.options.chkAnimate=eval(v);
	}
};
//}}}
// // }}}
// // {{groupbox small{
// // This tweak adds an optional 'sortby' parameter to the {{{<<tag tagname label tip sortby>>}}} macro, as well as the {{{<<allTags excludeTag sortby>>}}} macro used to generate the sidebar contents 'tags' list.  Specify the field on which the contents of each tag popup is to be sorted, with a "+" or "-" prefix to indicate ascending/descending order, respectively.

// // Example: {{{<<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>}}}
// // Try it: <<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>

// // Similarly, to change the sort order used by the popups from all tags shown in the sidebar contents, edit the [[TagTags]] shadow tiddler and enter: {{{<<allTags excludeLists -modified>>}}}

//{{{
// hijack tag handler() to add 'sortby' attribute to tag button
config.macros.tag.CoreTweaksSortTags_handler=config.macros.tag.handler;
config.macros.tag.handler = function(place,macroName,params)
{
	this.CoreTweaksSortTags_handler.apply(this,arguments);
	var btn=place.lastChild;
	if (params[3]) btn.setAttribute("sortby",params[3]);
}

// TWEAK <<allTags>> macro to add 'sortby' attribute to each tag button
var fn=config.macros.allTags.handler;
var lines=fn.toString().split("\n");
lines.splice(lines.length-2,0,['if(params[1]) btn.setAttribute("sortby",params[1]);']);
fn=lines.join("\n");
eval("config.macros.allTags.handler="+fn);

// TWEAK event handler for clicking on a tiddler tag to use 'sortby' attribute
var fn=onClickTag;
fn=fn.toString().replace(
	/store.getTaggedTiddlers\(tag\);/g,
	'store.getTaggedTiddlers(tag);'
	+'var sortby=this.getAttribute("sortby");'
	+'if(sortby&&sortby.length) store.sortTiddlers(tagged,sortby);'
);
eval(fn);

//}}}
// // }}}
// // {{groupbox small{
// // This HIJACK tweak pre-processes source content to convert "double-backslash-newline" into {{{<br>}}} before wikify(), so that literal newlines can be embedded in line-mode wiki syntax (e.g., tables, bullets, etc.).  Based on a suggestion from Sitaram Chamarty.
//{{{
window.coreWikify = wikify;
window.wikify = function(source,output,highlightRegExp,tiddler)
{
	if (source) arguments[0]=source.replace(/\\\\\n/mg,"<br>");
	coreWikify.apply(this,arguments);
}
//}}}
// // }}}
/***
|Name|DatePlugin|
|Source|http://www.TiddlyTools.com/#DatePlugin|
|Documentation|http://www.TiddlyTools.com/#DatePluginInfo|
|Version|2.7.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|formatted dates plus popup menu with 'journal' link, changes and (optional) reminders|
There are quite a few calendar generators, reminders, to-do lists, 'dated tiddlers' journals, blog-makers and GTD-like schedule managers that have been built around TW.  While they all have different purposes, and vary in format, interaction, and style, in one way or another each of these plugins displays and/or uses date-based information to make finding, accessing and managing relevant tiddlers easier.  This plugin provides a general approach to embedding dates and date-based links/menus within tiddler content.
!!!!!Documentation
>see [[DatePluginInfo]]
!!!!!Configuration
<<<
<<option chkDatePopupHideCreated>> omit 'created' section from date popups
<<option chkDatePopupHideChanged>> omit 'changed' section from date popups
<<option chkDatePopupHideTagged>> omit 'tagged' section from date popups
<<option chkDatePopupHideReminders>> omit 'reminders' section from date popups
<<option chkShowJulianDate>> display Julian day number (1-365) below current date

see [[DatePluginConfig]] for additional configuration settings, for use in calendar displays, including:
*date formats
*color-coded backgrounds
*annual fixed-date holidays
*weekends
<<<
!!!!!Revisions
<<<
2008.03.08 [2.7.0] in addModifiedsToPopup(), if a tiddler was created on the specified date, don't list it in the 'changed' section of the popup.  Based on a request from Kashgarinn.
|please see [[DatePluginInfo]] for additional revision details|
2005.10.30 [0.9.0] pre-release
<<<
!!!!!Code
***/
//{{{
version.extensions.date = {major: 2, minor: 7, revision: 0, date: new Date(2008,3,8)};

config.macros.date = {
	format: "YYYY.0MM.0DD", // default date display format
	linkformat: "YYYY.0MM.0DD", // 'dated tiddler' link format
	linkedbg: "#babb1e", // "babble"
	todaybg: "#ffab1e", // "fable"
	weekendbg: "#c0c0c0", // "cocoa"
	holidaybg: "#ffaace", // "face"
	createdbg: "#bbeeff", // "beef"
	modifiedsbg: "#bbeeff", // "beef"
	remindersbg: "#c0ffee", // "coffee"
	holidays: [ "01/01", "07/04", "07/24", "11/24" ], // NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)
	weekend: [ 1,0,0,0,0,0,1 ] // [ day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6 ]
};

config.macros.date.handler = function(place,macroName,params)
{
	// do we want to see a link, a popup, or just a formatted date?
	var mode="display";
	if (params[0]=="display") { mode=params[0]; params.shift(); }
	if (params[0]=="popup") { mode=params[0]; params.shift(); }
	if (params[0]=="link") { mode=params[0]; params.shift(); }
	// get the date
	var now = new Date();
	var date = now;
	if (!params[0] || params[0]=="today")
		{ params.shift(); }
	else if (params[0]=="filedate")
		{ date=new Date(document.lastModified); params.shift(); }
	else if (params[0]=="tiddler")
		{ date=store.getTiddler(story.findContainingTiddler(place).id.substr(7)).modified; params.shift(); }
	else if (params[0].substr(0,8)=="tiddler:")
		{ var t; if ((t=store.getTiddler(params[0].substr(8)))) date=t.modified; params.shift(); }
	else {
		var y = eval(params.shift().replace(/Y/ig,(now.getYear()<1900)?now.getYear()+1900:now.getYear()));
		var m = eval(params.shift().replace(/M/ig,now.getMonth()+1));
		var d = eval(params.shift().replace(/D/ig,now.getDate()+0));
		date = new Date(y,m-1,d);
	}
	// date format with optional custom override
	var format=this.format; if (params[0]) format=params.shift();
	var linkformat=this.linkformat; if (params[0]) linkformat=params.shift();
	showDate(place,date,mode,format,linkformat);
}

window.showDate=showDate;
function showDate(place,date,mode,format,linkformat,autostyle,weekend)
{
	if (!mode) mode="display";
	if (!format) format=config.macros.date.format;
	if (!linkformat) linkformat=config.macros.date.linkformat;
	if (!autostyle) autostyle=false;

	// format the date output
	var title = date.formatString(format);
	var linkto = date.formatString(linkformat);

	// just show the formatted output
	if (mode=="display") { place.appendChild(document.createTextNode(title)); return; }

	// link to a 'dated tiddler'
	var link = createTiddlyLink(place, linkto, false);
	link.appendChild(document.createTextNode(title));
	link.title = linkto;
	link.date = date;
	link.format = format;
	link.linkformat = linkformat;

	// if using a popup menu, replace click handler for dated tiddler link
	// with handler for popup and make link text non-italic (i.e., an 'existing link' look)
	if (mode=="popup") {
		link.onclick = onClickDatePopup;
		link.style.fontStyle="normal";
	}
	// format the popup link to show what kind of info it contains (for use with calendar generators)
	if (autostyle) setDateStyle(place,link,weekend);
}
//}}}

//{{{
// NOTE: This function provides default logic for setting the date style when displayed in a calendar
// To customize the date style logic, please see[[DatePluginConfig]]
function setDateStyle(place,link,weekend) {
	// alias variable names for code readability
	var date=link.date;
	var fmt=link.linkformat;
	var linkto=date.formatString(fmt);
	var cmd=config.macros.date;

	if ((weekend!==undefined?weekend:isWeekend(date))&&(cmd.weekendbg!=""))
		{ place.style.background = cmd.weekendbg; }
	if (hasModifieds(date)||hasCreateds(date)||hasTagged(date,fmt))
		{ link.style.fontStyle="normal"; link.style.fontWeight="bold"; }
	if (hasReminders(date))
		{ link.style.textDecoration="underline"; }
	if (isToday(date))
		{ link.style.border="1px solid black"; }
	if (isHoliday(date)&&(cmd.holidaybg!=""))
		{ place.style.background = cmd.holidaybg; }
	if (hasCreateds(date)&&(cmd.createdbg!=""))
		{ place.style.background = cmd.createdbg; }
	if (hasModifieds(date)&&(cmd.modifiedsbg!=""))
		{ place.style.background = cmd.modifiedsbg; }
	if ((hasTagged(date,fmt)||store.tiddlerExists(linkto))&&(cmd.linkedbg!=""))
		{ place.style.background = cmd.linkedbg; }
	if (hasReminders(date)&&(cmd.remindersbg!=""))
		{ place.style.background = cmd.remindersbg; }
	if (isToday(date)&&(cmd.todaybg!=""))
		{ place.style.background = cmd.todaybg; }
	if (config.options.chkShowJulianDate) { // optional display of Julian date numbers
		var m=[0,31,59,90,120,151,181,212,243,273,304,334];
		var d=date.getDate()+m[date.getMonth()];
		var y=date.getFullYear();
		if (date.getMonth()>1 && (y%4==0 && y%100!=0) || y%400==0)
			d++; // after February in a leap year
		wikify("@@font-size:80%;<br>"+d+"@@",place);
	}

}
//}}}

//{{{
function isToday(date) // returns true if date is today
	{ var now=new Date(); return ((now-date>=0) && (now-date<86400000)); }

function isWeekend(date) // returns true if date is a weekend
	{ return (config.macros.date.weekend[date.getDay()]); }

function isHoliday(date) // returns true if date is a holiday
{
	var longHoliday = date.formatString("0MM/0DD/YYYY");
	var shortHoliday = date.formatString("0MM/0DD");
	for(var i = 0; i < config.macros.date.holidays.length; i++) {
		var holiday=config.macros.date.holidays[i];
		if (holiday==longHoliday||holiday==shortHoliday) return true;
	}
	return false;
}
//}}}

//{{{
// Event handler for clicking on a day popup
function onClickDatePopup(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	var popup = Popup.create(this);
	if(popup) {
		// always show dated tiddler link (or just date, if readOnly) at the top...
		if (!readOnly || store.tiddlerExists(this.date.formatString(this.linkformat)))
			createTiddlyLink(popup,this.date.formatString(this.linkformat),true);
		else
			createTiddlyText(popup,this.date.formatString(this.linkformat));
		if (!config.options.chkDatePopupHideCreated)
			addCreatedsToPopup(popup,this.date,this.format);
		if (!config.options.chkDatePopupHideChanged)
			addModifiedsToPopup(popup,this.date,this.format);
		if (!config.options.chkDatePopupHideTagged)
			addTaggedToPopup(popup,this.date,this.linkformat);
		if (!config.options.chkDatePopupHideReminders)
			addRemindersToPopup(popup,this.date,this.linkformat);
	}
	Popup.show(popup,false);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return(false);
}
//}}}

//{{{
function indexCreateds() // build list of tiddlers, hash indexed by creation date
{
	var createds= { };
	var tiddlers = store.getTiddlers("title","excludeLists");
	for (var t = 0; t < tiddlers.length; t++) {
		var date = tiddlers[t].created.formatString("YYYY0MM0DD")
		if (!createds[date])
			createds[date]=new Array();
		createds[date].push(tiddlers[t].title);
	}
	return createds;
}
function hasCreateds(date) // returns true if date has created tiddlers
{
	if (!config.macros.date.createds) config.macros.date.createds=indexCreateds();
	return (config.macros.date.createds[date.formatString("YYYY0MM0DD")]!=undefined);
}

function addCreatedsToPopup(popup,when,format)
{
	var force=(store.isDirty() && when.formatString("YYYY0MM0DD")==new Date().formatString("YYYY0MM0DD"));
	if (force || !config.macros.date.createds) config.macros.date.createds=indexCreateds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var createds = config.macros.date.createds[when.formatString("YYYY0MM0DD")];
	if (createds) {
		createds.sort();
		var e=createTiddlyElement(popup,"div",null,null,"created ("+createds.length+")");
		for(var t=0; t<createds.length; t++) {
			var link=createTiddlyLink(popup,createds[t],false);
			link.appendChild(document.createTextNode(indent+createds[t]));
			createTiddlyElement(popup,"br",null,null,null);
		}
	}
}
//}}}

//{{{
function indexModifieds() // build list of tiddlers, hash indexed by modification date
{
	var modifieds= { };
	var tiddlers = store.getTiddlers("title","excludeLists");
	for (var t = 0; t < tiddlers.length; t++) {
		var date = tiddlers[t].modified.formatString("YYYY0MM0DD")
		if (!modifieds[date])
			modifieds[date]=new Array();
		modifieds[date].push(tiddlers[t].title);
	}
	return modifieds;
}
function hasModifieds(date) // returns true if date has modified tiddlers
{
	if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();
	return (config.macros.date.modifieds[date.formatString("YYYY0MM0DD")]!=undefined);
}

function addModifiedsToPopup(popup,when,format)
{
	var date=when.formatString("YYYY0MM0DD");
	var force=(store.isDirty() && date==new Date().formatString("YYYY0MM0DD"));
	if (force || !config.macros.date.modifieds) config.macros.date.modifieds=indexModifieds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var mods = config.macros.date.modifieds[date];
	if (mods) {
		// if a tiddler was created on this date, don't list it in the 'changed' section
		if (config.macros.date.createds && config.macros.date.createds[date]) {
			var temp=[];
			for(var t=0; t<mods.length; t++)
				if (!config.macros.date.createds[date].contains(mods[t]))
					temp.push(mods[t]);
			mods=temp;
		}
		mods.sort();
		var e=createTiddlyElement(popup,"div",null,null,"changed ("+mods.length+")");
		for(var t=0; t<mods.length; t++) {
			var link=createTiddlyLink(popup,mods[t],false);
			link.appendChild(document.createTextNode(indent+mods[t]));
			createTiddlyElement(popup,"br",null,null,null);
		}
	}
}
//}}}

//{{{
function hasTagged(date,format) // returns true if date is tagging other tiddlers
{
	return store.getTaggedTiddlers(date.formatString(format)).length>0;
}

function addTaggedToPopup(popup,when,format)
{
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var tagged=store.getTaggedTiddlers(when.formatString(format));
	if (tagged.length) var e=createTiddlyElement(popup,"div",null,null,"tagged ("+tagged.length+")");
	for(var t=0; t<tagged.length; t++) {
		var link=createTiddlyLink(popup,tagged[t].title,false);
		link.appendChild(document.createTextNode(indent+tagged[t].title));
		createTiddlyElement(popup,"br",null,null,null);
	}
}
//}}}

//{{{
function indexReminders(date,leadtime) // build list of tiddlers with reminders, hash indexed by reminder date
{
	var reminders = { };
	if(window.findTiddlersWithReminders!=undefined) { // reminder plugin is installed
		// DEBUG var starttime=new Date();
		var t = findTiddlersWithReminders(date, [0,leadtime], null, null, 1);
		for(var i=0; i<t.length; i++) reminders[t[i].matchedDate]=true;
		// DEBUG var out="Found "+t.length+" reminders in "+((new Date())-starttime+1)+"ms\n";
		// DEBUG out+="startdate: "+date.toLocaleDateString()+"\n"+"leadtime: "+leadtime+" days\n\n";
		// DEBUG for(var i=0; i<t.length; i++) { out+=t[i].matchedDate.toLocaleDateString()+" "+t[i].params.title+"\n"; }
		// DEBUG alert(out);
	}
	return reminders;
}

function hasReminders(date) // returns true if date has reminders
{
	if (window.reminderCacheForCalendar)
		return window.reminderCacheForCalendar[date]; // use calendar cache
	if (!config.macros.date.reminders)
		config.macros.date.reminders = indexReminders(date,90); // create a 90-day leadtime reminder cache
	return (config.macros.date.reminders[date]);
}

function addRemindersToPopup(popup,when,format)
{
	if(window.findTiddlersWithReminders==undefined) return; // reminder plugin not installed

	var indent = String.fromCharCode(160)+String.fromCharCode(160);
	var reminders=findTiddlersWithReminders(when, [0,31],null,null,1);
	createTiddlyElement(popup,"div",null,null,"reminders ("+(reminders.length||"none")+")");
	for(var t=0; t<reminders.length; t++) {
		link = createTiddlyLink(popup,reminders[t].tiddler,false);
		var diff=reminders[t].diff;
		diff=(diff<1)?"Today":((diff==1)?"Tomorrow":diff+" days");
		var txt=(reminders[t].params["title"])?reminders[t].params["title"]:reminders[t].tiddler;
		link.appendChild(document.createTextNode(indent+diff+" - "+txt));
		createTiddlyElement(popup,"br",null,null,null);
	}
	if (readOnly) return;	// omit "new reminder..." link
	var link = createTiddlyLink(popup,indent+"new reminder...",true); createTiddlyElement(popup,"br");
	var title = when.formatString(format);
	link.title="add a reminder to '"+title+"'";
	link.onclick = function() {
		// show tiddler editor
		story.displayTiddler(null, title, 2, null, null, false, false);
		// find body 'textarea'
		var c =document.getElementById("tiddler" + title).getElementsByTagName("*");
		for (var i=0; i<c.length; i++) if ((c[i].tagName.toLowerCase()=="textarea") && (c[i].getAttribute("edit")=="text")) break;
		// append reminder macro to tiddler content
		if (i<c.length) {
			if (store.tiddlerExists(title)) c[i].value+="\n"; else c[i].value="";
			c[i].value += "<<reminder";
			c[i].value += " day:"+when.getDate();
			c[i].value += " month:"+(when.getMonth()+1);
			c[i].value += " year:"+when.getFullYear();
			c[i].value += ' title:"Enter a title" >>';
		}
	};
}
//}}}
//{{{

config.macros.date.holidays=[ ]; // use reminders instead

if (config.options.chkGTDFancyStyle) {
 // these colours are somewhat friendlier to the default d3 menu colour scheme
 config.macros.calendar.weekendbg= "seagreen";
 config.macros.calendar.monthbg = "transparent";

 config.macros.date.weekendbg="seagreen";
 config.macros.date.holidaybg="seagreen";
 config.macros.date.modifiedsbg="transparent";
 config.macros.date.remindersbg="red";
}


//}}}
[[MikeEssinger]]
[[StoneFace]]
[[Summary Review]]

/***
|Name|ExportTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#ExportTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#ExportTiddlersPluginInfo|
|Version|2.7.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|select and extract tiddlers from your ~TiddlyWiki documents and save them to a separate file|
ExportTiddlersPlugin lets you select and extract tiddlers from your ~TiddlyWiki documents using interactive control panel lets you specify a destination, and then select which tiddlers to export. Tiddler data can be output as complete, stand-alone TiddlyWiki documents, or just the selected tiddlers ("~PureStore" format -- smaller files!) that can be imported directly into another ~TiddlyWiki, or as an ~RSS-compatible XML file that can be published for RSS syndication.
!!!!!Documentation
>see [[ExportTiddlersPluginInfo]]
!!!!!Inline control panel (live):
><<exportTiddlers inline>>
!!!!!Revisions
<<<
2008.05.27 [2.7.0] added ability to 'merge' with existing export file. Also, revised 'matchTags' functionality to be more robust and more efficient
|please see [[ExportTiddlersPluginInfo]] for additional revision details|
2005.10.09 [0.0.0] development started
<<<
!!!!!Code
***/
//{{{
// version
version.extensions.exportTiddlers = {major: 2, minor: 7, revision: 0, date: new Date(2008,5,27)};

// default shadow definition
config.shadowTiddlers.ExportTiddlers="<<exportTiddlers inline>>";

// add 'export' backstage task (following built-in import task)
if (config.tasks) { // TW2.2 or above
	config.tasks.exportTask = {
		text:"export",
		tooltip:"Export selected tiddlers to another file",
		content:"<<exportTiddlers inline>>"
	}
	config.backstageTasks.splice(config.backstageTasks.indexOf("importTask")+1,0,"exportTask");
}

// macro handler
config.macros.exportTiddlers = {
	label: "export tiddlers",
	prompt: "Copy selected tiddlers to an export document",
	newdefault: "export.html",
	datetimefmt: "0MM/0DD/YYYY 0hh:0mm:0ss" // for "filter date/time" edit fields
};

config.macros.exportTiddlers.handler = function(place,macroName,params) {
	if (params[0]!="inline")
		{ createTiddlyButton(place,this.label,this.prompt,onClickExportMenu); return; }
	var panel=createExportPanel(place);
	panel.style.position="static";
	panel.style.display="block";
}

function createExportPanel(place) {
	var panel=document.getElementById("exportPanel");
	if (panel) { panel.parentNode.removeChild(panel); }
	setStylesheet(config.macros.exportTiddlers.css,"exportTiddlers");
	panel=createTiddlyElement(place,"span","exportPanel",null,null)
	panel.innerHTML=config.macros.exportTiddlers.html;
	exportInitFilter();
	refreshExportList(0);
	var fn=document.getElementById("exportFilename");
	if (window.location.protocol=="file:" && !fn.value.length) {
		// get new target path/filename
		var newPath=getLocalPath(window.location.href);
		var slashpos=newPath.lastIndexOf("/"); if (slashpos==-1) slashpos=newPath.lastIndexOf("\\"); 
		if (slashpos!=-1) newPath=newPath.substr(0,slashpos+1); // trim filename
		fn.value=newPath+config.macros.exportTiddlers.newdefault;
	}
	return panel;
}

function onClickExportMenu(e)
{
	if (!e) var e = window.event;
	var parent=resolveTarget(e).parentNode;
	var panel = document.getElementById("exportPanel");
	if (panel==undefined || panel.parentNode!=parent)
		panel=createExportPanel(parent);
	var isOpen = panel.style.display=="block";
	if(config.options.chkAnimate)
		anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,"none"));
	else
		panel.style.display = isOpen ? "none" : "block" ;
	if (panel.style.display!="none") { // update list and set focus when panel is made visible
		refreshExportList(0);
		var fn=document.getElementById("exportFilename"); fn.focus(); fn.select();
	}
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return(false);
}
//}}}

// // IE needs explicit scoping for functions called by browser events
//{{{
window.onClickExportMenu=onClickExportMenu;
window.onClickExportButton=onClickExportButton;
window.exportShowFilterFields=exportShowFilterFields;
window.refreshExportList=refreshExportList;
//}}}

// // CSS for floating export control panel
//{{{
config.macros.exportTiddlers.css = '\
#exportPanel {\
	display: none; position:absolute; z-index:12; width:35em; right:105%; top:6em;\
	background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
	border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
	padding: 0.5em; margin:0em; -moz-border-radius:1em;\
}\
#exportPanel a, #exportPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\
#exportPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\
#exportPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\
#exportPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\
#exportPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\
#exportPanel input  { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%; }\
#exportPanel textarea  { width:98%;padding:0px;margin:0px;overflow:auto;font-size:8pt; }\
#exportPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px; }\
#exportPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\
#exportPanel .rad { width:auto;border:0 }\
#exportPanel .chk { width:auto;border:0 }\
#exportPanel .btn { width:auto; }\
#exportPanel .btn1 { width:98%; }\
#exportPanel .btn2 { width:48%; }\
#exportPanel .btn3 { width:32%; }\
#exportPanel .btn4 { width:24%; }\
#exportPanel .btn5 { width:19%; }\
';
//}}}

// // HTML for export control panel interface
//{{{
config.macros.exportTiddlers.html = '\
<!-- target path/file  -->\
<div>\
export to path/filename:<br>\
<input type="text" id="exportFilename" size=40 style="width:93%"><input \
	type="button" id="exportBrowse" value="..." title="select or enter a local folder/file..." style="width:5%" \
	onclick="var fn=window.promptForExportFilename(this); if (fn.length) this.previousSibling.value=fn; ">\
</div>\
\
<!-- output format -->\
<div>\
output file format:\
<select id="exportFormat" size=1>\
<option value="TW">TiddlyWiki document (includes core code)</option>\
<option value="DIV">TiddlyWiki "PureStore" file (tiddler data only)</option>\
<option value="XML">XML (for RSS newsfeed)</option>\
</select>\
</div>\
\
<!-- notes -->\
<div>\
notes:<br>\
<textarea id="exportNotes" rows=3 cols=40 style="height:4em;margin-bottom:5px;" onfocus="this.select()"></textarea> \
</div>\
\
<!-- list of tiddlers -->\
<table><tr align="left"><td>\
	select:\
	<a href="JavaScript:;" id="exportSelectAll"\
		onclick="onClickExportButton(this)" title="select all tiddlers">\
		&nbsp;all&nbsp;</a>\
	<a href="JavaScript:;" id="exportSelectChanges"\
		onclick="onClickExportButton(this)" title="select tiddlers changed since last save">\
		&nbsp;changes&nbsp;</a> \
	<a href="JavaScript:;" id="exportSelectOpened"\
		onclick="onClickExportButton(this)" title="select tiddlers currently being displayed">\
		&nbsp;opened&nbsp;</a> \
	<a href="JavaScript:;" id="exportSelectRelated"\
		onclick="onClickExportButton(this)" title="select all tiddlers related (by link or transclusion) to the currently selected tiddlers">\
		&nbsp;related&nbsp;</a> \
	<a href="JavaScript:;" id="exportToggleFilter"\
		onclick="onClickExportButton(this)" title="show/hide selection filter">\
		&nbsp;filter&nbsp;</a>  \
</td><td align="right">\
	<a href="JavaScript:;" id="exportListSmaller"\
		onclick="onClickExportButton(this)" title="reduce list size">\
		&nbsp;&#150;&nbsp;</a>\
	<a href="JavaScript:;" id="exportListLarger"\
		onclick="onClickExportButton(this)" title="increase list size">\
		&nbsp;+&nbsp;</a>\
</td></tr></table>\
<select id="exportList" multiple size="10" style="margin-bottom:5px;"\
	onchange="refreshExportList(this.selectedIndex)">\
</select><br>\
</div><!--box-->\
\
<!-- selection filter -->\
<div id="exportFilterPanel" style="display:none">\
<table><tr align="left"><td>\
	selection filter\
</td><td align="right">\
	<a href="JavaScript:;" id="exportHideFilter"\
		onclick="onClickExportButton(this)" title="hide selection filter">hide</a>\
</td></tr></table>\
<div class="box">\
<input type="checkbox" class="chk" id="exportFilterStart" value="1"\
	onclick="exportShowFilterFields(this)"> starting date/time<br>\
<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\
	<select size=1 id="exportFilterStartBy" onchange="exportShowFilterFields(this);">\
		<option value="0">today</option>\
		<option value="1">yesterday</option>\
		<option value="7">a week ago</option>\
		<option value="30">a month ago</option>\
		<option value="site">SiteDate</option>\
		<option value="file">file date</option>\
		<option value="other">other (mm/dd/yyyy hh:mm)</option>\
	</select>\
</td><td width="50%">\
	<input type="text" id="exportStartDate" onfocus="this.select()"\
		onchange="document.getElementById(\'exportFilterStartBy\').value=\'other\';">\
</td></tr></table>\
<input type="checkbox" class="chk" id="exportFilterEnd" value="1"\
	onclick="exportShowFilterFields(this)"> ending date/time<br>\
<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\
	<select size=1 id="exportFilterEndBy" onchange="exportShowFilterFields(this);">\
		<option value="0">today</option>\
		<option value="1">yesterday</option>\
		<option value="7">a week ago</option>\
		<option value="30">a month ago</option>\
		<option value="site">SiteDate</option>\
		<option value="file">file date</option>\
		<option value="other">other (mm/dd/yyyy hh:mm)</option>\
	</select>\
</td><td width="50%">\
	<input type="text" id="exportEndDate" onfocus="this.select()"\
		onchange="document.getElementById(\'exportFilterEndBy\').value=\'other\';">\
</td></tr></table>\
<input type="checkbox" class="chk" id=exportFilterTags value="1"\
	onclick="exportShowFilterFields(this)"> match tags<br>\
<input type="text" id="exportTags" onfocus="this.select()">\
<input type="checkbox" class="chk" id=exportFilterText value="1"\
	onclick="exportShowFilterFields(this)"> match titles/tiddler text<br>\
<input type="text" id="exportText" onfocus="this.select()">\
</div> <!--box-->\
</div> <!--panel-->\
\
<!-- action buttons -->\
<div style="text-align:center">\
<input type=button class="btn4" onclick="onClickExportButton(this)"\
	id="exportFilter" value="apply filter">\
<input type=button class="btn4" onclick="onClickExportButton(this)"\
	id="exportStart" value="export tiddlers">\
<input type=button class="btn4" onclick="onClickExportButton(this)"\
	id="exportDelete" value="delete tiddlers">\
<input type=button class="btn4" onclick="onClickExportButton(this)"\
	id="exportClose" value="close">\
</div><!--center-->\
';
//}}}

// // initialize interface

// // exportInitFilter()
//{{{
function exportInitFilter() {
	// start date
	document.getElementById("exportFilterStart").checked=false;
	document.getElementById("exportStartDate").value="";
	// end date
	document.getElementById("exportFilterEnd").checked=false;
	document.getElementById("exportEndDate").value="";
	// tags
	document.getElementById("exportFilterTags").checked=false;
	document.getElementById("exportTags").value="";
	// text
	document.getElementById("exportFilterText").checked=false;
	document.getElementById("exportText").value="";
	// show/hide filter input fields
	exportShowFilterFields();
}
//}}}

// // exportShowFilterFields(which)
//{{{
function exportShowFilterFields(which) {
	var show;

	show=document.getElementById('exportFilterStart').checked;
	document.getElementById('exportFilterStartBy').style.display=show?"block":"none";
	document.getElementById('exportStartDate').style.display=show?"block":"none";
	var val=document.getElementById('exportFilterStartBy').value;
	document.getElementById('exportStartDate').value
		=getFilterDate(val,'exportStartDate').formatString(config.macros.exportTiddlers.datetimefmt);
	 if (which && (which.id=='exportFilterStartBy') && (val=='other'))
		document.getElementById('exportStartDate').focus();

	show=document.getElementById('exportFilterEnd').checked;
	document.getElementById('exportFilterEndBy').style.display=show?"block":"none";
	document.getElementById('exportEndDate').style.display=show?"block":"none";
	var val=document.getElementById('exportFilterEndBy').value;
	document.getElementById('exportEndDate').value
		=getFilterDate(val,'exportEndDate').formatString(config.macros.exportTiddlers.datetimefmt);
	 if (which && (which.id=='exportFilterEndBy') && (val=='other'))
		document.getElementById('exportEndDate').focus();

	show=document.getElementById('exportFilterTags').checked;
	document.getElementById('exportTags').style.display=show?"block":"none";

	show=document.getElementById('exportFilterText').checked;
	document.getElementById('exportText').style.display=show?"block":"none";
}
//}}}

// // onClickExportButton(which): control interactions
//{{{
function onClickExportButton(which)
{
	// DEBUG alert(which.id);
	var theList=document.getElementById('exportList'); if (!theList) return;
	var count = 0;
	var total = store.getTiddlers('title').length;
	switch (which.id)
		{
		case 'exportFilter':
			count=filterExportList();
			var panel=document.getElementById('exportFilterPanel');
			if (count==-1) { panel.style.display='block'; break; }
			document.getElementById("exportStart").disabled=(count==0);
			document.getElementById("exportDelete").disabled=(count==0);
			clearMessage(); displayMessage("filtered "+formatExportMessage(count,total));
			if (count==0) { alert("No tiddlers were selected"); panel.style.display='block'; }
			break;
		case 'exportStart':
			exportTiddlers();
			break;
		case 'exportDelete':
			exportDeleteTiddlers();
			break;
		case 'exportHideFilter':
		case 'exportToggleFilter':
			var panel=document.getElementById('exportFilterPanel')
			panel.style.display=(panel.style.display=='block')?'none':'block';
			break;
		case 'exportSelectChanges':
			var lastmod=new Date(document.lastModified);
			for (var t = 0; t < theList.options.length; t++) {
				if (theList.options[t].value=="") continue;
				var tiddler=store.getTiddler(theList.options[t].value); if (!tiddler) continue;
				theList.options[t].selected=(tiddler.modified>lastmod);
				count += (tiddler.modified>lastmod)?1:0;
			}
			document.getElementById("exportStart").disabled=(count==0);
			document.getElementById("exportDelete").disabled=(count==0);
			clearMessage(); displayMessage(formatExportMessage(count,total));
			if (count==0) alert("There are no unsaved changes");
			break;
		case 'exportSelectAll':
			for (var t = 0; t < theList.options.length; t++) {
				if (theList.options[t].value=="") continue;
				theList.options[t].selected=true;
				count += 1;
			}
			document.getElementById("exportStart").disabled=(count==0);
			document.getElementById("exportDelete").disabled=(count==0);
			clearMessage(); displayMessage(formatExportMessage(count,count));
			break;
		case 'exportSelectOpened':
			for (var t = 0; t < theList.options.length; t++) theList.options[t].selected=false;
			var tiddlerDisplay = document.getElementById("tiddlerDisplay"); // for TW2.1-
			if (!tiddlerDisplay) tiddlerDisplay = document.getElementById("storyDisplay"); // for TW2.2+
			for (var t=0;t<tiddlerDisplay.childNodes.length;t++) {
				var tiddler=tiddlerDisplay.childNodes[t].id.substr(7);
				for (var i = 0; i < theList.options.length; i++) {
					if (theList.options[i].value!=tiddler) continue;
					theList.options[i].selected=true; count++; break;
				}
			}
			document.getElementById("exportStart").disabled=(count==0);
			document.getElementById("exportDelete").disabled=(count==0);
			clearMessage(); displayMessage(formatExportMessage(count,total));
			if (count==0) alert("There are no tiddlers currently opened");
			break;
		case 'exportSelectRelated':
			// recursively build list of related tiddlers
			function getRelatedTiddlers(tid,tids) {
				var t=store.getTiddler(tid); if (!t || tids.contains(tid)) return tids;
				tids.push(t.title);
				if (!t.linksUpdated) t.changed();
				for (var i=0; i<t.links.length; i++)
					if (t.links[i]!=tid) tids=getRelatedTiddlers(t.links[i],tids);
				return tids;
			}
			// for all currently selected tiddlers, gather up the related tiddlers (including self) and select them as well
			var tids=[];
			for (var i=0; i<theList.options.length; i++)
				if (theList.options[i].selected) tids=getRelatedTiddlers(theList.options[i].value,tids);
			// select related tiddlers (includes original selected tiddlers)
			for (var i=0; i<theList.options.length; i++)
				theList.options[i].selected=tids.contains(theList.options[i].value);
			clearMessage(); displayMessage(formatExportMessage(tids.length,total));
			break;
		case 'exportListSmaller':	// decrease current listbox size
			var min=5;
			theList.size-=(theList.size>min)?1:0;
			break;
		case 'exportListLarger':	// increase current listbox size
			var max=(theList.options.length>25)?theList.options.length:25;
			theList.size+=(theList.size<max)?1:0;
			break;
		case 'exportClose':
			document.getElementById('exportPanel').style.display='none';
			break;
		}
}
//}}}

// // promptForFilename(msg,path,file) uses platform/browser specific functions to get local filespec
//{{{
window.promptForExportFilename=function(here)
{
	var msg=here.title; // use tooltip as dialog box message
	var path=getLocalPath(document.location.href);
	var slashpos=path.lastIndexOf("/"); if (slashpos==-1) slashpos=path.lastIndexOf("\\"); 
	if (slashpos!=-1) path = path.substr(0,slashpos+1); // remove filename from path, leave the trailing slash
	var file=config.macros.exportTiddlers.newdefault;
	var result="";
	if(window.Components) { // moz
		try {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
			var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
			var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
			picker.init(window, msg, nsIFilePicker.modeSave);
			var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
			thispath.initWithPath(path);
			picker.displayDirectory=thispath;
			picker.defaultExtension='html';
			picker.defaultString=file;
			picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
			if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
		}
		catch(e) { alert('error during local file access: '+e.toString()) }
	}
	else { // IE
		try { // XPSP2 IE only
			var s = new ActiveXObject('UserAccounts.CommonDialog');
			s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
			s.FilterIndex=3; // default to HTML files;
			s.InitialDir=path;
			s.FileName=file;
			if (s.showOpen()) var result=s.FileName;
		}
		catch(e) {  // fallback
			var result=prompt(msg,path+file);
		}
	}
	return result;
}
//}}}

// // list display
//{{{
function formatExportMessage(count,total)
{
	var txt=total+' tiddler'+((total!=1)?'s':'')+" - ";
	txt += (count==0)?"none":(count==total)?"all":count;
	txt += " selected for export";
	return txt;
}

function refreshExportList(selectedIndex)
{
	var theList  = document.getElementById("exportList");
	var sort;
	if (!theList) return;
	// get the sort order
	if (!selectedIndex)   selectedIndex=0;
	if (selectedIndex==0) sort='modified';
	if (selectedIndex==1) sort='title';
	if (selectedIndex==2) sort='modified';
	if (selectedIndex==3) sort='modifier';
	if (selectedIndex==4) sort='tags';

	// unselect headings and count number of tiddlers actually selected
	var count=0;
	for (var t=5; t < theList.options.length; t++) {
		if (!theList.options[t].selected) continue;
		if (theList.options[t].value!="")
			count++;
		else { // if heading is selected, deselect it, and then select and count all in section
			theList.options[t].selected=false;
			for ( t++; t<theList.options.length && theList.options[t].value!=""; t++) {
				theList.options[t].selected=true;
				count++;
			}
		}
	}

	// disable "export" and "delete" buttons if no tiddlers selected
	document.getElementById("exportStart").disabled=(count==0);
	document.getElementById("exportDelete").disabled=(count==0);
	// show selection count
	var tiddlers = store.getTiddlers('title');
	if (theList.options.length) { clearMessage(); displayMessage(formatExportMessage(count,tiddlers.length)); }

	// if a [command] item, reload list... otherwise, no further refresh needed
	if (selectedIndex>4)  return;

	// clear current list contents
	while (theList.length > 0) { theList.options[0] = null; }
	// add heading and control items to list
	var i=0;
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	theList.options[i++]=
		new Option(tiddlers.length+" tiddlers in document", "",false,false);
	theList.options[i++]=
		new Option(((sort=="title"        )?">":indent)+' [by title]', "",false,false);
	theList.options[i++]=
		new Option(((sort=="modified")?">":indent)+' [by date]', "",false,false);
	theList.options[i++]=
		new Option(((sort=="modifier")?">":indent)+' [by author]', "",false,false);
	theList.options[i++]=
		new Option(((sort=="tags"	)?">":indent)+' [by tags]', "",false,false);
	// output the tiddler list
	switch(sort)
		{
		case "title":
			for(var t = 0; t < tiddlers.length; t++)
				theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);
			break;
		case "modifier":
		case "modified":
			var tiddlers = store.getTiddlers(sort);
			// sort descending for newest date first
			tiddlers.sort(function (a,b) {if(a[sort] == b[sort]) return(0); else return (a[sort] > b[sort]) ? -1 : +1; });
			var lastSection = "";
			for(var t = 0; t < tiddlers.length; t++)
				{
				var tiddler = tiddlers[t];
				var theSection = "";
				if (sort=="modified") theSection=tiddler.modified.toLocaleDateString();
				if (sort=="modifier") theSection=tiddler.modifier;
				if (theSection != lastSection)
					{
					theList.options[i++] = new Option(theSection,"",false,false);
					lastSection = theSection;
					}
				theList.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);
				}
			 break;
		case "tags":
			var theTitles = {}; // all tiddler titles, hash indexed by tag value
			var theTags = new Array();
			for(var t=0; t<tiddlers.length; t++) {
				var title=tiddlers[t].title;
				var tags=tiddlers[t].tags;
				if (!tags || !tags.length) {
					if (theTitles["untagged"]==undefined) { theTags.push("untagged"); theTitles["untagged"]=new Array(); }
					theTitles["untagged"].push(title);
				}
				else for(var s=0; s<tags.length; s++) {
					if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }
					theTitles[tags[s]].push(title);
				}
			}
			theTags.sort();
			for(var tagindex=0; tagindex<theTags.length; tagindex++) {
				var theTag=theTags[tagindex];
				theList.options[i++]=new Option(theTag,"",false,false);
				for(var t=0; t<theTitles[theTag].length; t++)
					theList.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);
			}
			break;
		}
	theList.selectedIndex=selectedIndex;		  // select current control item
	document.getElementById("exportStart").disabled=true;
	document.getElementById("exportDelete").disabled=true;
	clearMessage(); displayMessage(formatExportMessage(0,tiddlers.length));
}
//}}}

// // list filtering
//{{{
function getFilterDate(val,id)
{
	var result=0;
	switch (val) {
		case 'site':
			var timestamp=store.getTiddlerText("SiteDate");
			if (!timestamp) timestamp=document.lastModified;
			result=new Date(timestamp);
			break;
		case 'file':
			result=new Date(document.lastModified);
			break;
		case 'other':
			result=new Date(document.getElementById(id).value);
			break;
		default: // today=0, yesterday=1, one week=7, two weeks=14, a month=31
			var now=new Date(); var tz=now.getTimezoneOffset()*60000; now-=tz;
			var oneday=86400000;
			if (id=='exportStartDate')
				result=new Date((Math.floor(now/oneday)-val)*oneday+tz);
			else
				result=new Date((Math.floor(now/oneday)-val+1)*oneday+tz-1);
			break;
	}
	// DEBUG alert('getFilterDate('+val+','+id+')=='+result+"\nnow="+now);
	return result;
}

function filterExportList()
{
	var theList  = document.getElementById("exportList"); if (!theList) return -1;

	var filterStart=document.getElementById("exportFilterStart").checked;
	var val=document.getElementById("exportFilterStartBy").value;
	var startDate=getFilterDate(val,'exportStartDate');

	var filterEnd=document.getElementById("exportFilterEnd").checked;
	var val=document.getElementById("exportFilterEndBy").value;
	var endDate=getFilterDate(val,'exportEndDate');

	var filterTags=document.getElementById("exportFilterTags").checked;
	var tags=document.getElementById("exportTags").value;

	var filterText=document.getElementById("exportFilterText").checked;
	var text=document.getElementById("exportText").value;

	if (!(filterStart||filterEnd||filterTags||filterText)) {
		alert("Please set the selection filter");
		document.getElementById('exportFilterPanel').style.display="block";
		return -1;
	}
	if (filterStart&&filterEnd&&(startDate>endDate)) {
		var msg="starting date/time:\n"
		msg+=startDate.toLocaleString()+"\n";
		msg+="is later than ending date/time:\n"
		msg+=endDate.toLocaleString()
		alert(msg);
		return -1;
	}

	// if filter by tags, set up conditional expression
	if (filterTags) {
		var all = store.getTags(); // get list of all tags
		for (var i=0; i<all.length; i++) all[i]=all[i][0]; // remove tag counts
		// convert "tag1 AND ( tag2 OR NOT tag3 )"
		// into javascript expression containing regexp tests:
		// "/\~tag1\~/.test(...) && ( /\~tag2\~/.test(...) || ! /\~tag2\~/.test(...) )"
		var c=tags;
		c = c.replace(/[\[\]]/g,""); // remove [[...]] quoting around tagvalues
		// change AND/OR/NOT/parens to javascript operators and delimit terms with "~"
		c = c.replace(/\sand\s/ig,"~&&~");
		c = c.replace(/\sor\s/ig,"~||~");
		c = c.replace(/(\s)?not([\s\(])/ig,"~!~$2");
		c = c.replace(/([\(\)])/ig,"~$1~");
		// change existing tags to regexp tests and non-existing tags to "false"
		var terms=c.split("~");
		for (var i=0; i<terms.length; i++) { var t=terms[i];
			if (/(&&)|(\|\|)|[!\(\)]/.test(t) || t=="") continue; // skip operators/parens/spaces
			terms[i]=!all.contains(t)?"false":("/\\~"+t+"\\~/.test(tiddlertags)");
		}
		c=terms.join(" ");
	}
	function matchTags(t,c) {
		if (!c||!c.trim().length) return false;
		// assemble tags from tiddler into string "~tag1~tag2~tag3~"
		var tiddlertags = "~"+t.tags.join("~")+"~";
		// eval string against boolean test expression
		try { if(eval(c)) return true; }
		catch(e) { displayMessage(e.toString()); }
		return false;
	}
	
	// scan list and select tiddlers that match all applicable criteria
	var total=0;
	var count=0;
	for (var i=0; i<theList.options.length; i++) {
		// get item, skip non-tiddler list items (section headings)
		var opt=theList.options[i]; if (opt.value=="") continue;
		// get tiddler, skip missing tiddlers (this should NOT happen)
		var tiddler=store.getTiddler(opt.value); if (!tiddler) continue; 
		var sel=true;
		if ( (filterStart && tiddler.modified<startDate)
		|| (filterEnd && tiddler.modified>endDate)
		|| (filterTags && !matchTags(tiddler,c))
		|| (filterText && (tiddler.text.indexOf(text)==-1) && (tiddler.title.indexOf(text)==-1)))
			sel=false;
		opt.selected=sel;
		count+=sel?1:0;
		total++;
	}
	return count;
}
//}}}

// // OUTPUT FORMATTING AND FILE I/O
//{{{
function exportTWHeader()
{
	// get the TiddlyWiki core code source
	var sourcefile=getLocalPath(document.location.href);
	var source=loadFile(sourcefile);
	if(source==null) { alert(config.messages.cantSaveError); return null; }
	// reset existing HTML source markup
	source=updateMarkupBlock(source,"PRE-HEAD");
	source=updateMarkupBlock(source,"POST-HEAD");
	source=updateMarkupBlock(source,"PRE-BODY");
	source=updateMarkupBlock(source,"POST-BODY");
	// find store area
	var posOpeningDiv=source.indexOf(startSaveArea);
	var posClosingDiv=source.lastIndexOf(endSaveArea);
	if((posOpeningDiv==-1)||(posClosingDiv==-1))
		{ alert(config.messages.invalidFileError.format([sourcefile])); return; }
	// return everything up to store area
	return source.substr(0,posOpeningDiv+startSaveArea.length);
}

function exportTWFooter()
{
	// get the TiddlyWiki core code source
	var sourcefile=getLocalPath(document.location.href);
	var source=loadFile(sourcefile);
	if(source==null) { alert(config.messages.cantSaveError); return null; }
	// reset existing HTML source markup
	source=updateMarkupBlock(source,"PRE-HEAD");
	source=updateMarkupBlock(source,"POST-HEAD");
	source=updateMarkupBlock(source,"PRE-BODY");
	source=updateMarkupBlock(source,"POST-BODY");
	// find store area
	var posOpeningDiv=source.indexOf(startSaveArea);
	var posClosingDiv=source.lastIndexOf(endSaveArea);
	if((posOpeningDiv==-1)||(posClosingDiv==-1))
		{ alert(config.messages.invalidFileError.format([sourcefile])); return; }
	// return everything after store area
	return source.substr(posClosingDiv);
}

function exportDIVHeader()
{
	var out=[];
	var now = new Date();
	var title = convertUnicodeToUTF8(wikifyPlain("SiteTitle").htmlEncode());
	var subtitle = convertUnicodeToUTF8(wikifyPlain("SiteSubtitle").htmlEncode());
	var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());
	var twver = version.major+"."+version.minor+"."+version.revision;
	var pver = version.extensions.exportTiddlers.major+"."
		+version.extensions.exportTiddlers.minor+"."+version.extensions.exportTiddlers.revision;
	out.push("<html><body>");
	out.push("<style type=\"text/css\">");
	out.push("#storeArea {display:block;margin:1em;}");
	out.push("#storeArea div");
	out.push("{padding:0.5em;margin:1em;border:2px solid black;height:10em;overflow:auto;}");
	out.push("#javascriptWarning");
	out.push("{width:100%;text-align:left;background-color:#eeeeee;padding:1em;}");
	out.push("</style>");
	out.push("<div id=\"javascriptWarning\">");
	out.push("TiddlyWiki export file<br>");
	out.push("Source"+": <b>"+convertUnicodeToUTF8(document.location.href)+"</b><br>");
	out.push("Title: <b>"+title+"</b><br>");
	out.push("Subtitle: <b>"+subtitle+"</b><br>");
	out.push("Created: <b>"+now.toLocaleString()+"</b> by <b>"+user+"</b><br>");
	out.push("TiddlyWiki "+twver+" / "+"ExportTiddlersPlugin "+pver+"<br>");
	out.push("Notes:<hr><pre>"+document.getElementById("exportNotes").value.replace(/\n/g,"<br>")+"</pre>");
	out.push("</div>");
	out.push("<div id=\"storeArea\">");
	return out;
}

function exportDIVFooter()
{
	return ["</div><!--POST-BODY-START-->\n<!--POST-BODY-END--></body></html>"];
}

function exportXMLHeader()
{
	var out=[];
	var now = new Date();
	var u = store.getTiddlerText("SiteUrl",null);
	var title = convertUnicodeToUTF8(wikifyPlain("SiteTitle").htmlEncode());
	var subtitle = convertUnicodeToUTF8(wikifyPlain("SiteSubtitle").htmlEncode());
	var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());
	var twver = version.major+"."+version.minor+"."+version.revision;
	var pver = version.extensions.exportTiddlers.major+"."
		+version.extensions.exportTiddlers.minor+"."+version.extensions.exportTiddlers.revision;
	out.push("<" + "?xml version=\"1.0\"?" + ">");
	out.push("<rss version=\"2.0\">");
	out.push("<channel>");
	out.push("<title>" + title + "</title>");
	if(u) out.push("<link>" + convertUnicodeToUTF8(u.htmlEncode()) + "</link>");
	out.push("<description>" + subtitle + "</description>");
	out.push("<language>en-us</language>");
	out.push("<copyright>Copyright " + now.getFullYear() + " " + user + "</copyright>");
	out.push("<pubDate>" + now.toGMTString() + "</pubDate>");
	out.push("<lastBuildDate>" + now.toGMTString() + "</lastBuildDate>");
	out.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>");
	out.push("<generator>TiddlyWiki "+twver+" plus ExportTiddlersPlugin "+pver+"</generator>");
	return out;
}

function exportXMLFooter()
{
	return ["</channel></rss>"];
}

function exportData(target,list,fmt)
{
	function getData(s,f,t) { var r="";
		switch (f) {
			case "TW": r=s.getSaver().externalizeTiddler(s,t); break;
			case "DIV": r=t.title+"\n"+s.getSaver().externalizeTiddler(s,t); break;
			case "XML": r=t.saveToRss(store.getTiddlerText("SiteUrl","")); break;
		}
		return convertUnicodeToUTF8(r);
	}

	var out=[]; var tids=[];
	// get selected tiddlers
	for (var i=0; i<list.options.length; i++) {
		var opt=list.options[i]; if (!opt.selected||!opt.value.length) continue;
		var tid=store.getTiddler(opt.value); if (!tid) continue;
		tids.push(tid.title);
		out.push(getData(store,fmt,tid));
	}
	var count=out.length;
	// merge with existing tiddlers
	var text=loadFile(target);
	if (text && text.length) {
		var msg=target+"\nalready contains tiddler definitions.\n";
		msg+="\nPress OK to add new/revised tiddlers to current file contents.";
		msg+="\nPress Cancel to completely replace file contents";
		var remoteStore=new TiddlyWiki();
		if (remoteStore.importTiddlyWiki(text) && confirm(msg)) {
			var existing=remoteStore.getTiddlers("title");
			for (var i=0; i<existing.length; i++)
				if (!tids.contains(existing[i].title))
					out.push(getData(remoteStore,fmt,existing[i]));
			var msg="Merged %0 new/revised tiddlers and %1 existing tiddlers";
			displayMessage(msg.format([count,out.length-count]));
		}
	}
	return out;
}
//}}}

// // exportTiddlers(): output selected data to local file
//{{{
function exportTiddlers()
{
	clearMessage();
	var list  = document.getElementById("exportList"); if (!list) return;
	var fmt = document.getElementById("exportFormat").value;
	var target = document.getElementById("exportFilename").value.trim();
	if (!target.length) {
		displayMessage("A local target path/filename is required",target);
		return;
	}
	switch (fmt) {
		case "TW":	var head=exportTWHeader(); break;
		case "DIV":	var head=exportDIVHeader(); break;
		case "XML":	var head=exportXMLHeader(); break;
	}
	var theData=exportData(target,list,fmt);
	var c=theData.length;
	switch (fmt) {
		case "TW":	var foot=exportTWFooter(); break;
		case "DIV":	var foot=exportDIVFooter(); break;
		case "XML":	var foot=exportXMLFooter(); break;
	}
	var out=[]; var txt=out.concat(head,theData,foot).join("\n");
	var msg="An error occurred while saving to "+target;
	if (saveFile(target,txt)) msg=c+" tiddler"+((c!=1)?"s":"")+" written to "+target;
	displayMessage(msg,"file:///"+target);
}
//}}}

// // exportDeleteTiddlers(): delete selected tiddlers from file
//{{{
function exportDeleteTiddlers()
{
	var list=document.getElementById("exportList"); if (!list) return;
	var tids=[];
	for (i=0;i<list.length;i++)
		if (list.options[i].selected && list.options[i].value.length)
			tids.push(list.options[i].value);
	if (!confirm("Are you sure you want to delete these tiddlers:\n\n"+tids.join(', '))) return;
	store.suspendNotifications();
	for (t=0;t<tids.length;t++) {
		var tid=store.getTiddler(tids[t]); if (!tid) continue;
		if (tid.tags.contains("systemConfig"))
			if (!confirm("'"+tid.title+"' is tagged with 'systemConfig'.\n\nRemoving this tiddler may cause unexpected results.  Are you sure?"))
				continue;
		store.removeTiddler(tid.title);
		story.closeTiddler(tid.title);
	}
	store.resumeNotifications();
	alert(tids.length+" tiddlers deleted");
	refreshExportList(0); // reload listbox
	store.notifyAll(); // update page display
}
//}}}
+++(gtdProjectsSliderState)[Projects]<<tiddler ProjectList>>===
+++(gtdActionsSliderState)[Actions]<<list tagged context>>===
+++(gtdReviewSliderState)[Review]
*[[Summary Review]]
*[[Project Review]]
*[[Action Review]]
*[[Reminders]]
===

<<newTiddler label:"Create new project" prompt:"Create a new project" title:"NewProject" tag:"project" text:{{store.getTiddlerText('NewProjectTemplate')}} focus:title>> <<newTiddler label:"Create new context" prompt:"Create a new context" title:"NewContext" tag:"context" text:{{store.getTiddlerText('NewContextTemplate')}} focus:title">> <<newTiddler label:"Create new action" prompt:"Create a new action" title:"NewAction" tag:"action" text:{{store.getTiddlerText('NewActionTemplate')}} focus:title>>
[[Ticklers]] +++(gtdReferenceSliderState)[Reference]<<list tagged reference>>=== +++(gtdSomedaySliderState)[Someday-Maybe]<<list tagged someday>>===
+++[Calendar|Show a calendar]<<calendar thismonth>>===

[[Configuration|Configuration Options]] [[Check for Updates|UpdateApplication]] [[Archives]]
/***
|''Name:''|GTDPlugins|
|''Description:''|Plugin to support Getting Things Done|
|''Version:''|<<gtdVersion>>|
|''Date:''|October 27, 2008|
|''Source:''|http://www.dcubed.ca/|
|''Author:''|Tom Otvos|
|''CoreVersion:''|2.4|
|''Browser:''|Firefox 1.5+; InternetExplorer 6.0+; Safari 3.1+|
***/

/***
''Macros:''
*{{{<<gtdAction "}}}//title//{{{" "}}}//context list//{{{">>}}}
*{{{<<gtdActionList {"}}}//context list//{{{" | "*" | "@" {"all" | "noproject" | "projectonly"} }>>}}}
** //if no parameters are specified, current context or project is used//
** //specify "*" for actions across all projects, "@" for incomplete actions across all contexts (or "all" for all actions)//
** //use "projectonly" or "noproject" to filter actions by project association//
*{{{<<list tagged "}}}//tag list//{{{" {any | all}>>}}}
** //if no parameters are specified, all tags are necessary//
*{{{<<gtdActionCompleted>>}}}
*{{{<<gtdToggleTag>>}}}
*{{{<<gtdToggleState>>}}}
*{{{<<importUpdates "}}}//url//{{{" {updates | all} "}}}//buttonTitle//{{{" "}}}//buttonHelp//{{{" "}}}//loadTiddlers params...//{{{">>}}}
*{{{<<gtdArchive { archive | unarchive | purge }>>}}}

''Commands:''
*{{{newAction}}}
*{{{newProjectAction}}}
*{{{changeContext}}}
*{{{deleteAction}}}
*{{{deleteContext}}}
*{{{deleteProject}}}
*{{{deleteProjectAll}}}
*{{{projectify}}}

''Wiki formatting:''
*{{{..new action title|context}}}

***/
//{{{

version.extensions.GTDPlugins = {major: 1, minor: 3, revision: 0, patch: 0 };

var _GTD = {

	lazyAutoSave: 0,
	contextCache: null,
	usingProjectTags: true,
	projectPriorities: [],

	initialize: function ()
	{
		var d = new Date();

		if (config.options.txtGTDReferenceContext == undefined) config.options.txtGTDReferenceContext = "reference";
		if (config.options.txtGTDSomedayContext == undefined) config.options.txtGTDSomedayContext = "someday";
		if (config.options.txtGTDUnfiledContext == undefined) config.options.txtGTDUnfiledContext = "unfiled";
		if (config.options.txtGTDActionAging == undefined) config.options.txtGTDActionAging = "";
		if (config.options.chkGTDFancyStyle == undefined) config.options.chkGTDFancyStyle = true;
		if (config.options.chkGTDLazyAutoSave == undefined) config.options.chkGTDLazyAutoSave = true;
		if (config.options.txtGTDLazyAutoSaveInterval == undefined) config.options.txtGTDLazyAutoSaveInterval = "60";
		if (config.options.txtGTDProjectPriorities == undefined) config.options.txtGTDProjectPriorities = "";
		
		// some tricks to work when our script is loaded from an external file...
		if (!store) config.notifyTiddlers.push( {name: "GTDStyleSheet", notify: refreshStyles} );
		if (!store && config.options.chkGTDFancyStyle) config.notifyTiddlers.push( {name: "GTDTWStyleSheet", notify: refreshStyles} );
		if (!store) config.notifyTiddlers.push( {name: null, notify: _GTD.refreshActionViews} );
		
		this.setReviewUpdate();
		this.setLazyAutoSave();
		
		if (config.options.txtGTDProjectPriorities.length == 0)
			this.projectPriorities = [ "important" ];
		else
			this.projectPriorities = config.options.txtGTDProjectPriorities.split(';');
		
		if (!store) return;
		
		if ((version.major == 2 && version.minor < 1) || !store.tiddlerExists("d3 settings")) {
			// we force a changed() call on all projects, contexts, and actions, to enable them to set up their cross-references
			var tiddlers = [];
			tiddlers = tiddlers.concat(store.getTaggedTiddlers("project"), store.getTaggedTiddlers("context"), store.getTaggedTiddlers("action"));
			for (var i = 0; i < tiddlers.length; i++)
				tiddlers[i].changed();
			
			// if we have tiddler meta data, rebuild it
			if (version.major > 2 || version.minor > 0)
				this.rebuildMetaData();
		}
		else {
			this.initializeFromMetaData();
			this.usingProjectTags = false;
		}
		
		//store.addNotification("GTDStyleSheet", refreshStyles);
		//if (config.options.chkGTDFancyStyle) store.addNotification("GTDTWStyleSheet", refreshStyles);
		store.addNotification(null, _GTD.refreshActionViews);
		
		// force a display of release notes, if required
		var v = version.extensions.GTDPlugins;
		var releaseNotesTiddler = "About version " + v.major + '.' + v.minor + '.' + v.revision;
		if ((config.options.chkGTDReleaseNotes || config.options.chkGTDReleaseNotes == undefined) && store.tiddlerExists(releaseNotesTiddler)) {
			params = "open:\"" + releaseNotesTiddler + "\"";
			params = params.parseParams("open",null,false);
			config.options.chkGTDReleaseNotes = false;
			saveOptionCookie("chkGTDReleaseNotes");
		}

		if (version.major > 2 || version.minor > 0)
			pluginInfo.log.push('Initialized in ' + ((new Date()).getTime() - d.getTime()) + ' milliseconds');
	},
	
	rebuildMetaData: function()
	{
		pluginInfo.log.push('Rebuilding action metadata...');

		store.suspendNotifications();
		var tiddlers = store.getTaggedTiddlers("action");
		for (var i = 0; i < tiddlers.length; i++) {
			var t = tiddlers[i];
			store.setValue(t, "gtd");
			store.setValue(t, "gtd.context", t.gtdContextName);
			if (t.gtdProject) store.setValue(t, "gtd.project", t.gtdProject.title);
			if (t.gtdProject) store.setValue(t, "gtd.projectindex", t.gtdProject.gtdActions.indexOf(t));
			// booo...scary...strip out project tag
			if (t.gtdProject) t.tags.remove(t.gtdProject.title);
		}
		store.resumeNotifications();
			
		var tiddler = store.createTiddler("d3 conversion");
		var s = "Completed document conversion. Do not delete this tiddler unless you want to rebuild the action metadata.\n\nThis tiddler also contains document-specific preferences which, if deleted, will revert to default settings.";
		tiddler.assign("d3 settings", s, config.options.txtUserName, new Date(), ["excludeLists"]);
	},
	
	initializeFromMetaData: function()
	{
		var tiddlers = store.getTaggedTiddlers("action");
		// ??? one possible optimization is to sort action list by project, to avoid repeatedly fetching project tiddler
		for (var i = 0; i < tiddlers.length; i++) {
			var t = tiddlers[i];
			t.gtdActionName = store.getValue(t, "title");
			t.gtdActionDone = this.tiddlerHasTag(t, "done");
			t.gtdProjectName = store.getValue(t, "gtd.project");
			t.gtdContextName = store.getValue(t, "gtd.context");
			if (t.gtdProjectName) {
				t.gtdProject = store.getTiddler(t.gtdProjectName);
				if (t.gtdProject) {
					if (t.gtdProject.gtdActions == undefined) t.gtdProject.gtdActions = [];
					t.gtdProject.gtdActions.push(t);
				}
			}
		}
		
		tiddlers = store.getTaggedTiddlers("project");
		for (i = 0; i < tiddlers.length; i++) {
			t = tiddlers[i];
			if (t.gtdActions) {
				t.gtdActions.sort( 
					function(a,b) { var ai = parseInt(store.getValue(a, "gtd.projectindex")), bi = parseInt(store.getValue(b, "gtd.projectindex")); return (ai < bi) ? -1 : +1; }
				);
			}
			else
				t.gtdActions = [];
			this.setNextAction(t);
		}
		
		tiddlers = this.getCachedContexts();
		for (i = 0; i < tiddlers.length; i++)
			tiddlers[i].gtdContextName = tiddlers[i].title;
	},
	
	tiddlerHasTag: function (tiddler, tag)
	{
		if (typeof(tiddler) == "string") tiddler = store.getTiddler(tiddler);
		return tiddler.isTagged(tag);
	},
	
	tiddlerSwapTag: function (tiddler, oldTag, newTag)
	{
		for (var i = 0; i < tiddler.tags.length; i++)
			if (tiddler.tags[i] == oldTag) {
				tiddler.tags[i] = newTag;
				return true;
			}
		return false;
	},
	
	setExtendedValue: function (tiddler, name, value)
	{
		// this bottleneck safely sets an extended data value, quietly ignoring the request
		// if the setValue function is not available AND it disables notifications during
		// the setValue if it is defined
		
		if (version.major > 2 || version.minor > 0) {
			store.suspendNotifications();
			store.setValue(tiddler, name, value);
			store.resumeNotifications();
		}
	},
	
	tiddlerHasChanged: function (tiddler, doSave)
	{
		tiddler.changed();
		//story.setDirty(tiddler.title, true);
		store.setDirty(true);
		if (this.tiddlerHasTag(tiddler, 'context'))
			this.clearContextCache();
		if (doSave == undefined) doSave = true;
		if (doSave) tiddler.modified = new Date();
		if (config.options.chkAutoSave && doSave)
			saveChanges();
		else if (doSave)
			this.lazyAutoSave++;
	},
	
	tiddlerAgeInDays: function(tiddler)
	{
		var now = new Date();
		return (now.getTime() - tiddler.modified.getTime()) / 1000 / 86400;
	},
	
	filteredTags: function (tags, specialTags, filterTags)
	{
		var resultTags = [];
		specialTags = specialTags.concat(filterTags);
		for (var i = 0; i < tags.length; i++)
			if (!specialTags.contains(tags[i])) resultTags.push(tags[i]);
		return resultTags;
	},
	
	filteredActionTags: function (tags, filterTags)
	{
		return this.filteredTags(tags, [ "action", "done", "floating", "action-archive" ], filterTags);
	},
	
	filteredProjectTags: function (tags, filterTags)
	{
		return this.filteredTags(tags, [ "project", "done", "important", "project-archive" ], filterTags);
	},
	
	qualifiedProjectName: function(p)
	{
		var tags = this.filteredProjectTags(p.tags, []);
		var q = '';
		for (var i = 0; i < tags.length; i++)
			q += tags[i] + '.';
		return q + p.title;
	},
	
	toggleTag: function (tiddler, tag, toggle)
	{
		var tagIndex = -1;
		for (var i = 0; i < tiddler.tags.length; i++)
			if (tiddler.tags[i] == tag) {
				tagIndex = i;
				break;
			}
		
		if (toggle && tagIndex == -1) {
			tiddler.tags.push(tag);
		}
		else if (!toggle && tagIndex != -1) {
			tiddler.tags.splice(tagIndex, 1);
		}
	},
	
	getTiddlerElement: function (tiddler)
	{
		return document.getElementById(story.idPrefix + tiddler.title);
	},
	
	refreshActionViews: function (tiddler)
	{
		if (tiddler) {
			if (typeof(tiddler) == "string") tiddler = store.getTiddler(tiddler);
			if (tiddler) {
				// first refresh the action tiddler
				story.refreshTiddler(tiddler.title, null, true);
				// do not do anything else if we are not an action!
				// no, we still want to do review updates below, so only do the next bit for actions
				// if (!_GTD.tiddlerHasTag(tiddler, "action")) return;
				if (_GTD.tiddlerHasTag(tiddler, "action")) {
					// now refresh all tiddlers that are tags of the action, which should be the context and project
					// no...now use explicit reference to project/context
					//for (var i = 0; i < tiddler.tags.length; i++)
						// ...of course, we don't refresh action-specific state tags
					//	if (tiddler.tags[i] != "action" && tiddler.tags[i] != "done" && tiddler.tags[i] != "floating") {
					//		story.refreshTiddler(tiddler.tags[i], null, true);
					//	}
					if (tiddler.gtdProjectName && tiddler.gtdProjectName.length > 0) story.refreshTiddler(tiddler.gtdProjectName, null, true);
					// because an action change can affect multiple contexts (via next actions), the only way we can ensure that everything
					// gets updated is to refresh all the displayed contexts...hopefully, there won't be many open and DOM lookups fairly snappy
					// if (tiddler.gtdContextName && tiddler.gtdContextName.length > 0) story.refreshTiddler(tiddler.gtdContextName, null, true);
					_GTD.refreshAllContexts();
				}
				else if (_GTD.tiddlerHasTag(tiddler, "context"))
					_GTD.clearContextCache();
			}
		}
	
		var specialTiddlers = store.getTaggedTiddlers("review");
		for (var i = 0; i < specialTiddlers.length; i++)
			if (_GTD.tiddlerHasTag(specialTiddlers[i], "gtd")) {		// only update GTD review tiddlers, as an optimization
				// as a further optimization, we don't refresh tiddlers that aren't actually displayed, and make sure that
				// if they are displayed, they are in view mode, not edit mode
				var el = _GTD.getTiddlerElement(specialTiddlers[i]);
				if (el && el.getAttribute("template") == "reviewViewTemplate")
					story.refreshTiddler(specialTiddlers[i].title, null, true);
			}

	},
	
	appendProjectActionMarkup: function(projectTiddler, actionTitle, actionContext)
	{
		var actionInsertionPoint = -1, actionLeadin = "";
		
		var reActionWikitext = "^\\.{2}([^|\\n]+)(?:\\|?)(.*).*$";
		var reActionMacro = "(.*)<<gtdAction ((?:[^>]|(?:>(?!>)))*)>>.*$";
		var actionRe = new RegExp("(" + reActionWikitext + ")|(" + reActionMacro + ")", "mg");
		do {
			var formatMatch = actionRe.exec(projectTiddler.text);
			if (formatMatch) {
				actionLeadin = (formatMatch[1] ? "" : formatMatch[5]);
				actionInsertionPoint = actionRe.lastIndex;
			}
		} while(formatMatch);
		
		var actionProto = "\n" + actionLeadin + "<<gtdAction \"" + actionTitle + "\" \"" + actionContext + "\">>";
		if (actionInsertionPoint == -1)
			projectTiddler.text += actionProto;
		else
			projectTiddler.text = projectTiddler.text.substring(0, actionInsertionPoint) + actionProto + projectTiddler.text.substr(actionInsertionPoint);
		
		this.tiddlerHasChanged(projectTiddler);
		this.refreshActionViews(projectTiddler);
	},
	
	removeProjectAction: function(projectTiddler, actionTitle)
	{
		var reActionWikitext = "^(\\.{2})[ \\t]*(" + actionTitle + ")[ \\t]*((\\|.*\\n?)|(.*\\n?))";
		var reActionMacro = "(.*<<gtdAction [\"\']?)(" + actionTitle + ")([\"\']?\\s+(?:[^>]|(?:>(?!>)))*>>.*\\n?)";
		projectTiddler.text = projectTiddler.text.replace(new RegExp(reActionWikitext, "mg"), "");
		projectTiddler.text = projectTiddler.text.replace(new RegExp(reActionMacro, "mg"), "");
		projectTiddler.changed();
		story.refreshTiddler(projectTiddler.title, null, true);
	},
	
	setNextAction: function(project)
	{
		if (project.gtdActions == undefined) project.gtdActions = [];
		project.gtdNextAction = null;
		for (var i = 0; i < project.gtdActions.length; i++)
			if (!project.gtdActions[i].gtdActionDone) {
				project.gtdNextAction = project.gtdActions[i];
				project.gtdProjectDone = false;
				this.toggleTag(project, "done", project.gtdProjectDone);
				return;
			}
		// if we get here, project is currently complete
		if (project.gtdActions.length > 0) project.gtdProjectDone = true;
		this.toggleTag(project, "done", project.gtdProjectDone);
	},
	
	clearContextCache: function()
	{
		this.contextCache = null;
	},
	
	getCachedContexts: function()
	{
		if (!this.contextCache) this.contextCache = store.getTaggedTiddlers("context");
		return this.contextCache;
	},
	
	renameCachedContext: function(oldName, newName)
	{
		if (this.contextCache) {
			var index = this.contextCache.indexOf(oldName);
			if (index > -1) this.contextCache[index] = newName;
		}
	},
	
	findActionContext: function(action)
	{
		var context = null;
		
		var contexts = this.getCachedContexts();
		for (var i = 0; i < contexts.length; i++)
			if (_GTD.tiddlerHasTag(action, contexts[i].title)) {
				context = contexts[i].title;
				break;
			}
		
		return context;
	},
	
	refreshAllContexts: function()
	{
		var contexts = this.getCachedContexts();
		for (var i = 0; i < contexts.length; i++)
			story.refreshTiddler(contexts[i].title, null, true);
	},
	
	saveWithForcedBackup: function()
	{
		var saveBackups = config.options.chkSaveBackups;
		config.options.chkSaveBackups = true;
		saveChanges();
		config.options.chkSaveBackups = saveBackups;
	},
	
	isNextAction: function(actionTiddler)
	{
		if (actionTiddler.gtdProject && actionTiddler == actionTiddler.gtdProject.gtdNextAction)
			return true;
		return !actionTiddler.gtdActionDone && this.tiddlerHasTag(actionTiddler, "floating");
	},
	
	setReviewUpdate: function()
	{
		window._GTD = this;
		// having a subminute review update is overkill, but it would be nice to have semi-accurate
		// clock, so we can't have it be longer than a minute between updates
		//window.setTimeout('window._GTD.doReviewUpdate()', 60 * 1000);
		var d = new Date();
		window.setTimeout('window._GTD.doReviewUpdate()', (3600 - 60*d.getMinutes() - d.getSeconds()) * 1000);
	},
	
	doReviewUpdate: function()
	{
		this.refreshActionViews(null);
		this.setReviewUpdate();
	},
	
	setLazyAutoSave: function()
	{
		window._GTD = this;
		var interval = parseInt(config.options.txtGTDLazyAutoSaveInterval, 10);
		interval = isNaN(interval) ? 60 : interval.clamp(0, Number.MAX_VALUE);
		window.setTimeout('window._GTD.doLazyAutoSave()', interval * 1000);
	},
	
	doLazyAutoSave: function()
	{
		if (config.options.chkGTDLazyAutoSave && !config.options.chkAutoSave && (this.lazyAutoSave > 0 || store.isDirty())) {
			this.lazyAutoSave = 0;
			displayMessage('Autosaving changes...');
			saveChanges();
			if (typeof(gtdAutoSaveHook) == "function")
				gtdAutoSaveHook();
			window.setTimeout('clearMessage()', 5 * 1000);
		}
		this.setLazyAutoSave();
	},
	
	projectPriority: function(p)
	{
		var maxPriority = _GTD.projectPriorities.length;
		for (var i = 0; i < maxPriority; i++)
			if (_GTD.tiddlerHasTag(p, _GTD.projectPriorities[i])) return (maxPriority - i);
		return 0;
	},
	
	actionSorter: function(a,b)
	{
		// we now have an extended sort function to try and provide a more useful list of actions, esp. in a context view
		// ... the rule now is that project actions appear before non-project actions
		// ... if two actions have projects, and either project is tagged "important", it will appear first, otherwise actions are alphabetical by project
		// ... if two actions are from the same project, they appear in project action sequence, not alphabetically
		// ... all non-project actions continue to be sorted alphabetically
		
		if (a.gtdProject && b.gtdProject) {
			var aImportance = _GTD.projectPriority(a.gtdProject), bImportance = _GTD.projectPriority(b.gtdProject);
			if (a.gtdProject == b.gtdProject)
				return (a.gtdProject.gtdActions.indexOf(a) < b.gtdProject.gtdActions.indexOf(b)) ? -1 : +1;
			else if (aImportance != bImportance)
				return (aImportance > bImportance) ? -1 : +1;
			else
				return (a.gtdProject.title < b.gtdProject.title) ? -1 : +1;
		}
		else if (a.gtdProject)
			return -1;	// "a" has a project, "b" doesn't, so "a" comes first
		else if (b.gtdProject)
			return +1;	// "b" has a project, "a" doesn't, so "b" comes first
		else {
			var aImportance = _GTD.tiddlerHasTag(a, "important"), bImportance = _GTD.tiddlerHasTag(b, "important");
			if (aImportance && !bImportance)
				return -1;	// "a" is important, "b" is not, so "a" comes first
			else if (bImportance && !aImportance)
				return +1;	// "b" is important, "a" is not, so "a" comes first
			else
				return (a.title < b.title) ? -1 : +1;
		}
	},
	
	projectSorter: function(a,b) 
	{
		
		var aImportance = _GTD.projectPriority(a), bImportance = _GTD.projectPriority(b);
		if (aImportance != bImportance)
			return (aImportance > bImportance) ? -1 : +1;
		else
			return (a.title < b.title) ? -1 : +1;
	}
};

config.macros.gtdVersion = {}
config.macros.gtdVersion.handler = function(place)
{
	var v = version.extensions.GTDPlugins;
	createTiddlyElement(place, "span", null, null, v.major + "." + v.minor + "." + v.revision + (v.patch ? "." + v.patch : "") + (v.beta ? " (beta " + v.beta + ")" : ""));
}

config.macros.list.tagged = {}
config.macros.list.tagged.innerHandler = function(tagList, allTags)
{
	var tiddlers = store.getTaggedTiddlers(tagList[0]);

	if (allTags) {
		var results = [];
		for (var i = 0; i < tiddlers.length; i++) {
			var tiddler = tiddlers[i], hasAllTags = true;
			for (var j = 1; hasAllTags && j < tagList.length; j++) {
				// hasAllTags &= _GTD.tiddlerHasTag(tiddler, tagList[j]);
				hasAllTags &= (tagList[j].charAt(0) == '-') ? !_GTD.tiddlerHasTag(tiddler, tagList[j].substr(1)) : _GTD.tiddlerHasTag(tiddler, tagList[j])
			}
			if (hasAllTags) results.push(tiddlers[i]);
		}
		return results;
	}
	else {
		for (var i = 1; i < tagList.length; i++) {
			var more = store.getTaggedTiddlers(tagList[i]);
			for (var j = 0; j < more.length; j++)
				tiddlers.pushUnique(more[j]);
		}
		return tiddlers;
	}
}
config.macros.list.tagged.handler = function(params) 
{
	var tags = params[1].readBracketedList();
	if (tags.length == 1) {
		if (config.options[tags[0]] == undefined)
			return store.getTaggedTiddlers(tags[0]);
		else
			return store.getTaggedTiddlers(config.options[tags[0]]);
	}
	else if (tags.length > 1) {
		var allTags = (params[2] == undefined || params[2] == 'all');
		var tiddlers = this.innerHandler(tags, allTags);
		tiddlers.sort(function (a,b) {if(a.title == b.title) return(0); else return (a.title < b.title) ? -1 : +1; });
		return tiddlers;
	}
}

config.macros.gtdActionList = {}
config.macros.gtdActionList.handler = function(place,macroName,params)
{
	var theList = createTiddlyElement(place, "ul", null, "gtdActionList");
	var parentTiddlerName = story.findContainingTiddler(place).getAttribute("tiddler");
	
	var allActions = (params[1] == "all");
	var noProjectActions = (params[1] == "noproject");
	var justProjectActions = (params[1] == "projectonly");
	var aging = parseInt(config.options.txtGTDActionAging, 10);
	aging = isNaN(aging) ? 0 : aging.clamp(0, Number.MAX_VALUE);
	
	if (params[0] == "*") {		// review actions for all projects
		var projects = store.getTaggedTiddlers("project");
		// do an importance sort on project list first, so they bubble to the top
		projects.sort(_GTD.projectSorter);
		for (var i = 0; i < projects.length; i++) {
			var project = projects[i];
			// filter projects that have been deferred
			if (_GTD.tiddlerHasTag(project, config.options.txtGTDSomedayContext)) continue;
			if (!allActions) {
				//var skipEmptyProject = true;
				//if (project.gtdActions != undefined && project.gtdActions.length > 0)
				//	for (var k = 0; skipEmptyProject && k < project.gtdActions.length; k++)
				//		skipEmptyProject = project.gtdActions[k].gtdActionDone;
				//if (skipEmptyProject) continue;
				if (project.gtdActions == undefined || project.gtdActions.length == 0 || project.gtdProjectDone) continue;
			}
			// this will present the actions in the same order as they appear in the project
			var theListItem = createTiddlyElement(theList, "li", null, "gtdActionListProject");
			createTiddlyLink(theListItem, project.title, true);
			if (project.gtdActions != undefined && project.gtdActions.length > 0) {
				var subList = createTiddlyElement(theList, "ul", null, "gtdActionList");
				for (var j = 0; j < project.gtdActions.length; j++) {
					var action = project.gtdActions[j];
					// if we are not displaying all actions, filter old completed actions (if specified)
					// if (!allActions && action.gtdActionDone && aging > 0 && _GTD.tiddlerAgeInDays(action) > aging) continue;
					// NEW! we are now filtering all completed actions unless we are displaying all actions
					if (!allActions && action.gtdActionDone) continue;
					var subListItem = createTiddlyElement(subList, "li");
					var el = config.macros.gtdAction.createActionElement(subListItem, action, project.title, action.tags);
				}
			}
		}
	}
	
	else if (params[0] == "@") {	// review actions for all contexts
		var contexts = _GTD.getCachedContexts();
		for (var i = 0; i < contexts.length; i++) {
			var context = contexts[i];
			var actions = config.macros.list.tagged.innerHandler([context.title, "action"], true);
			if (actions.length > 0) {
				var firstAction = true, theListItem, subList;
				actions.sort(_GTD.actionSorter);
				for (var j = 0; j < actions.length; j++) {
					var currentAction = actions[j];
					// special filtering by request...
					if (noProjectActions && currentAction.gtdProject) continue;
					if (justProjectActions && typeof(currentAction.gtdProject) == 'undefined') continue;
					// if we are not displaying all actions, filter completed actions and non-next project actions
					if (!allActions && (currentAction.gtdActionDone || (currentAction.gtdProject && !_GTD.isNextAction(currentAction)))) continue;
					// filter actions for projects that have been deferred
					if (currentAction.gtdProject && _GTD.tiddlerHasTag(currentAction.gtdProject, config.options.txtGTDSomedayContext)) continue;
					if (firstAction) {
						theListItem = createTiddlyElement(theList, "li", null, "gtdActionListContext");
						createTiddlyLink(theListItem, context.title, true);
						subList = createTiddlyElement(theList, "ul", null, "gtdActionList");
						firstAction = false;
					}
					var subListItem = createTiddlyElement(subList, "li");
					var el = config.macros.gtdAction.createActionElement(subListItem, currentAction, context.title, currentAction.tags);
				}
			}
		}
	}
	
	else {		// actions tagged by current tiddler name, or specified tag list as parameter
		var reviewMode = config.options['chkGTDActionListReviewMode' + escape(parentTiddlerName)];
		if (typeof(reviewMode) == 'undefined') reviewMode = false;
		
		// chain to our "tagged" list macro to get the tiddlers first
		var tags = (params.length == 0 || params[0] == "." ? [ parentTiddlerName ] : params[0].readBracketedList());
		tags.push("action");
		var results = config.macros.list.tagged.innerHandler(tags, true);
		results.sort(_GTD.actionSorter);
		for (var t = 0; t < results.length; t++) {
			var action = results[t];
			// special filtering by request...
			if (noProjectActions && action.gtdProject) continue;
			if (justProjectActions && typeof(action.gtdProject) == 'undefined') continue;
			if (action.gtdProject && _GTD.tiddlerHasTag(action.gtdProject, config.options.txtGTDSomedayContext)) continue;
			// if we are not displaying all actions, filter completed actions and non-next project actions
			if (reviewMode && !allActions && (action.gtdActionDone || (action.gtdProject && !_GTD.isNextAction(action)))) continue;
			// if we are not displaying all actions, filter old completed actions (if specified)
			if (!allActions && action.gtdActionDone && aging > 0 && _GTD.tiddlerAgeInDays(action) > aging) continue;
			var theListItem = createTiddlyElement(theList, "li");
			var el = config.macros.gtdAction.createActionElement(theListItem, action, parentTiddlerName, action.tags);
		}
	}
}

config.macros.gtdAction = {}
config.macros.gtdAction.createActionElement = function(place, actionTiddler, filterName, tags)
{
	if (typeof(actionTiddler) == "string") actionTiddler = store.getTiddler(actionTiddler);
	
	var actionElement = createTiddlyElement(place, "span", null, "gtdActionItem");
	
	// oddly, we barf when setting the checkbox type on an input if we use createTiddlyElement...
	var cb = document.createElement("input");
	cb.setAttribute("type", "checkbox");
	cb.setAttribute("actionTiddler", actionTiddler.title);
	cb.onclick = this.onClickDone;
	actionElement.appendChild(cb);
	cb.checked = actionTiddler.gtdActionDone;
	createTiddlyLink(actionElement, actionTiddler.title, true);
	actionElement.className = (actionTiddler.text ? "gtdActionWithContent" : "gtdActionWithoutContent");
	if (actionTiddler.gtdActionDone) actionElement.className += " gtdCompletedActionItem";
	if (_GTD.isNextAction(actionTiddler)) actionElement.className += " gtdNextActionItem";
	
	var filterTags = [], actionTags = [];
	if (actionTiddler.gtdProjectName && actionTiddler.gtdProjectName.length > 0)
		actionTags.push(actionTiddler.gtdProjectName);
	if (actionTiddler.gtdContextName && actionTiddler.gtdContextName.length > 0)
		actionTags.push(actionTiddler.gtdContextName);
	for (var i = 0; i < tags.length; i++) actionTags.pushUnique(tags[i]);
	if (filterName && filterName.length > 0) filterTags.pushUnique(filterName);
	
	actionTags = _GTD.filteredActionTags(actionTags, filterTags);
	if (actionTags.length > 0) {
		createTiddlyText(actionElement, " [ ");
		for (var i = 0; i < actionTags.length; i++) {
			if (i > 0) createTiddlyText(actionElement, ", ");
			createTiddlyLink(actionElement, actionTags[i], true, "actionCrossReference");
		}
		createTiddlyText(actionElement, " ]");
	}
	
	return actionElement;
}

config.macros.gtdAction.onClickDone = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("actionTiddler"));
	if (tiddler) {
		_GTD.toggleTag(tiddler, "done", this.checked);
		tiddler.gtdActionDone = this.checked;
		_GTD.tiddlerHasChanged(tiddler);
		_GTD.refreshActionViews(tiddler);
		if (this.checked && typeof(gtdActionDoneHook) == "function")
			gtdActionDoneHook(tiddler);
		if (tiddler.gtdActionDone && tiddler.gtdProject == undefined && confirm("This action is not a part of a project. Would you just like to delete it?")) {
			story.closeTiddler(tiddler.title, false, false);
			store.removeTiddler(tiddler.title);
		}
	}
	return true;
}

config.macros.gtdAction.handler = function(place,macroName,params)
{
	var title = params[0], tags;
	var parentTiddlerName = story.findContainingTiddler(place).getAttribute("tiddler");
	var tiddler = store.getTiddler(title);
	if (!tiddler) {
		// we should *never* get here now for project actions, but keep code in case project code
		// trips up, or we use this macro somewhere else
		this.createAction(title, parentTiddlerName, params[1]);
	}
	else
		// use actual tiddler tags, not macro param, in case context changed!
		tags = tiddler.tags;
	var action = this.createActionElement(place, title, parentTiddlerName, tags);
}

config.macros.gtdAction.createAction = function(title, projectTiddlerName, tagParams, extraTags)
{
	// var tags = ["action", parentTiddler];
	var action, tags = ["action"], fields = {};
	if (_GTD.usingProjectTags)
		tags.push(projectTiddlerName);
	if (typeof(tagParams) == "string") tags = tags.concat(tagParams.readBracketedList());
	if (typeof(extraTags) == "string") tags = tags.concat(extraTags.readBracketedList());
	var templateText = store.getTiddlerText("NewActionTemplate", config.views.wikified.defaultText.format([title]));
	if (_GTD.usingProjectTags)
		action = store.saveTiddler(title, title, templateText, config.options.txtUserName, new Date(), tags);
	else {
		fields["gtd.project"] = projectTiddlerName;
		action = store.saveTiddler(title, title, templateText, config.options.txtUserName, new Date(), tags, fields);
	}
	return action;
}

config.macros.gtdActionCompleted = {}
config.macros.gtdActionCompleted.handler = function(place,macroName,params)
{
	if (!readOnly) {
		var title = story.findContainingTiddler(place).getAttribute("tiddler");
		var tiddler = store.getTiddler(title);
		// oddly, we barf when setting the checkbox type on an input if we use createTiddlyElement...
		var cb = document.createElement("input");
		cb.setAttribute("type", "checkbox");
		cb.setAttribute("actionTiddler", title);
		cb.onclick = this.onClickDone;
		place.appendChild(cb);
		cb.checked = tiddler.gtdActionDone;
	}
}

config.macros.gtdActionCompleted.onClickDone = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("actionTiddler"));
	if (tiddler) {
		_GTD.toggleTag(tiddler, "done", this.checked);
		tiddler.gtdActionDone = this.checked;
		_GTD.tiddlerHasChanged(tiddler);
		_GTD.refreshActionViews(tiddler);
		if (this.checked && typeof(gtdActionDoneHook) == "function")
			gtdActionDoneHook(tiddler);
		if (tiddler.gtdActionDone && tiddler.gtdProject == undefined && confirm("This action is not a part of a project. Would you just like to delete it?")) {
			story.closeTiddler(tiddler.title, false, false);
			store.removeTiddler(tiddler.title);
		}
	}
	return true;
}

config.macros.gtdToggleTag = {}
config.macros.gtdToggleTag.handler = function(place,macroName,params)
{
	if (!readOnly) {
		var title = story.findContainingTiddler(place).getAttribute("tiddler");
		var tiddler = store.getTiddler(title);
		// oddly, we barf when setting the checkbox type on an input if we use createTiddlyElement...
		var cb = document.createElement("input");
		cb.setAttribute("type", "checkbox");
		cb.setAttribute("tiddler", title);
		cb.setAttribute("toggledTag", params[0]);
		cb.onclick = this.onClickDone;
		place.appendChild(cb);
		cb.checked = _GTD.tiddlerHasTag(tiddler, params[0]);
	}
}

config.macros.gtdToggleTag.onClickDone = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("tiddler"));
	if (tiddler) {
		_GTD.toggleTag(tiddler, this.getAttribute("toggledTag"), this.checked);
		_GTD.tiddlerHasChanged(tiddler);
		if (_GTD.tiddlerHasTag(tiddler, "action"))
			_GTD.refreshActionViews(tiddler);
		else
			// we need a broad notification here, not just refreshActionViews
			store.notify(tiddler.title, true);
	}
	return true;
}

config.macros.gtdToggleState = {}
config.macros.gtdToggleState.handler = function(place,macroName,params)
{
	var title = story.findContainingTiddler(place).getAttribute("tiddler");
	var tiddler = store.getTiddler(title);
	// oddly, we barf when setting the checkbox type on an input if we use createTiddlyElement...
	var cb = document.createElement("input");
	cb.setAttribute("type", "checkbox");
	cb.setAttribute("tiddler", title);
	var state = params[0] + escape(title);
	cb.setAttribute("stateName", state);
	cb.onclick = this.onClickDone;
	place.appendChild(cb);
	cb.checked = config.options[state];
}

config.macros.gtdToggleState.onClickDone = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("tiddler"));
	if (tiddler) {
		var state = this.getAttribute("stateName");
		config.options[state] = this.checked;
		saveOptionCookie(state);
		story.refreshTiddler(tiddler.title, null, true);
	}
	return true;
}

config.macros.importUpdates = { 
	importMode: "updates",
	buttonTitle: "Update", 
	buttonHelp: "Click here to update the application",
	missingHelperMessage: "This functionality depends on the LoadTiddlersPlugin, which is missing. Please import the plugin from TiddlyTools.",
	preUpdateMessage: "Once the download is finished, you will need to reload your document to complete the update. In order to allow you to review the update tiddlers, this will not be done automatically. \n\nClick \"OK\" start the update.",
	postUpdateMessage: "Please remember, you will need to save and reload your document to complete the update. In order to allow you to review the update tiddlers, this will not be done automatically."
}
config.macros.importUpdates.handler = function(place, macroName, params)
{
	var mode = params[1] ? params[1] : this.importMode;
	var title = params[2] ? params[2] : this.buttonTitle;
	var prompt = params[3] ? params[3] : this.buttonHelp;
	var button = createTiddlyButton(place, title, prompt, this.onClickUpdate);
	button.setAttribute("updateSource", params[0]);
	button.setAttribute("importMode", mode);
	if (params.length > 4) button.setAttribute("importExtras", params.slice(4).join(" "));
}

config.macros.importUpdates.onClickUpdate = function(e)
{
	if (config.macros.loadTiddlers == undefined || version.extensions.LoadTiddlersPlugin == undefined) {
		alert(config.macros.importUpdates.missingHelperMessage);
		return;
	}
	if (!confirm(config.macros.importUpdates.preUpdateMessage))
		return;
	var importParams = [ this.getAttribute("importMode"), this.getAttribute("updateSource") ];
	var importExtras = this.getAttribute("importExtras");
	if (importExtras) importParams = importParams.concat(importExtras.split(" "));
	// force a saveChanges with backup before the update
	_GTD.saveWithForcedBackup();
	// chain to the loadTiddlers macro
	config.macros.loadTiddlers.handler(this, "loadTiddlers", importParams);
	// ensure that relevant release notes are displayed on first launch
	config.options.chkGTDReleaseNotes = true;
	saveOptionCookie("chkGTDReleaseNotes");
	// do *not* cause a browser navigation
	return false;
}

config.macros.gtdArchive = {}
config.macros.gtdArchive.handler = function(place, macroName, params)
{
	var archiveAction = params.length > 0 ? params[0] : "archive"
	var btn = createTiddlyButton(place, archiveAction, "", this.onClick);
	btn.setAttribute("archiveAction", archiveAction);
}

config.macros.gtdArchive.onClick = function(e)
{
	var warning = "Are you sure you want to %0 all %1 projects and actions?";
	var status = "There were %0 project(s) and %1 action(s) %2d.";
	var archiveAction = this.getAttribute("archiveAction");
	
	var projectCount = 0, actionCount = 0;
	
	if (archiveAction == "archive") {
		if (confirm(warning.format([archiveAction, "completed"]))) {
			clearMessage();
			var projects = store.getTaggedTiddlers("project");
			for (var i = 0; i < projects.length; i++) {
				var project = projects[i];
				if (project.gtdActions == undefined || project.gtdActions.length == 0) continue;
				var projectComplete = true;
				for (var j = 0; projectComplete && j < project.gtdActions.length; j++)
					projectComplete = project.gtdActions[j].gtdActionDone;
				if (!projectComplete) continue;
				// if we get here, all project actions are done, so archive project
				story.closeTiddler(project.title, false, false);
				_GTD.tiddlerSwapTag(project, "project", "project-archive");
				_GTD.tiddlerHasChanged(project, false);
				projectCount++;
				for (j = 0; j < project.gtdActions.length; j++) {
					story.closeTiddler(project.gtdActions[j].title, false, false);
					_GTD.tiddlerSwapTag(project.gtdActions[j], "action", "action-archive");
					_GTD.tiddlerHasChanged(project.gtdActions[j], false);
					actionCount++;
				}
			}
			var actions = store.getTaggedTiddlers("action");
			for (i = 0; i < actions.length; i++) {
				var action = actions[i];
				if (action.gtdActionDone && !action.gtdProject) {
					story.closeTiddler(action.title, false, false);
					_GTD.tiddlerSwapTag(action, "action", "action-archive");
					_GTD.tiddlerHasChanged(action, false);
					actionCount++;
				}
			}
			displayMessage(status.format([projectCount, actionCount, archiveAction]));
			var saveClearMessage = clearMessage;
			clearMessage = function() {};
			if (config.options.chkAutoSave) saveChanges();
			clearMessage = saveClearMessage;
			store.notify(null, true);
		}
	}
	
	else if (archiveAction == "unarchive") {
		if (confirm(warning.format([archiveAction, "archived"]))) {
			clearMessage();
			var projects = store.getTaggedTiddlers("project-archive");
			for (var i = 0; i < projects.length; i++) {
				var project = projects[i];
				story.closeTiddler(project.title, false, false);
				_GTD.tiddlerSwapTag(project, "project-archive", "project");
				_GTD.tiddlerHasChanged(project, false);
				projectCount++;
			}
			var actions = store.getTaggedTiddlers("action-archive");
			for (i = 0; i < actions.length; i++) {
				var action = actions[i];
				story.closeTiddler(action.title, false, false);
				_GTD.tiddlerSwapTag(action, "action-archive", "action");
				_GTD.tiddlerHasChanged(action, false);
				actionCount++;
			}
			displayMessage(status.format([projectCount, actionCount, archiveAction]));
			var saveClearMessage = clearMessage;
			clearMessage = function() {};
			if (config.options.chkAutoSave) saveChanges();
			clearMessage = saveClearMessage;
			store.notify(null, true);
		}
	}
	
	else if (archiveAction == "purge") {
		if (confirm(warning.format([archiveAction, "archived"]))) {
			clearMessage();
			_GTD.saveWithForcedBackup();
			var projects = store.getTaggedTiddlers("project-archive");
			for (var i = 0; i < projects.length; i++) {
				var project = projects[i];
				story.closeTiddler(project.title, false, false);
				store.removeTiddler(project.title);
				projectCount++;
			}
			var actions = store.getTaggedTiddlers("action-archive");
			for (i = 0; i < actions.length; i++) {
				var action = actions[i];
				story.closeTiddler(action.title, false, false);
				store.removeTiddler(action.title);
				actionCount++;
			}
			displayMessage(status.format([projectCount, actionCount, archiveAction]));
			var saveClearMessage = clearMessage;
			clearMessage = function() {};
			if (config.options.chkAutoSave) saveChanges();
			clearMessage = saveClearMessage;
			store.notify(null, true);
		}
	}
	else
		alert("That archiving action is not supported");
}

config.formatters.push(
	{
	name: "gtdAction",
	match: "^\\.{2}.*",
	lookahead: "^\\.{2}([^|]*)(?:\\|?)(.*)",
	handler: function(w)
		{
			var lookaheadRegExp = new RegExp(this.lookahead,"g");
			var lookaheadMatch = lookaheadRegExp.exec(w.matchText)
			if (lookaheadMatch) {
				var params = [ lookaheadMatch[1].trim() ];
				if (lookaheadMatch[2].trim().length > 0) params.push(lookaheadMatch[2].trim());
				config.macros.gtdAction.handler(w.output, "gtdAction", params);
			}
		}
	}
);

config.commands.newAction = { text: "action", tooltip: "Create a new action for this context", hideReadOnly: true };
config.commands.newAction.handler = function(event, src, context)
{
	var d = new Date();
	var newActionTitle = d.formatString("New Action hh:0mm:0ss");
	if (!store.tiddlerExists(newActionTitle)) {
		var tiddler = store.createTiddler(newActionTitle);
		var templateText = store.getTiddlerText("NewActionTemplate", config.views.wikified.defaultText.format([newActionTitle]));
		tiddler.assign(newActionTitle, templateText, config.options.txtUserName, new Date(), [ "action", context ]);
		
		story.displayTiddler(null, newActionTitle, DEFAULT_EDIT_TEMPLATE);
		story.focusTiddler(newActionTitle, "title");
	}
	return false;
}

config.commands.newProjectAction = { text: "action", tooltip: "Create a new action for this project", hideReadOnly: true };
config.commands.newProjectAction.handler = function(event, src, project)
{
	var d = new Date();
	var newActionTitle = d.formatString("New Action hh:0mm:0ss");
	if (!store.tiddlerExists(newActionTitle)) {
		var defaultContext = config.options.txtGTDUnfiledContext;
		_GTD.appendProjectActionMarkup(store.getTiddler(project), newActionTitle, defaultContext);
		
		var tiddler = store.createTiddler(newActionTitle);
		var templateText = store.getTiddlerText("NewActionTemplate", config.views.wikified.defaultText.format([newActionTitle]));
		var tags = ["action"], fields = {};
		if (_GTD.usingProjectTags)
			tags.push(project);
		tags.push(defaultContext);
		if (_GTD.usingProjectTags)
			tiddler.assign(newActionTitle, templateText, config.options.txtUserName, new Date(), tags);
		else {
			fields["gtd.project"] = project;
			tiddler.assign(newActionTitle, templateText, config.options.txtUserName, new Date(), tags, new Date(), fields);
		}
		
		story.displayTiddler(null, newActionTitle, DEFAULT_EDIT_TEMPLATE);
		story.focusTiddler(newActionTitle, "title");
	}
	return false;
}

config.commands.changeContext = { text: "context", tooltip: "Change context of this action", hideReadOnly: true, popupNone: "There are no contexts" };
config.commands.changeContext.handler = function(event,src,title)
{
	var popup = Popup.create(src);
	if (popup) {
		var contexts = _GTD.getCachedContexts();
		var tiddler = store.getTiddler(title);
		var currentContext = _GTD.findActionContext(tiddler);
		if (!currentContext) currentContext = '';
		
		var c = false;
		for (var i = 0; i < contexts.length; i++)
			if (contexts[i].title != currentContext) {
				var button = createTiddlyButton(createTiddlyElement(popup, "li"), contexts[i].title, '', this.onClickContext);
				button.setAttribute("actionTiddler", title);
				button.setAttribute("oldContext", currentContext);
				button.setAttribute("newContext", contexts[i].title);
				c = true;
			}
			
		if (!c)
			createTiddlyText(createTiddlyElement(popup, "li", null, "disabled"), this.popupNone);
	}
	
	Popup.show(popup, false);
	event.cancelBubble = true;
	if (event.stopPropagation) event.stopPropagation();
	// do *not* cause a browser navigation
	return false;
}

config.commands.changeContext.onClickContext = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("actionTiddler"));
	if (tiddler) {
		var contextChanged = false;
		var oldContext = this.getAttribute("oldContext");
		var newContext = this.getAttribute("newContext");
		if (oldContext.length == 0)
			contextChanged = (tiddler.tags.push(newContext) > 0);
		else
			contextChanged = _GTD.tiddlerSwapTag(tiddler, oldContext, newContext);
		
		if (contextChanged) {
			tiddler.gtdContextName = newContext;
			_GTD.setExtendedValue(tiddler, "gtd.context", newContext);
			_GTD.tiddlerHasChanged(tiddler);
			_GTD.refreshActionViews(tiddler);
			// be sure to refresh old context as well...
			story.refreshTiddler(oldContext, null, true);
		}
	}
	// do *not* cause a browser navigation
	return false;
}

config.commands.changeProject = { text: "project", tooltip: "Change project of this action", hideReadOnly: true, popupNone: "There are no projects" };
config.commands.changeProject.handler = function(event,src,title)
{
	var popup = Popup.create(src);
	if (popup) {
		var projects = store.getTaggedTiddlers("project");
		var tiddler = store.getTiddler(title);
		var currentProject = (tiddler.gtdProject ? tiddler.gtdProject.title : '');
		
		var c = false;
		for (var i = 0; i < projects.length; i++)
			if (projects[i].title != currentProject) {
				var button = createTiddlyButton(createTiddlyElement(popup, "li"), projects[i].title, '', this.onClickProject);
				button.setAttribute("actionTiddler", title);
				button.setAttribute("oldProject", currentProject);
				button.setAttribute("newProject", projects[i].title);
				c = true;
			}
			
		if (!c)
			createTiddlyText(createTiddlyElement(popup, "li", null, "disabled"), this.popupNone);
	}
	
	Popup.show(popup, false);
	event.cancelBubble = true;
	if (event.stopPropagation) event.stopPropagation();
	// do *not* cause a browser navigation
	return false;
}

config.commands.changeProject.onClickProject = function(e)
{
	var tiddler = store.getTiddler(this.getAttribute("actionTiddler"));
	if (tiddler) {
		var oldProject = this.getAttribute("oldProject");
		var newProject = this.getAttribute("newProject");
		
		if (oldProject.length > 0)
			_GTD.removeProjectAction(tiddler.gtdProject, tiddler.title)
		if (_GTD.usingProjectTags)
			_GTD.tiddlerSwapTag(tiddler, oldProject, newProject);
		else
			_GTD.setExtendedValue(tiddler, "gtd.project", newProject);
		_GTD.appendProjectActionMarkup(store.getTiddler(newProject), tiddler.title, tiddler.gtdContextName);
		
		_GTD.tiddlerHasChanged(tiddler);
		_GTD.refreshActionViews(tiddler);
	}
	// do *not* cause a browser navigation
	return false;
}

config.commands.deleteAction = { text: "delete", tooltip: "Delete this action", hideReadOnly: true, warning: "Are you sure you want to delete '%0'?", altwarning: "Are you sure you want to delete '%0'? The action will also be removed from project '%1'." };
config.commands.deleteAction.handler = function(event, src, title)
{
	var tiddler = store.getTiddler(title);
	var ok = (tiddler.gtdProject ? confirm(this.altwarning.format([title, tiddler.gtdProject.title])) : confirm(this.warning.format([title])));
	if (ok) {
		if (tiddler.gtdProject) _GTD.removeProjectAction(tiddler.gtdProject, title);
		store.removeTiddler(title);
		story.closeTiddler(title,true,event.shiftKey || event.altKey);
		if (config.options.chkAutoSave)
			saveChanges();
	}
	
	return false;
}

config.commands.deleteContext = { text: "delete", tooltip: "Delete this context", hideReadOnly: true, warning: "Are you sure you want to delete '%0'? All associated actions will be tagged as 'unfiled'." };
config.commands.deleteContext.handler = function(event, src, title)
{
	if (confirm(this.warning.format([title]))) {
		store.suspendNotifications();
		this.unlinkActions(title);
		// force a rebuild of our context cache
		_GTD.clearContextCache();
		store.resumeNotifications();
		store.removeTiddler(title);
		story.closeTiddler(title,true,event.shiftKey || event.altKey);
		if (config.options.chkAutoSave)
			saveChanges();
	}
	
	return false;
}

config.commands.deleteContext.unlinkActions = function(contextTitle)
{
	var tiddlers = config.macros.list.tagged.innerHandler([contextTitle, "action"], true);
	for (var i = 0; i < tiddlers.length; i++) {
		var tiddler = tiddlers[i];
		_GTD.tiddlerSwapTag(tiddler, contextTitle, config.options.txtGTDUnfiledContext);
		_GTD.tiddlerHasChanged(tiddler, false);
		// context removal will do view notification...
	}
}

config.commands.archiveProject = { text: "archive", tooltip: "Archive this project", hideReadOnly: true, warning: "Are you sure you want to archive '%0'?", noarchive: "This project is %0 and will not be archived." };
config.commands.archiveProject.handler = function(event, src, title)
{
	if (confirm(this.warning.format([title]))) {
		var project = store.getTiddler(title);
		if (project.gtdActions == undefined || project.gtdActions.length == 0) {
			alert(this.noarchive.format(["empty"]));
			return;
		}
		var projectComplete = true;
		for (var j = 0; projectComplete && j < project.gtdActions.length; j++)
			projectComplete = project.gtdActions[j].gtdActionDone;
		if (!projectComplete) {
			alert(this.noarchive.format(["incomplete"]));
			return;
		}
		// if we get here, all project actions are done, so archive project
		story.closeTiddler(project.title, false, false);
		_GTD.tiddlerSwapTag(project, "project", "project-archive");
		_GTD.tiddlerHasChanged(project, false);
		for (j = 0; j < project.gtdActions.length; j++) {
			story.closeTiddler(project.gtdActions[j].title, false, false);
			_GTD.tiddlerSwapTag(project.gtdActions[j], "action", "action-archive");
			_GTD.tiddlerHasChanged(project.gtdActions[j], false);
		}
		store.notify(null, true);
		if (config.options.chkAutoSave)
			saveChanges();
	}

	return false;
}

config.commands.deleteProject = { text: "delete", tooltip: "Delete this project", hideReadOnly: true, warning: "Are you sure you want to delete '%0'? All associated actions will no longer be bound to this (or any) project." };
config.commands.deleteProject.handler = function(event, src, title)
{
	if (confirm(this.warning.format([title]))) {
		store.suspendNotifications();
		this.unlinkActions(title);
		store.resumeNotifications();
		store.removeTiddler(title);
		story.closeTiddler(title,true,event.shiftKey || event.altKey);
		if (config.options.chkAutoSave)
			saveChanges();
	}
	
	return false;
}

config.commands.deleteProject.unlinkActions = function(projectTitle)
{
	// var tiddlers = config.macros.list.tagged.innerHandler([projectTitle, "action"], true);
	var project = store.getTiddler(projectTitle);
	for (var i = 0; i < project.gtdActions.length; i++) {
		var tiddler = project.gtdActions[i];
		tiddler.gtdProject = null;
		tiddler.gtdProjectName = null;
		if (_GTD.usingProjectTags)
			tiddler.tags.splice(tiddler.tags.indexOf(projectTitle), 1);
		else {
			_GTD.setExtendedValue(tiddler, "gtd.project", null);
			_GTD.setExtendedValue(tiddler, "gtd.projectindex", null);
		}
		_GTD.tiddlerHasChanged(tiddler, false);
		// project removal will do view notification...
	}
}

config.commands.deleteProjectAll = { text: "delete all", tooltip: "Delete this project and its actions", hideReadOnly: true, warning: "Are you sure you want to delete '%0' and all its associated actions?" };
config.commands.deleteProjectAll.handler = function(event, src, title)
{
	if (confirm(this.warning.format([title]))) {
		store.suspendNotifications();
		this.deleteActions(title);
		store.resumeNotifications();
		store.removeTiddler(title);
		story.closeTiddler(title,true,event.shiftKey || event.altKey);
		if (config.options.chkAutoSave)
			saveChanges();
	}
	
	return false;
}

config.commands.deleteProjectAll.deleteActions = function(projectTitle)
{
	// var tiddlers = config.macros.list.tagged.innerHandler([projectTitle, "action"], true);
	var project = store.getTiddler(projectTitle);
	for (var i = 0; i < project.gtdActions.length; i++) {
		var tiddler = project.gtdActions[i].title;
		store.removeTiddler(tiddler);
		story.closeTiddler(tiddler, true, false);
		// project removal will do view notification...
	}
}

config.commands.projectify = { text: "projectify", tooltip: "Convert this action to a project", hideReadOnly: true, warning: "Are you sure you want to convert '%0' to a project?" };
config.commands.projectify.handler = function(event, src, title)
{
	if (confirm(this.warning.format([title]))) {
		var tiddler = store.getTiddler(title);
		if (tiddler.gtdProject) _GTD.removeProjectAction(tiddler.gtdProject, title);
		tiddler.tags = [ "project" ];
		_GTD.tiddlerHasChanged(tiddler, true);
		// we need a broad notification here, not just refreshActionViews
		store.notify(title, true);
	}
	
	return false;
}

// *** ***/
// *** These are overrides to core TiddlyWiki functionality ***
// *** ***/

Tiddler.prototype._GTDInheritedChanged = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	this._GTDInheritedChanged();
	
	// Note that this is called both as part of normal tiddler changes AND as a part
	// of the initial TW loading process from DIVs...
	
	if (_GTD.tiddlerHasTag(this, "project")) {
		// (re)build the in-memory ordered action list
		this.gtdActions = [];
		this.gtdNextAction = null;
		if (this.text) {
			var reActionWikitext = "^\\.{2}([^|\\n]+)(?:\\|?)(.*)";
			var reActionMacro = "<<gtdAction ((?:[^>]|(?:>(?!>)))*)>>";
			var actionRe = new RegExp("(" + reActionWikitext + ")|(" + reActionMacro + ")", "mg");
			do {
				var formatMatch = actionRe.exec(this.text);
				if (formatMatch) {
					var macroParams = (formatMatch[1] ? null : formatMatch[5].readMacroParams());
					// note that for the ".." notation, we are trimming up action titles and contexts
					var actionTiddlerName = (formatMatch[1] ? formatMatch[2].trim() : macroParams[0]);
					var actionTiddler = store.getTiddler(actionTiddlerName);
					if (!actionTiddler) {
						var actionTags = (formatMatch[1] ? formatMatch[3].trim() : macroParams[1]);
						var extraTags = (formatMatch[1] ? '' : macroParams[2]);
						actionTiddler = config.macros.gtdAction.createAction(actionTiddlerName, this.title, actionTags, extraTags);
					}
					if (actionTiddler) {
						actionTiddler.gtdProject = this;
						if (this.gtdNextAction == null && !_GTD.tiddlerHasTag(actionTiddler, "done"))
							this.gtdNextAction = actionTiddler;
						this.gtdActions.push(actionTiddler);
						_GTD.setExtendedValue(actionTiddler, "gtd.projectindex", this.gtdActions.length - 1);
						// handle project renaming in action
						if (actionTiddler.gtdProjectName && actionTiddler.gtdProjectName != this.title) {
							if (_GTD.usingProjectTags)
								_GTD.tiddlerSwapTag(actionTiddler, actionTiddler.gtdProjectName, this.title);
							else
								_GTD.setExtendedValue(actionTiddler, "gtd.project", this.title);
							// action view won't get updated through any other refresh mechanism, so
							story.refreshTiddler(actionTiddler.title, null, true);
						}
						actionTiddler.gtdProjectName = this.title;
					}
				}
			} while(formatMatch);
		}
	}
	
	else if (_GTD.tiddlerHasTag(this, "context")) {
		if (this.gtdContextName == undefined)
			this.gtdContextName = this.title;
		else if (this.gtdContextName != this.title) {
			// propagate renamed context to affected actions
			store.suspendNotifications();
			var results = config.macros.list.tagged.innerHandler([ this.gtdContextName, "action"], true);
			for (var t = 0; t < results.length; t++) {
				_GTD.tiddlerSwapTag(results[t], this.gtdContextName, this.title);
				results[t].gtdContextName = this.title;
				_GTD.setExtendedValue(results[t], "gtd.context", this.title);
				// action view won't get updated through any other refresh mechanism, so
				//story.refreshTiddler(results[t].title, null, true);
			}
			// because the store is not yet updated, we need to manipulate the context cache directly
			_GTD.renameCachedContext(this.gtdContextName, this.title);
			this.gtdContextName = this.title;
			// we need a broad notification here, not just refreshActionViews
			store.resumeNotifications();
			store.notify(null, true);
		}
	}
	
	else if (_GTD.tiddlerHasTag(this, "action")) {
		if (this.gtdActionName == undefined)
			this.gtdActionName = this.title;
		else if (this.gtdActionName != this.title && this.gtdProject) {
			// ugh...dig into related project and update the wiki code to use new action name
			var reActionWikitext = "^(\\.{2}[ \\t]*)(" + this.gtdActionName + ")(([ \\t]*\\|.*\\n?)|(\\n?))";
			var reActionMacro = "(<<gtdAction [\"\']?)(" + this.gtdActionName + ")([\"\']?\\s+(?:[^>]|(?:>(?!>)))*>>)";
			this.gtdProject.text = this.gtdProject.text.replace(new RegExp(reActionWikitext, "mg"), "$1" + this.title + "$3");
			this.gtdProject.text = this.gtdProject.text.replace(new RegExp(reActionMacro, "mg"), "$1" + this.title + "$3");
			this.gtdActionName = this.title;
		}
		this.gtdActionDone = _GTD.tiddlerHasTag(this, "done");
		this.gtdContextName = _GTD.findActionContext(this);
		_GTD.setExtendedValue(this, "gtd.context", this.gtdContextName);
		// reset the next action on the associated project
		if (this.gtdProject) _GTD.setNextAction(this.gtdProject);
	}
}

Story.prototype.chooseTemplateForTiddler = function(title,template)
{
	// This override to core TW functionality is used to provide tag-based view and edit templates. The
	// basic idea is that the tiddler is scanned for its tags and, depending on whether we are opening a
	// tiddler in "view" or "edit" mode, a corresponding 'tag + "ViewTemplate"' or 'tag + "EditTemplate"'
	// tiddler is searched for. If it exists, it is used instead of the default templates.
	
	if (!template)
		template = DEFAULT_VIEW_TEMPLATE;

	// before reverting to default behaviour, check to see if a tag-based template exists
	if (template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE) {
		if (this.tagBasedTemplateCache == undefined) this.tagBasedTemplateCache = new Array();
		var templateRoot = (template == DEFAULT_VIEW_TEMPLATE ? "ViewTemplate" : "EditTemplate");
		var tiddler = store.getTiddler(title);
		if (tiddler) {
			for (var i = 0; i < tiddler.tags.length; i++) {
				var tag = tiddler.tags[i];
				var tagTemplate = tag + templateRoot;
				var tagCacheId = tag + template;
				// first check our cache to see if we have seen this template before
				if (this.tagBasedTemplateCache[tagCacheId] != undefined) {
					// make sure template still exists
					if (store.tiddlerExists(this.tagBasedTemplateCache[tagCacheId])) {
						template = this.tagBasedTemplateCache[tagCacheId];
						break;
					}
					else
						delete this.tagBasedTemplateCache[tagCacheId];
				}
				// go to the store to see if template exists
				if (store.tiddlerExists(tagTemplate)) {
					template = tagTemplate;
					this.tagBasedTemplateCache[tagCacheId] = tagTemplate;
					break;
				}
			}
		}
	}
	
	if (template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE)
		template = config.tiddlerTemplates[template];
	return template;
}

// Clint Checketts' IE first-child patch, version 1.1, http://www.checkettsweb.com/tw/gtd_tiddlywiki.htm#GiveFirstTiddlerClassPatch

Story.prototype.closeTiddlerIEFirstChild = Story.prototype.closeTiddler;
Story.prototype.closeTiddler = function(title,animate,slowly) {
	var tiddler = document.getElementById(this.idPrefix + title);
	// we need to test to ensure tiddler is actually open
	if (tiddler) {
		var storyArea = tiddler.parentNode;
		if ((this.idPrefix + title) == storyArea.firstChild.id){
			removeClass(storyArea.firstChild,"IEFirstChild");
			// this next line is redundant, since it is looked after at the end of this function
			// if (storyArea.firstChild.nextSibling) addClass(storyArea.firstChild.nextSibling,"IEFirstChild");
		}
		story.closeTiddlerIEFirstChild(title,animate,slowly);
		if (storyArea.firstChild) addClass(storyArea.firstChild,"IEFirstChild");
	}
}

Story.prototype.displayTiddlerIEFirstChild = Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc) {
	var storyArea = document.getElementById(this.container);
	if (storyArea.firstChild) removeClass(storyArea.firstChild,"IEFirstChild");
	story.displayTiddlerIEFirstChild(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc);
	addClass(storyArea.firstChild,"IEFirstChild");
}

_GTD.initialize();

//}}}
/***
!GTD specific styles
***/

/*{{{*/
/* how annoying is that big header anyway?! */
.headerForeground, .headerShadow {
 padding-top: 1em;
}

/* the tagging popup really gets in the way so push it off to the side */
.tagging { float: right; }

/* this unbullets actions in the actionList macro */
ul.gtdActionList { list-style-type: none; }
li.gtdActionListProject, li.gtdActionListContext { margin-top: 1.0em; }

.gtdCompletedActionItem { text-decoration: line-through; }
.gtdNextActionItem { border-bottom: 1px solid red; }
.gtdActionWithContent a { font-weight: bold; }
.gtdActionWithoutContent a { font-weight: normal; }

a.actionCrossReference { color: #228B22; }
a.actionCrossReference:hover { color: white; }

/* necessary bits copied from enhanced stylesheet to render properly without it */
#mainMenu {
 font-size: 1em;
 text-align: left;
 width: 12em;
}

#mainMenu * {
 font-size: 1em;
 font-weight: normal;
 padding: 0; margin: 0; border: 0;
}

#mainMenu ul {
 list-style: none;
 margin-bottom: 10px;
}

#mainMenu li {
 text-indent: 1em;
}

#mainMenu li li {
 text-indent: 1.5em;
}

#mainMenu li li li {
 text-indent: 2em;
}

#mainMenu li li li li {
 text-indent: 2.5em;
}

#mainMenu a.button, #mainMenu a.tiddlyLink, #mainMenu a.externalLink {
 display: block; margin: 0;
}

table.review { width: 98%; }
.review tr { vertical-align: top; }

/*}}}*/

/***
!Imported 3x5 printing styles
//adapted from the work of Clint Checketts, http://www.checkettsweb.com/tw/gtd_tiddlywiki.htm //
***/

/*{{{*/

@media print {
#mainMenu, #sidebar, #messageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em 1em;}


/* LAYOUT ELEMENTS ========================================================== */
*
{
 margin: 0;
 padding: 0;
}

#contentWrapper
{
 margin: 0;
 width: 100%;
 position: static;
}

body {
 background: #fff;
 color: #000;
 font-size: 6.2pt;
 font-family: "Lucida Grande", "Bitstream Vera Sans", Helvetica, Verdana, Arial, sans-serif;
 /* we don't want any unnecessary output */
 border: none;
}

img {
 max-width: 2.2in;
 max-height: 4.3in;
}

#header, #side_container, #storeArea, #copyright, #floater, #messageArea, .save_accesskey, .site_description, #saveTest, .toolbar, .header, .footer, .tagging, .tagged
{
 display: none;
}

#tiddlerDisplay, #displayArea
{
 display: inline;
}

.tiddler {
 margin: 0 0 2em 0;
 border: none;
 page-break-before: always;
 font-size: 200%;
 /* IF YOU DO NOT USE INDEX CARDS, USE THIS */
 font-size: 100%;
}

.tiddler:first-child {
 page-break-before: avoid;
}

/* this relies on Clint's IE first-child patch */
.IEFirstChild {
 page-break-before: auto;
}

.title {
 font-size: 1.6em;
 font-weight: bold;
 margin-bottom: .3em;
 padding: .2em 0;
 border-bottom: 1px dotted #000;
}

p, blockquote, ul, li, ol, dt, dd, dl, table
{
 margin: 0 0 .3em 0;
}

h1, h2, h3, h4, h5, h6
{
 margin: .2em 0;
} 

h1
{
 font-size: 1.5em;
}

h2
{
 font-size: 1.3em;
}

h3
{
 font-size: 1.25em;
}

h4
{
 font-size: 1.15em;
}

h5
{
 font-size: 1.1em;
}

blockquote
{
 margin: .6em;
 padding-left: .6em;
 border-left: 1px solid #ccc;
}

ul
{
 list-style-type: circle;
}

li
{
 margin: .1em 0 .1em 2em;
 line-height: 1.4em; 
}

table
{
 border-collapse: collapse;
 font-size: 1em;
}

td, th
{
 border: 1px solid #999;
 padding: .2em;
}

hr {
 border: none;
 border-top: dotted 1px #777;
 height: 1px;
 color: #777;
 margin: .6em 0;
}
}
/*}}}*/

/***
!Imported styles for calendar plugin
***/

/*{{{*/

#mainMenu .calendar {
 width: 100%;
 background-color: transparent !important;
}

#mainMenu .calendar, #mainMenu .calendar tr, #mainMenu .calendar td, #mainMenu .calendar a {
}


/*}}}*/
/***
!Layout Rules /%==============================================%/
***/
/*{{{*/

body {
 /* this is required for proper layout on IE, for some reason... */
 _position: static;
}

.tagClear {
 /* this, too, is a necessary IE hack... */
 _margin-top: 10em; 
 _clear: both;
}

.headerForeground, .headerShadow {
 padding-top: 1em;
}

.tiddler {
 margin: 0 0 0.9em 0;
 padding-bottom: 1em;
}

#mainMenu {
 width: 16em;
 font-size: 1em;
 text-align: left;
 padding-top: 0.5em;
}

#mainMenu * {
 font-size: 1em;
 font-weight: normal;
 padding: 0; margin: 0; border: 0;
}

#mainMenu ul {
 list-style: none;
 margin-bottom: 10px;
}

#mainMenu li {
 text-indent: 1em;
}

#mainMenu a.button, #mainMenu a.tiddlyLink, #mainMenu a.externalLink {
 display: block; margin: 0;
}

#displayArea {
 margin-left: 19em; margin-top: 0;
}

.toolbar .button {
 margin-left: 4px;
}

/*}}}*/

/***
!Generic Rules /%==============================================%/
***/
/*{{{*/
body {
 background: #464646;
 color: #000;
}

h1,h2,h3,h4,h5 {
 color: #000;
 background: #eee;
}

/*}}}*/
/***
!Header /%==================================================%/
***/
/*{{{*/
.header {
 background: #000;
}

.headerForeground {
 color: #cf6;
}

.headerForeground a {
 font-weight: normal;
 color: #cf6;
}

/* ??? what is up when you specify a site title colour in IE ??? */
/* .siteTitle { color: red; } */

/*}}}*/
/***
!General tabs /%=================================================%/
***/
/*{{{*/

.tabSelected {
 color: #fff;
 background: #960;
 border: none;
}

.tabUnselected {
 color: #fff;
 background: #660;
}

.tabContents {
 color: #004;
 background: #960;
 border: none;
}

.tabContents .button, .tabContents a {
 border: none;
 color: #fff;
}

.tabContents a:hover, .tabset a:hover {
 background: #000;
}

/* make nested tab areas look different */
.tabContents .tabSelected, .tabContents .tabContents {
 background: #700;
 color: #fff;
}

.tabContents .tabContents {
 color: #eeb;
}

/*}}}*/
/***
!Main Menu /%=================================================%/
***/
/*{{{*/
#mainMenu {
 background: #700;
 color: #fff;
 border-right: 3px solid #500;
}

#mainMenu * {
 color: #fff;
}

#mainMenu a.button, #mainMenu a.tiddlyLink, #mainMenu a.externalLink {
 border: none;
 border-bottom: 1px solid #500;
 border-top: 1px solid #900;
}

#mainMenu a:hover,
#mainMenu a.button:hover {
 background-color: #b00;
 color: #fff;
}

/*}}}*/
/***
!Sidebar options /%=================================================%/
~TiddlyLinks and buttons are treated identically in the sidebar and slider panel
***/
/*{{{*/
#sidebar {
 color: #000;
 background: #eeb;
 border-right: 3px solid #bb8;
 border-bottom: 3px solid #520;
}

#sidebarOptions .sliderPanel {
 background: #fff;
}

#sidebarOptions .sliderPanel a {
 border: none;
 color: #700;
}

#sidebarOptions .sliderPanel a:hover {
 color: #fff;
 background: #700;
}

#sidebarOptions .sliderPanel a:active {
 color: #700;
 background: #fff;
}

#sidebarOptions a {
 color: #700;
 border: none;
}

#sidebarOptions a:hover, #sidebarOptions a:active {
 color: #fff;
 background: #700;
}

/*}}}*/
/***
!Message Area /%=================================================%/
***/
/*{{{*/
#messageArea {
 border-right: 3px solid #da1;
 border-bottom: 3px solid #a80;
 background: #ffe72f;
 color: #014;
}

/*}}}*/
/***
!Popup /%=================================================%/
***/
/*{{{*/
.popup {
 background: #cf6;
 border: none;
}

.popup hr {
 color: #000;
}

.popup li.disabled {
 color: #666;
 background: #cf6;
}

.popup li a, .popup li a:visited {
 color: #000;
 border: 1px outset #cf6;
 background: #cf6;
}

.popup li a:hover {
 color: #000;
 border: 1px outset #cf6;
 background: #ef9;
}
/*}}}*/
/***
!Tiddler Display /%=================================================%/
***/
/*{{{*/
.tiddler {
 background: #fff;
 border-right: 3px solid #aaa;
 border-bottom: 3px solid #555;
}

.title {
 color: #900;
}

.selected .toolbar a {
 color: #000;
}

.toolbar .button {
 background: #eeb /*#cf6*/;
 border: 1px outset #eeb /*#cf6*/;
}

.selected .toolbar .button:hover {
 background: #700 /*#ef9*/;
 color: #fff;
}

#mainMenu .calendar { border: 1px solid white; }
#mainMenu .calendar, #mainMenu .calendar tr, #mainMenu .calendar td, #mainMenu .calendar a {
}

/*}}}*/

/***
!Additional print overrides for fancy style /%==============================================%/
***/
/*{{{*/

@media print {

.tiddler {
 /* get rid of our fancy tiddler outline */
 border: none;
}

}
/*}}}*/
Also known as the green house.
The outcome for this project is to have a place for guests to stay that is not in the FarmHouse. 
wood stove
Ceiling fan

/***
|Name|LoadTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#LoadTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#LoadTiddlersPluginInfo|
|Version|3.6.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|macro for automated updates or one-click installations of tiddlers from remote sources|
!!!!!Documentation
>see [[LoadTiddlersPluginInfo]]
!!!!!Configuration
<<<
__password-protected server settings //(optional, if needed)//:__
>username: <<option txtRemoteUsername>> password: <<option txtRemotePassword>>
>{{{usage: <<option txtRemoteUsername>> <<option txtRemotePassword>>}}}
>''note: these settings are also used by [[ExternalTiddlersPlugin]] and [[ImportTiddlersPlugin]]''
<<<
!!!!!Revisions
<<<
2008.10.27 [3.6.3] in doImport(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
|please see [[LoadTiddlersPluginInfo]] for additional revision details|
2005.07.20 [1.0.0] Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.LoadTiddlersPlugin= {major: 3, minor: 6, revision: 3, date: new Date(2008,10,27)};

config.macros.loadTiddlers = {
	label: "",
	tip: "add/update tiddlers from '%0'",
	lockedTag: "noReload",	// if existing tiddler has this tag value, don't overwrite it, even if inbound tiddler is newer
	askMsg: "Please enter a local path/filename or a remote URL",
	openMsg: "Opening %0",
	openErrMsg: "Could not open %0 - error=%1",
	readMsg: "Read %0 bytes from %1",
	foundMsg: "Found %0 tiddlers in %1",
	nochangeMsg: "'%0' is up-to-date... skipped.",
	lockedMsg: "'%0' is tagged '%1'... skipped.",
	skippedMsg: "skipped (cancelled by user)",
	loadedMsg: "Loaded %0 of %1 tiddlers from %2",
	reportTitle: "ImportedTiddlers",
	warning: "Warning!!  Processing '%0' as a systemConfig (plugin) tiddler may produce unexpected results! Are you sure you want to proceed?",
	handler: function(place,macroName,params) {
		var label=(params[0] && params[0].substr(0,6)=='label:')?params.shift().substr(6):this.label;
		var tip=(params[0] && params[0].substr(0,7)=='prompt:')?params.shift().substr(7):this.tip;
		var filter="updates";
		if (params[0] && (params[0]=='all' || params[0]=='new' || params[0]=='changes' || params[0]=='updates'
			|| params[0].substr(0,8)=='tiddler:' || params[0].substr(0,4)=='tag:'))
			filter=params.shift();
		var src=params.shift(); if (!src || !src.length) return; // filename is required
		var quiet=(params[0]=="quiet"); if (quiet) params.shift();
		var ask=(params[0]=="confirm"); if (ask) params.shift();
		var force=(params[0]=="force"); if (force) params.shift();
		var init=(params[0]=="init"); if (init) params.shift();
		var noreport=(params[0]=="noreport"); if (noreport) params.shift();
		this.newTags=[]; if (params[0]) this.newTags=params; // any remaining params are used as "autotags"
		if (label.trim().length) {
			// link triggers load tiddlers from another file/URL and then applies filtering rules to add/replace tiddlers in the store
			createTiddlyButton(place,label.format([src.replace(/%20/g," ")]),tip.format([src.replace(/%20/g," ")]), function() {
				if (src=="ask") src=prompt(this.askMsg);
				config.macros.loadTiddlers.loadFile(src,config.macros.loadTiddlers.doImport,{quiet:quiet,ask:ask,filter:filter,force:force,init:init,noreport:noreport});
			})
		}
		else {
			// load tiddlers from another file/URL and then apply filtering rules to add/replace tiddlers in the store
			if (src=="ask") src=prompt(this.askMsg);
			config.macros.loadTiddlers.loadFile(src,config.macros.loadTiddlers.doImport,{quiet:quiet,ask:ask,filter:filter,force:force,init:init,noreport:noreport});
		}
	},
	loadFile: function(src,callback,params) {
		var quiet=params.quiet;
		if (src==undefined || !src.length) return null; // filename is required
		if (!quiet) clearMessage();
		if (!quiet) displayMessage(this.openMsg.format([src.replace(/%20/g," ")]));
		if (src.substr(0,5)!="http:" && src.substr(0,5)!="file:") { // if not a URL, read from local filesystem
			var txt=loadFile(src);
			if (!txt) { // file didn't load, might be relative path.. try fixup
				var pathPrefix=document.location.href;  // get current document path and trim off filename
				var slashpos=pathPrefix.lastIndexOf("/"); if (slashpos==-1) slashpos=pathPrefix.lastIndexOf("\\"); 
				if (slashpos!=-1 && slashpos!=pathPrefix.length-1) pathPrefix=pathPrefix.substr(0,slashpos+1);
				src=pathPrefix+src;
				if (pathPrefix.substr(0,5)!="http:") src=getLocalPath(src);
				var txt=loadFile(src);
			}
			if (!txt) { // file still didn't load, report error
				if (!quiet) displayMessage(this.openErrMsg.format([src.replace(/%20/g," "),"(unknown)"]));
			} else {
				if (!quiet) displayMessage(this.readMsg.format([txt.length,src.replace(/%20/g," ")]));
				if (callback) callback(true,params,convertUTF8ToUnicode(txt),src,null);
			}
		} else {
			var name=config.options.txtRemoteUsername; var pass=config.options.txtRemotePassword;
			var x=doHttp("GET",src,null,null,name,pass,callback,params,null);
		}
	},
	readTiddlersFromHTML: function(html) {
		// for TW2.2+
		if (TiddlyWiki.prototype.importTiddlyWiki!=undefined) {
			var remoteStore=new TiddlyWiki();
			remoteStore.importTiddlyWiki(html);
			return remoteStore.getTiddlers("title");	
		}
	},
	doImport: function(status,params,html,src,xhr) {
		var quiet=params.quiet;
		var ask=params.ask;
		var filter=params.filter;
		var force=params.force;
		var init=params.init;
		var noreport=params.noreport;
		var tiddlers = config.macros.loadTiddlers.readTiddlersFromHTML(html);
		var count=tiddlers?tiddlers.length:0;
		var querypos=src.lastIndexOf("?"); if (querypos!=-1) src=src.substr(0,querypos);
		if (!quiet) displayMessage(config.macros.loadTiddlers.foundMsg.format([count,src.replace(/%20/g," ")]));
		store.suspendNotifications();
		var count=0;
		if (tiddlers) for (var t=0;t<tiddlers.length;t++) {
			var inbound = tiddlers[t];
			var theExisting = store.getTiddler(inbound.title);
			if (inbound.title==config.macros.loadTiddlers.reportTitle)
				continue; // skip "ImportedTiddlers" history from the other document...
			if (theExisting && theExisting.tags.contains(config.macros.loadTiddlers.lockedTag)) {
				if (!quiet) displayMessage(config.macros.loadTiddlers.lockedMsg.format([theExisting.title,config.macros.loadTiddlers.lockedTag]));
				continue; // skip existing tiddler if tagged with 'noReload'
			}
			// apply the all/new/changes/updates filter (if any)
			if (filter && filter!="all") {
				if ((filter=="new") && theExisting) // skip existing tiddlers
					continue;
				if ((filter=="changes") && !theExisting) // skip new tiddlers
					continue;
				if ((filter.substr(0,4)=="tag:") && inbound.tags.indexOf(filter.substr(4))==-1) // must match specific tag value
					continue;
				if ((filter.substr(0,8)=="tiddler:") && inbound.title!=filter.substr(8)) // must match specific tiddler name
					continue;
				if (!force && store.tiddlerExists(inbound.title) && ((theExisting.modified.getTime()-inbound.modified.getTime())>=0)) {
					var msg=config.macros.loadTiddlers.nochangeMsg;
					if (!quiet&&msg.length) displayMessage(msg.format([inbound.title]));
					continue;
				}
			}
			// get confirmation if required
			if (ask && !confirm((theExisting?"Update":"Add")+" tiddler '"+inbound.title+"'\nfrom "+src.replace(/%20/g," ")+"\n\nOK to proceed?"))
				{ tiddlers[t].status=config.macros.loadTiddlers.skippedMsg; continue; }
			// DO IT!
			var tags=new Array().concat(inbound.tags,config.macros.loadTiddlers.newTags);
	                store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, tags, inbound.fields, true, inbound.created);
	                store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value - needed for TW2.1.3 or earlier
			tiddlers[t].status=theExisting?"updated":"added"
			if (init && tags.contains("systemConfig") && !tags.contains("systemConfigDisable")) {
				var ok=true;
				if (ask||!quiet) ok=confirm(config.macros.loadTiddlers.warning.format([inbound.title]))
				if (ok) { // run the plugin
					try { window.eval(inbound); tiddlers[t].status+=" (plugin initialized)"; }
					catch(ex) { displayMessage(config.messages.pluginError.format([exceptionText(ex)])); }
				}
			}
			count++;
		}
		store.resumeNotifications();
		if (count) {
			// refresh display
			store.setDirty(true); store.notifyAll();
			// generate a report
			if (!noreport) config.macros.loadTiddlers.report(src,tiddlers,count,quiet);
		}
		// always show final message when tiddlers were actually loaded
		if (!quiet||count) displayMessage(config.macros.loadTiddlers.loadedMsg.format([count,tiddlers.length,src.replace(/%20/g," ")]));
	},
	report: function(src,tiddlers,count,quiet) {
		// format the new report content
		var newText = "On "+(new Date()).toLocaleString()+", ";
		newText += config.options.txtUserName+" loaded "+count+" tiddlers ";
		newText += "from\n[["+src+"|"+src+"]]:\n";
		newText += "<<<\n";
		for (var t=0; t<tiddlers.length; t++)
			if (tiddlers[t].status)
				newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\n";
		newText += "<<<\n";
		// get current report (if any)
		var title=config.macros.loadTiddlers.reportTitle;
		var currText="";
		var theReport = store.getTiddler(title);
		if (theReport) currText=((theReport.text!="")?'\n----\n':"")+theReport.text;
		// update the ImportedTiddlers content and show the tiddler
		store.saveTiddler(title, title, newText+currText, config.options.txtUserName, new Date(), theReport?theReport.tags:null, theReport?theReport.fields:null);
		if (!quiet) { story.displayTiddler(null,title,1,null,null,false); story.refreshTiddler(title,1,true); }
	}
}
//}}}
/***
|Name|LoadTiddlersPluginInfo|
|Source|http://www.TiddlyTools.com/#LoadTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#LoadTiddlersPluginInfo|
|Version|3.6.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|documentation|
|Requires||
|Overrides||
|Description|documentation for LoadTiddlersPlugin|
!!!!!Usage
<<<
Syntax:
{{{<<loadTiddlers label:text prompt:text filter source quiet confirm force init noreport tag tag tag...>>}}}

Example:
{{{<<loadTiddlers "label:load tiddlers from %0" example.html confirm temporary>>}}}
<<loadTiddlers "label:load tiddlers from %0" example.html confirm temporary>>

Where:
''"""label:text"""'' and ''"""prompt:text"""''
>defines link text and tooltip (prompt) that can be clicked to trigger the load tiddler processing.  If a label is NOT provided, then no link is created and the loadTiddlers function is performed whenever the containing tiddler is rendered.
''filter'' (optional) determines which tiddlers will be automatically selected for importing.  Use one of the following keywords:
>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.
>''"new"'' retrieves only tiddlers that are found in the import source document, but do not yet exist in the destination document
>''"changes"'' retrieves only tiddlers that exist in both documents for which the import source tiddler is newer than the existing tiddler
>''"updates"'' retrieves both ''new'' and ''changed'' tiddlers (this is the default action when none is specified)
>''""""tiddler:TiddlerName""""'' retrieves only the specific tiddler named in the parameter.
>''""""tag:text""""'' retrieves only the tiddlers tagged with the indicated text.
>> Note: ''if an existing tiddler is tagged with 'noReload', then it will not be overwritten'', even if the inbound tiddler has been selected by the filtering process.  This allows you to make local changes to imported tiddlers while ensuring that those changes won't be lost due to automatic tiddler updates retrieved from the import source document.
''source'' (required) is the location of the imported document.  It can be either a local document path/filename in whatever format your system requires, or a remote web location (starting with "http://" or "https://")
>use the keyword ''ask'' to prompt for a source location whenever the macro is invoked
''"quiet"'' (optional)
>supresses all status message during the import processing (e.g., "opening local file...", "found NN tiddlers..." etc).  Note that if ANY tiddlers are actualy imported, a final information message will still be displayed (along with the ImportedTiddlers report), even when 'quiet' is specified.  This ensures that changes to your document cannot occur without any visible indication at all.
''"confirm"'' (optional)
>adds interactive confirmation.  A browser message box (OK/Cancel) is displayed for each tiddler that will be imported, so that you can manually bypass any tiddlers that you do not want to import.
''"init"'' (optional)
>invoke tiddlers tagged with <<tag systemConfig>> as plugins as soon as they are imported, without requiring a save-and-reload action first.  For safety, a browser message box (OK/Cancel) is displayed for each imported plugin, so that you can manually bypass any plugins that you do not want to invoke.  Note, however, that those tiddlers are still //imported// into your document and therefore will still take effect the next time you save-and-reload the document.
''"force"'' (optional)
>import all matching tiddlers, even if unchanged
''"noreport"'' (optional)
>suppress generation of [[ImportedTiddlers]] report
''"tag tag tag..."'' (optional)
>any remaining parameters are used as tag values to be added to each imported tiddler (i.e., "tag-on-import")
<<<
!!!!!Configuration
<<<
__password-protected server settings //(optional, if needed)//:__
>username: <<option txtRemoteUsername>> password: <<option txtRemotePassword>>
>{{{usage: <<option txtRemoteUsername>> <<option txtRemotePassword>>}}}
>''note: these settings are also used by [[ExternalTiddlersPlugin]] and [[ImportTiddlersPlugin]]''
<<<
!!!!!Revisions
<<<
2008.10.27 [3.6.3] in doImport(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
2008.08.05 [3.6.2] rewrote loadFile() to eliminate use of platform-specific fileExists() test
2008.08.03 [3.6.1] in handler(), changed variable 'prompt' to 'tip' to avoid conflict with prompt() function
2008.01.07 [3.6.0] added 'init' option to automatically invoke plugin tiddlers as soon as they are loaded (without needing save/reload)
2008.01.03 [3.5.0] in loadFile(), use lower-level doHttp() instead of loadRemoteFile() in order to support username/password access to remote server
2007.12.04 [*.*.*] update for TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.06.27 [3.4.8] added missing 'fields' params to saveTiddler() call. Fixes problem where importing tiddlers would lose the custom fields.
2007.06.25 [3.4.7] add calls to store.suspendNotifications() and store.resumeNotifications() to eliminate redisplay overhead DURING import activities.
2007.05.27 [3.4.6] in handler(),  loadRemoteFile() and doImport(), added 'noreport' flag to suppress generation of ImportedTiddlers
2007.05.27 [3.4.5] in handler(),  initialize 'newTags' to [] (empty array) instead of null... fixes fatal error when loading tiddler without autotagging.
2007.04.22 [3.4.4] in readTiddlersFromHTML(), for TW2.2 and above, use importTiddlyWiki() (new core functionality) to get tiddlers from remote file content.  Also, copied updated TW21Loader.prototype.internalizeTiddler() definition from TW2.2b5 so plugin can read tiddlers from TW2.2+ even when running under TW2.1.x
2007.04.05 [3.4.3] in doImport(), changed this.readTiddlersFromHTML(html) to config.macros.loadTiddlers.readTiddlersFromHTML(html).  Fixes error caused when ImportTiddlersPlugin has NOT been installed along side this plugin.
2007.03.26 [3.4.2] renamed import() to doImport() to fix IE load-time error ("identifier expected").  This may also cause a problem with FF1.5.0.x.... Apparently, "import" is a reserved word in some browsers...
2007.03.22 [3.4.1] code cleanup: moved all functions inside object def'n, re-wrote report function
2007.03.21 [3.4.0] split ImportTiddlersPlugin and LoadTiddlersPlugin functionality into separate plugins
|please see [[ImportTiddlersPluginInfo]] for additional revision details|
2005.07.20 [1.0.0] Initial Release
<<<
<<tiddler GTDMenu>>
[[Help|http://www.blogjones.com/TiddlyWikiTutorial.html#EasyToEdit]][[About]]
Hello,
I am Mike, the chief goat wrangler and Grand Poobah here at StoneFace Farm.

I am retired from the Boeing Company where I worked for 28 years as a designer, programmer and computing analyst.

These are my projects, journals and adventures as I work to become a productive rancher of a small sustainable farming and ranching operation.
/***
|Name|NestedSlidersPlugin|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Documentation|http://www.TiddlyTools.com/#NestedSlidersPluginInfo|
|Version|2.4.5|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|show content in nest-able sliding/floating panels, without creating separate tiddlers for each panel's content|
!!!!!Documentation
>see [[NestedSlidersPluginInfo]]
!!!!!Configuration
<<<
<<option chkFloatingSlidersAnimate>> allow floating sliders to animate when opening/closing
>Note: This setting can cause 'clipping' problems in some versions of InternetExplorer.
>In addition, for floating slider animation to occur you must also allow animation in general (see [[AdvancedOptions]]).
<<<
!!!!!Revisions
<<<
2008.06.07 - 2.4.5 in 'onmouseover' handler for 'open on hover' slider buttons,<br>use call() method when invoking document.onclick function (avoids error in IE)
|please see [[NestedSlidersPluginInfo]] for additional revision details|
2005.11.03 - 1.0.0 initial public release.  Thanks to RodneyGomes, GeoffSlocock, and PaulPetterson for suggestions and experiments.
<<<
!!!!!Code
***/
//{{{
version.extensions.nestedSliders = {major: 2, minor: 4, revision: 5, date: new Date(2008,6,7)};

// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkFloatingSlidersAnimate===undefined)
	config.options.chkFloatingSlidersAnimate=false; // avoid clipping problems in IE

// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
	background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");

config.formatters.push( {
	name: "nestedSliders",
	match: "\\n?\\+{3}",
	terminator: "\\s*\\={3}\\n?",
	lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\@\\[\\>]*\\^)?)?(\\*)?(\\@)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(\\[[^\\]]*\\])?(?:\\}{3})?(\\#[^:]*\\:)?(\\>)?(\\.\\.\\.)?\\s*",
	handler: function(w)
		{
			lookaheadRegExp = new RegExp(this.lookahead,"mg");
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source)
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
			{
				var defopen=lookaheadMatch[1];
				var cookiename=lookaheadMatch[2];
				var header=lookaheadMatch[3];
				var panelwidth=lookaheadMatch[4];
				var transient=lookaheadMatch[5];
				var hover=lookaheadMatch[6];
				var buttonClass=lookaheadMatch[7];
				var label=lookaheadMatch[8];
				var openlabel=lookaheadMatch[9];
				var panelID=lookaheadMatch[10];
				var blockquote=lookaheadMatch[11];
				var deferred=lookaheadMatch[12];

				// location for rendering button and panel
				var place=w.output;

				// default to closed, no cookie, no accesskey, no alternate text/tip
				var show="none"; var cookie=""; var key="";
				var closedtext=">"; var closedtip="";
				var openedtext="<"; var openedtip="";

				// extra "+", default to open
				if (defopen) show="block";

				// cookie, use saved open/closed state
				if (cookiename) {
					cookie=cookiename.trim().slice(1,-1);
					cookie="chkSlider"+cookie;
					if (config.options[cookie]==undefined)
						{ config.options[cookie] = (show=="block") }
					show=config.options[cookie]?"block":"none";
				}

				// parse label/tooltip/accesskey: [label=X|tooltip]
				if (label) {
					var parts=label.trim().slice(1,-1).split("|");
					closedtext=parts.shift();
					if (closedtext.substr(closedtext.length-2,1)=="=")	
						{ key=closedtext.substr(closedtext.length-1,1); closedtext=closedtext.slice(0,-2); }
					openedtext=closedtext;
					if (parts.length) closedtip=openedtip=parts.join("|");
					else { closedtip="show "+closedtext; openedtip="hide "+closedtext; }
				}

				// parse alternate label/tooltip: [label|tooltip]
				if (openlabel) {
					var parts=openlabel.trim().slice(1,-1).split("|");
					openedtext=parts.shift();
					if (parts.length) openedtip=parts.join("|");
					else openedtip="hide "+openedtext;
				}

				var title=show=='block'?openedtext:closedtext;
				var tooltip=show=='block'?openedtip:closedtip;

				// create the button
				if (header) { // use "Hn" header format instead of button/link
					var lvl=(header.length>5)?5:header.length;
					var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,buttonClass,title);
					btn.onclick=onClickNestedSlider;
					btn.setAttribute("href","javascript:;");
					btn.setAttribute("title",tooltip);
				}
				else
					var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,buttonClass);
				btn.innerHTML=title; // enables use of HTML entities in label

				// set extra button attributes
				btn.setAttribute("closedtext",closedtext);
				btn.setAttribute("closedtip",closedtip);
				btn.setAttribute("openedtext",openedtext);
				btn.setAttribute("openedtip",openedtip);
				btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
				btn.defOpen=defopen!=null; // save default open/closed state (boolean)
				btn.keyparam=key; // save the access key letter ("" if none)
				if (key.length) {
					btn.setAttribute("accessKey",key); // init access key
					btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
				}
				btn.setAttribute("hover",hover?"true":"false");
				btn.onmouseover=function(ev) {
					// optional 'open on hover' handling
					if (this.getAttribute("hover")=="true" && this.sliderPanel.style.display=='none') {
						document.onclick.call(document,ev); // close transients
						onClickNestedSlider(ev); // open this slider
					}
					// mouseover on button aligns floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel);
				}

				// create slider panel
				var panelClass=panelwidth?"floatingPanel":"sliderPanel";
				if (panelID) panelID=panelID.slice(1,-1); // trim off delimiters
				var panel=createTiddlyElement(place,"div",panelID,panelClass,null);
				panel.button = btn; // so the slider panel know which button it belongs to
				btn.sliderPanel=panel; // so the button knows which slider panel it belongs to
				panel.defaultPanelWidth=(panelwidth && panelwidth.length>2)?panelwidth.slice(1,-1):"";
				panel.setAttribute("transient",transient=="*"?"true":"false");
				panel.style.display = show;
				panel.style.width=panel.defaultPanelWidth;
				panel.onmouseover=function(event) // mouseover on panel aligns floater position with button
					{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this); }

				// render slider (or defer until shown) 
				w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
				if ((show=="block")||!deferred) {
					// render now if panel is supposed to be shown or NOT deferred rendering
					w.subWikify(blockquote?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
					// align floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel);
				}
				else {
					var src = w.source.substr(w.nextMatch);
					var endpos=findMatchingDelimiter(src,"+++","===");
					panel.setAttribute("raw",src.substr(0,endpos));
					panel.setAttribute("blockquote",blockquote?"true":"false");
					panel.setAttribute("rendered","false");
					w.nextMatch += endpos+3;
					if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
				}
			}
		}
	}
)

function findMatchingDelimiter(src,starttext,endtext) {
	var startpos = 0;
	var endpos = src.indexOf(endtext);
	// check for nested delimiters
	while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
		// count number of nested 'starts'
		var startcount=0;
		var temp = src.substring(startpos,endpos-1);
		var pos=temp.indexOf(starttext);
		while (pos!=-1)  { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
		// set up to check for additional 'starts' after adjusting endpos
		startpos=endpos+endtext.length;
		// find endpos for corresponding number of matching 'ends'
		while (startcount && endpos!=-1) {
			endpos = src.indexOf(endtext,endpos+endtext.length);
			startcount--;
		}
	}
	return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	while (theTarget && theTarget.sliderPanel==undefined) theTarget=theTarget.parentNode;
	if (!theTarget) return false;
	var theSlider = theTarget.sliderPanel;
	var isOpen = theSlider.style.display!="none";

	// toggle label
	theTarget.innerHTML=isOpen?theTarget.getAttribute("closedText"):theTarget.getAttribute("openedText");
	// toggle tooltip
	theTarget.setAttribute("title",isOpen?theTarget.getAttribute("closedTip"):theTarget.getAttribute("openedTip"));

	// deferred rendering (if needed)
	if (theSlider.getAttribute("rendered")=="false") {
		var place=theSlider;
		if (theSlider.getAttribute("blockquote")=="true")
			place=createTiddlyElement(place,"blockquote");
		wikify(theSlider.getAttribute("raw"),place);
		theSlider.setAttribute("rendered","true");
	}
	// show/hide the slider
	if(config.options.chkAnimate && (!hasClass(theSlider,'floatingPanel') || config.options.chkFloatingSlidersAnimate))
		anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
	else
		theSlider.style.display = isOpen ? "none" : "block";
	// reset to default width (might have been changed via plugin code)
	theSlider.style.width=theSlider.defaultPanelWidth;
	// align floater panel position with target button
	if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider);
	// if showing panel, set focus to first 'focus-able' element in panel
	if (theSlider.style.display!="none") {
		var ctrls=theSlider.getElementsByTagName("*");
		for (var c=0; c<ctrls.length; c++) {
			var t=ctrls[c].tagName.toLowerCase();
			if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
				{ ctrls[c].focus(); break; }
		}
	}
	var cookie=theTarget.sliderCookie;
	if (cookie && cookie.length) {
		config.options[cookie]=!isOpen;
		if (config.options[cookie]!=theTarget.defOpen)
			saveOptionCookie(cookie);
		else { // remove cookie if slider is in default display state
			var ex=new Date(); ex.setTime(ex.getTime()-1000);
			document.cookie = cookie+"=novalue; path=/; expires="+ex.toGMTString();
		}
	}

	// prevent SHIFT-CLICK from being processed by browser (opens blank window... yuck!)
	// prevent clicks *within* a slider button from being processed by browser
	// but allow plain click to bubble up to page background (to close transients, if any)
	if (e.shiftKey || theTarget!=resolveTarget(e))
		{ e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); }
	Popup.remove(); // close open popup (if any)
	return false;
}
//}}}
//{{{
// click in document background closes transient panels 
document.nestedSliders_savedOnClick=document.onclick;
document.onclick=function(ev) { if (!ev) var ev=window.event; var target=resolveTarget(ev);

	if (document.nestedSliders_savedOnClick)
		var retval=document.nestedSliders_savedOnClick.apply(this,arguments);
	// if click was inside a popup... leave transient panels alone
	var p=target; while (p) if (hasClass(p,"popup")) break; else p=p.parentNode;
	if (p) return retval;
	// if click was inside transient panel (or something contained by a transient panel), leave it alone
	var p=target; while (p) {
		if ((hasClass(p,"floatingPanel")||hasClass(p,"sliderPanel"))&&p.getAttribute("transient")=="true") break;
		p=p.parentNode;
	}
	if (p) return retval;
	// otherwise, find and close all transient panels...
	var all=document.all?document.all:document.getElementsByTagName("DIV");
	for (var i=0; i<all.length; i++) {
		 // if it is not a transient panel, or the click was on the button that opened this panel, don't close it.
		if (all[i].getAttribute("transient")!="true" || all[i].button==target) continue;
		// otherwise, if the panel is currently visible, close it by clicking it's button
		if (all[i].style.display!="none") window.onClickNestedSlider({target:all[i].button}) 
	}
	return retval;
};
//}}}
//{{{
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel) {
	if (hasClass(panel,"floatingPanel")) {
		var rightEdge=document.body.offsetWidth-1;
		var panelWidth=panel.offsetWidth;
		var left=0;
		var top=btn.offsetHeight; 
		if (place.style.position=="relative" && findPosX(btn)+panelWidth>rightEdge) {
			left-=findPosX(btn)+panelWidth-rightEdge; // shift panel relative to button
			if (findPosX(btn)+left<0) left=-findPosX(btn); // stay within left edge
		}
		if (place.style.position!="relative") {
			var left=findPosX(btn);
			var top=findPosY(btn)+btn.offsetHeight;
			var p=place; while (p && !hasClass(p,'floatingPanel')) p=p.parentNode;
			if (p) { left-=findPosX(p); top-=findPosY(p); }
			if (left+panelWidth>rightEdge) left=rightEdge-panelWidth;
			if (left<0) left=0;
		}
		panel.style.left=left+"px"; panel.style.top=top+"px";
	}
}
//}}}
//{{{
// TW2.1 and earlier:
// hijack Slider stop handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
	{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }

// TW2.2+
// hijack Morpher stop handler so sliderPanel/floatingPanel overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
	Morpher.prototype.coreStop = Morpher.prototype.stop;
	Morpher.prototype.stop = function() {
		this.coreStop.apply(this,arguments);
		var e=this.element;
		if (hasClass(e,"sliderPanel")||hasClass(e,"floatingPanel")) {
			// adjust panel overflow and position after animation
			e.style.overflow = "visible";
			if (window.adjustSliderPos) window.adjustSliderPos(e.parentNode,e.button,e);
		}
	};
}
//}}}

<<gtdActionList>>
The outcome for this project is 
|''URL:''|http://dcubed.ca/d3-update-13.html|
|''Description:''|Official d-cubed feed|
|''Author:''|Tom Otvos|
<div class='header' macro='gradient vert #000 #464646'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu' force='true'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
! Active projects with remaining actions
<<gtdActionList *>>
! Projects with no open actions
<<list tagged "project done -someday">>
*+++(gtdImportantProjectsSliderState)[Important:] <<list tagged "project important -someday" all>>===
+++(gtdOtherProjectsSliderState)[Other:] <<list tagged "project -syntora -important -someday" all>>===
<<list tagged txtGTDReferenceContext any>>
/***
|''Name:''|ReminderPlugin|
|''Version:''|2.3.8.3 (Nov 28, 2006)|
|''Source:''|http://www.geocities.com/allredfaq/reminderMacros.html|
|''Author:''|Jeremy Sheeley(pop1280 [at] excite [dot] com)|
|''Modified by:''|Tom Otvos|
|''Licence:''|[[BSD open source license]]|
|''Macros:''|reminder, showreminders, displayTiddlersWithReminders, newReminder|
|''TiddlyWiki:''|2.0+|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|

!Description
This plugin provides macros for tagging a date with a reminder.  Use the {{{reminder}}} macro to do this.  The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.

''This version contains a fix by Tom Otvos that modifies tag filtering when tiddlers contain no tags. In this version, if you are filtering showReminders by tag, and a tiddler has no tags, the filter will //not// match the tiddler. There are also a number of small UI-related changes to make the reminder interface a bit nicer. Do not copy this into your own TW documents unless you accept these changes.''

!Installation
* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag.  The tag is important because it tells TW that this is executable code.
* Double click this tiddler, and copy all the text from the tiddler's body.
* Paste the text into the body of the new tiddler in your TW.
* Save and reload your TW.
* You can copy some examples into your TW as well.  See [[Simple examples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]

!Syntax:
|>|See [[ReminderSyntax]] and [[showRemindersSyntax]]|

!Revision history
* v2.3.8 (Mar 9, 2006)
**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1
**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format
* v2.3.6 (Mar 1, 2006)
**Bug fix: Reminders for today weren't being matched sometimes.
**Feature:  Solidified integration with DatePlugin and CalendarPlugin
**Feature:  Recurring reminders will now return multiple hits in showReminders and the calendar.
**Feature:  Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.
* v2.3.5 (Feb 8, 2006)
**Bug fix: Sped up reminders lots.  Added a caching mechanism for reminders that have already been matched.
* v2.3.4 (Feb 7, 2006)
**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins 
to crash Firefox.  Thanks to http://www.jslint.com
* v2.3.3 (Feb 2, 2006)
**Feature: newReminder now has drop down lists instead of text boxes.
**Bug fix:  A trailing space in a title would trigger an infinite loop.
**Bug fix:  using tag:"birthday !reminder" would filter differently than tag:"!reminder birthday"
* v2.3.2 (Jan 21, 2006)
**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.
** Bug fix: offsetday was not working sometimes
** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch.  I've reverted back to searching through all tiddlers
* v2.3.1 (Jan 7, 2006)
**Feature: 2.0 compatibility
**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.
* v2.3.0 (Jan 3, 2006)
** Bug Fix:  Using "Last Sunday (-0)" as a offsetdayofweek wasn't working.
** Bug Fix:  Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.

!Code
***/
//{{{

//============================================================================
//============================================================================
//           ReminderPlugin
//============================================================================
//============================================================================

version.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: "http://www.geocities.com/allredfaq/reminderMacros.html"};

//============================================================================
// Configuration
// Modify this section to change the defaults for 
// leadtime and display strings
//============================================================================

config.macros.reminders = {};
config.macros["reminder"] = {};
config.macros["newReminder"] = {};
config.macros["showReminders"] = {};
config.macros["displayTiddlersWithReminders"] = {};

config.macros.reminders["defaultLeadTime"] = [0,365];
config.macros.reminders["defaultReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY";
config.macros.reminders["defaultShowReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY -- TIDDLER";
config.macros.reminders["defaultAnniversaryMessage"] = "(DIFF)";
config.macros.reminders["untitledReminder"] = "Untitled Reminder";
config.macros.reminders["noReminderFound"] = "Couldn't find a match for TITLE in the next LEADTIMEUPPER days."
config.macros.reminders["todayString"] = "Today";
config.macros.reminders["tomorrowString"] = "Tomorrow";
config.macros.reminders["ndaysString"] = "DIFF days";
config.macros.reminders["emtpyShowRemindersString"] = "There are no upcoming events";


//============================================================================
//  Code
// You should not need to edit anything 
// below this.  Make sure to edit this tiddler and copy 
// the code from the text box, to make sure that 
// tiddler rendering doesn't interfere with the copy 
// and paste.
//============================================================================

// This line is to preserve 1.2 compatibility
// if (!story) var story=window; 
//this object will hold the cache of reminders, so that we don't
//recompute the same reminder over again.
var reminderCache = {};

config.macros.showReminders.handler = function showReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the 
         //leadtime a few lines down.
         paramHash["leadtime"] = [-10000, 10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }

   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   var elem = createTiddlyElement(place,"span",null,null, null);
   var mess = "";
   if (arr.length == 0)
   {
      mess += config.macros.reminders.emtpyShowRemindersString; 
   }
   for (var j = 0; j < arr.length; j++)
   {
      if (paramHash["format"] != null)
      {
         arr[j]["params"]["format"] = paramHash["format"];
      }
      else
      {
         arr[j]["params"]["format"] = config.macros.reminders["defaultShowReminderMessage"];
      }
      mess += getReminderMessageForDisplay(arr[j]["diff"], arr[j]["params"], arr[j]["matchedDate"], arr[j]["tiddler"]);
      mess += "\n";
   }
   wikify(mess, elem, null, null);
};


config.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the leadtime 
         //a few lines down.
         paramHash["leadtime"] = [-10000,10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }
   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   for (var j = 0; j < arr.length; j++)
   {
      displayTiddler(null, arr[j]["tiddler"], 0, null, false, false, false);
   }
};

config.macros.reminder.handler = function reminder(place,macroName,params)
{
   var dateHash = getParamsForReminder(params);
   if (dateHash["hidden"] != null)
   {
      return;
   }
   var leadTime = dateHash["leadtime"];
   if (leadTime == null)
   {
      leadTime = config.macros.reminders["defaultLeadTime"]; 
   }
   var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);
   var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);
   var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);
   if (!window.story) 
   {
      window.story=window; 
   }
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(place).id.substr(7);
   if (matchedDate != null)
   {
      var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());
      var elem = createTiddlyElement(place,"span",null,null, null);
      var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);
      wikify(mess, elem, null, null);
   }
   else
   {
      createTiddlyElement(place,"span",null,null, config.macros.reminders["noReminderFound"].replace("TITLE", dateHash["title"]).replace("LEADTIMEUPPER", leadTime[1]).replace("LEADTIMELOWER", leadTime[0]).replace("TIDDLERNAME", title).replace("TIDDLER", "[[" + title + "]]") );
   }
};

config.macros.newReminder.handler = function newReminder(place,macroName,params)
{
	// tomo - cleaned up the form layout a bit
	var today=new Date().getMidnight();
	var formstring = '<html><br/><form>';
	
	formstring += 'Year: <select name="year"><option value="">Every year</option>';
	for (var i = 0; i < 5; i++)
	{
		formstring += '<option' + ((i == 0) ? ' selected' : '') + ' value="' + (today.getFullYear() +i) + '">' + (today.getFullYear() + i) + '</option>';
	}
	formstring += '</select>&nbsp;&nbsp;Month: <select name="month"><option value="">Every month</option>';
	for (i = 0; i < 12; i++)
	{
		formstring += '<option' + ((i == today.getMonth()) ? ' selected' : '') + ' value="' + (i+1) + '">' + config.messages.dates.months[i] + '</option>';
	}
	formstring += '</select>&nbsp;&nbsp;Day: <select name="day"><option value="">Every day</option>';
	for (i = 1; i < 32; i++)
	{
		formstring += '<option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value="' + i + '">' + i + '</option>';
	}
	formstring += '</select>&nbsp;&nbsp;&nbsp;&nbsp;Reminder Title: <input type="text" size="40" name="title" value="" onfocus="this.select();">&nbsp;&nbsp;<input type="button" value="Add reminder" onclick="addReminderToTiddler(this.form)">';
	formstring += '</form></html>';
	
	var panel = config.macros.slider.createSlider(place, null, "New Reminder", "Open a form to add a new reminder to this tiddler");
	wikify(formstring, panel, null, store.getTiddler(params[1]));
};

// onclick: process input and insert reminder at 'marker'
window.addReminderToTiddler = function(form) {
	if (!window.story) 
	{
		window.story=window; 
	}
	if (!store.getTiddler) 
	{
		store.getTiddler=function(title) {return this.tiddlers[title];};
	}
	var title = window.story.findContainingTiddler(form).id.substr(7);
	var tiddler=store.getTiddler(title);
	var txt='\n<<reminder ';
	if (form.year.value != "")
		txt += 'year:'+form.year.value + ' ';
	if (form.month.value != "")
		txt += 'month:'+form.month.value + ' ';
	if (form.day.value != "")
		txt += 'day:'+form.day.value + ' ';
	txt += 'title:"'+form.title.value+'" ';
	txt +='>>';
	tiddler.set(null,tiddler.text + txt);
	window.story.refreshTiddler(title,1,true);
	store.setDirty(true);
	// tomo - make sure to save if required
	if(config.options.chkAutoSave)
		saveChanges();
};

function hasTag(tiddlerTags, tagFilters)
{
	// tomo - this has been updated to work better with tag-less tiddlers
	
	//Make sure we respond well to empty tagFilterlists
	if (tagFilters.length==0) return true;
	
	var bHasTag = false;
	
	/*bNoPos says: "'till now there has been no check using a positive filter"
	Imagine a filterlist consisting of 1 negative filter:
	If the filter isn't matched, we want hasTag to be true.
	Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)
	
	If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false
	Thus: hasTag returns true.
	
	If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which
	means bHasTag must be true for hasTag to return true*/
	var bNoPos=true;
	
	for (var t3 = 0; t3 < tagFilters.length; t3++)
	{
		var negTest = tagFilters[t3].length > 1 && tagFilters[t3].charAt(0) == '!';
		// do the positive filter test outside of the tag loop, in case there are no tags!
		if (bNoPos && !negTest) bNoPos = false;
		
		for(var t2=0; t2<tiddlerTags.length; t2++)
		{
			if (negTest) 
			{
				if (tiddlerTags[t2] == tagFilters[t3].substring(1))
				{
					//If at any time a negative filter is matched, we return false
					return false;
				}
			}
			else 
			{
				if (tiddlerTags[t2] == tagFilters[t3])
				{
					//A positive filter is matched. As long as no negative filter is matched, hasTag will return true
					bHasTag=true;
				}
			}
		}
	}
	return (bNoPos || bHasTag);
};

//This function searches all tiddlers for the reminder  //macro.  It is intended that other plugins (like //calendar) will use this function to query for 
//upcoming reminders.
//The arguments to this function filter out reminders //based on when they will fire.
//
//ARGUMENTS:
//baseDate is the date that is used as "now".  
//leadtime is a two element int array, with leadtime[0] 
//         as the lower bound and leadtime[1] as the
//         upper bound.  A reasonable default is [0,14]
//tags is a space-separated list of tags to use to filter 
//         tiddlers.  If a tag name begins with an !, then 
//         only tiddlers which do not have that tag will 
//         be considered.  For example "examples holidays"  
//         will search for reminders in any tiddlers that  
//         are tagged with examples or holidays and 
//         "!examples !holidays" will search for reminders 
//         in any tiddlers that are not tagged with 
//         examples or holidays.  Pass in null to search 
//         all tiddlers.
//limit.  If limit is null, individual reminders can 
//        override the leadtime specified earlier.  
//        Pass in 1 in order to override that behavior.

window.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)
{
//function(searchRegExp,sortField,excludeTag)
//   var macroPattern = "<<([^>\\]+)(?:\\*)([^>]*)>>";
   var macroPattern = "<<(reminder)(.*)>>";
   var macroRegExp = new RegExp(macroPattern,"mg");
   var matches = store.search(macroRegExp,"title","");
   var arr = [];
   var tagsArray = null;
   if (tags != null)
   {
      tagsArray = tags.split(" ");
   }
   for(var t=matches.length-1; t>=0; t--)
   {
      if (tagsArray != null)
      {
         //If they specified tags to filter on, and this tiddler doesn't 
	 //match, skip it entirely.
         if ( ! hasTag(matches[t].tags, tagsArray))
         {
            continue;
         }
      }

      var targetText = matches[t].text;
      do {
         // Get the next formatting match
         var formatMatch = macroRegExp.exec(targetText);
         if(formatMatch && formatMatch[1] != null && formatMatch[1].toLowerCase() == "reminder")
         {
            //Find the matching date.
            
            var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};
            var dateHash = getParamsForReminder(params);
            if (limit != null || dateHash["leadtime"] == null)
            {
               if (leadtime == null)
                   dateHash["leadtime"] = leadtime;
               else
               {
                  dateHash["leadtime"] = [];
                  dateHash["leadtime"][0] = leadtime[0];
                  dateHash["leadtime"][1] = leadtime[1];
               }
            }
	    if (dateHash["leadtime"] == null)
               dateHash["leadtime"] = config.macros.reminders["defaultLeadTime"]; 
            var leadTimeLowerBound = baseDate.addDays(dateHash["leadtime"][0]);
            var leadTimeUpperBound = baseDate.addDays(dateHash["leadtime"][1]);
            var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
            while (matchedDate != null)
            {
               var hash = {};
               hash["diff"] = matchedDate.getDifferenceInDays(baseDate);
               hash["matchedDate"] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);
               hash["params"] = cloneParams(dateHash);
               hash["tiddler"] = matches[t].title;
               hash["tags"] = matches[t].tags;
               arr.pushUnique(hash);
	       if (dateHash["recurdays"] != null || (dateHash["year"] == null))
	       {
	         leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);
                 matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
	       }
	       else matchedDate = null;
            }
         }
      }while(formatMatch);
   }
   if(arr.length > 1)  //Sort the array by number of days remaining.
   {
      arr.sort(function (a,b) {if(a["diff"] == b["diff"]) {return(0);} else {return (a["diff"] < b["diff"]) ? -1 : +1; } });
   }
   return arr;
};

//This function takes the reminder macro parameters and
//generates the string that is used for display.
//This function is not intended to be called by 
//other plugins.
 window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)
{
   var anniversaryString = "";
   var reminderTitle = params["title"];
   if (reminderTitle == null)
   {
      reminderTitle = config.macros.reminders["untitledReminder"];
   }
   if (params["firstyear"] != null)
   {
      anniversaryString = config.macros.reminders["defaultAnniversaryMessage"].replace("DIFF", (matchedDate.getFullYear() - params["firstyear"]));
   }
   var mess = "";
   var diffString = "";
   if (diff == 0)
   {
      diffString = config.macros.reminders["todayString"];
   }
   else if (diff == 1)
   {
      diffString = config.macros.reminders["tomorrowString"];
   }
   else
   {
      diffString = config.macros.reminders["ndaysString"].replace("DIFF", diff);
   }
   var format = config.macros.reminders["defaultReminderMessage"];
   if (params["format"] != null)
   {
      format = params["format"];
   }
   mess = format;
//HACK!  -- Avoid replacing DD in TIDDLER with the date
   mess = mess.replace(/TIDDLER/g, "TIDELER");
   mess = matchedDate.formatStringDateOnly(mess);
   mess = mess.replace(/TIDELER/g, "TIDDLER");
   if (tiddlerTitle != null)
   {
      mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);
      mess = mess.replace(/TIDDLER/g, "[[" + tiddlerTitle + "]]");
   }
   
   mess = mess.replace("DIFF", diffString).replace("TITLE", reminderTitle).replace("DATE", matchedDate.formatString("DDD MMM DD, YYYY")).replace("ANNIVERSARY", anniversaryString);
   return mess;
};

// Parse out the macro parameters into a hashtable.  This
// handles the arguments for reminder, showReminders and 
// displayTiddlersWithReminders.
window.getParamsForReminder = function getParamsForReminder(params)
{
   var dateHash = {};
   var type = "";
   var num = 0;
   var title = "";
   for(var t=0; t<params.length; t++)
   {
      var split = params[t].split(":");
      type = split[0].toLowerCase();
      var value = split[1];
      for (var i=2; i < split.length; i++)
      {
         value += ":" + split[i];
      }
      if (type == "nolinks" || type == "limit" || type == "hidden")
      {
         num = 1;
      }
      else if (type == "leadtime")
      {
         var leads = value.split("...");
         if (leads.length == 1)
         {
            leads[1]= leads[0];
            leads[0] = 0;
         }
         leads[0] = parseInt(leads[0], 10);
         leads[1] = parseInt(leads[1], 10);
         num = leads;
      }
      else if (type == "offsetdayofweek")
      {
          if (value.substr(0,1) == "-")
          {
             dateHash["negativeOffsetDayOfWeek"] = 1;
	     value = value.substr(1);
          }
          num = parseInt(value, 10);
      }
      else if (type != "title" && type != "tag" && type != "format")
      {
         num = parseInt(value, 10);
      }
      else
      {
         title = value;
         t++;
         while (title.substr(0,1) == '"' && title.substr(title.length - 1,1) != '"' && params[t] != undefined)
         {
            title += " " + params[t++];
         }
         //Trim off the leading and trailing quotes
         if (title.substr(0,1) == "\"" && title.substr(title.length - 1,1)== "\"")
         {
            title = title.substr(1, title.length - 2);
            t--;
         }
         num = title;
      }
      dateHash[type] = num;
   }
   //date is synonymous with day
   if (dateHash["day"] == null)
   {
      dateHash["day"] = dateHash["date"];
   }
   return dateHash;
};

//This function finds the date specified in the reminder 
//parameters.  It will return null if no match can be
//found.  This function is not intended to be used by
//other plugins.
window.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)
{
   if (baseDate == null)
   {
     baseDate = new Date().getMidnight();
   }
   var hashKey = baseDate.convertToYYYYMMDDHHMM();
   for (var k in dateHash)
   {
      hashKey += "," + k + "|" + dateHash[k];
   }
   hashKey += "," + leadTimeLowerBound.convertToYYYYMMDDHHMM();
   hashKey += "," + leadTimeUpperBound.convertToYYYYMMDDHHMM();
   if (reminderCache[hashKey] == null)
   {
      //If we don't find a match in this run, then we will
      //cache that the reminder can't be matched.
      reminderCache[hashKey] = false;
   }
   else if (reminderCache[hashKey] == false)
   {
      //We've already tried this date and failed
      return null;
   }
   else
   {
      return reminderCache[hashKey];
   }
   
   var bOffsetSpecified = dateHash["offsetyear"] != null || 
				dateHash["offsetmonth"] != null || 
				dateHash["offsetday"] != null || 
				dateHash["offsetdayofweek"] != null || 
				dateHash["recurdays"] != null;
   
   // If we are matching the base date for a dayofweek offset, look for the base date a 
   //little further back.
   var tmp1leadTimeLowerBound = leadTimeLowerBound;  
   if ( dateHash["offsetdayofweek"] != null)
   {
      tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6);  
   }
   var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);
   if (matchedDate != null)
   {
      var newMatchedDate = matchedDate;
      if (dateHash["recurdays"] != null)
      {
         while (newMatchedDate.getTime() < leadTimeLowerBound.getTime())
         {
            newMatchedDate = newMatchedDate.addDays(dateHash["recurdays"]);
         }
      }
      else if (dateHash["offsetyear"] != null || 
		dateHash["offsetmonth"] != null || 
		dateHash["offsetday"] != null || 
		dateHash["offsetdayofweek"] != null)
      {
         var tmpdateHash = cloneParams(dateHash);
         tmpdateHash["year"] = dateHash["offsetyear"];
         tmpdateHash["month"] = dateHash["offsetmonth"];
         tmpdateHash["day"] = dateHash["offsetday"];
         tmpdateHash["dayofweek"] = dateHash["offsetdayofweek"];
	 var tmpleadTimeLowerBound = leadTimeLowerBound;
	 var tmpleadTimeUpperBound = leadTimeUpperBound;
	 if (tmpdateHash["offsetdayofweek"] != null)
	 {
	 	if (tmpdateHash["negativeOffsetDayOfWeek"] == 1)
		{
		   tmpleadTimeLowerBound = matchedDate.addDays(-6);
		   tmpleadTimeUpperBound = matchedDate;

		}
		else
		{
		   tmpleadTimeLowerBound = matchedDate;
		   tmpleadTimeUpperBound = matchedDate.addDays(6);
		}

	 }
	 newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);
         //The offset couldn't be matched.  return null.
         if (newMatchedDate == null)
         {
            return null;
         }
      }
      if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         reminderCache[hashKey] = newMatchedDate;
         return newMatchedDate;
      }
   }
   return null;
};

//This does much the same job as findDateForReminder, but
//this one doesn't deal with offsets or recurring 
//reminders.
Date.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)
{

   var bSpecifiedYear =     (dateHash["year"] != null);
   var bSpecifiedMonth =     (dateHash["month"] != null);
   var bSpecifiedDay =     (dateHash["day"] != null);
   var bSpecifiedDayOfWeek =     (dateHash["dayofweek"] != null);
   if (bSpecifiedYear && bSpecifiedMonth && bSpecifiedDay)
   {
      return new Date(dateHash["year"], dateHash["month"]-1, dateHash["day"], 0, 0);
   }
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedDay && bSpecifiedMonth && !bSpecifiedYear && !bSpecifiedDayOfWeek)
   {

      //Shortcut -- First try this year.  If it's too small, try next year.
      var tmpMidnight = this.getMidnight();
      var tmpDate = new Date(this.getFullYear(), dateHash["month"]-1, dateHash["day"], 0,0);
      if (tmpDate.getTime() < leadTimeLowerBound.getTime())
      {
         tmpDate = new Date((this.getFullYear() + 1), dateHash["month"]-1, dateHash["day"], 0,0);
      }
      if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         return tmpDate;
      }
      else
      {
         return null;
      }
   }

   var newDate = leadTimeLowerBound; 
   while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
   {
      var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);
      if (tmp != null)
        return tmp;
      newDate = newDate.addDays(1);
   }
};

function testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)
{
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedYear)
   {
      bMatchedYear = (dateHash["year"] == testMe.getFullYear());
   }
   if (bSpecifiedMonth)
   {
      bMatchedMonth = ((dateHash["month"] - 1)  == testMe.getMonth() );
   }
   if (bSpecifiedDay)
   {
      bMatchedDay = (dateHash["day"] == testMe.getDate());
   }
   if (bSpecifiedDayOfWeek)
   {
      bMatchedDayOfWeek = (dateHash["dayofweek"] == testMe.getDay());
   }

   if (bMatchedYear && bMatchedMonth && bMatchedDay && bMatchedDayOfWeek)
   {
      return testMe;
   }
};

//Returns true if the date is in between two given dates
Date.prototype.isBetween = function isBetween(lowerBound, upperBound)
{
  return (this.getTime() >= lowerBound.getTime() && this.getTime() <= upperBound.getTime());
}
//Return a new date, with the time set to midnight (0000)
Date.prototype.getMidnight = function getMidnight()
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);
};
// Add the specified number of days to a date.
Date.prototype.addDays = function addDays(numberOfDays)
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);
};
//Return the number of days between two dates.
Date.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)
{
//I have to do it this way, because this way ignores daylight savings
   var tmpDate = this.addDays(0);
   if (this.getTime() > otherDate.getTime())
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() > otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(-1);
      }
      return i;
   }
   else
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() < otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(1);
      }
      return i * -1;
   }
   return 0;
};
function cloneParams(what) {
    var tmp = {};
    for (var i in what) {
        tmp[i] = what[i];
    }
    return tmp;
}
// Substitute date components into a string
Date.prototype.formatStringDateOnly = function formatStringDateOnly(template)
{
	template = template.replace("YYYY",this.getFullYear());
	template = template.replace("YY",String.zeroPad(this.getFullYear()-2000,2));
	template = template.replace("MMM",config.messages.dates.months[this.getMonth()]);
	template = template.replace("0MM",String.zeroPad(this.getMonth()+1,2));
	template = template.replace("MM",this.getMonth()+1);
	template = template.replace("DDD",config.messages.dates.days[this.getDay()]);
	template = template.replace("0DD",String.zeroPad(this.getDate(),2));
	template = template.replace("DD",this.getDate());
	return template;
};

//}}}
!Overdue actions
<<showReminders leadtime:-365...-1 tag:"action !done" format:"DATE: @@color:red;TITLE@@ [ TIDDLER ]">>
!Actions for today and tomorrow
<<showReminders leadtime:0...1 tag:"action !done" format:"DIFF: @@color:red;TITLE@@ [ TIDDLER ]">>
!All reminders for the next week
<<showReminders leadtime:0...7 tag:"!done" format:"DIFF: @@color:red;TITLE@@ [ TIDDLER ]">>


Click on the button below to create a new reminder as a tickler:

<<newReminder>>
The (almost) all inclusive list
[img[./SFFLogo.png]] 

 ''Things I gotta do''
<<list tagged txtGTDSomedayContext any>>
StoneFace Farm (note that it is singular) is just over 50 acres in south east Idaho located just north and west of [[Pocatello|http://goo.gl/maps/WIFhC]]

Currently the first crop out of the ground every year is scrap metal, rocks, and barn wood with a little fencing and baleing wire thrown in for fun. Not to ignore the glass I keep finding, but, there is not enough there to really count.

I am only re-habing the corner 5 acres at this point and the progress of that project can be seen on my [[blog|https://stonefacefarm.me]]. the rest of the land is rented out to a local farmer.
[[GTDStyleSheet]]
[[GTDTWStyleSheet]]

/***
!Personal preferences
***/

/*{{{*/
/* make input fields in viewer (options) show up in correct size */
.viewer input { font-size: 0.9em; }

.editor { font-family: monospace; font-size: 10pt; }

/*}}}*/

/*{{{*/

@media print {
#mainMenu, #sidebar, #messageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em 1em;}


/* LAYOUT ELEMENTS ========================================================== */
*
{
 margin: 0;
 padding: 0;
}

body {
 background: #fff;
 color: #000;
 font-size: 6.2pt;
 font-family: "Lucida Grande", "Bitstream Vera Sans", Helvetica, Verdana, Arial, sans-serif;
}

img {
 max-width: 2.2in;
 max-height: 4.3in;
}

#header, #side_container, #storeArea, #copyright, #floater, #messageArea, .save_accesskey, .site_description, #saveTest, .toolbar, .footer
{
 display: none;
}

#tiddlerDisplay, #displayArea
{
 display: inline;
}

.tiddler {
 margin: 0 0 2em 0;
 border-top: 1px solid #000;
 page-break-before: always;
}

.tiddler:first-child {
 page-break-before: avoid;
}

.title {
 font-size: 1.6em;
 font-weight: bold;
 margin-bottom: .3em;
 padding: .2em 0;
 border-bottom: 1px dotted #000;
}

p, blockquote, ul, li, ol, dt, dd, dl, table
{
 margin: 0 0 .3em 0;
}

h1, h2, h3, h4, h5, h6
{
 margin: .2em 0;
} 

h1
{
 font-size: 1.5em;
}

h2
{
 font-size: 1.3em;
}

h3
{
 font-size: 1.25em;
}

h4
{
 font-size: 1.15em;
}

h5
{
 font-size: 1.1em;
}

blockquote
{
 margin: .6em;
 padding-left: .6em;
 border-left: 1px solid #ccc;
}

ul
{
 list-style-type: circle;
}

li
{
 margin: .1em 0 .1em 2em;
 line-height: 1.4em; 
}

table
{
 border-collapse: collapse;
 font-size: 1em;
}

td, th
{
 border: 1px solid #999;
 padding: .2em;
}

hr {
 border: none;
 border-top: dotted 1px #777;
 height: 1px;
 color: #777;
 margin: .6em 0;
}
}
/*}}}*/
|review|k
|!Overdue actions|!All reminders for the next week|
|<<showReminders leadtime:-365...-1 tag:"action !done" format:"DATE: @@color:red;TITLE@@ [ TIDDLER ]">>|<<showReminders leadtime:0...7 tag:"!done" format:"DIFF: @@color:red;TITLE@@ [ TIDDLER ]">>|
|!Actions for today/tomorrow|~|
|<<showReminders leadtime:0...1 tag:"action !done" format:"DIFF: @@color:red;TITLE@@ [ TIDDLER ]">>|~|
|!Project Review|!Action Review|
|<<tiddler "Project Review">>|<<tiddler "Action Review">>|
|''URL:''|http://www.tiddlytools.com/|
|''Description:''|TiddlyTools - Small Tools for Big Ideas|
|''Author:''|Eric Shulman|
If you are connected to the Internet, you can always get the latest version of this application. While it is possible to upgrade using the standard TiddlyWiki import using the backstage area (for which there is an official d-cubed feed, but see the caveats for upgrading using backstage, below), there are ''three better'' ways you can do this:

Click the following button if you simply want to get the latest changes to any of the core tiddlers that make up this application. These tiddlers are tagged "gtd", and updating in this way will not overwrite any of the core tiddlers that you may have changed unless the core tiddlers are even newer than your changes. This is the recommended way to get updates:
**<<importUpdates "http://www.dcubed.ca/d3-update-13.html">>

Click the following button if you would like to get the latest changes to any of the core tiddlers, but to interactively approve each and every updated tiddler as it is loaded into your system. If there are no updated tiddlers, you will not be prompted and the update will exit quietly:
**<<importUpdates "http://www.dcubed.ca/d3-update-13.html" updates "Update interactively" "Click here to interactively update the application" confirm>>

Click the following button if you want to download all of the core tiddlers, regardless of their modification date. Use this to absolutely ensure that you are running with the core application as it was originally written:
**<<importUpdates "http://www.dcubed.ca/d3-update-13.html" all "Update everything" force>>

''For your safety, your file will be saved and a backup file will be automatically generated before any update is performed.''

!!Updating using backstage

There is a feed defined to enable you to update from "backstage". Just select "Official d-cubed feed" from the feed selection list, and import all tiddlers. Be sure to uncheck the "Keep these tiddlers linked..." checkbox before importing.

Also, unless you are importing into an empty d-cubed document, always save a copy before importing into a document that has important stuff.
Because of the changes to TiddlyWiki, it is not possible to upgrade to this new version from version 1.2 using the normal UpdateApplication you are familiar with. Indeed, the only way to get this new version is to start with an empty d-cubed document, and import your projects, actions, and contexts from your existing d-cubed document.

The most reliable way to import your tiddlers into a new document is to use the "backstage import" feature of the new TiddlyWiki. If you are not familiar with this, you should take a few moments at http://www.tiddlywiki.com/ to learn the new features. However please note that ''whenever you are using the backstage import feature of TiddlyWiki to import actions, projects, or contexts, you must first disable the "GTDPlugins" plugin''. 

To reliably upgrade your d-cubed document (subject to caveats, below):
# Start with a copy of an empty d-cubed document (you will need the empty document later).
# Open the "backstage", click on the "plugins" tab, and ensure there is a check in the "Disabled" column of "GTDPlugins". Save and reload your document.
# Import all the tiddlers from your old d-cubed document. Be sure to have the "Keep these tiddlers linked..." checkbox //unchecked//.
# After importing all the tiddlers from your original d-cubed document ''but before saving and reloading'', do another import from the original empty d-cubed document you copied in step 1. Again, ensure that the "Keep these tiddlers linked..." checkbox is //unchecked//.
# Once you have completed your import, confirm that "GTDPlugins" is re-enabled, reversing step 2. Save and reload, and you should be back in business. 
# Remove or disable the following obsolete plugins: TWUpdatePlugin, NewerTiddlerPlugin, ImportTiddlersPlugin. If you have customized core pieces of d-cubed (such as GTDMenu or ProjectList) you can now also carefully merge those changes into your new working document.
If you do not follow this procedure, especially disabling "GTDPlugins", you will see strange behaviour as the core d-cubed code tries to process your GTD tiddlers as they are being pulled in. However once you are upgraded you can freely use the backstage import at any time in the future to get other non-d3 tiddlers (like other plugins) without disabling "GTDPlugins". 

While the upgrade process described above is rather inelegant, the good news is that unless TiddlyWiki undergoes another major architectural change, future updates to d-cubed will revert to the usual painless process in UpdateApplication.

!!Platform caveats
As of this writing, version 2.4.1 of TiddlyWiki has a number of issues with certain browser/platform configurations:
#On Firefox for Mac, you need to ensure that the source and destination d-cubed documents for the import are in the same directory. Otherwise, you get some pretty messy behaviour in the file path selection.
#On IE (Windows), file importing is simply broken ("access is denied"). There does not appear to be a workaround save using Firefox (for the import at least).
The driveway were:
#level 
#[[solid|http://pacificenzymes.com/]] 
#self clearing 
##geothermal ground loop

The red house had:
#a good roof 
#a good floor 
#working heat/cooling #good door(s) and window(s)

I could use old cast iron radiators to heat the shop in the winter. you could replace the bottom pipe with a water heater element and fill the radiator with a water and glycol mixture and use a thermostat to control heating time? [[like this|http://www.ecorad.ca/en/index.html]]
<div class='toolbar' macro='toolbar projectify +saveTiddler -cancelTiddler deleteAction'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view gtd.project'></span></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div>
<div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<div class='toolbar' macro='toolbar changeContext changeProject deleteAction closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view gtd.project link'></span></div>
<div class='subtitle'><span macro='view modified date [[DD MMM YYYY]]'></span> (created <span macro='view created date [[DD MMM YYYY]]'></span>)&nbsp;<span macro='gtdActionCompleted'></span>complete&nbsp;<span macro='gtdToggleTag floating'></span>floating</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div><br/>
<div macro='newReminder'></div>
completely empty the building so I can start repair work on it
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteContext'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<div class='toolbar' macro='toolbar newAction closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='tagging'><span class='subtitle'><span macro='gtdToggleState chkGTDActionListReviewMode'></span>Review next actions only</span></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
Completed document conversion. Do not delete this tiddler unless you want to rebuild the action metadata.

This tiddler also contains document-specific preferences which, if deleted, will revert to default settings.
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteProject deleteProjectAll'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<div class='toolbar' macro='toolbar newProjectAction archiveProject deleteProject deleteProjectAll closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><!-- <span macro='view modifier link'></span>, --><span macro='view modified date [[DD MMM YYYY]]'></span> (created <span macro='view created date [[DD MMM YYYY]]'></span>)&nbsp;<span macro='gtdToggleTag important'></span>important&nbsp;<span macro='gtdToggleTag someday'></span>defer</div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div><br/><div macro='newReminder'></div>

<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div><div class='subtitle' macro='today "DDD, MMM DD, YYYY hh:0mm"'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>