I was looking for a possibility to write text from a panorama to a file on the user's computer and found Downloadify, which can do this via JavaScript. So I have this code to add to the panorama.html:
<head>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/downloadify.min.js"></script>
</head>
<body onload="load();">
<form>
<p>
<label for="filename">Filename</label><br />
<input type="text" name="filename" value="testfile.txt" id="filename" />
</p>
<p>
<label for="data">File Contents</label><br />
<textarea cols="60" rows="10" name="data" id="data">
Whatever you put in this text box will be downloaded and saved in the file. If you leave it blank, no file will be downloaded</textarea>
</p>
<p id="downloadify">
You must have Flash 10 installed to download this file.
</p>
</form>
<script type="text/javascript">
function load(){
Downloadify.create('downloadify',{
filename: function(){
return document.getElementById('filename').value;
},
data: function(){
return document.getElementById('data').value;
},
onComplete: function(){ alert('Your File Has Been Saved!'); },
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); },
swf: 'media/downloadify.swf',
downloadImage: 'images/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});
}
</script>
</body>
Display More
And this for the panorama.xml:
<plugin name="save" url="save.png" onclick="js( load(get(variable1), get(variable2)) );" />
As I don't need the <form> I deleted it, but now (I guess) I have to rewrite these lines in the <body>:
return document.getElementById('filename').value;
return document.getElementById('data').value;
...but I don't know how. Can you help me? I'm sure it's very simple, but I couldn't manage to get it work.