GcMedia version 1.0beta (release date: 2009-02-24)
About
This is a server side file browser plug-in for jQuery. Purpose is simple - you have some files on your server, and you have some input fields, where you want user to input URL of one of those files. This could come handy for CMS development or some social networking site.
Attention! since there is a bug in jQuery UI dialog widget - dialog does not show up in IE7 (and i think also in IE6). The bug has been fixed in the trunk, so in final version of jQuery UI 1.6/1.7 the plug-in will work in IE.
Download
- Downdload (ZIP, 151Kb)
- Downdload Minified (coming soon)
- Downdload Packed (coming soon)
Demo
Coming soon
Requirements
Options explained
- onOpen - callback function, parameters:
- target - target input field
- onClose - callback function, parameters:
- target - object, target input field
- filePath - string, new file path
- cancel - boolean, is this a cancel operation
- backendFileURI - string, server backend script for file opeartions and listing
- backendDirectoryURI - string, server backend script for directory operations
- backendType - string, "iframe" or "json" server backend output type (if it's json, data will be rendered on client side, if an iframe data will be printed in iframe body) - NOT IMPLEMENTED
- backendReadOnly - boolean, describes weather backend is static (read-only) or dynamic (with upload and other options). If this is false file upload, file rename, delete and directory create, rename or delete is not accessible
- viewMode - string, file list view-mode. Available values: "list" and "thumbnails"
- viewModeChange - boolean, weather to allow or deny access for user to change view-mode
- useButton - boolean, weather or not to add a button after input field. If false, click will be activated on the input field.
Backends
Most of operations are performed via HTTP POST, with variable "task".
Directory backend task values:
'create-directory', 'rename-directory', 'delete-directory'
File backend task values are:
'rename-file', 'delete-file'
Also there is HTTP GET parameter for directory backend called 'get-directory-tree', which must return <option value="$directory_url">$directory_name</option> tags in plain text.
For file upload the same IFrame is used and it should accept all the form fields for further operation on file upload. Like: 'directory-list' field for seting target directory and 'upload-file' as the uploaded file source.
Usage
$('input.file').gcmedia({
backendFileURI: '/path/to/backend/backend.file.php',
backendDirectoryURI: '/path/to/backend/backend.dir.php',
});
Change Log
- 2009-02-24 (v1.0beta) - Initial public release.
ToDo
- Add support for system configurations WITHOUT jQuery UI plugin installed. For example use popup (window.open) or develop my own modal dialog renderer
- Add support for JSON backend - draw file list in a div#gcmedia-browser-form element from returned JSON data (elements: directories, files)
- Add table sort functionality for "List view" mode
- Implement beautifull alert, prompt and confirm dialogs (maybe I should build them on the same jQuery UI dialog widget)
- Testing testing testing