PDA

View Full Version : Setting up downloads


rajs1
10-14-2004, 03:26 AM
I have written a Laszlo App that allows a person to register (with email address).

After logging in (with emailed password) I want to show a grid of download options as follows:

App (Demo) vX.X Size

Win 98/2k/XP download xx MB
Mac OS X download xx MB
Unix download xx MB


Ideally I would like the "download" to be a button that calls up a servlet, so that within that servlet I can

response.sendRedirect("http://myserver.com/files/app.exe")


The registration, loggin in etc has been done using javarpc and it all works fine.

I don't thin I can use javarpc for the "download" bit (can I?)

How can I call a servlet (something to do with doRequest() is it?).

Can you please point me to the correct documentation please.

Also can I pass the sesion info from my Laszlo App to the download servlet?

Cheers
-raj

antun
10-14-2004, 06:04 AM
There's a LzBrowser service that has a loadURL() method you can use:

http://www.laszlosystems.com/lps-2.2/docs/reference/lzbrowser.html

-Antun

rajs1
10-14-2004, 08:39 AM
Thanks for the reply.

I have some (xml) data on the server.

I create the grid from it as:

<grid datapath="downloads:/resultset" width="400" height="300">

<gridcolumn width="125">Platform
<text datapath="@platform" />
</gridcolumn>


<gridcolumn width="125">
<text><a href="downloadurl/text()">download</a></text>


<!-- <button onclick="LzBrowser.loadURL('@downloadurl')">download</button> -->

</gridcolumn>


<gridcolumn width="50">Size
<text datapath="@size" />
</gridcolumn>


</grid>

I have tried:
<a href="@downloadurl">download</a> too.

But in all cases, the URL is passed through as
@downloadurl (i.e, it does not get parsed!).

How can it pick up the URL from my dataset dynamically.

As an aside you'd notice that the <button> code has been commented out. This is because I get a compiler error?

Your help is much appreciated.

Cheers
-raj

antun
10-14-2004, 01:39 PM
You had the right idea with this:

<button onclick="LzBrowser.loadURL('@downloadurl')">download</button>


... only just putting '@downloadurl' isn't going to do anything. You need to do something like:


<button>
<method event="onclick">
var url = parent.datapath.p.getAttr("downloadurl");
LzBrowser.loadURL( url );
</method>
</button>


-Antun

PS You might find these instructions on forums formatting useful:
http://www.laszlosystems.com/developers/community/forums/misc.php?action=bbcode

rajs1
10-14-2004, 02:03 PM
Thank you very much indeed for your help.

I did put the <method> tags etc initially with button inside the grid.

But I got this error in the debugging console.

I get it even now that I have followed your suggestion.

The error is:


lz/button.lzx:125: undefined object does not have a property 'setResourceNumber'
lz/button.lzx:126: reference to undefined property '_innerbezel'
lz/button.lzx:126: undefined object does not have a property 'setResourceNumber'
lz/button.lzx:75: reference to undefined variable '_enabled'


Should I just ignore it.

Cheers
-raj