Automatically exported from code.google.com/p/cfilebrowser
spanjeta / cfilebrowser Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/cfilebrowser
Automatically exported from code.google.com/p/cfilebrowser
I have
1) "public function actionAjaxFileBrowser()" which
generates tree nodes. This function is located in
/akestrel/protected/modules/article/controllers/ImageController.php file.
(in the atached file)
2)
In .../config/main.php
'request'=>array(
'enableCsrfValidation'=>true,
'enableCookieValidation'=>true,
),
3)
$this->widget('application.extensions.cfilebrowser.CFileBrowserWidget',array(
'script'=>array('article/image/ajaxfilebrowser'),
'root'=>'/Xbb/',
'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 widget generates
//<![CDATA[
jQuery(document).ready(function() {
jQuery('#filebrowser').fileTree({
root:'/Xbb/',
script:'/akestrel/index.php?r=article/image/ajaxfilebrowser',
folderEvent:'click',
expandSpeed:1000,
collapseSpeed:1000,
multiFolder:true,
expandEasing:'easeOutBounce',
collapseEasing:'easeOutBounce',
loadMessage:'File Browser Is Loading...hang on a sec'
}, function(f){
alert("I selected " + f); });
});
//]]>>
When enableCsrfValidation is set to false this javascript generates the tree.
But if enableCsrfValidation is set to true this javascript generates nothing.
Original issue reported on code.google.com by [email protected]
on 6 Jul 2010 at 4:23
Attachments:
What steps will reproduce the problem?
1. Create a new Yii project (I'm using 1.1.8).
2. Copy the CFileBrowser folder to protected/extensions.
3. Instantiate the widget in your view, like so:
<?php
$this->widget('application.extensions.cfilebrowser.CFileBrowserWidget',array(
'script'=>array('site/filebrowser'),
'root'=>'/tmp/',
'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)'
));
?>
4. Copy the example action into your controller (in my case SiteController.php):
public function actionFileBrowser()
{
$root = '/';
$_POST['dir'] = urldecode($_POST['dir']);
if( file_exists($root . $_POST['dir']) ) {
$files = scandir($root . $_POST['dir']);
natcasesort($files);
if( count($files) > 2 ) { /* The 2 accounts for . and .. */
echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
// All dirs
foreach( $files as $file ) {
if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && is_dir($root . $_POST['dir'] . $file) ) {
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "/\">" . htmlentities($file) . "</a></li>";
}
}
// All files
foreach( $files as $file ) {
if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && !is_dir($root . $_POST['dir'] . $file) ) {
$ext = preg_replace('/^.*\./', '', $file);
echo "<li class=\"file ext_$ext\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "\">" . htmlentities($file) . "</a></li>";
}
}
echo "</ul>";
}
}
}
What is the expected output? What do you see instead?
I'm expecting to see the file browser, but instead see nothing. The console is
showing the following error:
[12:53:29.757] jQuery("#filebrowser").fileTree is not a function @
http://test.local/site/files/1:81
What version of the product are you using? On what operating system?
I'm using cfilebrowser-1.0 on Ubuntu Desktop 10.10 (64 bit) and Firefox 8.0.
Please provide any additional information below.
Not sure what else to add (new to this), but will provide more information on
request.
Original issue reported on code.google.com by [email protected]
on 24 Nov 2011 at 1:02
What steps will reproduce the problem?
1.Create an page with this widget correctly configured and view it. Must be
without errors.
2.Change the extentionsPath to something different from /protected/extensions.
3.view again the previous page.
What is the expected output? What do you see instead?
I expect the same output shown in the first step, but I have obtained the
exception: The asset "/Path/to/webapp/protected/extensions/cfilebrowser/assets"
to be published does not exist.
What version of the product are you using? On what operating system?
1.0
Please provide any additional information below.
The problem is the alias used in CFIleBrowserWidget.php :
application.extensions.cfilebrowser
It's incorrect! try with ext.cfilebrowser, it's the correct way!
Original issue reported on code.google.com by [email protected]
on 14 Sep 2011 at 2:13
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.