config.options.chkHttpReadOnly = false;\n
!Expected this week (Jul 2007) to come up with a new implementation of the server files compatible with Moodle 1.7 and above\n!Notice: The server files work only in Moodle 1.6 due to the new moodle kernel roles feature\nWe are working on a Moodle 1.7 - 1.8 version.\nThe demo server only works with the Guest user. \nThe new [[SynchronizePlugin]] is released!!!\nThe IE6 and IE7 syntax error for the SynchronizePlugin is fixed, but it's ''strongly recommended'' that you use ''Firefox'' instead of IE.\nNew versions of the [[ExportTiddlersToDFwikiPlugin]] and the [[ImportDFwikisPlugin]] are released too.
DFWIKI is a project conceived and leaded by Ludo ( Marc Alier malier@lsi.upc.edu)\nto build a new wiki wiki module for moodle. I started on Feb 2005 and still goes on \nnow at late 2006.\n\nThis alternative Wiki module (called also new wiki) is the evolution of DFWiki to fit \nin Moodle 1.6 replacing the standard wiki module. The Moodle roadmap places n wiki \nas the oficial Wiki module for Moodle 1.8.\n \nAll the dfwiki development has been done within the frame of degree projects in\nthe Computer Science Engineering studies in the FIB school "http://www.fib.upc.edu" \nof the UPC University "http://www.upc.edu"\n\nThe main developers that have worked in this project are\n* Ferran Recio \n* David Castro \n* Jordi Piguillem Poch\n* Bernardino Todoli\n\nAnd a growing number of students that contributes to this project http://docs.moodle.org/en/Dfwikiteam\n\nDFWiki has two paralel projects :\nThe dfwiki Course . Wich alows to place a wiki in the main course page (even in the \nMoodle main course)\nThe wikiBook Module ( in development and soon released ) that allows to create a \nordered and due noted seqüence of pages out of a chaotic wiki. It also will allow \nto place metadata, and export to formats like docBook, pdf, scorm and so on.\n\nDFWiki has the same license as moodle, whatever it is wink\nFind dfwiki news in moodle.org in "using moodle"-> wiki forum and in the \nnew dfwiki home page. http://morfeo.upc.edu/crom\n\nLudo (Marc Alier) \nmalier@lsi.upc.edu\nhttp://www.lsi.upc.edu/~malier\n\nMore Infor and Downloads on [[DFWikiLabs|http://morfeo.upc.edu/crom]]\n\n\n
All the projects inspired and related to [[DFWiki]] have been done within the frame of degree projects in the Computer Science Engineering studies in the FIB school [[http://www.fib.upc.edu]] of the UPC University [[http://www.upc.edu]]\n\nThe main developers that have worked in this project are\n* [[Ludo(Marc Alier)]] \n* Jordi Piguillem Poch - [[Pigui]]\n* [[Ferran Recio]] \n* [[David Castro]] \n* Bernardino Todoli\n* Agatha Prats \n* ups.. I'm forgeting lots of names... And a growing number of students that contributes to this project http://docs.moodle.org/en/Dfwikiteam\n\n ImportDFwikisPlugin is a DFWikiTeam Project conducted by \n*[[Oriol Nieto]]\n*[[Alejandro Moreno]]\nAnd maybe more infomration in [[our blogs]]\n
BreakingNews\n[[Syncronize Moodle NWiki with your Tiddlywiki]]\n[[License And Legal Aspects]]
DefaultTiddlers\n[[tiddlyspotControls]]\nSideBarOptions\nMainMenu\n\n
<<exportDFwikis inline>>
/***\n|''Name:''|ExportTiddlersToDFwikisPlugin|\n|''Author:''|[[Oriol Nieto|http://enochrooted.blogspot.com/]] , [[Alejandro Moreno|http://vdemarvvv.blogspot.com/]], Dídac Calventus & [[Ludo( Marc Alier)|http://www.lsi.upc.edu/~malier/]]|\n|''Another production of:''|[[dfwikiteam|http://morfeo.upc.es/crom/]] [[Universitat Politècnica de Catalunya|http://www.upc.edu]]|\n|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/ as described in the license document http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html#%5B%5BLicense%20And%20Legal%20Aspects%5D%5D]]|\n|''~CoreVersion:''|2.1.2|\n|''~PluglinVersion:''|1.3|\n|''Download latest version from''|http://moodle.tiddlyspot.com#ExportTiddlersToDFwikiPlugin|\n|''Moodle wiki server side files''|http://morfeo.upc.edu/crom|\n/***\n\nThis plugin lets you export tiddlers into dfwiki pages of a moodle 1.6.X with the nwiki module installed.\nLog-in with your moodle username and pasword and click "get info" to begin the interactive process of exporting tiddlers.\n\nYou need to install the Moodle wiki server side files. You can find them in http://morfeo.upc.edu/crom.\n\nIt's ''strongly recommended'' that you use ''Firefox'' (or any netscape based navigator) instead of IE in order to avoid security problems.\n\nIf anyway you want to use IE, you'll have to turn down all security parameters.\n\n!!!!!Inline interface (live)\n<<<\n<<exportDFwikis inline>>\n<<<\n!!!!!Credits \n<<<\nThis plugin is a derivative of http://www.TiddlyTools.com/#ExportTiddlersPlugin, created by Eric L.Shulman and/or ELS Design Studios, and is subject to all terms and conditions as described in http://www.TiddlyTools.com/#LegalStatements as well as all other terms and conditions as described in this document.\n<<<\n!!!!!Usage\n<<<\nOptional "special tiddlers" used by this plugin:\n* MoodleSource^^\nIndicates the source of the moodle distribution that you wanna export to.\ndefault: //none//^^\n<<<\n!!!!!Revision History\n<<<\n''2006.12.09 [1.3]''\nAdded a new optional part of the panel compatible with wiki with groups.\n''2006.11.27 [1.2]''\nAJAX interaction is recieved in XML format (Solve some names problems).\n''2006.11.15 [1.1]''\nImproved and interactive interface.\n''2006.11.15 [1.0]''\nFirst release\n''2006.11.09 [0.0]''\ndevelopment started\n<<<\n!!!!!Code\n***/\n// // +++[version]\n//{{{\nversion.extensions.exportDFwikis = {major: 2, minor: 2, revision: 3, date: new Date(2006,10,12)};\n//}}}\n// //===\n\n// // +++[macro handler]\n//{{{\nconfig.macros.exportDFwikis = {\n label: "export tiddlers to moodle",\n prompt: "Copy selected tiddlers to a moodle",\n datetimefmt: "0MM/0DD/YYYY 0hh:0mm:0ss", // for "filter date/time" edit fields\n callNumber: "0",\n info: "",\n username: "",\n transition: "no" , //to select if we've to call the export function or the transaction event (groups->users)\n selectedWiki: "" ,\n selectedWikiGroups: "", //Wiki just before filling the users/groups select\n selectedGroup: "",\n selectedUser: "",\n selectedCourse: ""\n \n};\n\nconfig.macros.exportDFwikis.handler = function(place,macroName,params) {\n if (params[0]!="inline")\n { createTiddlyButton(place,this.label,this.prompt,onClickExportDFwikiMenu); return; }\n var panel=createExportDFwikiPanel(place);\n panel.style.position="static";\n panel.style.display="block";\n}\n\nfunction createExportDFwikiPanel(place) {\n var panel=document.getElementById("exportPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.exportDFwikis.css,"exportDFwikis");\n panel=createTiddlyElement(place,"span","exportPanel",null,null)\n panel.innerHTML=config.macros.exportDFwikis.html;\n exportInitFilter();\n refreshExportDFwikiList(0);\n var MoodleSource=store.getTiddlerText("MoodleSource"); if (!MoodleSource) MoodleSource="";\n document.getElementById("exportMoodleServer").value=MoodleSource;\n return panel;\n}\n\nfunction onClickExportDFwikiMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("exportPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createExportDFwikiPanel(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 if (panel.style.display!="none") refreshExportDFwikiList(0); // update list when panel is made visible\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return(false);\n}\n//}}}\n// //===\n\n// // +++[Hijack saveChanges] diverts 'notFileUrlError' to display export control panel instead\n//{{{\nwindow.coreSaveDFwikiChanges=window.saveDFwikiChanges;\nwindow.saveDFwikiChanges = function()\n{\n if (document.location.protocol=="file:") { coreSaveDFwikiChanges(); return; }\n var e = window.event;\n var parent=e?resolveTarget(e).parentNode:document.body;\n var panel = document.getElementById("exportPanel");\n if (panel==undefined || panel.parentNode!=parent) panel=createExportDFwikiPanel(parent);\n if (parent==document.body) { panel.style.left="30%"; panel.style.top="30%"; }\n panel.style.display = "block" ;\n}\n//}}}\n// //===\n\n// // +++[IE needs explicit scoping] for functions called by browser events\n//{{{\nwindow.onClickExportDFwikiMenu=onClickExportDFwikiMenu;\nwindow.onClickExportDFwikiButton=onClickExportDFwikiButton;\nwindow.exportShowDFwikiFilterFields=exportShowDFwikiFilterFields;\nwindow.refreshExportDFwikiList=refreshExportDFwikiList;\n//}}}\n// //===\n\n// // +++[CSS] for floating export control panel\n//{{{\nconfig.macros.exportDFwikis.css = '\s\n#exportPanel {\s\n display: none; position:absolute; z-index:12; width:35em; right:105%; top:6em;\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#exportPanel a, #exportPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\s\n#exportPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\s\n#exportPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\s\n#exportPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\s\n#exportPanel select { width:100%;margin:0px;font-size:8pt;line-height:110%;}\s\n#exportPanel input { width:100%;padding:0px;margin:0px;font-size:8pt;line-height:110%; }\s\n#exportPanel textarea { width:98%;padding:0px;margin:0px;overflow:auto;font-size:8pt; }\s\n#exportPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px; }\s\n#exportPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\s\n#exportPanel .rad { width:auto;border:0 }\s\n#exportPanel .chk { width:auto;border:0 }\s\n#exportPanel .btn { width:auto; }\s\n#exportPanel .btn1 { width:98%; }\s\n#exportPanel .btn1bis { width:90%; }\s\n#exportPanel .btn2 { width:48%; }\s\n#exportPanel .btn3 { width:32%; }\s\n#exportPanel .btn4 { width:24%; }\s\n#exportPanel .btn5 { width:19%; }\s\n#groupsPanel { display:none; margin:0.5em 0em 0em 0em; }\s\n';\n//}}}\n// //===\n\n// // +++[HTML] for export control panel interface\n//{{{\nconfig.macros.exportDFwikis.html = '\s\n<!-- export to a moodle server -->\s\n<div id="exportDFwikiPanel" style="margin-top:5px;">\s\nmoodle server<br>\s\n<table cellpadding="0" cellspacing="0"><td width="80%">\s\n <input type="text" id="exportMoodleServer" onfocus="this.select()"><br>\s\n</td><td width="20%" align="right">\s\n<input type=button class="btn1bis" onclick="getMoodleInfo()"\s\n id="getMoodleInfo" value="get info!">\s\n</td></table>\s\n<table cellpadding="0" cellspacing="0" width="40%"><td>\s\n username<br>\s\n <input type="text" id="exportID" onfocus="this.select()"><br>\s\n</td><td width="40%">\s\n password<br>\s\n <input type="password" id="exportPW" onfocus="this.select()"><br>\s\n</td><td width="20%" align="right">\s\n <br>\s\n developed by\s\n</td></table>\s\n<table cellpadding="0" cellspacing="0" width="40%"><td>\s\n course<br>\s\n <select id="exportDFwikiCourse" onfocus="this.select()" onchange="continueGettingMoodleInfo(this.value)" disabled><br>\s\n </select>\s\n</td><td width="40%">\s\n wiki name<br>\s\n <select id="exportDFwikiName" onfocus="this.select()" onchange="config.macros.exportDFwikis.selectedWiki=this.value" disabled><br>\s\n </select>\s\n</td><td width="20%" align="right">\s\n <a href="http://morfeo.upc.es/crom/">\s\n <img src="http://img294.imageshack.us/img294/8712/dfwikiteamie8.jpg">\s\n </a>\s\n</td></table>\s\n</div><!--panel-->\s\n<div id="groupsPanel" style="margin-top:5px;margin-bottom:5px">\s\n <table cellpadding="0" cellspacing="0" width="40%"><td>\s\n group<br>\s\n <select id="groupbox" onfocus="this.select()" onchange="transitionInfo(this.value)" disabled><br>\s\n </select>\s\n </td><td width="40%">\s\n user<br>\s\n <select id="userbox" onfocus="this.select()" onchange="config.macros.exportDFwikis.selectedUser=this.value" disabled><br>\s\n </select>\s\n </td><td width="20%" align="right">\s\n <font color="green">\s\n ¡¡ groups info !!\s\n </font>\s\n</td></table>\s\n</div>\s\n\s\n<!-- list of tiddlers -->\s\n<table><tr align="left"><td>\s\n select:\s\n <a href="JavaScript:;" id="exportSelectChanges"\s\n onclick="onClickExportDFwikiButton(this)" title="select tiddlers changed since last save">\s\n &nbsp;changes&nbsp;</a> \s\n <a href="JavaScript:;" id="exportSelectOpened"\s\n onclick="onClickExportDFwikiButton(this)" title="select tiddlers currently being displayed">\s\n &nbsp;opened&nbsp;</a> \s\n <a href="JavaScript:;" id="exportToggleFilter"\s\n onclick="onClickExportDFwikiButton(this)" title="show/hide selection filter">\s\n &nbsp;filter&nbsp;</a> \s\n</td><td align="right">\s\n <a href="JavaScript:;" id="exportListSmaller"\s\n onclick="onClickExportDFwikiButton(this)" title="reduce list size">\s\n &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="exportListLarger"\s\n onclick="onClickExportDFwikiButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n</td></tr></table>\s\n<select id="exportList" multiple size="10" style="margin-bottom:5px;"\s\n onchange="refreshExportDFwikiList(this.selectedIndex)">\s\n</select><br>\s\n</div><!--box-->\s\n\s\n<!-- selection filter -->\s\n<div id="exportFilterPanel" style="display:none">\s\n<table><tr align="left"><td>\s\n selection filter\s\n</td><td align="right">\s\n <a href="JavaScript:;" id="exportHideFilter"\s\n onclick="onClickExportDFwikiButton(this)" title="hide selection filter">hide</a>\s\n</td></tr></table>\s\n<div class="box">\s\n<input type="checkbox" class="chk" id="exportFilterStart" value="1"\s\n onclick="exportShowDFwikiFilterFields(this)"> starting date/time<br>\s\n<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\s\n <select size=1 id="exportFilterStartBy" onchange="exportShowDFwikiFilterFields(this);">\s\n <option value="0">today</option>\s\n <option value="1">yesterday</option>\s\n <option value="7">a week ago</option>\s\n <option value="30">a month ago</option>\s\n <option value="site">SiteDate</option>\s\n <option value="file">file date</option>\s\n <option value="other">other (mm/dd/yyyy hh:mm)</option>\s\n </select>\s\n</td><td width="50%">\s\n <input type="text" id="exportStartDate" onfocus="this.select()"\s\n onchange="document.getElementById(\s'exportFilterStartBy\s').value=\s'other\s';">\s\n</td></tr></table>\s\n<input type="checkbox" class="chk" id="exportFilterEnd" value="1"\s\n onclick="exportShowDFwikiFilterFields(this)"> ending date/time<br>\s\n<table cellpadding="0" cellspacing="0"><tr valign="center"><td width="50%">\s\n <select size=1 id="exportFilterEndBy" onchange="exportShowDFwikiFilterFields(this);">\s\n <option value="0">today</option>\s\n <option value="1">yesterday</option>\s\n <option value="7">a week ago</option>\s\n <option value="30">a month ago</option>\s\n <option value="site">SiteDate</option>\s\n <option value="file">file date</option>\s\n <option value="other">other (mm/dd/yyyy hh:mm)</option>\s\n </select>\s\n</td><td width="50%">\s\n <input type="text" id="exportEndDate" onfocus="this.select()"\s\n onchange="document.getElementById(\s'exportFilterEndBy\s').value=\s'other\s';">\s\n</td></tr></table>\s\n<input type="checkbox" class="chk" id=exportFilterTags value="1"\s\n onclick="exportShowDFwikiFilterFields(this)"> match tags<br>\s\n<input type="text" id="exportTags" onfocus="this.select()">\s\n<input type="checkbox" class="chk" id=exportFilterText value="1"\s\n onclick="exportShowDFwikiFilterFields(this)"> match titles/tiddler text<br>\s\n<input type="text" id="exportText" onfocus="this.select()">\s\n</div> <!--box-->\s\n</div> <!--panel-->\s\n\s\n<!-- action buttons -->\s\n<div style="text-align:center">\s\n<input type=button class="btn3" onclick="onClickExportDFwikiButton(this)"\s\n id="exportFilter" value="apply filter">\s\n<input type=button class="btn3" onclick="onClickExportDFwikiButton(this)"\s\n id="exportStart" value="export tiddlers">\s\n<input type=button class="btn3" onclick="onClickExportDFwikiButton(this)"\s\n id="exportClose" value="close">\s\n</div><!--center-->\s\n';\n//}}}\n// //===\n\n// // +++[continueInfo()]\n//{{{\nfunction continueInfo() {\n \n if (config.macros.exportDFwikis.info=="0")\n {\n displayMessage("Name or password incorrect");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true; \n removeSelect("exportDFwikiName");\n }\n else if (config.macros.exportDFwikis.info=="2")\n {\n displayMessage("Guests can't export content");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n removeSelect("exportDFwikiName");\n }\n else if (config.macros.exportDFwikis.info=="1")\n { \n displayMessage("Name and password correct");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=false;\n removeSelect("exportDFwikiName");\n }\n else \n {\n displayMessage("Impossible to connect");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true; \n removeSelect("exportDFwikiName");\n }\n}\n//}}}\n// //===\n\n// // +++[continueInfo()]\n//{{{\nfunction transitionInfo(group) {\n if (group!="choose a group...")\n {\n config.macros.exportDFwikis.selectedGroup=group;\n if(config.macros.exportDFwikis.transition=="yes")\n {\n document.getElementById("exportStart").disabled=false;\n exportDFwikis(); \n }\n }\n else\n {\n displayMessage("Impossible to export: The user choose a group... doesn't exists");\n }\n} \n//}}}\n// //===\n\n// // +++[exportInitFilter()]\n//{{{\nfunction exportInitFilter() {\n // start date\n document.getElementById("exportFilterStart").checked=false;\n document.getElementById("exportStartDate").value="";\n // end date\n document.getElementById("exportFilterEnd").checked=false;\n document.getElementById("exportEndDate").value="";\n // tags\n document.getElementById("exportFilterTags").checked=false;\n document.getElementById("exportTags").value="";\n // text\n document.getElementById("exportFilterText").checked=false;\n document.getElementById("exportText").value="";\n // show/hide filter input fields\n exportShowDFwikiFilterFields();\n}\n//}}}\n// //===\n\n// // +++[exportShowDFwikiFilterFields(which)]\n//{{{\nfunction exportShowDFwikiFilterFields(which) {\n var show;\n\n show=document.getElementById('exportFilterStart').checked;\n document.getElementById('exportFilterStartBy').style.display=show?"block":"none";\n document.getElementById('exportStartDate').style.display=show?"block":"none";\n var val=document.getElementById('exportFilterStartBy').value;\n document.getElementById('exportStartDate').value\n =getFilterDate(val,'exportStartDate').formatString(config.macros.exportDFwikis.datetimefmt);\n if (which && (which.id=='exportFilterStartBy') && (val=='other'))\n document.getElementById('exportStartDate').focus();\n\n show=document.getElementById('exportFilterEnd').checked;\n document.getElementById('exportFilterEndBy').style.display=show?"block":"none";\n document.getElementById('exportEndDate').style.display=show?"block":"none";\n var val=document.getElementById('exportFilterEndBy').value;\n document.getElementById('exportEndDate').value\n =getFilterDate(val,'exportEndDate').formatString(config.macros.exportDFwikis.datetimefmt);\n if (which && (which.id=='exportFilterEndBy') && (val=='other'))\n document.getElementById('exportEndDate').focus();\n\n show=document.getElementById('exportFilterTags').checked;\n document.getElementById('exportTags').style.display=show?"block":"none";\n\n show=document.getElementById('exportFilterText').checked;\n document.getElementById('exportText').style.display=show?"block":"none";\n}\n//}}}\n// //===\n// //===\n\n// // +++[onClickExportDFwikiButton(which): control interactions]\n//{{{\nfunction onClickExportDFwikiButton(which)\n{\n // DEBUG alert(which.id);\n var theList=document.getElementById('exportList'); if (!theList) return;\n var count = 0;\n var total = store.getTiddlers('title').length;\n switch (which.id)\n {\n case 'exportFilter':\n count=filterExportList();\n var panel=document.getElementById('exportFilterPanel');\n if (count==-1) { panel.style.display='block'; break; }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage("filtered "+formatExportMessage(count,total));\n if (count==0) { alert("No tiddlers were selected"); panel.style.display='block'; }\n break;\n case 'exportStart':\n exportDFwikis();\n break;\n case 'exportHideFilter':\n case 'exportToggleFilter':\n var panel=document.getElementById('exportFilterPanel')\n panel.style.display=(panel.style.display=='block')?'none':'block';\n break;\n case 'exportSelectChanges':\n var lastmod=new Date(document.lastModified);\n for (var t = 0; t < theList.options.length; t++) {\n if (theList.options[t].value=="") continue;\n var tiddler=store.getTiddler(theList.options[t].value); if (!tiddler) continue;\n theList.options[t].selected=(tiddler.modified>lastmod);\n count += (tiddler.modified>lastmod)?1:0;\n }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage(formatExportMessage(count,total));\n if (count==0) alert("There are no unsaved changes");\n break;\n case 'exportSelectOpened':\n for (var t = 0; t < theList.options.length; t++) theList.options[t].selected=false;\n var tiddlerDisplay = document.getElementById("tiddlerDisplay");\n for (var t=0;t<tiddlerDisplay.childNodes.length;t++) {\n var tiddler=tiddlerDisplay.childNodes[t].id.substr(7);\n for (var i = 0; i < theList.options.length; i++) {\n if (theList.options[i].value!=tiddler) continue;\n theList.options[i].selected=true; count++; break;\n }\n }\n document.getElementById("exportStart").disabled=(count==0);\n clearMessage(); displayMessage(formatExportMessage(count,total));\n if (count==0) alert("There are no tiddlers currently opened");\n break;\n case 'exportListSmaller': // decrease current listbox size\n var min=5;\n theList.size-=(theList.size>min)?1:0;\n break;\n case 'exportListLarger': // increase current listbox size\n var max=(theList.options.length>25)?theList.options.length:25;\n theList.size+=(theList.size<max)?1:0;\n break;\n case 'exportClose':\n document.getElementById('exportPanel').style.display='none';\n break;\n }\n}\n//}}}\n// //===\n\n// // +++[list display]\n//{{{\n \nfunction addToSelect(optionSelect,selectbox)\n{\n var elOptNew = document.createElement('option');\n elOptNew.text = optionSelect;\n elOptNew.value = optionSelect;\n var elSel = document.getElementById(selectbox);\n\n try {\n elSel.add(elOptNew, null); // standards compliant; doesn't work in IE\n }\n catch(ex) {\n elSel.add(elOptNew); // IE only\n }\n}\n\nfunction removeSelect(selectbox)\n{\n var elSel = document.getElementById(selectbox);\n var i;\n for (i = elSel.length - 1; i>=0; i--) {\n elSel.remove(i);\n }\n}\n\nfunction formatExportMessage(count,total)\n{\n var txt=total+' tiddler'+((total!=1)?'s':'')+" - ";\n txt += (count==0)?"none":(count==total)?"all":count;\n txt += " selected for export";\n return txt;\n}\n\nfunction refreshExportDFwikiList(selectedIndex)\n{\n var theList = document.getElementById("exportList");\n var sort;\n if (!theList) return;\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) sort='modified';\n if (selectedIndex==1) sort='title';\n if (selectedIndex==2) sort='modified';\n if (selectedIndex==3) sort='modifier';\n\n // get the alphasorted list of tiddlers\n var tiddlers = store.getTiddlers('title');\n // unselect headings and count number of tiddlers actually selected\n var count=0;\n for (var i=0; i<theList.options.length; i++) {\n if (theList.options[i].value=="") theList.options[i].selected=false;\n count+=theList.options[i].selected?1:0;\n }\n // disable "export" button if no tiddlers selected\n document.getElementById("exportStart").disabled=(count==0);\n // update listbox heading to show selection count\n if (theList.options.length) { clearMessage(); displayMessage(formatExportMessage(count,tiddlers.length)); }\n\n // if a [command] item, reload list... otherwise, no further refresh needed\n if (selectedIndex>3) return;\n\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++]=\n new Option(tiddlers.length+" tiddlers in document", "",false,false);\n theList.options[i++]=\n new Option(((sort=="title" )?">":indent)+' [by title]', "",false,false);\n theList.options[i++]=\n new Option(((sort=="modified")?">":indent)+' [by date]', "",false,false);\n theList.options[i++]=\n new Option(((sort=="modifier")?">":indent)+' [by author]', "",false,false);\n // output the tiddler list\n switch(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 "modifier":\n case "modified":\n var tiddlers = store.getTiddlers(sort);\n // sort descending for newest date first\n tiddlers.sort(function (a,b) {if(a[sort] == b[sort]) return(0); else return (a[sort] > b[sort]) ? -1 : +1; });\n var lastSection = "";\n for(var t = 0; t < tiddlers.length; t++)\n {\n var tiddler = tiddlers[t];\n var theSection = "";\n if (sort=="modified") theSection=tiddler.modified.toLocaleDateString();\n if (sort=="modifier") theSection=tiddler.modifier;\n if (theSection != lastSection)\n {\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 }\n theList.selectedIndex=selectedIndex; // select current control item\n}\n//}}}\n// //===\n\n// // +++[list filtering]\n//{{{\nfunction getFilterDate(val,id)\n{\n var result=0;\n switch (val) {\n case 'site':\n var timestamp=store.getTiddlerText("SiteDate");\n if (!timestamp) timestamp=document.lastModified;\n result=new Date(timestamp);\n break;\n case 'file':\n result=new Date(document.lastModified);\n break;\n case 'other':\n result=new Date(document.getElementById(id).value);\n break;\n default: // today=0, yesterday=1, one week=7, two weeks=14, a month=31\n var now=new Date(); var tz=now.getTimezoneOffset()*60000; now-=tz;\n var oneday=86400000;\n if (id=='exportStartDate')\n result=new Date((Math.floor(now/oneday)-val)*oneday+tz);\n else\n result=new Date((Math.floor(now/oneday)-val+1)*oneday+tz-1);\n break;\n }\n // DEBUG alert('getFilterDate('+val+','+id+')=='+result+"\snnow="+now);\n return result;\n}\n\nfunction filterExportList()\n{\n var theList = document.getElementById("exportList"); if (!theList) return -1;\n\n var filterStart=document.getElementById("exportFilterStart").checked;\n var val=document.getElementById("exportFilterStartBy").value;\n var startDate=getFilterDate(val,'exportStartDate');\n\n var filterEnd=document.getElementById("exportFilterEnd").checked;\n var val=document.getElementById("exportFilterEndBy").value;\n var endDate=getFilterDate(val,'exportEndDate');\n\n var filterTags=document.getElementById("exportFilterTags").checked;\n var tags=document.getElementById("exportTags").value;\n\n var filterText=document.getElementById("exportFilterText").checked;\n var text=document.getElementById("exportText").value;\n\n if (!(filterStart||filterEnd||filterTags||filterText)) {\n alert("Please set the selection filter");\n document.getElementById('exportFilterPanel').style.display="block";\n return -1;\n }\n if (filterStart&&filterEnd&&(startDate>endDate)) {\n var msg="starting date/time:\sn"\n msg+=startDate.toLocaleString()+"\sn";\n msg+="is later than ending date/time:\sn"\n msg+=endDate.toLocaleString()\n alert(msg);\n return -1;\n }\n\n // scan list and select tiddlers that match all applicable criteria\n var total=0;\n var count=0;\n for (var i=0; i<theList.options.length; i++) {\n // get item, skip non-tiddler list items (section headings)\n var opt=theList.options[i]; if (opt.value=="") continue;\n // get tiddler, skip missing tiddlers (this should NOT happen)\n var tiddler=store.getTiddler(opt.value); if (!tiddler) continue; \n var sel=true;\n if ( (filterStart && tiddler.modified<startDate)\n || (filterEnd && tiddler.modified>endDate)\n || (filterTags && !matchTags(tiddler,tags))\n || (filterText && (tiddler.text.indexOf(text)==-1) && (tiddler.title.indexOf(text)==-1)))\n sel=false;\n opt.selected=sel;\n count+=sel?1:0;\n total++;\n }\n return count;\n}\n//}}}\n\n//{{{\nfunction matchTags(tiddler,cond)\n{\n if (!cond||!cond.trim().length) return false;\n\n // build a regex of all tags as a big-old regex that \n // OR's the tags together (tag1|tag2|tag3...) in length order\n var tgs = store.getTags();\n if ( tgs.length == 0 ) return results ;\n var tags = tgs.sort( function(a,b){return (a[0].length<b[0].length)-(a[0].length>b[0].length);});\n var exp = "(" + tags.join("|") + ")" ;\n exp = exp.replace( /(,[\sd]+)/g, "" ) ;\n var regex = new RegExp( exp, "ig" );\n\n // build a string such that an expression that looks like this: tag1 AND tag2 OR NOT tag3\n // turns into : /tag1/.test(...) && /tag2/.test(...) || ! /tag2/.test(...)\n cond = cond.replace( regex, "/$1\s\s|/.test(tiddlerTags)" );\n cond = cond.replace( /\ssand\ss/ig, " && " ) ;\n cond = cond.replace( /\ssor\ss/ig, " || " ) ;\n cond = cond.replace( /\ss?not\ss/ig, " ! " ) ;\n\n // if a boolean uses a tag that doesn't exist - it will get left alone \n // (we only turn existing tags into actual tests).\n // replace anything that wasn't found as a tag, AND, OR, or NOT with the string "false"\n // if the tag doesn't exist then /tag/.test(...) will always return false.\n cond = cond.replace( /(\ss|^)+[^\s/\s|&!][^\ss]*/g, "false" ) ;\n\n // make a string of the tags in the tiddler and eval the 'cond' string against that string \n // if it's TRUE then the tiddler qualifies!\n var tiddlerTags = (tiddler.tags?tiddler.tags.join("|"):"")+"|" ;\n try { if ( eval( cond ) ) return true; }\n catch( e ) { displayMessage("Error in tag filter '" + e + "'" ); }\n return false;\n}\n//}}}\n// //===\n\n// // +++[output data formatting]>\n\n// // +++[exportDataToDFWiki()]\n//{{{\nfunction exportDataToDFWiki(theList)\n{\n try{\n // scan export listbox and collect DIVs or XML for selected tiddler content\n var out=[];\n for (var i=0; i<theList.options.length; i++) {\n // get item, skip non-selected items and section headings\n var opt=theList.options[i]; \n if (!opt.selected||(opt.value=="")) continue;\n // get tiddler, skip missing tiddlers (this should NOT happen)\n var thisTiddler=store.getTiddler(opt.value); \n if (!thisTiddler) continue; \n var tiddlerTitle=store.fetchTiddler(thisTiddler.title).title;\n var modifier=store.fetchTiddler(thisTiddler.title).modifier;\n var modified=store.fetchTiddler(thisTiddler.title).modified;\n var tiddlerContent=store.fetchTiddler(thisTiddler.title).text;\n var tags=store.fetchTiddler(thisTiddler.title).tags;\n\n out.push(convertUnicodeToUTF8(tiddlerTitle));\n out.push(convertUnicodeToUTF8(modifier));\n out.push(modified);\n out.push(convertUnicodeToUTF8(tiddlerContent));\n out.push(convertUnicodeToUTF8(tags));\n }\n return out;\n }\n catch (e) {\n displayMessage(e.description?e.description:e.toString());\n }\n}\n//}}}\n// //===\n\n// // +++[exportDFwikis(): output selected data to local or server]\n//{{{\nfunction exportDFwikis()\n{\n var theList = document.getElementById("exportList"); if (!theList) return;\n\n // assemble output: \n // [0]: tiddler name\n // [1]: modifier\n // [2]: time modified\n // [3]: tiddler content\n // [4]: tags\n var theData=exportDataToDFWiki(theList);\n var count=theData.length;\n /*displayMessage(theData[0]);\n displayMessage(theData[1]);\n displayMessage(theData[2]);\n displayMessage(theData[3]);\n */\n var i;\n for (i=0; i<count; i=i+5){\n var tiddlerName = theData[i+0];\n var modifier = theData[i+1];\n var modified = theData[i+2];\n var tiddlerContent = theData[i+3];\n var tag = theData[i+4];\n tiddlerContent=tiddlerContent.replace(/&/g, "&amp;").replace(/</g,"&lt;").replace(/>/g, "&gt;");\n tiddlerContent=tiddlerContent.replace(/&/g, "#|@");\n exportToMoodle(tiddlerName, modifier, modified, tiddlerContent,tag);\n }\n \n /*var out=[]; var txt=out.concat("",theData).join("\sn");\n var msg="";\n\n var theTarget = document.getElementById("exportFilename").value.trim();\n if (!theTarget.length) msg = "A local path/filename is required\sn";\n if (!msg && saveFile(theTarget,txt))\n msg=count+" tiddler"+((count!=1)?"s":"")+" exported to local file";\n else if (!msg)\n msg+="An error occurred while saving to "+theTarget;\n\n clearMessage(); displayMessage(msg,theTarget);*/\n}\n//}}}\n// //===\n\n// // Security functions\n//{{{\n/*****************************************************************************\n * md5.js\n *\n * A JavaScript implementation derived from the RSA Data Security, Inc. MD5\n * Message-Digest Algorithm. See http://cw.oaktree.co.uk/site/legal.html for\n * details.\n *\n * Copyright (C) Paul Johnston 1999 - 2000. Distributed under the LGPL.\n *****************************************************************************/\n\n/* to convert strings to a list of ascii values */\nvar sAscii = " !\s"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"\nvar sAscii = sAscii + "[\s\s]^_`abcdefghijklmnopqrstuvwxyz{|}~";\n\n/* convert integer to hex string */\nvar sHex = "0123456789ABCDEF";\nfunction hex(i)\n{\n h = "";\n for(j = 0; j <= 3; j++)\n {\n h += sHex.charAt((i >> (j * 8 + 4)) & 0x0F) +\n sHex.charAt((i >> (j * 8)) & 0x0F);\n }\n return h;\n}\n\n/* add, handling overflows correctly */\nfunction add(x, y)\n{\n return ((x&0x7FFFFFFF) + (y&0x7FFFFFFF)) ^ (x&0x80000000) ^ (y&0x80000000);\n}\n\n/* MD5 rounds functions */\nfunction R1(A, B, C, D, X, S, T)\n{\n q = add(add(A, (B & C) | ((~B) & D)), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R2(A, B, C, D, X, S, T)\n{\n q = add(add(A, (B & D) | (C & (~D))), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R3(A, B, C, D, X, S, T)\n{\n q = add(add(A, B ^ C ^ D), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R4(A, B, C, D, X, S, T)\n{\n q = add(add(A, C ^ (B | (~D))), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\n/* main entry point */\nfunction calcMD5(sInp) {\n\n /* Calculate length in machine words, including padding */\n wLen = (((sInp.length + 8) >> 6) + 1) << 4;\n var X = new Array(wLen);\n\n /* Convert string to array of words */\n j = 4;\n for (i = 0; (i * 4) < sInp.length; i++)\n {\n X[i] = 0;\n for (j = 0; (j < 4) && ((j + i * 4) < sInp.length); j++)\n {\n X[i] += (sAscii.indexOf(sInp.charAt((i * 4) + j)) + 32) << (j * 8);\n }\n }\n\n /* Append padding bits and length */\n if (j == 4)\n {\n X[i++] = 0x80;\n }\n else\n {\n X[i - 1] += 0x80 << (j * 8);\n }\n for(; i < wLen; i++) { X[i] = 0; }\n X[wLen - 2] = sInp.length * 8;\n\n /* hard coded initial values */\n a = 0x67452301;\n b = 0xefcdab89;\n c = 0x98badcfe;\n d = 0x10325476;\n\n /* Process each 16 word block in turn */\n for (i = 0; i < wLen; i += 16) {\n aO = a;\n bO = b;\n cO = c;\n dO = d;\n\n a = R1(a, b, c, d, X[i+ 0], 7 , 0xd76aa478);\n d = R1(d, a, b, c, X[i+ 1], 12, 0xe8c7b756);\n c = R1(c, d, a, b, X[i+ 2], 17, 0x242070db);\n b = R1(b, c, d, a, X[i+ 3], 22, 0xc1bdceee);\n a = R1(a, b, c, d, X[i+ 4], 7 , 0xf57c0faf);\n d = R1(d, a, b, c, X[i+ 5], 12, 0x4787c62a);\n c = R1(c, d, a, b, X[i+ 6], 17, 0xa8304613);\n b = R1(b, c, d, a, X[i+ 7], 22, 0xfd469501);\n a = R1(a, b, c, d, X[i+ 8], 7 , 0x698098d8);\n d = R1(d, a, b, c, X[i+ 9], 12, 0x8b44f7af);\n c = R1(c, d, a, b, X[i+10], 17, 0xffff5bb1);\n b = R1(b, c, d, a, X[i+11], 22, 0x895cd7be);\n a = R1(a, b, c, d, X[i+12], 7 , 0x6b901122);\n d = R1(d, a, b, c, X[i+13], 12, 0xfd987193);\n c = R1(c, d, a, b, X[i+14], 17, 0xa679438e);\n b = R1(b, c, d, a, X[i+15], 22, 0x49b40821);\n\n a = R2(a, b, c, d, X[i+ 1], 5 , 0xf61e2562);\n d = R2(d, a, b, c, X[i+ 6], 9 , 0xc040b340);\n c = R2(c, d, a, b, X[i+11], 14, 0x265e5a51);\n b = R2(b, c, d, a, X[i+ 0], 20, 0xe9b6c7aa);\n a = R2(a, b, c, d, X[i+ 5], 5 , 0xd62f105d);\n d = R2(d, a, b, c, X[i+10], 9 , 0x2441453);\n c = R2(c, d, a, b, X[i+15], 14, 0xd8a1e681);\n b = R2(b, c, d, a, X[i+ 4], 20, 0xe7d3fbc8);\n a = R2(a, b, c, d, X[i+ 9], 5 , 0x21e1cde6);\n d = R2(d, a, b, c, X[i+14], 9 , 0xc33707d6);\n c = R2(c, d, a, b, X[i+ 3], 14, 0xf4d50d87);\n b = R2(b, c, d, a, X[i+ 8], 20, 0x455a14ed);\n a = R2(a, b, c, d, X[i+13], 5 , 0xa9e3e905);\n d = R2(d, a, b, c, X[i+ 2], 9 , 0xfcefa3f8);\n c = R2(c, d, a, b, X[i+ 7], 14, 0x676f02d9);\n b = R2(b, c, d, a, X[i+12], 20, 0x8d2a4c8a);\n\n a = R3(a, b, c, d, X[i+ 5], 4 , 0xfffa3942);\n d = R3(d, a, b, c, X[i+ 8], 11, 0x8771f681);\n c = R3(c, d, a, b, X[i+11], 16, 0x6d9d6122);\n b = R3(b, c, d, a, X[i+14], 23, 0xfde5380c);\n a = R3(a, b, c, d, X[i+ 1], 4 , 0xa4beea44);\n d = R3(d, a, b, c, X[i+ 4], 11, 0x4bdecfa9);\n c = R3(c, d, a, b, X[i+ 7], 16, 0xf6bb4b60);\n b = R3(b, c, d, a, X[i+10], 23, 0xbebfbc70);\n a = R3(a, b, c, d, X[i+13], 4 , 0x289b7ec6);\n d = R3(d, a, b, c, X[i+ 0], 11, 0xeaa127fa);\n c = R3(c, d, a, b, X[i+ 3], 16, 0xd4ef3085);\n b = R3(b, c, d, a, X[i+ 6], 23, 0x4881d05);\n a = R3(a, b, c, d, X[i+ 9], 4 , 0xd9d4d039);\n d = R3(d, a, b, c, X[i+12], 11, 0xe6db99e5);\n c = R3(c, d, a, b, X[i+15], 16, 0x1fa27cf8);\n b = R3(b, c, d, a, X[i+ 2], 23, 0xc4ac5665);\n\n a = R4(a, b, c, d, X[i+ 0], 6 , 0xf4292244);\n d = R4(d, a, b, c, X[i+ 7], 10, 0x432aff97);\n c = R4(c, d, a, b, X[i+14], 15, 0xab9423a7);\n b = R4(b, c, d, a, X[i+ 5], 21, 0xfc93a039);\n a = R4(a, b, c, d, X[i+12], 6 , 0x655b59c3);\n d = R4(d, a, b, c, X[i+ 3], 10, 0x8f0ccc92);\n c = R4(c, d, a, b, X[i+10], 15, 0xffeff47d);\n b = R4(b, c, d, a, X[i+ 1], 21, 0x85845dd1);\n a = R4(a, b, c, d, X[i+ 8], 6 , 0x6fa87e4f);\n d = R4(d, a, b, c, X[i+15], 10, 0xfe2ce6e0);\n c = R4(c, d, a, b, X[i+ 6], 15, 0xa3014314);\n b = R4(b, c, d, a, X[i+13], 21, 0x4e0811a1);\n a = R4(a, b, c, d, X[i+ 4], 6 , 0xf7537e82);\n d = R4(d, a, b, c, X[i+11], 10, 0xbd3af235);\n c = R4(c, d, a, b, X[i+ 2], 15, 0x2ad7d2bb);\n b = R4(b, c, d, a, X[i+ 9], 21, 0xeb86d391);\n\n a = add(a, aO);\n b = add(b, bO);\n c = add(c, cO);\n d = add(d, dO);\n }\n return hex(a) + hex(b) + hex(c) + hex(d);\n}\n\nfunction calculateMD5Export() \n{\n var pw = document.getElementById("exportPW").value;\n return(calcMD5(pw));\n}\n\nfunction attachMD5Export(hash) \n{\n config.macros.exportDFwikis.username=document.getElementById("exportID").value; \n var getUrl = "&user="+document.getElementById("exportID").value;\n getUrl += "&pwd="+hash.toLowerCase();\n return getUrl;\n}\n//}}}\n\n// // AJAX Functions\n// // +++[GetXmlHttpObject(handler): gets the XMLhttp object]\n//{{{\nfunction GetXmlHttpObject(handler)\n{ \n var objXMLHttp=null;\n if (window.XMLHttpRequest)\n {\n objXMLHttp=new XMLHttpRequest();\n }\n else if (window.ActiveXObject)\n {\n objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");\n }\n return objXMLHttp;\n}\n\nfunction exportToMoodle(tiddlerName, modifier, modified, tiddlerContent, tag)\n{\n if (config.macros.exportDFwikis.selectedWiki!="choose a wiki...")\n {\n if(config.macros.exportDFwikis.selectedUser!="choose an user...")\n {\n if (config.macros.exportDFwikis.callNumber!="0") //This only happen if we've to call this function more than 1 time\n {\n if (config.macros.exportDFwikis.selectedWikiGroups!=document.getElementById("exportDFwikiName").value)\n {\n displayMessage("The selected wiki has changed. Please log-in.");\n removeSelect("exportDFwikiCourse");\n removeSelect("exportDFwikiName");\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n document.getElementById('groupsPanel').style.display='none';\n config.macros.exportDFwikis.callNumber="0"; \n }\n else if (config.macros.exportDFwikis.selectedCourse!=document.getElementById("exportDFwikiCourse").value)\n {\n displayMessage("The selected course has changed. Please log-in.");\n removeSelect("exportDFwikiCourse");\n removeSelect("exportDFwikiName");\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n document.getElementById('groupsPanel').style.display='none';\n config.macros.exportDFwikis.callNumber="0"; \n } \n }\n \n if (config.macros.exportDFwikis.username!=document.getElementById("exportID").value)\n {\n displayMessage("The user don't exists or has changed. Please log-in.");\n removeSelect("exportDFwikiCourse");\n removeSelect("exportDFwikiName");\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n document.getElementById('groupsPanel').style.display='none';\n }\n else\n {\n xmlHttp=GetXmlHttpObject();\n if (xmlHttp==null)\n {\n alert ("Browser does not support HTTP Request");\n return\n }\n var url=document.getElementById("exportMoodleServer").value;\n url+= ((url.charAt(url.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php";\n var wikiName = document.getElementById("exportDFwikiName").value;\n var courseName = document.getElementById("exportDFwikiCourse").value;\n var call_number = config.macros.exportDFwikis.callNumber;\n var ownerName = config.macros.exportDFwikis.selectedUser;\n var groupName = config.macros.exportDFwikis.selectedGroup;\n xmlHttp.onreadystatechange=stateExportToMoodle;\n if (typeof(netscape)!="undefined") { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n try \n {\n xmlHttp.open("POST",url);\n xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Needed for the POST method\n if (xmlHttp.overrideMimeType) xmlHttp.overrideMimeType('text/xml');\n xmlHttp.send("sel=importTiddlers"+attachMD5Export(calculateMD5Export())+"&course="+courseName+"&wiki="+wikiName+"&tiddler_title="+tiddlerName+"&tag="+tag+"&tiddler_content="+tiddlerContent+"&call_number="+call_number+"&ownerName="+ownerName+"&groupName="+groupName);\n }\n catch (e) {\n displayMessage(e.description?e.description:e.toString());\n }\n } \n }\n else\n {\n displayMessage("Impossible to export: The user choose an user... doesn't exists"); \n }\n }\n else\n {\n displayMessage("Impossible to export: The wiki choose a wiki... doesn't exists");\n }\n}\n\nfunction getMoodleInfo(sync)\n{ \n //Remove the existent valors of the selects used before\n config.macros.exportDFwikis.callNumber="0";\n removeSelect("groupbox");\n removeSelect("userbox");\n removeSelect("exportDFwikiCourse");\n removeSelect("exportDFwikiName");\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n document.getElementById('groupsPanel').style.display='none';\n \n //AJAX interaction\n xmlHttp=GetXmlHttpObject();\n \n if (xmlHttp==null)\n {\n alert ("Browser does not support HTTP Request");\n return\n }\n var url=document.getElementById("exportMoodleServer").value;\n url+= ((url.charAt(url.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php";\n if (sync && sync==true) xmlHttp.onreadystatechange=stateGetMoodleInfoSync;\n else xmlHttp.onreadystatechange=stateGetMoodleInfo;\n if (typeof(netscape)!="undefined") \n { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n try \n {\n xmlHttp.open("POST",url);\n xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Needed for the POST method\n if (xmlHttp.overrideMimeType) xmlHttp.overrideMimeType('text/xml');\n xmlHttp.send("sel=getMoodleInfo"+attachMD5Export(calculateMD5Export()));\n }\n catch (e) \n {\n displayMessage(e.description?e.description:e.toString());\n }\n}\n\nfunction continueGettingMoodleInfo(course_short, sync)\n{\n if (course_short!="choose a course...")\n {\n if (config.macros.exportDFwikis.username!=document.getElementById("exportID").value)\n {\n displayMessage("The user has changed. Please log-in again.");\n removeSelect("exportDFwikiCourse");\n removeSelect("exportDFwikiName");\n document.getElementById("exportDFwikiName").disabled=true;\n document.getElementById("exportDFwikiCourse").disabled=true;\n }\n else\n {\n xmlHttp=GetXmlHttpObject();\n if (xmlHttp==null)\n {\n alert ("Browser does not support HTTP Request");\n return\n }\n var url=document.getElementById("exportMoodleServer").value;\n url+= ((url.charAt(url.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php";\n if (sync && sync==true) xmlHttp.onreadystatechange=statecontinueGettingMoodleInfoSync;\n else xmlHttp.onreadystatechange=statecontinueGettingMoodleInfo;\n if (typeof(netscape)!="undefined") \n { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n try {\n xmlHttp.open("POST",url);\n xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Needed for the POST method\n if (xmlHttp.overrideMimeType) xmlHttp.overrideMimeType('text/xml');\n xmlHttp.send("sel=continueGettingMoodleInfo"+attachMD5Export(calculateMD5Export())+"&course="+course_short);\n }\n catch (e) {\n displayMessage(e.description?e.description:e.toString());\n }\n } \n }\n}\n\nfunction stateExportToMoodle() \n{\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n { \n if (typeof(netscape)!="undefined") { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var info =new Array(xml.getElementsByTagName('items').length);\n for (i = 0; i < xml.getElementsByTagName('items').length; i++)\n {\n var item = xml.getElementsByTagName('response')[0];\n var id = item.getElementsByTagName('items')[i].firstChild.data;\n info[i]=id;\n }\n \n //We save the current valors of selects and inputs to avoid in invalid accesses\n config.macros.exportDFwikis.username=document.getElementById("exportID").value;\n config.macros.exportDFwikis.selectedWikiGroups=document.getElementById("exportDFwikiName").value;\n config.macros.exportDFwikis.selectedCourse=document.getElementById("exportDFwikiCourse").value;\n \n var option=info[0];\n if (option=="0") //error\n {\n displayMessage(info[1]);\n document.getElementById('groupsPanel').style.display='none';\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n config.macros.exportDFwikis.callNumber="0";\n config.macros.exportDFwikis.transition="no";\n }\n else if (option=="1") //warning\n {\n displayMessage(info[1]);\n displayMessage(info[2]);\n document.getElementById('groupsPanel').style.display='none';\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n config.macros.exportDFwikis.callNumber="0";\n config.macros.exportDFwikis.transition="no"; \n }\n else if (option=="2") //correct\n {\n displayMessage(info[1]);\n document.getElementById('groupsPanel').style.display='none';\n removeSelect("groupbox");\n removeSelect("userbox");\n document.getElementById("groupbox").disabled=true;\n document.getElementById("userbox").disabled=true;\n config.macros.exportDFwikis.callNumber="0";\n config.macros.exportDFwikis.transition="no";\n }\n else if (option=="3") //teacher gmode=0 & smode=1 or smode=2\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("userbox");\n addToSelect("choose an user...","userbox");\n document.getElementById("userbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"userbox");\n }\n config.macros.exportDFwikis.callNumber="2";\n }\n else if (option=="4")// teacher gmode={1,2} and smode=0\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("groupbox");\n addToSelect("choose a group...","groupbox");\n document.getElementById("groupbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"groupbox");\n }\n config.macros.exportDFwikis.callNumber="2"; \n }\n else if (option=="5")//teacher in gmode={1,2} & smode={1,2}\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("groupbox");\n addToSelect("choose a group...","groupbox");\n document.getElementById("groupbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"groupbox");\n }\n config.macros.exportDFwikis.callNumber="1";\n config.macros.exportDFwikis.transition="yes";\n }\n else if (option=="6")//teacher continuing gmode={1,2} & smode={1,2}\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("userbox");\n addToSelect("choose an user...","userbox");\n document.getElementById("userbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"userbox");\n }\n config.macros.exportDFwikis.callNumber="2";\n }\n else if (option=="7")// student gmode={1,2} and smode=0\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("groupbox");\n addToSelect("choose a group...","groupbox");\n document.getElementById("groupbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"groupbox");\n }\n config.macros.exportDFwikis.callNumber="2"; \n }\n else if (option=="8")// student gmode={1,2} and smode=1\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("groupbox");\n addToSelect("choose a group...","groupbox");\n document.getElementById("groupbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"groupbox");\n }\n config.macros.exportDFwikis.callNumber="2"; \n }\n else if (option=="9")//teacher in gmode={1,2} & smode=1\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("groupbox");\n addToSelect("choose a group...","groupbox");\n document.getElementById("groupbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"groupbox");\n }\n config.macros.exportDFwikis.callNumber="1";\n config.macros.exportDFwikis.transition="yes";\n }\n else if (option=="10")//teacher continuing gmode={1,2} & smode=2\n {\n document.getElementById('groupsPanel').style.display='block';\n displayMessage(info[1]);\n removeSelect("userbox");\n addToSelect("choose an user...","userbox");\n document.getElementById("userbox").disabled=false;\n for (i=2;i<info.length;i++)\n {\n addToSelect(info[i],"userbox");\n }\n config.macros.exportDFwikis.callNumber="2";\n }\n } \n}\n\nfunction stateGetMoodleInfo() \n{\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n { \n if (typeof(netscape)!="undefined") { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var info =new Array(xml.getElementsByTagName('items').length);\n for (i = 0; i < xml.getElementsByTagName('items').length; i++)\n {\n var item = xml.getElementsByTagName('response')[0];\n var id = item.getElementsByTagName('items')[i].firstChild.data;\n info[i]=id;\n }\n var option=info[0];\n config.macros.exportDFwikis.info=option;\n removeSelect("exportDFwikiCourse");\n if (option=="1")\n {\n addToSelect("choose a course...","exportDFwikiCourse");\n for (i=1;i<info.length;i++)\n {\n addToSelect(info[i],"exportDFwikiCourse");\n } \n }\n continueInfo();\n } \n}\n\nfunction stateGetMoodleInfoSync() \n{\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n { \n if (typeof(netscape)!="undefined") { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var info =new Array(xml.getElementsByTagName('items').length);\n for (i = 0; i < xml.getElementsByTagName('items').length; i++)\n {\n var item = xml.getElementsByTagName('response')[0];\n var id = item.getElementsByTagName('items')[i].firstChild.data;\n info[i]=id;\n }\n var option=info[0];\n config.macros.exportDFwikis.info=option;\n removeSelect("exportDFwikiCourse");\n if (option=="1")\n {\n addToSelect("choose a course...","exportDFwikiCourse");\n for (i=1;i<info.length;i++)\n {\n addToSelect(info[i],"exportDFwikiCourse");\n }\n \n }\n continueInfo();\n continueSyncCourses(1);\n } \n}\n\nfunction statecontinueGettingMoodleInfo() \n{\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n { \n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n {\n if (typeof(netscape)!="undefined") \n { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var info =new Array(xml.getElementsByTagName('items').length);\n for (i = 0; i < xml.getElementsByTagName('items').length; i++)\n {\n var item = xml.getElementsByTagName('response')[0];\n var id = item.getElementsByTagName('items')[i].firstChild.data;\n info[i]=id;\n }\n var option=info[0];\n config.macros.exportDFwikis.info=option;\n removeSelect("exportDFwikiName");\n if (option=="1")\n {\n addToSelect("choose a course...","exportDFwikiName");\n for (i=1;i<info.length;i++)\n {\n addToSelect(info[i],"exportDFwikiName");\n }\n document.getElementById("exportDFwikiName").disabled=false; \n } \n }\n } \n}\n\nfunction statecontinueGettingMoodleInfoSync() \n{\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")\n { \n if (typeof(netscape)!="undefined") \n { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var info =new Array(xml.getElementsByTagName('items').length);\n for (i = 0; i < xml.getElementsByTagName('items').length; i++)\n {\n var item = xml.getElementsByTagName('response')[0];\n var id = item.getElementsByTagName('items')[i].firstChild.data;\n info[i]=id;\n }\n var option=info[0];\n config.macros.exportDFwikis.info=option;\n removeSelect("exportDFwikiName");\n if (option=="1")\n {\n addToSelect("choose a wiki...","exportDFwikiName");\n for (i=1;i<info.length;i++)\n {\n addToSelect(info[i],"exportDFwikiName");\n }\n document.getElementById("exportDFwikiName").disabled=false; \n } \n continueSyncWikis(1);\n } \n}\n//}}}\n// //===
<<importDFwikis inline>>
/***\n|''Name:''|ImportDFwikisPlugin|\n|''Author:''|[[Oriol Nieto|http://enochrooted.blogspot.com/]] , [[Alejandro Moreno|http://vdemarvvv.blogspot.com/]], Dídac Calventus & [[Ludo( Marc Alier)|http://www.lsi.upc.edu/~malier/]]|\n|''Another production of:''|[[dfwikiteam|http://morfeo.upc.es/crom/]] [[Universitat Politècnica de Catalunya|http://www.upc.edu]]|\n|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/ as described in the license document http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html#%5B%5BLicense%20And%20Legal%20Aspects%5D%5D]]|\n|''~CoreVersion:''|2.1.2|\n|''~PluglinVersion:''|1.4|\n|''Download latest version from''|http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html#ImportDFwikisPlugin|\n|''Moodle wiki server side files and docs''|http://morfeo.upc.edu/crom|\n\n<<importDFwikis inline>>\n\nThis plugin lets you import pages of dfwikis from a moodle 1.6.X with the nwiki module installed.\n\nIt's ''strongly recommended'' that you use ''Firefox'' (or any netscape based navigator) instead of IE in order to avoid security problems.\n\nIf anyway you want to use IE, you'll have to turn down all security parameters.\n\nYou can import pages using an interactive control panel, selecting the wiki and then the page to import, or typing the complete URL of the wiki page, both methods with prompting for skip, rename, merge or replace actions when importing pages that match existing tiddler titles. Generates a detailed report of import 'history' in ImportedTiddlers.\nYou can import immediately (without panel interaction) the page you want typping the complete URL that appears in your browser while viewing this page in your moodle installation (direct import use always the ImportTiddlersToDFwikisPluglin parser and ''only works with wikis without groups'').\nYou can enable or disable the use of the ImportTiddlersToDFwikisPluglin parser. If you disable that option, is recommended to have installed previously the [[MediaWikiFotmatterPluglin|http://martinswiki.com/prereleases.html#MediaWikiFormatterPlugin]] and the [[HTMLFormattingPluglin|http://www.TiddlyTools.com/#HTMLFormattingPlugin]] to visualize correctly the imported content.\n\nIMPORTANT: Don't disable/enable the ImportTiddlersToDFwikisPluglin parser after clicking "open pages". Enable/Disable it at the beginning of the interactive process.\n\n! credits \nThis plugin is a derivative of http://www.TiddlyTools.com/#ImportTiddlersPlugin, created by Eric L.Shulman and/or ELS Design Studios, and is subject to all terms and conditions as described in http://www.TiddlyTools.com/#LegalStatements as well as all other terms and conditions as described in this document.\n\n!!!!! Test site\nYou can test this plugin getting wiki pages from our server http://morfeo.upc.edu/crom as Guest user\n\n!!!!!Interactive interface\n<<<\n{{{<<importDFwikis>>}}}\ncreates "import dfwikis" link. click to show/hide import control panel\n\n{{{<<importDFwikis inline>>}}}\ncreates import control panel directly in tiddler content\n\n\n\nThere are two ways available in this pluglin to import dfwikis.\n\n1. Introducing the complete URL of the page wiki you're going to import.\n2. Using the interactive process.\n\nIf you want to use the first method you only have to type the complete URL of the wiki you want to import, your username and password in moodle and click ''[import now!]''\n\nIf you want to import using the second method follow the instructions written below.\nType the source of your moodle installation in you server, your username and your password and press ''[open wikis]'' to get a list of all the existent wikis in your moodles installation with the appropiate access restricctions.\nThen select the wiki that you want to import from and press ''[open pages]'' to get a list of the pages included in the wiki.\nSelect one or more pages 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 pages titles in the list. Use the ''[-]'', ''[+]'', or ''[=]'' links to adjust the listbox size so you can view more (or less) pages titles at one time. When you have chosen the pages 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 pages from the list. This makes it very quick and easy to find and import just the updated pages you are interested in:\n>''"all"'' selects ALL pages from the import source document, even if they have not been changed.\n>''"new"'' selects only pages that are found in the import source wiki, but do not yet exist in the destination document\n>''"changes"'' selects only pages that exist in both documents but that are newer in the source wiki\n>''"differences"'' selects all new and existing pages that are different from the destination document (even if destination pages is newer)\n\n''Import Tagging:''\n\nPages that have been imported and transformed in Tiddlers 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 page whose title is identical to one that already exists, the import process pauses and the page title is displayed in an input field, along with four push buttons: ''[skip]'', ''[rename]'', ''[merge]'' and ''[replace]''.\n\nTo bypass importing this page, press ''[skip]''. To import the page 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 pages into a single tiddler. Press ''[replace]'' to overwrite the existing page with the imported one, discarding the previous tiddler content.\n\n//Note: if both the title ''and'' modification date/////time match, the imported page 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 pages are imported, a report is generated into ImportedTiddlers, indicating when the latest import was performed, the number of pages 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 pages 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 pages 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''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 loadDFwikis() 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<<<\n1. copy/paste the following tiddlers into your document:\n ''ImportDFwikisPlugin'' (tagged with <<tag systemConfig>>)\n\n2. Use ''ImportTiddlersPluglin''\n\ncreate/edit ''SideBarOptions'': (sidebar menu items) \n^^Add "< < ImportDFwikis > >" macro^^\n\n<<<\n!!!!!Revision History\n<<<\n''2006.12.09 [1.4]'' \n* Compatible with wiki with groups\n''2006.11.27 [1.3]'' \n* Enable/Disable the ImportDfwikisPluglin parser\n''2006.11.01 [1.2]'' \n* ISO 8859 1Wikis compatible with UTF-8 Tiddlywikis.\n* More accessible interface. Guest enable/disable. Direct import enable/disable. Tags text clarified.\n''2006.11.01 [1.1]'' \n* Import wikipage from URL \n* Access control implemented. Username and Password protection and logging into Moodle server.\n''2006.10.22 [1.0]'' \n* Demonstration release. Only imports from wikis opened to guest user in the Moodle Server\n<<<\n\n!!!!!Code\n***/\n// // ''MACRO DEFINITION''\n//{{{\n// Version\nversion.extensions.importDFwikis = {major: 3, minor: 0, revision: 8, date: new Date(2006,10,12)};\n\n// IE needs explicit global scoping for functions/vars called from browser events\nwindow.onClickImportDFwikiButton=onClickImportDFwikiButton;\nwindow.refreshImportDFwikiList=refreshImportDFwikiList;\n\n// default cookie/option values\nif (!config.options.chkimportDFwikiReport) config.options.chkimportDFwikiReport=true;\n\nconfig.macros.importDFwikis = { };\nconfig.macros.importDFwikis = {\n label: "import dfwikis",\n prompt: "Copy dfwikis from another document",\n foundMsg: "Found %0 items in %1",\n countMsg: "%0 items selected for import",\n importedMsg: "Imported %0 of %1 items from %2",\n src: "", // URL of moodle to import (retrieved from MoodleSource tiddler)\n inbound: null, // hash-indexed array of items from other document\n newTags: "", // text of tags added to imported items\n addTags: true, // add new tags to imported items\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: -1, // current processing index in import list\n sort: "", // sort order for imported tiddler listbox\n parser: 1\n};\n\nconfig.macros.importDFwikis.handler = function(place,macroName,params) {\n if (!config.macros.loadDFwikis.handler)\n return;\n if (!params[0]) // LINK TO FLOATING PANEL\n createTiddlyButton(place,this.label,this.prompt,onClickImportDFwikiMenu);\n else if (params[0]=="inline") {// // INLINE TIDDLER CONTENT\n createImportDFwikiPanel(place);\n document.getElementById("dfwikiPanel").style.position="static";\n document.getElementById("dfwikiPanel").style.display="block";\n }\n else config.macros.loadDFwikis.handler(place,macroName,params); // FALLBACK: PASS TO loadDFwikis\n}\n//}}}\n\n// // ''INTERFACE DEFINITION''\n\n// // Handle link click to create/show/hide control panel\n//{{{\nfunction onClickImportDFwikiMenu(e)\n{\n if (!e) var e = window.event;\n var parent=resolveTarget(e).parentNode;\n var panel = document.getElementById("dfwikiPanel");\n if (panel==undefined || panel.parentNode!=parent)\n panel=createImportDFwikiPanel(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 createImportDFwikiPanel(place) {\n var panel=document.getElementById("dfwikiPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n setStylesheet(config.macros.importDFwikis.css,"importDFwikis");\n panel=createTiddlyElement(place,"span","dfwikiPanel",null,null)\n panel.innerHTML=config.macros.importDFwikis.html;\n refreshImportDFwikiList();\n var siteURL=store.getTiddlerText("MoodleSource"); if (!siteURL) siteURL="";\n document.getElementById("importSourceURL").value=siteURL;\n config.macros.importDFwikis.src=siteURL;\n return panel;\n}\n//}}}\n\n// // CSS\n//{{{\nconfig.macros.importDFwikis.css = '\s\n#dfwikiPanel {\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#dfwikiPanel a, #dfwikiPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\s\n#dfwikiPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\s\n#dfwikiPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\s\n#dfwikiPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\s\n#dfwikiPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\s\n#dfwikiPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\s\n#dfwikiPanel input#importSourceURL { width:75%;padding:1px;margin:0px;font-size:8pt;line-height:110%}\s\n#dfwikiPanel input#moodleUserName { width:90%;padding:0px;margin-right:8px;font-size:8pt;line-height:110%}\s\n#dfwikiPanel input#moodlePwd { width:90%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\s\n#dfwikiPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px;}\s\n#dfwikiPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\s\n#dfwikiPanel .rad { width:auto; }\s\n#dfwikiPanel .chk { width:auto; margin:1px;border:0; }\s\n#dfwikiPanel .btn { width:auto; }\s\n#dfwikiPanel .btn1 { width:98%; }\s\n#dfwikiPanel .btn2 { width:48%; }\s\n#dfwikiPanel .btn3 { width:32%; }\s\n#dfwikiPanel .btn4 { width:24%; }\s\n#dfwikiPanel .btn5 { width:19%; }\s\n#dfwikiPanel .ImportDFwikiButton { padding: 0em; margin: 0px; font-size:8pt; }\s\n#dfwikiPanel .importListButton { padding:0em 0.25em 0em 0.25em; color: #000000; display:inline }\s\n#importCollisionDFwikiPanel { display:none; margin:0.5em 0em 0em 0em; }\s\n#importNonDirectPanelUp { display:block; margin:0em 0em 0em 0em; }\s\n#importNonDirectPanelDown { display:block; margin:0em 0em 0em 0em; }\s\n';\n//}}}\n\n// // HTML \n//{{{\nconfig.macros.importDFwikis.html = '\s\n<!-- source and report -->\s\n<table><tr><td align=left>\s\n import from a moodle based web\s\n</td><td align=right>\s\n <input type=checkbox class="chk" id="chkimportDFwikiReport" checked\s\n onClick="config.options[\s'chkimportDFwikiReport\s']=this.checked;"> create a report\s\n</td></tr></table>\s\n<!--panel-->\s\n\s\n<!-- import from http server -->\s\n<div id="importHTTPPanel" style="display:block;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999;text-align: center;">\s\n<table><tr><td align=left>\s\n remote moodle URL:<br>\s\n</td><td align=right>\s\n</td></tr></table>\s\n<input type="text" id="importSourceURL" onfocus="this.select()" value="SiteUrl"\s\n onKeyUp="config.macros.importDFwikis.src=this.value"\s\n onChange="config.macros.importDFwikis.src=this.value;">\s\n<input type=button id="importImmediately" class="ImportDFwikiButton" style="width:23%" value="import now!" disabled\s\n onclick="onClickImportDFwikiButton(this)">\s\n<table cellpadding="0" cellspacing="0"><tr><td width="40%" align=left>\s\n username<br>\s\n <input type="text" id="moodleUserName" onfocus="this.select()" value="" size="10"\s\n onKeyUp=""\s\n onChange="">\s\n</td><td width="40%" align=left>\s\n password<br>\s\n <input type="password" id="moodlePwd" onfocus="this.select()" value="" size="10"\s\n onKeyUp=""\s\n onChange="">\s\n</td><td width="20%" align=center>\s\n developed by\s\n</td></tr></table>\s\n<table cellpadding="0" cellspacing="0"><tr><td width="45%" align=left>\s\n <input type="checkbox" class="chk" id="guestLoginCheck" \s\n onClick="enableGuestLogin()">login as guest<br>\s\n <input type="checkbox" class="chk" id="useParserCheck" checked \s\n onClick="useParser()">use ImportDFwikis parser<br>\s\n</td><td width="35%" align=left>\s\n <input type="checkbox" class="chk" id="importImmediatelyCheck" \s\n onClick="enableDisableImportImmediately()"> enable direct import<br>\s\n</td><td width="20%" align=center>\s\n <a href="http://morfeo.upc.es/crom/">\s\n <img src="http://img294.imageshack.us/img294/8712/dfwikiteamie8.jpg">\s\n </a>\s\n</td></tr></table>\s\n</div><!--panel-->\s\n\s\n<div id="importNonDirectPanelUp">\s\n<table><tr><td align=left>\s\n select:\s\n <a href="JavaScript:;" id="importSelectAll"\s\n onclick="onClickImportDFwikiButton(this)" title="select all tiddlers">\s\n &nbsp;all&nbsp;</a>\s\n <a href="JavaScript:;" id="importSelectNew"\s\n onclick="onClickImportDFwikiButton(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="onClickImportDFwikiButton(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="onClickImportDFwikiButton(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="onClickImportDFwikiButton(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="onClickImportDFwikiButton(this)" title="reduce list size">\s\n &nbsp;&#150;&nbsp;</a>\s\n <a href="JavaScript:;" id="importListLarger"\s\n onclick="onClickImportDFwikiButton(this)" title="increase list size">\s\n &nbsp;+&nbsp;</a>\s\n <a href="JavaScript:;" id="importListMaximize"\s\n onclick="onClickImportDFwikiButton(this)" title="maximize/restore list size">\s\n &nbsp;=&nbsp;</a>\s\n</td></tr></table></div>\s\n<select id="importList" size=8 multiple\s\n onchange="setTimeout(\s'refreshImportDFwikiList(\s'+this.selectedIndex+\s')\s',1)">\s\n <!-- NOTE: delay refresh so list is updated AFTER onchange event is handled -->\s\n</select>\s\ntags:<br>\s\n<input type=text id="txtNewTags" size=15 onKeyUp="config.macros.importDFwikis.newTags=this.value" autocomplete=off>\s\n<div id="importNonDirectPanelDown">\s\n<div align=center>\s\n <input type=button id="importOpenWikis" class="ImportDFwikiButton" style="width:23%" value="open wikis"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importOpenPages" class="ImportDFwikiButton" style="width:23%" value="open pages" disabled="true"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importStart" class="ImportDFwikiButton" style="width:23%" value="import" disabled="true"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importClose" class="ImportDFwikiButton" style="width:23%" value="close"\s\n onclick="onClickImportDFwikiButton(this)">\s\n</div>\s\n</div>\s\n<div id="importCollisionDFwikiPanel">\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="ImportDFwikiButton" style="width:23%" value="skip"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importRename" class="ImportDFwikiButton" style="width:23%" value="rename"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importMerge" class="ImportDFwikiButton" style="width:23%" value="merge"\s\n onclick="onClickImportDFwikiButton(this)">\s\n <input type=button id="importReplace" class="ImportDFwikiButton" style="width:23%" value="replace"\s\n onclick="onClickImportDFwikiButton(this)">\s\n </div>\s\n</div>\s\n';\n//}}}\n\n// // Control interactions\n//{{{\nfunction useParser()\n{\n if (config.macros.importDFwikis.parser==1) config.macros.importDFwikis.parser=0;\n else config.macros.importDFwikis.parser=1;\n} \n\nfunction enableDisableImportImmediately() \n{\n if(!document.getElementById('importImmediatelyCheck').checked)\n {\n document.getElementById('importImmediately').disabled=true;\n document.getElementById('importNonDirectPanelUp').style.display='block';\n document.getElementById('importNonDirectPanelDown').style.display='block';\n }\n\n else\n {\n document.getElementById('importImmediately').disabled=false;\n document.getElementById('importNonDirectPanelUp').style.display='none';\n document.getElementById('importNonDirectPanelDown').style.display='none';\n }\n}\n\nfunction enableGuestLogin() \n{\n if(document.getElementById('guestLoginCheck').checked)\n {\n document.getElementById('moodleUserName').value="guest";\n document.getElementById('moodleUserName').disabled=true;\n document.getElementById('moodlePwd').value="guest";\n document.getElementById('moodlePwd').disabled=true;\n }\n\n else\n {\n document.getElementById('moodleUserName').disabled=false;\n document.getElementById('moodlePwd').disabled=false;\n }\n}\n\nfunction onClickImportDFwikiButton(which)\n{\n // DEBUG alert(which.id);\n var theList = document.getElementById('importList');\n if (!theList) return;\n var thePanel = document.getElementById('dfwikiPanel');\n var theCollisionPanel = document.getElementById('importCollisionDFwikiPanel');\n var theNewTitle = document.getElementById('importNewTitle');\n var count=0;\n switch (which.id)\n {\n case 'fileImportSource':\n case 'importImmediately':\n config.macros.importDFwikis.inbound=null; // clear the imported tiddler buffer\n refreshImportDFwikiList(); // reset/resize the listbox\n if (config.macros.importDFwikis.src=="") break;\n src_backup=config.macros.importDFwikis.src; //backup of the original source\n \n // This sentences erase the group info. If you want to have the groups info just delete the sentences below.\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////\n var erase_till=config.macros.importDFwikis.src.lastIndexOf("&gid");\n if (erase_till=="-1") erase_till=config.macros.importDFwikis.src.length;\n var erased_group_src=config.macros.importDFwikis.src.substr(0,erase_till);\n config.macros.importDFwikis.src=erased_group_src\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////\n \n var src_backup_without_groups = config.macros.importDFwikis.src; //backup of the original source without groups\n var lastIndex=config.macros.importDFwikis.src.lastIndexOf("/mod/wiki/view.php?"); \n var source=config.macros.importDFwikis.src.substr(0,lastIndex); //we need this source to connect with the webservice\n var restant=src_backup_without_groups.length - source.length - 19; //19 are the chars in "/mod/wiki/view.php?"\n var parameters=src_backup_without_groups.substr(-restant,restant);\n var number_of_parameters = 0;\n for (var i=0; i<parameters.length; i++)\n {\n if (parameters.charAt(i)=="=") number_of_parameters++;\n }\n if (number_of_parameters=="1")\n {\n //Put the course-->id in the URL as "id"\n lastIndex=parameters.lastIndexOf("=");\n restant=parameters.length - lastIndex;\n var id=parameters.substr(-restant+1,restant);\n config.macros.importDFwikis.src=source+"/mod/wiki/webservicelib.php?sel=urlManagement&id="+id;\n config.macros.importDFwikis.src += attachMD5(calculateMD5()); \n }\n else if (number_of_parameters=="2")\n {\n //Put the course-->id in the URL as "id" and the pagename as "page"\n lastIndex=parameters.lastIndexOf("=");\n restant=parameters.length - lastIndex;\n var page=parameters.substr(-restant+1,restant);\n lastIndex=parameters.lastIndexOf("&page=");\n parameters=parameters.substr(0,lastIndex);\n lastIndex=parameters.lastIndexOf("=");\n restant=parameters.length - lastIndex;\n var id=parameters.substr(-restant+1,restant);\n config.macros.importDFwikis.src=source+"/mod/wiki/webservicelib.php?sel=urlManagement&id="+id+"&page="+page;\n config.macros.importDFwikis.src += attachMD5(calculateMD5());\n }\n else if (number_of_parameters=="3")\n {\n //Put the course-->id in the URL as "id" and the pagename as "page". It's a filter for the "name parameter\n //http://localhost/moodle16/mod/wiki/view.php?id=11&name=dfwikipage&page=Segunda+Wiki1\n lastIndex=parameters.lastIndexOf("=");\n restant=parameters.length - lastIndex;\n var page=parameters.substr(-restant+1,restant);\n lastIndex=parameters.lastIndexOf("&name=");\n parameters=parameters.substr(0,lastIndex);\n lastIndex=parameters.lastIndexOf("=");\n restant=parameters.length - lastIndex;\n var id=parameters.substr(-restant+1,restant);\n config.macros.importDFwikis.src=source+"/mod/wiki/webservicelib.php?sel=urlManagement&id="+id+"&page="+page;\n config.macros.importDFwikis.src += attachMD5(calculateMD5());\n } \n loadRemoteItem(config.macros.importDFwikis.src, function(src,txt) {\n var wiki = readItemsFromHTML(txt);\n config.macros.importDFwikis.inbound=wiki;\n window.refreshImportDFwikiList();\n importDFwikiReport();\n config.macros.importDFwikis.index=0;\n config.macros.importDFwikis.index=importDFwikisImmediately(-1);\n importDFwikiStopped(); \n });\n config.macros.importDFwikis.src=src_backup\n break;\n case 'importOpenWikis': // load import source into hidden frame\n importDFwikiReport(); // if an import was in progress, generate a report\n config.macros.importDFwikis.inbound=null; // clear the imported tiddler buffer\n refreshImportDFwikiList(); // reset/resize the listbox\n if (config.macros.importDFwikis.src=="") break;\n var src_backup = config.macros.importDFwikis.src;\n config.macros.importDFwikis.src=src_backup+((src_backup.charAt(src_backup.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php?sel=exportAllWikis";\n config.macros.importDFwikis.src += attachMD5(calculateMD5());\n // Load document into hidden iframe so we can read it's DOM and fill the list\n loadRemoteItem(config.macros.importDFwikis.src, function(src,txt) {\n var tiddlers = readItemsFromHTML(txt);\n var count=tiddlers?tiddlers.length:0;\n if (tiddlers.length!=0) document.getElementById('importOpenPages').disabled = false;\n displayMessage(config.macros.importDFwikis.foundMsg.format([count,src]));\n config.macros.importDFwikis.inbound=tiddlers;\n window.refreshImportDFwikiList();\n });\n config.macros.importDFwikis.src=src_backup;\n break;\n case 'importOpenPages': // load import source into hidden frame\n importDFwikiReport(); // if an import was in progress, generate a report\n //config.macros.importDFwikis.inbound=null; // clear the imported tiddler buffer\n //refreshImportDFwikiList(); // reset/resize the listbox\n if (config.macros.importDFwikis.src=="") break;\n config.macros.importDFwikis.index=0;\n //config.macros.importDFwikis.index=importDFwikis(0);\n var src_backup = config.macros.importDFwikis.src;\n config.macros.importDFwikis.src=src_backup+((src_backup.charAt(src_backup.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php?sel=exportWikiPages&wiki="+getWikiName(0)+"&parser="+config.macros.importDFwikis.parser;\n config.macros.importDFwikis.src += attachMD5(calculateMD5());\n // Load document into hidden iframe so we can read it's DOM and fill the list\n loadRemoteItem(config.macros.importDFwikis.src, function(src,txt) {\n var tiddlers = readItemsFromHTML(txt);\n var count=tiddlers?tiddlers.length:0;\n if (tiddlers.length!=0) document.getElementById('importStart').disabled = false;\n displayMessage(config.macros.importDFwikis.foundMsg.format([count,src]));\n config.macros.importDFwikis.inbound=tiddlers;\n window.refreshImportDFwikiList();\n });\n config.macros.importDFwikis.src=src_backup;\n break;\n case 'importSelectAll': // select all tiddler list items (i.e., not headings)\n importDFwikiReport(); // 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.importDFwikis.countMsg.format([count]));\n break;\n case 'importSelectNew': // select tiddlers not in current document\n importDFwikiReport(); // 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.importDFwikis.countMsg.format([count]));\n break;\n case 'importSelectChanges': // select tiddlers that are updated from existing tiddlers\n importDFwikiReport(); // 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.importDFwikis.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importDFwikis.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.importDFwikis.countMsg.format([count]));\n break;\n case 'importSelectDifferences': // select tiddlers that are new or different from existing tiddlers\n importDFwikiReport(); // 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.importDFwikis.inbound.length; i++) // find matching inbound tiddler\n { var inbound=config.macros.importDFwikis.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.importDFwikis.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 importDFwikiReport(); // if an import was in progress, generate a report\n config.macros.importDFwikis.index=0;\n config.macros.importDFwikis.index=importDFwikis(-1);\n importDFwikiStopped();\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.importDFwikis.inbound) { thePanel.style.display='none'; break; }\n importDFwikiReport(); // if an import was in progress, generate a report\n config.macros.importDFwikis.inbound=null; // clear the imported tiddler buffer\n refreshImportDFwikiList(); // reset/resize the listbox\n break;\n case 'importSkip': // don't import the tiddler\n var theItem = theList.options[config.macros.importDFwikis.index];\n for (var j=0;j<config.macros.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importDFwikis.inbound[j];\n theImported.status='skipped after asking'; // mark item as skipped\n theCollisionPanel.style.display='none';\n config.macros.importDFwikis.index=importDFwikis(config.macros.importDFwikis.index+1); // resume with NEXT item\n importDFwikiStopped();\n break;\n case 'importRename': // change name of imported tiddler\n var theItem = theList.options[config.macros.importDFwikis.index];\n for (var j=0;j<config.macros.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importDFwikis.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.importDFwikis.index=importDFwikis(config.macros.importDFwikis.index); // resume with THIS item\n importDFwikiStopped();\n break;\n case 'importMerge': // join existing and imported tiddler content\n var theItem = theList.options[config.macros.importDFwikis.index];\n for (var j=0;j<config.macros.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importDFwikis.inbound[j];\n var theExisting = store.getTiddler(theItem.value);\n var theText = theExisting.text+'\sn----\sn^^merged from: ';\n theText +='[['+config.macros.importDFwikis.src+'#'+theItem.value+'|'+config.macros.importDFwikis.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.importDFwikis.index=importDFwikis(config.macros.importDFwikis.index); // resume with this item\n importDFwikiStopped();\n break;\n case 'importReplace': // substitute imported tiddler for existing tiddler\n var theItem = theList.options[config.macros.importDFwikis.index];\n for (j=0;j<config.macros.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==theItem.value) break;\n var theImported = config.macros.importDFwikis.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.importDFwikis.index=importDFwikis(config.macros.importDFwikis.index); // resume with THIS item\n importDFwikiStopped();\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.importDFwikis.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.importDFwikis.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.importDFwikis.listsize:theList.options.length;\n break;\n }\n}\n//}}}\n\n// // refresh listbox\n//{{{\nfunction refreshImportDFwikiList(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.importDFwikis.inbound) \n {\n while (theList.length > 0) { theList.options[0] = null; }\n theList.options[0]=new Option('please open moodle URL...',"",false,false);\n theList.size=config.macros.importDFwikis.listsize;\n document.getElementById('importOpenPages').disabled = true;\n document.getElementById('importStart').disabled = true;\n return;\n }\n // get the sort order\n if (!selectedIndex) selectedIndex=0;\n if (selectedIndex==0) config.macros.importDFwikis.sort='title'; // hidden heading\n\n // get the alphasorted list of tiddlers (optionally, filter out unchanged tiddlers)\n var tiddlers=config.macros.importDFwikis.inbound;\n if (tiddlers[0].text == 'error'){ // If wrong user or password don't show open wiki pages button or import button\n document.getElementById('importOpenPages').disabled = true;\n document.getElementById('importStart').disabled = true;\n }\n tiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });\n // clear current list contents\n while (theList.length > 0) { theList.options[0] = null; }\n // add heading and control items to list\n var i=0;\n var indent=String.fromCharCode(160)+String.fromCharCode(160);\n\n for(var t = 0; t < tiddlers.length; t++)\n theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);\n\n theList.selectedIndex=selectedIndex; // select current control item\n if (theList.size<config.macros.importDFwikis.listsize) theList.size=config.macros.importDFwikis.listsize;\n if (theList.size>theList.options.length) theList.size=theList.options.length;\n}\n//}}}\n\n// // Security functions\n//{{{\n/*****************************************************************************\n * md5.js\n *\n * A JavaScript implementation derived from the RSA Data Security, Inc. MD5\n * Message-Digest Algorithm. See http://cw.oaktree.co.uk/site/legal.html for\n * details.\n *\n * Copyright (C) Paul Johnston 1999 - 2000. Distributed under the LGPL.\n *****************************************************************************/\n\n/* to convert strings to a list of ascii values */\nvar sAscii = " !\s"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"\nvar sAscii = sAscii + "[\s\s]^_`abcdefghijklmnopqrstuvwxyz{|}~";\n\n/* convert integer to hex string */\nvar sHex = "0123456789ABCDEF";\nfunction hex(i)\n{\n h = "";\n for(j = 0; j <= 3; j++)\n {\n h += sHex.charAt((i >> (j * 8 + 4)) & 0x0F) +\n sHex.charAt((i >> (j * 8)) & 0x0F);\n }\n return h;\n}\n\n/* add, handling overflows correctly */\nfunction add(x, y)\n{\n return ((x&0x7FFFFFFF) + (y&0x7FFFFFFF)) ^ (x&0x80000000) ^ (y&0x80000000);\n}\n\n/* MD5 rounds functions */\nfunction R1(A, B, C, D, X, S, T)\n{\n q = add(add(A, (B & C) | ((~B) & D)), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R2(A, B, C, D, X, S, T)\n{\n q = add(add(A, (B & D) | (C & (~D))), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R3(A, B, C, D, X, S, T)\n{\n q = add(add(A, B ^ C ^ D), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\nfunction R4(A, B, C, D, X, S, T)\n{\n q = add(add(A, C ^ (B | (~D))), add(X, T));\n return add((q << S) | (q >>> (32 - S)), B);\n}\n\n/* main entry point */\nfunction calcMD5(sInp) {\n\n /* Calculate length in machine words, including padding */\n wLen = (((sInp.length + 8) >> 6) + 1) << 4;\n var X = new Array(wLen);\n\n /* Convert string to array of words */\n j = 4;\n for (i = 0; (i * 4) < sInp.length; i++)\n {\n X[i] = 0;\n for (j = 0; (j < 4) && ((j + i * 4) < sInp.length); j++)\n {\n X[i] += (sAscii.indexOf(sInp.charAt((i * 4) + j)) + 32) << (j * 8);\n }\n }\n\n /* Append padding bits and length */\n if (j == 4)\n {\n X[i++] = 0x80;\n }\n else\n {\n X[i - 1] += 0x80 << (j * 8);\n }\n for(; i < wLen; i++) { X[i] = 0; }\n X[wLen - 2] = sInp.length * 8;\n\n /* hard coded initial values */\n a = 0x67452301;\n b = 0xefcdab89;\n c = 0x98badcfe;\n d = 0x10325476;\n\n /* Process each 16 word block in turn */\n for (i = 0; i < wLen; i += 16) {\n aO = a;\n bO = b;\n cO = c;\n dO = d;\n\n a = R1(a, b, c, d, X[i+ 0], 7 , 0xd76aa478);\n d = R1(d, a, b, c, X[i+ 1], 12, 0xe8c7b756);\n c = R1(c, d, a, b, X[i+ 2], 17, 0x242070db);\n b = R1(b, c, d, a, X[i+ 3], 22, 0xc1bdceee);\n a = R1(a, b, c, d, X[i+ 4], 7 , 0xf57c0faf);\n d = R1(d, a, b, c, X[i+ 5], 12, 0x4787c62a);\n c = R1(c, d, a, b, X[i+ 6], 17, 0xa8304613);\n b = R1(b, c, d, a, X[i+ 7], 22, 0xfd469501);\n a = R1(a, b, c, d, X[i+ 8], 7 , 0x698098d8);\n d = R1(d, a, b, c, X[i+ 9], 12, 0x8b44f7af);\n c = R1(c, d, a, b, X[i+10], 17, 0xffff5bb1);\n b = R1(b, c, d, a, X[i+11], 22, 0x895cd7be);\n a = R1(a, b, c, d, X[i+12], 7 , 0x6b901122);\n d = R1(d, a, b, c, X[i+13], 12, 0xfd987193);\n c = R1(c, d, a, b, X[i+14], 17, 0xa679438e);\n b = R1(b, c, d, a, X[i+15], 22, 0x49b40821);\n\n a = R2(a, b, c, d, X[i+ 1], 5 , 0xf61e2562);\n d = R2(d, a, b, c, X[i+ 6], 9 , 0xc040b340);\n c = R2(c, d, a, b, X[i+11], 14, 0x265e5a51);\n b = R2(b, c, d, a, X[i+ 0], 20, 0xe9b6c7aa);\n a = R2(a, b, c, d, X[i+ 5], 5 , 0xd62f105d);\n d = R2(d, a, b, c, X[i+10], 9 , 0x2441453);\n c = R2(c, d, a, b, X[i+15], 14, 0xd8a1e681);\n b = R2(b, c, d, a, X[i+ 4], 20, 0xe7d3fbc8);\n a = R2(a, b, c, d, X[i+ 9], 5 , 0x21e1cde6);\n d = R2(d, a, b, c, X[i+14], 9 , 0xc33707d6);\n c = R2(c, d, a, b, X[i+ 3], 14, 0xf4d50d87);\n b = R2(b, c, d, a, X[i+ 8], 20, 0x455a14ed);\n a = R2(a, b, c, d, X[i+13], 5 , 0xa9e3e905);\n d = R2(d, a, b, c, X[i+ 2], 9 , 0xfcefa3f8);\n c = R2(c, d, a, b, X[i+ 7], 14, 0x676f02d9);\n b = R2(b, c, d, a, X[i+12], 20, 0x8d2a4c8a);\n\n a = R3(a, b, c, d, X[i+ 5], 4 , 0xfffa3942);\n d = R3(d, a, b, c, X[i+ 8], 11, 0x8771f681);\n c = R3(c, d, a, b, X[i+11], 16, 0x6d9d6122);\n b = R3(b, c, d, a, X[i+14], 23, 0xfde5380c);\n a = R3(a, b, c, d, X[i+ 1], 4 , 0xa4beea44);\n d = R3(d, a, b, c, X[i+ 4], 11, 0x4bdecfa9);\n c = R3(c, d, a, b, X[i+ 7], 16, 0xf6bb4b60);\n b = R3(b, c, d, a, X[i+10], 23, 0xbebfbc70);\n a = R3(a, b, c, d, X[i+13], 4 , 0x289b7ec6);\n d = R3(d, a, b, c, X[i+ 0], 11, 0xeaa127fa);\n c = R3(c, d, a, b, X[i+ 3], 16, 0xd4ef3085);\n b = R3(b, c, d, a, X[i+ 6], 23, 0x4881d05);\n a = R3(a, b, c, d, X[i+ 9], 4 , 0xd9d4d039);\n d = R3(d, a, b, c, X[i+12], 11, 0xe6db99e5);\n c = R3(c, d, a, b, X[i+15], 16, 0x1fa27cf8);\n b = R3(b, c, d, a, X[i+ 2], 23, 0xc4ac5665);\n\n a = R4(a, b, c, d, X[i+ 0], 6 , 0xf4292244);\n d = R4(d, a, b, c, X[i+ 7], 10, 0x432aff97);\n c = R4(c, d, a, b, X[i+14], 15, 0xab9423a7);\n b = R4(b, c, d, a, X[i+ 5], 21, 0xfc93a039);\n a = R4(a, b, c, d, X[i+12], 6 , 0x655b59c3);\n d = R4(d, a, b, c, X[i+ 3], 10, 0x8f0ccc92);\n c = R4(c, d, a, b, X[i+10], 15, 0xffeff47d);\n b = R4(b, c, d, a, X[i+ 1], 21, 0x85845dd1);\n a = R4(a, b, c, d, X[i+ 8], 6 , 0x6fa87e4f);\n d = R4(d, a, b, c, X[i+15], 10, 0xfe2ce6e0);\n c = R4(c, d, a, b, X[i+ 6], 15, 0xa3014314);\n b = R4(b, c, d, a, X[i+13], 21, 0x4e0811a1);\n a = R4(a, b, c, d, X[i+ 4], 6 , 0xf7537e82);\n d = R4(d, a, b, c, X[i+11], 10, 0xbd3af235);\n c = R4(c, d, a, b, X[i+ 2], 15, 0x2ad7d2bb);\n b = R4(b, c, d, a, X[i+ 9], 21, 0xeb86d391);\n\n a = add(a, aO);\n b = add(b, bO);\n c = add(c, cO);\n d = add(d, dO);\n }\n return hex(a) + hex(b) + hex(c) + hex(d);\n}\n\nfunction calculateMD5() \n{\n var pw = document.getElementById("moodlePwd").value;\n return(calcMD5(pw));\n}\n\nfunction attachMD5(hash) \n{\n var getUrl = "&user="+document.getElementById("moodleUserName").value;\n getUrl += "&pwd="+hash.toLowerCase();\n return getUrl;\n}\n//}}}\n\n// // re-entrant processing for handling import with interactive collision prompting\n//{{{\nfunction importDFwikis(startIndex)\n{\n if (!config.macros.importDFwikis.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==-1)\n for (var t=0;t<config.macros.importDFwikis.inbound.length;t++)\n config.macros.importDFwikis.inbound[t].status="";\n startIndex=0;\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.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==t) break;\n var inbound = config.macros.importDFwikis.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.importDFwikis.importTags)\n newTags+=inbound.getTags() // import remote tags\n if (config.macros.importDFwikis.keepTags && theExisting)\n newTags+=" "+theExisting.getTags(); // keep existing tags\n if (config.macros.importDFwikis.addTags && config.macros.importDFwikis.newTags.trim().length)\n newTags+=" "+config.macros.importDFwikis.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 inbound.modified = new Date();\n inbound.created = new Date();\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\nfunction importDFwikisImmediately(startIndex, sync)\n{\n if (!config.macros.importDFwikis.inbound) return -1;\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==-1)\n for (var t=0;t<config.macros.importDFwikis.inbound.length;t++)\n config.macros.importDFwikis.inbound[t].status="";\n startIndex=0;\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 if ((t=theList.options[i].value)=="") \n {\n continue;\n }\n for (var j=0;j<config.macros.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==t) break;\n var inbound = config.macros.importDFwikis.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 it's an error tiddler don't store it\n if (inbound.modifier=="yes")\n break;\n // if tiddler exists and import not marked for replace or merge, stop importing\n if (!sync && 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.importDFwikis.importTags)\n newTags+=inbound.getTags() // import remote tags\n if (config.macros.importDFwikis.keepTags && theExisting)\n newTags+=" "+theExisting.getTags(); // keep existing tags\n if (config.macros.importDFwikis.addTags && config.macros.importDFwikis.newTags.trim().length)\n newTags+=" "+config.macros.importDFwikis.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 inbound.modified = new Date();\n inbound.created = new Date();\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\nfunction getWikiName(startIndex)\n{\n if (!config.macros.importDFwikis.inbound) return -1;\n\n var theList = document.getElementById('importList');\n if (!theList) return "merda";\n var t;\n // if starting new import, reset import status flags\n if (startIndex==0)\n for (var t=0;t<config.macros.importDFwikis.inbound.length;t++)\n config.macros.importDFwikis.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.importDFwikis.inbound.length;j++)\n if (config.macros.importDFwikis.inbound[j].title==t) break;\n var inbound = config.macros.importDFwikis.inbound[j];\n return(inbound.text);\n }\n //return(-1); // signals that we really finished the entire list\n}\n//}}}\n\n//{{{\nfunction importDFwikiStopped()\n{\n var theList = document.getElementById('importList');\n var theNewTitle = document.getElementById('importNewTitle');\n if (!theList) return;\n if (config.macros.importDFwikis.index==-1)\n importDFwikiReport(); // import finished... generate the report\n else\n {\n // DEBUG alert('import stopped at: '+config.macros.importDFwikis.index);\n // import collision... show the collision panel and set the title edit field\n document.getElementById('importCollisionDFwikiPanel').style.display='block';\n theNewTitle.value=theList.options[config.macros.importDFwikis.index].value;\n }\n}\n//}}}\n\n// // ''REPORT GENERATOR''\n//{{{\nfunction importDFwikiReport(quiet)\n{\n if (!config.macros.importDFwikis.inbound) return;\n // DEBUG alert('importDFwikiReport: start');\n\n // if import was not completed, the collision panel will still be open... close it now.\n var panel=document.getElementById('importCollisionDFwikiPanel'); if (panel) panel.style.display='none';\n\n // get the alphasorted list of tiddlers\n var tiddlers = config.macros.importDFwikis.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.chkimportDFwikiReport) {\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.importDFwikis.src+"|"+config.macros.importDFwikis.src+"]]:\sn";\n if (config.macros.importDFwikis.addTags && config.macros.importDFwikis.newTags.trim().length)\n newText += "imported tiddlers were tagged with: \s""+config.macros.importDFwikis.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// 20060918 ELS: DON'T ADD "discard" BUTTON TO REPORT\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.importDFwikis.inbound.length; t++) config.macros.importDFwikis.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.importDFwikis.importedMsg.format([count,tiddlers.length,config.macros.importDFwikis.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.chkimportDFwikiReport) config.options.chkimportDFwikiReport=true;\n\nconfig.macros.loadDFwikis = {\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.loadDFwikis.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.loadDFwikis.askMsg);\n loadRemoteItem(src,loadDFwikis,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.loadDFwikis.askMsg);\n loadRemoteItem(src,loadDFwikis,quiet,ask,filter,force);\n }\n}\n\nfunction loadDFwikis(src,html,quiet,ask,filter,force)\n{\n var tiddlers = readItemsFromHTML(html);\n var count=tiddlers?tiddlers.length:0;\n if (!quiet) displayMessage(config.macros.loadDFwikis.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.loadDFwikis.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.chkimportDFwikiReport) {\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 // 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.loadDFwikis.loadedMsg.format([count,tiddlers.length,src]));\n}\n\nfunction loadRemoteItem(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.loadDFwikis.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.loadDFwikis.openErrMsg.format([src,"(unknown)"])); }\n else {\n if (!quiet) displayMessage(config.macros.loadDFwikis.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.loadDFwikis.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.loadDFwikis.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.loadDFwikis.openErrMsg.format([src,"(unknown)"]));\n displayMessage(e.description?e.description:e.toString());\n }\n }\n }\n}\n\nfunction readItemsFromHTML(html)\n{\n // extract store area from html \n var start=html.indexOf('<div id="storeArea">');\n var end=html.indexOf("<!--POST-BODY-START--"+">",start);\n if (end==-1) var end=html.indexOf("</body"+">",start); // backward-compatibility for older documents\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//}}}
/***\n|''Name:''|InlineJavascriptPlugin|\n|''Source:''|http://www.TiddlyTools.com/#InlineJavascriptPlugin|\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\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.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.\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: 2, date: new Date(2006,10,16)};\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]+"\sn};_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]+"\sn};_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
You may either read the instructions for \n* [[Installation on your Tiddywiki]]\n* [[Installation on your Moodle New Wiki]]\n\n
You need to have installed a Nwe Wiki in your Moodle 1.6 (or above) server. Get it at [[DFwikilabs|http://morfeo.upc.es/crom/course/view.php?id=4]]\n\nIf you have it you need to copy the following files [[http://morfeo.upc.es/crom/mod/resource/view.php?id=38]] into the mod/wiki folder of your moodle installation. \n\nThis will only allow to import the wiki pages placed in wiki activities open to the Guest user in your server.
* You can download a the Tiddywiki template from [[DFWikilabs|http://morfeo.upc.es/crom/course/view.php?id=4]] \n* Or you can take the ImportDFwikisPlugin, view / edit it and copy and paste all its content into a Tiddler in your own Tiddlywiki file, remeber to tag it as systemConfig \n* You can also use the ImportTiddlers plugin to get it.
[[Styles SideBarOptions]]
/***\n|''Name:''|LegacyStrikeThroughPlugin|\n|''Description:''|Support for legacy (pre 2.1) strike through formatting|\n|''Version:''|1.0.1|\n|''Date:''|Jul 21, 2006|\n|''Source:''|http://www.tiddlywiki.com/#LegacyStrikeThroughPlugin|\n|''Author:''|MartinBudden (mjbudden (at) gmail (dot) com)|\n|''License:''|[[BSD open source license]]|\n|''CoreVersion:''|2.1.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n\n***/\n\n//{{{\n\n// Ensure that the LegacyStrikeThrough Plugin is only installed once.\nif(!version.extensions.LegacyStrikeThroughPlugin)\n {\n version.extensions.LegacyStrikeThroughPlugin = true;\n\nconfig.formatters.push(\n{\n name: "legacyStrikeByChar",\n match: "==",\n termRegExp: /(==)/mg,\n element: "strike",\n handler: config.formatterHelpers.createElementAndWikify\n});\n\n} // end of "install only once"\n//}}}\n
<<<\nThis work is based upon TiddlyWiki <<version>>, written by Jeremy Ruston, &copy; Osmosoft Limited, which has been distributed under a BSD open source license.\n\nThis work includes one or more derivative components that have been modified from original licensed components created by Eric L. Shulman\n and/or ELS Design Studios and are subject to the terms and conditions of the Creative Commons Attribution-ShareAlike 2.5 License as well as all other terms and conditions as described in http://www.TiddlyTools.com/#LegalStatements\n\nModifications and additions to this work, including (but not limited to) original programmatic components ("plugins", "macros", "scripts", "stylesheets") have been created by [[Ludo(Marc Alier)]], Oriol Nieto and Alex Moreno. You are permitted to use, copy, and/or modify these components, subject to the terms and conditions of the [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] as well as all other terms and conditions specifically included within the body of this work.\n\nAny and all modifications and/or additions that you make to components of this work must be clearly identified as a derivative work that is easily distinguished from the original version, and must retain appropriate licensing information and references ( i.e., ~URLs) to the official distribution source for the unaltered component.\n\nAll other original content, including (but not limited to) writings, images, sound recordings, and videos, are the property of Marc Alier and/or Oriol Nieto and or Alex Moreno, or are used under license or agreement with third parties and, except as required for normative operation and viewing of this work, may not be stored, displayed or re-transmitted in any form, nor used for any commercial purposes, without the specific prior permission of the respective rights holders.\n<<<\n\n''Limits on Liability:''\n<<<\nAll materials are presented on an "as-is" basis and are subject to change without notice. The author of this document makes no claims regarding the suitability or reliability of the information presented, and assumes no liability for any damages that may occur as a result of its use.\n<<<\n@@display:block;text-align:center;^^//please review these statements periodically, as they are subject to change without notice//^^@@\n\n''About DFWiki and Moodle New wiki'' [[DFWiki Readme|http://morfeo.upc.es/crom/file.php/4/tiddlywiki_integration/readme.txt]]\n<<<\nDFWIKI is a project conceived and leaded by Ludo ( Marc Alier malier@lsi.upc.edu)\nto build a new wiki wiki module for moodle. I started on Feb 2005 and still goes on \nnow at late 2006.\n\nThis alternative Wiki module (called also new wiki) is the evolution of DFWiki to fit \nin Moodle 1.6 replacing the standard wiki module. The Moodle roadmap places n wiki \nas the oficial Wiki module for Moodle 1.8.\n \nAll the dfwiki development has been done within the frame of degree projects in\nthe Computer Science Engineering studies in the FIB school "http://www.fib.upc.edu" \nof the UPC University "http://www.upc.edu"\n\nThe main developers that have worked in this project are\n* Ferran Recio \n* David Castro \n* Jordi Piguillem Poch\n* Bernardino Todoli\n\nAnd a growing number of students that contributes to this project http://docs.moodle.org/en/Dfwikiteam\n\nDFWiki has two paralel projects :\nThe dfwiki Course . Wich alows to place a wiki in the main course page (even in the \nMoodle main course)\nThe wikiBook Module ( in development and soon released ) that allows to create a \nordered and due noted seqüence of pages out of a chaotic wiki. It also will allow \nto place metadata, and export to formats like docBook, pdf, scorm and so on.\n\nDFWiki has the same license as moodle, whatever it is wink\nFind dfwiki news in moodle.org in "using moodle"-> wiki forum and in the \nnew dfwiki home page. http://morfeo.upc.edu/crom\n\nLudo (Marc Alier) \n\nmalier@lsi.upc.edu\nhttp://www.lsi.upc.edu/~malier\n<<<\n\n
[>img[http://static.flickr.com/80/267908220_64b1725a4d_o.jpg][http://morfeo.upc.edu/crom/]]\n[<img[alt_text|http://www.lsi.upc.es/~malier/ludo03.jpg]]\nContact info:\n'''Ludo / Marc Alier ''' \nFacultat d'Informàtica de Barcelona' http:www.fib.upc.edu -\nDepartament de Llenguatges i Sistemes Informàtics - http://www.lis.upc.edu\nUniversitat Politècnica de Catalunya http://www.upc.edu\nmaito:malier@lsi.upc.es\nEdifici OMEGA - despatx 116\nJordi Girona Salgado, 1-3 E-08034 Barcelona\nTel +34 9341 37885\n[[Home page|http://www.lsi.upc.edu/~malier]]\n[[DFwikiLabs|http://morfeo.upc.edu/crom]]\n[[Orangoodle|http://orangoodle.blogspot.com]] .\n[[Orangoodling|http://orangoodling.blogspot.com]] \n[[Moodle New Wiki|http://appserv.lsi.upc.es/palangana/moodle/course/view.php?id=15]]\n[[Moodle Internalmail |http://appserv.lsi.upc.es/palangana/moodle/course/view.php?id=18]]\n[[J2MEMicroDB.|http://morfeo.upc.es/crom/course/view.php?id=5]]\n\n
[[DFwikilabs Moodle NWiki, Internalmail, and more|http://morfeo.upc.edu/crom]]\n[[Orangoodling the blog (castellano)|http://orangoodling.blogspot.com]]\n[[Osos de viaje|http://ososdeviaje.dfwikilabs.org]]\n[[Osos de viaje old blog|http://ososdeviaje.wordpress.com]]\n[[dfwikilabs|http://www.dfwikilabs.org]]\n[[blog olpc|http://blogs.dfwikilabs.org/olpc]]\n\n\n[img[http://static.flickr.com/80/267908220_64b1725a4d_o.jpg][http://morfeo.upc.edu/crom/]]\n'''[[Download this Tiddlywiki|http://moodle.tiddlyspot.com/]]'''\n----\nImportDFwikisPlugin\nExportTiddlersToDFwikiPlugin\nSynchronizePlugin\n[[Installation Instructions]]\n[[Download and Updates|http://morfeo.upc.es/crom/course/view.php?id=4]]\n[[DFWikiTeam]]\n[[RSS Feed|http://moodle.tiddlyspot.com/index.xml]]\n[[License And Legal Aspects]]\n[[Bookmark|http://del.icio.us/granludo]]\n[[Editor Tools]]\n<script>\nvar _uacct=""; // set up the Urchin Account\nvar _userv=1; // service mode (0=local,1=remote,2=both)\n\n//-- UTM User Settings\nvar _ufsc=1; // set client info flag (1=on|0=off)\nvar _udn="auto"; // (auto|none|domain) set the domain name for cookies\nvar _uhash="on"; // (on|off) unique domain hash for cookies\nvar _utimeout="1800"; // set the inactive session timeout in seconds\nvar _ugifpath="/__utm.gif"; // set the web path to the __utm.gif file\nvar _utsp="|"; // transaction field separator\nvar _uflash=1; // set flash version detect option (1=on|0=off)\nvar _utitle=1; // set the document title detect option (1=on|0=off)\nvar _ulink=0; // enable linker functionality (1=on|0=off)\nvar _uanchor=0; // enable use of anchors for campaign (1=on|0=off)\nvar _utcp="/"; // the cookie path for tracking\nvar _usample=100; // The sampling % of visitors to track (1-100).\n\n//-- UTM Campaign Tracking Settings\nvar _uctm=1; // set campaign tracking module (1=on|0=off)\nvar _ucto="15768000"; // set timeout in seconds (6 month default)\nvar _uccn="utm_campaign"; // name\nvar _ucmd="utm_medium"; // medium (cpc|cpm|link|email|organic)\nvar _ucsr="utm_source"; // source\nvar _uctr="utm_term"; // term/keyword\nvar _ucct="utm_content"; // content\nvar _ucid="utm_id"; // id number\nvar _ucno="utm_nooverride"; // don't override\n\n//-- Auto/Organic Sources and Keywords\nvar _uOsr=new Array();\nvar _uOkw=new Array();\n_uOsr[0]="google"; _uOkw[0]="q";\n_uOsr[1]="yahoo"; _uOkw[1]="p";\n_uOsr[2]="msn"; _uOkw[2]="q";\n_uOsr[3]="aol"; _uOkw[3]="query";\n_uOsr[4]="aol"; _uOkw[4]="encquery";\n_uOsr[5]="lycos"; _uOkw[5]="query";\n_uOsr[6]="ask"; _uOkw[6]="q";\n_uOsr[7]="altavista"; _uOkw[7]="q";\n_uOsr[8]="search"; _uOkw[8]="q";\n_uOsr[9]="netscape"; _uOkw[9]="s";\n_uOsr[10]="cnn"; _uOkw[10]="query";\n_uOsr[11]="looksmart"; _uOkw[11]="qt";\n_uOsr[12]="about"; _uOkw[12]="terms";\n_uOsr[13]="mamma"; _uOkw[13]="query";\n_uOsr[14]="alltheweb"; _uOkw[14]="q";\n_uOsr[15]="gigablast"; _uOkw[15]="q";\n_uOsr[16]="voila"; _uOkw[16]="kw";\n_uOsr[17]="virgilio"; _uOkw[17]="qs";\n_uOsr[18]="live"; _uOkw[18]="q";\n_uOsr[19]="baidu"; _uOkw[19]="wd";\n_uOsr[20]="alice"; _uOkw[20]="qs";\n_uOsr[21]="seznam"; _uOkw[21]="w";\n_uOsr[22]="yandex"; _uOkw[22]="text";\n_uOsr[23]="najdi"; _uOkw[23]="q";\n\n//-- Auto/Organic Keywords to Ignore\nvar _uOno=new Array();\n//_uOno[0]="urchin";\n//_uOno[1]="urchin.com";\n//_uOno[2]="www.urchin.com";\n\n//-- Referral domains to Ignore\nvar _uRno=new Array();\n//_uRno[0]=".urchin.com";\n\n//-- **** Don't modify below this point ***\nvar _uff,_udh,_udt,_ubl=0,_udo="",_uu,_ufns=0,_uns=0,_ur="-",_ufno=0,_ust=0,_ubd=document,_udl=_ubd.location,_udlh="",_uwv="1";\nvar _ugifpath2="http://www.google-analytics.com/__utm.gif";\nif (_udl.hash) _udlh=_udl.href.substring(_udl.href.indexOf('#'));\nif (_udl.protocol=="https:") _ugifpath2="https://ssl.google-analytics.com/__utm.gif";\nif (!_utcp || _utcp=="") _utcp="/";\nfunction urchinTracker(page) {\n if (_udl.protocol=="file:") return;\n if (_uff && (!page || page=="")) return;\n var a,b,c,xx,v,z,k,x="",s="",f=0;\n var nx=" expires=Sun, 18 Jan 2038 00:00:00 GMT;";\n var dc=_ubd.cookie;\n _udh=_uDomain();\n if (!_uVG()) return;\n _uu=Math.round(Math.random()*2147483647);\n _udt=new Date();\n _ust=Math.round(_udt.getTime()/1000);\n a=dc.indexOf("__utma="+_udh);\n b=dc.indexOf("__utmb="+_udh);\n c=dc.indexOf("__utmc="+_udh);\n if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }\n if (_utimeout && _utimeout!="") {\n x=new Date(_udt.getTime()+(_utimeout*1000));\n x=" expires="+x.toGMTString()+";";\n }\n if (_ulink) {\n if (_uanchor && _udlh && _udlh!="") s=_udlh+"&";\n s+=_udl.search;\n if(s && s!="" && s.indexOf("__utma=")>=0) {\n if (!(_uIN(a=_uGC(s,"__utma=","&")))) a="-";\n if (!(_uIN(b=_uGC(s,"__utmb=","&")))) b="-";\n if (!(_uIN(c=_uGC(s,"__utmc=","&")))) c="-";\n v=_uGC(s,"__utmv=","&");\n z=_uGC(s,"__utmz=","&");\n k=_uGC(s,"__utmk=","&");\n xx=_uGC(s,"__utmx=","&");\n if ((k*1) != ((_uHash(a+b+c+xx+z+v)*1)+(_udh*1))) {_ubl=1;a="-";b="-";c="-";xx="-";z="-";v="-";}\n if (a!="-" && b!="-" && c!="-") f=1;\n else if(a!="-") f=2;\n }\n }\n if(f==1) {\n _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;\n _ubd.cookie="__utmb="+b+"; path="+_utcp+";"+x+_udo;\n _ubd.cookie="__utmc="+c+"; path="+_utcp+";"+_udo;\n } else if (f==2) {\n a=_uFixA(s,"&",_ust);\n _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;\n _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;\n _ubd.cookie="__utmc="+_udh+"; path="+_utcp+";"+_udo;\n _ufns=1;\n } else if (a>=0 && b>=0 && c>=0) {\n _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;\n } else {\n if (a>=0) a=_uFixA(_ubd.cookie,";",_ust);\n else a=_udh+"."+_uu+"."+_ust+"."+_ust+"."+_ust+".1";\n _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;\n _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;\n _ubd.cookie="__utmc="+_udh+"; path="+_utcp+";"+_udo;\n _ufns=1;\n }\n if (_ulink && xx && xx!="" && xx!="-") {\n xx=_uUES(xx);\n if (xx.indexOf(";")==-1) _ubd.cookie="__utmx="+xx+"; path="+_utcp+";"+nx+_udo;\n }\n if (_ulink && v && v!="" && v!="-") {\n v=_uUES(v);\n if (v.indexOf(";")==-1) _ubd.cookie="__utmv="+v+"; path="+_utcp+";"+nx+_udo;\n }\n _uInfo(page);\n _ufns=0;\n _ufno=0;\n _uff=1;\n}\nfunction _uInfo(page) {\n var p,s="",dm="",pg=_udl.pathname+_udl.search;\n if (page && page!="") pg=_uES(page,1);\n _ur=_ubd.referrer;\n if (!_ur || _ur=="") { _ur="-"; }\n else {\n dm=_ubd.domain;\n if(_utcp && _utcp!="/") dm+=_utcp;\n p=_ur.indexOf(dm);\n if ((p>=0) && (p<=8)) { _ur="0"; }\n if (_ur.indexOf("[")==0 && _ur.lastIndexOf("]")==(_ur.length-1)) { _ur="-"; }\n }\n s+="&utmn="+_uu;\n if (_ufsc) s+=_uBInfo();\n if (_uctm) s+=_uCInfo();\n if (_utitle && _ubd.title && _ubd.title!="") s+="&utmdt="+_uES(_ubd.title);\n if (_udl.hostname && _udl.hostname!="") s+="&utmhn="+_uES(_udl.hostname);\n s+="&utmr="+_ur;\n s+="&utmp="+pg;\n if ((_userv==0 || _userv==2) && _uSP()) {\n var i=new Image(1,1);\n i.src=_ugifpath+"?"+"utmwv="+_uwv+s;\n i.onload=function() {_uVoid();}\n }\n if ((_userv==1 || _userv==2) && _uSP()) {\n var i2=new Image(1,1);\n i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();\n i2.onload=function() { _uVoid(); }\n }\n return;\n}\nfunction _uVoid() { return; }\nfunction _uCInfo() {\n if (!_ucto || _ucto=="") { _ucto="15768000"; }\n if (!_uVG()) return;\n var c="",t="-",t2="-",t3="-",o=0,cs=0,cn=0,i=0,z="-",s="";\n if (_uanchor && _udlh && _udlh!="") s=_udlh+"&";\n s+=_udl.search;\n var x=new Date(_udt.getTime()+(_ucto*1000));\n var dc=_ubd.cookie;\n x=" expires="+x.toGMTString()+";";\n if (_ulink && !_ubl) {\n z=_uUES(_uGC(s,"__utmz=","&"));\n if (z!="-" && z.indexOf(";")==-1) { _ubd.cookie="__utmz="+z+"; path="+_utcp+";"+x+_udo; return ""; }\n }\n z=dc.indexOf("__utmz="+_udh);\n if (z>-1) { z=_uGC(dc,"__utmz="+_udh,";"); }\n else { z="-"; }\n t=_uGC(s,_ucid+"=","&");\n t2=_uGC(s,_ucsr+"=","&");\n t3=_uGC(s,"gclid=","&");\n if ((t!="-" && t!="") || (t2!="-" && t2!="") || (t3!="-" && t3!="")) {\n if (t!="-" && t!="") c+="utmcid="+_uEC(t);\n if (t2!="-" && t2!="") { if (c != "") c+="|"; c+="utmcsr="+_uEC(t2); }\n if (t3!="-" && t3!="") { if (c != "") c+="|"; c+="utmgclid="+_uEC(t3); }\n t=_uGC(s,_uccn+"=","&");\n if (t!="-" && t!="") c+="|utmccn="+_uEC(t);\n else c+="|utmccn=(not+set)";\n t=_uGC(s,_ucmd+"=","&");\n if (t!="-" && t!="") c+="|utmcmd="+_uEC(t);\n else c+="|utmcmd=(not+set)";\n t=_uGC(s,_uctr+"=","&");\n if (t!="-" && t!="") c+="|utmctr="+_uEC(t);\n else { t=_uOrg(1); if (t!="-" && t!="") c+="|utmctr="+_uEC(t); }\n t=_uGC(s,_ucct+"=","&");\n if (t!="-" && t!="") c+="|utmcct="+_uEC(t);\n t=_uGC(s,_ucno+"=","&");\n if (t=="1") o=1;\n if (z!="-" && o==1) return "";\n }\n if (c=="-" || c=="") { c=_uOrg(); if (z!="-" && _ufno==1) return ""; }\n if (c=="-" || c=="") { if (_ufns==1) c=_uRef(); if (z!="-" && _ufno==1) return ""; }\n if (c=="-" || c=="") {\n if (z=="-" && _ufns==1) { c="utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)"; }\n if (c=="-" || c=="") return "";\n }\n if (z!="-") {\n i=z.indexOf(".");\n if (i>-1) i=z.indexOf(".",i+1);\n if (i>-1) i=z.indexOf(".",i+1);\n if (i>-1) i=z.indexOf(".",i+1);\n t=z.substring(i+1,z.length);\n if (t.toLowerCase()==c.toLowerCase()) cs=1;\n t=z.substring(0,i);\n if ((i=t.lastIndexOf(".")) > -1) {\n t=t.substring(i+1,t.length);\n cn=(t*1);\n }\n }\n if (cs==0 || _ufns==1) {\n t=_uGC(dc,"__utma="+_udh,";");\n if ((i=t.lastIndexOf(".")) > 9) {\n _uns=t.substring(i+1,t.length);\n _uns=(_uns*1);\n }\n cn++;\n if (_uns==0) _uns=1;\n _ubd.cookie="__utmz="+_udh+"."+_ust+"."+_uns+"."+cn+"."+c+"; path="+_utcp+"; "+x+_udo;\n }\n if (cs==0 || _ufns==1) return "&utmcn=1";\n else return "&utmcr=1";\n}\nfunction _uRef() {\n if (_ur=="0" || _ur=="" || _ur=="-") return "";\n var i=0,h,k,n;\n if ((i=_ur.indexOf("://"))<0) return "";\n h=_ur.substring(i+3,_ur.length);\n if (h.indexOf("/") > -1) {\n k=h.substring(h.indexOf("/"),h.length);\n if (k.indexOf("?") > -1) k=k.substring(0,k.indexOf("?"));\n h=h.substring(0,h.indexOf("/"));\n }\n h=h.toLowerCase();\n n=h;\n if ((i=n.indexOf(":")) > -1) n=n.substring(0,i);\n for (var ii=0;ii<_uRno.length;ii++) {\n if ((i=n.indexOf(_uRno[ii].toLowerCase())) > -1 && n.length==(i+_uRno[ii].length)) { _ufno=1; break; }\n }\n if (h.indexOf("www.")==0) h=h.substring(4,h.length);\n return "utmccn=(referral)|utmcsr="+_uEC(h)+"|"+"utmcct="+_uEC(k)+"|utmcmd=referral";\n}\nfunction _uOrg(t) {\n if (_ur=="0" || _ur=="" || _ur=="-") return "";\n var i=0,h,k;\n if ((i=_ur.indexOf("://")) < 0) return "";\n h=_ur.substring(i+3,_ur.length);\n if (h.indexOf("/") > -1) {\n h=h.substring(0,h.indexOf("/"));\n }\n for (var ii=0;ii<_uOsr.length;ii++) {\n if (h.toLowerCase().indexOf(_uOsr[ii].toLowerCase()) > -1) {\n if ((i=_ur.indexOf("?"+_uOkw[ii]+"=")) > -1 || (i=_ur.indexOf("&"+_uOkw[ii]+"=")) > -1) {\n k=_ur.substring(i+_uOkw[ii].length+2,_ur.length);\n if ((i=k.indexOf("&")) > -1) k=k.substring(0,i);\n for (var yy=0;yy<_uOno.length;yy++) {\n if (_uOno[yy].toLowerCase()==k.toLowerCase()) { _ufno=1; break; }\n }\n if (t) return _uEC(k);\n else return "utmccn=(organic)|utmcsr="+_uEC(_uOsr[ii])+"|"+"utmctr="+_uEC(k)+"|utmcmd=organic";\n }\n }\n }\n return "";\n}\nfunction _uBInfo() {\n var sr="-",sc="-",ul="-",fl="-",cs="-",je=1;\n var n=navigator;\n if (self.screen) {\n sr=screen.width+"x"+screen.height;\n sc=screen.colorDepth+"-bit";\n } else if (self.java) {\n var j=java.awt.Toolkit.getDefaultToolkit();\n var s=j.getScreenSize();\n sr=s.width+"x"+s.height;\n }\n if (n.language) { ul=n.language.toLowerCase(); }\n else if (n.browserLanguage) { ul=n.browserLanguage.toLowerCase(); }\n je=n.javaEnabled()?1:0;\n if (_uflash) fl=_uFlash();\n if (_ubd.characterSet) cs=_uES(_ubd.characterSet);\n else if (_ubd.charset) cs=_uES(_ubd.charset);\n return "&utmcs="+cs+"&utmsr="+sr+"&utmsc="+sc+"&utmul="+ul+"&utmje="+je+"&utmfl="+fl;\n}\nfunction __utmSetTrans() {\n var e;\n if (_ubd.getElementById) e=_ubd.getElementById("utmtrans");\n else if (_ubd.utmform && _ubd.utmform.utmtrans) e=_ubd.utmform.utmtrans;\n if (!e) return;\n var l=e.value.split("UTM:");\n var i,i2,c;\n if (_userv==0 || _userv==2) i=new Array();\n if (_userv==1 || _userv==2) { i2=new Array(); c=_uGCS(); }\n\n for (var ii=0;ii<l.length;ii++) {\n l[ii]=_uTrim(l[ii]);\n if (l[ii].charAt(0)!='T' && l[ii].charAt(0)!='I') continue;\n var r=Math.round(Math.random()*2147483647);\n if (!_utsp || _utsp=="") _utsp="|";\n var f=l[ii].split(_utsp),s="";\n if (f[0].charAt(0)=='T') {\n s="&utmt=tran"+"&utmn="+r;\n f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+_uES(f[1]);\n f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmtst="+_uES(f[2]);\n f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmtto="+_uES(f[3]);\n f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmttx="+_uES(f[4]);\n f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmtsp="+_uES(f[5]);\n f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmtci="+_uES(f[6]);\n f[7]=_uTrim(f[7]); if(f[7]&&f[7]!="") s+="&utmtrg="+_uES(f[7]);\n f[8]=_uTrim(f[8]); if(f[8]&&f[8]!="") s+="&utmtco="+_uES(f[8]);\n } else {\n s="&utmt=item"+"&utmn="+r;\n f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+_uES(f[1]);\n f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmipc="+_uES(f[2]);\n f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmipn="+_uES(f[3]);\n f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmiva="+_uES(f[4]);\n f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmipr="+_uES(f[5]);\n f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmiqt="+_uES(f[6]);\n }\n if ((_userv==0 || _userv==2) && _uSP()) {\n i[ii]=new Image(1,1);\n i[ii].src=_ugifpath+"?"+"utmwv="+_uwv+s;\n i[ii].onload=function() { _uVoid(); }\n }\n if ((_userv==1 || _userv==2) && _uSP()) {\n i2[ii]=new Image(1,1);\n i2[ii].src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+c;\n i2[ii].onload=function() { _uVoid(); }\n }\n }\n return;\n}\nfunction _uFlash() {\n var f="-",n=navigator;\n if (n.plugins && n.plugins.length) {\n for (var ii=0;ii<n.plugins.length;ii++) {\n if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {\n f=n.plugins[ii].description.split('Shockwave Flash ')[1];\n break;\n }\n }\n } else if (window.ActiveXObject) {\n for (var ii=10;ii>=2;ii--) {\n try {\n var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");\n if (fl) { f=ii + '.0'; break; }\n }\n catch(e) {}\n }\n }\n return f;\n}\nfunction __utmLinker(l,h) {\n if (!_ulink) return;\n var p,k,a="-",b="-",c="-",x="-",z="-",v="-";\n var dc=_ubd.cookie;\n if (!l || l=="") return;\n var iq = l.indexOf("?"); \n var ih = l.indexOf("#"); \n if (dc) {\n a=_uES(_uGC(dc,"__utma="+_udh,";"));\n b=_uES(_uGC(dc,"__utmb="+_udh,";"));\n c=_uES(_uGC(dc,"__utmc="+_udh,";"));\n x=_uES(_uGC(dc,"__utmx="+_udh,";"));\n z=_uES(_uGC(dc,"__utmz="+_udh,";"));\n v=_uES(_uGC(dc,"__utmv="+_udh,";"));\n k=(_uHash(a+b+c+x+z+v)*1)+(_udh*1);\n p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmx="+x+"&__utmz="+z+"&__utmv="+v+"&__utmk="+k;\n }\n if (p) {\n if (h && ih>-1) return;\n if (h) { _udl.href=l+"#"+p; }\n else {\n if (iq==-1 && ih==-1) _udl.href=l+"?"+p;\n else if (ih==-1) _udl.href=l+"&"+p;\n else if (iq==-1) _udl.href=l.substring(0,ih-1)+"?"+p+l.substring(ih);\n else _udl.href=l.substring(0,ih-1)+"&"+p+l.substring(ih);\n }\n } else { _udl.href=l; }\n}\nfunction __utmLinkPost(f,h) {\n if (!_ulink) return;\n var p,k,a="-",b="-",c="-",x="-",z="-",v="-";\n var dc=_ubd.cookie;\n if (!f || !f.action) return;\n var iq = f.action.indexOf("?"); \n var ih = f.action.indexOf("#"); \n if (dc) {\n a=_uES(_uGC(dc,"__utma="+_udh,";"));\n b=_uES(_uGC(dc,"__utmb="+_udh,";"));\n c=_uES(_uGC(dc,"__utmc="+_udh,";"));\n x=_uES(_uGC(dc,"__utmx="+_udh,";"));\n z=_uES(_uGC(dc,"__utmz="+_udh,";"));\n v=_uES(_uGC(dc,"__utmv="+_udh,";"));\n k=(_uHash(a+b+c+x+z+v)*1)+(_udh*1);\n p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmx="+x+"&__utmz="+z+"&__utmv="+v+"&__utmk="+k;\n }\n if (p) {\n if (h && ih>-1) return;\n if (h) { f.action+="#"+p; }\n else {\n if (iq==-1 && ih==-1) f.action+="?"+p;\n else if (ih==-1) f.action+="&"+p;\n else if (iq==-1) f.action=f.action.substring(0,ih-1)+"?"+p+f.action.substring(ih);\n else f.action=f.action.substring(0,ih-1)+"&"+p+f.action.substring(ih);\n }\n }\n return;\n}\nfunction __utmSetVar(v) {\n if (!v || v=="") return;\n if (!_udo || _udo == "") {\n _udh=_uDomain();\n if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }\n }\n if (!_uVG()) return;\n var r=Math.round(Math.random() * 2147483647);\n _ubd.cookie="__utmv="+_udh+"."+_uES(v)+"; path="+_utcp+"; expires=Sun, 18 Jan 2038 00:00:00 GMT;"+_udo;\n var s="&utmt=var&utmn="+r;\n if ((_userv==0 || _userv==2) && _uSP()) {\n var i=new Image(1,1);\n i.src=_ugifpath+"?"+"utmwv="+_uwv+s;\n i.onload=function() { _uVoid(); }\n }\n if ((_userv==1 || _userv==2) && _uSP()) {\n var i2=new Image(1,1);\n i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();\n i2.onload=function() { _uVoid(); }\n }\n}\nfunction _uGCS() {\n var t,c="",dc=_ubd.cookie;\n if ((t=_uGC(dc,"__utma="+_udh,";"))!="-") c+=_uES("__utma="+t+";+");\n if ((t=_uGC(dc,"__utmb="+_udh,";"))!="-") c+=_uES("__utmb="+t+";+");\n if ((t=_uGC(dc,"__utmc="+_udh,";"))!="-") c+=_uES("__utmc="+t+";+");\n if ((t=_uGC(dc,"__utmx="+_udh,";"))!="-") c+=_uES("__utmx="+t+";+");\n if ((t=_uGC(dc,"__utmz="+_udh,";"))!="-") c+=_uES("__utmz="+t+";+");\n if ((t=_uGC(dc,"__utmv="+_udh,";"))!="-") c+=_uES("__utmv="+t+";");\n if (c.charAt(c.length-1)=="+") c=c.substring(0,c.length-1);\n return c;\n}\nfunction _uGC(l,n,s) {\n if (!l || l=="" || !n || n=="" || !s || s=="") return "-";\n var i,i2,i3,c="-";\n i=l.indexOf(n);\n i3=n.indexOf("=")+1;\n if (i > -1) {\n i2=l.indexOf(s,i); if (i2 < 0) { i2=l.length; }\n c=l.substring((i+i3),i2);\n }\n return c;\n}\nfunction _uDomain() {\n if (!_udn || _udn=="" || _udn=="none") { _udn=""; return 1; }\n if (_udn=="auto") {\n var d=_ubd.domain;\n if (d.substring(0,4)=="www.") {\n d=d.substring(4,d.length);\n }\n _udn=d;\n }\n if (_uhash=="off") return 1;\n return _uHash(_udn);\n}\nfunction _uHash(d) {\n if (!d || d=="") return 1;\n var h=0,g=0;\n for (var i=d.length-1;i>=0;i--) {\n var c=parseInt(d.charCodeAt(i));\n h=((h << 6) & 0xfffffff) + c + (c << 14);\n if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));\n }\n return h;\n}\nfunction _uFixA(c,s,t) {\n if (!c || c=="" || !s || s=="" || !t || t=="") return "-";\n var a=_uGC(c,"__utma="+_udh,s);\n var lt=0,i=0;\n if ((i=a.lastIndexOf(".")) > 9) {\n _uns=a.substring(i+1,a.length);\n _uns=(_uns*1)+1;\n a=a.substring(0,i);\n if ((i=a.lastIndexOf(".")) > 7) {\n lt=a.substring(i+1,a.length);\n a=a.substring(0,i);\n }\n if ((i=a.lastIndexOf(".")) > 5) {\n a=a.substring(0,i);\n }\n a+="."+lt+"."+t+"."+_uns;\n }\n return a;\n}\nfunction _uTrim(s) {\n if (!s || s=="") return "";\n while ((s.charAt(0)==' ') || (s.charAt(0)=='\sn') || (s.charAt(0,1)=='\sr')) s=s.substring(1,s.length);\n while ((s.charAt(s.length-1)==' ') || (s.charAt(s.length-1)=='\sn') || (s.charAt(s.length-1)=='\sr')) s=s.substring(0,s.length-1);\n return s;\n}\nfunction _uEC(s) {\n var n="";\n if (!s || s=="") return "";\n for (var i=0;i<s.length;i++) {if (s.charAt(i)==" ") n+="+"; else n+=s.charAt(i);}\n return n;\n}\nfunction __utmVisitorCode(f) {\n var r=0,t=0,i=0,i2=0,m=31;\n var a=_uGC(_ubd.cookie,"__utma="+_udh,";");\n if ((i=a.indexOf(".",0))<0) return;\n if ((i2=a.indexOf(".",i+1))>0) r=a.substring(i+1,i2); else return ""; \n if ((i=a.indexOf(".",i2+1))>0) t=a.substring(i2+1,i); else return ""; \n if (f) {\n return r;\n } else {\n var c=new Array('A','B','C','D','E','F','G','H','J','K','L','M','N','P','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9');\n return c[r>>28&m]+c[r>>23&m]+c[r>>18&m]+c[r>>13&m]+"-"+c[r>>8&m]+c[r>>3&m]+c[((r&7)<<2)+(t>>30&3)]+c[t>>25&m]+c[t>>20&m]+"-"+c[t>>15&m]+c[t>>10&m]+c[t>>5&m]+c[t&m];\n }\n}\nfunction _uIN(n) {\n if (!n) return false;\n for (var i=0;i<n.length;i++) {\n var c=n.charAt(i);\n if ((c<"0" || c>"9") && (c!=".")) return false;\n }\n return true;\n}\nfunction _uES(s,u) {\n if (typeof(encodeURIComponent) == 'function') {\n if (u) return encodeURI(s);\n else return encodeURIComponent(s);\n } else {\n return escape(s);\n }\n}\nfunction _uUES(s) {\n if (typeof(decodeURIComponent) == 'function') {\n return decodeURIComponent(s);\n } else {\n return unescape(s);\n }\n}\nfunction _uVG() {\n if((_udn.indexOf("www.google.") == 0 || _udn.indexOf(".google.") == 0 || _udn.indexOf("google.") == 0) && _utcp=='/') {\n return false;\n }\n return true;\n}\nfunction _uSP() {\n var s=100;\n if (_usample) s=_usample;\n if(s>=100 || s<=0) return true;\n return ((__utmVisitorCode(1)%10000)<(s*100));\n}\n\n_uacct = "UA-442126-7";urchinTracker();\n</script>\n\n<script src="http://embed.technorati.com/embed/vddq934kug.js">\n</script>
[[Moodle|http://moodle.org]] is a course management system (CMS) - a free, Open Source software package designed using sound pedagogical principles, to help educators create effective online learning communities. You can download and use it on any computer you have handy (including webhosts), yet it can scale from a single-teacher site to a 50,000-student University. This site itself is created using Moodle, so check out the Moodle Demonstration Courses or read the latest Moodle Buzz.
''Moodle N Wiki'' is what we call a new [[activity Module]] developed for the [[Moodle]] comunity to replace the current wiki module. \n\n[[N Wiki]] or [[NWiki]] is a short name for New Wiki. N Wiki is based on another Wiki activity Module called [[DFWiki]]. \n\nThe N Wiki module is the evolution of DFWiki to fit in [[Moodle]] 1.6 and later replacing the standard wiki module. \nThe [[Moodle roadmap]] places N Wiki as the oficial [[Wiki]] module for Moodle 1.8.\n \nN Wiki has two paralel projects :\n*The [[Wiki Course format]] . Wich alows to place a wiki in the main course page (even in the Moodle main course)\n*The WikiBook Module ( in development and soon released ) that allows to create noted seqüence of pages out of a wiki networked and chaotic bunch. It also will allow to place metadata, and export to formats like DocBook, Pdf, SCORM and others.\n\nTo get Moodle N Wiki : [[DFWikiLabs|http://morfeo.upc.edu/crom]]\n
http://morfeo.upc.edu/crom
See \n*[[Moodle N Wiki]]\n*[[DFWikiTeam]]\n*[[DFWikiLabs|http://morfeo.upc.edu/crom]]\n
A [[Ludo|http://www.lsi.upc.edu/~malier]]'s [[DFWikiteam|http://morfeo.upc.edu/crom]] Site
Moodle Wiki - Tiddlywiki Integration
http://morfeo.upc.edu/crom
<<sync>>
/***\n|''Name:''|SynchronizePluglin|\n|''Author:''|[[Oriol Nieto|http://enochrooted.blogspot.com/]] , [[Alejandro Moreno|http://vdemarvvv.blogspot.com/]] & [[Ludo( Marc Alier)|http://www.lsi.upc.edu/~malier/]]|\n|''Another production of:''|[[dfwikiteam|http://morfeo.upc.es/crom/]] [[Universitat Politècnica de Catalunya|http://www.upc.edu]]|\n|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/ as described in the license document http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html#%5B%5BLicense%20And%20Legal%20Aspects%5D%5D]]|\n|''~CoreVersion:''|2.1.2|\n|''~PluglinVersion:''|1.1|\n|''Moodle wiki server side files''|http://morfeo.upc.edu/crom|\n\nThis plugin lets you synchronize tiddlers with dfwiki pages of a moodle 1.6.X with the nwiki module installed.\nThis is, exporting or importing from a moodle server depending on the last modification date, just by pressing a button.\n\nIt's ''strongly recommended'' that you use ''Firefox'' (or any netscape based navigator) instead of IE in order to avoid security problems.\n\nIf anyway you want to use IE, you'll have to turn down all security parameters.\n\n!!!!!Installation\n<<<\nYour [[ViewTemplate]] should have a line like this to make this plugin work (just add the word ''synchronize'' at the end of the macro string):\n\n<div class='toolbar' macro='toolbar ... synchronize'></div>\n\nYou also have to have the [[ImportDFwikisPlugin]] and the [[ExportTiddlersToDFwikiPlugin]] installed on this tiddlywiki.\n<<<\n!!!!!Usage\n<<<\nYou have to add the user and pwd information of your Moodle Server in the [[Synchronize Panel]]. \nYou also have to add your Moodle URL in the [[MoodleSource]] tiddler.\n\nOnce done, just press the "synchronize" button that will appear on the right-upper corner of any tiddler to synchronize the tiddler with a wiki page ''with the same name'' of you Moodle Server.\n<<<\n!!!!!Inline interface (live)\n<<<\nTo create the Syncrhonize Panel you can use the following Interactive Interface:\n\n{{{<<sync>>}}}\n\n<<sync>>\n<<<\n!!!!!Revision History\n<<<\n''2006.12.21 [1.1]''\nIE6 and IE7 bug fixed\n''2006.12.18 [1.0]''\nFirst release\n''2006.11.25 [0.0]''\ndevelopment started\n<<<\n!!!!!Code\n***/\n\n//{{{\nconfig.commands.synchronize= {\n text: 'synchronize',\n tooltip: 'synchronizes this tiddler with the Moodle wiki',\n text_alt: '<input type="checkbox" style="padding:0;margin:0;border:0;background:transparent;" checked>synchronize',\n tooltip_alt: 'uncheck to reset the editor to the standard height',\n hideReadOnly: false,\n tiddler: 'not set',\n course: 'not set',\n pageFound: false,\n course_it: 0,\n courses: [],\n wikis: [],\n handler: function(event,src,title) {\n // check if export and import plugins are installed\n if(!store.tiddlerExists("ImportDFwikisPlugin")){\n displayMessage("Error: ImportDFwikisPlugin Required!");\n return;\n }\n if(!store.tiddlerExists("ExportTiddlersToDFwikiPlugin")){\n displayMessage("Error: ExportTiddlersToDFwikiPlugin Required!");\n return;\n }\n\n // Get the user and pwd parameters\n if (!document.getElementById("syncMoodleName"))\n story.displayTiddler("bottom","SynchronizePanel",1,null,null,false);\n \n var user = document.getElementById("syncMoodleName").value;\n var pwd = document.getElementById("syncMoodlePwd").value;\n\n // We need to open our plugins:\n story.displayTiddler("bottom","ImportDFwikisPanel",1,null,null,false);\n story.displayTiddler("bottom","ExportTiddlersToDFwikiPanel",1,null,null,false);\n\n // For the Export Plugin:\n document.getElementById("exportID").value = user;\n document.getElementById("exportPW").value = pwd;\n // For the Import Plugin:\n document.getElementById("moodleUserName").value = user;\n document.getElementById("moodlePwd").value = pwd;\n if (user=="" || pwd==""){\n displayMessage("You must fill the user and pwd parameters in the Syncronize Panel!");\n return;\n }\n document.getElementById("exportMoodleServer").value = store.getTiddlerText("MoodleSource");\n var sync = true;\n config.commands.synchronize.tiddler = store.getTiddler(title);\n getMoodleInfo(sync); // Get the courses\n displayMessage("Synchronizing..."); \n\n var tiddler = store.getTiddler(title);\n store.setTiddlerTag(title,true,"synchronized");\n setLastSyncTime(title, tiddler);\n \n document.getElementById("syncMoodleName").value = user;\n document.getElementById("syncMoodlePwd").value = pwd;\n\n return false;\n }\n};\n\nfunction setLastSyncTime(title, tiddler){\n tiddler.sync = new Date();\n store.getTiddler(title) = tiddler;\n};\n\nfunction continueSyncCourses(i){\n var IMPORT = 0;\n var EXPORT = 1;\n var courses = document.getElementById("exportDFwikiCourse").options;\n var found_courses = config.commands.synchronize.courses;\n var found_wikis = config.commands.synchronize.wikis;\n var sync = true;\n config.commands.synchronize.course_it = i;\n if (courses.length<=i){\n displayMessage("courses: "+config.commands.synchronize.courses.length+" wikis: "+ config.commands.synchronize.wikis.length);\n if (found_courses.length == 1 && found_wikis.length == 1){\n displayMessage("Good: found 1 wiki page named like this, let's synchronize!");\n var it = found_wikis[0].it;\n var wiki_id = found_wikis[0].id;\n var course_id = found_courses[0].id;\n var parser = found_wikis[0].parser;\n var import_or_export = found_wikis[0].impexp;\n var wiki_name = found_wikis[0].name;\n config.commands.synchronize.course = found_courses[0].name;\n if (import_or_export == IMPORT) importTiddlerSync(it, wiki_id, course_id, parser);\n else if (import_or_export == EXPORT) exportTiddlerSync(it, wiki_name);\n }\n else if (found_courses.length > 1 || found_wikis > 1){\n displayMessage("Found more than 1 wiki page named like this tiddler");\n }\n else{\n displayMessage("Wiki page not found on the moodle server. Create it first!");\n }\n config.commands.synchronize.courses = [];\n config.commands.synchronize.wikis = [];\n }\n else {\n config.commands.synchronize.course = courses[i].value;\n continueGettingMoodleInfo(courses[i].value, sync);\n }\n};\n\nfunction continueSyncWikis(i){\n var wikis = document.getElementById("exportDFwikiName").options;\n var tiddler = config.commands.synchronize.tiddler;\n var course = config.commands.synchronize.course;\n var found = false;\n \n if (wikis.length<=i){\n displayMessage("Tiddler not found in the course "+course);\n var j = config.commands.synchronize.course_it;\n continueSyncCourses(j+1);\n return; // The tiddler is not in this course\n }\n \n getPagesFromWiki(tiddler, wikis[i].value, course, i);\n return;\n};\n\nfunction getPagesFromWiki(tiddler, wiki, course, i){\n xmlHttp=GetXmlHttpObject();\n if (xmlHttp==null)\n {\n alert ("Browser does not support HTTP Request");\n return\n }\n var url=document.getElementById("exportMoodleServer").value;\n url+= ((url.charAt(url.length-1)!="/")?'/':'')+"mod/wiki/webservicelib.php";\n xmlHttp.onreadystatechange=stateGetFromWiki;\n if (typeof(netscape)!="undefined") \n { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n try \n {\n xmlHttp.open("POST",url);\n xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Needed for the POST method\n if (xmlHttp.overrideMimeType) xmlHttp.overrideMimeType('text/xml');\n //displayMessage(tiddler.modified);\n xmlHttp.send("sel=getPagesFromWiki"+attachMD5Export(calculateMD5Export())+"&tiddlerTitle="+tiddler.title+"&tiddlerModified="+tiddler.modified+"&wiki="+wiki+"&course="+course+"&it="+i);\n//displayMessage("sel=getPagesFromWiki"+attachMD5Export(calculateMD5Export())+"&tiddlerTitle="+tiddler.title+"&tiddlerModified="+tiddler.modified+"&wiki="+wiki+"&course="+course+"&it="+i);\n }\n catch (e) \n {\n displayMessage(e.description?e.description:e.toString());\n }\n};\n\nfunction stateGetFromWiki(){\n if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){\n if (typeof(netscape)!="undefined") { // For moz-netscape, to access to a remote http:// or file://\n try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}\n catch (e) { displayMessage(e.description?e.description:e.toString()); }\n }\n var xml = xmlHttp.responseXML;\n var response = xml.getElementsByTagName('response')[0];\n var msg = response.getElementsByTagName('msg')[0].firstChild.data;\n var it = parseInt(response.getElementsByTagName('it')[0].firstChild.data);\n \n displayMessage(msg);\n if (msg == "found"){\n config.commands.synchronize.pageFound = true;\n var wikis = document.getElementById("exportDFwikiName").options;\n var tiddler = config.commands.synchronize.tiddler;\n displayMessage("Wiki Page found!: "+tiddler.title);\n var import_or_export = response.getElementsByTagName('impexp')[0].firstChild.data;\n var wiki_id = response.getElementsByTagName('wikiid')[0].firstChild.data;\n var parser = response.getElementsByTagName('parser')[0].firstChild.data;\n var course_id = response.getElementsByTagName('courseid')[0].firstChild.data;\n // Store the course where we've found the wiki page\n var course = new Object();\n course.name = config.commands.synchronize.course;\n course.id = course_id;\n config.commands.synchronize.courses.push(course);\n // Store the wiki, its parser and iterator and imp/exp where we've found the wiki page\n var wikis = document.getElementById("exportDFwikiName").options;\n var wiki = new Object();\n wiki.name = wikis[it].value;\n wiki.id = wiki_id;\n wiki.parser = parser;\n wiki.it = it;\n wiki.impexp = import_or_export;\n config.commands.synchronize.wikis.push(wiki);\n displayMessage("found in the wiki: "+wikis[it].value+" course id:"+course_id+" wikiname"+wiki.name);\n // Keep searching\n continueSyncWikis(it+1); \n }\n else{\n continueSyncWikis(it+1); \n }\n }\n};\n\nfunction importTiddlerSync(it, wiki_id, course_id, parser){\n config.macros.importDFwikis.inbound=null; // clear the imported tiddler buffer\n refreshImportDFwikiList();\n var siteURL=store.getTiddlerText("MoodleSource"); if (!siteURL) siteURL="";\n document.getElementById("importSourceURL").value=siteURL;\n\n var wikis = document.getElementById("exportDFwikiName").options;\n var course = config.commands.synchronize.course;\n var tiddler = config.commands.synchronize.tiddler;\n\n config.macros.importDFwikis.index=0;\n config.macros.importDFwikis.src = siteURL;\n var src_backup = config.macros.importDFwikis.src;\n \n config.macros.importDFwikis.src = src_backup+((src_backup.charAt(src_backup.length-1)!="/")?'/':'');\n config.macros.importDFwikis.src += "mod/wiki/webservicelib.php?sel=urlManagement&courseid="+course_id+"&wikiid="+wiki_id+"&page="+tiddler.title;\n config.macros.importDFwikis.src += attachMD5(calculateMD5());\n loadRemoteItem(config.macros.importDFwikis.src, function(src,txt) {\n var wiki = readItemsFromHTML(txt);\n config.macros.importDFwikis.inbound=wiki;\n window.refreshImportDFwikiList();\n //importDFwikiReport();\n config.macros.importDFwikis.index=0;\n config.macros.importDFwikis.index=importDFwikisImmediately(-1, "true");\n //importDFwikiStopped(); \n });\n config.macros.importDFwikis.src=src_backup;\n displayMessage("Successfully Synchronized!");\n};\n\nfunction exportTiddlerSync(it, wiki_name){\n var course = config.commands.synchronize.course;\n var tiddler = config.commands.synchronize.tiddler;\n addToSelect(wiki_name, "exportDFwikiName");\n document.getElementById("exportDFwikiName").value = wiki_name;\n document.getElementById("exportDFwikiCourse").value = course;\n exportToMoodle(tiddler.title, tiddler.modifier, tiddler.modified, tiddler.text, tiddler.tags);\n displayMessage("Successfully Synchronized!");\n};\n\n//}}}\n\n// // Macros Definition \n//{{{\nconfig.macros.sync = {\n notSynchronizedText: "(This tiddler has not been synchronized yet)",\n noPluginText: "There are no synchronized tiddlers",\n confirmDeleteText: "Are you sure you want to unsynchronize these tiddlers:\sn\sn%0",\n listViewTemplate : {\n columns: [\n {name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},\n {name: 'Title', field: 'title', tiddlerLink: 'title', title: "Title", type: 'TiddlerLink'}\n //{name: 'Forced', field: 'forced', title: "Forced", tag: 'systemConfigForce', type: 'TagCheckbox'},\n //{name: 'Disabled', field: 'disabled', title: "Disabled", tag: 'systemConfigDisable', type: 'TagCheckbox'},\n //{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},\n //{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},\n //{name: 'Log', field: 'log', title: "Log", type: 'StringList'}\n ],\n rowClasses: [\n {className: 'error', field: 'error'},\n {className: 'warning', field: 'warning'}\n ],\n actions: [\n {caption: "More actions...", name: ''},\n {caption: "Remove synchronized tag", name: 'remove'},\n {caption: "Delete these tiddlers forever", name: 'delete'}\n ]}\n };\n\nconfig.macros.sync.handler = function(place,macroName,params,wikifier,paramString,tiddler)\n{\n var panel=document.getElementById("syncPanel");\n if (panel) { panel.parentNode.removeChild(panel); }\n panel=createTiddlyElement(place,"span","syncPanel",null,null)\n panel.innerHTML=config.macros.sync.html;\n\n var e = createTiddlyElement(place,"div");\n e.setAttribute("refresh","macro");\n e.setAttribute("macroName","sync");\n e.setAttribute("params",paramString);\n this.refresh(e,paramString);\n};\n\nconfig.macros.sync.html = '\s\n<b>Moodle User Information</b><br>\s\nusername: <input type="text" id="syncMoodleName" onfocus="this.select()" value="" size="10"\s\n onKeyUp=""\s\n onChange=""><br>\s\npassword: <input type="password" id="syncMoodlePwd" onfocus="this.select()" value="" size="10"\s\n onKeyUp=""\s\n onChange=""><br><br><br>\s\n<b>Synchronized Tiddlers:</b>\s\n';\n\nconfig.macros.sync.refresh = function(place,params)\n{\n if(!store.tiddlerExists("ImportDFwikisPlugin")){\n displayMessage("Warning: ImportDFwikisPlugin Required for Syncrhonizing");\n }\n if(!store.tiddlerExists("ExportTiddlersToDFwikiPlugin")){\n displayMessage("Warning: ExportTiddlersToDFwikiPlugin Required for Syncrhonizing");\n }\n var selectedRows = [];\n ListView.forEachSelector(place,function(e,rowName) {\n if(e.checked)\n selectedRows.push(e.getAttribute("rowName"));\n });\n removeChildren(place);\n params = params.parseParams("anon");\n //var plugins = installedPlugins.slice(0);\n var plugins = [];\n var t,tiddler,p;\n var configTiddlers = store.getTaggedTiddlers("synchronized");\n for(t=0; t<configTiddlers.length; t++)\n {\n tiddler = configTiddlers[t];\n if(plugins.findByField("title",tiddler.title) == null)\n {\n p = getPluginInfo(tiddler);\n p.executed = false;\n //p.log.splice(0,0,this.notSynchronizedText);\n if (tiddler.sync) p.log.splice(0,0,tiddler.sync);\n else p.log.splice(0,0,this.notSynchronizedText);\n plugins.push(p);\n }\n }\n /*for(t=0; t<plugins.length; t++)\n {\n var p = plugins[t];\n p.forced = p.tiddler.isTagged("systemConfigForce");\n p.disabled = p.tiddler.isTagged("systemConfigDisable");\n p.Selected = selectedRows.find(plugins[t].title) != null;\n }*/\n if(plugins.length == 0)\n createTiddlyElement(place,"em",null,null,this.noPluginText);\n else\n ListView.create(place,plugins,this.listViewTemplate,this.onSelectCommand);\n};\n\nconfig.macros.sync.onSelectCommand = function(foo,command,rowNames)\n{\n var t;\n switch(command)\n {\n case "remove":\n for(t=0; t<rowNames.length; t++)\n store.setTiddlerTag(rowNames[t],false,"synchronized");\n break;\n case "delete":\n if(rowNames.length > 0 && confirm(config.macros.sync.confirmDeleteText.format([rowNames.join(", ")])))\n {\n for(t=0; t<rowNames.length; t++)\n {\n store.removeTiddler(rowNames[t]);\n story.closeTiddler(rowNames[t],true,false);\n }\n }\n break;\n }\n if(config.options.chkAutoSave)\n saveChanges(true);\n};\n//}}}
You can find here three TiddlyWiki Plugins that may help you to synchronize your TiddlyWiki files with the contents of a [[NWiki]] in a [[Moodle ]] server.\n\nPlugins:\n*ImportDFwikisPlugin : Import pages from your [[Moodle]] [[NWiki]] to TiddlyWiki Tiddlers.\n*ExportTiddlersToDFwikiPlugin : Export TiddlyWiki Tiddlers to [[Moodle]] [[NWiki]] pages. \n*SynchronizePlugin : Synchronize Tiddlers and pages \n\n\n*You will find News and Updates of this page in [[DFWikiLabs|http://morfeo.upc.edu/crom]].\n*[[Download this tiddlywiki to test the plugin|http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html]]\n*[[Installation Instructions|http://morfeo.upc.es/crom/mod/wiki/view.php?id=22&page=Tiddlywiki+integration+with+New+Moodle+Wiki&gid=0&uid=0]]\n*[[Download and Updates|http://morfeo.upc.es/crom/course/view.php?id=4]]\n----\n!Demo\nImportDFwikisPlugin \n<<importDFwikis inline>>\nThis demo works only working at local, ''NOT when accesed througth http''. You may use our server [[http://morfeo.upc.edu/crom]] to try and play with it. Have fun!\n----\nExportTiddlersToDFwikiPluglin\n<<exportDFwikis inline>>\nThis demo works only working at local, ''NOT when accesed througth http''. You may use our server [[http://morfeo.upc.edu/crom]] to try and play with it. \n|''user''|dfdemo|''password''|dfdemo|\n|''course''|dfdemo|''wiki''|dfdemo|\n
[[Tiddywiki|http://tiddlywiki.com/]] is a free MicroContent WikiWikiWeb created by JeremyRuston and a busy Community of independent developers. It's written in HTML, CSS and JavaScript to run on any modern browser without needing any ServerSide logic. It allows anyone to create personal SelfContained hypertext documents that can be posted to a WebServer, sent by email or kept on a USB thumb drive to make a WikiOnAStick. It also makes a great GuerillaWiki.
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |\n| 18/11/2006 16:33:23 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 18/11/2006 16:38:12 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/11/2006 16:45:12 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/11/2006 16:47:10 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/11/2006 18:1:49 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/11/2006 18:10:53 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 18/11/2006 18:17:14 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 18/11/2006 18:19:34 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/11/2006 18:19:45 | Ludo | [[moodle.html|file:///E:/Documents%20and%20Settings/Ludo/Escritorio/web%20ludo/moodle.html]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 22/11/2006 8:57:0 | Ludo(Marc Alier) | [[moodle.html|file:///C:/Documents%20and%20Settings/ASUS/Mis%20documentos/tiddlyspots/moodle.html#%5B%5BLicense%20And%20Legal%20Aspects%5D%5D]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 22/11/2006 15:24:3 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 22/11/2006 15:24:40 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 22/11/2006 15:35:18 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 13/12/2006 13:33:51 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/12/2006 11:40:42 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/12/2006 11:45:15 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/12/2006 11:50:3 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/12/2006 11:50:6 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok | Ok | Ok | Ok |\n| 18/12/2006 12:34:8 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 18/12/2006 12:44:21 | uri | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 19/12/2006 22:31:40 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 19/12/2006 22:33:58 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 19/12/2006 22:46:35 | uri | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 21/12/2006 11:29:17 | uri | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 21/12/2006 12:25:47 | uri | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 7/1/2007 9:12:18 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 7/1/2007 9:13:59 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 7/1/2007 9:15:7 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 7/1/2007 9:19:54 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 7/1/2007 9:21:18 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 9/1/2007 13:21:56 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 17/3/2007 11:1:36 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 17/3/2007 11:8:18 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 17/3/2007 11:8:28 | Ludo | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/5/2007 14:58:57 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/7/2007 8:20:47 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 2/7/2007 8:20:55 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 8/1/2008 20:29:38 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 8/1/2008 20:30:56 | YourName | [[/|http://moodle.tiddlyspot.com/]] | [[store.cgi|http://moodle.tiddlyspot.com/store.cgi]] | . | index.html | . |
/***\n|''Name:''|UploadPlugin|\n|''Description:''|Save to web a TiddlyWiki|\n|''Version:''|3.4.4|\n|''Date:''|Sep 30, 2006|\n|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|\n|''Documentation:''|http://tiddlywiki.bidix.info/#UploadDoc|\n|''Author:''|BidiX (BidiX (at) bidix (dot) info)|\n|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|\n|''~CoreVersion:''|2.0.0|\n|''Browser:''|Firefox 1.5; InternetExplorer 6.0; Safari|\n|''Include:''|config.lib.file; config.lib.log; config.lib.options; PasswordTweak|\n|''Require:''|[[UploadService|http://tiddlywiki.bidix.info/#UploadService]]|\n***/\n//{{{\nversion.extensions.UploadPlugin = {\n major: 3, minor: 4, revision: 4, \n date: new Date(2006,8,30),\n source: 'http://tiddlywiki.bidix.info/#UploadPlugin',\n documentation: 'http://tiddlywiki.bidix.info/#UploadDoc',\n author: 'BidiX (BidiX (at) bidix (dot) info',\n license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',\n coreVersion: '2.0.0',\n browser: 'Firefox 1.5; InternetExplorer 6.0; Safari'\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: 1}, \n date: new Date(2006,8,19)\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: 3, date: new Date(2006,8,30),\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 {\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 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.className = "txtOptionInput "+opt;\n place.appendChild(c);\n c.value = config.options[opt];\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.className = "pasOptionInput "+opt;\n place.appendChild(c);\n c.value = config.options[opt];\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 c.className = "chkOptionInput "+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 c.className = "chkOptionInput "+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 backupFileStored: "Previous file backuped in %0",\n crossDomain: "Certainly a cross-domain isue: access to an other site isn't allowed",\n errorDownloading: "Error downloading",\n errorUploadingContent: "Error uploading content",\n fileLocked: "Files is locked: You are not allowed to Upload",\n fileNotFound: "file to upload not found",\n fileNotUploaded: "File %0 NOT uploaded",\n mainFileUploaded: "Main TiddlyWiki file uploaded to %0",\n passwordEmpty: "Unable to upload, your password is empty",\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.toDirUrl(storeUrl, uploadDir, username)]);\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.toRootUrl = function (storeUrl, username)\n{\n return root = (this.dirname(storeUrl)?this.dirname(storeUrl):this.dirname(document.location.toString()));\n}\nconfig.macros.upload.toDirUrl = function (storeUrl, uploadDir, username)\n{\n var root = this.toRootUrl(storeUrl, username);\n if (uploadDir && uploadDir != '.')\n root = root + '/' + uploadDir;\n return root;\n}\nconfig.macros.upload.toFileUrl = function (storeUrl, toFilename, uploadDir, username)\n{\n return this.toDirUrl(storeUrl, uploadDir, username) + '/' + toFilename;\n}\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 (!password || password === '') {\n alert(config.macros.upload.messages.passwordEmpty);\n return;\n }\n if (storeUrl === '') {\n storeUrl = 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 // Check that file is not locked\n if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {\n if (BidiX.GroupAuthoring.lock.isLocked() && !BidiX.GroupAuthoring.lock.isMyLock()) {\n alert(config.macros.upload.messages.fileLocked);\n return;\n }\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 var toDir = config.macros.upload.toDirUrl(storeUrl, toFilename, uploadDir, username);\n displayMessage(config.macros.upload.messages.aboutToUpload.format([toDir]), toDir);\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 var toFileUrl = config.macros.upload.toFileUrl(storeUrl, rssPath, uploadDir, username);\n displayMessage(config.macros.upload.messages.rssFileUploaded.format(\n [toFileUrl]), toFileUrl);\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\n revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");\n revised = revised.replaceChunk("<!--PRE-HEAD-START--"+">","<!--PRE-HEAD-END--"+">","\sn" + store.getTiddlerText("MarkupPreHead","") + "\sn");\n revised = revised.replaceChunk("<!--POST-HEAD-START--"+">","<!--POST-HEAD-END--"+">","\sn" + store.getTiddlerText("MarkupPostHead","") + "\sn");\n revised = revised.replaceChunk("<!--PRE-BODY-START--"+">","<!--PRE-BODY-END--"+">","\sn" + store.getTiddlerText("MarkupPreBody","") + "\sn");\n revised = revised.replaceChunk("<!--POST-BODY-START--"+">","<!--POST-BODY-END--"+">","\sn" + store.getTiddlerText("MarkupPostBody","") + "\sn");\n\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 var toFileUrl = config.macros.upload.toFileUrl(storeUrl, toFilename, uploadDir, username);\n if (responseText.indexOf("destfile:") > 0) {\n var destfile = responseText.substring(responseText.indexOf("destfile:")+9, \n responseText.indexOf("\sn", responseText.indexOf("destfile:")));\n toFileUrl = config.macros.upload.toRootUrl(storeUrl, username) + '/' + destfile;\n }\n else {\n toFileUrl = config.macros.upload.toFileUrl(storeUrl, toFilename, uploadDir, username);\n }\n displayMessage(config.macros.upload.messages.mainFileUploaded.format(\n [toFileUrl]), toFileUrl);\n if (backupDir && responseText.indexOf("backupfile:") > 0) {\n var backupFile = responseText.substring(responseText.indexOf("backupfile:")+11, \n responseText.indexOf("\sn", responseText.indexOf("backupfile:")));\n toBackupUrl = config.macros.upload.toRootUrl(storeUrl, username) + '/' + backupFile;\n displayMessage(config.macros.upload.messages.backupFileStored.format(\n [toBackupUrl]), toBackupUrl);\n }\n var log = new config.macros.upload.UploadLog();\n log.endUpload();\n store.setDirty(false);\n // erase local lock\n if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {\n BidiX.GroupAuthoring.lock.eraseLock();\n // change mtime with new mtime after upload\n var mtime = responseText.substr(responseText.indexOf("mtime:")+6);\n BidiX.GroupAuthoring.lock.mtime = mtime;\n }\n \n \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 // add lock attributes to sheader\n if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {\n var l = BidiX.GroupAuthoring.lock.myLock;\n sheader += ";lockuser=" + l.user\n + ";mtime=" + l.mtime\n + ";locktime=" + l.locktime;\n }\n sheader += ";;\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 //strailer = "--" + boundary + "--\sr\sn";\n var data;\n data = sheader + content + strailer;\n //request.open("POST", storeUrl, true, username, password);\n try {\n request.open("POST", storeUrl, true); \n }\n catch(e) {\n alert(config.macros.upload.messages.crossDomain + "\snError:" +e);\n exit;\n }\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 + "\snStatus: "+request.status.statusText);\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 try {\n request.open("GET", document.location.toString(), true);\n }\n catch(e) {\n alert(config.macros.upload.messages.crossDomain + "\snError:" +e);\n exit;\n }\n \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()]) + "\snStatus: "+request.status.statusText);\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','');\nsetStylesheet(\n ".pasOptionInput {width: 11em;}\sn"+\n ".txtOptionInput.txtUploadStoreUrl {width: 25em;}\sn"+\n ".txtOptionInput.txtUploadFilename {width: 25em;}\sn"+\n ".txtOptionInput.txtUploadDir {width: 25em;}\sn"+\n ".txtOptionInput.txtUploadBackupDir {width: 25em;}\sn"+\n "",\n "UploadOptionsStyles");\nconfig.shadowTiddlers.UploadDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadDoc ]]\sn"; \nconfig.options.chkAutoSave = false; saveOptionCookie('chkAutoSave');\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////===\n
<!--{{{-->\n<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump synchronize'></div>\n<div class='title' macro='view title'></div>\n<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></span>)</div>\n<div class='tagging' macro='tagging'></div>\n<div class='tagged' macro='tags'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>\n<!--}}}-->
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.\n\n@@font-weight:bold;font-size:1.3em;color:#444; //What now?// &nbsp;&nbsp;@@ Before you can save any changes, you need to enter your password in the form below. Then configure privacy and other site settings at your [[control panel|http://moodle.tiddlyspot.com/controlpanel]] (your control panel username is //moodle//).\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; //Help!// &nbsp;&nbsp;@@ Find 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. If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@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 or suggestions.
This TiddyWiki page contains the ImportDFwikisPlugin that will allow you to Import Wiki pages from a [[Moodle N Wiki]] into your Tiddywiki [[tiddlers]]. \n[[We|DFWikiTeam]] are developing another plugin to do exactly the oposite, to export tiddywiki tiddlers into [[Moodle N Wiki]] pages, so stay tunned. \n*You will find News and Updates of this page in [[DFWikiLabs|http://morfeo.upc.edu/crom]].\n*[[Download this tiddlywiki to test the plugin|http://www.lsi.upc.edu/~malier/tidlywikimoodledfwikimport.html]]\n*[[Installation Instructions|http://morfeo.upc.es/crom/mod/wiki/view.php?id=22&page=Tiddlywiki+integration+with+New+Moodle+Wiki&gid=0&uid=0]]\n*[[Download and Updates|http://morfeo.upc.es/crom/course/view.php?id=4]]\n----\nImportDFwikisPlugin \n<<importDFwikis inline>>\nThis demo works only working at local, ''NOT when accesed througth http''. You may use our server [[http://morfeo.upc.edu/crom]] to try and play with it. Have fun!\n----\nExportTiddlersToDFwikiPluglin\n<<exportDFwikis inline>>\nThis demo works only working at local, ''NOT when accesed througth http''. You may use our server [[http://morfeo.upc.edu/crom]] to try and play with it. \n|''user''|dfdemo|''password''|dfdemo|\n|''course''|dfdemo|''wiki''|dfdemo|\n\n\n
[[DFWikiteam]] Blogs:\n!Blogs in english\n[[Ludo's Blog in Moodle.org|http://moodle.org/blog/index.php?userid=22420&courseid=1]]\n!Blogs in Spanish \n[[Orangoodling Ludo's blog|http://orangoodling.blogspot.com/]]\n[[De percebes y tortugas|http://enochrooted.blogspot.com/]]\n[[Alex Moreno's blog|http://vdemarvvv.blogspot.com/]]\n!Blogs in catalan\n[[Orangoodle Ludo's blog|http://orangoodle.blogspot.com/]]\n[[El Pigui i la wiki|http://elpigui-i-lawiki.blogspot.com/index.html]] Jordi Piguillem's Blog
| tiddlyspot password:|<<option pasUploadPassword>>|\n| site management:|<<upload http://moodle.tiddlyspot.com/store.cgi index.html . . moodle>>//(requires tiddlyspot password)//<<br>>[[control panel|http://moodle.tiddlyspot.com/controlpanel]], [[download (go offline)|http://moodle.tiddlyspot.com/download]]|\n| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[announcements|http://announce.tiddlyspot.com/]], [[blog|http://tiddlyspot.com/blog/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|