CFileBrowserWidget

This is a widget that will render a file browser on the page

thumbnail

Installation and Usage

The Controller Action

The widget relises on a 'connector' that gets called via AJAX requests to display a folders contents. You can cut and paste the code in ControllerActionSample.php into the controller of your choice.

The widget

Place all the widget file in the extensions folder of your application and call the widget in your page like this:

$this->widget('application.extensions.cfilebrowser.CFileBrowserWidget',array(
                'script'=>array('site/filebrowser'),
                'root'=>'/var/',
                'folderEvent'=>'click',
                'expandSpeed'=>1000,
                'collapseSpeed'=>1000,
                'expandEasing'=>'easeOutBounce',
                'collapseEasing'=>'easeOutBounce',
                'multiFolder'=>true,
                'loadMessage'=>'File Browser Is Loading...hang on a sec',
                'callbackFunction'=>'alert("I selected " + f)'
));

This will then render the following code in your file

<div id="filebrowser"></div>


<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
        jQuery('#filebrowser').fileTree({
                root:'/var/',
                script:'/index.php?r=site/filebrowser',
                folderEvent:'click',
                expandSpeed:1000,
                collapseSpeed:1000,
                multiFolder:true,
                loadMessage:'File Browser Is Loading...hang on a sec',
                expandEasing:'easeOutBounce',
                collapseEasing:'easeOutBounce'
        }, function(f){
                alert("I selected " + f);
        });
});
//]]>>
</script>

Widget Options