/***\n!! Collapse Plugins\n^^Authors: Eric Shulman & Bradley Meck^^\n***/\n\nconfig.commands.collapseTiddler = {\ntext: " - ",\ntooltip: "Collapse this tiddler",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nif(e.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE]){\nvar template;\nif(e.getAttribute("template") != "CollapsedTemplate" ){\ne.setAttribute("oldTemplate",e.getAttribute("template"));\nstory.displayTiddler(null,title,"CollapsedTemplate");\n}\n}\n}\n}\n\nconfig.commands.expandTiddler = {\ntext: " + ",\ntooltip: "Expand this tiddler",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nstory.displayTiddler(null,title,e.getAttribute("oldTemplate"));\n}\n}\n\nconfig.macros.collapseAll = {\nhandler: function(place,macroName,params,wikifier,paramString,tiddler){\ncreateTiddlyButton(place,"Collapse All","",function(){\nstory.forEachTiddler(function(title,tiddler){\nif(tiddler.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE])\nstory.displayTiddler(null,title,"CollapsedTemplate");\n})})\n}\n}\n\nconfig.macros.expandAll = {\nhandler: function(place,macroName,params,wikifier,paramString,tiddler){\ncreateTiddlyButton(place,"Expand All","",function(){\nstory.forEachTiddler(function(title,tiddler){\nif(tiddler.getAttribute("template") == "CollapsedTemplate") story.displayTiddler(null,title,tiddler.getAttribute("oldTemplate"));\n})})\n}\n}\n\nconfig.commands.collapseOthers = {\ntext: "collapse others",\ntooltip: "Expand this tiddler and collapse all others",\nhandler: function(event,src,title)\n{\nvar e = story.findContainingTiddler(src);\nstory.forEachTiddler(function(title,tiddler){\nif(tiddler.getAttribute("template") != config.tiddlerTemplates[DEFAULT_EDIT_TEMPLATE]){\nvar t="CollapsedTemplate";\nif (e==tiddler) t=e.getAttribute("oldTemplate");\nif (!t||!t.length) t="ViewTemplate";\nstory.displayTiddler(null,title,t);\n}\n})\n}\n}
<div macro='gradient vert #06a #058'><div class='toolbar' macro='toolbar -closeTiddler closeOthers +editTiddler templateChooser collapseOthers expandTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div></div>
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler collapseOthers collapseTiddler deleteTiddler'></div>\n<div class='title' macro='view title'></div>\n<div class='editor' macro='edit title'></div>\n<div class='editor' macro='edit text'></div>\n<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<div style='border: 1px solid black; font-size: 1.3em; background-color: #dff;'>This Tiddler Was Created By Use Of Tagged Templating! Don't believe me? Change the tag so example isn't a tag of this!</div>\n<div class='toolbar' macro='toolbar -closeTiddler closeOthers +editTiddler templateChooser collapseOthers jumpAll collapseTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div>\n<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>)</div>\n<div class='tagging' macro='tagging'></div>\n<div class='tagged' macro='tags'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div></div>
if(Array.indexOf){\n Array.find = Array.indexOf;\n}
!!TaggedTemplating [[StyleSheetLayout]]\n\nInstall the plugin in your TW and use the manager to control what tags are shown in what templates.\n''WARNING: THIS CAN MAKE TIDDLERS NOT SHOW UP IF THE TEMPLATE DOES NOT EXIST, BEWARE OF WHITESPACE''\n\n!!TemplateChooserPlugin\n\nTag a tiddler with ''template'' and it will be able to be a template to show tiddlers with.\n\n!!CollapsePlugin\n\nTo add the Collapse Plugin you need to change your view, and or edit template[[PageTemplate]]\n[mail[test]]\nmake sure your toolbar now includes collapseTiddler\ne.g.\n\n<div class='toolbar' macro='toolbar -closeTiddler closeOthers +editTiddler collapseTiddler permalink references jump'></div>\n\nNow Make or copy and paste the CollapsedTemplate to your liking\n''Be sure to have expandTiddler in your toolbar on the CollapsedTemplate and not collapseTiddler''\n\nYou can also now add two macros collapseAll and expandAll by adding\n{{{\n<<collapseAll>>\n}}}\nand\n{{{\n<<expandAll>>\n}}}\n\nFinaly add the Collapse Plugin to your wiki and you are done, enjoy!
config.commands.jumpAll = {\ntext: "all tiddlers",\nsubtitle: "browse all tiddlers",\nhandler: function(event,src,title){\nvar popup = Popup.create(src);\nif(popup)\n{\nstore.forEachTiddler(function(src,tiddler){\ncreateTiddlyLink(createTiddlyElement(popup,"li"),tiddler.title,true);\n});\n}\nPopup.show(popup,false);\nevent.cancelBubble = true;\nif (event.stopPropagation) event.stopPropagation();\nreturn true;\n}}
[[GettingStarted]]\n<<collapseAll>>\n<<expandAll>>
/***\n!Sections in this Tiddler:\n*Generic rules\n**Links styles\n**Link Exceptions\n*Header\n*Main menu\n*Sidebar\n**Sidebar options\n**Sidebar tabs\n*Message area\n*Popup\n*Tabs\n*Tiddler display\n**Viewer\n**Editor\n*Misc. rules\n!Generic Rules /%==============================================%/\n***/\n/*{{{*/\nbody {\n font-size: .75em;\n font-family: arial,helvetica;\n position: relative;\n margin: 0;\n padding: 0;\n}\n\nh1,h2,h3,h4,h5 {\n font-weight: bold;\n text-decoration: none;\n padding-left: 0.4em;\n}\n\nh1 {font-size: 1.35em;}\nh2 {font-size: 1.25em;}\nh3 {font-size: 1.1em;}\nh4 {font-size: 1em;}\nh5 {font-size: .9em;}\n\nhr {\n height: 1px;\n}\n\na{\n text-decoration: none;\n}\n\nol { list-style-type: decimal }\nol ol { list-style-type: lower-alpha }\nol ol ol { list-style-type: lower-roman }\nol ol ol ol { list-style-type: decimal }\nol ol ol ol ol { list-style-type: lower-alpha }\nol ol ol ol ol ol { list-style-type: lower-roman }\nol ol ol ol ol ol ol { list-style-type: decimal }\n/*}}}*/\n/***\n''General Link Styles'' /%-----------------------------------------------------------------------------%/\n***/\n/*{{{*/\n.externalLink {\n text-decoration: underline;\n}\n\n.tiddlyLinkExisting {\n font-weight: bold;\n}\n\n.tiddlyLinkNonExisting {\n font-style: italic;\n}\n\n/* the 'a' is required for IE, otherwise it renders the whole tiddler a bold */\na.tiddlyLinkNonExisting.shadow {\n font-weight: bold;\n}\n/*}}}*/\n/***\n''Exceptions to common link styles'' /%------------------------------------------------------------------%/\n***/\n/*{{{*/\n\n#mainMenu .tiddlyLinkExisting, \n#mainMenu .tiddlyLinkNonExisting,\n#sidebarTabs .tiddlyLinkExisting,\n#sidebarTabs .tiddlyLinkNonExisting,\n#siteTitle .tiddlyLinkExisting,\n#siteTitle .tiddlyLinkNonExisting{\n font-weight: normal;\n font-style: normal;\n}\n\n/*}}}*/\n/***\n!Header /%==================================================%/\n***/\n/*{{{*/\n\n.header {\n position: relative;\n}\n\n.header a:hover {\n background: transparent;\n}\n\n.headerShadow {\n position: relative;\n padding: 4.5em 0em 1em 1em;\n left: -1px;\n top: -1px;\n}\n\n.headerForeground {\n position: absolute;\n padding: 4.5em 0em 1em 1em;\n left: 0px;\n top: 0px;\n}\n\n.siteTitle {\n font-size: 3em;\n}\n\n.siteSubtitle {\n font-size: 1.2em;\n}\n\n/*}}}*/\n/***\n!Main menu /%==================================================%/\n***/\n/*{{{*/\n#mainMenu {\n position: absolute;\n left: 0;\n width: 10em;\n text-align: right;\n line-height: 1.6em;\n padding: 1.5em 0.5em 0.5em 0.5em;\n font-size: 1.1em;\n}\n\n/*}}}*/\n/***\n!Sidebar rules /%==================================================%/\n***/\n/*{{{*/\n#sidebar {\n position: absolute;\n right: 3px;\n width: 16em;\n font-size: .9em;\n}\n/*}}}*/\n/***\n''Sidebar options'' /%----------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n#sidebarOptions {\n padding-top: 0.3em;\n}\n\n#sidebarOptions a {\n margin: 0em 0.2em;\n padding: 0.2em 0.3em;\n display: block;\n}\n\n#sidebarOptions input {\n margin: 0.4em 0.5em;\n}\n\n#sidebarOptions .sliderPanel {\n margin-left: 1em;\n padding: 0.5em;\n font-size: .85em;\n}\n\n#sidebarOptions .sliderPanel a {\n font-weight: bold;\n display: inline;\n padding: 0;\n}\n\n#sidebarOptions .sliderPanel input {\n margin: 0 0 .3em 0;\n}\n/*}}}*/\n/***\n''Sidebar tabs'' /%-------------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n\n#sidebarTabs .tabContents {\n width: 15em;\n overflow: hidden;\n}\n\n/*}}}*/\n/***\n!Message area /%==================================================%/\n***/\n/*{{{*/\n#messageArea {\n padding: 0.5em;\n}\n\n.messageToolbar {\ndisplay: block;\ntext-align: right;\n}\n\n#messageArea a{\n text-decoration: underline;\n}\n/*}}}*/\n/***\n!Popup /%==================================================%/\n***/\n/*{{{*/\n.popup {\n font-size: .9em;\n padding: 0.2em;\n list-style: none;\n margin: 0;\n}\n\n.popup hr {\n display: block;\n height: 1px;\n width: auto;\n padding: 0;\n margin: 0.2em 0em;\n}\n\n.popup li.disabled {\n padding: 0.2em;\n}\n\n.popup li a{\n display: block;\n padding: 0.2em;\n}\n/*}}}*/\n/***\n!Tabs /%==================================================%/\n***/\n/*{{{*/\n.tabset {\n padding: 1em 0em 0em 0.5em;\n}\n\n.tab {\n margin: 0em 0em 0em 0.25em;\n padding: 2px;\n}\n\n.tabContents {\n padding: 0.5em;\n}\n\n.tabContents ul, .tabContents ol {\n margin: 0;\n padding: 0;\n}\n\n.tabContents li {\n list-style: none;\n}\n\n.tabContents li.listLink {\n margin-left: .75em;\n}\n/*}}}*/\n/***\n!Tiddler display rules /%==================================================%/\n***/\n/*{{{*/\n#displayArea {\n margin: 1em 17em 0em 14em;\n}\n\n\n.toolbar {\n text-align: right;\n font-size: .9em;\n visibility: hidden;\n}\n\n.selected .toolbar {\n visibility: visible;\n}\n\n.tiddler {\n padding: 1em 1em 0em 1em;\noverflow: auto;\n}\n\n.missing .viewer,.missing .title {\n font-style: italic;\n}\n\n.title {\n font-size: 1.6em;\n font-weight: bold;\n}\n\n.missing .subtitle {\n display: none;\n}\n\n.subtitle {\n font-size: 1.1em;\n}\n\n/* I'm not a fan of how button looks in tiddlers... */\n.tiddler .button {\n padding: 0.2em 0.4em;\n}\n\n.tagging {\nmargin: 0.5em 0.5em 0.5em 0;\nfloat: left;\ndisplay: none;\n}\n\n.isTag .tagging {\ndisplay: block;\n}\n\n.tagged {\nmargin: 0.5em;\nfloat: right;\n}\n\n.tagging, .tagged {\nfont-size: 0.9em;\npadding: 0.25em;\n}\n\n.tagging ul, .tagged ul {\nlist-style: none;margin: 0.25em;\npadding: 0;\n}\n\n.tagClear {\nclear: both;\n}\n\n.footer {\n font-size: .9em;\n}\n\n.footer li {\ndisplay: inline;\n}\n/***\n''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.viewer {\n line-height: 1.4em;\n padding-top: 0.5em;\n}\n\n.viewer .button {\n margin: 0em 0.25em;\n padding: 0em 0.25em;\n}\n\n.viewer blockquote {\n line-height: 1.5em;\n padding-left: 0.8em;\n margin-left: 2.5em;\n}\n\n.viewer ul, .viewer ol{\n margin-left: 0.5em;\n padding-left: 1.5em;\n}\n\n.viewer table {\n border-collapse: collapse;\n margin: 0.8em 1.0em;\n}\n\n.viewer th, .viewer td, .viewer tr,.viewer caption{\n padding: 3px;\n}\n\n.viewer pre {\n padding: 0.5em;\n margin-left: 0.5em;\n font-size: 1.2em;\n line-height: 1.4em;\n overflow: auto;\n}\n\n.viewer code {\n font-size: 1.2em;\n line-height: 1.4em;\n}\n\n.tiddlerSidebar{\n float: left;\n}\n/*}}}*/\n/***\n''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.editor {\nfont-size: 1.1em;\n}\n\n.editor input, .editor textarea {\n display: block;\n width: 100%;\n font: inherit;\n}\n\n.editorFooter {\n padding: 0.25em 0em;\n font-size: .9em;\n}\n\n.editorFooter .button {\npadding-top: 0px; padding-bottom: 0px;}\n\n.fieldsetFix {border: 0;\npadding: 0;\nmargin: 1px 0px 1px 0px;\n}\n/*}}}*/\n/***\n!Misc rules /%==================================================%/\n***/\n/*{{{*/\n.sparkline {\n line-height: 1em;\n}\n\n.sparktick {\n outline: 0;\n}\n\n.zoomer {\n font-size: 1.1em;\n position: absolute;\n padding: 1em;\n}\n\n.cascade {\n font-size: 1.1em;\n position: absolute;\n overflow: hidden;\n}\n/*}}}*/
/***\n!!Current Tagged Templates\n<<taggedTemplates>>\n!!Code\n***/\nconfig.macros.taggedTemplates={store:{example:'ExampleTemplate'},\nhtml : "<!--start of tags--><table><tr><td>Tag</td><td>Template</td><td>Remove</td></tr><tr><td>example</td><td>ExampleTemplate</td><td><input type='button' value='remove' onclick='config.macros.taggedTemplates.removing(story.findContainingTiddler(this),this.parentNode.previousSibling.previousSibling.innerHTML)'/></td></tr></table><!--end of tags-->",\nconsole : "<div>Tag:</div><input type='text'/><div>Template:</div><input type='text'/><br/><input type='button' value='add' onclick='config.macros.taggedTemplates.adding(story.findContainingTiddler(this),this.previousSibling.previousSibling.previousSibling.previousSibling.value,this.previousSibling.previousSibling.value)'/></html>",\nhandler: function(place,macroName,params){\nvar e = createTiddlyElement(place,"div");\ne.innerHTML = config.macros.taggedTemplates.html + config.macros.taggedTemplates.console;\n},\nadding : function(tiddler,tag,template){\nvar aler = "";\nif(tag.trim().length == 0){\naler += "tag is invalid\sn"\n}\nif(template.length == 0){\naler += "template is invalid\sn"\n}\nif(aler.length > 0){alert(aler.slice(0,-1));return}\nvar e = store.getTiddler(tiddler.getAttribute("tiddler"));\nconfig.macros.taggedTemplates.store[tag] = template;\nconfig.macros.taggedTemplates.formText(e);\nstory.forEachTiddler(function(title,src){\nif(title == e.title || store.getTiddler(title).tags.find(tag) != null){story.refreshTiddler(title,null,true);};\n})\n},\nremoving: function(tiddler,tag){\ndelete config.macros.taggedTemplates.store[tag];\nvar e = store.getTiddler(tiddler.getAttribute("tiddler"));\nconfig.macros.taggedTemplates.formText(e);\nstory.forEachTiddler(function(title,src){\nif(title == e.title || store.getTiddler(title).tags.find(tag) != null){story.refreshTiddler(title,null,true);};\n})\n},\nformText : function(e){\nvar str ="";\nvar tags = [];\nvar templates = [];\nfor(var i in config.macros.taggedTemplates.store){\nstr += i+":\s'"+config.macros.taggedTemplates.store[i]+"\s',"\ntags.push(i);\ntemplates.push(config.macros.taggedTemplates.store[i]);\n}\nvar table = "";\nfor(var i = 0; i < tags.length; i++){\ntable += "<tr><td>"+tags[i]+"</td><td>"+templates[i]+"</td><td><input type='button' value='remove' onclick='config.macros.taggedTemplates.removing(story.findContainingTiddler(this),this.parentNode.previousSibling.previousSibling.innerHTML)'/></td></tr>"\n}\ne.text = e.text.replace(/\s<\s!\s-\s-start\s of\s tags\s-\s-\s>.*\s<\s!\s-\s-end\s of\s tags\s-\s-\s>/i,"<!--start of tags--><table><tr><td>Tag</td><td>Template</td><td>Remove</td></tr>"+table+"</table><!--end of tags-->").replace(/config\s.macros\s.taggedTemplates\s=\s{store\s:\s{[^\s}]*/,"config.macros.taggedTemplates={store:{"+str.slice(0,-1))\nconfig.macros.taggedTemplates.html = e.text.match(/\s<\s!\s-\s-start\s of\s tags\s-\s-\s>.*\s<\s!\s-\s-end\s of\s tags\s-\s-\s>/i);\n}\n};\n\nvar c = function(title,template)\n{\n if(!template){\n template = DEFAULT_VIEW_TEMPLATE;\nvar tiddler = store.fetchTiddler(title);\nfor(var i = 0; i < tiddler.tags.length; i++){\nif(config.macros.taggedTemplates.store[tiddler.tags[i]]){\ntemplate = config.macros.taggedTemplates.store[tiddler.tags[i]];\n}}}\n if(template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE)\n template = config.tiddlerTemplates[template];\n return template;\n}\nstory.chooseTemplateForTiddler = c;\nStory.chooseTemplateForTiddler = c;
config.commands.templateChooser = {\ntext: "template",\ntooltip: "Choose Template for this Tiddler",\nhandler: function(event,src,title){\n var popup = Popup.create(src);\n if(popup)\n {\nvar tiddlers = store.getTaggedTiddlers("template","title");\nvar e;\nfor(var i = 0; i < tiddlers.length; i++){\ne = createTiddlyElement(popup,"li")\ne = createTiddlyElement(e,"a",null,"tiddlyLink",tiddlers[i].title)\ne.onclick = function(){\nstory.displayTiddler(null,this.getAttribute("tiddler"),this.getAttribute("template"));\n};\ne.setAttribute("tiddler",title);\ne.setAttribute("template",tiddlers[i].title);\n}\n }\n Popup.show(popup,false);\n event.cancelBubble = true;\n if (event.stopPropagation) event.stopPropagation();\n return true;\n},\ntemplateTiddler : function(){\n}\n}
This is a Testing of the Template Chooser\n\nhere is the main menu\n<<tiddler MainMenu>>
<div class='toolbar' macro='toolbar -closeTiddler closeOthers +editTiddler templateChooser collapseOthers jumpAll collapseTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div>\n<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>)</div>\n<div class='tagging' macro='tagging'></div>\n<div class='tagged' macro='tags'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>
/***\n<<importTiddlers inline>>\n***/\n\n//{{{\nversion.extensions.importTiddlers = {major: 2, minor: 4, revision: 1, date: new Date(2006,1,15)};\n//}}}\n\n// // 1.2.x compatibility\n//{{{\nif (!window.story) window.story=window;\nif (!store.getTiddler) store.getTiddler=function(title){return store.tiddlers[title]}\nif (!store.addTiddler) store.addTiddler=function(tiddler){store.tiddlers[tiddler.title]=tiddler}\nif (!store.deleteTiddler) store.deleteTiddler=function(title){delete store.tiddlers[title]}\n//}}}\n\n// // IE needs explicit global scoping for functions/vars called from browser events\n//{{{\nwindow.onClickImportButton=onClickImportButton;\nwindow.loadImportFile=loadImportFile;\nwindow.refreshImportList=refreshImportList;\nwindow.importSource=""; // path/filename or URL of document to import\nwindow.importedTiddlers; // hash-indexed array of tiddlers from other document\nwindow.importTags=""; // text of tags added to imported tiddlers\nwindow.importListSize=10; // # of lines to show in imported tiddler list\nwindow.importDiffsOnly=true; // show differences option (toggle)\nwindow.importIndex=0; // current processing index in import list\n//}}}\n\n// // ''MACRO DEFINITION''\n\n//{{{\nconfig.macros.importTiddlers = { label: "import tiddlers", prompt: "Copy tiddlers from another document" };\nconfig.macros.importTiddlers.handler = function(place,macroName,params) {\n // LINK WITH FLOATING PANEL\n if (!params[0]) {\n createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);\n return;\n }\n // INLINE TIDDLER CONTENT\n if (params[0]=="inline") {\n createImportPanel(place);\n document.getElementById("importPanel").style.position="static";\n document.getElementById("importPanel").style.display="block";\n return;\n }\n // NON-INTERACTIVE BATCH MODE\n switch (params[0]) {\n case 'all':\n case 'new':\n case 'changes':\n case 'updates':\n var filter=params.shift();\n break;\n default:\n var filter="updates";\n break;\n } \n if (!params[0]||!params[0].length) return; // filename is required\n window.importSource=params.shift();\n var quiet=(params[0]=="quiet"); if (quiet) params.shift();\n var ask=(params[0]=="ask"); if (ask) params.shift();\n window.importedTiddlers=null; // clear the imported tiddler buffer\n // load storeArea from a hidden IFRAME, then apply import rules and add/replace tiddlers\n loadImportFile(window.importSource,filter,quiet,ask,autoImportTiddlers);\n}\n//}}}\n\n// // ''READ TIDDLERS FROM ANOTHER DOCUMENT''\n\n//{{{\nfunction loadImportFile(src,filter,quiet,ask,callback) {\n if (!quiet) clearMessage();\n // LOCAL FILE\n if ((src.substr(0,7)!="http://")&&(src.substr(0,8)!="https://")) {\n if (!quiet) displayMessage("Opening local document: "+ src);\n var txt=loadFile(src);\nalert(txt);\n if(!txt) { if (!quiet) displayMessage("Could not open local document: "+src); }\n else {\n var s="<html><body>"+txt.substr(txt.indexOf('<div id="storeArea">'));\n if (!quiet) displayMessage(txt.length+" bytes in document. ("+s.length+" bytes used for tiddler storage)");\n window.importedTiddlers = readImportedTiddlers(convertUTF8ToUnicode(s));\n var count=window.importedTiddlers?window.importedTiddlers.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask);\n }\n return;\n }\n // REMOTE FILE\n var x; // XML object\n try {x = new XMLHttpRequest()}\n catch(e) {\n try {x = new ActiveXObject("Msxml2.XMLHTTP")}\n catch (e) {\n try {x = new ActiveXObject("Microsoft.XMLHTTP")}\n catch (e) { return }\n }\n }\n x.onreadystatechange = function() {\n if (x.readyState == 4) {\n if (x.status == 200) {\nalert(x.responseText)\n var sa="<html><body>"+x.responseText.substr(x.responseText.indexOf('<div id="storeArea">'));\n if (!quiet) displayMessage(x.responseText.length+" bytes in document. ("+sa.length+" bytes used for tiddler storage)");\n window.importedTiddlers = readImportedTiddlers(sa);\n var count=window.importedTiddlers?window.importedTiddlers.length:0;\n if (!quiet) displayMessage("Found "+count+" tiddlers in "+src);\n if (callback) callback(src,filter,quiet,ask);\n }\n else\n if (!quiet) displayMessage("Could not open remote document:"+ src+" (error="+x.status+")");\n }\n }\n if (document.location.protocol=="file:") { // UniversalBrowserRead only works from a local file context\n try {netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead')}\n catch (e) { if (!quiet) displayMessage(e.description?e.description:e.toString()); }\n }\n if (!quiet) displayMessage("Opening remote document: "+ src);\n try {\n var url=src+(src.indexOf('?')<0?'?':'&')+'nocache='+Math.random();\n x.open("GET",url,true);\n x.overrideMimeType('text/html');\n x.send(null);\n }\n catch (e) {\n if (!quiet) {\n displayMessage("Could not open remote document: "+src);\n displayMessage(e.description?e.description:e.toString());\n }\n }\n}\n\nfunction readImportedTiddlers(txt)\n{\n var importedTiddlers = [];\n // create frame\n var f=document.getElementById("importFrame");\n if (f) document.body.removeChild(f);\n f=document.createElement("iframe");\n f.id="importFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\n // get document\n var d=f.document;\n if (f.contentDocument) d=f.contentDocument; // For NS6\n else if (f.contentWindow) d=f.contentWindow.document; // For IE5.5 and IE6\n // load source into document\n d.open(); d.writeln(txt); d.close();\n // read tiddler DIVs from storeArea DOM element \n var importStore = [];\n var importStoreArea = d.getElementById("storeArea");\n if (!importStoreArea || !(importStore=importStoreArea.childNodes) || (importStore.length==0)) { return null; }\n importStoreArea.normalize();\n for(var t = 0; t < importStore.length; t++) {\n var e = importStore[t];\n var title = null;\n if(e.getAttribute)\n title = e.getAttribute("tiddler");\n if(!title && e.id && (e.id.substr(0,5) == "store"))\n title = e.id.substr(5);\n if(title && title != "") {\n var theImported = new Tiddler();\n theImported.loadFromDiv(e,title);\n importedTiddlers.push(theImported);\n }\n }\n return importedTiddlers;\n}\n//}}}\n\n// // ''NON-INTERACTIVE IMPORT''\n\n// // import all/new/changed tiddlers into store, replacing or adding tiddlers as needed\n//{{{\nfunction autoImportTiddlers(src,filter,quiet,ask)\n{\n var count=0;\n if (window.importedTiddlers) for (t=0;t<window.importedTiddlers.length;t++) {\n var theImported = window.importedTiddlers[t];\n var theExisting = store.getTiddler(theImported.title);\n\n // only import tiddlers if tagged with "importPublic"\n if (theImported.tags && theImported.tags.find("importPublic")==null)\n { window.importedTiddlers[t].status=""; continue; } // status=="" means don't show in report\n\n // never import the "ImportedTiddlers" history from the other document...\n if (theImported.title=='ImportedTiddlers')\n { window.importedTiddlers[t].status=""; continue; } // status=="" means don't show in report\n\n // check existing tiddler for importReplace, or systemConfig tags\n window.importedTiddlers[t].status="added"; // default - add any tiddlers not filtered out\n if (store.tiddlerExists(theImported.title)) {\n window.importedTiddlers[t].status="replaced";\n if (!theExisting.tags||(theExisting.tags.find("importReplace")==null))\n { window.importedTiddlers[t].status="not imported - tiddler already exists (use importReplace to allow changes)"; continue; }\n if ((theExisting.tags.find("systemConfig")!=null)||(theImported.tags.find("systemConfig")!=null))\n window.importedTiddlers[t].status+=" - WARNING: an active systemConfig plugin has been added or updated";\n }\n\n // apply the all/new/changes/updates filter \n if (filter!="all") {\n if ((filter=="new") && store.tiddlerExists(theImported.title))\n { window.importedTiddlers[t].status="not imported - tiddler already exists"; continue; }\n if ((filter=="changes") && !store.tiddlerExists(theImported.title))\n { window.importedTiddlers[t].status="not imported - new tiddler"; continue; }\n if (store.tiddlerExists(theImported.title) && ((theExisting.modified.getTime()-theImported.modified.getTime())>=0))\n { window.importedTiddlers[t].status="not imported - tiddler is unchanged"; continue; }\n }\n\n // get confirmation if required\n if (ask && !confirm("Import "+(theExisting?"updated":"new")+" tiddler '"+theImported.title+"'\snfrom "+src))\n { window.importedTiddlers[t].status="skipped - cancelled by user"; continue; }\n\n // DO THE IMPORT!!\n store.addTiddler(theImported); count++;\n }\n importReport(quiet); // generate a report (as needed) and display it if not 'quiet'\n if (count) store.setDirty(true); \n // always show final message when tiddlers were actually imported\n if (!quiet||count) displayMessage("Imported "+count+" tiddler"+(count!=1?"s":"")+" from "+src);\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n\n//{{{\nfunction importReport(noshow)\n{\n if (!window.importedTiddlers) return;\n // DEBUG alert('importReport: start');\n\n // if import was not completed, the Ask panel will still be open... close it now.\n var askpanel=document.getElementById('importAskPanel'); if (askpanel) askpanel.style.display='none'; \n // get the alphasorted list of tiddlers\n var tiddlers = window.importedTiddlers;\n window.importedTiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });\n // gather the statistics\n var count=window.importedTiddlers.length; var added=0; var replaced=0; var renamed=0; var skipped=0; var merged=0;\n for (var t=0; t<count; t++)\n if (window.importedTiddlers[t].status)\n {\n if (window.importedTiddlers[t].status=='added') added++;\n if (window.importedTiddlers[t].status.substr(0,7)=='skipped') skipped++;\n if (window.importedTiddlers[t].status.substr(0,6)=='rename') renamed++;\n if (window.importedTiddlers[t].status.substr(0,7)=='replace') replaced++;\n if (window.importedTiddlers[t].status.substr(0,6)=='merged') merged++;\n }\n var omitted=count-(added+replaced+renamed+skipped+merged);\n // DEBUG alert('stats done: '+count+' total, '+added+' added, '+skipped+' skipped, '+renamed+' renamed, '+replaced+' replaced, '+merged+' merged');\n // skip the report if nothing was imported\n if (added+replaced+renamed+merged==0) return;\n // quick message area summary report\n displayMessage((added+replaced+renamed+merged)+' of '+count+' tiddler'+((count!=1)?'s':"")+' imported from '+window.importSource.replace(/\s\s/g,'/'))\n // create the report tiddler (if not already present)\n var tiddler = store.getTiddler('ImportedTiddlers');\n if (!tiddler) // create new report tiddler if it doesn't exist\n {\n tiddler = new Tiddler();\n tiddler.title = 'ImportedTiddlers';\n tiddler.text = "";\n }\n // format the report header\n var now = new Date();\n newText = "";\n newText += "On "+now.toLocaleString()+", "+config.options.txtUserName+" imported tiddlers from\sn";\n newText += "[["+window.importSource+"|"+window.importSource+"]]:\sn";\n newText += "<"+"<"+"<\sn";\n newText += "Out of "+count+" tiddler"+((count!=1)?"s ":" ")+" in {{{"+window.importSource.replace(/\s\s/g,'/')+"}}}:\sn";\n if (added+renamed>0)\n newText += (added+renamed)+" new tiddler"+(((added+renamed)!=1)?"s were":" was")+" added to your document.\sn";\n if (merged>0)\n newText += merged+" tiddler"+((merged!=1)?"s were":" was")+" merged with "+((merged!=1)?"":"an ")+"existing tiddler"+((merged!=1)?"s":"")+".\sn"; \n if (replaced>0)\n newText += replaced+" existing tiddler"+((replaced!=1)?"s were":" was")+" replaced.\sn"; \n if (skipped>0)\n newText += skipped+" tiddler"+((skipped!=1)?"s were":" was")+" skipped after asking.\sn"; \n if (omitted>0)\n newText += omitted+" tiddler"+((omitted!=1)?"s":"")+((omitted!=1)?" were":" was")+" not imported.\sn";\n if (window.importTags!="")\n newText += "imported tiddlers were tagged with: \s""+window.importTags+"\s"\sn";\n // output the tiddler detail and reset status flags\n for (var t=0; t<count; t++)\n if (window.importedTiddlers[t].status!="")\n {\n newText += "#["+"["+window.importedTiddlers[t].title+"]"+"]";\n newText += ((window.importedTiddlers[t].status!="added")?("^^\sn"+window.importedTiddlers[t].status+"^^"):"")+"\sn";\n window.importedTiddlers[t].status="";\n }\n newText += "<"+"<"+"<\sn";\n // output 'discard report' link\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+tiddler.title+"'); store.deleteTiddler('"+tiddler.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n tiddler.text = newText+((tiddler.text!="")?'\sn----\sn':"")+tiddler.text;\n tiddler.modifier = config.options.txtUserName;\n tiddler.modified = new Date();\n store.addTiddler(tiddler);\n if (!noshow) story.displayTiddler(null,"ImportedTiddlers",1,null,null,false);\n // update the page display\n store.notifyAll();\n}\n//}}}\n\n// // ''INTERFACE DEFINITION''\n\n// // Handle link click to create/show/hide control panel\n//{{{\nfunction onClickImportMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("importPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createImportPanel(parent);\n var isOpen = panel.style.display=="block";\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,"none"));\n else\n panel.style.display = isOpen ? "none" : "block" ;\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return(false);\n}\n//}}}\n\n// // Create control panel: HTML, CSS, register for notification\n//{{{\nfunction createImportPanel(place) {\n var panel=document.getElementById("importPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.importTiddlers.css,"importTiddlers");\n panel=createTiddlyElement(place,"span","importPanel",null,null)\n panel.innerHTML=config.macros.importTiddlers.html;\n store.addNotification(null,refreshImportList); // refresh listbox after every tiddler change\n return panel;\n}\n//}}}\n\n// // CSS\n//{{{\nconfig.macros.importTiddlers.css = '\s\n#importPanel {\s\n display: none; position:absolute; z-index:11; width:30em; right:105%; top:3em;\s\n padding: 0.5em; margin:0em; text-align:left; font-size: 8pt;\s\n background-color: #eee; color:#000000; \s\n border:1px solid black; border-bottom-width: 3px; border-right-width: 3px; -moz-border-radius:1em;\s\n}\s\n#importPanel input { width: 100%; margin: 1px; font-size:8pt; }\s\n#importPanel select { width: 100%; margin: 1px; font-size:8pt; }\s\n#importPanel .importButton { padding: 0em; margin: 0px; font-size:8pt; }\s\n#importPanel .importListButton { padding:0em 0.25em 0em 0.25em; color: #000000; display:inline }\s\n#importAskPanel { display:none; margin:0.5em 0em 0em 0em; }\s\n';\n//}}}\n\n// // HTML\n//{{{\nconfig.macros.importTiddlers.html = '\s\nimport from source document:\s\n<input type="file" id="fileImportSource" size=46\s\n onKeyUp="window.importSource=this.value"\s\n onChange="window.importSource=this.value;">\s\n<span style="float:left; padding:1px; white-space:nowrap">\s\n <input type=checkbox id="chkImportDiffsOnly" checked style="height:1em; width:auto"\s\n onClick="window.importDiffsOnly=this.checked; refreshImportList();">show differences only\s\n</span>\s\n<span style="float:right; padding:1px; white-space:nowrap">\s\n <a href="JavaScript:;" id="importSmaller" class="importListButton"\s\n onclick="onClickImportButton(this)" title="reduce list size">&#150;</a>\s\n <a href="JavaScript:;" id="importLarger" class="importListButton"\s\n onclick="onClickImportButton(this)" title="increase list size">+</a>\s\n <a href="JavaScript:;" id="importMaximize" class="importListButton"\s\n onclick="onClickImportButton(this)" title="maximize/restore list size">=</a>\s\n</span>\s\n<select id="importList" size=1 multiple\s\n onchange="setTimeout(\s'refreshImportList(\s'+this.selectedIndex+\s')\s',1)">\s\n <!-- NOTE: delay refresh so list is updated AFTER onchange event is handled -->\s\n</select>\s\nadd tags:\s\n<input type=text id="txtImportTags" size=15 onKeyUp="window.importTags=this.value" autocomplete=off>\s\n<div align=center>\s\n <input type=button id="importOpen" class="importButton" style="width:23%" value="open"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importSelectAll" class="importButton" style="width:23%" value="select all"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importStart" class="importButton" style="width:23%" value="import"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importClose" class="importButton" style="width:23%" value="close"\s\n onclick="onClickImportButton(this)">\s\n</div>\s\n<div id="importAskPanel">\s\n tiddler already exists:\s\n <input type=text id="importNewTitle" size=15 autocomplete=off">\s\n <div align=center>\s\n <input type=button id="importSkip" class="importButton" style="width:23%" value="skip"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importRename" class="importButton" style="width:23%" value="rename"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importMerge" class="importButton" style="width:23%" value="merge"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importReplace" class="importButton" style="width:23%" value="replace"\s\n onclick="onClickImportButton(this)">\s\n </div>\s\n</div>\s\n';\n//}}}\n\n// // refresh listbox\n//{{{\nvar importSortBy;\nfunction refreshImportList(selectedIndex)\n{\n var theList = document.getElementById("importList");\n if (!theList) return;\n // if nothing to show, reset list content and size\n if (!window.importedTiddlers) \n {\n while (theList.length > 0) { theList.options[0] = null; }\n theList.options[0]=new Option('please open a document...',"",false,false);\n theList.size=1; // show one line only\n return;\n }\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) importSortBy='title'; // heading\n if (selectedIndex==1) importSortBy='title';\n if (selectedIndex==2) importSortBy='modified';\n if (selectedIndex==3) importSortBy='tags';\n if (selectedIndex>3) return; // heading or tiddler item, no refresh needed\n\n // get the alphasorted list of tiddlers (optionally, filter out unchanged tiddlers)\n var tiddlers = [];\n for (t=0;t<window.importedTiddlers.length;t++)\n {\n // don't import tiddler if title/date/time match (i.e., no changes)\n if ( window.importDiffsOnly\n && store.tiddlerExists(window.importedTiddlers[t].title)\n && (window.importedTiddlers[t].modified-store.getTiddler(window.importedTiddlers[t].title).modified==0))\n continue;\n tiddlers.push(window.importedTiddlers[t]);\n }\n tiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n // add heading and control items to list\n var i=0;\n var indent=String.fromCharCode(160)+String.fromCharCode(160);\n theList.options[i++]=new Option('Select tiddlers to import',"",false,false);\n theList.options[i++]=new Option(((importSortBy=="title" )?">":indent)+' [by title]',"",false,false);\n theList.options[i++]=new Option(((importSortBy=="modified")?">":indent)+' [by date]',"",false,false);\n theList.options[i++]=new Option(((importSortBy=="tags")?">":indent)+' [by tags]',"",false,false);\n theList.options[i++]=new Option(tiddlers.length+' tiddler'+((tiddlers.length!=1)?'s are ':' is ')+(window.importDiffsOnly?'different':'in the document'),"",false,false);\n // output the tiddler list\n switch(importSortBy)\n {\n case "title":\n for(var t = 0; t < tiddlers.length; t++)\n theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);\n break;\n case "modified":\n // sort descending for newest date first\n tiddlers.sort(function (a,b) {if(a['modified'] == b['modified']) return(0); else return (a['modified'] > b['modified']) ? -1 : +1; });\n var lastSection = "";\n for(var t = 0; t < tiddlers.length; t++) {\n var tiddler = tiddlers[t];\n var theSection = tiddler.modified.toLocaleDateString();\n if (theSection != lastSection) {\n theList.options[i++] = new Option(theSection,"",false,false);\n lastSection = theSection;\n }\n theList.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);\n }\n break;\n case "tags":\n var theTitles = {}; // all tiddler titles, hash indexed by tag value\n var theTags = new Array();\n for(var t=0; t<tiddlers.length; t++) {\n var title=tiddlers[t].title;\n var tags=tiddlers[t].tags;\n for(var s=0; s<tags.length; s++) {\n if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }\n theTitles[tags[s]].push(title);\n }\n }\n theTags.sort();\n for(var tagindex=0; tagindex<theTags.length; tagindex++) {\n var theTag=theTags[tagindex];\n theList.options[i++]=new Option(theTag,"",false,false);\n for(var t=0; t<theTitles[theTag].length; t++)\n theList.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);\n }\n break;\n }\n theList.selectedIndex=selectedIndex; // select current control item\n if (theList.size<window.importListSize) theList.size=window.importListSize;\n if (theList.size>theList.options.length) theList.size=theList.options.length;\n}\n//}}}\n\n// // Control interactions\n//{{{\nfunction onClickImportButton(which)\n{\n // DEBUG alert(which.id);\n var theList = document.getElementById('importList');\n if (!theList) return;\n var thePanel = document.getElementById('importPanel');\n var theAskPanel = document.getElementById('importAskPanel');\n var theNewTitle = document.getElementById('importNewTitle');\n switch (which.id)\n {\n case 'fileImportSource':\n case 'importOpen': // load import source into hidden frame\n importReport(); // if an import was in progress, generate a report\n window.importedTiddlers=null; // clear the imported tiddler buffer\n refreshImportList(); // reset/resize the listbox\n if (window.importSource=="") break;\n // Load document into hidden iframe so we can read it's DOM and fill the list\n loadImportFile(window.importSource,"all",null,null,function(src,filter,quiet,ask){window.refreshImportList(0);});\n break;\n case 'importSelectAll': // select all tiddler list items (i.e., not headings)\n importReport(); // if an import was in progress, generate a report\n for (var t = 0; t < theList.options.length; t++)\n theList.options[t].selected=(theList.options[t].value!="");\n break;\n case 'importStart': // initiate the import processing\n importReport(); // if an import was in progress, generate a report\n window.importIndex=0;\n window.importIndex=importTiddlers(0);\n importStopped();\n break;\n case 'importClose': // unload imported tiddlers or hide the import control panel\n // if imported tiddlers not loaded, close the import control panel\n if (!window.importedTiddlers) { thePanel.style.display='none'; break; }\n importReport(); // if an import was in progress, generate a report\n window.importedTiddlers=null; // clear the imported tiddler buffer\n refreshImportList(); // reset/resize the listbox\n break;\n case 'importSkip': // don't import the tiddler\n var theItem = theList.options[window.importIndex];\n for (var j=0;j<window.importedTiddlers.length;j++)\n if (window.importedTiddlers[j].title==theItem.value) break;\n var theImported = window.importedTiddlers[j];\n theImported.status='skipped after asking'; // mark item as skipped\n theAskPanel.style.display='none';\n window.importIndex=importTiddlers(window.importIndex+1); // resume with NEXT item\n importStopped();\n break;\n case 'importRename': // change name of imported tiddler\n var theItem = theList.options[window.importIndex];\n for (var j=0;j<window.importedTiddlers.length;j++)\n if (window.importedTiddlers[j].title==theItem.value) break;\n var theImported = window.importedTiddlers[j];\n theImported.status = 'renamed from '+theImported.title; // mark item as renamed\n theImported.set(theNewTitle.value,null,null,null,null); // change the tiddler title\n theItem.value = theNewTitle.value; // change the listbox item text\n theItem.text = theNewTitle.value; // change the listbox item text\n theAskPanel.style.display='none';\n window.importIndex=importTiddlers(window.importIndex); // resume with THIS item\n importStopped();\n break;\n case 'importMerge': // join existing and imported tiddler content\n var theItem = theList.options[window.importIndex];\n for (var j=0;j<window.importedTiddlers.length;j++)\n if (window.importedTiddlers[j].title==theItem.value) break;\n var theImported = window.importedTiddlers[j];\n var theExisting = store.getTiddler(theItem.value);\n var theText = theExisting.text+'\sn----\sn^^merged from: [['+window.importSource+'#'+theItem.value+'|'+window.importSource+'#'+theItem.value+']]^^\sn^^'+theImported.modified.toLocaleString()+' by '+theImported.modifier+'^^\sn'+theImported.text;\n var theDate = new Date();\n var theTags = theExisting.getTags()+' '+theImported.getTags();\n theImported.set(null,theText,null,theDate,theTags);\n theImported.status = 'merged with '+theExisting.title; // mark item as merged\n theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.style.display='none';\n window.importIndex=importTiddlers(window.importIndex); // resume with this item\n importStopped();\n break;\n case 'importReplace': // substitute imported tiddler for existing tiddler\n var theItem = theList.options[window.importIndex];\n for (var j=0;j<window.importedTiddlers.length;j++)\n if (window.importedTiddlers[j].title==theItem.value) break;\n var theImported = window.importedTiddlers[j];\n var theExisting = store.getTiddler(theItem.value);\n theImported.status = 'replaces '+theExisting.title; // mark item for replace\n theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY hh:mm:ss");\n theImported.status += ' by '+theExisting.modifier;\n theAskPanel.style.display='none';\n window.importIndex=importTiddlers(window.importIndex); // resume with THIS item\n importStopped();\n break;\n case 'importSmaller': // decrease current listbox size, minimum=5\n if (theList.options.length==1) break;\n theList.size-=(theList.size>5)?1:0;\n window.importListSize=theList.size;\n break;\n case 'importLarger': // increase current listbox size, maximum=number of items in list\n if (theList.options.length==1) break;\n theList.size+=(theList.size<theList.options.length)?1:0;\n window.importListSize=theList.size;\n break;\n case 'importMaximize': // toggle listbox size between current and maximum\n if (theList.options.length==1) break;\n theList.size=(theList.size==theList.options.length)?window.importListSize:theList.options.length;\n break;\n }\n}\n//}}}\n\n// // re-entrant processing for handling import with interactive collision prompting\n//{{{\nfunction importTiddlers(startIndex)\n{\n if (!window.importedTiddlers) return -1;\n\n var theList = document.getElementById('importList');\n if (!theList) return;\n // if starting new import, reset import status flags\n if (startIndex==0)\n for (var t=0;t<window.importedTiddlers.length;t++)\n window.importedTiddlers[t].status="";\n for (var i=startIndex; i<theList.options.length; i++)\n {\n // if list item is not selected or is a heading (i.e., has no value), skip it\n if ((!theList.options[i].selected) || ((t=theList.options[i].value)==""))\n continue;\n for (var j=0;j<window.importedTiddlers.length;j++)\n if (window.importedTiddlers[j].title==t) break;\n var theImported = window.importedTiddlers[j];\n var theExisting = store.getTiddler(theImported.title);\n // avoid redundant import for tiddlers that are listed multiple times (when 'by tags')\n if (theImported.status=="added")\n continue;\n // don't import the "ImportedTiddlers" history from the other document...\n if (theImported.title=='ImportedTiddlers')\n continue;\n // don't import tiddler if title/date/time match (i.e., no changes)\n if (window.importDiffsOnly && theExisting && ((theImported.modified-theExisting.modified)==0))\n continue;\n // if tiddler exists and import not marked for replace or merge, stop importing\n if (theExisting && (theImported.status.substr(0,7)!="replace") && (theImported.status.substr(0,5)!="merge"))\n return i;\n // append importation tags (if any)\n if (window.importTags!="")\n theImported.set(null,null,null,null,theImported.getTags()+' '+window.importTags)\n // set the status to 'added' (if not already set by the 'ask the user' UI)\n theImported.status=(theImported.status=="")?'added':theImported.status;\n // do the import!\n store.addTiddler(theImported);\n store.setDirty(true);\n }\n return(-1); // signals that we really finished the entire list\n}\n//}}}\n\n//{{{\nfunction importStopped()\n{\n var theList = document.getElementById('importList');\n var theNewTitle = document.getElementById('importNewTitle');\n if (!theList) return;\n if (window.importIndex==-1)\n importReport(); // import finished... generate the report\n else\n {\n // DEBUG alert('import stopped at: '+window.importIndex);\n // import collision... show the ask panel and set the title edit field\n document.getElementById('importAskPanel').style.display='block';\n theNewTitle.value=theList.options[window.importIndex].value;\n }\n}\n//}}}\n