A story for Leigh - http://neuage.org/leigh.htm on line at http://neuage.org/wombat.htm
<html>
<a href="http://www.angelfire.com/ex/saratoga/children-stories/wombat.jpg"><img src="http://www.angelfire.com/ex/saratoga/children-stories/wombat.jpg"style="height: 300px;" /></a></html>
It was Friday afternoon.
The last day of school, before the first day of the holidays.
Leigh McGee tried to walk into his room. He couldn’t get very far. There was no room to move. He tossed his school books onto a very high pile of something somewhere in the middle of the room and walked away.
It was summer. Leigh put his bathers on and threw his school clothes into his room. They landed somewhere in the midst of another pile of something or other.
What Leigh McGee did not know, probably because he didn’t look around his room, except to follow a thin cleared path to his bed, was that his room was more than just a place where he threw his things.
It was a home. A home for a hairy-nosed wombat.
<html><a href="http://neuage.org/stories/wombat2.jpg"><img src="http://neuage.org/stories/wombat2.jpg"style="height: 388px;" /></a></html>
The wombat had made a complex tunnel system in Leigh McGee‘s room.
Its burrow was in the middle of a large pile of clothes in the corner of Leigh’s room at the foot of the bed. The main tunnel from the wombat’s home followed the walls around the room. It wandered beneath the full length of the bed, behind an antique 18th century cupboard, past the overflowing clothing hamper, past the desk - then stopped. At the end of the tunnel the wombat would peek about to see that the coast was clear, then hop up to Leigh’s desk to the window. Leigh had left the window open the summer before and because it got stuck he never bothered to close it again.
Leigh’s desk had a huge pile of things on it. Papers, books, toys, some baseballs, a football, basket ball and a computer that had yet to be used, as well as food, clothing, dreams and wishes.
The only clearing in Leigh’s room was a narrow path to his bed.
Leigh McGee’s dad used to help him clean his room. Actually his dad did the cleaning by himself in the “old” days while the kids were at school. But since he had started writing his latest novel, he just didn’t get to Leigh’s room any more. Leigh’s dad worked in his office writing. He would get so involved with writing that he would forget to do the things he used to do. He would leave his desk only to make something to eat for the children when he remembered. Once a week or every other week, whenever he remembered, he would go into town and purchase groceries, do laundry or buy clothes because the children could not find their school uniforms or socks.
The children didn’t mind. They knew it was just a phase. Though they thought it was a very strange phase. His other novels had sold well, so there was money enough to live on. It was easier to give the children money to go and buy a new track-suit or sneakers, and then it was to take the time to try and find the lost sneaker, or the other odd sock, or a favourite jumper. It was often easier to order pizza or Chinese take away than to make a meal. As their father often said, ‘We are flying on automatic at the moment.’ The kids understood.
The children’s’ parents had once lived together in the city. When their dad wanted to move into their seaside holiday home after the separation, to write his novel, the children went with him. They liked the seashore and they liked going to school in the small nearby town. Mom liked the city; the noise, the activities, art galleries and museums. The children liked the country. They wanted to play outside, something they didn’t feel free to do in the city. Most of all they wanted their parents to live together and they knew that some day, someway, they would succeed.
Their mother was an artist and like their dad with his writing, she would get so involved with a painting that she would forget everything for days, sometimes weeks and months.
It was the novel that Leigh’s dad was writing that was so strange. Its title was, “The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct”
The children tried to tell their dad that the title was too long, and would anyone really buy it when it was finished? He didn’t pay any attention though. To him it was going to be a masterpiece. Maybe even a major movie. At least, it would become a four part television series.
After three novels that were easy to write “They just came off the top of me head their dad had said” “The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct.” was the first story that he had to do research on. His office was almost as bad as Leigh McGee’s room. Tables were filled with books and papers.
And there was always the lights on, music, television and even singing and laughing. And there were several paths to the desk. No hairy-nosed wombat would settle in his office.
Of course no one knew what was going on in Leigh’s room. It was too much of a mess to go inside. Both children slept in their father’s office. The children liked to be near their dad and since he would sit typing until the middle of the night they would bring their sleeping bags into the office and sleep on the floor. They had made areas in between books, papers, maps and the filing cabinets to sleep in.
Sometimes, actually a lot of times, when the children awoke the next morning, their father would be asleep at his desk. The children didn’t say too much about, “ The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct”.
They wished that the book would become extinct too, so that they could go back to living like a normal family again. Maybe their mother would even come and live with them. At other times they talked about making the title into a cartoon series when they grew up. But they didn’t tell their father that. They didn’t want to hurt his feelings.
The hairy-nosed wombat liked her new home. She was from the Nullarbor Plain and had snuck onto a truck and had ended up at a truck depot on the same block as Leigh McGee’s house.
When the wombat first walked around the block she wasn’t impressed. It was a lot different than the Nullarbor Plains. She had never seen so many houses. And all so close together too. There were cats and dogs in her new neighbourhood. The wombat stayed away from them. She didn’t know whether they would be friendly toward her or not. She had watched a dog chase a cat up a tree. It wasn’t a pretty sight. She didn’t want to get involved in rough housing like that. No way. Leigh McGee’s house was near a river that flowed into the sea, so there was plenty of exploring to do and plenty of food left by plenty of tourists. The hairy-nosed wombat had a pretty good life, except that there were no other wombats around to play with.
The wombat used to go out of the open window every night and walk over to the truck depot that she had arrived at. She hoped another wombat would arrive at the truck depot like she had. She had discovered the open window a year ago when a dog had spotted her and began to give chase. She quickly looked for a place to hide and that is when she spotted the open window to Leigh McGee’s room.
She had been hungry too. She found a lot of food in the room. There were a lot of new things to try. There was a half eaten peanut butter and
jelly sandwich next to the bed. It was strange tasting to a wombat that had never had anything more than grass and shrubs and herbs before.
There were other things to eat too. Biscuits, crackers, toast, potato chips, nuts and lollies. The wombat liked to try different foods. But usually she settled for the normal things growing in the front yard. The family hadn’t mowed their lawn for a long time so there was tall grass and the shrubs were good. And because no one in the house seemed to notice much of anything any more, they didn’t notice the partly eaten plants in the front yard. The children would play in a nearby park instead of their front yard. At least the nearby park got ‘mowed’.
One night the wombat was in the front yard chomping on a shrub when she heard a commotion. A dog was barking loudly. The wombat sat up and looked over the tall grass. Running in her direction was another wombat. The two wombats spotted each other and both ran toward the house with the dog loudly barking after them. The two wombats quickly climbed through Leigh’s open window. The visiting wombat had climbed aboard a road-train that had arrived at the nearby truck depot too.
The two wombats took up home in Leigh McGee’s room. Both wombats made their own burrows - though they shared the tunnel to the window. They explored together and no one knew that they were in Leigh’s room.
During the summer more animals arrived at the truck depot. There were marsupial moles, fat-tailed dunnarts, ring-tailed possums and a wide variety of small animals that were looking for places to live. Soon Leigh McGee’s room was more like a zoo than a child’s bedroom. It wasn’t possible to see at first glance from the doorway to Leigh’s room, all that was going on in the bedroom.
As more things were thrown into the room and the piles of clothing, books and whatever else Leigh didn’t know what to do with landed in the room, the animals inside made more and more tunnels.
The children’s father was finished with his current writing project. “The Yellow- bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct” was over two- thousand pages not counting additional maps, photos, diagrams, and non-related items such as pictures of the kids when they were young, a trip to Paris and a recipe for tofu cheesecake:
<html>
<a href="http://neuage.org/stories/tofu.jpg "><img src="http://neuage.org/stories/tofu.jpg "style="height: 300px;" /></a></html>
Mix in a blender then let it set in the refrigerator. Oh! cover with slices of mango before putting in the fridge
He sent the manuscript to several book publishers. The publishers had no idea what to do with “The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct”. One publisher even sent a letter saying it was the best book - that made absolutely no sense - that she had ever read.
The children’s father didn’t understand. To him it made perfect sense. If anything, he thought that maybe the book was too short. And so was the title. The title clearly had to be longer in order to explain what was inside. The children worried about their father. They tried to talk to their mother about him, but she was very busy painting.
Their mother was getting ready to do a major art show at the museum in the city. The children thought her paintings were even more ridiculous than their father’s books.
Her paintings were huge. They didn’t look like anything that was describable. The closest the children could come to describing her pictures was to say that they looked as if someone had poured buckets of paint on the canvas then rolled across it. It was difficult for the children to believe that their mother actually spent months on each picture.
The children and their father drove to the opening of their mother’s art show. It was very crowded there. There were radio, television and newspaper reporters at the show.
After all, both parents were famous people. One for art and one for writing novels.
The children’s parents hadn’t seen each other for over a year and they were both quite nervous about seeing one another again.
Their dad brought along his finished novel and handed it to the children’s mother.
The children’s mother thought that the book had an excellent title and she sat down in the middle of the museum and began to read, “The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat Ranges and the ecological effects on the world if it becomes extinct”
The children shook their heads and said, “ but mom, it is two-thousand pages long. It will take weeks to read it”. But she wanted to read it, then and there. Even when the gallery was closing she was still reading. She hadn’t noticed anyone else. She just kept reading. And every once in awhile she would say, “This is really good.”
Meanwhile the children’s father was standing in front of one of the huge paintings.
One of the ones that looked like some people had rolled across the canvas after spilling buckets of paint. He stood there for hours, staring.
Every once in a while he would say, “This is really excellent.” Even when the gallery was closing, he was still standing and staring at the painting.
The children looked at each other. They knew what to do. They managed to get their mom and dad into their father’s car. They put their father’s book in with their mom.
They talked the security guards at the museum into taking down their mother’s painting and had them tie it onto the top of their father’s car.
Their father drove to their seashore home. All the while saying, “I didn’t know your art was so wonderful. And the mother said, “This book is great, I had forgotten what an imaginative writer you were.”
It took the children’s mother weeks to finish “The Yellow-bellied Sheath-tailed bat that scared Ned Kelly at Stringbark Creek in the Wombat
Ranges and the ecological effects on the world if it becomes extinct”. Then she wanted to read it again. No publisher in the world would publish it. But the children’s mother loved it and to them that was what was important. The family was back together again and they were all away from the city.
The huge painting was put up in the garage. The children said that they would never go into the house again if the painting was in the living room. The parents were unhappy about putting it in the garage but they did anyway.
They hired a house cleaner and the family prepared to go away on holiday.
Before they left on holiday, the house cleaner came screaming out of Leigh’s room.
The animals had been discovered. Everyone in the family liked the animals so much that they fenced in the front yard and let the animals live there.
When they came back from their holiday, together, the house was incredibly tidy.
The children’s parents got jobs in a nearby town as shopkeepers. The father still worked on his writing, but wrote stories for children instead of long novels that made no sense. He wrote children’s stories that made no sense, but children loved them and they sold well.
Leigh’s mother took up film making in her spare time and though the children thought some of her movies were a bit strange, they were happy that she wasn’t rolling around in paint or whatever it was that she did to do her paintings.
Most of all, the family was back together again, they didn’t live in the city any more, and they had all the animals from the lost world in Leigh McGee’s room. The animals even had a door in the fence where they could go in and out whenever they wanted to. But most of the animals chose to stay in the yard all the time.
© Terrell Neuage 1992 Victor Harbor South Australia
more stories at http://neuage.org/stories/
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''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.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
major: 4, minor: 1, revision: 3,
date: new Date("Feb 24, 2008"),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
//
// Upload Macro
//
config.macros.upload = {
// default values
defaultBackupDir: '', //no backup
defaultStoreScript: "store.php",
defaultToFilename: "index.html",
defaultUploadDir: ".",
authenticateUser: true // UploadService Authenticate User
};
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.messages = {
noStoreUrl: "No store URL in parmeters or options",
usernameOrPasswordMissing: "Username or password missing"
};
config.macros.upload.handler = function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (params[0]) {
prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0],
(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
} else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};
config.macros.upload.action = function(params)
{
// for missing macro parameter set value from options
if (!params) params = {};
var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
var username = params[4] ? params[4] : config.options.txtUploadUserName;
var password = config.options.pasUploadPassword; // for security reason no password as macro parameter
// for still missing parameter set default value
if ((!storeUrl) && (document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
if (storeUrl.substr(0,4) != "http")
storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
if (!toFilename)
toFilename = bidix.basename(window.location.toString());
if (!toFilename)
toFilename = config.macros.upload.defaultToFilename;
if (!uploadDir)
uploadDir = config.macros.upload.defaultUploadDir;
if (!backupDir)
backupDir = config.macros.upload.defaultBackupDir;
// report error if still missing
if (!storeUrl) {
alert(config.macros.upload.messages.noStoreUrl);
clearMessage();
return false;
}
if (config.macros.upload.authenticateUser && (!username || !password)) {
alert(config.macros.upload.messages.usernameOrPasswordMissing);
clearMessage();
return false;
}
bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;
};
config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir)
{
if (!storeUrl)
return null;
var dest = bidix.dirname(storeUrl);
if (uploadDir && uploadDir != '.')
dest = dest + '/' + uploadDir;
dest = dest + '/' + toFilename;
return dest;
};
//
// uploadOptions Macro
//
config.macros.uploadOptions = {
handler: function(place,macroName,params) {
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue("listWrapper",listWrapper);
this.refreshOptions(listWrapper,false);
var uploadCaption;
if (document.location.toString().substr(0,4) == "http")
uploadCaption = config.macros.upload.label.saveLabel;
else
uploadCaption = config.macros.upload.label.uploadLabel;
wizard.setButtons([
{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption,
onClick: config.macros.upload.action},
{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
]);
},
options: [
"txtUploadUserName",
"pasUploadPassword",
"txtUploadStoreUrl",
"txtUploadDir",
"txtUploadFilename",
"txtUploadBackupDir",
"chkUploadLog",
"txtUploadLogMaxLine"
],
refreshOptions: function(listWrapper) {
var opts = [];
for(i=0; i<this.options.length; i++) {
var opt = {};
opts.push();
opt.option = "";
n = this.options[i];
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
opts.push(opt);
}
var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if (h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
}
}
},
onCancel: function(e)
{
backstage.switchTab(null);
return false;
},
wizardTitle: "Upload with options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br>",
cancelButton: "Cancel",
cancelButtonPrompt: "Cancel prompt",
listViewTemplate: {
columns: [
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
};
//
// upload functions
//
if (!bidix.upload) bidix.upload = {};
if (!bidix.upload.messages) bidix.upload.messages = {
//from saving
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to upload backup file",
rssSaved: "RSS feed uploaded",
rssFailed: "Failed to upload RSS feed file",
emptySaved: "Empty template uploaded",
emptyFailed: "Failed to upload empty template file",
mainSaved: "Main TiddlyWiki file uploaded",
mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
//specific upload
loadOriginalHttpPostError: "Can't get original file",
aboutToSaveOnHttpPost: 'About to upload on %0 ...',
storePhpNotFound: "The store script '%0' was not found."
};
bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
var callback = function(status,uploadParams,original,url,xhr) {
if (!status) {
displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
return;
}
if (bidix.debugMode)
alert(original.substr(0,500)+"\n...");
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.upload.uploadRss(uploadParams,original,posDiv);
};
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
// save on localdisk ?
if (document.location.toString().substr(0,4) == "file") {
var path = document.location.toString();
var localPath = getLocalPath(path);
saveChanges();
}
// get original
var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
var originalPath = document.location.toString();
// If url is a directory : add index.html
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + "index.html";
var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
var log = new bidix.UploadLog();
log.startUpload(storeUrl, dest, uploadDir, backupDir);
displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
if (bidix.debugMode)
alert("about to execute Http - GET on "+originalPath);
var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
bidix.upload.uploadRss = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
bidix.upload.uploadMain(params[0],params[1],params[2]);
} else {
displayMessage(bidix.upload.messages.rssFailed);
}
};
// do uploadRss
if(config.options.chkGenerateAnRssFeed) {
var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
var rssString = generateRss();
// no UnicodeToUTF8 conversion needed when location is "file" !!!
if (document.location.toString().substr(0,4) != "file")
rssString = convertUnicodeToUTF8(rssString);
bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
} else {
bidix.upload.uploadMain(uploadParams,original,posDiv);
}
};
bidix.upload.uploadMain = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
var log = new bidix.UploadLog();
if(status) {
// if backupDir specified
if ((params[3]) && (responseText.indexOf("backupfile:") > -1)) {
var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
}
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
store.setDirty(false);
log.endUpload("ok");
} else {
alert(bidix.upload.messages.mainFailed);
displayMessage(bidix.upload.messages.mainFailed);
log.endUpload("failed");
}
};
// do uploadMain
var revised = bidix.upload.updateOriginal(original,posDiv);
bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};
bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
var localCallback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (xhr.status == 404)
alert(bidix.upload.messages.storePhpNotFound.format([url]));
if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
alert(responseText);
if (responseText.indexOf("Debug mode") >= 0 )
responseText = responseText.substring(responseText.indexOf("\n\n")+2);
} else if (responseText.charAt(0) != '0')
alert(responseText);
if (responseText.charAt(0) != '0')
status = null;
callback(status,params,responseText,url,xhr);
};
// do httpUpload
var boundary = "---------------------------"+"AaB03x";
var uploadFormName = "UploadPlugin";
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += uploadFormName +"\"\r\n\r\n";
sheader += "backupDir="+uploadParams[3] +
";user=" + uploadParams[4] +
";password=" + uploadParams[5] +
";uploaddir=" + uploadParams[2];
if (bidix.debugMode)
sheader += ";debug=1";
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
sheader += "Content-Length: " + data.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
data = sheader + data + strailer;
if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
if (!posDiv)
posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
store.allTiddlersAsHtml() + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = getPageTitle().htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
};
//
// UploadLog
//
// config.options.chkUploadLog :
// false : no logging
// true : logging
// config.options.txtUploadLogMaxLine :
// -1 : no limit
// 0 : no Log lines but UploadLog is still in place
// n : the last n lines are only kept
// NaN : no limit (-1)
bidix.UploadLog = function() {
if (!config.options.chkUploadLog)
return; // this.tiddler = null
this.tiddler = store.getTiddler("UploadLog");
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = "UploadLog";
this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
}
return this;
};
bidix.UploadLog.prototype.addText = function(text) {
if (!this.tiddler)
return;
// retrieve maxLine when we need it
var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
if (isNaN(maxLine))
maxLine = -1;
// add text
if (maxLine != 0)
this.tiddler.text = this.tiddler.text + text;
// Trunck to maxLine
if (maxLine >= 0) {
var textArray = this.tiddler.text.split('\n');
if (textArray.length > maxLine + 1)
textArray.splice(1,textArray.length-1-maxLine);
this.tiddler.text = textArray.join('\n');
}
// update tiddler fields
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
// refresh and notifiy for immediate update
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
};
bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
if (!this.tiddler)
return;
var now = new Date();
var text = "\n| ";
var filename = bidix.basename(document.location.toString());
if (!filename) filename = '/';
text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
text += config.options.txtUserName + " | ";
text += "[["+filename+"|"+location + "]] |";
text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
text += uploadDir + " | ";
text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
text += backupDir + " |";
this.addText(text);
};
bidix.UploadLog.prototype.endUpload = function(status) {
if (!this.tiddler)
return;
this.addText(" "+status+" |");
};
//
// Utilities
//
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.dirname = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
bidix.basename = function(filePath) {
if (!filePath)
return;
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);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
//
// Initializations
//
// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);
// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");
//optionsDesc
merge(config.optionsDesc,{
txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
txtUploadUserName: "Upload Username",
pasUploadPassword: "Upload Password",
chkUploadLog: "do Logging in UploadLog (default: true)",
txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});
// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');
// Backstage
merge(config.tasks,{
uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");
//}}}