mip’s blog


OL Filebrowser FAQ

Posted in openlaszlo by admin on the April 14th, 2008

Ok, after introducing my OL Filebrowser class, here is part 2 to answer most of the possible questions about using this class:

Attributes

Despite the general attributes applible to an object of the OL window class the following attributes have been implemented:

  • DirPath: The starting directory on the server – aka the root you like to show
  • SrcPath: The URL to call for getting the directory listing
  • callAttributes: If you require additional parameters added over the script providing the directory listing, define an object with attribute-value pairs like here:
    callAttributes="${{menuname:'read_mediadir'}}"
  • autoclose: if a file is selected the window closes automatically. If this behaviour is not wishful, turn it of by setting it to false; Default: true.
  • value: if a file was selected, this attribute contains the filename

Methods

These are just the major methods you’re going to use during normal usage:

  • open: Opens the window and loads the current directory again. So selection is resetted
  • takeSelection: Parameters: [func:Function], [target:Object]
    The closing function of the class. Sets the value of the Object to the selected document (if any) otherwise null. If [func] and [target] is set, the function [func] is called as a method of [target] and with the path of the selected document as parameter.
    If autoclose is true, the window is closed.
  • getCurrentDir: returns the full current directory path starting with the directory specified in DirPath

XML input

The object uses the standard HTTP request of its “fileListSet” dataset. A parameter “dir” is set to the path of the directory to read and the callAttributes are added if there are any.

The Response of the serverside script then should look like this:
<list>
<file type="DS_Store" size="12292" date="2008-04-08 08:44:12">
<name><![CDATA[.DS_Store]]></name>
<full><![CDATA[/Users/myuser/path/to/file.jpg]]></full>
</file>
<file type="directory" size="476" date="2007-10-02 22:15:43">
<name><![CDATA[classes]]></name>
<full><![CDATA[/Users/myuser/path/to/dir]]></full>
</file>
</list>

The structure is quite straight forward. The filesize is in bytes and is converted into KB or MB by the object. The type attribute can have any value. Only “directory” is important to identify directories.

2 Responses to 'OL Filebrowser FAQ'

Subscribe to comments with RSS or TrackBack to 'OL Filebrowser FAQ'.

  1. Arsène Kafando said,

    on June 19th, 2008 at 15:47

    Hi,
    i try to use fileuploader of Wagner Sebastian but it didn’t physically put the file at location. Can you help me to solve the problem?

    Thanks!

  2. admin said,

    on June 23rd, 2008 at 10:44

    Dear Arséne,

    pls. open a thread at forum.openlaszlo.org and then we can discuss everything in detail. Pls. first submit your code to check. I’ll be much better able to help you then

    Thx & Best Regards,

    mip

Leave a Reply