$html = get_storage_html(parameter array);
It makes it easy for the user and the developer to select and integrate storage devices into the plugin UI.
This features is available starting with LoxBerry 1.2.1. Use that version as your minimum version in your plugin.cfg.
To simplify parameter readability and usage, the function needs to be called with an array of named parameters.
Using the parameters, you can adjust the behaviour and design of the HTML dropdown.
The function can be used multiple times on every page, but the
formid parameter must be unique for every call.
Parameter list of get_storage_html (Perl and PHP)
Name of the HTML form element including the resulting path. This id is used as id and name of the element. The input field is hidden in the form, but updated on every user change.
Giving a path, this is the pre-defined path of the dropdown element. Read the path from your config file and insert it here.
Omitting this parameter will set an empty path.
undef - The user is not allowed to add an additional subfolder to the selected storage.
1 - Behind the selected storage, the user can enter an own subfolder tree. But keep in mind that the plugin code has to care about the existance and creation of that folder.
If this parameter is omitted (default), all storage points are shown.
To only show writeable storage points, set readwriteonly => 1.
This is the string label in front of the dropdown. Usually, set the label to a string from your plugin language phrases.
Without this parameter, the system default string "Storage path" (language specific) will be used.
|data_mini||x||undef||This flag corresponds to the jQuery Mobile flag |
|Types of storage to show|
|type_all||x||1 oder 0|
Using type_all => 1 (or omitting this parameter), all of the folloing storage types are shown. If you set at least one other type to 1, type_all is disabled.
USB storage devices are selectable.
Network shares are selectable.
The local plugin data directory ($lbpdatadir) is selectable.
The user can alternatively enter an own path.
Take care: If you want to prevent a custom path by type_custom = 0, and the sent
The function returns a string with html, that can be directly echoed to the output. In the case that anything fails, it returns nothing.
Usage with html form processing
Echo the generated html inside <form></form> tags. On submission, the
formid name contains the full path (including folders) of the user selection. The path is the absolute path on LoxBerry.
A trailing / is always removed, also if you deliver it with
the current, combined path can be accessed everytime, and every change can be monitored: