config.options.chkHttpReadOnly = false;\n
\nModel: D-Link DWL-G122, H/W Version: C1\n\nFor this usb stick you need the driver for chipsets [[RT2501USB(RT73:RT2571W/RT2573/RT2671|http://www.ralink.com.tw/data/RT73_Linux_STA_Drv1.0.4.0.tar.gz]] from http://www.ralink.com.tw/Home/Support/Linux.html\n\nand the following Makefile when compiling using the Axis SDK (tested only with the crisv32 compiler for elphel353) :\n\n//{{{\n######################################################################\n# Module Name: Makefile\n# Abstract: Makefile for rt73 linux driver on kernel series 2.6 \n######################################################################\n\n\nKERNEL_VERSION=2.6.19\n\nWFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs\n\n## Comment/uncomment the following line to enable/disable debugging\n#CFLAGS += -DDBG\nCFLAGS += -I$(AXIS_KERNEL_DIR)/include\n\nCC=crisv32-axis-linux-gnu-gcc -mlinux\nLD=crisv32-axis-linux-gnu-ld -mcrislinux\nCFLAGS += $(WFLAGS)\n\nobj-m := rt73.o\n\nrt73-objs := rtmp_main.o mlme.o connect.o rtusb_bulk.o rtusb_io.o sync.o assoc.o auth.o auth_rsp.o rtusb_data.o rtmp_init.o sanity.o rtmp_wep.o rtmp_info.o rtmp_tkip.o wpa.o md5.o\n\n## Configuration files on SuSE\n#NDDIR=/etc/sysconfig/network\n#MOD_CONF=/etc/modprobe.d/module-renames\n\n## NDDIR/ifcfg-rausb0\nND_CONF=/etc/sysconfig/network-scripts/ifcfg-rausb0\n\nifdef NDDIR\n NDDIR := $(NDDIR)\nelse\n NDDIR := /etc/sysconfig/network-scripts\nendif\n\nifdef MOD_CONF\n MOD_CONF := $(MOD_CONF)\nelse\n MOD_CONF := /etc/modprobe.conf \nendif\n\nall: \n make -C $(AXIS_TOP_DIR)/target/crisv32-axis-linux-gnu/lib/modules/$(KERNEL_VERSION)/build SUBDIRS=$(shell pwd) modules\n\nclean:\n rm -rf *.o *~ .*.cmd *.ko *.mod.c .tmp_versions built-in.o\n \ninstall:\n make -C $(AXIS_TOP_DIR)/target/crisv32-axis-linux-gnu/lib/modules/$(KERNEL_VERSION)/build \s\n INSTALL_MOD_DIR=extra SUBDIRS=$(shell pwd) \s\n modules_install \n \n @echo "Network device directory $(NDDIR)"; \n @echo "Module configuration file $(MOD_CONF)"; \n \n @if [ -d "$(NDDIR)" ] ; then \s\n if [ ! -f "$(ND_CONF)" ]; then \s\n echo "Create 'ifcfg-rausb0' in $(NDDIR)/"; \s\n cp ifcfg-rausb0 $(NDDIR)/ ; \s\n fi; \s\n fi\n \n @if ! grep -q 'rausb0' $(MOD_CONF) ; then \s\n echo "append 'alias rausb0 rt73' to $(MOD_CONF)"; \s\n echo "alias rausb0 rt73" >> $(MOD_CONF) ; \s\n fi\n /sbin/depmod -a\n//}}}\n
[[The World Is Mindblind]]
<script>\n if (!story.findContainingTiddler(place)) return;\n var t=story.findContainingTiddler(place); // get the tiddler element\n for (var i=0; i<t.childNodes.length; i++)\n if (hasClass(t.childNodes[i],"viewer")) t.ondblclick=null; // disable double-click\n</script>
/***\nDropDownTagChooser\nhttp://simonbaird.com/mptw/#DropDownTagChooser\nRequires TagUtils\nExample:\n{{{<<selectUniqueTag Priority>>}}}\n<<selectUniqueTag Priority>>\nSee also ExampleTask (uses ViewTemplate to put a couple of these in the toolbar).\n***/\n//{{{\nvar selectUniqueTagOnChange = function(tiddler,newTag,tagGroup) {\n\n // can I do this a better way, ie not have to use store.getTiddler???\n // just use macro handler scope ???\n\n var t = store.getTiddler(tiddler);\n t.setUniqueTagFromGroup(newTag,tagGroup);\n\n // refresh visible tiddlers\n story.forEachTiddler(function(title,element) {\n if (element.getAttribute("dirty") != "true") \n story.refreshTiddler(title,false,true);\n });\n\n return false;\n}\n\nconfig.macros.selectUniqueTag = {};\nconfig.macros.selectUniqueTag.handler =\n function(place,macroName,params,wikifier,paramString,tiddler) {\n\n var tagGroup = params[0];\n var label = params[1]?params[1]:params[0]+":";\n\n var tagsInGroup = getTitles(store.getTaggedTiddlers(params[0]));\n\n var select = document.createElement("select");\n\n /*\n // dont know how to make this work..\n var update = function(e) {\n if (!e) var e = window.event;\n alert("here");\n return false;\n };\n select.onchange = update;\n */\n\n select.setAttribute("onchange","selectUniqueTagOnChange('"+\n tiddler.title+"',this.options[this.selectedIndex].text,'"+tagGroup+"');");\n\n select.setAttribute("style","font-size:90%;"); // evil. should use a class!\n\n // in case there is currently none of them\n if (!tiddler.hasAnyTag(tagsInGroup)) {\n var opt = document.createElement("option");\n opt.text = "-";\n opt.selected = true;\n try {\n // for IE\n select.add(opt);\n }\n catch(e) {\n select.appendChild(opt)\n };\n }\n\n for (var i=0;i<tagsInGroup.length;i++) {\n var opt = document.createElement("option");\n opt.text = tagsInGroup[i];\n if (tiddler.hasTag(tagsInGroup[i]))\n opt.selected = true;\n try {\n // for IE\n select.add(opt);\n }\n catch(e) {\n select.appendChild(opt)\n };\n }\n\n wikify(label,place,null,tiddler);\n place.appendChild(select);\n}\n\n//}}}\n\n
<div class="toolbar" macro="toolbar +saveTiddler closeOthers -cancelTiddler deleteTiddler"></div>\n<div class="title" macro="view title"></div>\n<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>\n<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div>\n<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>\n<div class="editor" macro="edit text"></div>\n<br/>
!!ADD AUDIO TO YOUR ELPHEL CAMERA STREAM USING [[GSTREAMER|http://gstreamer.freedesktop.org]]\nIn two words and three lines we have to:\n* demultiplex (demux) the incoming ogg stream to read the mjpeg stream,\n* grab the sound from an audio source, \n* multiplex (mux) the mjpeg and the audio streams into an ogg container.\n////+++!![Example 1 - soundmux]\nPaste the script below (soundmux) in a new file or download the full version [[here|http://luxigo.ath.cx/elphel/gstreamer/soundmux.sh]],\nchange the settings, save it as "soundmux.sh", and make it executable with:\n//{{{\nchmod +x soundmux.sh\n//}}}\nthen run it with:\n//{{{\nElphelOgm | soundmux.sh\n//}}}\n\n!!!Simplified soundmux.sh\nDownload the full version [[here|http://luxigo.ath.cx/elphel/gstreamer/soundmux.sh]]\n//{{{\n#!/bin/sh\n\n# audio settings\nAUDIO_DEVICE="hw:0,0"\nAUDIO_BITRATE=48000\n\n# output file name\nOUTFILE="out.ogg"\n\nDEBUG="-v -m"\n\ngst-launch-0.10 $DEBUG \s\n\s\n oggmux name=mux \s\n ! filesink location="$OUTFILE" \s\n\s\n fdsrc fd=0 \s\n ! queue \s\n ! oggdemux \s\n ! ogmvideoparse \s\n ! mux. \s\n\s\n alsasrc device="$AUDIO_DEVICE" \s\n ! audioconvert \s\n ! queue \s\n ! vorbisenc \s\n bitrate=$AUDIO_BITRATE \s\n ! mux.\n\n# Description of the gst-launch command above:\n\n# - the muxed stream (the output from the oggmux element) will be\n# stored in a file (filesink)\n\n# - The video comes from ElphelOgm through stdin (fdsrc fd=0).\n# - The ogg stream is demuxed.\n# - The ogg media video stream is parsed for security (optional?).\n# - The resulting mjpeg stream is sent to the ogg muxer through the\n# "mux." element (defined with "oggmux name=mux"). \n# (This syntax could also be used for oggdemux but here there's only\n# a single stream in the incoming ogg container so we dont need to\n# complicate things here) \n\n# - The sound comes from an alsa device through alsasrc,\n# - The sound is converted in a suitable format then encoded in vorbis,\n# before being muxed with the video stream.\n//}}}\n\n////===\n\n!!BROADCAST THE VIDEO MULTIPLEXED WITH AUDIO USING [[ICECAST 2|http://www.icecast.org]]\nIn the same time you add audio, you can resize and transcode the video stream\nin theora in order to broadcast the resulting stream on your icecast server\n(if your machine can handle the frame size at the given framerate).\n////+++!![Example 2 - oggmicecast]\nPaste the script below in a new file or download the full version [[here|http://luxigo.ath.cx/elphel/gstreamer/oggmiceast.sh]],\nchange the default settings if required, then save it as "oggmicecast.sh"\nand make it executable with:\n//{{{\n chmod +x oggmicecast.sh\n//}}}\nThen run it with:\n//{{{\n ElphelOgm | oggmicecast.sh\n//}}}\nFinally you can use mplayer to watch the stream:\n//{{{\n gmplayer http://icecast:8000/elphel.ogg.m3u\n//}}}\n\n!!!Simplified oggmicecast.sh\nDownload the full version [[here|http://luxigo.ath.cx/elphel/gstreamer/oggmicecast.sh]]\n\n//{{{\n#!/bin/sh\n\n# video settings\nVIDEO_QUALITY=51 # between 0 and 63 (51 is ~80%)\nWIDTH=480 # 4/3: ... 512x384, 480x360, 353x264, ...\nHEIGHT=360 # 16/9: ... 640x360, 512x288, 384x216, ... \n\n# audio settings\nAUDIO_BITRATE=48000 # ..., 32000, 48000, 64000, ...\nAUDIO_DEVICE="hw:0,0" # ALSA notation\n\n# icecast settings\nICECAST_SERVER=icecast\nICECAST_SERVER_PORT=8000\nICECAST_SERVER_PW="hackme"\nICECAST_STREAMNAME="Elphel Camera"\nICECAST_MOUNTPOINT="/elphel.ogg"\nDEBUG="-v -m"\n\n# starting gstreamer\n\ngst-launch-0.10 $DEBUG \s\n\s\n oggmux name=mux \s\n ! queue \s\n ! shout2send \s\n ip=$ICECAST_SERVER \s\n port=$ICECAST_SERVER_PORT \s\n password="$ICECAST_SERVER_PW" \s\n streamname="$ICECAST_STREAMNAME" \s\n protocol=3 \s\n sync=true \s\n mount="$ICECAST_MOUNTPOINT" \s\n\s\n fdsrc fd=0 \s\n ! queue \s\n ! oggdemux \s\n ! ogmvideoparse \s\n ! jpegdec \s\n ! queue \s\n ! videoscale \s\n method=1 ! video/x-raw-yuv,width=$WIDTH height=$HEIGHT \s\n ! theoraenc \s\n quality=$VIDEO_QUALITY \s\n ! mux. \s\n\s\n alsasrc device="$AUDIO_DEVICE" \s\n ! audioconvert \s\n ! queue \s\n ! vorbisenc \s\n bitrate=$AUDIO_BITRATE \s\n ! mux.\n//}}}\n\n////===\n\n!!REMOTE MICROPHONE:\nThe microphone can be located on another machine, far from the camera.\n////+++!![Example 3 - micsend]\n\nYou may replace the "alsasrc" paragraph in oggmicecast.sh on the server with:\n//{{{\n tcpserversrc \s\n host=local_interface_ip \s\n port=9003 \s\n protocol=1 \s\n ! mux.\n//}}}\nor use the full version of oggmicecast with option -mi (download [[here|http://luxigo.ath.cx/elphel/gstreamer/oggmicecast.sh]])\n\nRun the script below (micsend.sh) on the client machine where you\nplugged the microphone, giving the ip you set for the tcpserversrc host\non the other side as last argument:\n//{{{\n micsend.sh <hostname>\n//}}}\n\n!!!Simplified micsend.sh\nDownload the full version [[here|http://luxigo.ath.cx/elphel/gstreamer/micsend.sh]]\n\n//{{{\n# audio settings\nAUDIO_DEVICE="hw:0,0"\nAUDIO_BITRATE=48000\n\n# network settings\nTCP_SERVER_PORT=9003\nTCP_SERVER=host_running_oggmicecast\n\nDEBUG="-v -m"\n\ngst-launch-0.10 $DEBUG \s\n\s\n alsasrc \s\n device=$AUDIO_DEVICE \s\n ! audioconvert \s\n ! queue \s\n ! vorbisenc bitrate=$AUDIO_BITRATE \s\n ! tcpclientsink \s\n host=$TCP_SERVER \s\n port=$TCP_SERVER_PORT \s\n max-lateness=150000000 \s\n protocol=1 \s\n sync=true\n//}}}\n\n////===\n\n////+++!![GSTREAMER HINTS]\n* Use "!" to pipe the output from the previous gstreamer element in the next one.\n* Try "gst-inspect-0.10" to list available gst-launch elements (commands) and "gst-inspect-0.10 <command>" to display syntax details for a single command.\n* An empty line in the formatted gst-launch command line layout used in this page denotes a distinct pipe.\n////===\n////+++!![KNOWN PROBLEMS]\n* Trying to use a different thread to recompress video (using gst-launch brace syntax), we were not able to synchronize audio with video. \n* Using [[ElphelOgm]]-0.9.7 in unicast mode and gstreamer-0.10, we experienced systematic crash in oggdemux (but i cant say for sure it never worked in the past or if it is an ElphelOgm encapsulation problem or a gstreamer oggdemux problem). \nSo actually we are using [[ElphelOgm]] 0.9.9 in multicast mode, but..\n* Using ElphelOgm in multicast mode, icecast server 2.3.1, and finally vlc 0.8.6 to watch the stream from the icecast server, we experienced image freeze in vlc after some time of playback, with all subsequent frames dropped. It was not the case using [[ElphelOgm]]-0.9.7 in unicast mode. (maybe vlc had problems decoding theora because the network was overloaded by many other streams and some packets were lost) However MPlayer1.0rc1-0ubuntu9 did play the same stream through the same overloaded switch without any problem ;)\n* Maybe you must recompile your icecast server so that it supports theora. Try "ldd /usr/bin/icecast" (/usr/bin/icecast2 in ubuntu) to see if yours is compiled with theora support enabled.\n* Depending on the cpu and bus speed, the sound card latency and other hardware and software factors, it may be a nightmare trying to synchronize audio and video. Hopefully, sometimes it just works :)\n////===\n////+++!![LINKS]\nhttp://gstreamer.freedesktop.org/ (see GSTREAMER HINTS)\nhttp://www.icecast.org/\nhttp://www.mplayerhq.hu/\nhttp://www.videolan.org/ (see KNOWN PROBLEMS)\n////===\n
[[MPlayer for Elphel Cameras]]\n[[Elphel Camera Remote Audio HOW-TO]]\n[[Make a movie from JPEG images using gstreamer]]\n[[Wireless USB stick D-Link DWL-G122 - Elphel Cameras - How-To]]\n\nhttp://www.elphel.com\nhttp://wiki.elphel.com
ElphelOgm is a RTP receiver for elphel cameras.\n\nDownload the source [[here|http://sourceforge.net/project/showfiles.php?group_id=105686&package_id=172636]] or [[here|http://sourceforge.net/projects/elphel]].
\nAuthor: [[John Stewart|http://users.tpg.com.au/users/jes999]]\n\nEvolution’s Arrow founds its conclusions on a new theory of the evolution of cooperation. It shows how self-interest at the level of genes and individuals does not stand in the way of the movement of evolution toward increasing cooperation. Evolution progresses by discovering ways to build cooperative organizations out of self-interested individuals.\n\nThe book argues that ‘management’ and ‘governance’ are keys to explaining the evolution of cooperation. It shows how management can organise cooperative organizations of self-interested components. Management can be external (eg. proteins managed by RNA, and human societies managed by rulers or government) or can be internal and distributed (eg. insect societies managed by genes reproduced in each individual insect, multicellular organisms managed by genes reproduced in each cell, human tribes managed by inculcated beliefs reproduced in each tribal member).\n\nEvolution’s Arrow also notes that humanity has reached a major evolutionary threshold. The next great step in social evolution on earth is the formation of a cooperative, sustainable and creative global society. Individuals are beginning to emerge who have decided to consciously contribute to the evolutionary process by doing what they can to actualise such a global society. They are aware that their evolutionary activism is part of a significant evolutionary event on earth.\n\n<html>\n<br>\nFOR THE FULL TEXT IN HTML, CLICK ON THE RELEVANT CHAPTER\n HEADING BELOW.<o:p></o:p></span></b></p>\n <p class="MsoNormal"><span style="font-size: 20pt;">&nbsp;<o:p></o:p></span></p>\n <h1 style="margin: 0in 0in 0.0001pt;"><span style="color: maroon;">Part 1:<span style="">&nbsp; </span><span style="">&nbsp;</span>Evolutionary\n Progress?<u2:p></u2:p></span><span style="color: maroon;"><o:p></o:p></span></h1>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/1.htm" target="book">1.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Introduction</a></p>\n\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/2.htm" target="book">2.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>The Causes of Progress</a></p>\n <h1 style="margin: 12pt 0in;"><span style="color: maroon;">Part 2:<span style="">&nbsp;&nbsp;\n </span>The Evolution of Cooperation<u2:p></u2:p></span><span style="color: maroon;"><o:p></o:p></span></h1>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/3.htm" target="book">3.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Why Cooperate?</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/4.htm" target="book">4.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Barriers to Cooperation</a></p>\n\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/5.htm" target="book">5.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Organising Cooperation</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/6.htm" target="book">6.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>The Evolution of Management</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/7.htm" target="book">7.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Internal Management</a></p>\n <h1 style="margin: 12pt 0in;"><span style="color: maroon;">Part 3:<span style="">&nbsp;&nbsp;\n\n </span>The Evolution of Evolution<u2:p></u2:p></span><span style="color: maroon;"><o:p></o:p></span></h1>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/8.htm" target="book">8.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Smarter Cooperation</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/9.htm" target="book">9.<span style="font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Smarter Genes</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/10.htm" target="book">10.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Smarter Organisms</a></p>\n\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/11.htm" target="book">11.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Smarter Humans</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/12.htm" target="book">12.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>The Self-Evolving Organism</a></p>\n <p class="MsoBodyText"><h1><span style="color: maroon;">Part 4:&nbsp;&nbsp; The Evolution of Life on Earth –\n Past, Present and Future<u2:p></u2:p></span></h1><span style="color: maroon;"><o:p></o:p></span></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/13.htm" target="book">13.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Evolution of Life on Earth</a></p>\n\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/14.htm" target="book">14.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Management by Morals</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/15.htm" target="book">15.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>The Rise of Governed Societies</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/16.htm" target="book">16.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Limitations of Markets</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/17.htm" target="book">17.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Planetary Society and Beyond</a></p>\n\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/18.htm" target="book">18.<span style="font-size: 7pt;">&nbsp;&nbsp; </span>Humanity V. Bacteria</a></p>\n <p class="MsoNormal" style="margin-left: 39.75pt; text-indent: -21.75pt;"><a href="http://users.tpg.com.au/users/jes999/19.htm" target="book"><span style="">19.</span><span style="font-size: 7pt;">&nbsp;&nbsp;\n </span>The Evolutionary Warrior</a>\n</html>
/***\nNot using this for anything at the moment but it's too good to throw out..\n***/\n//{{{\n\nfunction feEsc(expr) {\n return '"'+expr.replace(/"/,'\s\s"').replace(/\sn/,'\s\sn')+'"';\n\n}\n\nfunction feHelper(where,sortBy,sortOrder,write,place,debug) {\n markup = "<<forEachTiddler\sn\stwhere\sn\st\st%0\sn\stsortBy\sn\st\st%1\sn\st\st\st%2\sn\stwrite\sn\st\st%3\sn>>".format([\n feEsc(where),\n feEsc(sortBy),\n (sortOrder == "asc" ? "ascending" : (sortOrder == "desc" ? "descending" : sortOrder)),\n feEsc(write)\n ]);\n\n if (debug)\n wikify('\sn{{{\sn'+markup+'\sn}}}\sn', place);\n\n wikify(markup, place);\n}\n\n\n// example usage:\n feHelper(\n "tiddler.tags.contains('" + tiddler.title + "')",\n "tiddler."+sortBy,\n sortOrder,\n "'*[['+tiddler.title+']]\sn'",\n place\n );\n\n\n//}}}\n
Here are some examples that show the usage of the write action in the ForEachTiddlerMacro.\n\n//''Select and Sort Examples''//\n* InClauseExamples\n* WhereClauseExamples\n* SortClauseExamples\n* ScriptClauseExamples\n//''Action Examples''//\n* AddToListActionExamples\n* WriteActionExamples\n\n\nOf cause you may also combine the examples, e.g. taking the whereClause of one example, the sortClause of a second and the action of a third.
//~~(Part of the [[ForEachTiddlerPlugin]])~~//\n\nCreate customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.\n\n''Syntax:'' \n|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|\n|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|\n|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|\n|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|\n|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|\n\n\n''Using JavaScript''\n\nTo give you a lot of flexibility the [[ForEachTiddlerMacro]] uses JavaScript in its arguments. Even if you are not that familiar with JavaScript you may find forEachTiddler useful. Just have a look at the various ready-to-use [[ForEachTiddlerExamples]] and adapt them to your needs.\n\n''The Elements of the Macro''\n\nThe arguments of the ForEachTiddlerMacro consist of multiple parts, each of them being optional.\n\n<<slider chkFETInClause [[inClause]] "inClause" "inClause">>\n<<slider chkFETWhereClause [[whereClause]] "whereClause" "whereClause">>\n<<slider chkFETSortClause [[sortClause]] "sortClause" "sortClause">>\n<<slider chkFETScriptClause [[scriptClause]] "scriptClause" "scriptClause">>\n<<slider chkFETActions [[Action Specification]] "Action Specification" "Action Specification">>\n\n''Using Macros and ">" inside the forEachTiddler Macro''\n\nYou may use other macro calls into the expression, especially in the actionParameters. To avoid that the {{{>>}}} of such a macro call is misinterpreted as the end of the {{{<<forEachTiddler...>>}}} macro you must escape the {{{>>}}} of the inner macro with {{{$))}}} E.g. if you want to use {{{<<tiddler ...>>}}} inside the {{{forEachTiddler}}} macro you have to write {{{<<tiddler ...$))}}}.\n\nIn addition it is necessary to escape single {{{>}}} with the text {{{$)}}}.\n\n\n\nSee also [[ForEachTiddlerExamples]].
/***\n|''Name:''|ForEachTiddlerPlugin|\n|''Version:''|1.0.5 (2006-02-05)|\n|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license]]|\n|''Macros:''|[[ForEachTiddlerMacro]] v1.0.5|\n|''TiddlyWiki:''|1.2.38+, 2.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n!Description\n\nCreate customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.\n\n''Syntax:'' \n|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|\n|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|\n|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|\n|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|\n|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|\n|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|\n|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|\n\nSee details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].\n\n!Revision history\n* v1.0.5\n** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro ("inTiddler"). Thanks to SimonBaird.\n** Support Firefox 1.5.0.1\n** Internal\n*** Make "JSLint" conform\n*** "Only install once"\n* v1.0.4 (2006-01-06)\n** Support TiddlyWiki 2.0\n* v1.0.3 (2005-12-22)\n** Features: \n*** Write output to a file supports multi-byte environments (Thanks to Bram Chen) \n*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)\n** Enhancements:\n*** Improved error messages on InternetExplorer.\n* v1.0.2 (2005-12-10)\n** Features: \n*** context object also holds reference to store (TiddlyWiki)\n** Fixed Bugs: \n*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)\n* v1.0.1 (2005-12-08)\n** Features: \n*** Access tiddlers stored in separated TiddlyWikis through the "in" option. I.e. you are no longer limited to only work on the "current TiddlyWiki".\n*** Write output to an external file using the "toFile" option of the "write" action. With this option you may write your customized tiddler exports.\n*** Use the "script" section to define "helper" JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).\n*** Access and store context information for the current forEachTiddler invocation (through the build-in "context" object) .\n*** Improved script evaluation (for where/sort clause and write scripts).\n* v1.0.0 (2005-11-20)\n** initial version\n\n!Code\n***/\n//{{{\n\n \n//============================================================================\n//============================================================================\n// ForEachTiddlerPlugin\n//============================================================================\n//============================================================================\n\n// Only install once\nif (!version.extensions.ForEachTiddlerPlugin) {\n\nversion.extensions.ForEachTiddlerPlugin = {major: 1, minor: 0, revision: 5, date: new Date(2006,2,5), source: "http://tiddlywiki.abego-software.de/#ForEachTiddlergPlugin"};\n\n// For backward compatibility with TW 1.2.x\n//\nif (!TiddlyWiki.prototype.forEachTiddler) {\n TiddlyWiki.prototype.forEachTiddler = function(callback) {\n for(var t in this.tiddlers) {\n callback.call(this,t,this.tiddlers[t]);\n }\n };\n}\n\n//============================================================================\n// forEachTiddler Macro\n//============================================================================\n\nversion.extensions.forEachTiddler = {major: 1, minor: 0, revision: 5, date: new Date(2006,2,5), provider: "http://tiddlywiki.abego-software.de"};\n\n// ---------------------------------------------------------------------------\n// Configurations and constants \n// ---------------------------------------------------------------------------\n\nconfig.macros.forEachTiddler = {\n // Standard Properties\n label: "forEachTiddler",\n prompt: "Perform actions on a (sorted) selection of tiddlers",\n\n // actions\n actions: {\n addToList: {},\n write: {}\n }\n};\n\n// ---------------------------------------------------------------------------\n// The forEachTiddler Macro Handler \n// ---------------------------------------------------------------------------\n\nconfig.macros.forEachTiddler.getContainingTiddler = function(e) {\n while(e && !hasClass(e,"tiddler"))\n e = e.parentNode;\n var title = e ? e.getAttribute("tiddler") : null; \n return title ? store.getTiddler(title) : null;\n};\n\nconfig.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {\n // config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);\n\n if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);\n // --- Parsing ------------------------------------------\n\n var i = 0; // index running over the params\n // Parse the "in" clause\n var tiddlyWikiPath = undefined;\n if ((i < params.length) && params[i] == "in") {\n i++;\n if (i >= params.length) {\n this.handleError(place, "TiddlyWiki path expected behind 'in'.");\n return;\n }\n tiddlyWikiPath = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the where clause\n var whereClause ="true";\n if ((i < params.length) && params[i] == "where") {\n i++;\n whereClause = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the sort stuff\n var sortClause = null;\n var sortAscending = true; \n if ((i < params.length) && params[i] == "sortBy") {\n i++;\n if (i >= params.length) {\n this.handleError(place, "sortClause missing behind 'sortBy'.");\n return;\n }\n sortClause = this.paramEncode(params[i]);\n i++;\n\n if ((i < params.length) && (params[i] == "ascending" || params[i] == "descending")) {\n sortAscending = params[i] == "ascending";\n i++;\n }\n }\n\n // Parse the script\n var scriptText = null;\n if ((i < params.length) && params[i] == "script") {\n i++;\n scriptText = this.paramEncode((i < params.length) ? params[i] : "");\n i++;\n }\n\n // Parse the action. \n // When we are already at the end use the default action\n var actionName = "addToList";\n if (i < params.length) {\n if (!config.macros.forEachTiddler.actions[params[i]]) {\n this.handleError(place, "Unknown action '"+params[i]+"'.");\n return;\n } else {\n actionName = params[i]; \n i++;\n }\n } \n \n // Get the action parameter\n // (the parsing is done inside the individual action implementation.)\n var actionParameter = params.slice(i);\n\n\n // --- Processing ------------------------------------------\n try {\n this.performMacro({\n place: place, \n inTiddler: tiddler,\n whereClause: whereClause, \n sortClause: sortClause, \n sortAscending: sortAscending, \n actionName: actionName, \n actionParameter: actionParameter, \n scriptText: scriptText, \n tiddlyWikiPath: tiddlyWikiPath});\n\n } catch (e) {\n this.handleError(place, e);\n }\n};\n\n// Returns an object with properties "tiddlers" and "context".\n// tiddlers holds the (sorted) tiddlers selected by the parameter,\n// context the context of the execution of the macro.\n//\n// The action is not yet performed.\n//\n// @parameter see performMacro\n//\nconfig.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {\n\n var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);\n\n var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;\n context["tiddlyWiki"] = tiddlyWiki;\n \n // Get the tiddlers, as defined by the whereClause\n var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);\n context["tiddlers"] = tiddlers;\n\n // Sort the tiddlers, when sorting is required.\n if (parameter.sortClause) {\n this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);\n }\n\n return {tiddlers: tiddlers, context: context};\n};\n\n// Returns the (sorted) tiddlers selected by the parameter.\n//\n// The action is not yet performed.\n//\n// @parameter see performMacro\n//\nconfig.macros.forEachTiddler.getTiddlers = function(parameter) {\n return this.getTiddlersAndContext(parameter).tiddlers;\n};\n\n// Performs the macros with the given parameter.\n//\n// @param parameter holds the parameter of the macro as separate properties.\n// The following properties are supported:\n//\n// place\n// whereClause\n// sortClause\n// sortAscending\n// actionName\n// actionParameter\n// scriptText\n// tiddlyWikiPath\n//\n// All properties are optional. \n// For most actions the place property must be defined.\n//\nconfig.macros.forEachTiddler.performMacro = function(parameter) {\n var tiddlersAndContext = this.getTiddlersAndContext(parameter);\n\n // Perform the action\n var actionName = parameter.actionName ? parameter.actionName : "addToList";\n var action = config.macros.forEachTiddler.actions[actionName];\n if (!action) {\n this.handleError(parameter.place, "Unknown action '"+actionName+"'.");\n return;\n }\n\n var actionHandler = action.handler;\n actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);\n};\n\n// ---------------------------------------------------------------------------\n// The actions \n// ---------------------------------------------------------------------------\n\n// Internal.\n//\n// --- The addToList Action -----------------------------------------------\n//\nconfig.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {\n // Parse the parameter\n var p = 0;\n\n // Check for extra parameters\n if (parameter.length > p) {\n config.macros.forEachTiddler.createExtraParameterErrorElement(place, "addToList", parameter, p);\n return;\n }\n\n // Perform the action.\n var list = document.createElement("ul");\n place.appendChild(list);\n for (var i = 0; i < tiddlers.length; i++) {\n var tiddler = tiddlers[i];\n var listItem = document.createElement("li");\n list.appendChild(listItem);\n createTiddlyLink(listItem, tiddler.title, true);\n }\n};\n\n// Internal.\n//\n// --- The write Action ---------------------------------------------------\n//\nconfig.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {\n // Parse the parameter\n var p = 0;\n if (p >= parameter.length) {\n this.handleError(place, "Missing expression behind 'write'.");\n return;\n }\n\n var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);\n p++;\n\n // Parse the "toFile" option\n var filename = null;\n var lineSeparator = undefined;\n if ((p < parameter.length) && parameter[p] == "toFile") {\n p++;\n if (p >= parameter.length) {\n this.handleError(place, "Filename expected behind 'toFile' of 'write' action.");\n return;\n }\n \n filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));\n p++;\n if ((p < parameter.length) && parameter[p] == "withLineSeparator") {\n p++;\n if (p >= parameter.length) {\n this.handleError(place, "Line separator text expected behind 'withLineSeparator' of 'write' action.");\n return;\n }\n lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);\n p++;\n }\n }\n \n // Check for extra parameters\n if (parameter.length > p) {\n config.macros.forEachTiddler.createExtraParameterErrorElement(place, "write", parameter, p);\n return;\n }\n\n // Perform the action.\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);\n var count = tiddlers.length;\n var text = "";\n for (var i = 0; i < count; i++) {\n var tiddler = tiddlers[i];\n text += func(tiddler, context, count, i);\n }\n \n if (filename) {\n if (lineSeparator !== undefined) {\n lineSeparator = lineSeparator.replace(/\s\sn/mg, "\sn").replace(/\s\sr/mg, "\sr");\n text = text.replace(/\sn/mg,lineSeparator);\n }\n saveFile(filename, convertUnicodeToUTF8(text));\n } else {\n var wrapper = createTiddlyElement(place, "span");\n wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);\n }\n};\n\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// Internal.\n//\nconfig.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {\n return {\n place : placeParam, \n whereClause : whereClauseParam, \n sortClause : sortClauseParam, \n sortAscending : sortAscendingParam, \n script : scriptText,\n actionName : actionNameParam, \n actionParameter : actionParameterParam,\n tiddlyWikiPath : tiddlyWikiPathParam,\n inTiddler : inTiddlerParam\n };\n};\n\n// Internal.\n//\n// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of \n// the given path.\n//\nconfig.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {\n if (!idPrefix) {\n idPrefix = "store";\n }\n var lenPrefix = idPrefix.length;\n \n // Read the content of the given file\n var content = loadFile(this.getLocalPath(path));\n if(content === null) {\n throw "TiddlyWiki '"+path+"' not found.";\n }\n \n // Locate the storeArea div's\n var posOpeningDiv = content.indexOf(startSaveArea);\n var posClosingDiv = content.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1)) {\n throw "File '"+path+"' is not a TiddlyWiki.";\n }\n var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);\n \n // Create a "div" element that contains the storage text\n var myStorageDiv = document.createElement("div");\n myStorageDiv.innerHTML = storageText;\n myStorageDiv.normalize();\n \n // Create all tiddlers in a new TiddlyWiki\n // (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)\n var tiddlyWiki = new TiddlyWiki();\n var store = myStorageDiv.childNodes;\n for(var t = 0; t < store.length; t++) {\n var e = store[t];\n var title = null;\n if(e.getAttribute)\n title = e.getAttribute("tiddler");\n if(!title && e.id && e.id.substr(0,lenPrefix) == idPrefix)\n title = e.id.substr(lenPrefix);\n if(title && title !== "") {\n var tiddler = tiddlyWiki.createTiddler(title);\n tiddler.loadFromDiv(e,title);\n }\n }\n tiddlyWiki.dirty = false;\n\n return tiddlyWiki;\n};\n\n\n \n// Internal.\n//\n// Returns a function that has a function body returning the given javaScriptExpression.\n// The function has the parameters:\n// \n// (tiddler, context, count, index)\n//\nconfig.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {\n var script = context["script"];\n var functionText = "var theFunction = function(tiddler, context, count, index) { return "+javaScriptExpression+"}";\n var fullText = (script ? script+";" : "")+functionText+";theFunction;";\n return eval(fullText);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {\n var result = [];\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);\n tiddlyWiki.forEachTiddler(function(title,tiddler) {\n if (func(tiddler, context, undefined, undefined)) {\n result.push(tiddler);\n }\n });\n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {\n var message = "Extra parameter behind '"+actionName+"':";\n for (var i = firstUnusedIndex; i < parameter.length; i++) {\n message += " "+parameter[i];\n }\n this.handleError(place, message);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortAscending = function(tiddlerA, tiddlerB) {\n var result = \n (tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) \n ? 0\n : (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)\n ? -1 \n : +1; \n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortDescending = function(tiddlerA, tiddlerB) {\n var result = \n (tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) \n ? 0\n : (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)\n ? +1 \n : -1; \n return result;\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.sortTiddlers = function(tiddlers, sortClause, ascending, context) {\n // To avoid evaluating the sortClause whenever two items are compared \n // we pre-calculate the sortValue for every item in the array and store it in a \n // temporary property ("forEachTiddlerSortValue") of the tiddlers.\n var func = config.macros.forEachTiddler.getEvalTiddlerFunction(sortClause, context);\n var count = tiddlers.length;\n var i;\n for (i = 0; i < count; i++) {\n var tiddler = tiddlers[i];\n tiddler.forEachTiddlerSortValue = func(tiddler,context, undefined, undefined);\n }\n\n // Do the sorting\n tiddlers.sort(ascending ? this.sortAscending : this.sortDescending);\n\n // Delete the temporary property that holds the sortValue. \n for (i = 0; i < tiddlers.length; i++) {\n delete tiddlers[i].forEachTiddlerSortValue;\n }\n};\n\n\n// Internal.\n//\nconfig.macros.forEachTiddler.trace = function(message) {\n displayMessage(message);\n};\n\n// Internal.\n//\nconfig.macros.forEachTiddler.traceMacroCall = function(place,macroName,params) {\n var message ="<<"+macroName;\n for (var i = 0; i < params.length; i++) {\n message += " "+params[i];\n }\n message += ">>";\n displayMessage(message);\n};\n\n\n// Internal.\n//\n// Creates an element that holds an error message\n// \nconfig.macros.forEachTiddler.createErrorElement = function(place, exception) {\n var message = (exception.description) ? exception.description : exception.toString();\n return createTiddlyElement(place,"span",null,"forEachTiddlerError","<<forEachTiddler ...>>: "+message);\n};\n\n// Internal.\n//\n// @param place [may be null]\n//\nconfig.macros.forEachTiddler.handleError = function(place, exception) {\n if (place) {\n this.createErrorElement(place, exception);\n } else {\n throw exception;\n }\n};\n\n// Internal.\n//\n// Encodes the given string.\n//\n// Replaces \n// "$))" to ">>"\n// "$)" to ">"\n//\nconfig.macros.forEachTiddler.paramEncode = function(s) {\n var reGTGT = new RegExp("\s\s$\s\s)\s\s)","mg");\n var reGT = new RegExp("\s\s$\s\s)","mg");\n return s.replace(reGTGT, ">>").replace(reGT, ">");\n};\n\n// Internal.\n//\n// Returns the given original path (that is a file path, starting with "file:")\n// as a path to a local file, in the systems native file format.\n//\n// Location information in the originalPath (i.e. the "#" and stuff following)\n// is stripped.\n// \nconfig.macros.forEachTiddler.getLocalPath = function(originalPath) {\n // Remove any location part of the URL\n var hashPos = originalPath.indexOf("#");\n if(hashPos != -1)\n originalPath = originalPath.substr(0,hashPos);\n // Convert to a native file format assuming\n // "file:///x:/path/path/path..." - pc local file --> "x:\spath\spath\spath..."\n // "file://///server/share/path/path/path..." - FireFox pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n // "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."\n // "file://server/share/path/path/path..." - pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n var localPath;\n if(originalPath.charAt(9) == ":") // pc local file\n localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file://///") === 0) // FireFox pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file:///") === 0) // mac/unix local file\n localPath = unescape(originalPath.substr(7));\n else if(originalPath.indexOf("file:/") === 0) // mac/unix local file\n localPath = unescape(originalPath.substr(5));\n else // pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\s\s"); \n return localPath;\n};\n\n// ---------------------------------------------------------------------------\n// Stylesheet Extensions (may be overridden by local StyleSheet)\n// ---------------------------------------------------------------------------\n//\nsetStylesheet(\n ".forEachTiddlerError{color: #ffffff;background-color: #880000;}",\n "forEachTiddler");\n\n//============================================================================\n// End of forEachTiddler Macro\n//============================================================================\n\n\n//============================================================================\n// String.startsWith Function\n//============================================================================\n//\n// Returns true if the string starts with the given prefix, false otherwise.\n//\nversion.extensions["String.startsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.startsWith = function(prefix) {\n var n = prefix.length;\n return (this.length >= n) && (this.slice(0, n) == prefix);\n};\n\n\n\n//============================================================================\n// String.endsWith Function\n//============================================================================\n//\n// Returns true if the string ends with the given suffix, false otherwise.\n//\nversion.extensions["String.endsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.endsWith = function(suffix) {\n var n = suffix.length;\n return (this.length >= n) && (this.right(n) == suffix);\n};\n\n\n//============================================================================\n// String.contains Function\n//============================================================================\n//\n// Returns true when the string contains the given substring, false otherwise.\n//\nversion.extensions["String.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nString.prototype.contains = function(substring) {\n return this.indexOf(substring) >= 0;\n};\n\n//============================================================================\n// Array.indexOf Function\n//============================================================================\n//\n// Returns the index of the first occurance of the given item in the array or \n// -1 when no such item exists.\n//\n// @param item [may be null]\n//\nversion.extensions["Array.indexOf"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.indexOf = function(item) {\n for (var i = 0; i < this.length; i++) {\n if (this[i] == item) {\n return i;\n }\n }\n return -1;\n};\n\n//============================================================================\n// Array.contains Function\n//============================================================================\n//\n// Returns true when the array contains the given item, otherwise false. \n//\n// @param item [may be null]\n//\nversion.extensions["Array.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.contains = function(item) {\n return (this.indexOf(item) >= 0);\n};\n\n//============================================================================\n// Array.containsAny Function\n//============================================================================\n//\n// Returns true when the array contains at least one of the elements \n// of the item. Otherwise (or when items contains no elements) false is returned.\n//\nversion.extensions["Array.containsAny"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.containsAny = function(items) {\n for(var i = 0; i < items.length; i++) {\n if (this.contains(items[i])) {\n return true;\n }\n }\n return false;\n};\n\n\n//============================================================================\n// Array.containsAll Function\n//============================================================================\n//\n// Returns true when the array contains all the items, otherwise false.\n// \n// When items is null false is returned (even if the array contains a null).\n//\n// @param items [may be null] \n//\nversion.extensions["Array.containsAll"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};\n//\nArray.prototype.containsAll = function(items) {\n for(var i = 0; i < items.length; i++) {\n if (!this.contains(items[i])) {\n return false;\n }\n }\n return true;\n};\n\n\n} // of "install only once"\n\n// Used Globals (for JSLint) ==============\n// ... DOM\n/*global document */\n// ... TiddlyWiki Core\n/*global convertUnicodeToUTF8, createTiddlyElement, createTiddlyLink, \n displayMessage, endSaveArea, hasClass, loadFile, saveFile, \n startSaveArea, store, wikify */\n//}}}\n\n\n/***\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of abego Software nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n***/\n\n
<script label="hide sidebar">\n var show=0;\n document.getElementById('sidebar').style.display=show?"block":"none";\n document.getElementById('displayArea').style.marginRight=show?config.options.txtDisplayAreaRightMargin:"1em";\n</script>
<script>\n var s=place.parentNode.style;\n s.backgroundImage="none";\n s.backgroundColor="transparent"\n s.borderColor="transparent";\n s.borderWidth=0;\n s.margin=0;\n s.padding=0;\n</script>
<script>\n // get the tiddler element\n var t=story.findContainingTiddler(place);\n if (t && t.id!="tiddlerHideTiddlerSubtitle") \n for (var i=0; i<t.childNodes.length; i++)\n if (hasClass(t.childNodes[i],"subtitle"))\n t.childNodes[i].style.display="none";\n</script>
<script>\n var t=story.findContainingTiddler(place);\n if (t && t.id!="tiddlerHideTiddlerTags")\n for (var i=0; i<t.childNodes.length; i++)\n if (hasClass(t.childNodes[i],"tagging")||hasClass(t.childNodes[i],"tagged"))\n t.childNodes[i].style.display="none";\n</script>
<script>\n // get the tiddler element\n var t=story.findContainingTiddler(place);\n if (t && t.id!="tiddlerHideTiddlerTitle") \n for (var i=0; i<t.childNodes.length; i++)\n if (hasClass(t.childNodes[i],"title")||hasClass(t.childNodes[i],"title"))\n t.childNodes[i].style.display="none";\n</script>
<script>\n var t=story.findContainingTiddler(place);\n if (t && t.id!="tiddlerHideTiddlerToolbar")\n for (var i=0; i<t.childNodes.length; i++)\n if (hasClass(t.childNodes[i],"toolbar"))\n t.childNodes[i].style.display="none";\n</script>
/***\nTo use, add {{{[[HorizontalMainMenuStyles]]}}} to your StyleSheet tiddler, or you can just paste the CSS in directly. See also HorizontalMainMenu and PageTemplate.\n***/\n/*{{{*/\n\n#topMenu br {display:none; }\n#topMenu { background: #069; }\n#topMenu { padding:2px; }\n#topMenu .button, #topMenu .tiddlyLink {\n margin-left:0.5em; margin-right:0.5em;\n padding-left:3px; padding-right:3px;\n color:white; font-size:115%;\n}\n#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#17a;}\n\n#displayArea { margin: 1em 15.7em 0em 1em; } /* so we use the freed up space */\n\n/* just in case want some QuickOpenTags in your topMenu */\n#topMenu .quickopentag { padding:0px; margin:0px; border:0px; }\n#topMenu .quickopentag .tiddlyLink { padding-right:1px; margin-right:0px; }\n#topMenu .quickopentag .button { padding-left:1px; margin-left:0px; border:0px; }\n\n@media print { #topMenu {display: none ! important;} }\n\n/*}}}*/
<<importTiddlers inline>>
/***\n''Import Tiddlers Plugin for TiddlyWiki version 1.2.x, 2.0 and 2.1beta''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#ImportTiddlersPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nWhen many people share and edit copies of the same TiddlyWiki document, the ability to quickly collect all these changes back into a single, updated document that can then be redistributed to the entire group is very important. This plugin lets you selectively combine tiddlers from any two TiddlyWiki documents. It can also be very useful when moving your own tiddlers from document to document (e.g., when upgrading to the latest version of TiddlyWiki, or 'pre-loading' your favorite stylesheets into a new 'empty' TiddlyWiki document.)\n\n!!!!!Interactive interface\n<<<\n{{{<<importTiddlers>>}}}\ncreates "import tiddlers" link. click to show/hide import control panel\n\n{{{<<importTiddlers inline>>}}}\ncreates import control panel directly in tiddler content\n\n<<importTiddlers inline>>\n\nPress ''[browse]'' to select a TiddlyWiki document file to import. You can also type in the path/filename or a remote document URL (starting with http://)and press ''[open]''. //Note: There may be some delay to permit the browser time to access and load the document before updating the listbox with the titles of all tiddlers that are available to be imported.//\n\nSelect one or more titles from the listbox (hold CTRL or SHIFT while clicking to add/remove the highlight from individual list items). You can press ''[select all]'' to quickly highlight all tiddler titles in the list. Use the ''[-]'', ''[+]'', or ''[=]'' links to adjust the listbox size so you can view more (or less) tiddler titles at one time. When you have chosen the tiddlers you want to import and entered any extra tags, press ''[import]'' to begin copying them to the current TiddlyWiki document.\n\n''select: all, new, changes, or differences''\n\nYou can click on ''all'', ''new'', ''changes'', or ''differences'' to automatically select a subset of tiddlers from the list. This makes it very quick and easy to find and import just the updated tiddlers you are interested in:\n>''"all"'' selects ALL tiddlers from the import source document, even if they have not been changed.\n>''"new"'' selects only tiddlers that are found in the import source document, but do not yet exist in the destination document\n>''"changes"'' selects only tiddlers that exist in both documents but that are newer in the source document\n>''"differences"'' selects all new and existing tiddlers that are different from the destination document (even if destination tiddler is newer)\n\n''Import Tagging:''\n\nTiddlers that have been imported can be automatically tagged, so they will be easier to find later on, after they have been added to your document. New tags are entered into the "add tags" input field, and then //added// to the existing tags for each tiddler as it is imported.\n\n''Skip, Rename, Merge, or Replace:''\n\nWhen importing a tiddler whose title is identical to one that already exists, the import process pauses and the tiddler title is displayed in an input field, along with four push buttons: ''[skip]'', ''[rename]'', ''[merge]'' and ''[replace]''.\n\nTo bypass importing this tiddler, press ''[skip]''. To import the tiddler with a different name (so that both the tiddlers will exist when the import is done), enter a new title in the input field and then press ''[rename]''. Press ''[merge]'' to combine the content from both tiddlers into a single tiddler. Press ''[replace]'' to overwrite the existing tiddler with the imported one, discarding the previous tiddler content.\n\n//Note: if both the title ''and'' modification date/////time match, the imported tiddler is assumed to be identical to the existing one, and will be automatically skipped (i.e., not imported) without asking.//\n\n''Import Report History''\n\nWhen tiddlers are imported, a report is generated into ImportedTiddlers, indicating when the latest import was performed, the number of tiddlers successfully imported, from what location, and by whom. It also includes a list with the title, date and author of each tiddler that was imported.\n\nWhen the import process is completed, the ImportedTiddlers report is automatically displayed for your review. If more tiddlers are subsequently imported, a new report is //added// to ImportedTiddlers, above the previous report (i.e., at the top of the tiddler), so that a reverse-chronological history of imports is maintained.\n\nIf a cumulative record is not desired, the ImportedTiddlers report may be deleted at any time. A new ImportedTiddlers report will be created the next time tiddlers are imported.\n\nNote: You can prevent the ImportedTiddlers report from being generated for any given import activity by clearing the "create a report" checkbox before beginning the import processing.\n\n<<<\n!!!!!non-interactive 'load tiddlers' macro\n<<<\nUseful for automated installation/update of plugins and other tiddler content.\n\n{{{<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>}}}\n<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>\n\nSyntax:\n{{{<<loadTiddlers label:text prompt:text filter source quiet confirm>>}}}\n\n''label:text'' and ''prompt:text''\n>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 loadTiddlers() is executed whenever the containing tiddler is rendered.\n''filter'' (optional) determines which tiddlers will be automatically selected for importing. Use one of the following keywords:\n>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.\n>''"new"'' retrieves only tiddlers that are found in the import source document, but do not yet exist in the destination document\n>''"changes"'' retrieves only tiddlers that exist in both documents for which the import source tiddler is newer than the existing tiddler\n>''"updates"'' retrieves both ''new'' and ''changed'' tiddlers (this is the default action when none is specified)\n>''"tiddler:~TiddlerName"'' retrieves only the specific tiddler named in the parameter.\n>''"tag:text"'' retrieves only the tiddlers tagged with the indicated text.\n''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://")\n>use the keyword ''ask'' to prompt for a source location whenever the macro is invoked\n''"quiet"'' (optional)\n>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.\n''"confirm"'' (optional)\n>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.\n<<<\n!!!!!Installation\n<<<\ncopy/paste the following tiddlers into your document:\n''ImportTiddlersPlugin'' (tagged with <<tag systemConfig>>)\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add "< < ImportTiddlers > >" macro^^\n\n''Quick Installation Tip #1:''\nIf you are using an unmodified version of TiddlyWiki (core release version <<version>>), you can get a new, empty TiddlyWiki with the Import Tiddlers plugin pre-installed (''[[download from here|TW+ImportExport.html]]''), and then simply import all your content from your old document into this new, empty document.\n<<<\n!!!!!Revision History\n<<<\n//wffl store.addNotification(null,refreshImportList); // \n\n''2006.08.16 [3.0.6]'' Use higher-level store.saveTiddler() instead of store.addTiddler() to avoid conflicts with ZW and other adaptations that hijack low-level tiddler handling. Also, in CreateImportPanel(), no longer register notify to "refresh listbox after every tiddler change" (left over from old 'auto-filtered' list handling). Thanks to Bob McElrath for report/solution.\n''2006.07.29 [3.0.5]'' added noChangeMsg to loadTiddlers processing. if not 'quiet' mode, reports skipped tiddlers.\n''2006.04.18 [3.0.4]'' in loadTiddlers.handler, fixed parsing of "prompt:" param. Also, corrected parameters mismatch in loadTiddlers() callback function definition (order of params was wrong, resulting in filters NOT being applied)\n''2006.04.12 [3.0.3]'' moved many display messages to macro properties for easier L10N translations via 'lingo' definitions.\n''2006.04.12 [3.0.2]'' additional refactoring of 'core candidate' code. Proposed API now defines "loadRemoteFile()" for XMLHttpRequest processing with built in fallback for handling local filesystem access, and readTiddlersFromHTML() to process the resulting source HTML content.\n''2006.04.04 [3.0.1]'' in refreshImportList(), when using [by tags], tiddlers without tags are now included in a new "untagged" psuedo-tag list section\n''2006.04.04 [3.0.0]'' Separate non-interactive {{{<<importTiddlers...>>}}} macro functionality for incorporation into TW2.1 core and renamed as {{{<<loadTiddlers>>}}} macro. New parameters for loadTiddlers: ''label:text'' and ''prompt:text'' for link creation, ''ask'' for filename/URL, ''tag:text'' for filtering, "confirm" for accept/reject of individual inbound tiddlers. Also, ImportedTiddlers report generator output has been simplified and "importReplace/importPublic" tags and associated "force" param (which were rarely, if ever, used) has been dropped.\n''2006.03.30 [2.9.1]'' when extracting store area from remote URL, look for "</body>" instead of "</body>\sn</html>" so it will match even if the "\sn" is absent from the source.\n''2006.03.30 [2.9.0]'' added optional 'force' macro param. When present, autoImportTiddlers() bypasses the checks for importPublic and importReplace. Based on a request from Tom Otvos.\n''2006.03.28 [2.8.1]'' in loadImportFile(), added checks to see if 'netscape' and 'x.overrideMimeType()' are defined (IE does *not* define these values, so we bypass this code)\nAlso, when extracting store area from remote URL, explicitly look for "</body>\sn</html>" to exclude any extra content that may have been added to the end of the file by hosting environments such as GeoCities. Thanks to Tom Otvos for finding these bugs and suggesting some fixes.\n''2006.02.21 [2.8.0]'' added support for "tiddler:TiddlerName" filtering parameter in auto-import processing\n''2006.02.21 [2.7.1]'' Clean up layout problems with IE. (Use tables for alignment instead of SPANs styled with float:left and float:right)\n''2006.02.21 [2.7.0]'' Added "local file" and "web server" radio buttons for selecting dynamic import source controls in ImportPanel. Default file control is replaced with URL text input field when "web server" is selected. Default remote document URL is defined in SiteURL tiddler. Also, added option for prepending SiteProxy URL as prefix to remote URL to mask cross-domain document access (requires compatible server-side script)\n''2006.02.17 [2.6.0]'' Removed "differences only" listbox display mode, replaced with selection filter 'presets': all/new/changes/differences. Also fixed initialization handling for "add new tags" so that checkbox state is correctly tracked when panel is first displayed.\n''2006.02.16 [2.5.4]'' added checkbox options to control "import remote tags" and "keep existing tags" behavior, in addition to existing "add new tags" functionality.\n''2006.02.14 [2.5.3]'' FF1501 corrected unintended global 't' (loop index) in importReport() and autoImportTiddlers()\n''2006.02.10 [2.5.2]'' corrected unintended global variable in importReport().\n''2006.02.05 [2.5.1]'' moved globals from window.* to config.macros.importTiddlers.* to avoid FireFox 1.5.0.1 crash bug when referencing globals\n''2006.01.18 [2.5.0]'' added checkbox for "create a report". Default is to create/update the ImportedTiddlers report. Clear the checkbox to skip this step.\n''2006.01.15 [2.4.1]'' added "importPublic" tag and inverted default so that auto sharing is NOT done unless tagged with importPublic\n''2006.01.15 [2.4.0]'' Added support for tagging individual tiddlers with importSkip, importReplace, and/or importPrivate to control which tiddlers can be overwritten or shared with others when using auto-import macro syntax. Defaults are to SKIP overwriting existing tiddlers with imported tiddlers, and ALLOW your tiddlers to be auto-imported by others.\n''2006.01.15 [2.3.2]'' Added "ask" parameter to confirm each tiddler before importing (for use with auto-importing)\n''2006.01.15 [2.3.1]'' Strip TW core scripts from import source content and load just the storeArea into the hidden IFRAME. Makes loading more efficient by reducing the document size and by preventing the import document from executing its TW initialization (including plugins). Seems to resolve the "Found 0 tiddlers" problem. Also, when importing local documents, use convertUTF8ToUnicode() to convert the file contents so support international characters sets.\n''2006.01.12 [2.3.0]'' Reorganized code to use callback function for loading import files to support event-driven I/O via an ASYNCHRONOUS XMLHttpRequest. Let's processing continue while waiting for remote hosts to respond to URL requests. Added non-interactive 'batch' macro mode, using parameters to specify which tiddlers to import, and from what document source. Improved error messages and diagnostics, plus an optional 'quiet' switch for batch mode to eliminate //most// feedback.\n''2006.01.11 [2.2.0]'' Added "[by tags]" to list of tiddlers, based on code submitted by BradleyMeck\n''2006.01.09 [2.1.1]'' When a URL is typed in, and then the "open" button is pressed, it generates both an onChange event for the file input and a click event for open button. This results in multiple XMLHttpRequest()'s which seem to jam things up quite a bit. I removed the onChange handling for file input field. To open a file (local or URL), you must now explicitly press the "open" button in the control panel.\n''2006.01.08 [2.1.0]'' IMPORT FROM ANYWHERE!!! re-write getImportedTiddlers() logic to either read a local file (using local I/O), OR... read a remote file, using a combination of XML and an iframe to permit cross-domain reading of DOM elements. Adapted from example code and techniques courtesy of Jonny LeRoy.\n''2006.01.06 [2.0.2]'' When refreshing list contents, fixed check for tiddlerExists() when "show differences only" is selected, so that imported tiddlers that don't exist in the current file will be recognized as differences and included in the list.\n''2006.01.04 [2.0.1]'' When "show differences only" is NOT checked, import all tiddlers that have been selected even when they have a matching title and date.\n''2005.12.27 [2.0.0]'' Update for TW2.0\nDefer initial panel creation and only register a notification function when panel first is created\n''2005.12.22 [1.3.1]'' tweak formatting in importReport() and add 'discard report' link to output\n''2005.12.03 [1.3.0]'' Dynamically create/remove importPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding. Also, dynamically create/recreate importFrame each time an external TW document is loaded for importation (reduces DOM overhead and ensures a 'fresh' frame for each document)\n''2005.11.29 [1.2.1]'' fixed formatting of 'detail info' in importReport()\n''2005.11.11 [1.2.0]'' added 'inline' param to embed controls in a tiddler\n''2005.11.09 [1.1.0]'' only load HTML and CSS the first time the macro handler is called. Allows for redundant placement of the macro without creating multiple instances of controls with the same ID's.\n''2005.10.25 [1.0.5]'' fixed typo in importReport() that prevented reports from being generated\n''2005.10.09 [1.0.4]'' combined documentation with plugin code instead of using separate tiddlers\n''2005.08.05 [1.0.3]'' moved CSS and HTML definitions into plugin code instead of using separate tiddlers\n''2005.07.27 [1.0.2]'' core update 1.2.29: custom overlayStyleSheet() replaced with new core setStylesheet()\n''2005.07.23 [1.0.1]'' added parameter checks and corrected addNotification() usage\n''2005.07.20 [1.0.0]'' Initial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n// // ''MACRO DEFINITION''\n//{{{\n// Version\nversion.extensions.importTiddlers = {major: 3, minor: 0, revision: 6, date: new Date(2006,8,16)};\n\n// IE needs explicit global scoping for functions/vars called from browser events\nwindow.onClickImportButton=onClickImportButton;\nwindow.refreshImportList=refreshImportList;\n\n// default cookie/option values\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n\nconfig.macros.importTiddlers = { };\nconfig.macros.importTiddlers = {\n label: "import tiddlers",\n prompt: "Copy tiddlers from another document",\n foundMsg: "Found %0 tiddlers in %1",\n countMsg: "%0 tiddlers selected for import",\n importedMsg: "Imported %0 of %1 tiddlers from %2",\n src: "", // path/filename or URL of document to import (retrieved from SiteUrl tiddler)\n proxy: "", // URL for remote proxy script (retrieved from SiteProxy tiddler)\n useProxy: false, // use specific proxy script in front of remote URL\n inbound: null, // hash-indexed array of tiddlers from other document\n newTags: "", // text of tags added to imported tiddlers\n addTags: true, // add new tags to imported tiddlers\n listsize: 8, // # of lines to show in imported tiddler list\n importTags: true, // include tags from remote source document when importing a tiddler\n keepTags: true, // retain existing tags when replacing a tiddler\n index: 0, // current processing index in import list\n sort: "" // sort order for imported tiddler listbox\n};\n\nconfig.macros.importTiddlers.handler = function(place,macroName,params) {\n if (!config.macros.loadTiddlers.handler)\n { alert("importTiddlers error: this plugin requires LoadTiddlersPlugin or TiddlyWiki 2.1+"); return; }\n if (!params[0]) // LINK TO FLOATING PANEL\n createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);\n else if (params[0]=="inline") {// // INLINE TIDDLER CONTENT\n createImportPanel(place);\n document.getElementById("importPanel").style.position="static";\n document.getElementById("importPanel").style.display="block";\n }\n else config.macros.loadTiddlers.handler(place,macroName,params); // FALLBACK: PASS TO LOADTIDDLERS\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\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 refreshImportList();\n var siteURL=store.getTiddlerText("SiteUrl"); if (!siteURL) siteURL="";\n document.getElementById("importSourceURL").value=siteURL;\n config.macros.importTiddlers.src=siteURL;\n var siteProxy=store.getTiddlerText("SiteProxy"); if (!siteProxy) siteProxy="SiteProxy";\n document.getElementById("importSiteProxy").value=siteProxy;\n config.macros.importTiddlers.proxy=siteProxy;\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:35em; right:105%; top:3em;\s\n background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\s\n border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\s\n padding: 0.5em; margin:0em; -moz-border-radius:1em;\s\n}\s\n#importPanel a, #importPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\s\n#importPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\s\n#importPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\s\n#importPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\s\n#importPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\s\n#importPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\s\n#importPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px;}\s\n#importPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\s\n#importPanel .rad { width:auto; }\s\n#importPanel .chk { width:auto; margin:1px;border:0; }\s\n#importPanel .btn { width:auto; }\s\n#importPanel .btn1 { width:98%; }\s\n#importPanel .btn2 { width:48%; }\s\n#importPanel .btn3 { width:32%; }\s\n#importPanel .btn4 { width:24%; }\s\n#importPanel .btn5 { width:19%; }\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#importCollisionPanel { display:none; margin:0.5em 0em 0em 0em; }\s\n';\n//}}}\n\n// // HTML \n//{{{\nconfig.macros.importTiddlers.html = '\s\n<!-- source and report -->\s\n<table><tr><td align=left>\s\n import from\s\n <input type="radio" class="rad" name="importFrom" value="file" CHECKED\s\n onClick="document.getElementById(\s'importLocalPanel\s').style.display=this.checked?\s'block\s':\s'none\s';\s\n document.getElementById(\s'importHTTPPanel\s').style.display=!this.checked?\s'block\s':\s'none\s'"> local file\s\n <input type="radio" class="rad" name="importFrom" value="http"\s\n onClick="document.getElementById(\s'importLocalPanel\s').style.display=!this.checked?\s'block\s':\s'none\s';\s\n document.getElementById(\s'importHTTPPanel\s').style.display=this.checked?\s'block\s':\s'none\s'"> web server\s\n</td><td align=right>\s\n <input type=checkbox class="chk" id="chkImportReport" checked\s\n onClick="config.options[\s'chkImportReport\s']=this.checked;"> create a report\s\n</td></tr></table>\s\n<!-- import from local file -->\s\n<div id="importLocalPanel" style="display:block;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\s\nlocal document path/filename:<br>\s\n<input type="file" id="fileImportSource" size=57 style="width:100%"\s\n onKeyUp="config.macros.importTiddlers.src=this.value"\s\n onChange="config.macros.importTiddlers.src=this.value;">\s\n</div><!--panel-->\s\n\s\n<!-- import from http server -->\s\n<div id="importHTTPPanel" style="display:none;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\s\n<table><tr><td align=left>\s\n remote document URL:<br>\s\n</td><td align=right>\s\n <input type="checkbox" class="chk" id="importUseProxy"\s\n onClick="config.macros.importTiddlers.useProxy=this.checked;\s\n document.getElementById(\s'importSiteProxy\s').style.display=this.checked?\s'block\s':\s'none\s'"> use a proxy script\s\n</td></tr></table>\s\n<input type="text" id="importSiteProxy" style="display:none;margin-bottom:1px" onfocus="this.select()" value="SiteProxy"\s\n onKeyUp="config.macros.importTiddlers.proxy=this.value"\s\n onChange="config.macros.importTiddlers.proxy=this.value;">\s\n<input type="text" id="importSourceURL" onfocus="this.select()" value="SiteUrl"\s\n onKeyUp="config.macros.importTiddlers.src=this.value"\s\n onChange="config.macros.importTiddlers.src=this.value;">\s\n</div><!--panel-->\s\n\s\n<table><tr><td align=left>\s\n select:\s\n <a href="JavaScript:;" id="importSelectAll"\s\n onclick="onClickImportButton(this)" title="select all tiddlers">\s\n &nbsp;all&nbsp;</a>\s\n <a href="JavaScript:;" id="importSelectNew"\s\n onclick="onClickImportButton(this)" title="select tiddlers not already in destination document">\s\n &nbsp;added&nbsp;</a> \s\n <a href="JavaScript:;" id="importSelectChanges"\s\n onclick="onClickImportButton(this)" title="select tiddlers that have been updated in source document">\s\n &nbsp;changes&nbsp;</a> \s\n <a href="JavaScript:;" id="importSelectDifferences"\s\n onclick="onClickImportButton(this)" title="select tiddlers that have been added or are different from existing tiddlers">\s\n &nbsp;differences&nbsp;</a> \s\n <a href="JavaScript:;" id="importToggleFilter"\s\n onclick="onClickImportButton(this)" title="show/hide selection filter">\s\n &nbsp;filter&nbsp;</a> \s\n</td><td align=right>\s\n <a href="JavaScript:;" id="importListSmaller"\s\n onclick="onClickImportButton(this)" title="reduce list size">\s\n &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="importListLarger"\s\n onclick="onClickImportButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n <a href="JavaScript:;" id="importListMaximize"\s\n onclick="onClickImportButton(this)" title="maximize/restore list size">\s\n &nbsp;=&nbsp;</a>\s\n</td></tr></table>\s\n<select id="importList" size=8 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\n<input type=checkbox class="chk" id="chkAddTags" checked\s\n onClick="config.macros.importTiddlers.addTags=this.checked;">add new tags &nbsp;\s\n<input type=checkbox class="chk" id="chkImportTags" checked\s\n onClick="config.macros.importTiddlers.importTags=this.checked;">import source tags &nbsp;\s\n<input type=checkbox class="chk" id="chkKeepTags" checked\s\n onClick="config.macros.importTiddlers.keepTags=this.checked;">keep existing tags<br>\s\n<input type=text id="txtNewTags" size=15 onKeyUp="config.macros.importTiddlers.newTags=this.value" autocomplete=off>\s\n<div align=center>\s\n <input type=button id="importOpen" class="importButton" style="width:32%" value="open"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importStart" class="importButton" style="width:32%" value="import"\s\n onclick="onClickImportButton(this)">\s\n <input type=button id="importClose" class="importButton" style="width:32%" value="close"\s\n onclick="onClickImportButton(this)">\s\n</div>\s\n<div id="importCollisionPanel">\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// // 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 theCollisionPanel = document.getElementById('importCollisionPanel');\n var theNewTitle = document.getElementById('importNewTitle');\n var count=0;\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 config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer\n refreshImportList(); // reset/resize the listbox\n if (config.macros.importTiddlers.src=="") break;\n // Load document into hidden iframe so we can read it's DOM and fill the list\n loadRemoteFile(config.macros.importTiddlers.src, function(src,txt) {\n var tiddlers = readTiddlersFromHTML(txt);\n var count=tiddlers?tiddlers.length:0;\n displayMessage(config.macros.importTiddlers.foundMsg.format([count,src]));\n config.macros.importTiddlers.inbound=tiddlers;\n window.refreshImportList(0);\n });\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,count=0; t < theList.options.length; t++) {\n if (theList.options[t].value=="") continue;\n theList.options[t].selected=true;\n count++;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectNew': // select tiddlers not in current document\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value=="") continue;\n theList.options[t].selected=!store.tiddlerExists(theList.options[t].value);\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectChanges': // select tiddlers that are updated from existing tiddlers\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value==""||!store.tiddlerExists(theList.options[t].value)) continue;\n for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }\n theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified>0); // updated tiddler\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importSelectDifferences': // select tiddlers that are new or different from existing tiddlers\n importReport(); // if an import was in progress, generate a report\n for (var t=0,count=0; t < theList.options.length; t++) {\n theList.options[t].selected=false;\n if (theList.options[t].value=="") continue;\n if (!store.tiddlerExists(theList.options[t].value)) { theList.options[t].selected=true; count++; continue; }\n for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }\n theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified!=0); // changed tiddler\n count+=theList.options[t].selected?1:0;\n }\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n break;\n case 'importToggleFilter': // show/hide filter\n case 'importFilter': // apply filter\n alert("coming soon!");\n break;\n case 'importStart': // initiate the import processing\n importReport(); // if an import was in progress, generate a report\n config.macros.importTiddlers.index=0;\n config.macros.importTiddlers.index=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 (!config.macros.importTiddlers.inbound) { thePanel.style.display='none'; break; }\n importReport(); // if an import was in progress, generate a report\n config.macros.importTiddlers.inbound=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[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n theImported.status='skipped after asking'; // mark item as skipped\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index+1); // resume with NEXT item\n importStopped();\n break;\n case 'importRename': // change name of imported tiddler\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[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 theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item\n importStopped();\n break;\n case 'importMerge': // join existing and imported tiddler content\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[j];\n var theExisting = store.getTiddler(theItem.value);\n var theText = theExisting.text+'\sn----\sn^^merged from: ';\n theText +='[['+config.macros.importTiddlers.src+'#'+theItem.value+'|'+config.macros.importTiddlers.src+'#'+theItem.value+']]^^\sn';\n theText +='^^'+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 0hh:0mm:0ss");\n theImported.status += ' by '+theExisting.modifier;\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with this item\n importStopped();\n break;\n case 'importReplace': // substitute imported tiddler for existing tiddler\n var theItem = theList.options[config.macros.importTiddlers.index];\n for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importTiddlers.inbound[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 0hh:0mm:0ss");\n theImported.status += ' by '+theExisting.modifier;\n theCollisionPanel.style.display='none';\n config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item\n importStopped();\n break;\n case 'importListSmaller': // decrease current listbox size, minimum=5\n if (theList.options.length==1) break;\n theList.size-=(theList.size>5)?1:0;\n config.macros.importTiddlers.listsize=theList.size;\n break;\n case 'importListLarger': // 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 config.macros.importTiddlers.listsize=theList.size;\n break;\n case 'importListMaximize': // toggle listbox size between current and maximum\n if (theList.options.length==1) break;\n theList.size=(theList.size==theList.options.length)?config.macros.importTiddlers.listsize:theList.options.length;\n break;\n }\n}\n//}}}\n\n// // refresh listbox\n//{{{\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 (!config.macros.importTiddlers.inbound) \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=config.macros.importTiddlers.listsize;\n return;\n }\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) config.macros.importTiddlers.sort='title'; // heading\n if (selectedIndex==1) config.macros.importTiddlers.sort='title';\n if (selectedIndex==2) config.macros.importTiddlers.sort='modified';\n if (selectedIndex==3) config.macros.importTiddlers.sort='tags';\n if (selectedIndex>3) {\n // display selected tiddler count\n for (var t=0,count=0; t < theList.options.length; t++) count+=(theList.options[t].selected&&theList.options[t].value!="")?1:0;\n clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));\n return; // no refresh needed\n }\n\n // get the alphasorted list of tiddlers (optionally, filter out unchanged tiddlers)\n var tiddlers=config.macros.importTiddlers.inbound;\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(tiddlers.length+' tiddler'+((tiddlers.length!=1)?'s are':' is')+' in the document',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="title" )?">":indent)+' [by title]',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="modified")?">":indent)+' [by date]',"",false,false);\n theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="tags")?">":indent)+' [by tags]',"",false,false);\n // output the tiddler list\n switch(config.macros.importTiddlers.sort)\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 if (!tags || !tags.length) {\n if (theTitles["untagged"]==undefined) { theTags.push("untagged"); theTitles["untagged"]=new Array(); }\n theTitles["untagged"].push(title);\n }\n else 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<config.macros.importTiddlers.listsize) theList.size=config.macros.importTiddlers.listsize;\n if (theList.size>theList.options.length) theList.size=theList.options.length;\n}\n//}}}\n\n// // re-entrant processing for handling import with interactive collision prompting\n//{{{\nfunction importTiddlers(startIndex)\n{\n if (!config.macros.importTiddlers.inbound) return -1;\n\n var theList = document.getElementById('importList');\n if (!theList) return;\n var t;\n // if starting new import, reset import status flags\n if (startIndex==0)\n for (var t=0;t<config.macros.importTiddlers.inbound.length;t++)\n config.macros.importTiddlers.inbound[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<config.macros.importTiddlers.inbound.length;j++)\n if (config.macros.importTiddlers.inbound[j].title==t) break;\n var inbound = config.macros.importTiddlers.inbound[j];\n var theExisting = store.getTiddler(inbound.title);\n // avoid redundant import for tiddlers that are listed multiple times (when 'by tags')\n if (inbound.status=="added")\n continue;\n // don't import the "ImportedTiddlers" history from the other document...\n if (inbound.title=='ImportedTiddlers')\n continue;\n // if tiddler exists and import not marked for replace or merge, stop importing\n if (theExisting && (inbound.status.substr(0,7)!="replace") && (inbound.status.substr(0,5)!="merge"))\n return i;\n // assemble tags (remote + existing + added)\n var newTags = "";\n if (config.macros.importTiddlers.importTags)\n newTags+=inbound.getTags() // import remote tags\n if (config.macros.importTiddlers.keepTags && theExisting)\n newTags+=" "+theExisting.getTags(); // keep existing tags\n if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)\n newTags+=" "+config.macros.importTiddlers.newTags; // add new tags\n inbound.set(null,null,null,null,newTags.trim());\n // set the status to 'added' (if not already set by the 'ask the user' UI)\n inbound.status=(inbound.status=="")?'added':inbound.status;\n // do the import!\n // OLD: store.addTiddler(in); store.setDirty(true);\n store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, inbound.tags);\n store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value\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 (config.macros.importTiddlers.index==-1)\n importReport(); // import finished... generate the report\n else\n {\n // DEBUG alert('import stopped at: '+config.macros.importTiddlers.index);\n // import collision... show the collision panel and set the title edit field\n document.getElementById('importCollisionPanel').style.display='block';\n theNewTitle.value=theList.options[config.macros.importTiddlers.index].value;\n }\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n//{{{\nfunction importReport(quiet)\n{\n if (!config.macros.importTiddlers.inbound) return;\n // DEBUG alert('importReport: start');\n\n // if import was not completed, the collision panel will still be open... close it now.\n var panel=document.getElementById('importCollisionPanel'); if (panel) panel.style.display='none';\n\n // get the alphasorted list of tiddlers\n var tiddlers = config.macros.importTiddlers.inbound;\n // gather the statistics\n var count=0;\n for (var t=0; t<tiddlers.length; t++)\n if (tiddlers[t].status && tiddlers[t].status.trim().length && tiddlers[t].status.substr(0,7)!="skipped") count++;\n\n // generate a report\n if (count && config.options.chkImportReport) {\n // get/create the report tiddler\n var theReport = store.getTiddler('ImportedTiddlers');\n if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }\n // format the report content\n var now = new Date();\n var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName\n newText +=" imported "+count+" tiddler"+(count==1?"":"s")+" from\sn[["+config.macros.importTiddlers.src+"|"+config.macros.importTiddlers.src+"]]:\sn";\n if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)\n newText += "imported tiddlers were tagged with: \s""+config.macros.importTiddlers.newTags+"\s"\sn";\n newText += "<<<\sn";\n for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\sn";\n newText += "<<<\sn";\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n theReport.text = newText+((theReport.text!="")?'\sn----\sn':"")+theReport.text;\n theReport.modifier = config.options.txtUserName;\n theReport.modified = new Date();\n // OLD: store.addTiddler(theReport);\n store.saveTiddler(theReport.title, theReport.title, theReport.text, theReport.modifier, theReport.modified, theReport.tags);\n if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }\n }\n\n // reset status flags\n for (var t=0; t<config.macros.importTiddlers.inbound.length; t++) config.macros.importTiddlers.inbound[t].status="";\n\n // refresh display if tiddlers have been loaded\n if (count) { store.setDirty(true); store.notifyAll(); }\n\n // always show final message when tiddlers were actually loaded\n if (count) displayMessage(config.macros.importTiddlers.importedMsg.format([count,tiddlers.length,config.macros.importTiddlers.src]));\n}\n//}}}\n\n/***\n!!!!!TW 2.1beta Core Code Candidate\n//The following section is a preliminary 'code candidate' for incorporation of non-interactive 'load tiddlers' functionality into TW2.1beta. //\n***/\n//{{{\n// default cookie/option values\nif (!config.options.chkImportReport) config.options.chkImportReport=true;\n\nconfig.macros.loadTiddlers = {\n label: "",\n prompt: "add/update tiddlers from '%0'",\n askMsg: "Please enter a local path/filename or a remote URL",\n openMsg: "Opening %0",\n openErrMsg: "Could not open %0 - error=%1",\n readMsg: "Read %0 bytes from %1",\n foundMsg: "Found %0 tiddlers in %1",\n nochangeMsg: "'%0' is up-to-date... skipped.",\n loadedMsg: "Loaded %0 of %1 tiddlers from %2"\n};\n\nconfig.macros.loadTiddlers.handler = function(place,macroName,params) {\n var label=(params[0] && params[0].substr(0,6)=='label:')?params.shift().substr(6):this.label;\n var prompt=(params[0] && params[0].substr(0,7)=='prompt:')?params.shift().substr(7):this.prompt;\n var filter="updates";\n if (params[0] && (params[0]=='all' || params[0]=='new' || params[0]=='changes' || params[0]=='updates'\n || params[0].substr(0,8)=='tiddler:' || params[0].substr(0,4)=='tag:'))\n filter=params.shift();\n var src=params.shift(); if (!src || !src.length) return; // filename is required\n var quiet=(params[0]=="quiet"); if (quiet) params.shift();\n var ask=(params[0]=="confirm"); if (ask) params.shift();\n var force=(params[0]=="force"); if (force) params.shift();\n if (label.trim().length) {\n // link triggers load tiddlers from another file/URL and then applies filtering rules to add/replace tiddlers in the store\n createTiddlyButton(place,label.format([src]),prompt.format([src]), function() {\n if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);\n loadRemoteFile(src,loadTiddlers,quiet,ask,filter,force);\n })\n }\n else {\n // load tiddlers from another file/URL and then apply filtering rules to add/replace tiddlers in the store\n if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);\n loadRemoteFile(src,loadTiddlers,quiet,ask,filter,force);\n }\n}\n\nfunction loadTiddlers(src,html,quiet,ask,filter,force)\n{\n var tiddlers = readTiddlersFromHTML(html);\n var count=tiddlers?tiddlers.length:0;\n if (!quiet) displayMessage(config.macros.loadTiddlers.foundMsg.format([count,src]));\n var count=0;\n if (tiddlers) for (var t=0;t<tiddlers.length;t++) {\n var inbound = tiddlers[t];\n var theExisting = store.getTiddler(inbound.title);\n if (inbound.title=='ImportedTiddlers')\n continue; // skip "ImportedTiddlers" history from the other document...\n\n // apply the all/new/changes/updates filter (if any)\n if (filter && filter!="all") {\n if ((filter=="new") && theExisting) // skip existing tiddlers\n continue;\n if ((filter=="changes") && !theExisting) // skip new tiddlers\n continue;\n if ((filter.substr(0,4)=="tag:") && inbound.tags.find(filter.substr(4))==null) // must match specific tag value\n continue;\n if ((filter.substr(0,8)=="tiddler:") && inbound.title!=filter.substr(8)) // must match specific tiddler name\n continue;\n if (!force && store.tiddlerExists(inbound.title) && ((theExisting.modified.getTime()-inbound.modified.getTime())>=0))\n { if (!quiet) displayMessage(config.macros.loadTiddlers.nochangeMsg.format([inbound.title])); continue; }\n }\n // get confirmation if required\n if (ask && !confirm((theExisting?"Update":"Add")+" tiddler '"+inbound.title+"'\snfrom "+src))\n { tiddlers[t].status="skipped - cancelled by user"; continue; }\n // DO IT!\n // OLD: store.addTiddler(in);\n store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, inbound.tags);\n store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value\n tiddlers[t].status=theExisting?"updated":"added"\n count++;\n }\n if (count) {\n // refresh display\n store.setDirty(true);\n store.notifyAll();\n // generate a report\n if (config.options.chkImportReport) {\n // get/create the report tiddler\n var theReport = store.getTiddler('ImportedTiddlers');\n if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }\n // format the report content\n var now = new Date();\n var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName+" loaded "+count+" tiddlers from\sn[["+src+"|"+src+"]]:\sn";\n newText += "<<<\sn";\n for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\sn";\n newText += "<<<\sn";\n newText += "<html><input type=\s"button\s" href=\s"javascript:;\s" ";\n newText += "onclick=\s"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\s" ";\n newText += "value=\s"discard report\s"></html>";\n // update the ImportedTiddlers content and show the tiddler\n theReport.text = newText+((theReport.text!="")?'\sn----\sn':"")+theReport.text;\n theReport.modifier = config.options.txtUserName;\n theReport.modified = new Date();\n // OLD: store.addTiddler(theReport);\n store.saveTiddler(theReport.title, theReport.title, theReport.text, theReport.modifier, theReport.modified, theReport.tags);\n if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }\n }\n }\n // always show final message when tiddlers were actually loaded\n if (!quiet||count) displayMessage(config.macros.loadTiddlers.loadedMsg.format([count,tiddlers.length,src]));\n}\n\nfunction loadRemoteFile(src,callback,quiet,ask,filter,force) {\n if (src==undefined || !src.length) return null; // filename is required\n if (!quiet) clearMessage();\n if (!quiet) displayMessage(config.macros.loadTiddlers.openMsg.format([src]));\n if (src.substr(0,4)!="http" && src.substr(0,4)!="file") { // if not a URL, fallback to read from local filesystem\n var txt=loadFile(src);\n if ((txt==null)||(txt==false)) // file didn't load\n { if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"])); }\n else {\n if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([txt.length,src]));\n if (callback) callback(src,convertUTF8ToUnicode(txt),quiet,ask,filter,force);\n }\n }\n else {\n var x; // get an request object\n try {x = new XMLHttpRequest()} // moz\n catch(e) {\n try {x = new ActiveXObject("Msxml2.XMLHTTP")} // IE 6\n catch (e) {\n try {x = new ActiveXObject("Microsoft.XMLHTTP")} // IE 5\n catch (e) { return }\n }\n }\n // setup callback function to handle server response(s)\n x.onreadystatechange = function() {\n if (x.readyState == 4) {\n if (x.status==0 || x.status == 200) {\n if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([x.responseText.length,src]));\n if (callback) callback(src,x.responseText,quiet,ask,filter,force);\n }\n else {\n if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,x.status]));\n }\n }\n }\n // get privileges to read another document's DOM via http:// or file:// (moz-only)\n if (typeof(netscape)!="undefined") {\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); }\n catch (e) { if (!quiet) displayMessage(e.description?e.description:e.toString()); }\n }\n // send the HTTP request\n try {\n var url=src+(src.indexOf('?')<0?'?':'&')+'nocache='+Math.random();\n x.open("GET",src,true);\n if (x.overrideMimeType) x.overrideMimeType('text/html');\n x.send(null);\n }\n catch (e) {\n if (!quiet) {\n displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"]));\n displayMessage(e.description?e.description:e.toString());\n }\n }\n }\n}\n\nfunction readTiddlersFromHTML(html)\n{\n // extract store area from html \n var start=html.indexOf('<div id="storeArea">');\n var end=html.indexOf('</body>',start);\n var sa="<html><body>"+html.substring(start,end)+"</body></html>";\n\n // load html into iframe document\n var f=document.getElementById("loaderFrame"); if (f) document.body.removeChild(f);\n f=document.createElement("iframe"); f.id="loaderFrame";\n f.style.width="0px"; f.style.height="0px"; f.style.border="0px";\n document.body.appendChild(f);\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 d.open(); d.writeln(sa); d.close();\n\n // read tiddler DIVs from storeArea DOM element \n var sa = d.getElementById("storeArea");\n if (!sa) return null;\n sa.normalize();\n var nodes = sa.childNodes;\n if (!nodes || !nodes.length) return null;\n var tiddlers = [];\n for(var t = 0; t < nodes.length; t++) {\n var title = null;\n if(nodes[t].getAttribute)\n title = nodes[t].getAttribute("tiddler");\n if(!title && nodes[t].id && (nodes[t].id.substr(0,5) == "store"))\n title = nodes[t].id.substr(5);\n if(title && title != "")\n tiddlers.push((new Tiddler()).loadFromDiv(nodes[t],title));\n }\n return tiddlers;\n}\n//}}}
On mer 13 sep 2006 06:14:53 Local time zone must be set--see zic manual page, YourName imported 5 tiddlers from\n[[http://192.168.100.6:86|http://192.168.100.6:86]]:\n<<<\n#[[DoubleClickDisable]] - skipped after asking\n#[[Kiseido Go Server]] - added\n#[[SinglePageModePlugin]] - skipped after asking\n#[[VirtualHostPanel]] - added\n#[[VirtualHostPlugin]] - added\n#[[VirtualHostPluginDoc]] - added\n#[[VirtualHostUploadOptions]] - added\n<<<\n<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
TiddlyWiki lets you write ordinary HTML by enclosing it in {{{<html>}}} and {{{</html>}}}:\n\n<html>\n<a href="javascript:;" onclick="onClickTiddlerLink(event);" tiddlyLink="TiddlyWiki" style="background-color: yellow;">Link to wikiwords from HTML</a>\n</html>\n\nThe source for the above is:\n\n{{{\n<html>\n<div style="background-color: yellow;">\n<a href="javascript:;" onclick="onClickTiddlerLink(event);" tiddlyLink="Macros">Link to wikiwords from HTML</a>\n</div>\n</html>\n}}}\n\nHTML can enable some exotic new features (like [[embedding GMail and Outlook|http://groups.google.com/group/TiddlyWiki/browse_thread/thread/d363303aff5868d0/056269d8409d121f?lnk=st&q=embedding+gmail&rnum=1#056269d8409d121f]] in a TiddlyWiki). But, care needs to be taken with including things like JavaScript code. For example, this Flickr badge doesn't work in any of the browsers I've tried:\n\n<html>\n<!-- Start of Flickr Badge -->\n<style type="text/css">\n#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}\n#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}\n#flickr_icon_td {padding:0 5px 0 0 !important;}\n.flickr_badge_image {text-align:center !important;}\n.flickr_badge_image img {border: 1px solid black !important;}\n#flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}\n#flickr_badge_uber_wrapper a:hover,\n#flickr_badge_uber_wrapper a:link,\n#flickr_badge_uber_wrapper a:active,\n#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;}\n#flickr_badge_wrapper {}\n#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;}\n</style>\n<table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"><tr><td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper">\n<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=5&display=latest&size=t&layout=v&source=user&user=35468148136%40N01"></script>\n</table>\n</td></tr></table>\n<!-- End of Flickr Badge -->\n</html>
/***\n''InlineJavascriptPlugin for ~TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#InlineJavascriptPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nInsert Javascript executable code directly into your tiddler content. Lets you ''call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.\n!!!!!Usage\n<<<\nWhen installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.\n\n''Deferred execution from an 'onClick' link''\nBy including a label="..." parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered.\n\n''External script source files:''\nYou can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.\n\n''Display script source in tiddler output''\nBy including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.\n\n''Defining javascript functions and libraries:''\nAlthough the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).\n\nTo ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.\n\nSince the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.\n\n''Creating dynamic tiddler content''\nAn important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:\n* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.\n* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.\n* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.\n\nIf your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.\n\n//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//\n\n''Accessing the ~TiddlyWiki DOM''\nThe plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.\n\nAccess to this DOM element allows you to create scripts that can:\n* vary their actions based upon the specific location in which they are embedded\n* access 'tiddler-relative' information (use findContainingTiddler(place))\n* perform direct DOM manipulations (when returning wikified text is not enough)\n<<<\n!!!!!Examples\n<<<\nan "alert" message box:\n><script show>\n alert('InlineJavascriptPlugin: this is a demonstration message');\n</script>\ndynamic output:\n><script show>\n return (new Date()).toString();\n</script>\nwikified dynamic output:\n><script show>\n return "link to current user: [["+config.options.txtUserName+"]]";\n</script>\ndynamic output using 'place' to get size information for current tiddler:\n><script show>\n if (!window.story) window.story=window;\n var title=story.findContainingTiddler(place).id.substr(7);\n return title+" is using "+store.getTiddlerText(title).length+" bytes";\n</script>\ncreating an 'onclick' button/link that runs a script:\n><script label="click here" show>\n if (!window.story) window.story=window;\n alert("Hello World!\snlinktext='"+place.firstChild.data+"'\sntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");\n</script>\nloading a script from a source url:\n>http://www.TiddlyTools.com/demo.js contains:\n>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}\n>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}\n><script src="demo.js" show>\n return "loading demo.js..."\n</script>\n><script label="click to execute demo() function" show>\n demo()\n</script>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly\n''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output\n''2006.01.05 [1.4.0]'' added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.\n''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski\n''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by BradleyMeck\n''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax\n''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access \n''2005.11.08 [1.0.0]'' initial release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.inlineJavascript= {major: 1, minor: 5, revision: 1, date: new Date(2006,6,1)};\n\nconfig.formatters.push( {\n name: "inlineJavascript",\n match: "\s\s<script",\n lookahead: "\s\s<script(?: src=\s\s\s"((?:.|\s\sn)*?)\s\s\s")?(?: label=\s\s\s"((?:.|\s\sn)*?)\s\s\s")?( show)?\s\s>((?:.|\s\sn)*?)\s\s</script\s\s>",\n\n handler: function(w) {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg");\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source)\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {\n if (lookaheadMatch[1]) { // load a script library\n // make script tag, set src, add to body to execute, then remove for cleanup\n var script = document.createElement("script"); script.src = lookaheadMatch[1];\n document.body.appendChild(script); document.body.removeChild(script);\n }\n if (lookaheadMatch[4]) { // there is script code\n if (lookaheadMatch[3]) // show inline script code in tiddler output\n wikify("{{{\sn"+lookaheadMatch[0]+"\sn}}}\sn",w.output);\n if (lookaheadMatch[2]) { // create a link to an 'onclick' script\n // add a link, define click handler, save code in link (pass 'place'), set link attributes\n var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);\n link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}\n link.code="function _out(place){"+lookaheadMatch[4]+"};_out(this);"\n link.setAttribute("href","javascript:;"); link.setAttribute("title",""); link.style.cursor="pointer";\n }\n else { // run inline script code\n var code="function _out(place){"+lookaheadMatch[4]+"};_out(w.output);"\n code=code.replace(/document.write\s(/gi,'place.innerHTML+=(');\n try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }\n if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);\n }\n }\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n }\n }\n} )\n//}}}\n
<html>\n<div align="center">\n<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="350" height="400" codebase="http://java.sun.com/products/plugin/index.html">\n<PARAM name="java_code" value="org/igoweb/kgs/client/swing/KApplet.class">\n<PARAM name="java_codebase" value="http://goserver.gokgs.com/javaBin-3.3.17/">\n<PARAM name="java_archive" value="kgsApplet.jar">\n<PARAM name="type" value="application/x-java-applet;version=1.3">\n<PARAM name="r" value="-2138257200045225055">\n<COMMENT>\n<EMBED type="application/x-java-applet;version=1.3" width="350" height="400" pluginspage="http://java.sun.com/products/plugin/index.html" java_code="org/igoweb/kgs/client/swing/KApplet.class" java_codebase="http://goserver.gokgs.com/javaBin-3.3.17/" java_archive="kgsApplet.jar" r="-2138257200045225055">\n<NOEMBED>\nDésolé, mais vous avez besoin d'avoir le plugin java installé pour que l'applet fonctionne.\n</NOEMBED>\n</COMMENT>\n\n</OBJECT>\n</div>\n</html>\n\n
!!Download [[MPlayer|http://www.mplayerhq.hu]] for Elphel Cameras (Ubuntu 7.0.4 feisty):\nYou may need to install some packages from http://medibuntu.sos-sts.com/ or \nfrom the official universe and multiverse [[Ubuntu|http://www.ubuntu.net]] repositories\n!!!Optimized for: pentium4 mmx mmxext sse sse2 mtrr\nClick [[here|http://luxigo.ath.cx/elphel/mplayer/mplayer-elphel-pentium4_1.0~rc1-1_i386.deb]] to download: mplayer-elphel-pentium4_1.0~rc1-1_i386.deb\n\nconfigure options: \n--prefix=/usr/local --enable-gui --enable-largefiles --enable-menu --language=en,all --enable-dynamic-plugins\n!!!Generic, with runtime CPU detection :\nClick [[here|http://luxigo.ath.cx/elphel/mplayer/mplayer-elphel_1.0~rc1-1_i386.deb]] to download mplayer-elphel_1.0~rc1-1_i386.deb\n\nconfigure options:\n--prefix=/usr/local --enable-gui --enable-largefiles --enable-menu --language=en,all --enable-dynamic-plugins --enable-runtime-cpudetection\n!!!Enabled optional drivers:\n Input: ftp network pvr tv-v4l2 tv-v4l tv live555 cdda dvdread dvdnav vcd dvb smb\n Codecs: qtx x264 xvid libdv libavcodec real xanim win32 faad2 faac musepack libmpeg2 libdts liba52 mp3lib libtheora speex tremor(internal) twolame libmad liblzo gif\n Audio output: alsa openal jack esd arts oss nas sdl mpegpes(dvb)\n Video output: xvidix cvidix md5sum sdl gif89a pnm jpeg png mpegpes(dvb) svga caca aa ggi opengl dga xv x11 xover dfbmga directfb tga\n Audio filters: ladspa\n!!!Disabled optional drivers:\n Input: vstream radio mpdvdkit2\n Codecs: amr_wb amr_nb toolame\n Audio output: sun pulse ivtv dxr2\n Video output: winvidix bl zr zr2 ivtv dxr3 dxr2 vesa fbdev xmga mga xvmc tdfx_vid s3fb tdfxfb 3dfx\n Audio filters:\n\n\n
[[Elphel Cameras]]\nVirtualHostPlugin\n[[Kiseido Go Server]]\n[[Evolution’s Arrow]]\n[[Mindblind|The World Is Mindblind]]
Capture a frame every ~SLEEP_TIME seconds from URL and rename it ~PREFIX-nnnnnn.jpg:\n//{{{\n#!/bin/sh\n\nPREFIX=img\nSLEEP_TIME=1\nURL="http://192.168.0.90/admin-bin/ccam.cgi?opt=vhcxy-"\n\nnum=0\n\nwhile true ; do\n\n img=$PREFIX-`printf %06d $num`.jpg\n\n if [ -s $img ] ; then\n echo exists: $img\n else\n wget -q "$URL" -O $img && sleep $SLEEP_TIME && ln -sf $img $PREFIX.jpg\n echo $img\n fi\n\n num=`expr $num + 1`\n\ndone\n\n//}}}\n\nTo watch the frames while capturing them without disturbing the camera,\nput this html page in a file located in the same folder,\nreplace 'content="1"' with the number of seconds you want between updates,\nand open it with your browser:\n//{{{\n<html>\n <head>\n <meta http-equiv="refresh" content="1">\n </head>\n <body>\n <img src=img.jpg>\n </body>\n</html>\n\n//}}}\n\nCreate an ogg/theora movie using the JPEG files generated with the first script from this page:\n//{{{\n#!/bin/sh\n\nPREFIX=img\nFRAMERATE=30\nWIDTH=768\nHEIGHT=576\nQUALITY=63\nOUTFILE=out.ogg\n\nif [ -s "$OUTFILE" ] ; then\n echo file exists: $OUTFILE 1>&2\n exit 1\nfi\n\ntime gst-launch-0.10 \s\n multifilesrc \s\n location="$PREFIX-%06d.jpg" ! image/jpeg,framerate=$FRAMERATE/1 \s\n ! decodebin \s\n ! videoscale \s\n ! video/x-raw-yuv,width=$WIDTH,height=$HEIGHT \s\n ! progressreport \s\n name=progress \s\n ! theoraenc \s\n quality=$QUALITY \s\n ! oggmux \s\n ! filesink \s\n location="$OUTFILE"\n\n//}}}
/***\n|''Name:''|NestedSlidersPlugin|\n|''Source:''|http://www.TiddlyTools.com/#NestedSlidersPlugin|\n|''Author:''|Eric Shulman - ELS Design Studios|\n|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|\n|''~CoreVersion:''|2.0.10|\n\nQuickly make any tiddler content into an expandable 'slider' panel, without needing to create a separate tiddler to contain the slider content. Optional syntax allows ''default to open'', ''custom button label/tooltip'' and ''automatic blockquote formatting.''\n\nYou can also 'nest' these sliders as deep as you like (see complex nesting example below), so that expandable 'tree-like' hierarchical displays can be created. This is most useful when converting existing in-line text content to create in-line annotations, footnotes, context-sensitive help, or other subordinate information displays.\n\nFor more details, please click on a section headline below:\n++++!!!!![Configuration]>\nDebugging messages for 'lazy sliders' deferred rendering:\n<<option chkDebugLazySliderDefer>> show debugging alert when deferring slider rendering\n<<option chkDebugLazySliderRender>> show debugging alert when deferred slider is actually rendered\n===\n++++!!!!![Usage]>\nWhen installed, this plugin adds new wiki syntax for embedding 'slider' panels directly into tiddler content. Use {{{+++}}} and {{{===}}} to delimit the slider content. Additional optional syntax elements let you specify\n*default to open\n*cookiename\n*heading level\n*floater (with optional CSS width value)\n*mouse auto rollover\n*custom class/label/tooltip/accesskey\n*automatic blockquote\n*deferred rendering\nThe complete syntax, using all options, is:\n//{{{\n++++(cookiename)!!!!!^width^*{{class{[label=key|tooltip]}}}>...\ncontent goes here\n===\n//}}}\nwhere:\n* {{{+++}}} (or {{{++++}}}) and {{{===}}}^^\nmarks the start and end of the slider definition, respectively. When the extra {{{+}}} is used, the slider will be open when initially displayed.^^\n* {{{(cookiename)}}}^^\nsaves the slider opened/closed state, and restores this state whenever the slider is re-rendered.^^\n* {{{!}}} through {{{!!!!!}}}^^\ndisplays the slider label using a formatted headline (Hn) style instead of a button/link style^^\n* {{{^width^}}} (or just {{{^}}})^^\nmakes the slider 'float' on top of other content rather than shifting that content downward. 'width' must be a valid CSS value (e.g., "30em", "180px", "50%", etc.). If omitted, the default width is "auto" (i.e., fit to content)^^\n* {{{*}}}^^\nautomatically opens/closes slider on "rollover" as well as when clicked^^\n* {{{{{class{[label=key|tooltip]}}}}}}^^\nuses custom label/tooltip/accesskey. {{{{{class{...}}}}}}, {{{=key}}} and {{{|tooltip}}} are optional. 'class' is any valid CSS class name, used to style the slider label text. 'key' must be a ''single letter only''. Default labels/tootips are: ">" (more) and "<" (less), with no default access key assignment.^^\n* {{{">"}}} //(without the quotes)//^^\nautomatically adds blockquote formatting to slider content^^\n* {{{"..."}}} //(without the quotes)//^^\ndefers rendering of closed sliders until the first time they are opened. //Note: deferred rendering may produce unexpected results in some cases. Use with care.//^^\n\n//Note: to make slider definitions easier to read and recognize when editing a tiddler, newlines immediately following the {{{+++}}} 'start slider' or preceding the {{{===}}} 'end slider' sequence are automatically supressed so that excess whitespace is eliminated from the output.//\n===\n++++!!!!![Examples]>\nsimple in-line slider: \n{{{\n+++\n content\n===\n}}}\n+++\n content\n===\n----\nuse a custom label and tooltip: \n{{{\n+++[label|tooltip]\n content\n===\n}}}\n+++[label|tooltip]\n content\n===\n----\ncontent automatically blockquoted: \n{{{\n+++>\n content\n===\n}}}\n+++>\n content\n===\n----\nall options combined //(default open, cookie, heading, sized floater, rollover, class, label/tooltip/key, blockquoted, deferred)//\n{{{\n++++(testcookie)!!!^30em^*{{big{[label=Z|click or press Alt-Z to open]}}}>...\n content\n===\n}}}\n++++(testcookie)!!!^30em^*{{big{[label=Z|click or press Alt-Z to open]}}}>...\n content\n===\n----\ncomplex nesting example:\n{{{\n+++^[get info...=I|click for information or press Alt-I]\n put some general information here, plus a floating slider with more specific info:\n +++^10em^[view details...|click for details]\n put some detail here, which could include a rollover with a +++^25em^*[glossary definition]explaining technical terms===\n ===\n===\n}}}\n+++^[get info...=I|click for information or press Alt-I]\n put some general information here, plus a floating slider with more specific info:\n +++^10em^[view details...|click for details]\n put some detail here, which could include a rollover with a +++^25em^*[glossary definition]explaining technical terms===\n ===\n===\n===\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''NestedSlidersPlugin'' (tagged with <<tag systemConfig>>)\n<<<\n!!!!!Revision History\n<<<\n''2006.07.28 - 2.0.0'' added custom class syntax around label/tip/key syntax: {{{{{classname{[label=key|tip]}}}}}}\n''2006.07.25 - 1.9.3'' when parsing slider, save default open/closed state in button element, then in onClickNestedSlider(), if slider state matches saved default, instead of saving cookie, delete it. Significantly reduces the 'cookie overhead' when default slider states are used.\n''2006.06.29 - 1.9.2'' in onClickNestedSlider(), when setting focus to first control, skip over type="hidden"\n''2006.06.22 - 1.9.1'' added panel.defaultPanelWidth to save requested panel width, even after resizing has changed the style value\n''2006.05.11 - 1.9.0'' added optional '^width^' syntax for floating sliders and '=key' syntax for setting an access key on a slider label\n''2006.05.09 - 1.8.0'' in onClickNestedSlider(), when showing panel, set focus to first child input/textarea/select element\n''2006.04.24 - 1.7.8'' in adjustSliderPos(), if floating panel is contained inside another floating panel, subtract offset of containing panel to find correct position\n''2006.02.16 - 1.7.7'' corrected deferred rendering to account for use-case where show/hide state is tracked in a cookie\n''2006.02.15 - 1.7.6'' in adjustSliderPos(), ensure that floating panel is positioned completely within the browser window (i.e., does not go beyond the right edge of the browser window)\n''2006.02.04 - 1.7.5'' add 'var' to unintended global variable declarations to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2006.01.18 - 1.7.4'' only define adjustSliderPos() function if it has not already been provided by another plugin. This lets other plugins 'hijack' the function even when they are loaded first.\n''2006.01.16 - 1.7.3'' added adjustSliderPos(place,btn,panel,panelClass) function to permit specialized logic for placement of floating panels. While it provides improved placement for many uses of floating panels, it exhibits a relative offset positioning error when used within *nested* floating panels. Short-term workaround is to only adjust the position for 'top-level' floaters.\n''2006.01.16 - 1.7.2'' added button property to slider panel elements so that slider panel can tell which button it belongs to. Also, re-activated and corrected animation handling so that nested sliders aren't clipped by hijacking Slider.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends\n''2006.01.14 - 1.7.1'' added optional "^" syntax for floating panels. Defines new CSS class, ".floatingPanel", as an alternative for standard in-line ".sliderPanel" styles.\n''2006.01.14 - 1.7.0'' added optional "*" syntax for rollover handling to show/hide slider without requiring a click (Based on a suggestion by tw4efl)\n''2006.01.03 - 1.6.2'' When using optional "!" heading style, instead of creating a clickable "Hn" element, create an "A" element inside the "Hn" element. (allows click-through in SlideShowPlugin, which captures nearly all click events, except for hyperlinks)\n''2005.12.15 - 1.6.1'' added optional "..." syntax to invoke deferred ('lazy') rendering for initially hidden sliders\nremoved checkbox option for 'global' application of lazy sliders\n''2005.11.25 - 1.6.0'' added optional handling for 'lazy sliders' (deferred rendering for initially hidden sliders)\n''2005.11.21 - 1.5.1'' revised regular expressions: if present, a single newline //preceding// and/or //following// a slider definition will be suppressed so start/end syntax can be place on separate lines in the tiddler 'source' for improved readability. Similarly, any whitespace (newlines, tabs, spaces, etc.) trailing the 'start slider' syntax or preceding the 'end slider' syntax is also suppressed.\n''2005.11.20 - 1.5.0'' added (cookiename) syntax for optional tracking and restoring of slider open/close state\n''2005.11.11 - 1.4.0'' added !!!!! syntax to render slider label as a header (Hn) style instead of a button/link style\n''2005.11.07 - 1.3.0'' removed alternative syntax {{{(((}}} and {{{)))}}} (so they can be used by other\nformatting extensions) and simplified/improved regular expressions to trim multiple excess newlines\n''2005.11.05 - 1.2.1'' changed name to NestedSlidersPlugin\nmore documentation\n''2005.11.04 - 1.2.0'' added alternative character-mode syntax {{{(((}}} and {{{)))}}}\ntweaked "eat newlines" logic for line-mode {{{+++}}} and {{{===}}} syntax\n''2005.11.03 - 1.1.1'' fixed toggling of default tooltips ("more..." and "less...") when a non-default button label is used\ncode cleanup, added documentation\n''2005.11.03 - 1.1.0'' changed delimiter syntax from {{{(((}}} and {{{)))}}} to {{{+++}}} and {{{===}}}\nchanged name to EasySlidersPlugin\n''2005.11.03 - 1.0.0'' initial public release\n<<<\n!!!!!Credits\n<<<\nThis feature was implemented by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]] with initial research and suggestions from RodneyGomes, GeoffSlocock, and PaulPetterson.\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.nestedSliders = {major: 2, minor: 0, revision: 0, date: new Date(2006,7,28)};\n//}}}\n\n//{{{\n// options for deferred rendering of sliders that are not initially displayed\nif (config.options.chkDebugLazySliderDefer==undefined) config.options.chkDebugLazySliderDefer=false;\nif (config.options.chkDebugLazySliderRender==undefined) config.options.chkDebugLazySliderRender=false;\n\n// default styles for 'floating' class\nsetStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \s\n background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");\n//}}}\n\n//{{{\nconfig.formatters.push( {\n name: "nestedSliders",\n match: "\s\sn?\s\s+{3}",\n terminator: "\s\ss*\s\s={3}\s\sn?",\n lookahead: "\s\sn?\s\s+{3}(\s\s+)?(\s\s([^\s\s)]*\s\s))?(\s\s!*)?(\s\s^(?:[^\s\s^\s\s*\s\s[\s\s>]*\s\s^)?)?(\s\s*)?(?:\s\s{\s\s{([\s\sw]+[\s\ss\s\sw]*)\s\s{)?(\s\s[[^\s\s]]*\s\s])?(?:\s\s}{3})?(\s\s>)?(\s\s.\s\s.\s\s.)?\s\ss*",\n handler: function(w)\n {\n // defopen=lookaheadMatch[1]\n // cookiename=lookaheadMatch[2]\n // header=lookaheadMatch[3]\n // panelwidth=lookaheadMatch[4]\n // rollover=lookaheadMatch[5]\n // class=lookaheadMatch[6]\n // label=lookaheadMatch[7]\n // blockquote=lookaheadMatch[8]\n // deferred=lookaheadMatch[9]\n\n lookaheadRegExp = new RegExp(this.lookahead,"mg");\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source)\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart)\n {\n // location for rendering button and panel\n var place=w.output;\n\n // default to closed, no cookie, no accesskey\n var show="none"; var title=">"; var tooltip="show"; var cookie=""; var key="";\n\n // extra "+", default to open\n if (lookaheadMatch[1])\n { show="block"; title="<"; tooltip="hide"; }\n\n // cookie, use saved open/closed state\n if (lookaheadMatch[2]) {\n cookie=lookaheadMatch[2].trim().slice(1,-1);\n cookie="chkSlider"+cookie;\n if (config.options[cookie]==undefined)\n { config.options[cookie] = (show=="block") }\n if (config.options[cookie])\n { show="block"; title="<"; tooltip="hide"; }\n else\n { show="none"; title=">"; tooltip="show"; }\n }\n\n // parse custom label/tooltip/accesskey: [label=X|tooltip]\n if (lookaheadMatch[7]) {\n title = lookaheadMatch[7].trim().slice(1,-1);\n var pos=title.indexOf("|");\n if (pos!=-1) { tooltip = title.substr(pos+1,title.length); title=title.substr(0,pos); }\n if (title.substr(title.length-2,1)=="=") { key=title.substr(title.length-1,1); title=title.slice(0,-2); }\n if (pos==-1) tooltip += " "+title; // default tooltip: "show/hide <title>"\n }\n\n // create the button\n if (lookaheadMatch[3]) { // use "Hn" header format instead of button/link\n var lvl=(lookaheadMatch[3].length>6)?6:lookaheadMatch[3].length;\n var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,lookaheadMatch[6],title);\n btn.onclick=onClickNestedSlider;\n btn.setAttribute("href","javascript:;");\n btn.setAttribute("title",tooltip);\n }\n else\n var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,lookaheadMatch[6]);\n\n // set extra button attributes\n btn.sliderCookie = cookie; // save the cookiename (if any) in the button object\n btn.defOpen=lookaheadMatch[1]!=null; // save default open/closed state (boolean)\n btn.keyparam=key; // save the access key letter ("" if none)\n if (key.length) {\n btn.setAttribute("accessKey",key); // init access key\n btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus\n }\n\n // "non-click" MouseOver open/close slider\n if (lookaheadMatch[5]) btn.onmouseover=onClickNestedSlider;\n\n // create slider panel\n var panelClass=lookaheadMatch[4]?"floatingPanel":"sliderPanel";\n var panel=createTiddlyElement(place,"div",null,panelClass,null);\n panel.button = btn; // so the slider panel know which button it belongs to\n panel.defaultPanelWidth=(lookaheadMatch[4] && lookaheadMatch[4].length>2)?lookaheadMatch[4].slice(1,-1):""; // save requested panel size\n btn.sliderPanel=panel;\n panel.style.display = show;\n panel.style.width=panel.defaultPanelWidth;\n\n // render slider (or defer until shown) \n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n if ((show=="block")||!lookaheadMatch[9]) {\n // render now if panel is supposed to be shown or NOT deferred rendering\n w.subWikify(lookaheadMatch[8]?createTiddlyElement(panel,"blockquote"):panel,this.terminator);\n // align slider/floater position with button\n adjustSliderPos(place,btn,panel,panelClass);\n }\n else {\n var src = w.source.substr(w.nextMatch);\n var endpos=findMatchingDelimiter(src,"+++","===");\n panel.setAttribute("raw",src.substr(0,endpos));\n panel.setAttribute("blockquote",lookaheadMatch[8]?"true":"false");\n panel.setAttribute("rendered","false");\n w.nextMatch += endpos+3;\n if (w.source.substr(w.nextMatch,1)=="\sn") w.nextMatch++;\n if (config.options.chkDebugLazySliderDefer) alert("deferred '"+title+"':\sn\sn"+panel.getAttribute("raw"));\n }\n }\n }\n }\n)\n\n// TBD: ignore 'quoted' delimiters (e.g., "{{{+++foo===}}}" isn't really a slider)\nfunction findMatchingDelimiter(src,starttext,endtext) {\n var startpos = 0;\n var endpos = src.indexOf(endtext);\n // check for nested delimiters\n while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {\n // count number of nested 'starts'\n var startcount=0;\n var temp = src.substring(startpos,endpos-1);\n var pos=temp.indexOf(starttext);\n while (pos!=-1) { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }\n // set up to check for additional 'starts' after adjusting endpos\n startpos=endpos+endtext.length;\n // find endpos for corresponding number of matching 'ends'\n while (startcount && endpos!=-1) {\n endpos = src.indexOf(endtext,endpos+endtext.length);\n startcount--;\n }\n }\n return (endpos==-1)?src.length:endpos;\n}\n//}}}\n\n//{{{\nwindow.onClickNestedSlider=function(e)\n{\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var theLabel = theTarget.firstChild.data;\n var theSlider = theTarget.sliderPanel\n var isOpen = theSlider.style.display!="none";\n // if using default button labels, toggle labels\n if (theLabel==">") theTarget.firstChild.data = "<";\n else if (theLabel=="<") theTarget.firstChild.data = ">";\n // if using default tooltips, toggle tooltips\n if (theTarget.getAttribute("title")=="show")\n theTarget.setAttribute("title","hide");\n else if (theTarget.getAttribute("title")=="hide")\n theTarget.setAttribute("title","show");\n if (theTarget.getAttribute("title")=="show "+theLabel)\n theTarget.setAttribute("title","hide "+theLabel);\n else if (theTarget.getAttribute("title")=="hide "+theLabel)\n theTarget.setAttribute("title","show "+theLabel);\n // deferred rendering (if needed)\n if (theSlider.getAttribute("rendered")=="false") {\n if (config.options.chkDebugLazySliderRender)\n alert("rendering '"+theLabel+"':\sn\sn"+theSlider.getAttribute("raw"));\n var place=theSlider;\n if (theSlider.getAttribute("blockquote")=="true")\n place=createTiddlyElement(place,"blockquote");\n wikify(theSlider.getAttribute("raw"),place);\n theSlider.setAttribute("rendered","true");\n }\n // show/hide the slider\n if(config.options.chkAnimate)\n anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));\n else\n theSlider.style.display = isOpen ? "none" : "block";\n // reset to default width (might have been changed via plugin code)\n theSlider.style.width=theSlider.defaultPanelWidth;\n // align slider/floater position with target button\n if (!isOpen) adjustSliderPos(theSlider.parentNode,theTarget,theSlider,theSlider.className);\n // if showing panel, set focus to first 'focus-able' element in panel\n if (theSlider.style.display!="none") {\n var ctrls=theSlider.getElementsByTagName("*");\n for (var c=0; c<ctrls.length; c++) {\n var t=ctrls[c].tagName.toLowerCase();\n if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")\n { ctrls[c].focus(); break; }\n }\n }\n if (this.sliderCookie && this.sliderCookie.length) {\n config.options[this.sliderCookie]=!isOpen;\n if (config.options[this.sliderCookie]!=this.defOpen)\n saveOptionCookie(this.sliderCookie);\n else { // remove cookie if slider is in default display state\n var ex=new Date(); ex.setTime(ex.getTime()-1000);\n document.cookie = this.sliderCookie+"=novalue; path=/; expires="+ex.toGMTString();\n }\n }\n return false;\n}\n\n// hijack animation handler 'stop' handler so overflow is visible after animation has completed\nSlider.prototype.coreStop = Slider.prototype.stop;\nSlider.prototype.stop = function() { this.coreStop(); this.element.style.overflow = "visible"; }\n\n// adjust panel position based on button position\nif (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel,panelClass) {\n if (panelClass=="floatingPanel") {\n var left=0;\n var top=btn.offsetHeight; \n if (place.style.position!="relative") {\n var left=findPosX(btn);\n var top=findPosY(btn)+btn.offsetHeight;\n var p=place; while (p && p.className!='floatingPanel') p=p.parentNode;\n if (p) { left-=findPosX(p); top-=findPosY(p); }\n }\n if (left+panel.offsetWidth > getWindowWidth()) left=getWindowWidth()-panel.offsetWidth-10;\n panel.style.left=left+"px"; panel.style.top=top+"px";\n }\n}\n\nfunction getWindowWidth() {\n if(document.width!=undefined)\n return document.width; // moz (FF)\n if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )\n return document.documentElement.clientWidth; // IE6\n if(document.body && ( document.body.clientWidth || document.body.clientHeight ) )\n return document.body.clientWidth; // IE4\n if(window.innerWidth!=undefined)\n return window.innerWidth; // IE - general\n return 0; // unknown\n}\n//}}}
/***\n|Name|NewHereCommand|\n|Source|http://simonbaird.com/mptw/#NewHereCommand|\n|Version|1.0|\n\nCode originally by ArphenLin. Small tweak by SimonBaird\nhttp://aiddlywiki.sourceforge.net/NewHere_demo.html#NewHereCommand\nTo use this you must edit your ViewTemplate and add newHere to the toolbar div, eg\n{{{<div class='toolbar' macro='toolbar ... newHere'></div>}}}\n***/\n//{{{\n\nconfig.commands.newHere = {\n text: 'new here',\n tooltip: 'Create a new tiddler tagged as this tiddler',\n handler: function(e,src,title) {\n if (!readOnly) {\n clearMessage();\n var t=document.getElementById('tiddler'+title);\n story.displayTiddler(t,config.macros.newTiddler.title,DEFAULT_EDIT_TEMPLATE);\n story.setTiddlerTag(config.macros.newTiddler.title, title, 0);\n story.focusTiddler(config.macros.newTiddler.title,"title");\n return false;\n }\n }\n};\n\nconfig.commands.newJournalHere = {\n //text: 'new journal here', // too long\n text: 'new journal',\n dataFormat: 'YYYY-0MM-0DD 0hh:0mm', // adjust to your preference\n tooltip: 'Create a new journal tiddler tagged as this tiddler',\n handler: function(e,src,title) {\n if (!readOnly) {\n clearMessage();\n var now = new Date();\n var t=document.getElementById('tiddler'+title);\n var newtitle = now.formatString(this.dataFormat)\n story.displayTiddler(t,newtitle,DEFAULT_EDIT_TEMPLATE);\n story.setTiddlerTag(newtitle, title, 0);\n story.focusTiddler(newtitle,"title");\n return false;\n }\n }\n};\n\n\n//}}}
<div id="siteHeader" class='header' macro='gradient vert #70f #000'>\n<div class='headerShadow'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n<div class='headerForeground'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n<div id='topMenu' refresh='content' tiddler='MainMenu'></div>\n</div>\n<div id='sidebar'>\n<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>\n<div id='displayArea'>\n<div id='messageArea'></div>\n<div id='tiddlerDisplay'></div>\n</div>
/***\n| Name:|QuickOpenTagPlugin|\n| Purpose:|Makes tag links into a Taggly style open tag plus a normal style drop down menu|\n| Creator:|SimonBaird|\n| Source:|http://simonbaird.com/mptw/#QuickOpenTagPlugin|\n| Requires:|TW 2.x|\n| Version|1.1.1 (19-May-06)|\n\n!History\n* Version 1.1.1 (19/05/2006)\n** Added a little more CSS so the tags look good in standard main menus and normal tiddlers\n* Version 1.1 (07/02/2006)\n** Fix Firefox 1.5.0.1 crashes\n** Updated by ~BidiX[at]~BidiX.info\n* Version 1.0 (?/01/2006)\n** First release\n\n***/\n//{{{\n\n//⊻ ⊽ ⋁ ▼ \n\nwindow.createTagButton_orig_mptw = createTagButton;\nwindow.createTagButton = function(place,tag,excludeTiddler) {\n var sp = createTiddlyElement(place,"span",null,"quickopentag");\n createTiddlyLink(sp,tag,true,"button");\n var theTag = createTiddlyButton(sp,config.macros.miniTag.dropdownchar,config.views.wikified.tag.tooltip.format([tag]),onClickTag);\n theTag.setAttribute("tag",tag);\n if(excludeTiddler)\n theTag.setAttribute("tiddler",excludeTiddler);\n return(theTag);\n};\n\nconfig.macros.miniTag = {handler:function(place,macroName,params,wikifier,paramString,tiddler) {\n var tagged = store.getTaggedTiddlers(tiddler.title);\n if (tagged.length > 0) {\n var theTag = createTiddlyButton(place,config.macros.miniTag.dropdownchar,config.views.wikified.tag.tooltip.format([tiddler.title]),onClickTag);\n theTag.setAttribute("tag",tiddler.title);\n theTag.className = "miniTag";\n }\n}};\n\nconfig.macros.miniTag.dropdownchar = (document.all?"▼":"▾"); // the fat one is the only one that works in IE\n\nconfig.macros.allTags.handler = function(place,macroName,params)\n{\n var tags = store.getTags();\n var theDateList = createTiddlyElement(place,"ul",null,null,null);\n if(tags.length === 0)\n createTiddlyElement(theDateList,"li",null,"listTitle",this.noTags);\n for (var t=0; t<tags.length; t++)\n {\n var theListItem =createTiddlyElement(theDateList,"li",null,null,null);\n var theLink = createTiddlyLink(theListItem,tags[t][0],true);\n var theCount = " (" + tags[t][1] + ")";\n theLink.appendChild(document.createTextNode(theCount));\n\n var theDropDownBtn = createTiddlyButton(theListItem," "+config.macros.miniTag.dropdownchar,this.tooltip.format([tags[t][0]]),onClickTag);\n theDropDownBtn.setAttribute("tag",tags[t][0]);\n }\n};\n\n\n// probably could redo these styles a bit cleaner..\nsetStylesheet(\n ".tagglyTagged .quickopentag, .tagged .quickopentag \sn"+\n " { margin-right:1.2em; border:1px solid #eee; padding:2px; padding-right:0px; padding-left:1px; }\sn"+\n ".quickopentag .tiddlyLink { padding:2px; padding-left:3px; }\sn"+\n ".quickopentag a.button { padding:1px; padding-left:2px; padding-right:2px;}\sn"+\n// extra specificity to make it work?\n "#displayArea .viewer .quickopentag a.button, \sn"+\n "#displayArea .viewer .quickopentag a.tiddyLink, \sn"+\n "#mainMenu .quickopentag a.tiddyLink, \sn"+\n "#mainMenu .quickopentag a.tiddyLink \sn"+\n " { border:0px solid black; }\sn"+\n "#displayArea .viewer .quickopentag a.button, \sn"+\n "#mainMenu .quickopentag a.button \sn"+\n "{ margin-left:0px; padding-left:2px; }\sn"+\n "#displayArea .viewer .quickopentag a.tiddlyLink, \sn"+\n "#mainMenu .quickopentag a.tiddlyLink \sn"+\n " { margin-right:0px; padding-right:0px; padding-left:0px; margin-left:0px; }\sn"+\n "a.miniTag {font-size:150%;} \sn"+\n "#mainMenu .quickopentag a.button \sn"+\n "{ margin-left:0px; padding-left:2px; margin-right:0px; padding-right:0px; }\sn"+ // looks better in right justified main menus\n "",\n"QuickOpenTagStyles");\n\n//}}}\n\n/***\n<html>&#x22bb; &#x22bd; &#x22c1; &#x25bc; &#x25be;</html>\n***/\n
//{{{\nif (!story.refreshVisible())\n story.refreshVisible = function() {\n this.forEachTiddler(function(title,element) {\n if (element.getAttribute("dirty") != "true") \n story.refreshTiddler(title,false,true);\n });\n }\n}\n//}}}
/***\n| Name:|RenameTagsPlugin|\n| Purpose:|Allows you to easily rename tags|\n| Creator:|SimonBaird|\n| Source:|http://simonbaird.com/mptw/#RenameTagsPlugin|\n| Version:|1.0.1 (5-Mar-06)|\n\n!Description\nIf you rename a tiddler/tag that is tagging other tiddlers this plugin will ask you if you want to rename the tag in each tiddler where it is used. This is essential if you use tags and ever want to rename them. To use it, open the tag you want to rename as a tiddler (it's the last option in the tag popup menu), edit it, rename it and click done. You will asked if you want to rename the tag. Click OK to rename the tag in the tiddlers that use it. Click Cancel to not rename the tag.\n\n!Example\nTry renaming [[Plugins]] or [[CSS]] on this site.\n\n!History\n* 1.0.1 (5-Mar-06) - Added feature to allow renaming of tags without side-effect of creating a tiddler\n* 1.0.0 (5-Mar-06) - First working version\n\n!Code\n***/\n//{{{\n\nversion.extensions.RenameTagsPlugin = {\n major: 1, minor: 0, revision: 0,\n date: new Date(2006,3,5),\n source: "http://simonbaird.com/mptw/#RenameTagsPlugin"\n};\n\nconfig.macros.RenameTagsPlugin = {};\nconfig.macros.RenameTagsPlugin.prompt = "Rename the tag '%0' to '%1' in %2 tidder%3?";\n\n// these are very useful, perhaps they should be in the core\nif (!store.addTag) {\n store.addTag = function(title,tag) {\n var t=this.getTiddler(title); if (!t || !t.tags) return;\n t.tags.push(tag);\n };\n};\n\nif (!store.removeTag) {\n store.removeTag = function(title,tag) {\n var t=this.getTiddler(title); if (!t || !t.tags) return;\n if (t.tags.find(tag)!=null) t.tags.splice(t.tags.find(tag),1);\n };\n};\n\nstore.saveTiddler_orig_tagrename = store.saveTiddler;\nstore.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags) {\n if (title != newTitle && this.getTaggedTiddlers(title).length > 0) {\n // then we are renaming a tag\n var tagged = this.getTaggedTiddlers(title);\n if (confirm(config.macros.RenameTagsPlugin.prompt.format([title,newTitle,tagged.length,tagged.length>1?"s":""]))) {\n for (var i=0;i<tagged.length;i++) {\n store.removeTag(tagged[i].title,title);\n store.addTag(tagged[i].title,newTitle);\n // if tiddler is visible refresh it to show updated tag\n story.refreshTiddler(tagged[i].title,false,true);\n }\n }\n if (!this.tiddlerExists(title) && newBody == "") {\n // dont create unwanted tiddler\n return null;\n }\n }\n return this.saveTiddler_orig_tagrename(title,newTitle,newBody,modifier,modified,tags);\n}\n\n//}}}\n\n
<script label="show sidebar">\n if (!config.options.txtDisplayAreaRightMargin||!config.options.txtDisplayAreaRightMargin.length)\n config.options.txtDisplayAreaRightMargin="17em";\n var show=1;\n document.getElementById('sidebar').style.display=show?"block":"none";\n document.getElementById('displayArea').style.marginRight=show?config.options.txtDisplayAreaRightMargin:"1em";\n</script>
{{smallform{<script>\n // track date/time of last file save\n if (config.options.lastSaved==undefined)\n config.options.lastSaved=new Date(document.lastModified);\n\n // hijack store.setDirty() function (force display update after saving the file)\n if (TiddlyWiki.prototype.showUnsavedHijack_setDirty==undefined) {\n TiddlyWiki.prototype.showUnsavedHijack_setDirty=TiddlyWiki.prototype.setDirty;\n TiddlyWiki.prototype.setDirty = function(flag) {\n var refresh=this.isDirty() && !flag; // 'dirty' to 'clean', force a refresh...\n this.showUnsavedHijack_setDirty(flag); // but change the flag first.\n if (refresh) {\n config.options.lastSaved=new Date(); // remember save time\n refreshDisplay(); // finally, update the display\n }\n }\n }\n\n // get the unsaved tiddlers sorted by date - INCLUDE ALL TIDDLERS (even hidden ones!!)\n var tiddlers=store.getTiddlers("modified");\n // If no tiddlers have changed, DO NOTHING.\n if (tiddlers[tiddlers.length-1].modified<=config.options.lastSaved) return;\n var count=0; var list="";\n var item='<option value="%0">%1 - %0</option>';\n for (var i=tiddlers.length-1; i>=0; i--) {\n if (tiddlers[i].modified<=config.options.lastSaved) break;\n list+=item.format([tiddlers[i].title,\n tiddlers[i].modified.formatString('YYYY.0MM.0DD 0hh:0mm:0ss')]);\n count++;\n }\n // display the dropdown list wrapped in a slider\n var out='';\n var label='There %0 %1 unsaved tiddler%2...'.format([count==1?'is':'are',count,count==1?'':'s'])\n out+='+++(unsaved)['+label+'|show/hide a list of changed tiddlers]...';\n out+='<html><form style="display:inline">';\n out+='<select size="1" name="list" title="select a tiddler to view" ';\n out+=' onchange="var v=this.value; if (!v.length) return;';\n out+=' story.displayTiddler(null,v);';\n out+=' window.scrollTo(0,ensureVisible(document.getElementById(story.idPrefix+v)));">';\n out+=list;\n out+='</select>';\n out+='<input type="button" value="goto"';\n out+=' onclick="var v=this.form.list.value; if (!v.length) return; story.displayTiddler(null,v);';\n out+=' var t=document.getElementById(story.idPrefix+v); if (t) window.scrollTo(0,ensureVisible(t));">';\n out+='<input type="button" value="revert" title="import the last saved version of this tiddler"';\n out+=' onclick="var v=this.form.list.value; if (!v.length) return;';\n out+=' var t=\s'<\s'+\s'<loadTiddlers [[tiddler:\s'+v+\s']] \s'+document.location.href+\s' confirm force>\s'+\s'>\s';';\n out+=' var e=document.getElementById(\s'executeRevert\s'); if (e) e.parentNode.removeChild(e);';\n out+=' e=document.createElement(\s'span\s'); e.id=\s'executeRevert\s'; wikify(t,e);">';\n out+='</form></html>';\n out+='<'+'script>place.lastChild.style.fontWeight="normal"</'+'script>';\n out+='===';\n return out;\n</script>}}}
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal 'DD MMM YYYY'>><<importTiddlers>><<saveChanges>><<upload http://luxigo.tiddlyspot.com/store.cgi index.html . . luxigo>><html><a href='http://tiddlyspot.com/download/luxigo' class='button'>download</a></html><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>
/***\n''Single Page Mode Plugin for TiddlyWiki version 2.0 or above''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SinglePageModePlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nNormally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.\n\n!!!!!Usage\n<<<\nSinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. When SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.\n\nEven when SinglePageMode is disabled (i.e., displaying multiple tiddlers is permitted), you can reduce the potential for confusion by enable TopOfPageMode, which forces tiddlers to always open at the top of the page instead of being displayed following the tiddler containing the link that was clicked.\n<<<\n!!!!!Configuration\n<<<\nWhen installed, this plugin automatically adds checkboxes in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. For convenience, these checkboxes are also included here:\n\n<<option chkSinglePageMode>> Display one tiddler at a time\n<<option chkTopOfPageMode>> Always open tiddlers at the top of the page\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SinglePageMode handling^^\n\nWhen installed, this plugin automatically adds checkboxes in the ''shadow'' AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to ''manually add these checkboxes to your customized tiddler.''\n<<<\n!!!!!Revision History\n<<<\n''2006.07.04 [2.2.1]'' in hijack for displayTiddlers(), suspend TPM as well as SPM so that DefaultTiddlers displays in the correct order.\n''2006.06.01 [2.2.0]'' added chkTopOfPageMode (TPM) handling\n''2006.02.04 [2.1.1]'' moved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2005.12.27 [2.1.0]'' hijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list). Also, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers\n''2005.12.27 [2.0.0]'' Update for TW2.0\n''2005.11.24 [1.1.2]'' When the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts\n''2005.10.14 [1.1.1]'' permalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them\n''2005.10.14 [1.1.0]'' added automatic setting of window title and location bar ('auto-permalink'). feature suggestion by David Dickens.\n''2005.10.09 [1.0.1]'' combined documentation and code in a single tiddler\n''2005.08.15 [1.0.0]'' Initial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nSupport for BACK/FORWARD buttons adapted from code developed by Clint Checketts\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.SinglePageMode= {major: 2, minor: 2, revision: 1, date: new Date(2006,7,3)};\n\nif (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSinglePageMode>> Display one tiddler at a time";\n\nif (config.options.chkTopOfPageMode==undefined) config.options.chkTopOfPageMode=false;\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkTopOfPageMode>> Always open tiddlers at the top of the page";\n\nconfig.SPMTimer = 0;\nconfig.lastURL = window.location.hash;\nfunction checkLastURL()\n{\n if (!config.options.chkSinglePageMode)\n { window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }\n if (config.lastURL == window.location.hash)\n return;\n var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));\n tiddlerName=tiddlerName.replace(/\s[\s[/,"").replace(/\s]\s]/,""); // strip any [[ ]] bracketing\n if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);\n}\n\nif (Story.prototype.SPM_coreDisplayTiddler==undefined) Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n if (config.options.chkSinglePageMode) {\n window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));\n config.lastURL = window.location.hash;\n document.title = wikifyPlain("SiteTitle") + " - " + title;\n story.closeAllTiddlers();\n if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);\n }\n if (config.options.chkTopOfPageMode) { story.closeTiddler(title); window.scrollTo(0,0); srcElement=null; }\n this.SPM_coreDisplayTiddler(srcElement,title,template,animate,slowly)\n}\n\nif (Story.prototype.SPM_coreDisplayTiddlers==undefined) Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;\nStory.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)\n{\n // suspend single-page mode when displaying multiple tiddlers\n var saveSPM=config.options.chkSinglePageMode; config.options.chkSinglePageMode=false;\n var saveTPM=config.options.chkTopOfPageMode; config.options.chkTopOfPageMode=false;\n this.SPM_coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);\n config.options.chkSinglePageMode=saveSPM; config.options.chkTopOfPageMode=saveTPM;\n}\n//}}}
/***\nImportant stuff. See TagglyTaggingStyles and HorizontalMainMenuStyles\n***/\n/*{{{*/\n[[HorizontalMainMenuStyles]]\n/*}}}*/\n/*{{{*/\nbody {\nbackground: #000;\n}\n/*}}}*/\n/***\n!Link styles /% ============================================================= %/\n***/\n/*{{{*/\na,\na.button,\n#mainMenu a.button,\n#sidebarOptions .sliderPanel a{\n color: #ffbf00;\n border: 0;\n}\n\na:hover,\na.button:hover,\n#mainMenu a.button:hover,\n#sidebarOptions .sliderPanel a:hover\n#sidebarOptions .sliderPanel a:active{\n color: #ff7f00;\n border: 0;\n border-bottom: #ff7f00 1px dashed;\n background: transparent;\n text-decoration: none;\n}\n\n#displayArea .button.highlight{\n color: #ffbf00;\n background: #4c4c4c;\n}\n/*}}}*/\n/***\n!Header styles /% ============================================================= %/\n***/\n/*{{{*/\n.header{\n border-bottom: 2px solid #ffbf00;\n color: #fff;\n}\n\n.headerForeground a {\n color: #fff;\n}\n\n.header a:hover {\n border-bottom: 1px dashed #fff;\n}\n/*}}}*/\n/***\n!Main menu styles /% ============================================================= %/\n***/\n/*{{{*/\n#mainMenu {color: #fff;}\n#mainMenu h1{\n font-size: 1.1em;\n}\n#mainMenu li,#mainMenu ul{\n list-style: none;\n margin: 0;\n padding: 0;\n}\n/*}}}*/\n/***\n!Sidebar styles /% ============================================================= %/\n***/\n/*{{{*/\n#sidebar {\n right: 0;\n color: #fff;\n border: 2px solid #ffbf00;\n border-width: 0 0 2px 2px;\n}\n#sidebarOptions {\n background-color: #4c4c4c;\n padding: 0;\n}\n\n#sidebarOptions a{\n margin: 0;\n color: #ffbf00;\n border: 0;\n}\n#sidebarOptions a:hover {\n color: #4c4c4c;\n background-color: #ffbf00;\n\n}\n\n#sidebarOptions a:active {\n color: #ffbf00;\n background-color: transparent;\n}\n\n#sidebarOptions .sliderPanel {\n background-color: #333;\n margin: 0;\n}\n\n#sidebarTabs {background-color: #4c4c4c;}\n#sidebarTabs .tabSelected {\n padding: 3px 3px;\n cursor: default;\n color: #ffbf00;\n background-color: #666;\n}\n#sidebarTabs .tabUnselected {\n color: #ffbf00;\n background-color: #5f5f5f;\n padding: 0 4px;\n}\n\n#sidebarTabs .tabUnselected:hover,\n#sidebarTabs .tabContents {\n background-color: #666;\n}\n\n.listTitle{color: #FFF;}\n#sidebarTabs .tabContents a{\n color: #ffbf00;\n}\n\n#sidebarTabs .tabContents a:hover{\n color: #ff7f00;\n background: transparent;\n}\n\n#sidebarTabs .txtMoreTab .tabSelected,\n#sidebarTabs .txtMoreTab .tab:hover,\n#sidebarTabs .txtMoreTab .tabContents{\n color: #ffbf00;\n background: #4c4c4c;\n}\n\n#sidebarTabs .txtMoreTab .tabUnselected {\n color: #ffbf00;\n background: #5f5f5f;\n}\n\n.tab.tabSelected, .tab.tabSelected:hover{color: #ffbf00; border: 0; background-color: #4c4c4c;cursor:default;}\n.tab.tabUnselected {background-color: #666;}\n.tab.tabUnselected:hover{color:#ffbf00; border: 0;background-color: #4c4c4c;}\n.tabContents {\n background-color: #4c4c4c;\n border: 0;\n}\n.tabContents .tabContents{background: #666;}\n.tabContents .tabSelected{background: #666;}\n.tabContents .tabUnselected{background: #5f5f5f;}\n.tabContents .tab:hover{background: #666;}\n/*}}}*/\n/***\n!Message area styles /% ============================================================= %/\n***/\n/*{{{*/\n#messageArea {background-color: #666; color: #fff; border: 2px solid #ffbf00;}\n#messageArea a:link, #messageArea a:visited {color: #ffbf00; text-decoration:none;}\n#messageArea a:hover {color: #ff7f00;}\n#messageArea a:active {color: #ff7f00;}\n#messageArea .messageToolbar a{\n border: 1px solid #ffbf00;\n background: #4c4c4c;\n}\n/*}}}*/\n/***\n!Popup styles /% ============================================================= %/\n***/\n/*{{{*/\n#popup {color: #fff; background-color: #4c4c4c; border: 1px solid #ffbf00;}\n#popup a {color: #ffbf00; }\n#popup a:hover { background: transparent; color: #ff7f00; border: 0;}\n#popup hr {color: #ffbf00; background: #ffbf00;}\n/*}}}*/\n/***\n!Tiddler Display styles /% ============================================================= %/\n***/\n/*{{{*/\n.title{color: #fff;}\nh1, h2, h3, h4, h5 {\n color: #fff;\n background-color: transparent;\n border-bottom: 1px solid #333;\n}\n\n.subtitle{\n color: #666;\n}\n\n.viewer {color: #fff; }\n\n.viewer table{background: #666; color: #fff;}\n\n.viewer th {background-color: #996; color: #fff;}\n\n.viewer pre, .viewer code {color: #ddd; background-color: #4c4c4c; border: 1px solid #ffbf00;}\n\n.viewer hr {color: #666;}\n\n.tiddler .button {color: #4c4c4c;}\n.tiddler .button:hover { color: #ffbf00; background-color: #4c4c4c;}\n.tiddler .button:active {color: #ffbf00; background-color: #4c4c4c;}\n\n.toolbar {\n color: #4c4c4c;\n}\n\n.toolbar a.button,\n.editorFooter a{\n border: 0;\n}\n\n.footer {\n color: #ddd;\n}\n\n.selectedTiddler .footer {\n color: #888;\n}\n\n.highlight, .marked {\n color: #000;\n background-color: #ffe72f;\n}\n.editorFooter {\n color: #aaa;\n}\n\n.tab{\n-moz-border-radius-topleft: 3px;\n-moz-border-radius-topright: 3px;\n}\n\n.tagging,\n.tagged{\n background: #4c4c4c;\n border: 1px solid #4c4c4c; \n}\n\n.selected .tagging,\n.selected .tagged{\n background: #000;\n border: 1px solid #ffbf00;\n}\n\n.tagging .listTitle,\n.tagged .listTitle{\n color: #fff;\n}\n\n.tagging .button,\n.tagged .button{\n color: #ffbf00;\n border: 0;\n padding: 0;\n}\n\n.tagging .button:hover,\n.tagged .button:hover{\nbackground: transparent;\n}\n\n.cascade {\n background: #4c4c4c;\n color: #ddd;\n border: 1px solid #ffbf00;\n}\n/*}}}*/
/***\nTagUtils\nhttp://simonbaird.com/mptw/#TagUtils\nDoesn't do anything except provide functions for use in other plugins\nSorry no documentation! RTFC :)\n\n!Update\nAdded some macros. See Examples.\n\n!Todo\nSorting is next\n\n!Example\nNote: you must have spaces between every element including brackets and logical operators\n{{{<<listByTagExpr '( Todo || Tasks ) && ! Done'>>}}}\n<<listByTagExpr '( Todo || Tasks ) && ! Done'>>\n\n{{{<<listByTagExprWithExcerpt '( Todo || Tasks ) && Urgent && ! Done'>>}}}\n<<listByTagExprWithExcerpt '( Todo || Tasks ) && Urgent && ! Done'>>\n\n***/\n//{{{\n\n// Array methods originally written by Udo\n\nif (!Array.prototype.indexOf)\n Array.prototype.indexOf = function(item) {\n for (var i=0;i<this.length;i++)\n if (this[i] == item)\n return i;\n return -1;\n };\n\nif (!Array.prototype.contains)\n Array.prototype.contains = function(item) {\n return (this.indexOf(item) >= 0);\n };\n\nif (!Array.prototype.containsAny)\n Array.prototype.containsAny = function(items) {\n for (var i=0;i<items.length;i++)\n if (this.contains(items[i]))\n return true;\n return false;\n };\n\nif (!Array.prototype.containsAll)\n Array.prototype.containsAll = function(items) {\n for (var i = 0; i < items.length; i++)\n if (!this.contains(items[i]))\n return false;\n return true;\n };\n\n\nvar allowBracketedList = function(tags) {\n return (typeof(tags) == "string") ? tags.readBracketedList() : tags;\n}\n\nvar getTitles = function(tiddlers) {\n var titles = [];\n for (var i=0;i<tiddlers.length;i++)\n titles[i] = tiddlers[i].title;\n return titles;\n}\n\nTiddler.prototype.hasTag = function(tag) {\n return this.tags.contains(tag)\n}\n\nTiddler.prototype.hasAnyTag = function(tags) {\n return this.tags.containsAny(allowBracketedList(tags));\n}\n\nTiddler.prototype.hasAllTags = function(tags) {\n return this.tags.containsAll(allowBracketedList(tags));\n}\n\nTiddler.prototype.addTag = function(tag) {\n if (!this.hasTag(tag))\n this.tags.push(tag);\n}\n\nTiddler.prototype.addTags = function(tags) {\n var newTags = allowBracketedList(tags);\n for (var i=0;i<newTags.length;i++)\n this.addTag(newTags[i]);\n}\n\nTiddler.prototype.removeTag = function(tag) {\n if (this.hasTag(tag))\n this.tags.splice(this.tags.indexOf(tag),1);\n}\n\nTiddler.prototype.removeTags = function(tags) {\n var deadTags = allowBracketedList(tags);\n for (var i=0;i<deadTags.length;i++)\n this.removeTag(deadTags[i]);\n}\n\nTiddler.prototype.removeTagsFromGroup = function(tagGroup) {\n // the tags are tagged with tagGroup, taggly style\n var tagsInGroup = getTitles(store.getTaggedTiddlers(tagGroup));\n for (var i=0;i<tagsInGroup.length;i++)\n this.removeTag(tagsInGroup[i]);\n}\n\nTiddler.prototype.setUniqueTagFromGroup = function(tag,tagGroup) {\n // used for a single value dropdown\n this.removeTagsFromGroup(tagGroup);\n this.addTag(tag);\n}\n\nTiddler.prototype.setUniqueTagFromList = function(tag,tagList) {\n // will probably never use this since I like setUniqueTagFromGroup\n this.removeTags(tagList);\n this.addTag(tag);\n}\n\nTiddlyWiki.prototype.getTiddlersByTag = function(includeTags,excludeTags,includeMode,excludeMode) {\n includeTags = allowBracketedList(includeTags);\n excludeTags = allowBracketedList(excludeTags);\n if (!includeMode) includeMode = 'all';\n if (!excludeMode) excludeMode = 'any';\n var results = [];\n this.forEachTiddler(function(title,tiddler) {\n var included = (includeMode == 'any') ?\n tiddler.hasAnyTag(includeTags) :\n tiddler.hasAllTags(includeTags);\n var excluded = (excludeMode == 'any') ?\n tiddler.hasAnyTag(excludeTags):\n tiddler.hasAllTags(excludeTags);\n if (included && !excluded)\n results.push(tiddler);\n });\n return results;\n}\n\nTiddlyWiki.prototype.getTiddlersByTagExpression = function(expression) {\n // example expression\n // "( [[A Tag]] || Tag2 ) && ! Tag3"\n // must have spaces between everything\n var splitExpression = expression.readBracketedList(false); // false means not unique. thanks Jeremy!!\n var asIs = ['(',')','||','&&','!']; // better not have any tags called those!\n var translatedExpression = "";\n for (var i=0;i<splitExpression.length;i++)\n if (asIs.contains(splitExpression[i]))\n translatedExpression += splitExpression[i];\n else\n translatedExpression += "tiddler.hasTag('"+splitExpression[i]+"')";\n // alert(translatedExpression);\n var results = [];\n this.forEachTiddler(function(title,tiddler) {\n if (eval('('+translatedExpression+')'))\n results.push(tiddler);\n });\n return results;\n}\n\nArray.prototype.tiddlerList = function(listFormat) {\n var output = "";\n if (!listFormat) listFormat = "'*[['+tiddler.title+']]\s\sn'";\n if (this.length > 0 && this[0] instanceof Tiddler) {\n for (var i=0;i<this.length;i++) {\n var tiddler = this[i];\n output += eval(listFormat);\n }\n }\n return output;\n}\n \nArray.prototype.tiddlerListWithExcerpt = function(listFormat) {\n return this.tiddlerList("'*[['+tiddler.title+']] tiddler.text.trim().substr(20)...\s\sn'");\n}\n\nString.prototype.prettyTrim = function(len,prefix,postfix) {\n var result = this.trim().replace(/\sr\sn/g,' ').replace(/[\sn|\st]/g,' ');\n if (result.length > len - 3)\n return result.trim().substr(0,len) + '...';\n else\n return result;\n}\n\nString.prototype.prettyTrim2 = function(len,prefix,postfix) {\n if (!prefix) prefix = '';\n if (!postfix) postfix = '';\n return prefix + this.prettyTrim(len) + postfix;\n}\n\n \nArray.prototype.tiddlerListWithExcerpt = function(listFormat) {\n return this.tiddlerList("'*[['+tiddler.title+']] ' + tiddler.text.prettyTrim2(60,' - ') + '\s\sn'");\n}\n\nconfig.macros.listByTag = {};\nconfig.macros.listByTag.handler =\n function(place,macroName,params,wikifier,paramString,tiddler) {\n wikify(store.getTiddlersByTag(params[0],params[1],params[2],params[3]).tiddlerList(),place,null,tiddler);\n};\n\nconfig.macros.listByTagWithExcerpt = {};\nconfig.macros.listByTagWithExcerpt.handler =\n function(place,macroName,params,wikifier,paramString,tiddler) {\n wikify(store.getTiddlersByTag(params[0],params[1],params[2],params[3]).tiddlerListWithExcerpt(),place,null,tiddler);\n};\n\nconfig.macros.listByTagExpr = {};\nconfig.macros.listByTagExpr.handler =\n function(place,macroName,params,wikifier,paramString,tiddler) {\n wikify(store.getTiddlersByTagExpression(params[0]).tiddlerList(),place,null,tiddler);\n};\n\nconfig.macros.listByTagExprWithExcerpt = {};\nconfig.macros.listByTagExprWithExcerpt.handler =\n function(place,macroName,params,wikifier,paramString,tiddler) {\n wikify(store.getTiddlersByTagExpression(params[0]).tiddlerListWithExcerpt(),place,null,tiddler);\n};\n\n\n\n//}}}\n
/***\n|Name|TagglyListPlugin|\n|Created by|SimonBaird|\n|Location|http://simonbaird.com/mptw/#TagglyListPlugin|\n|Version|1.1.2 25-Apr-06|\n|Requires|See TagglyTagging|\n\n!History\n* 1.1.2 (25-Apr-2006) embedded TagglyTaggingStyles. No longer need separated tiddler for styles.\n* 1.1.1 (6-Mar-2006) fixed bug with refreshAllVisible closing tiddlers being edited. Thanks Luke Blanshard.\n\n***/\n\n/***\n!Setup and config\n***/\n//{{{\n\nversion.extensions.TagglyListPlugin = {\n major: 1, minor: 1, revision: 2,\n date: new Date(2006,4,25),\n source: "http://simonbaird.com/mptw/#TagglyListPlugin"\n};\n\nconfig.macros.tagglyList = {};\nconfig.macros.tagglyListByTag = {};\nconfig.macros.tagglyListControl = {};\nconfig.macros.tagglyListWithSort = {};\nconfig.macros.hideSomeTags = {};\n\n// change this to your preference\nconfig.macros.tagglyListWithSort.maxCols = 6;\n\nconfig.macros.tagglyList.label = "Tagged as %0:";\n\n// the default sort options. set these to your preference\nconfig.macros.tagglyListWithSort.defaults = {\n sortBy:"title", // title|created|modified\n sortOrder: "asc", // asc|desc\n hideState: "show", // show|hide\n groupState: "nogroup", // nogroup|group\n numCols: 1\n};\n\n// these tags will be ignored by the grouped view\nconfig.macros.tagglyListByTag.excludeTheseTags = [\n "systemConfig",\n "TiddlerTemplates"\n];\n\nconfig.macros.tagglyListControl.tags = {\n title:"sortByTitle", \n modified: "sortByModified", \n created: "sortByCreated",\n asc:"sortAsc", \n desc:"sortDesc",\n hide:"hideTagged", \n show:"showTagged",\n nogroup:"noGroupByTag",\n group:"groupByTag",\n cols1:"list1Cols",\n cols2:"list2Cols",\n cols3:"list3Cols",\n cols4:"list4Cols",\n cols5:"list5Cols",\n cols6:"list6Cols",\n cols7:"list7Cols",\n cols8:"list8Cols",\n cols9:"list9Cols" \n}\n\n// note: should match config.macros.tagglyListControl.tags\nconfig.macros.hideSomeTags.tagsToHide = [\n "sortByTitle",\n "sortByCreated",\n "sortByModified",\n "sortDesc",\n "sortAsc",\n "hideTagged",\n "showTagged",\n "noGroupByTag",\n "groupByTag",\n "list1Cols",\n "list2Cols",\n "list3Cols",\n "list4Cols",\n "list5Cols",\n "list6Cols",\n "list7Cols",\n "list8Cols",\n "list9Cols"\n];\n\n\n//}}}\n/***\n\n!Utils\n***/\n//{{{\n// from Eric\nfunction isTagged(title,tag) {\n var t=store.getTiddler(title); if (!t) return false;\n return (t.tags.find(tag)!=null);\n}\n\n// from Eric\nfunction toggleTag(title,tag) {\n var t=store.getTiddler(title); if (!t || !t.tags) return;\n if (t.tags.find(tag)==null) t.tags.push(tag);\n else t.tags.splice(t.tags.find(tag),1);\n}\n\nfunction addTag(title,tag) {\n var t=store.getTiddler(title); if (!t || !t.tags) return;\n t.tags.push(tag);\n}\n\nfunction removeTag(title,tag) {\n var t=store.getTiddler(title); if (!t || !t.tags) return;\n if (t.tags.find(tag)!=null) t.tags.splice(t.tags.find(tag),1);\n}\n\n// from Udo\nArray.prototype.indexOf = function(item) {\n for (var i = 0; i < this.length; i++) {\n if (this[i] == item) {\n return i;\n }\n }\n return -1;\n};\nArray.prototype.contains = function(item) {\n return (this.indexOf(item) >= 0);\n}\n//}}}\n/***\n\n!tagglyList\ndisplays a list of tagged tiddlers. \nparameters are sortField and sortOrder\n***/\n//{{{\n\n// not used at the moment...\nfunction sortedListOfOtherTags(tiddler,thisTag) {\n var list = tiddler.tags.concat(); // so we are working on a clone..\n for (var i=0;i<config.macros.hideSomeTags.tagsToHide.length;i++) {\n if (list.find(config.macros.hideSomeTags.tagsToHide[i]) != null)\n list.splice(list.find(config.macros.hideSomeTags.tagsToHide[i]),1); // remove hidden ones\n }\n for (var i=0;i<config.macros.tagglyListByTag.excludeTheseTags.length;i++) {\n if (list.find(config.macros.tagglyListByTag.excludeTheseTags[i]) != null)\n list.splice(list.find(config.macros.tagglyListByTag.excludeTheseTags[i]),1); // remove excluded ones\n }\n list.splice(list.find(thisTag),1); // remove thisTag\n return '[[' + list.sort().join("]] [[") + ']]';\n}\n\nfunction sortHelper(a,b) {\n if (a == b) return 0;\n else if (a < b) return -1;\n else return +1;\n}\n\nconfig.macros.tagglyListByTag.handler = function (place,macroName,params,wikifier,paramString,tiddler) {\n\n var sortBy = params[0] ? params[0] : "title"; \n var sortOrder = params[1] ? params[1] : "asc";\n\n var result = store.getTaggedTiddlers(tiddler.title,sortBy);\n\n if (sortOrder == "desc")\n result = result.reverse();\n\n var leftOvers = []\n for (var i=0;i<result.length;i++) {\n leftOvers.push(result[i].title);\n }\n\n var allTagsHolder = {};\n for (var i=0;i<result.length;i++) {\n for (var j=0;j<result[i].tags.length;j++) {\n\n if ( \n result[i].tags[j] != tiddler.title // not this tiddler\n && config.macros.hideSomeTags.tagsToHide.find(result[i].tags[j]) == null // not a hidden one\n && config.macros.tagglyListByTag.excludeTheseTags.find(result[i].tags[j]) == null // not excluded\n ) {\n if (!allTagsHolder[result[i].tags[j]])\n allTagsHolder[result[i].tags[j]] = "";\n allTagsHolder[result[i].tags[j]] += "**[["+result[i].title+"]]\sn";\n\n if (leftOvers.find(result[i].title) != null)\n leftOvers.splice(leftOvers.find(result[i].title),1); // remove from leftovers. at the end it will contain the leftovers...\n }\n }\n }\n\n\n var allTags = [];\n for (var t in allTagsHolder)\n allTags.push(t);\n\n allTags.sort(function(a,b) {\n var tidA = store.getTiddler(a);\n var tidB = store.getTiddler(b);\n if (sortBy == "title") return sortHelper(a,b);\n else if (!tidA && !tidB) return 0;\n else if (!tidA) return -1;\n else if (!tidB) return +1;\n else return sortHelper(tidA[sortBy],tidB[sortBy]);\n });\n\n var markup = "";\n\n if (sortOrder == "desc") {\n allTags.reverse();\n }\n else {\n // leftovers first...\n for (var i=0;i<leftOvers.length;i++)\n markup += "*[["+leftOvers[i]+"]]\sn";\n } \n\n for (var i=0;i<allTags.length;i++)\n markup += "*[["+allTags[i]+"]]\sn" + allTagsHolder[allTags[i]];\n\n if (sortOrder == "desc") {\n // leftovers last...\n for (var i=0;i<leftOvers.length;i++)\n markup += "*[["+leftOvers[i]+"]]\sn";\n }\n\n wikify(markup,place);\n}\n\nconfig.macros.tagglyList.handler = function (place,macroName,params,wikifier,paramString,tiddler) {\n var sortBy = params[0] ? params[0] : "title"; \n var sortOrder = params[1] ? params[1] : "asc";\n var numCols = params[2] ? params[2] : 1;\n\n var result = store.getTaggedTiddlers(tiddler.title,sortBy);\n if (sortOrder == "desc")\n result = result.reverse();\n\n var listSize = result.length;\n var colSize = listSize/numCols;\n var remainder = listSize % numCols;\n\n var upperColsize;\n var lowerColsize;\n if (colSize != Math.floor(colSize)) {\n // it's not an exact fit so..\n lowerColsize = Math.floor(colSize);\n upperColsize = Math.floor(colSize) + 1;\n }\n else {\n lowerColsize = colSize;\n upperColsize = colSize;\n }\n\n var markup = "";\n var c=0;\n\n var newTaggedTable = createTiddlyElement(place,"table");\n var newTaggedBody = createTiddlyElement(newTaggedTable,"tbody");\n var newTaggedTr = createTiddlyElement(newTaggedBody,"tr");\n\n for (var j=0;j<numCols;j++) {\n var foo = "";\n var thisSize;\n\n if (j<remainder)\n thisSize = upperColsize;\n else\n thisSize = lowerColsize;\n\n for (var i=0;i<thisSize;i++) \n foo += ( "*[[" + result[c++].title + "]]\sn"); // was using splitList.shift() but didn't work in IE;\n\n var newTd = createTiddlyElement(newTaggedTr,"td",null,"tagglyTagging");\n wikify(foo,newTd);\n\n }\n\n};\n\n/* snip for later.....\n //var groupBy = params[3] ? params[3] : "t.title.substr(0,1)";\n //var groupBy = params[3] ? params[3] : "sortedListOfOtherTags(t,tiddler.title)";\n //var groupBy = params[3] ? params[3] : "t.modified";\n var groupBy = null; // for now. groupBy here is working but disabled for now.\n\n var prevGroup = "";\n var thisGroup = "";\n\n if (groupBy) {\n result.sort(function(a,b) {\n var t = a; var aSortVal = eval(groupBy); var aSortVal2 = eval("t".sortBy);\n var t = b; var bSortVal = eval(groupBy); var bSortVal2 = eval("t".sortBy);\n var t = b; var bSortVal2 = eval(groupBy);\n return (aSortVal == bSortVal ?\n (aSortVal2 == bSortVal2 ? 0 : (aSortVal2 < bSortVal2 ? -1 : +1)) // yuck\n : (aSortVal < bSortVal ? -1 : +1));\n });\n }\n\n if (groupBy) {\n thisGroup = eval(groupBy);\n if (thisGroup != prevGroup)\n markup += "*[["+thisGroup+']]\sn';\n markup += "**[["+t.title+']]\sn';\n prevGroup = thisGroup;\n }\n\n\n\n*/\n\n\n//}}}\n\n/***\n\n!tagglyListControl\nUse to make the sort control buttons\n***/\n//{{{\n\nfunction getSortBy(title) {\n var tiddler = store.getTiddler(title);\n var defaultVal = config.macros.tagglyListWithSort.defaults.sortBy;\n if (!tiddler) return defaultVal;\n var usetags = config.macros.tagglyListControl.tags;\n if (tiddler.tags.contains(usetags["title"])) return "title";\n else if (tiddler.tags.contains(usetags["modified"])) return "modified";\n else if (tiddler.tags.contains(usetags["created"])) return "created";\n else return defaultVal;\n}\n\nfunction getSortOrder(title) {\n var tiddler = store.getTiddler(title);\n var defaultVal = config.macros.tagglyListWithSort.defaults.sortOrder;\n if (!tiddler) return defaultVal;\n var usetags = config.macros.tagglyListControl.tags;\n if (tiddler.tags.contains(usetags["asc"])) return "asc";\n else if (tiddler.tags.contains(usetags["desc"])) return "desc";\n else return defaultVal;\n}\n\nfunction getHideState(title) {\n var tiddler = store.getTiddler(title);\n var defaultVal = config.macros.tagglyListWithSort.defaults.hideState;\n if (!tiddler) return defaultVal;\n var usetags = config.macros.tagglyListControl.tags;\n if (tiddler.tags.contains(usetags["hide"])) return "hide";\n else if (tiddler.tags.contains(usetags["show"])) return "show";\n else return defaultVal;\n}\n\nfunction getGroupState(title) {\n var tiddler = store.getTiddler(title);\n var defaultVal = config.macros.tagglyListWithSort.defaults.groupState;\n if (!tiddler) return defaultVal;\n var usetags = config.macros.tagglyListControl.tags;\n if (tiddler.tags.contains(usetags["group"])) return "group";\n else if (tiddler.tags.contains(usetags["nogroup"])) return "nogroup";\n else return defaultVal;\n}\n\nfunction getNumCols(title) {\n var tiddler = store.getTiddler(title);\n var defaultVal = config.macros.tagglyListWithSort.defaults.numCols; // an int\n if (!tiddler) return defaultVal;\n var usetags = config.macros.tagglyListControl.tags;\n for (var i=1;i<=config.macros.tagglyListWithSort.maxCols;i++)\n if (tiddler.tags.contains(usetags["cols"+i])) return i;\n return defaultVal;\n}\n\n\nfunction getSortLabel(title,which) {\n // TODO. the strings here should be definable in config\n var by = getSortBy(title);\n var order = getSortOrder(title);\n var hide = getHideState(title);\n var group = getGroupState(title);\n if (which == "hide") return (hide == "show" ? "−" : "+"); // 0x25b8;\n else if (which == "group") return (group == "group" ? "normal" : "grouped");\n else if (which == "cols") return "cols±"; // &plusmn;\n else if (by == which) return which + (order == "asc" ? "↓" : "↑"); // &uarr; &darr;\n else return which;\n}\n\nfunction handleSortClick(title,which) {\n var currentSortBy = getSortBy(title);\n var currentSortOrder = getSortOrder(title);\n var currentHideState = getHideState(title);\n var currentGroupState = getGroupState(title);\n var currentNumCols = getNumCols(title);\n\n var tags = config.macros.tagglyListControl.tags;\n\n // if it doesn't exist, lets create it..\n if (!store.getTiddler(title))\n store.saveTiddler(title,title,"",config.options.txtUserName,new Date(),null);\n\n if (which == "hide") {\n // toggle hide state\n var newHideState = (currentHideState == "hide" ? "show" : "hide");\n removeTag(title,tags[currentHideState]);\n if (newHideState != config.macros.tagglyListWithSort.defaults.hideState)\n toggleTag(title,tags[newHideState]);\n }\n else if (which == "group") {\n // toggle hide state\n var newGroupState = (currentGroupState == "group" ? "nogroup" : "group");\n removeTag(title,tags[currentGroupState]);\n if (newGroupState != config.macros.tagglyListWithSort.defaults.groupState)\n toggleTag(title,tags[newGroupState]);\n }\n else if (which == "cols") {\n // toggle num cols\n var newNumCols = currentNumCols + 1; // confusing. currentNumCols is an int\n if (newNumCols > config.macros.tagglyListWithSort.maxCols || newNumCols > store.getTaggedTiddlers(title).length)\n newNumCols = 1;\n removeTag(title,tags["cols"+currentNumCols]);\n if (("cols"+newNumCols) != config.macros.tagglyListWithSort.defaults.groupState)\n toggleTag(title,tags["cols"+newNumCols]);\n }\n else if (currentSortBy == which) {\n // toggle sort order\n var newSortOrder = (currentSortOrder == "asc" ? "desc" : "asc");\n removeTag(title,tags[currentSortOrder]);\n if (newSortOrder != config.macros.tagglyListWithSort.defaults.sortOrder)\n toggleTag(title,tags[newSortOrder]);\n }\n else {\n // change sortBy only\n removeTag(title,tags["title"]);\n removeTag(title,tags["created"]);\n removeTag(title,tags["modified"]);\n\n if (which != config.macros.tagglyListWithSort.defaults.sortBy)\n toggleTag(title,tags[which]);\n }\n\n store.setDirty(true); // save is required now.\n story.refreshTiddler(title,false,true); // force=true\n}\n\nconfig.macros.tagglyListControl.handler = function (place,macroName,params,wikifier,paramString,tiddler) {\n var onclick = function(e) {\n if (!e) var e = window.event;\n handleSortClick(tiddler.title,params[0]);\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return false;\n };\n createTiddlyButton(place,getSortLabel(tiddler.title,params[0]),"Click to change sort options",onclick,params[0]=="hide"?"hidebutton":"button");\n}\n//}}}\n/***\n\n!tagglyListWithSort\nput it all together..\n***/\n//{{{\nconfig.macros.tagglyListWithSort.handler = function (place,macroName,params,wikifier,paramString,tiddler) {\n if (tiddler && store.getTaggedTiddlers(tiddler.title).length > 0)\n // todo make this readable\n wikify(\n "<<tagglyListControl hide>>"+\n (getHideState(tiddler.title) != "hide" ? \n '<html><span class="tagglyLabel">'+config.macros.tagglyList.label.format([tiddler.title])+' </span></html>'+\n "<<tagglyListControl title>><<tagglyListControl modified>><<tagglyListControl created>><<tagglyListControl group>>"+(getGroupState(tiddler.title)=="group"?"":"<<tagglyListControl cols>>")+"\sn" + \n "<<tagglyList" + (getGroupState(tiddler.title)=="group"?"ByTag ":" ") + getSortBy(tiddler.title)+" "+getSortOrder(tiddler.title)+" "+getNumCols(tiddler.title)+">>" // hacky\n // + \sn----\sn" +\n //"<<tagglyList "+getSortBy(tiddler.title)+" "+getSortOrder(tiddler.title)+">>"\n : ""),\n place,null,tiddler);\n}\n\nconfig.macros.tagglyTagging = { handler: config.macros.tagglyListWithSort.handler };\n\n\n//}}}\n/***\n\n!hideSomeTags\nSo we don't see the sort tags.\n(note, they are still there when you edit. Will that be too annoying?\n***/\n//{{{\n\n// based on tags.handler\nconfig.macros.hideSomeTags.handler = function(place,macroName,params,wikifier,paramString,tiddler) {\n var theList = createTiddlyElement(place,"ul");\n if(params[0] && store.tiddlerExists[params[0]])\n tiddler = store.getTiddler(params[0]);\n var lingo = config.views.wikified.tag;\n var prompt = tiddler.tags.length == 0 ? lingo.labelNoTags : lingo.labelTags;\n createTiddlyElement(theList,"li",null,"listTitle",prompt.format([tiddler.title]));\n for(var t=0; t<tiddler.tags.length; t++)\n if (!this.tagsToHide.contains(tiddler.tags[t])) // this is the only difference from tags.handler...\n createTagButton(createTiddlyElement(theList,"li"),tiddler.tags[t],tiddler.title);\n\n}\n\n//}}}\n/***\n\n!Refresh everything when we save a tiddler. So the tagged lists never get stale. Is this too slow???\n***/\n//{{{\n\nfunction refreshAllVisible() {\n story.forEachTiddler(function(title,element) {\n if (element.getAttribute("dirty") != "true") \n story.refreshTiddler(title,false,true);\n });\n}\n\nstory.saveTiddler_orig_mptw = story.saveTiddler;\nstory.saveTiddler = function(title,minorUpdate) {\n var result = this.saveTiddler_orig_mptw(title,minorUpdate);\n refreshAllVisible();\n return result;\n}\n\nstore.removeTiddler_orig_mptw = store.removeTiddler;\nstore.removeTiddler = function(title) {\n this.removeTiddler_orig_mptw(title);\n refreshAllVisible();\n}\n\nconfig.shadowTiddlers.TagglyTaggingStyles = "/***\snTo use, add {{{[[TagglyTaggingStyles]]}}} to your StyleSheet tiddler, or you can just paste the CSS in directly. See also ViewTemplate, EditTemplate and TagglyTagging.\sn***/\sn/*{{{*/\sn.tagglyTagged li.listTitle { display:none;}\sn.tagglyTagged li { display: inline; font-size:90%; }\sn.tagglyTagged ul { margin:0px; padding:0px; }\sn.tagglyTagging { padding-top:0.5em; }\sn.tagglyTagging li.listTitle { display:none;}\sn.tagglyTagging ul { margin-top:0px; padding-top:0.5em; padding-left:2em; margin-bottom:0px; padding-bottom:0px; }\sn\sn/* .tagglyTagging .tghide { display:inline; } */\sn\sn.tagglyTagging { vertical-align: top; margin:0px; padding:0px; }\sn.tagglyTagging table { margin:0px; padding:0px; }\sn\sn\sn.tagglyTagging .button { display:none; margin-left:3px; margin-right:3px; }\sn.tagglyTagging .button, .tagglyTagging .hidebutton { color:#aaa; font-size:90%; border:0px; padding-left:0.3em;padding-right:0.3em;}\sn.tagglyTagging .button:hover, .hidebutton:hover { background:#eee; color:#888; }\sn.selected .tagglyTagging .button { display:inline; }\sn\sn.tagglyTagging .hidebutton { color:white; } /* has to be there so it takes up space. tweak if you're not using a white tiddler bg */\sn.selected .tagglyTagging .hidebutton { color:#aaa }\sn\sn.tagglyLabel { color:#aaa; font-size:90%; }\sn\sn.tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }\sn.tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}\sn.tagglyTagging ul ul li {margin-left:0.5em; }\sn\sn.editLabel { font-size:90%; padding-top:0.5em; }\sn/*}}}*/\sn";\n\nrefreshStyles("TagglyTaggingStyles");\n\n\n//}}}\n\n// // <html>&#x25b8;&#x25be;&minus;&plusmn;</html>
<!---\n| Name:|~TagglyTaggingViewTemplate |\n| Version:|1.2 (16-Jan-2006)|\n| Source:|http://simonbaird.com/mptw/#TagglyTaggingViewTemplate|\n| Purpose:|See TagglyTagging for more info|\n| Requires:|You need the CSS in TagglyTaggingStyles to make it look right|\n!History\n* 16-Jan-06, version 1.2, added tagglyListWithSort\n* 12-Jan-06, version 1.1, first version\n!Notes\nRemove the miniTag if you don't like it or you don't use QuickOpenTagPlugin\n--->\n<!--{{{-->\n<div class="toolbar" macro="toolbar -closeTiddler closeOthers +editTiddler permalink references jump newHere"></div>\n<div class="tagglyTagged" macro="hideSomeTags"></div>\n<div><span class="title" macro="view title"></span><span class="miniTag" macro="miniTag"></span></div>\n<div class='subtitle'>Updated <span macro='view modified date [[DD-MMM-YY]]'></span></div>\n<div class="viewer" macro="view text wikified"></div>\n<div class="tagglyTagging" macro="tagglyTagging"></div>\n<!--}}}-->\n
La source de nos émotions est notre mémoire; il y rentre beaucoup de choses à l'insu de notre plein gré. Et on ne va pas les remettre en question puisque c'est notre réalité. On est d'accord; mais en fait on n'en sait rien, on n'y a pas vraiment réfléchi: on l'a lu, entendu, ou vu a la tv; et on y associe une émotion et un sentiment plus ou moins fort.\n\n''On ne peut apréhender la réalité des faits à travers le jugement et les concepts d'autrui.''\n\n''Les émotions et la mémoire sont, au niveau cellulaire, des réflexes induits par les empreintes d'événements biologiques passés, __qui ne sont pas toujours en phase avec la réalité factuelle__ ''.\n\n''Nos connaissances individuelles étant limitées par la durée de notre vie, tous nos concepts sont subjectifs et n'ont rien d'absolu. Ils ne sont que le fruit de notre passé individuel et collectif. ''\n \nOn est d'accord avec ce qui a été déclaré par d'autres sans pouvoir l'expliquer clairement, voir même en l'interprétant complétement à l'envers.\n\nDans certaines conditions l'homme est pret à défendre au prix de sa vie des concepts subjectifs, alors qu'il en ignore l'origine et le sens, tout autant que l'origine et le sens des concepts auxquels ils s'opposent.\n\n''Quand on juge les gens ou les événements on ne fait que renforcer sa propre identité psychique et sociale.''\n\nMais pourquoi diable s'identifie-t-on à quelque chose, ou plutôt: pourquoi identifions-nous les autres à quelque chose de si différent de nous même, alors que tous nous sommes ce que notre passé à fait de nous, de l'ADN au mental en passant par le corps, des pieds à la tête ?\n\n(Des fois on se demande ou est l'un et ou est l'autre..) \n\n''Tout est répétition. Nous ne faisons que répéter chaque jour des comportements pour tenter d'apaiser nos désirs et nos peurs, et de valoriser notre identité psychique et sociale; même lorsque par excès ces comportements mènent au désequilibre, au conflit ou à l'auto-destruction.''\n\nL'avalanche d'informations répétitives et variées à laquelle on nous soumet nous fatigue et impaire nos facultés de jugement objectif, nous fait avaler par lassitude des concepts sans qu'on ait plus l'idée de les remettre en question.\n\nDe plus, cela réduit notre volonté ou fausse notre approche à résoudre des problèmes concrets dans notre entourage direct, à cause des émotions et des sentiments qu'on associe aux scènes qu'on nous met au premier plan ou qu'on nous amène à imaginer.\n\n''Qu'on le veuille ou non, nous sommes tous pareils et nous sommes tous une grande famille. Pour assurer la survie de l'espèce humaine sur ce qui reste du biotope terrestre dans de meilleures perspectives que ce nous réservent à assez court terme nos comportements répétitifs, il faudrait que chacun soit amené, si il peut l'être avant que sa vie ne soit directement mise en jeu, à pouvoir réobserver tous les concepts auxquels il est si attaché, au regard des concepts des autres et à la lumière des faits.\n\nIl faut réapprendre à observer les éléments et les systèmes qui constituent notre univers physique et psychique, en faisant abstraction des images mentales qui se reflètent sur la surface des choses et des idées, car elles empêchent de voir les faits tels qu'ils sont en réalité.''\n\nL'identité psychique en dehors du facteur ADN qui détermine la nature et le comportement basique de chaque forme de vie (et qui fait de nous des éléments du biotope terrestre), n'est-elle pas avant tout basée sur notre vécu et un ensemble de concepts intellectuels admis "religieusement" par l'entourage social ?\n\nhttp://www.afghanistanafterdemocracy.com\nhttp://www.reopen911.org\nhttp://www.reopen911.info (en français)
http://www.tiddlywiki.com
<script label="show/hide left sidebar">\n var show=document.getElementById('mainMenu').style.display=='none';\n if (!show) {\n document.getElementById('mainMenu').style.display='none';\n document.getElementById('displayArea').style.marginLeft='1em';\n place.innerHTML="show sidebar &gt;&gt;";\n }\n else {\n document.getElementById('mainMenu').style.display='block';\n var margin=config.options.txtDisplayAreaLeftMargin?config.options.txtDisplayAreaLeftMargin:"";\n place.innerHTML="&lt;&lt; hide sidebar";\n }\n document.getElementById('displayArea').style.marginLeft=margin;\n config.options.chkShowLeftSidebar=show;\n saveOptionCookie('chkShowLeftSidebar');\n config.refreshers.content(document.getElementById("storyMenu"));\n return false;\n</script><script>\n if (config.options.chkShowLeftSidebar==undefined)\n config.options.chkShowLeftSidebar=true;\n if (!config.options.txtDisplayAreaLeftMargin||!config.options.txtDisplayAreaLeftMargin.length)\n config.options.txtDisplayAreaLeftMargin="14em";\n var show=config.options.chkShowLeftSidebar;\n document.getElementById('mainMenu').style.display=show?"block":"none";\n document.getElementById('displayArea').style.marginLeft=show?config.options.txtDisplayAreaLeftMargin:"1em";\n place.lastChild.innerHTML=(show?"&lt;&lt; hide sidebar":"show sidebar &gt;&gt;"); // SET LINK TEXT\n place.lastChild.style.fontWeight="normal";\n</script>
<<option chkHttpReadOnly>><script>\n var chk=place.lastChild;\n chk.style.margin=chk.style.padding="0";\n chk.id="ToggleReadOnly_checkbox";\n chk.title="enable/disable TiddlyWiki editing functions";\n chk.checked=readOnly;\n chk.coreOnChange=chk.onchange;\n chk.onchange=function() {\n if (this.coreOnChange) this.coreOnChange();\n readOnly=!readOnly;\n this.checked=readOnly;\n story.forEachTiddler(function(t,e){story.refreshTiddler(t,null,true)});\n refreshDisplay();\n };\n</script><script label="read-only">\n place.previousSibling.onchange();\n</script><script>\n var s=place.lastChild.style; s.display="inline"; s.fontWeight="normal";\n</script>
<script label="show/hide right sidebar">\n var show=document.getElementById('sidebar').style.display=='none';\n if (!show) {\n document.getElementById('sidebar').style.display='none';\n var margin='1em';\n place.innerHTML="&lt;&lt; show sidebar";\n }\n else {\n document.getElementById('sidebar').style.display='block';\n var margin=config.options.txtDisplayAreaRightMargin?config.options.txtDisplayAreaRightMargin:"";\n place.innerHTML="hide sidebar &gt;&gt;";\n }\n document.getElementById('displayArea').style.marginRight=margin;\n config.options.chkShowRightSidebar=show;\n saveOptionCookie('chkShowRightSidebar');\n var storymenu=document.getElementById("storyMenu");\n if (storymenu!=undefined) \n config.refreshers.content(storymenu);\n return false;\n</script><script>\n if (config.options.chkShowRightSidebar==undefined)\n config.options.chkShowRightSidebar=true;\n if (!config.options.txtDisplayAreaRightMargin||!config.options.txtDisplayAreaRightMargin.length)\n config.options.txtDisplayAreaRightMargin="17em";\n var show=config.options.chkShowRightSidebar;\n document.getElementById('sidebar').style.display=show?"block":"none";\n document.getElementById('displayArea').style.marginRight=show?config.options.txtDisplayAreaRightMargin:"1em";\n place.lastChild.innerHTML=(show?"hide sidebar &gt;&gt;":"&lt;&lt; show sidebar"); // SET LINK TEXT\n place.lastChild.style.fontWeight="normal";\n</script>
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |\n| 23/8/2006 10:42:12 | admin | [[luxigo.html|file:///home/admin/Desktop/luxigo.html#DefaultTiddlers]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 23/8/2006 10:45:1 | admin | [[luxigo.html|file:///home/admin/Desktop/luxigo.html#%5B%5BWelcome%20to%20your%20tiddlyspot.com%20site!%5D%5D]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 23/8/2006 14:30:35 | admin | [[luxigo.html|file:///home/admin/Desktop/luxigo.html#GettingStarted]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 23/8/2006 14:42:51 | luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 28/8/2006 21:25:31 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/9/2006 13:26:18 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 2/9/2006 13:37:59 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/9/2006 13:41:9 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/9/2006 13:49:58 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/9/2006 13:50:37 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 2/9/2006 15:15:23 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/9/2006 16:10:8 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 11/9/2006 16:1:21 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 11/9/2006 18:9:53 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 11/9/2006 19:6:52 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 6:9:19 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 6:15:39 | YourName | [[luxigo.html|file:///home/admin/Desktop/luxigo.html#ImportedTiddlers]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 6:23:2 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 6:27:54 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 7:17:45 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/9/2006 18:3:17 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 26/9/2006 22:39:44 | YourName | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 4/1/2007 13:46:19 | YourName | [[luxigo.html|file:///home/admin/Desktop/luxigo.html]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/5/2007 14:25:47 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 13/5/2007 14:33:31 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 13/5/2007 14:35:19 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 10/6/2007 19:14:11 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 19:17:4 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 19:34:10 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 19:49:27 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 19:53:10 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 19:56:54 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 20:5:7 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 20:6:27 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 10/6/2007 20:11:17 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 10/6/2007 20:52:41 | admin | [[/|http://luxigo.tiddlyspot.com/#%5B%5BElphel%20Camera%20Remote%20Audio%20HOW-TO%5D%5D]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 11/6/2007 1:8:32 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 11/6/2007 1:23:45 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 11/6/2007 11:47:57 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 15/6/2007 17:38:9 | admin | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 3/7/2007 7:51:55 | luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 24/11/2007 15:50:29 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 15:52:39 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 16:1:12 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 16:4:38 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 16:6:54 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 24/11/2007 16:10:38 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 16:19:6 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 24/11/2007 16:34:32 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 16:41:4 | Luxigo | [[/|http://luxigo.tiddlyspot.com/]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 17:2:49 | Luxigo | [[/|http://luxigo.tiddlyspot.com/#%5B%5BD-Link%20DWL-G122%20-%20Elphel%5D%5D]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 24/11/2007 17:33:4 | Luxigo | [[/|http://luxigo.tiddlyspot.com/#%5B%5BWireless%20USB%20stick%20D-Link%20DWL-G122%20-%20Elphel%20Cameras%20-%20How-To%5D%5D]] | [[store.cgi|http://luxigo.tiddlyspot.com/store.cgi]] | . | index.html | . |
/***\n<<tiddler UploadPluginDoc>>\n!Code\n***/\n//{{{\nversion.extensions.UploadPlugin = {\n major: 3, minor: 3, revision: 3, \n date: new Date(2006,6,30),\n type: 'macro',\n source: 'http://tiddlywiki.bidix.info/#UploadPlugin',\n docs: 'http://tiddlywiki.bidix.info/#UploadPluginDoc'\n};\n//}}}\n\n////+++!![config.lib.file]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.file) config.lib.file= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.file.dirname = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(0, lastpos);\n } else {\n return filePath.substring(0, filePath.lastIndexOf("\s\s"));\n }\n};\nconfig.lib.file.basename = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("#")) != -1) \n filePath = filePath.substring(0, lastpos);\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(lastpos + 1);\n } else\n return filePath.substring(filePath.lastIndexOf("\s\s")+1);\n};\nwindow.basename = function() {return "@@deprecated@@";};\n//}}}\n////===\n\n////+++!![config.lib.log]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.log) config.lib.log= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.Log = function(tiddlerTitle, logHeader) {\n if (version.major < 2)\n this.tiddler = store.tiddlers[tiddlerTitle];\n else\n this.tiddler = store.getTiddler(tiddlerTitle);\n if (!this.tiddler) {\n this.tiddler = new Tiddler();\n this.tiddler.title = tiddlerTitle;\n this.tiddler.text = "| !date | !user | !location |" + logHeader;\n this.tiddler.created = new Date();\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[tiddlerTitle] = this.tiddler;\n else\n store.addTiddler(this.tiddler);\n }\n return this;\n};\n\nconfig.lib.Log.prototype.newLine = function (line) {\n var now = new Date();\n var newText = "| ";\n newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";\n newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";\n newText += config.options.txtUserName + " | ";\n var location = document.location.toString();\n var filename = config.lib.file.basename(location);\n if (!filename) filename = '/';\n newText += "[["+filename+"|"+location + "]] |";\n this.tiddler.text = this.tiddler.text + "\sn" + newText;\n this.addToLine(line);\n};\n\nconfig.lib.Log.prototype.addToLine = function (text) {\n this.tiddler.text = this.tiddler.text + text;\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[this.tiddler.tittle] = this.tiddler;\n else {\n store.addTiddler(this.tiddler);\n story.refreshTiddler(this.tiddler.title);\n store.notify(this.tiddler.title, true);\n }\n if (version.major < 2)\n store.notifyAll(); \n};\n//}}}\n////===\n\n////+++!![config.lib.options]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.options) config.lib.options = {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\n\nconfig.lib.options.init = function (name, defaultValue) {\n if (!config.options[name]) {\n config.options[name] = defaultValue;\n saveOptionCookie(name);\n }\n};\n//}}}\n////===\n\n////+++!![PasswordTweak]\n\n//{{{\nversion.extensions.PasswordTweak = {\n major: 1, minor: 0, revision: 2, date: new Date(2006,3,11),\n type: 'tweak',\n source: 'http://tiddlywiki.bidix.info/#PasswordTweak'\n};\n//}}}\n/***\n!!config.macros.option\n***/\n//{{{\nconfig.macros.option.passwordCheckboxLabel = "Save this password on this computer";\nconfig.macros.option.passwordType = "password"; // password | text\n\nconfig.macros.option.onChangeOption = function(e)\n{\n var opt = this.getAttribute("option");\n var elementType,valueField;\n if(opt) {\n switch(opt.substr(0,3)) {\n case "txt":\n elementType = "input";\n valueField = "value";\n break;\n case "pas":\n elementType = "input";\n valueField = "value";\n break;\n case "chk":\n elementType = "input";\n valueField = "checked";\n break;\n }\n config.options[opt] = this[valueField];\n saveOptionCookie(opt);\n var nodes = document.getElementsByTagName(elementType);\n for(var t=0; t<nodes.length; t++) {\n var optNode = nodes[t].getAttribute("option");\n if (opt == optNode) \n nodes[t][valueField] = this[valueField];\n }\n }\n return(true);\n};\n\nconfig.macros.option.handler = function(place,macroName,params)\n{\n var opt = params[0];\n var size = 15;\n if (params[1])\n size = params[1];\n if(config.options[opt] === undefined) {\n return;}\n var c;\n switch(opt.substr(0,3)) {\n case "txt":\n c = document.createElement("input");\n c.onkeyup = this.onChangeOption;\n c.setAttribute ("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n break;\n case "pas":\n // input password\n c = document.createElement ("input");\n c.setAttribute("type",config.macros.option.passwordType);\n c.onkeyup = this.onChangeOption;\n c.setAttribute("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n // checkbox link with this password "save this password on this computer"\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option","chk"+opt);\n place.appendChild(c);\n c.checked = config.options["chk"+opt];\n // text savePasswordCheckboxLabel\n place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));\n break;\n case "chk":\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option",opt);\n place.appendChild(c);\n c.checked = config.options[opt];\n break;\n }\n};\n//}}}\n/***\n!! Option cookie stuff\n***/\n//{{{\nwindow.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;\nwindow.loadOptionsCookie = function()\n{\n var cookies = document.cookie.split(";");\n for(var c=0; c<cookies.length; c++) {\n var p = cookies[c].indexOf("=");\n if(p != -1) {\n var name = cookies[c].substr(0,p).trim();\n var value = cookies[c].substr(p+1).trim();\n switch(name.substr(0,3)) {\n case "txt":\n config.options[name] = unescape(value);\n break;\n case "pas":\n config.options[name] = unescape(value);\n break;\n case "chk":\n config.options[name] = value == "true";\n break;\n }\n }\n }\n};\n\nwindow.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;\nwindow.saveOptionCookie = function(name)\n{\n var c = name + "=";\n switch(name.substr(0,3)) {\n case "txt":\n c += escape(config.options[name].toString());\n break;\n case "chk":\n c += config.options[name] ? "true" : "false";\n // is there an option link with this chk ?\n if (config.options[name.substr(3)]) {\n saveOptionCookie(name.substr(3));\n }\n break;\n case "pas":\n if (config.options["chk"+name]) {\n c += escape(config.options[name].toString());\n } else {\n c += "";\n }\n break;\n }\n c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";\n document.cookie = c;\n};\n//}}}\n/***\n!! Initializations\n***/\n//{{{\n// define config.options.pasPassword\nif (!config.options.pasPassword) {\n config.options.pasPassword = 'defaultPassword';\n window.saveOptionCookie('pasPassword');\n}\n// since loadCookies is first called befor password definition\n// we need to reload cookies\nwindow.loadOptionsCookie();\n//}}}\n////===\n\n////+++!![config.macros.upload]\n\n//{{{\nconfig.macros.upload = {\n accessKey: "U",\n formName: "UploadPlugin",\n contentType: "text/html;charset=UTF-8",\n defaultStoreScript: "store.php"\n};\n\n// only this two configs need to be translated\nconfig.macros.upload.messages = {\n aboutToUpload: "About to upload TiddlyWiki to %0",\n errorDownloading: "Error downloading",\n errorUploadingContent: "Error uploading content",\n fileNotFound: "file to upload not found",\n fileNotUploaded: "File %0 NOT uploaded",\n mainFileUploaded: "Main TiddlyWiki file uploaded to %0",\n urlParamMissing: "url param missing",\n rssFileNotUploaded: "RssFile %0 NOT uploaded",\n rssFileUploaded: "Rss File uploaded to %0"\n};\n\nconfig.macros.upload.label = {\n promptOption: "Save and Upload this TiddlyWiki with UploadOptions",\n promptParamMacro: "Save and Upload this TiddlyWiki in %0",\n saveLabel: "save to web", \n saveToDisk: "save to disk",\n uploadLabel: "upload" \n};\n\nconfig.macros.upload.handler = function(place,macroName,params){\n // parameters initialization\n var storeUrl = params[0];\n var toFilename = params[1];\n var backupDir = params[2];\n var uploadDir = params[3];\n var username = params[4];\n var password; // for security reason no password as macro parameter\n var label;\n if (document.location.toString().substr(0,4) == "http")\n label = this.label.saveLabel;\n else\n label = this.label.uploadLabel;\n var prompt;\n if (storeUrl) {\n prompt = this.label.promptParamMacro.toString().format([this.dirname(storeUrl)]);\n }\n else {\n prompt = this.label.promptOption;\n }\n createTiddlyButton(place, label, prompt, \n function () {\n config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password); \n return false;}, \n null, null, this.accessKey);\n};\nconfig.macros.upload.UploadLog = function() {\n return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );\n};\nconfig.macros.upload.UploadLog.prototype = config.lib.Log.prototype;\nconfig.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {\n var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";\n line += uploadDir + " | " + toFilename + " | " + backupDir + " |";\n this.newLine(line);\n};\nconfig.macros.upload.UploadLog.prototype.endUpload = function() {\n this.addToLine(" Ok |");\n};\nconfig.macros.upload.basename = config.lib.file.basename;\nconfig.macros.upload.dirname = config.lib.file.dirname;\nconfig.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)\n{\n // parameters initialization\n storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);\n toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);\n backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);\n uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);\n username = (username ? username : config.options.txtUploadUserName);\n password = config.options.pasUploadPassword; // for security reason no password as macro parameter\n if (storeUrl === '') {\n config.macros.upload.defaultStoreScript;\n }\n if (config.lib.file.dirname(storeUrl) === '') {\n storeUrl = config.lib.file.dirname(document.location.toString())+'/'+storeUrl;\n }\n if (toFilename === '') {\n toFilename = config.lib.file.basename(document.location.toString());\n }\n\n clearMessage();\n // only for forcing the message to display\n if (version.major < 2)\n store.notifyAll();\n if (!storeUrl) {\n alert(config.macros.upload.messages.urlParamMissing);\n return;\n }\n \n var log = new this.UploadLog();\n log.startUpload(storeUrl, toFilename, uploadDir, backupDir);\n if (document.location.toString().substr(0,5) == "file:") {\n saveChanges();\n }\n displayMessage(config.macros.upload.messages.aboutToUpload.format([this.dirname(storeUrl)]), this.dirname(storeUrl));\n this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);\n if(config.options.chkGenerateAnRssFeed) {\n //var rssContent = convertUnicodeToUTF8(generateRss());\n var rssContent = generateRss();\n var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";\n this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password, \n function (responseText) {\n if (responseText.substring(0,1) != '0') {\n displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));\n }\n else {\n if (uploadDir) {\n rssPath = uploadDir + "/" + config.macros.upload.basename(rssPath);\n } else {\n rssPath = config.macros.upload.basename(rssPath);\n }\n displayMessage(config.macros.upload.messages.rssFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+rssPath]), config.macros.upload.dirname(storeUrl)+"/"+rssPath);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n });\n }\n return;\n};\n\nconfig.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var original;\n if (document.location.toString().substr(0,4) == "http") {\n original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);\n return;\n }\n else {\n // standard way : Local file\n \n original = loadFile(getLocalPath(document.location.toString()));\n if(window.Components) {\n // it's a mozilla browser\n try {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]\n .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);\n converter.charset = "UTF-8";\n original = converter.ConvertToUnicode(original);\n }\n catch(e) {\n }\n }\n }\n //DEBUG alert(original);\n this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password);\n};\n\nconfig.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it\n var endSaveArea = '</d' + 'iv>';\n // Locate the storeArea div's\n var posOpeningDiv = original.indexOf(startSaveArea);\n var posClosingDiv = original.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1))\n {\n alert(config.messages.invalidFileError.format([document.location.toString()]));\n return;\n }\n var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + \n allTiddlersAsHtml() + "\sn\st\st" +\n original.substr(posClosingDiv);\n var newSiteTitle;\n if(version.major < 2){\n newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();\n } else {\n newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();\n }\n revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");\n var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir, \n username, password, function (responseText) {\n if (responseText.substring(0,1) != '0') {\n alert(responseText);\n displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));\n }\n else {\n if (uploadDir !== '') {\n toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);\n } else {\n toFilename = config.macros.upload.basename(toFilename);\n }\n displayMessage(config.macros.upload.messages.mainFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+toFilename]), config.macros.upload.dirname(storeUrl)+"/"+toFilename);\n var log = new config.macros.upload.UploadLog();\n log.endUpload();\n store.setDirty(false);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n }\n );\n};\n\nconfig.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir, \n username, password, callbackFn) {\n var boundary = "---------------------------"+"AaB03x"; \n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n if (window.netscape){\n try {\n if (document.location.toString().substr(0,4) != "http") {\n netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}\n }\n catch (e) { }\n } \n //DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");\n // compose headers data\n var sheader = "";\n sheader += "--" + boundary + "\sr\snContent-disposition: form-data; name=\s"";\n sheader += config.macros.upload.formName +"\s"\sr\sn\sr\sn";\n sheader += "backupDir="+backupDir\n +";user=" + username \n +";password=" + password\n +";uploaddir=" + uploadDir\n + ";;\sr\sn"; \n sheader += "\sr\sn" + "--" + boundary + "\sr\sn";\n sheader += "Content-disposition: form-data; name=\s"userfile\s"; filename=\s""+toFilename+"\s"\sr\sn";\n sheader += "Content-Type: " + config.macros.upload.contentType + "\sr\sn";\n sheader += "Content-Length: " + content.length + "\sr\sn\sr\sn";\n // compose trailer data\n var strailer = new String();\n strailer = "\sr\sn--" + boundary + "--\sr\sn";\n var data;\n data = sheader + content + strailer;\n //request.open("POST", storeUrl, true, username, password);\n request.open("POST", storeUrl, true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if (request.status == 200)\n callbackFn(request.responseText);\n else\n alert(config.macros.upload.messages.errorUploadingContent);\n }\n };\n request.setRequestHeader("Content-Length",data.length);\n request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);\n request.send(data); \n};\n\n\nconfig.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir, \n username, password) {\n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n try {\n if (uploadUrl.substr(0,4) == "http") {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");\n }\n else {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n }\n } catch (e) { }\n //request.open("GET", document.location.toString(), true, username, password);\n request.open("GET", document.location.toString(), true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if(request.status == 200) {\n config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl, \n uploadToFilename, uploadDir, uploadBackupDir, username, password);\n }\n else\n alert(config.macros.upload.messages.errorDownloading.format(\n [document.location.toString()]));\n }\n };\n request.send(null);\n};\n\n//}}}\n////===\n\n////+++!![Initializations]\n\n//{{{\nconfig.lib.options.init('txtUploadStoreUrl','store.php');\nconfig.lib.options.init('txtUploadFilename','');\nconfig.lib.options.init('txtUploadDir','');\nconfig.lib.options.init('txtUploadBackupDir','');\nconfig.lib.options.init('txtUploadUserName',config.options.txtUserName);\nconfig.lib.options.init('pasUploadPassword','');\nconfig.shadowTiddlers.UploadPluginDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadPluginDoc ]]\sn"; \n\n\n//}}}\n////===\n\n////+++!![Core Hijacking]\n\n//{{{\nconfig.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;\nconfig.macros.saveChanges.label = config.macros.upload.label.saveToDisk;\n\nconfig.macros.saveChanges.handler_orig_UploadPlugin = config.macros.saveChanges.handler;\n\nconfig.macros.saveChanges.handler = function(place)\n{\n if ((!readOnly) && (document.location.toString().substr(0,4) != "http"))\n createTiddlyButton(place,this.label,this.prompt,this.onClick,null,null,this.accessKey);\n}\n\n//}}}\n////===
<div class="toolbar" macro="toolbar -closeTiddler closeOthers +editTiddler permalink references jump newHere"></div>\n<div class="tagglyTagged" macro="hideSomeTags"></div>\n<div><span class="title" macro="view title"></span><span class="miniTag" macro="miniTag"></span></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="viewer" macro="view text wikified"></div>\n<div class="tagglyTagging" macro="tagglyTagging"></div>
Save your updated TiddlyWiki or create a new one:\n|User:|<<option txtUploadUserName>>|\n|Password:|<<option pasUploadPassword>>|\n\n<<upload '/cgi-bin/vhstore.cgi' 'index.html' . .>>\n
/***\n|''Name:''|VirtualHostPlugin|\n|''Description:''|Save or create tiddlywiki website|\n|''Version:''|1.0|\n|''Date:''|2006-09-11|\n|''Documentation:''|[[VirtualHostPluginDoc]]|\n|''Author:''|Luc Deschenaux|\n|''License:''|GPL2|\n|''~CoreVersion:''|2.0.0|\n|''Require:''|[[UploadPlugin|http://tiddlywiki.bidix.info/#UploadPlugin]] |\n***/\n//{{{\nversion.extensions.VirtualHostPlugin = {\n major: 1, minor: 0, revision: 0, \n date: new Date(2006,11,9),\n source: '',\n documentation: '',\n author: 'Luc Deschenaux',\n license: 'GPL2',\n coreVersion: '2.0.0',\n browser: ''\n};\n//}}}\n////+++!!![Override UploadPlugin default options]\n//{{{\nconfig.options.txtUploadStoreUrl='/cgi-bin/vhstore.cgi';\nconfig.options.txtUploadFilename='index.html';\nconfig.options.txtUploadDir='.';\nconfig.options.txtUploadBackupDir='backup';\nconfig.options.txtUploadUserName="www";\n//}}}\n////===\n////+++!!![Override UploadPlugin Notification Messages]\n//{{{\nconfig.macros.upload.label = {\n promptOption: "Save and Upload this TiddlyWiki with VirtualHostUploadOptions",\n promptParamMacro: "Save and Upload this TiddlyWiki",\n saveLabel: "save to web", \n saveToDisk: "save to disk",\n uploadLabel: "upload" \n};\n\nconfig.macros.upload.handler = function(place,macroName,params){\n // parameters initialization\n var storeUrl = params[0];\n var toFilename = params[1];\n var backupDir = params[2];\n var uploadDir = params[3];\n var username = params[4];\n var password; // for security reason no password as macro parameter\n var label;\n if (document.location.toString().substr(0,4) == "http")\n label = this.label.saveLabel;\n else\n label = this.label.uploadLabel;\n var prompt;\n if (storeUrl) {\n prompt = this.label.promptParamMacro;\n }\n else {\n prompt = this.label.promptOption;\n }\n createTiddlyButton(place, label, prompt, \n function () {\n config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password); \n return false;}, \n null, null, this.accessKey);\n};\n\nconfig.macros.upload.notify = function (msg,data,storeUrl,toFilename,uploadDir,backupDir,username) {\n\n if (toFilename=='') toFilename='index.html'\n\n switch(msg) {\n case 'aboutToUpload':\n data=toFilename;\n displayMessage(config.macros.upload.messages.aboutToUpload.format([data]),data);\n break;\n case 'rssFileNotUploaded':\n displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([data]));\n break;\n case 'rssFileUploaded':\n displayMessage(config.macros.upload.messages.rssFileUploaded.format([data]), data);\n break;\n case 'fileNotUploaded': \n data=toFilename;\n displayMessage(config.macros.upload.messages.fileNotUploaded.format([data]));\n break;\n case 'mainFileUploaded':\n displayMessage(config.macros.upload.messages.mainFileUploaded.format([data]), data);\n break;\n case 'backupFileStored':\n displayMessage(config.macros.upload.messages.backupFileStored.format([data]), data);\n break;\n }\n}\n\n//}}}\n////===\n\n
VirtualHostPlugin allows your TiddlyWiki users to create their own TiddlyWiki website\non your server in a few clicks using optionally virtual hosting capabilities from [[apache]] or [[lighttpd]]\nIt is made of:\n#A panel ([[VirtualHostUploadOptions]]) to create a new website or save changes to web using the BidiX UploadPlugin\n#A unix shell script [[vhstore.cgi]] replacing store.cgi (working with [[openwrt|http://www.openwrt.org]]), that handle both normal* "save to web" functionality and dynamic website creation ala [[TiddlySpot|http://tiddlyspot.com]]\n(* to enable normal behaviour, you have to create a symbolic link (ln -s . <user>) in the web server document root directory defined in vhstore.cgi: WWWROOT)\n////+++!![HOW IT WORKS]\nWhen you "save to web" using the UploadPlugin with the [[UploadService]] script [[vhstore.cgi]], that you specify a non-existing username, and that you are allowed to create a new website (see [[vhstore.cgi]] configuration) :\n#A new user is created. (ie: The password you specify is stored on the server in the file specified in [[vhstore.cgi]])\n#The current TiddlyWiki is uploaded to /var/www/<user>/htdocs/ or /var/www/htdocs/<user> (defined in [[vhstore.cgi]]) and will be accessible through http://www.yourdomain.dyndns.org/user (default), or http://user.your.domain.dyndns.org if you setup virtual hosting\n////===\n////+++![INSTALLATION]\n# Copy [[vhstore.cgi]] in your cgi-bin directory\n# Create the password file (default: /etc/twpasswd) and set the owner/group and permissions so that the cgi has read/write access to it, or add "<user>:<password>" entries manually\n# Set the new website creation policy:\n## Set the password to create a new website: echo '*:<password>' >> /etc/twpasswd\n## or disable password verification with: echo '*:*' >> /etc/twpasswd\n## To disable virtual host creation, remove the '*: ...' entry from /etc/twpasswd (default) or comment VHSTOREPASSWORD= in the cgi\n# Setup Virtual Hosting on your web server (see below)\n## If you are using full hostnames instead of usernames for your virtual hosts subdirectories (eg: using [[lighttpd]] with module mod_simple_vhost), you must set the DOMAIN variable in [[vhstore.cgi]]\n\nAdd this to your [[SideBarOptions]]:\n//{{{\n<<upload '/cgi-bin/vhstore.cgi' 'index.html' . .>>\n//}}}\nAdd this to your [[OptionsPanel]]\n//{{{\nYour upload username / password:\n\n<<option txtUploadUserName>>\n<<option pasUploadPassword>>\n//}}}\n////===\n////+++!![SETTING UP VIRTUAL HOSTING]\nIn order to get virtual hosting working (ie: to be able to reach your site through http://user.yourdomain.net/) you need to modify your web server configuration (see below) , to change the value for WWWROOT and DOMAIN in [[vhstore.cgi]], and to set a password in /etc/twpasswd or in option VHSTOREPASSWORD (see vhstore.cgi). You need also to enable wildcards for your domain name in your DNS server configuration.\n////+++!!![lighttpd configuration]\n\nReference: http://trac.lighttpd.net\n\n@@Using mod_evhost:@@\n//{{{\n# define a pattern for the host url finding\n# %% => % sign\n# %0 => domain name + tld\n# %1 => tld\n# %2 => domain name without tld\n# %3 => subdomain 1 name\n# %4 => subdomain 2 name\n#\n evhost.path-pattern = "/var/www/%3/htdocs/"\n//}}}\n@@Using mod_simple_vhost and mod_rewrite@@\n//{{{\nsimple-vhost.server-root = "/var/www/"\nsimple-vhost.default-host = "localhost"\nsimple-vhost.document-root = "/htdocs/"\n\nurl.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )\nalias.url = ( "/cgi-bin/" => "/var/www/cgi-bin/" )\n//}}}\n////===\n////+++!!![Apache-1.3 configuration]\n\nReference: [[Simple dynamic virtual hosts for apache-1.3|http://httpd.apache.org/docs/1.3/vhosts/mass.html#simple]]\n\n@@using mod_vhost_alias@@\n//{{{\n# get the server name from the Host: header\nUseCanonicalName Off\n\n# this log format can be split per-virtual-host based on the first field\nLogFormat "%V %h %l %u %t \s"%r\s" %s %b" vcommon\nCustomLog logs/access_log vcommon\n\n# include the server name in the filenames used to satisfy requests\nVirtualDocumentRoot /var/www/%1/htdocs\nVirtualScriptAlias /var/www/cgi-bin\n\n//}}}\n////===\n////+++![WEB SERVER DIRECTORIES]\n!!!1 - With virtual hosts enabled\n WWWROOT=/var/www\n DOMAIN=.mydomain.dyndns.org\n@@A: Using full server name in web server virtual hosts configuration@@\n//{{{\n# create a symbolic link for user "www"\n/var/www/:\n cgi-bin/\n localhost/\n mydomain.dyndns.org -> localhost\n www.mydomain.dyndns.org -> localhost \n\n/var/www/cgi-bin:\n vhstore.cgi\n\n/var/www/localhost:\n htdocs/\n\n/var/www/localhost/htdocs:\n index.html\n//}}}\n@@B: Using first part of domain name only (user name)@@\n//{{{\n# create a symbolic link for user "www"\n/var/www/:\n cgi-bin/\n localhost/\n mydomain -> localhost\n www -> localhost \n\n/var/www/cgi-bin:\n vhstore.cgi\n\n/var/www/localhost:\n htdocs/\n\n/var/www/localhost/htdocs:\n index.html\n//}}}\n\n!!! 2 - No virtual hosts (homepage style)\nWWWROOT=/var/www/localhost/htdocs\nDOMAIN=""\n@@Create symbolic link for user admin:@@\n//{{{\n/var/www/:\n cgi-bin/\n localhost/\n\n/var/www/cgi-bin:\n vhstore.cgi\n\n/var/www/localhost:\n htdocs/\n\n/var/www/localhost/htdocs:\n admin -> .\n index.html\n//}}}\n////===\n////===\n////+++![vhstore.cgi]\n<<tiddler vhstore.cgi>>\n////===\n\n\n
!Options used by UploadPlugin\n|Username:|<<option txtUploadUserName>>|\n|Password:|<<option pasUploadPassword>>|\n|Url of the UploadService script^^(1)^^:|<<option txtUploadStoreUrl 50>>|\n|Relative Directory where to store the file^^(2)^^:|<<option txtUploadDir 50>>|\n|Filename of the uploaded file^^(3)^^:|<<option txtUploadFilename 40>>|\n|Directory to backup file on webserver^^(4)^^:|<<option txtUploadBackupDir>>|\n\n^^(1)^^Mandatory either in UploadOptions or in macro parameter\n^^(2)^^If empty stores in the user root directory\n^^(3)^^If empty takes the actual filename\n^^(4)^^If empty existing file with same name on webserver will be overwritten\n\n<<upload>> with these options.
This document is a ~TiddlyWiki from tiddlyspot.com. A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.\nFind out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]]. Also visit [[TiddlyWiki Guides|http://tiddlywikiguides.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help.\n\n@@font-weight:bold;font-size:1.3em;color:#444; //Settings// &nbsp;&nbsp;@@Make sure you enter your password here.\n<<tiddler tiddlyspotControls>>\n@@font-weight:bold;font-size:1.3em;color:#444; //Working online// &nbsp;&nbsp;@@ You can edit this ~TiddlyWiki right now, and save your changes using the "save to web" button in the column on the right.\n\n@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// &nbsp;&nbsp;@@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick. You can make changes and save them locally without being connected to the Internet. When you're ready to sync up again, just click "upload" and your ~TiddlyWiki will be saved back to tiddlyspot.com.\n\n@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy!// &nbsp;&nbsp;@@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments.
This command replace sed for parsing the form data when saving the page to web through vhstore.cgi\n\nYou can download a binary version for i686 and mips architectures (mips is for openwrt/freewrt routers) here: http://www.basirc.ath.cx/openwrt/form-data-1.1.tar.gz\n\n//{{{\n/*\n * ** -----------------------------------------------------------------------------**\n * ** form-data.c version 1.1\n * **\n * ** Copyright 2007 Luc Deschenaux\n * **\n * ** -----------------------------------------------------------------------------**\n * ** form-data.c is free software; you can redistribute it and/or modify it under\n * ** the terms of the GNU General Public License as published by the Free Software\n * ** Foundation; either version 2 of the License, or (at your option) any later version.\n * ** \n * ** elphelContextHelp.js is distributed in the hope that it will be useful,\n * ** but WITHOUT ANY WARRANTY; without even the implied warranty of\n * ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * ** GNU General Public License for more details.\n * ** \n * ** You should have received a copy of the GNU General Public License\n * ** along with elphelContextHelp.js; if not, write to the Free Software\n * ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n * ** -----------------------------------------------------------------------------**\n * */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\n#include <string.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n\nchar *USAGE="usage: form-data <headers_output_filename> <boundary> <nextline_substring> [<nextline_substring> ...] <input_file>\sn";\n\nchar *memstr(char *buf,size_t len,char *str) {\n\n size_t p=0;\n size_t i=0;\n size_t slen=strlen(str);\n\n while (p<len) {\n if (buf[p]==str[i]) {\n ++i;\n if (i==slen) {\n return buf+p-i+1;\n }\n\n } else {\n if (i) {\n i=0;\n continue;\n }\n }\n ++p;\n }\n\n if (i>0) {\n return (char*)-1;\n }\n return 0;\n}\n\nint main(int argc,char **argv) {\n\n char *c;\n char *buf;\n int level=2;\n int lasterrlevel=0;\n size_t offset;\n char *boundary;\n FILE *f;\n FILE *outf;\n int header;\n char *header_filename;\n unsigned long start;\n size_t r=0;\n size_t w;\n\n if (argc<4) {\n fprintf(stderr,"%s",USAGE);\n exit(1);\n }\n\n//if i call fopen after strcpy, the content of var boundary is garbled !!??\n//using gcc version 4.1.1 (Gentoo 4.1.1) and gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)\n\n if (!strcmp(argv[argc-1],"-")) {\n f=stdin;\n } else if (!(f=fopen(argv[argc-1],"r"))) {\n fprintf(stderr,"form-data: cant open file (%d)",errno);\n exit(1);\n }\n\n header_filename=argv[1];\n if ((header=open(header_filename,O_WRONLY|O_TRUNC|O_CREAT))==-1) {\n fprintf(stderr,"form-data: cant open %s for writing (%d)",header_filename,errno);\n exit(1);\n }\n\n// gdb output confirms the bug:\n//102 if (!(header=fopen(header_filename,"w"))) {\n//(gdb) print boundary\n//$1 = 0x804b170 "\sr\sn", '-' <repeats 29 times>, "AaB03x"\n//(gdb) step\n//108 fprintf(header,"%s",buf);\n//(gdb) print boundary\n//$2 = 0x804b170 "\sr\sn", '-' <repeats 18 times>, "i\s001"\n//\n buf=malloc(8192);\n if (!buf) {\n fprintf(stderr,"form-data: out of memory !");\n exit(1);\n }\n//-------------------\n boundary=malloc(strlen(argv[2]+16));\n if (!boundary) {\n exit(1);\n }\n boundary[0]='\sr';\n boundary[1]='\sn';\n boundary[2]='-';\n boundary[3]='-';\n// strcpy here works.. \n strcpy(boundary+4,argv[2]);\n//---------------------------------------\n//\n while(level<(argc-1)) {\n\n c=fgets(buf,4096,f);\n if ((!c) || (feof(f))) {\n fprintf(stderr,"form-data: eof1\sn");\n exit(1);\n }\n\n c=strstr(buf,argv[level]);\n if (c) {\n fprintf(stderr,"form-data: got %s at 0x%lx\sn",argv[level],(unsigned long)(c-buf)+ftell(f)-strlen(buf)+3);\n ++level;\n lasterrlevel=0;\n\n } else {\n if (level!=lasterrlevel) {\n fprintf(stderr,"form-data: no match for %s\sn",argv[level]);\n lasterrlevel=level;\n }\n level=2;\n }\n }\n\n do {\n write(header,buf,strlen(buf));\n c=fgets(buf,4096,f);\n if ((!c) || (feof(f))) {\n fprintf(stderr,"form-data: eof2\sn");\n exit(1);\n }\n } while((buf[0]!='\sx0d') || (buf[1]!='\sx0a') || (buf[2]));\n close(header);\n\n outf=stdout;\n c=0;\n offset=0;\n start=ftell(f);\n fprintf(stderr,"form-data: data start at 0x%lx\sn",start);\n while(!feof(f) && !c) {\n if (offset) {\n memmove(buf,buf+r,offset);\n }\n if(!(r=fread(buf+offset,1,4096-offset,f))) {\n if (!feof(f)) {\n fprintf(stderr,"form-data: read error\sn");\n }\n break;\n }\n r+=offset;\n offset=0;\n if ((c=memstr(buf,r,boundary))) {\n if (c==(char*)-1) {\n c=0;\n if (buf+r-strlen(boundary)>buf) {\n offset=strlen(boundary);\n r-=offset;\n } else {\n fprintf(stderr,"You are doomed!\sn");\n exit(1);\n }\n } else {\n unsigned long pos=(unsigned long)(c-buf)+ftell(f)-r;\n fprintf(stderr,"form-data: got trailer at 0x%lx, data length=%lu\sn",pos,pos-start+1);\n r=(size_t)(c-buf);\n }\n }\n if ((w=fwrite(buf,1,r,outf))!=r) {\n fprintf(stderr,"form-data: write error\sn");\n exit(1); \n }\n }\n\n fflush(outf);\n\n if ((!c) || (c==(char*)-1)) {\n fprintf(stderr,"nomatch\sn");\n return 1;\n } \n return 0;\n}\n//}}}
| tiddlyspot password:|<<option pasUploadPassword>>|\n| site management:|<<upload http://luxigo.tiddlyspot.com/store.cgi index.html . . luxigo>>//(requires tiddlyspot password)//<<br>>[[control panel|http://luxigo.tiddlyspot.com/controlpanel]], [[download (go offline)|http://tiddlyspot.com/download/luxigo]]|\n| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://tiddlyspot.com/faq/]], [[announcements|http://tiddlyspot.com/announce/]], [[blog|http://tiddlyspot.com/blog/]], [[email feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|
//{{{\n#!/bin/sh\n# vhstore.cgi 1.1-20070609 - Save your updated TiddlyWiki or create a new one\n# Copyright (C) 2006 Luc Deschenaux\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n#\n# See the GNU General Public License for more details:\n# http://www.gnu.org/copyleft/gpl.html\n\n# History:\n# 2007/06/09 - Replaced sed with form-data for stability\n# 2006/09/11 - Remove extra CR when using sed/busybox\n# 2006/09/01: - Save in a temporary file first\n# 2006/08/31: - Added GET request method handler to return the destination file path\n# - Hidden password in alert box\n# 2006/08/28: First Release - works with ash/busybox/openwrt\n#\n# Notes:\n# The form-data Content-length is ignored because it doesnt match the document length.\n# (always 24 bytes diff?)\n\n\nPATH=/usr/local/bin:$PATH\nset -e\n\n####### store.cgi configuration #######\n\n# Uncomment the next line to trace cgi execution in web server error log for debugging \nset -x\n\n# WWWROOT\n#\n# * If you want to create virtual hosts for new users, WWWROOT must point\n# the real www root directory, eg: WWWROOT=/var/www\n# * If you want user homepage style urls for new users, WWWROOT must point\n# the default 'htdocs' directory\nWWWROOT=/var/www\n\n# Check passwords\nAUTHENTICATE_USER=true\n\n# TWPASSWDFILE - name of the password file\n# Password file format: <user>:<password>\nTWPASSWDFILE=/etc/twpasswd\n\n# VHSTOREPASSWORD\n# * When there is a user "*" in the password file, new website creation is enabled\n# * When his password is "*", you dont need a password to create a new website\n# * When a password has been specified for user "*" ("*:<password>"), you need to\n# specify <this_password>:<new_site_password> to create a new website (ie: saving\n# with a new username)\n# * On the other hand, you can just set VHSTOREPASSWORD manually here:\nVHSTOREPASSWORD=`egrep '^\s*:' $TWPASSWDFILE` || true \n\n# DOMAIN \n# If you need to append the domain name to the user name,\n# (it depends on your web server virtual hosting configuration)\n# for example if you are using lighttpd with mod_simple_vhost,\n# uncomment the next two lines and specify the domain name to use\nDOMAIN=.mydomain.com\n[ -n "$DOMAIN" ] && DOMAIN=$DOMAIN/htdocs \n\n# If you did setup virtual hosting, and that it is using only the first\n# part of the domain name, comment the two lines above and uncomment\n# the following one:\n#DOMAIN=/htdocs\n\n# Adapt this function to your needs\nhostAllowedToCreateNewSite() {\n return 0\n# echo $REMOTE_ADDR | egrep -q '^127\s.' && return 0\n# echo $REMOTE_ADDR | egrep -q '^192\s.168\s.' && return 0\n# echo $REMOTE_ADDR | egrep -q '^10\s.' && return 0\n# return 1\n}\n\n###### nothing to change below this line ######\n\n# those default values are overriden \nTWUPLOADDIR='.'\nTWBACKUPDIR='.'\n\n_exit() {\n echo "$1"\n# rm /tmp/*.$$.tmp 2> /dev/null || true\n exit 1\n}\n\n#env > /tmp/vhstore.env\necho Content-type: text/plain\necho\n\nif [ "$REQUEST_METHOD" = "GET" ] ; then\n\n for parm in `echo $QUERY_STRING | sed -r -e 's/&/ /g'` ; do\n\n name=`echo $parm | cut -f 1 -d =`\n value=`echo $parm | cut -f 2 -d = | urldecode`\n \n [ -z "$value" ] && continue\n \n case "$name" in \n user)\n TWUSER=$value ;;\n uploaddir)\n TWUPLOADDIR=$value ;; \n filename)\n TWFILENAME=$value ;;\n esac\n done\n\n if [ -z "$TWFILENAME" ] ; then\n TWFILENAME=index.html\n fi\n\n echo "$TWUSER $TWUPLOADDIR $TWFILENAME" | grep -q '\s.\s.' && exit 0\n\n TWBASEFILENAME=`basename $TWFILENAME .html`\n TWBASEFILENAME=`basename $TWBASEFILENAME .htm`\n TWFILENAME=$TWBASEFILENAME.html\n\n echo `echo $SERVER_NAME | sed -r -e 's/\s:[0-9]+$//'`:$WWWROOT/$TWUSER$DOMAIN/$TWUPLOADDIR/$TWFILENAME | sed -r -e 's/\s/\s.?\s//\s//g'\n exit 0\n\nfi\n\nPOSTDATA=/tmp/store.$$.tmp\ncat > $POSTDATA\n \n(\n\nif ! paramlist=`form-data /dev/null -----------------------------AaB03x UploadPlugin $POSTDATA | tr ';' ' '` ; then\n _exit 'Error : cant parse form-data [1]'\nfi\n\nfor p in $paramlist ; do\n\n name=`echo $p | cut -f 1 -d =`\n value=`echo $p | cut -f 2 -d =`\n [ -z "$value" ] && continue\n\n case "$name" in\n backupDir)\n TWBACKUPDIR=$value ;;\n user)\n TWUSER=$value ;;\n password)\n TWPASSWORD=$value ;;\n uploaddir)\n TWUPLOADDIR=$value ;;\n esac\n\ndone\n\nif [ "$TWUSER" = '*' ] ; then\n _exit "Error : Invalid username"\nfi\n\nUSERFILE=/tmp/userfile.$$.tmp\nHEADERFILE=/tmp/header.$$.tmp\n\nif ! form-data $HEADERFILE -----------------------------AaB03x userfile $POSTDATA > $USERFILE ; then\n _exit 'Error : cant parse form-data [2]'\nfi\n \nif ! TWFILENAME=`sed -r -n -e 's/.* filename="([^\s"]*).*/\s1/p' -e q $HEADERFILE` ; then\n _exit 'Error : cant parse form-data [3]'\nfi\n\n# Content-Length seems to be wrong=unusable (with uploadPlugin 3.4.1 Aug 19, 2006)\nif ! TWFILELENGTH=`sed -r -n -e '/^Content-Length:/!b' -e 's/^Content-Length: ([0-9]+).*/\s1/p' -e q $HEADERFILE` ; then\n _exit 'Error : cant parse form-data [4]'\nfi\n\nif [ -z "$TWFILENAME" ] ; then\n TWFILENAME=index.html\nfi\n\n# for security\n\nif echo "$TWUSER $TWUPLOADDIR $TWFILENAME $TWBACKUPDIR" | grep -q '\s.\s.' ; then\n _exit "Error : File, Directory or user name contains '..'"\nfi\n\nTWBASEFILENAME=`basename $TWFILENAME .html`\nTWBASEFILENAME=`basename $TWBASEFILENAME .htm`\nTWFILENAME=$TWBASEFILENAME.html\n\nif $AUTHENTICATE_USER ; then\n\n if [ -z "$TWUSER" ] ; then\n _exit "Error : empty username"\n fi\n\n if [ -z "$TWPASSWORD" ] ; then\n _exit "Error : empty password"\n fi\n\n if ! egrep -q "^$TWUSER:" $TWPASSWDFILE ; then\n\n if [ -z "$VHSTOREPASSWORD" ] ; then\n _exit "Error : New website creation is disabled"\n fi\n \n [ "$VHSTOREPASSWORD" != "*:*" ] && [ "`echo $TWPASSWORD | cut -f 1 -d :`" != "`echo $VHSTOREPASSWORD | cut -f 2 -d :`" ] && _exit "Error : Invalid password for Website creation."\n\n TWPASSWORD=`echo $TWPASSWORD | cut -f 2 -d :`\n if hostAllowedToCreateNewSite ; then\n touch $TWPASSWDFILE \n chmod go-rwx $TWPASSWDFILE\n echo $TWUSER:$TWPASSWORD >> $TWPASSWDFILE\n fi\n fi\n\n if [ -z "$TWUSER" ] || ! egrep -q "^$TWUSER:" $TWPASSWDFILE || [ -z "$TWPASSWORD" ] || [ "`egrep "^$TWUSER:" $TWPASSWDFILE | cut -f 2 -d :`" != "$TWPASSWORD" ] ; then\n echo "Error : UserName or Password do not match"\n _exit "UserName : $TWUSER Password : ********"\n fi\n\nfi\n\nif ! cd $WWWROOT ; then\n _exit "Error : couldnt change directory to '$WWWROOT'"\nfi\n\nif [ "$TWBACKUPDIR" != '.' ] && [ -f "./$TWUSER$DOMAIN/$TWFILENAME" ] ; then\n if ! mkdir -p ./$TWUSER$DOMAIN/$TWBACKUPDIR ; then\n _exit "Error : Cannot create directory '$TWBACKUPDIR'"\n fi\n\n backupfile=$TWBACKUPDIR/$TWBASEFILENAME-`date +%Y%m%d%H%M%S`.html\n if ! cp ./$TWUSER$DOMAIN/$TWFILENAME ./$TWUSER$DOMAIN/$backupfile ; then\n _exit "Error : Cannot create '`pwd`/$TWUSER$DOMAIN/$backupfile'"\n fi\nfi\n\nif ! mkdir -p ./$TWUSER$DOMAIN/$TWUPLOADDIR ; then\n _exit "Error : Cannot create directory '`pwd`/$TWUSER$DOMAIN/$TWUPLOADDIR'"\nfi\n\nif [ ! -s "$USERFILE" ] ; then\n _exit "Error : Upload failed !"\nfi\nmv $USERFILE $TWUSER$DOMAIN/$TWUPLOADDIR/$TWFILENAME\n\nrm /tmp/*.$$.tmp 2> /dev/null || true\n\necho 0\necho -n destfile:$WWWROOT/$TWUSER$DOMAIN/$TWUPLOADDIR/$TWFILENAME | sed -r -e 's/\s/\s.?\s//\s//g'\n#echo -n ", size:$TWFILELENGTH real: `wc -c $TWUSER$DOMAIN/$TWUPLOADDIR/$TWFILENAME`"\necho\n\n) || [ -f "$POSTDATA" ] && _exit "Error : see web server error log for details"\n//}}}