This project will provide a free Modelica library (see [[www.modelica.org|http://www.modelica.org]]) with components for field-oriented control (FOC) of electrical machines.
//This site is still under construction so please be patient and come back later for any project related news.//
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
<<tiddler MainMenu>>
AuthorMainMenu
MainMenu
DefaultTiddlers
PluginManager
PresentationIndex
<!--{{{-->
<div id='header' class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='AuthorMainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/***
Place your custom CSS here
***/
/*{{{*/
[[StyleSheetCommon]]
/*}}}*/
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='viewer topbutton' macro='top'></div>
<br><br>
<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>
<div class='tagClear'></div>
<!--}}}-->
Story.prototype.refreshTiddler_activelink = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function (title,template,force)
{
var theTiddler = Story.prototype.refreshTiddler_activelink.apply(this,arguments);
if (!theTiddler)
return theTiddler
var menu = document.getElementById("mainMenu");
var links = menu.getElementsByTagName("a");
for (var i=0; i<links.length; i++)
{
if (!links[i].getAttribute("tiddlyLink"))
return;
if (document.getElementById(this.idPrefix+(links[i].getAttribute("tiddlylink"))))
addClass(links[i],"bold");
else
removeClass(links[i],"bold");
}
return theTiddler;
}
config.options.chkAnimate = false;
config.options.chkSinglePageMode = true;
config.options.chkTopOfPageMode = false;
See it in action here: http://lewcid.googlepages.com/tots.html
!!Editing this TW:
Open the TW with #author:true at the end of the url/file location to enable editing.
Preview edits by using the "Presentation Mode" button in the MainMenu
//(To make future editing easier, bookmark the file with #author:true at the end of the file name. One click and edit!)//
!!Changing the content and order of the presentation:
Edit the PresentationIndex tiddler to change the contents and order of the presentation.
!! Customizing the default (viewing) interface.
Edit the following tiddlers as needed:
*PageTemplate
*StyleSheet
*ViewTemplate
*EditTemplate
*MainMenu
!!Customizing the editing (author's) interface.
Edit the following tiddlers as needed: //(Note that these files are optional, if any of them dont exist, the standard viewing one will be used instead. So if you only want to change the PageTemplate, you only need an AuthorPageTemplate tiddler.)//
*AuthorPageTemplate
*AuthorStyleSheet
*AuthorViewTemplate
*AuthorEditTemplate
*AuthorMainMenu
!!Using a different stylesheet or theme:
Using your own favorite stylesheet or theme is as simple as importing those tiddlers into this file.
If you are changing the presentation interface, just import the PageTemplate and StyleSheet. If you want to change the editing interface, you will need to copy over the PageTemplate and StyleSheet as AuthorPageTemplate and AuthorStyleSheet respectively.
!!Other tips:
* Use the tiddler StyleSheetCommon and include it using {{{[[StyleSheetCommon]]}}} in your StyleSheet and AuthorStyleSheet when making stlyesheet changes that you want applied to both the presentation and editing interface, to avoid having to type it out twice!
*To provide easy control over the font-size, use the FontSizePlugin: http://lewcid.googlepages.com/lewcid.html#FontSizePlugin
* If this presentation is going to be placed online, you might want to have a splash screen that displays while the TW is loading: http://lewcid.googlepages.com/lewcid.html#SplashScreenPlugin
function setFooter() {
if (document.getElementById && document.getElementById("contentFooter") ) {
var windowHeight=findWindowHeight();
if (windowHeight>0) {
var contentHeight= document.getElementById('mainMenu').offsetHeight + document.getElementById("header").offsetHeight + document.getElementById("contentFooter").offsetHeight;
var menu= document.getElementById('mainMenu');
//var footerHeight=footerElement.offsetHeight;
if (windowHeight-(contentHeight)>=0) {
menu.style.position='relative';
menu.style.marginBottom=(windowHeight-(contentHeight))+'px';
}
else {
menu.style.position='';
menu.style.marginBottom='';
}
}
}
}
window.onresize = function() {
setFooter();
}
Story.prototype.refreshTiddler_footerhack=Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function (title,template,force)
{
var theTiddler = Story.prototype.refreshTiddler_footerhack.apply(this,arguments);
setFooter();
return theTiddler;}
//{{{
config.macros.def ={};
config.macros.def.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();
var def = store.getTiddlerSlice("InfoDefinitions",sliceName);
if (def == undefined)
{
wikify(params[0],place);
return false;
}
var theClass = params[2]? params[2] : "info";
var container = createTiddlyElement(place,"span",null,theClass);
wikify(params[0],container);
if (document.all)
{
container.onmouseover = function(){addClass(this,"infoover");};
container.onmouseout = function(){removeClass(this,"infoover");};
}
var tooltip = createTiddlyElement(container,"span",null,null);
wikify(def, tooltip);
}
config.macros.note ={};
config.macros.note.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();
var def = store.getTiddlerSlice("InfoDefinitions",sliceName);
if (def == undefined)
{
wikify(params[0],place);
return false;
}
var theClass = params[2]? params[2] : "note";
var container = createTiddlyElement(place,"span",null,theClass);
wikify("^^"+params[0]+"^^",container);
if (document.all)
{
container.onmouseover = function(){addClass(this,"noteover");};
container.onmouseout = function(){removeClass(this,"noteover");};
}
var tooltip = createTiddlyElement(container,"span",null,null);
wikify(def, tooltip);
}
//}}}
/***
|''Name:''|LegacyStrikeThroughPlugin|
|''Description:''|Support for legacy (pre 2.1) strike through formatting|
|''Version:''|1.0.1|
|''Date:''|Jul 21, 2006|
|''Source:''|http://www.tiddlywiki.com/#LegacyStrikeThroughPlugin|
|''Author:''|MartinBudden (mjbudden (at) gmail (dot) com)|
|''License:''|[[BSD open source license]]|
|''CoreVersion:''|2.1.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
***/
//{{{
// Ensure that the LegacyStrikeThrough Plugin is only installed once.
if(!version.extensions.LegacyStrikeThroughPlugin)
{
version.extensions.LegacyStrikeThroughPlugin = true;
config.formatters.push(
{
name: "legacyStrikeByChar",
match: "==",
termRegExp: /(==)/mg,
element: "strike",
handler: config.formatterHelpers.createElementAndWikify
});
} // end of "install only once"
//}}}
// Resolves a Tiddler reference or tiddler title into a tiddler title string, or null if it doesn't exist
resolveTitle = function(t)
{
if (t instanceof Tiddler) t = t.title;
return store.tiddlerExists(t) ? t : null;
}
config.macros.navigation = {};
config.macros.navigation.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
if (!store.tiddlerExists(tiddler.title))
return false;
var e = createTiddlyElement(place,"span",null,"nav");
e.setAttribute("refresh","macro");
e.setAttribute("macroName",macroName);
e.setAttribute("params",paramString);
e.setAttribute("tiddler",tiddler.title)
this.refresh(e,paramString);
}
config.macros.navigation.refresh = function(place,params)
{
var tiddler = store.getTiddler(place.getAttribute("tiddler"));
removeChildren(place);
var params = place.getAttribute("params").parseParams("tiddlers",null,true);
//alert(store.getTiddlerText(getParam(params,"index",undefined)).parseParams("tiddlers",null,false))
var tiddlers = getParam(params,"tiddlers",undefined);
if (typeof tiddlers == 'string')
tiddlers = tiddlers.readBracketedList();
if (tiddlers == undefined)
alert("no source tiddlers defined for navigation");
var contents = [];
for (var i=0;i<tiddlers.length;i++)
{
var title = resolveTitle(tiddlers[i]);
contents.push(title);
}
var navIndex = contents.indexOf(tiddler.title);
if (navIndex == -1)
return false;
if (contents[navIndex-1])
{
wikify("[[<< Previous|"+contents[navIndex-1]+"]]",place);
place.lastChild.className += " navPrev";
}
if (contents[navIndex+1])
{
wikify("[[Next >>|"+contents[navIndex+1]+"]]",place);
place.lastChild.className += " navNext";
}
var theTable = createTiddlyElement(place,"table",null,"nav");
var theBody = createTiddlyElement(theTable,"tbody");
var theRow = createTiddlyElement(theBody,"tr");
for (var i=0; i<contents.length; i++)
{
var box = createTiddlyElement(theRow,"td",null,"navlinkcell"," ");
box.onclick = onClickTiddlerLink;
box.setAttribute("tiddlyLink",contents[i]);
box.title = (contents[i]);
if (contents[i] ==tiddler.title)
box.className += " activenav";
}
}
setStylesheet(
".navNext {float:right;}\n"+
".navPrev, .navPrevious{float:left;}\n"+
".nav .tiddlyLink {color:#000; background:transparent;border:none;padding:0;margin:0;}\n"+
".nav {padding:0;margin:0;}\n"+
".nav table {margin:0 auto !important; border:0px solid #000;padding:0;border-collapse:separate;}\n"+
".nav table tr{padding:0; margin:0;border-spacing: 1px;}\n"+
".nav table td {padding:4px; border:1px solid #000; border-spacing: 0px;cursor:pointer;cursor:hand}\n"+
".nav .activenav{background:#000 !important;}\n","NavigationPluginStyles");
<!--{{{-->
<div id="header" class='header'>
<div class='gradient' macro='gradient vert #00AA00 #003300 '>
<div class='titleLine' >
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
</div>
<div id='bodywrapper'>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div id='contentFooter' refresh='content' tiddler='contentFooter'></div>
</div>
//{{{
TiddlyWiki.prototype.removeNotification = function(title,fn) {
for (var i=0;i<this.namedNotifications.length;i++)
if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))
this.namedNotifications.splice(i,1);
}
//checks to see if a tiddler exists in store or as a shadow.
TiddlyWiki.prototype.isTiddler= function (title)
{return store.tiddlerExists(title) || store.isShadowTiddler(title)}
// Refresh all tiddlers in the Story
Story.prototype.lewcidrefreshAllTiddlers = function()
{
var place = document.getElementById(this.container);
var e = place.firstChild;
if(!e) return;
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
while((e = e.nextSibling) != null)
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
}
config.presentationPlugin ={
};
config.presentationPlugin.defaults = [
{name: "StyleSheet", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate}
];
window.presentationMode='';
function applyPresentationMode (oldMode,Mode)
{
presentationMode = Mode;
var defaults = config.presentationPlugin.defaults;
var oldStyleElement = document.getElementById(oldMode+"StyleSheet");
if (oldStyleElement)
{
oldStyleElement.parentNode.removeChild(oldStyleElement);
}
for (var i=0; i<defaults.length; i++)
{
var def = defaults[i]["name"];
var newMode = store.isTiddler(Mode + def)? Mode + def : def;
store.removeNotification(oldMode + def, defaults[i]["notify"]);
store.addNotification(newMode,defaults[i]["notify"]);
store.notify(newMode); //just one do blanket notify instead?
}
story.lewcidrefreshAllTiddlers();
}
config.macros.author={};
config.macros.author.handler= function (place,macroName,params,wikifier,paramString,tiddler) {
var e = createTiddlyElement(place,"div");
e.setAttribute("refresh","macro");
e.setAttribute("macroName","author");
e.setAttribute("params",paramString);
this.refresh(e,paramString);
}
config.macros.author.refresh = function(place,params){
if (window.lewcideditmode== false)
return false;
removeChildren(place);
var oldMode = window.presentationMode;
var newMode = (oldMode == "Author")?"":"Author";
var label = (oldMode == "Author")? "Presentation Mode":"Author Mode";
var tooltip = label;
createTiddlyButton(place,label,tooltip,function() {
applyPresentationMode(oldMode,newMode);
});
};
Story.prototype.chooseTemplateForTiddler_old_presentation = Story.prototype.chooseTemplateForTiddler;
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
if (!template)
template = DEFAULT_VIEW_TEMPLATE;
var mode = presentationMode;
if (template == DEFAULT_VIEW_TEMPLATE)
{
if (store.isTiddler(mode+"ViewTemplate"))
return mode+"ViewTemplate";
}
else if (template == DEFAULT_EDIT_TEMPLATE)
{
if (store.isTiddler(mode+"EditTemplate"))
return mode+"EditTemplate";
}
return this.chooseTemplateForTiddler_old_presentation(title,template);
}
window.lewcideditmode = false;
config.paramifiers.author = {
onstart: function(v) {
if (v!="true")
return false;
applyPresentationMode("","Author");
window.lewcideditmode = true;
if (config.options.chkSinglePageMode)
config.options.chkSinglePageMode = false;
refreshDisplay();
}
};
//}}}
/***
|''Name:''|SinglePageModePlugin|
|''Source:''|http://www.TiddlyTools.com/#SinglePageModePlugin|
|''Author:''|Eric Shulman - ELS Design Studios|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''~CoreVersion:''|2.0.10|
Normally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.
!!!!!Usage
<<<
SinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. When SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.
Even when SinglePageMode is disabled (i.e., displaying multiple tiddlers is permitted), you can reduce the potential for confusion by enable TopOfPageMode, which forces tiddlers to always open at the top of the page instead of being displayed following the tiddler containing the link that was clicked.
<<<
!!!!!Configuration
<<<
When installed, this plugin automatically adds checkboxes in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. For convenience, these checkboxes are also included here:
<<option chkSinglePageMode>> Display one tiddler at a time
<<option chkTopOfPageMode>> Always open tiddlers at the top of the page
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)
^^documentation and javascript for SinglePageMode handling^^
When installed, this plugin automatically adds checkboxes in the ''shadow'' AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to ''manually add these checkboxes to your customized tiddler.''
<<<
!!!!!Revision History
<<<
''2006.07.04 [2.2.1]'' in hijack for displayTiddlers(), suspend TPM as well as SPM so that DefaultTiddlers displays in the correct order.
''2006.06.01 [2.2.0]'' added chkTopOfPageMode (TPM) handling
''2006.02.04 [2.1.1]'' moved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals
''2005.12.27 [2.1.0]'' hijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list). Also, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers
''2005.12.27 [2.0.0]'' Update for TW2.0
''2005.11.24 [1.1.2]'' When the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts
''2005.10.14 [1.1.1]'' permalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them
''2005.10.14 [1.1.0]'' added automatic setting of window title and location bar ('auto-permalink'). feature suggestion by David Dickens.
''2005.10.09 [1.0.1]'' combined documentation and code in a single tiddler
''2005.08.15 [1.0.0]'' Initial Release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].
Support for BACK/FORWARD buttons adapted from code developed by Clint Checketts
<<<
!!!!!Code
***/
//{{{
Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)
{
var place = document.getElementById(this.container);
var theTiddler = document.getElementById(this.idPrefix + title);
if(theTiddler)
this.refreshTiddler(title,template);
else
{
var before = this.positionTiddler(srcElement);
theTiddler = this.createTiddler(place,before,title,template);
}
if(srcElement && typeof srcElement !== "string")
{
if(anim && config.options.chkAnimate && (animate == undefined || animate == true))
anim.startAnimating(new Cascade(title,srcElement,theTiddler,slowly),new Scroller(theTiddler,slowly));
else
window.scrollTo(0,0);
}
}
version.extensions.SinglePageMode= {major: 2, minor: 2, revision: 1, date: new Date(2006,7,3)};
config.options.chkSinglePageMode=true;
if (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkSinglePageMode>> Display one tiddler at a time";
if (config.options.chkTopOfPageMode==undefined) config.options.chkTopOfPageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkTopOfPageMode>> Always open tiddlers at the top of the page";
config.SPMTimer = 0;
config.lastURL = window.location.hash;
function checkLastURL()
{
if (!config.options.chkSinglePageMode)
{ window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }
if (config.lastURL == window.location.hash)
return;
var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));
tiddlerName=tiddlerName.replace(/\[\[/,"").replace(/\]\]/,""); // strip any [[ ]] bracketing
if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);
}
if (Story.prototype.SPM_coreDisplayTiddler==undefined) Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)
{
if (config.options.chkSinglePageMode) {
window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));
config.lastURL = window.location.hash;
document.title = wikifyPlain("SiteTitle") + " - " + title;
story.closeAllTiddlers();
if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);
}
if (config.options.chkTopOfPageMode) { story.closeTiddler(title); window.scrollTo(0,0); srcElement=null; }
this.SPM_coreDisplayTiddler(srcElement,title,template,animate,slowly)
}
if (Story.prototype.SPM_coreDisplayTiddlers==undefined) Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;
Story.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)
{
// suspend single-page mode when displaying multiple tiddlers
var saveSPM=config.options.chkSinglePageMode; config.options.chkSinglePageMode=false;
var saveTPM=config.options.chkTopOfPageMode; config.options.chkTopOfPageMode=false;
this.SPM_coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);
config.options.chkSinglePageMode=saveSPM; config.options.chkTopOfPageMode=saveTPM;
}
//}}}
free ~Field-Oriented Control library
/***
Place your custom CSS here
***/
/*{{{*/
[[SideBarWG]]
/***
!Top Menu Styles
***/
/*{{{*/
#topMenu br {display:none; }
#topMenu { background: #000 ; color:#fff;padding: 1em 1em;}
/*}}}*/
/***
!General
***/
/*{{{*/
body {
background: #000;
margin: 0 auto;
}
#contentWrapper{
background: #fff;
border: 0;
margin: 0 1em;
padding:0;
}
/*}}}*/
/***
!Header rules
***/
/*{{{*/
.titleLine{
margin: 68px 3em 0em 0em;
margin-left:1.7em;
margin-bottom: 28px;
padding: 0;
text-align: center;
color: #fff;
}
.siteTitle {
font-size: 2em;
font-weight: bold;
}
.siteSubtitle {
font-size: 1.1em;
display: block;
margin: .5em auto 1em;
}
.gradient {margin: 0 auto; border-bottom:1px solid #000;}
.header {
background: #fff;
margin: 0 0em;
padding:12px 12px;
}
/*}}}*/
/***
!Display Area
***/
/*{{{*/
#bodywrapper {margin:0 12px; padding:0;background:#fff; height:1%}
#displayArea{
margin: 0em 16em 0em 14em;
text-align: left;
}
.tiddler {
padding: 1em 1em 0em 0em;
}
h1,h2,h3,h4,h5 { color: #000; background: transparent; padding-bottom:2px; border-bottom: 1px dotted #666; }
.title {color:black; font-size:1.8em; border-bottom:1px solid #333; padding-bottom:0.3px;}
.subtitle { font-size:90%; color:#ccc; padding-left:0.25em; margin-top:0.1em; }
.shadow .title {
color: #aaa;
}
.tagClear{
clear: none;
}
* html .viewer pre {
margin-left: 0em;
}
* html .editor textarea, * html .editor input {
width: 98%;
}
.tiddler {margin-bottom:1em; padding-bottom:0em;}
.toolbar .button {color:#bbb; border:none;}
.toolbar .button:hover, .toolbar .highlight, .toolbar .marked, .toolbar a.button:active {background:transparent; color:#111; border:none; text-decoration:underline;}
#sidebar .highlight, #sidebar .marked {background:transparent;}
.tagging, .tagged {
border: 1px solid #eee;
background-color: #F7F7F7;
}
.selected .tagging, .selected .tagged {
background-color: #eee;
border: 1px solid #bbb;
}
.tagging .listTitle, .tagged .listTitle {
color: #bbb;
}
.selected .tagging .listTitle, .selected .tagged .listTitle {
color: #222;
}
.tagging .button:hover, .tagged .button:hover {
border: none; background:transparent; text-decoration:underline; color:#000;
}
.tagging .button, .tagged .button {
color:#aaa;
}
.selected .tagging .button, .selected .tagged .button {
color:#000;
}
.viewer blockquote {
border-left: 3px solid #000;
}
.viewer pre, .viewer code {
border: 1px dashed #ccc;
background: #eee;}
.viewer hr {
border: 0;
border-top: solid 1px #333;
margin: 0 8em;
color: #333;
}
.highlight, .marked {background:transparent; color:#111; border:none; text-decoration:underline;}
.viewer .highlight, .viewer .marked {text-decoration:none;}
#sidebarTabs .highlight, #sidebarTabs .marked {color:#000; text-decoration:none;}
.tabSelected {
color: #000;
background: #fff;
border-top: solid 1px #ccc;
border-left: solid 1px #ccc;
border-right: solid 1px #ccc;
border-bottom: none;
}
.viewer .tabSelected:hover{color:#000;}
.viewer .tabSelected {font-weight:bold;}
.tabUnselected {
color: #999;
background: #eee;
border-top: solid 1px #ccc;
border-left: solid 1px #ccc;
border-right: solid 1px #ccc;
border-bottom: solid 1px #ccc;
padding-bottom:1px;
}
.tabContents {
background: #fff;
color: #000;
}
/*}}}*/
/***
!!!Tables
***/
/*{{{*/
.viewer table {
border: 1px solid #000;
}
.viewer th, thead td {
background: #000;
border: 1px solid #000;
color: #fff;
}
.viewer td, .viewer tr {
border: 1px solid #111; padding:4px;
}
/*}}}*/
/***
!!!Editor area
***/
/*{{{*/
.editor input, .editor textarea {
border: 1px solid #ccc;
}
.editor {padding-top:0.3em;}
.editor textarea:focus, .editor input:focus {
border: 1px solid #333;
}
/*}}}*/
/***
!Sidebar
***/
/*{{{*/
#sidebar{
position:relative;
float:right;
margin-bottom:1em;
display:inline;
width: 16em;
}
#sidebarOptions .sliderPanel {
background: #eee; border:1px solid #ccc;
}
/*}}}*/
/***
!Body Footer rules
***/
/*{{{*/
#contentFooter {
text-align: center;
clear: both;
color:#fff;
background: #003300;
padding: 1em 2em;
font-weight:plain;
}
/*}}}*/
/***
!Link Styles
***/
/*{{{*/
a{
color: #000;
}
a:hover{
color: #ED700B;
background:#fff;
}
.button {
color: #000;
border: 1px solid #fff;
}
.button:hover {
color: #fff;
background: #ED700B;
border-color: #000;
}
.button:active {
color: #fff;
background: #ED700B;
border: 1px solid #000;
}
.tiddlyLink {border-bottom: 1px dotted #000;}
.tiddlyLink:hover {border-bottom: 1px dotted #ED700B;}
.titleLine a {border-bottom: 1px dotted #FF9900;}
.titleLine a:hover {border-bottom: 1px dotted #fff;}
.siteTitle a, .siteSubtitle a{
color: #fff;
}
.viewer .button {border: 1px solid #ED700B; font-weight:bold;}
.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #000;}
#topMenu .button, #topMenu .tiddlyLink {
margin-left:0.5em; margin-right:0.5em;
padding-left:3px; padding-right:3px;
color:white; font-weight:bold;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#000; color:#FF8814}
#topMenu a{border:none;}
/*}}}*/
/***
!Message Area /%=================================================%/
***/
/*{{{*/
#messageArea {
border: 4px dotted #ff8614;
background: #000;
color: #fff;
font-size:90%;
}
#messageArea .button {
padding: 0.2em;
color: #000;
background: #fff;
text-decoration:none;
font-weight:bold;
border:1px solid #000;
}
#messageArea a {color:#fff;}
#messageArea a:hover {color:#ff8614; background:transparent;}
#messageArea .button:hover {background: #FF8614; color:#fff; border:1px solid #fff; }
/*}}}*/
/***
!Popup /%=================================================%/
***/
/*{{{*/
.popup {
background: #ff8814;
border: 1px solid #333;
}
.popup hr {
color: #333;
background: #333;
border-bottom: 1px;
}
.popup li.disabled {
color: #333;
}
.popup li a, .popup li a:visited {
color: #eee;
border: none;
}
.popup li a:hover {
background: #ff8614;
color: #fff;
border: none;
text-decoration:underline;
}
.searchBar {float:right; font-size:1em;}
.searchBar .button {display:block; border:none; color:#ccc; }
.searchBar .button:hover{border:none; color:#eee;}
.searchBar input{
border: 1px inset #000; background:#EFDFD1; width:10em; margin:0;
}
.searchBar input:focus {
border: 1px inset #000; background:#fff;
}
*html .titleLine {margin-right:1.3em;}
*html .searchBar .button {margin-left:1.7em;}
.HideSideBarButton {float:right;}
/*}}}*/
.blog h2, .blog h3, .blog h4{
margin:0;
padding:0;
border-bottom:none;
}
.blog {margin-left:1.5em;}
.blog .excerpt {
margin:0;
margin-top:0.3em;
padding: 0;
margin-left:1em;
padding-left:1em;
font-size:90%;
border-left:1px solid #ddd;
}
#tiddlerWhatsNew h1, #tiddlerWhatsNew h2 {border-bottom:none;}
div[tags~="RecentUpdates"], div[tags~="lewcidExtension"] {margin-bottom: 2em;}
#hoverMenu .button, #hoverMenu .tiddlyLink {border:none; font-weight:bold; background:#f37211; color:#fff; padding:0 5px; float:right; margin-bottom:4px;}
#hoverMenu .button:hover, #hoverMenu .tiddlyLink:hover {font-weight:bold; border:none; color:#f37211; background:#000; padding:0 5px; float:right; margin-bottom:4px;}
#topMenu .fontResizer {float:right;}
#topMenu .fontResizer .button{border:1px solid #000;}
#topMenu .fontResizer .button:hover {border:1px solid #f37211; color:#fff;}
#sidebarTabs .txtMainTab .tiddlyLinkExisting {
font-weight: normal;
font-style: normal;
}
#sidebarTabs .txtMoreTab .tiddlyLinkExisting {
font-weight: bold;
font-style: normal;
}
#displayArea {margin-right:1em;}
.headerShadow {
position: relative;
padding: 2.5em 0em 1em 1em;
left: -1px;
top: -1px;
}
.headerForeground {
position: absolute;
padding: 2.5em 0em 1em 1em;
left: 0px;
top: 0px;
}
.siteTitle {
font-size: 2.5em;
}
.siteSubtitle {
font-size: 1.2em;
}
#mainMenu {float:left; position:relative;}
.viewer .button {border: 1px solid #ED700B; font-weight:bold;}
.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #ED700B;}
[[StyleSheetCommon]]
#contentFooter .tiddlyLink {
color:#fff;
}
/*}}}*/
{{{
.centre {text-align:center; margin:0;}
.centre img {margin:0 auto;}
.title, h1 {font-size: 1.6em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}
h2 {font-size: 1.45em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}
#mainMenu {width:14em;}
#displayArea {margin-left:18em;}
.left {float:left; margin-right:1em;}
.bold {font-weight:bold;}
.topbutton button, .topbutton{float:right;}
.note{
position:relative; /*this is the key*/
z-index:24; background:#ccc;
color:#000;
text-decoration:none}
.note:hover, .noteover{z-index:25; background-color:#FFB865;cursor:help;}
.note span{display: none;}
.note:hover span, .noteover span{ /*the span will display just on :hover state*/
display:block;
position:absolute;
top:2em; left:2em; width:15em;
border:1px solid #000;
background-color:#003300; color:#000;
padding:0.5em;}
.info{
position:relative; /*this is the key*/
z-index:24; background:#ccc;
color:#000;
text-decoration:none}
.info:hover, .infoover{z-index:25; background-color:#FFB865;cursor:help;}
.info span{display: none}
.info:hover span, .infoover span{ /*the span will display just on :hover state*/
display:block;
position:absolute;
top:2em; left:2em; width:15em;
border:1px solid #000;
background-color:#FFB35A; color:#000;
padding:0.5em;}
.bold {font-weight: bold !important;}
}}}
Tiddler.prototype.getSubtitle = function()
{
return(this.title);
}
config.macros.top={};
config.macros.top.handler=function(place,macroName)
{
createTiddlyButton(place,"^","jump to top",this.onclick);
}
config.macros.top.onclick=function()
{
window.scrollTo(0,0);
};
/***
Required by Tiddlyspot
***/
//{{{
config.options.chkHttpReadOnly = false; // make it so you can by default see edit controls via http
if (window.location.protocol != "file:")
config.options.chkGTDLazyAutoSave = false; // disable autosave in d3
config.tiddlyspotSiteId = 'freefoclib';
// probably will need to redo this for TW 2.2
with (config.shadowTiddlers) {
SiteUrl = 'http://'+config.tiddlyspotSiteId+'.tiddlyspot.com';
SideBarOptions = SideBarOptions.replace(/(<<saveChanges>>)/,"$1<<tiddler TspotSidebar>>");
OptionsPanel = OptionsPanel.replace(/^/,"<<tiddler TspotOptions>>");
DefaultTiddlers = DefaultTiddlers.replace(/^/,"[[Welcome to Tiddlyspot]] ");
MainMenu = MainMenu.replace(/^/,"[[Welcome to Tiddlyspot]] ");
}
merge(config.shadowTiddlers,{
'Welcome to Tiddlyspot':[
"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.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //What now?// @@ 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://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]] (your control panel username is //" + config.tiddlyspotSiteId + "//).",
"<<tiddler TspotControls>>",
"See also GettingStarted.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working online// @@ You can edit this ~TiddlyWiki right now, and save your changes using the \"save to web\" button in the column on the right.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// @@ 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.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Help!// @@ 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]].",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// @@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions."
].join("\n"),
'TspotControls':[
"| tiddlyspot password:|<<option pasUploadPassword>>|",
"| site management:|<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">>//(requires tiddlyspot password)//<<br>>[[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]], [[download (go offline)|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download]]|",
"| 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]]|"
].join("\n"),
'TspotSidebar':[
"<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">><html><a href='http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download' class='button'>download</a></html>"
].join("\n"),
'TspotOptions':[
"tiddlyspot password:",
"<<option pasUploadPassword>>",
""
].join("\n")
});
//}}}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 1/6/2007 8:40:56 | YourName | [[/|http://freefoclib.tiddlyspot.com/#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |
| 1/6/2007 8:54:22 | YourName | [[/|http://freefoclib.tiddlyspot.com/#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |
| 1/6/2007 8:55:39 | YourName | [[/|http://freefoclib.tiddlyspot.com/#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 8/6/2007 16:49:42 | HeX | [[freefoclib.html|file:///home/dietmarw/DISS/Prosjekter/freeFOClib/tiddlyspot/freefoclib.html#About]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 2/1/2008 8:59:59 | HeX | [[freefoclib.html|file:///home/dietmarw/DISS/Prosjekter/freeFOClib/website/tiddlyspot/freefoclib.html#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 2/1/2008 9:0:45 | HeX | [[freefoclib.html|file:///home/dietmarw/DISS/Prosjekter/freeFOClib/website/tiddlyspot/freefoclib.html#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |
| 2/1/2008 9:18:5 | HeX | [[freefoclib.html|file:///home/dietmarw/DISS/Prosjekter/freeFOClib/website/tiddlyspot/freefoclib.html#author:true]] | [[store.cgi|http://freefoclib.tiddlyspot.com/store.cgi]] | . | index.html | . |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|3.4.5|
|''Date:''|Oct 15, 2006|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.0.0|
|''Browser:''|Firefox 1.5; InternetExplorer 6.0; Safari|
|''Include:''|config.lib.file; config.lib.log; config.lib.options; PasswordTweak|
|''Require:''|[[UploadService|http://tiddlywiki.bidix.info/#UploadService]]|
***/
//{{{
version.extensions.UploadPlugin = {
major: 3, minor: 4, revision: 5,
date: new Date(2006,9,15),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
documentation: 'http://tiddlywiki.bidix.info/#UploadDoc',
author: 'BidiX (BidiX (at) bidix (dot) info',
license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
coreVersion: '2.0.0',
browser: 'Firefox 1.5; InternetExplorer 6.0; Safari'
};
//}}}
////+++!![config.lib.file]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.file) config.lib.file= {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 0},
date: new Date(2006,3,9)
};
config.lib.file.dirname = function (filePath) {
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
config.lib.file.basename = function (filePath) {
var lastpos;
if ((lastpos = filePath.lastIndexOf("#")) != -1)
filePath = filePath.substring(0, lastpos);
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(lastpos + 1);
} else
return filePath.substring(filePath.lastIndexOf("\\")+1);
};
window.basename = function() {return "@@deprecated@@";};
//}}}
////===
////+++!![config.lib.log]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.log) config.lib.log= {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 1},
date: new Date(2006,8,19)
};
config.lib.Log = function(tiddlerTitle, logHeader) {
if (version.major < 2)
this.tiddler = store.tiddlers[tiddlerTitle];
else
this.tiddler = store.getTiddler(tiddlerTitle);
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = tiddlerTitle;
this.tiddler.text = "| !date | !user | !location |" + logHeader;
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
if (version.major < 2)
store.tiddlers[tiddlerTitle] = this.tiddler;
else
store.addTiddler(this.tiddler);
}
return this;
};
config.lib.Log.prototype.newLine = function (line) {
var now = new Date();
var newText = "| ";
newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";
newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";
newText += config.options.txtUserName + " | ";
var location = document.location.toString();
var filename = config.lib.file.basename(location);
if (!filename) filename = '/';
newText += "[["+filename+"|"+location + "]] |";
this.tiddler.text = this.tiddler.text + "\n" + newText;
this.addToLine(line);
};
config.lib.Log.prototype.addToLine = function (text) {
this.tiddler.text = this.tiddler.text + text;
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
if (version.major < 2)
store.tiddlers[this.tiddler.tittle] = this.tiddler;
else {
store.addTiddler(this.tiddler);
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
}
if (version.major < 2)
store.notifyAll();
};
//}}}
////===
////+++!![config.lib.options]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.options) config.lib.options = {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 0},
date: new Date(2006,3,9)
};
config.lib.options.init = function (name, defaultValue) {
if (!config.options[name]) {
config.options[name] = defaultValue;
saveOptionCookie(name);
}
};
//}}}
////===
////+++!![PasswordTweak]
//{{{
version.extensions.PasswordTweak = {
major: 1, minor: 0, revision: 3, date: new Date(2006,8,30),
type: 'tweak',
source: 'http://tiddlywiki.bidix.info/#PasswordTweak'
};
//}}}
/***
!!config.macros.option
***/
//{{{
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordType = "password"; // password | text
config.macros.option.onChangeOption = function(e)
{
var opt = this.getAttribute("option");
var elementType,valueField;
if(opt) {
switch(opt.substr(0,3)) {
case "txt":
elementType = "input";
valueField = "value";
break;
case "pas":
elementType = "input";
valueField = "value";
break;
case "chk":
elementType = "input";
valueField = "checked";
break;
}
config.options[opt] = this[valueField];
saveOptionCookie(opt);
var nodes = document.getElementsByTagName(elementType);
for(var t=0; t<nodes.length; t++)
{
var optNode = nodes[t].getAttribute("option");
if (opt == optNode)
nodes[t][valueField] = this[valueField];
}
}
return(true);
};
config.macros.option.handler = function(place,macroName,params)
{
var opt = params[0];
if(config.options[opt] === undefined) {
return;}
var c;
switch(opt.substr(0,3)) {
case "txt":
c = document.createElement("input");
c.onkeyup = this.onChangeOption;
c.setAttribute ("option",opt);
c.className = "txtOptionInput "+opt;
place.appendChild(c);
c.value = config.options[opt];
break;
case "pas":
// input password
c = document.createElement ("input");
c.setAttribute("type",config.macros.option.passwordType);
c.onkeyup = this.onChangeOption;
c.setAttribute("option",opt);
c.className = "pasOptionInput "+opt;
place.appendChild(c);
c.value = config.options[opt];
// checkbox link with this password "save this password on this computer"
c = document.createElement("input");
c.setAttribute("type","checkbox");
c.onclick = this.onChangeOption;
c.setAttribute("option","chk"+opt);
c.className = "chkOptionInput "+opt;
place.appendChild(c);
c.checked = config.options["chk"+opt];
// text savePasswordCheckboxLabel
place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
break;
case "chk":
c = document.createElement("input");
c.setAttribute("type","checkbox");
c.onclick = this.onChangeOption;
c.setAttribute("option",opt);
c.className = "chkOptionInput "+opt;
place.appendChild(c);
c.checked = config.options[opt];
break;
}
};
//}}}
/***
!! Option cookie stuff
***/
//{{{
window.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;
window.loadOptionsCookie = function()
{
var cookies = document.cookie.split(";");
for(var c=0; c<cookies.length; c++) {
var p = cookies[c].indexOf("=");
if(p != -1) {
var name = cookies[c].substr(0,p).trim();
var value = cookies[c].substr(p+1).trim();
switch(name.substr(0,3)) {
case "txt":
config.options[name] = unescape(value);
break;
case "pas":
config.options[name] = unescape(value);
break;
case "chk":
config.options[name] = value == "true";
break;
}
}
}
};
window.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;
window.saveOptionCookie = function(name)
{
var c = name + "=";
switch(name.substr(0,3)) {
case "txt":
c += escape(config.options[name].toString());
break;
case "chk":
c += config.options[name] ? "true" : "false";
// is there an option link with this chk ?
if (config.options[name.substr(3)]) {
saveOptionCookie(name.substr(3));
}
break;
case "pas":
if (config.options["chk"+name]) {
c += escape(config.options[name].toString());
} else {
c += "";
}
break;
}
c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";
document.cookie = c;
};
//}}}
/***
!! Initializations
***/
//{{{
// define config.options.pasPassword
if (!config.options.pasPassword) {
config.options.pasPassword = 'defaultPassword';
window.saveOptionCookie('pasPassword');
}
// since loadCookies is first called befor password definition
// we need to reload cookies
window.loadOptionsCookie();
//}}}
////===
////+++!![config.macros.upload]
//{{{
config.macros.upload = {
accessKey: "U",
formName: "UploadPlugin",
contentType: "text/html;charset=UTF-8",
defaultStoreScript: "store.php"
};
// only this two configs need to be translated
config.macros.upload.messages = {
aboutToUpload: "About to upload TiddlyWiki to %0",
backupFileStored: "Previous file backuped in %0",
crossDomain: "Certainly a cross-domain isue: access to an other site isn't allowed",
errorDownloading: "Error downloading",
errorUploadingContent: "Error uploading content",
fileLocked: "Files is locked: You are not allowed to Upload",
fileNotFound: "file to upload not found",
fileNotUploaded: "File %0 NOT uploaded",
mainFileUploaded: "Main TiddlyWiki file uploaded to %0",
passwordEmpty: "Unable to upload, your password is empty",
urlParamMissing: "url param missing",
rssFileNotUploaded: "RssFile %0 NOT uploaded",
rssFileUploaded: "Rss File uploaded to %0"
};
config.macros.upload.label = {
promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
promptParamMacro: "Save and Upload this TiddlyWiki in %0",
saveLabel: "save to web",
saveToDisk: "save to disk",
uploadLabel: "upload"
};
config.macros.upload.handler = function(place,macroName,params){
// parameters initialization
var storeUrl = params[0];
var toFilename = params[1];
var backupDir = params[2];
var uploadDir = params[3];
var username = params[4];
var password; // for security reason no password as macro parameter
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (storeUrl) {
prompt = this.label.promptParamMacro.toString().format([this.toDirUrl(storeUrl, uploadDir, username)]);
}
else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt,
function () {
config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;},
null, null, this.accessKey);
};
config.macros.upload.UploadLog = function() {
return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );
};
config.macros.upload.UploadLog.prototype = config.lib.Log.prototype;
config.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";
line += uploadDir + " | " + toFilename + " | " + backupDir + " |";
this.newLine(line);
};
config.macros.upload.UploadLog.prototype.endUpload = function() {
this.addToLine(" Ok |");
};
config.macros.upload.basename = config.lib.file.basename;
config.macros.upload.dirname = config.lib.file.dirname;
config.macros.upload.toRootUrl = function (storeUrl, username)
{
return root = (this.dirname(storeUrl)?this.dirname(storeUrl):this.dirname(document.location.toString()));
}
config.macros.upload.toDirUrl = function (storeUrl, uploadDir, username)
{
var root = this.toRootUrl(storeUrl, username);
if (uploadDir && uploadDir != '.')
root = root + '/' + uploadDir;
return root;
}
config.macros.upload.toFileUrl = function (storeUrl, toFilename, uploadDir, username)
{
return this.toDirUrl(storeUrl, uploadDir, username) + '/' + toFilename;
}
config.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)
{
// parameters initialization
storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);
toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);
backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);
uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);
username = (username ? username : config.options.txtUploadUserName);
password = config.options.pasUploadPassword; // for security reason no password as macro parameter
if (!password || password === '') {
alert(config.macros.upload.messages.passwordEmpty);
return;
}
if (storeUrl === '') {
storeUrl = config.macros.upload.defaultStoreScript;
}
if (config.lib.file.dirname(storeUrl) === '') {
storeUrl = config.lib.file.dirname(document.location.toString())+'/'+storeUrl;
}
if (toFilename === '') {
toFilename = config.lib.file.basename(document.location.toString());
}
clearMessage();
// only for forcing the message to display
if (version.major < 2)
store.notifyAll();
if (!storeUrl) {
alert(config.macros.upload.messages.urlParamMissing);
return;
}
// Check that file is not locked
if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {
if (BidiX.GroupAuthoring.lock.isLocked() && !BidiX.GroupAuthoring.lock.isMyLock()) {
alert(config.macros.upload.messages.fileLocked);
return;
}
}
var log = new this.UploadLog();
log.startUpload(storeUrl, toFilename, uploadDir, backupDir);
if (document.location.toString().substr(0,5) == "file:") {
saveChanges();
}
var toDir = config.macros.upload.toDirUrl(storeUrl, toFilename, uploadDir, username);
displayMessage(config.macros.upload.messages.aboutToUpload.format([toDir]), toDir);
this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);
if(config.options.chkGenerateAnRssFeed) {
//var rssContent = convertUnicodeToUTF8(generateRss());
var rssContent = generateRss();
var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";
this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password,
function (responseText) {
if (responseText.substring(0,1) != '0') {
displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));
}
else {
var toFileUrl = config.macros.upload.toFileUrl(storeUrl, rssPath, uploadDir, username);
displayMessage(config.macros.upload.messages.rssFileUploaded.format(
[toFileUrl]), toFileUrl);
}
// for debugging store.php uncomment last line
//DEBUG alert(responseText);
});
}
return;
};
config.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir,
username, password) {
var original;
if (document.location.toString().substr(0,4) == "http") {
original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);
return;
}
else {
// standard way : Local file
original = loadFile(getLocalPath(document.location.toString()));
if(window.Components) {
// it's a mozilla browser
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
original = converter.ConvertToUnicode(original);
}
catch(e) {
}
}
}
//DEBUG alert(original);
this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir,
username, password);
};
config.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir,
username, password) {
var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it
var endSaveArea = '</d' + 'iv>';
// Locate the storeArea div's
var posOpeningDiv = original.indexOf(startSaveArea);
var posClosingDiv = original.lastIndexOf(endSaveArea);
if((posOpeningDiv == -1) || (posClosingDiv == -1))
{
alert(config.messages.invalidFileError.format([document.location.toString()]));
return;
}
var revised = original.substr(0,posOpeningDiv + startSaveArea.length) +
allTiddlersAsHtml() + "\n\t\t" +
original.substr(posClosingDiv);
var newSiteTitle;
if(version.major < 2){
newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();
} else {
newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();
}
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = revised.replaceChunk("<!--PRE-HEAD-START--"+">","<!--PRE-HEAD-END--"+">","\n" + store.getTiddlerText("MarkupPreHead","") + "\n");
revised = revised.replaceChunk("<!--POST-HEAD-START--"+">","<!--POST-HEAD-END--"+">","\n" + store.getTiddlerText("MarkupPostHead","") + "\n");
revised = revised.replaceChunk("<!--PRE-BODY-START--"+">","<!--PRE-BODY-END--"+">","\n" + store.getTiddlerText("MarkupPreBody","") + "\n");
revised = revised.replaceChunk("<!--POST-BODY-START--"+">","<!--POST-BODY-END--"+">","\n" + store.getTiddlerText("MarkupPostBody","") + "\n");
var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir,
username, password, function (responseText) {
if (responseText.substring(0,1) != '0') {
alert(responseText);
displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));
}
else {
if (uploadDir !== '') {
toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);
} else {
toFilename = config.macros.upload.basename(toFilename);
}
var toFileUrl = config.macros.upload.toFileUrl(storeUrl, toFilename, uploadDir, username);
if (responseText.indexOf("destfile:") > 0) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,
responseText.indexOf("\n", responseText.indexOf("destfile:")));
toFileUrl = config.macros.upload.toRootUrl(storeUrl, username) + '/' + destfile;
}
else {
toFileUrl = config.macros.upload.toFileUrl(storeUrl, toFilename, uploadDir, username);
}
displayMessage(config.macros.upload.messages.mainFileUploaded.format(
[toFileUrl]), toFileUrl);
if (backupDir && responseText.indexOf("backupfile:") > 0) {
var backupFile = responseText.substring(responseText.indexOf("backupfile:")+11,
responseText.indexOf("\n", responseText.indexOf("backupfile:")));
toBackupUrl = config.macros.upload.toRootUrl(storeUrl, username) + '/' + backupFile;
displayMessage(config.macros.upload.messages.backupFileStored.format(
[toBackupUrl]), toBackupUrl);
}
var log = new config.macros.upload.UploadLog();
log.endUpload();
store.setDirty(false);
// erase local lock
if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {
BidiX.GroupAuthoring.lock.eraseLock();
// change mtime with new mtime after upload
var mtime = responseText.substr(responseText.indexOf("mtime:")+6);
BidiX.GroupAuthoring.lock.mtime = mtime;
}
}
// for debugging store.php uncomment last line
//DEBUG alert(responseText);
}
);
};
config.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir,
username, password, callbackFn) {
var boundary = "---------------------------"+"AaB03x";
var request;
try {
request = new XMLHttpRequest();
}
catch (e) {
request = new ActiveXObject("Msxml2.XMLHTTP");
}
if (window.netscape){
try {
if (document.location.toString().substr(0,4) != "http") {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}
}
catch (e) {}
}
//DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += config.macros.upload.formName +"\"\r\n\r\n";
sheader += "backupDir="+backupDir
+";user=" + username
+";password=" + password
+";uploaddir=" + uploadDir;
// add lock attributes to sheader
if (window.BidiX && BidiX.GroupAuthoring && BidiX.GroupAuthoring.lock) {
var l = BidiX.GroupAuthoring.lock.myLock;
sheader += ";lockuser=" + l.user
+ ";mtime=" + l.mtime
+ ";locktime=" + l.locktime;
}
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+toFilename+"\"\r\n";
sheader += "Content-Type: " + config.macros.upload.contentType + "\r\n";
sheader += "Content-Length: " + content.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
//strailer = "--" + boundary + "--\r\n";
var data;
data = sheader + content + strailer;
//request.open("POST", storeUrl, true, username, password);
try {
request.open("POST", storeUrl, true);
}
catch(e) {
alert(config.macros.upload.messages.crossDomain + "\nError:" +e);
exit;
}
request.onreadystatechange = function () {
if (request.readyState == 4) {
if (request.status == 200)
callbackFn(request.responseText);
else
alert(config.macros.upload.messages.errorUploadingContent + "\nStatus: "+request.status.statusText);
}
};
request.setRequestHeader("Content-Length",data.length);
request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);
request.send(data);
};
config.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir,
username, password) {
var request;
try {
request = new XMLHttpRequest();
}
catch (e) {
request = new ActiveXObject("Msxml2.XMLHTTP");
}
try {
if (uploadUrl.substr(0,4) == "http") {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
} catch (e) { }
//request.open("GET", document.location.toString(), true, username, password);
try {
request.open("GET", document.location.toString(), true);
}
catch(e) {
alert(config.macros.upload.messages.crossDomain + "\nError:" +e);
exit;
}
request.onreadystatechange = function () {
if (request.readyState == 4) {
if(request.status == 200) {
config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl,
uploadToFilename, uploadDir, uploadBackupDir, username, password);
}
else
alert(config.macros.upload.messages.errorDownloading.format(
[document.location.toString()]) + "\nStatus: "+request.status.statusText);
}
};
request.send(null);
};
//}}}
////===
////+++!![Initializations]
//{{{
config.lib.options.init('txtUploadStoreUrl','store.php');
config.lib.options.init('txtUploadFilename','');
config.lib.options.init('txtUploadDir','');
config.lib.options.init('txtUploadBackupDir','');
config.lib.options.init('txtUploadUserName',config.options.txtUserName);
config.lib.options.init('pasUploadPassword','');
setStylesheet(
".pasOptionInput {width: 11em;}\n"+
".txtOptionInput.txtUploadStoreUrl {width: 25em;}\n"+
".txtOptionInput.txtUploadFilename {width: 25em;}\n"+
".txtOptionInput.txtUploadDir {width: 25em;}\n"+
".txtOptionInput.txtUploadBackupDir {width: 25em;}\n"+
"",
"UploadOptionsStyles");
if (document.location.toString().substr(0,4) == "http") {
config.options.chkAutoSave = false;
saveOptionCookie('chkAutoSave');
}
config.shadowTiddlers.UploadDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadDoc ]]\n";
//}}}
////===
////+++!![Core Hijacking]
//{{{
config.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;
config.macros.saveChanges.label = config.macros.upload.label.saveToDisk;
config.macros.saveChanges.handler_orig_UploadPlugin = config.macros.saveChanges.handler;
config.macros.saveChanges.handler = function(place)
{
if ((!readOnly) && (document.location.toString().substr(0,4) != "http"))
createTiddlyButton(place,this.label,this.prompt,this.onClick,null,null,this.accessKey);
};
//}}}
////===
<!--{{{-->
<div class='viewer' macro='view text wikified'></div>
<div class='viewer topbutton' macro='top'></div>
<br><br>
<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>
<div class='tagClear'></div>
<!--}}}-->
freeFOClib powered by [[TiddlyWiki|http://www.tiddlywiki.com]]