Code Monkey home page Code Monkey logo

jqueryfiletree's Introduction

jQueryFileTree

GitHub version

NOTE:

I no longer use jQuery and have no need for a filetree, so it would be great if someone wanted to take over this project to maintain it, address issues, set up integrated testing, etc.

DEMO

http://jqueryfiletree.github.io/

INSTALLING

Bower: bower install jqueryfiletree --save

Manual: Download ZIP

ABOUT

jQueryFileTree is a configurable, AJAX file browser plugin for jQuery. This repo is a continuation of unmaintained jQuery File Tree (12 April 2008) by Cory S.N. LaViska at ABeautifulSite.net

jQueryFileTree requires at least jQuery 1.2

FEATURES

  • Produces valid, semantic XHTML
  • Fully customizable via CSS
  • Ability to style icons based on file extension
  • Uses AJAX to fetch file information on the fly
  • Easy to configure and implement
  • Includes connector scripts for PHP and ASP.NET (C#)
  • Supports custom connector scripts for extended functionality
  • Customizable expand/collapse event
  • Customizable expand/collapse speeds
  • Supports easing functions
  • Single- and multi-folder views
  • Configurable load message
  • Multi-select select with checkboxes
  • Supports event listening on unique actions

CREATING A FILE TREE

In it’s simplest form, you can create a file tree using the following code:

	$(document).ready( function() {
		$('.class').fileTree({ root: '/some/folder/' }, function(file) {
			alert(file);
		});
	});

Where .class is the class of an empty DIV element that exists on your page. The file tree will automatically load when your page loads. Any DIV elements with this class will share the same file tree.

CONFIGURING THE FILE TREE

Parameters are passed as an object to the fileTree() function. Valid options include:

ParameterDescriptionDefault Value
rootroot folder to display"/"
script location of the serverside AJAX file to use "jqueryFileTree.php"
folderEvent event to trigger expand/collapse "click"
expandSpeed Speed to expand branches (in ms); use -1 for no animation 500
collapseSpeed Speed to collapse branches (in ms); use -1 for no animation 500
expandEasing Easing function to use on expand "swing"
collapseEasing Easing function to use on collapse "swing"
multiFolder Whether or not to limit the browser to one subfolder at a time true
loadMessage Message to display while initial tree loads (can be HTML) "Loading..."
errorMessage Message to display if unable to load tree "Unable to get file tree information"
multiSelect Append checkbox to each line item to select more than one false
onlyFolders Filter files and only return folders false
onlyFiles Filter folders and only return files false
preventLinkAction Prevents default link-clicking action from occurring. This, in effect, prevents the page from resetting to the top. false

* Anything other than 'swing' and 'linear' requires an external lib or script like jQuery UI or jquery.easing

There are many options available, which would look something like this:

	$(document).ready( function() {
		$('.class').fileTree({
			root: '/some/folder/',
			script: 'jqueryFileTree.php',
			expandSpeed: 1000,
			collapseSpeed: 1000,
			multiFolder: false
		}, function(file) {
			alert(file);
		});
	});

STYLING THE FILE TREE

The file tree relies 100% on CSS for styling. Refer to jqueryFileTree.less to make any changes to the default styling.

CONNECTOR SCRIPTS

jQueryFileTree comes with a handful of serverside connector scripts that are used to read the file system on your server and return data to the clientside script via AJAX. The default connector script is jqueryFileTree.php. You can use a connector script for another language by setting the script parameter to the location of the script you want to use (see Configuring the File Tree). Alternatively, you can build a custom connector script to extend the functionality of jQueryFileTree to better suit your needs (see Custom Connector Scripts).

Connector scripts for the following languages are provided:

  • PHP by Cory LaViska (originally)
  • PHP-Laravel 5.* by Jean Jar
  • ASP (VBS) by Chazzuka
  • ASP.NET (C#) by Andrew Sweeny
  • ColdFusion by Tjarko Rikkerink
  • JSP by Joshua Gould
  • Lasso by Marc Sabourdin
  • Lasso by Jason Huck
  • Node.js by Peng Wang
  • Perl by Oleg Burlaca
  • Python/Django by Martin Skou
  • Ruby by Erik Lax

(DAVE) Note that all of the connector scripts have been left unmaintained outside of the PHP one in which I have updated (and will continue to do so). If you've improved or created a connector, feel free to create a pull request. Use connector scripts as a starting point, but be mindful that often such (largely) unmaintained examples lack the security necessary for production.

CUSTOM CONNECTOR SCRIPTS

You can create a custom connector script to extend the functionality of the file tree. The easiest way to do this is probably by modifying one of the scripts supplied in the download. If you want to start from scratch, your script should accept one POST variable (dir) and output an unsorted list in the following format:

	<ul class="jqueryFileTree">
		<li class="directory collapsed"><a href="#" rel="/this/folder/">Folder Name</a></li>
		(additional folders here)
		<li class="file ext_txt"><a href="#" rel="/this/folder/filename.txt">filename.txt</a></li>
		(additional files here)
	</ul>

Note that the corresponding file extension should be written as a class of the li element, prefixed with ext_. (The prefix is used to prevent invalid class names for file extensions that begin with non-alpha characters.)

Additionally you may choose to enable multi-select, which appends a checkbox to each item. Visible child elements will automatically be checked/unchecked along with the parent. Currently this is only supported in PHP; feel free to update other connectors to reflect the following format:

	<ul class="jqueryFileTree">
		<li class="directory collapsed"><input type='checkbox' /><a href="#" rel="/this/folder/">Folder Name</a></li>
		(additional folders here)
		<li class="file ext_txt"><input type='checkbox' /><a href="#" rel="/this/folder/filename.txt">filename.txt</a></li>
		(additional files here)
	</ul>

EVENTS

jQueryFileTree now supports binding event listeners to the file tree element

$('.filetree')
	.on('filetreeinitiated', function(e, data)	{ console.log(data); });
	.on('filetreeexpand', function (e, data)	{ console.log(data); })
	.on('filetreeexpanded', function (e, data)	{ console.log(data); })
	.on('filetreecollapsed', function (e, data)	{ console.log(data); })
	.on('filetreecollapse', function (e, data)	{ console.log(data); })
	.on('filetreeclicked', function(e, data)	{ console.log(data); });

All except 'filetreeinitiated' return the data object with the following properties

PropertyValue
liLI jQuery object
typefile | directory
valuename of the file or directory
relrelative path to file or directory
containercontainer jQuery object (ie: `$('.filetree')`)

Pretty much has the information you need, but I included the LI object anyways so you can easily get any other data you want with something like data.li.prop('class').

LICENSING & TERMS OF USE

This plugin is dual-licensed under the GNU General Public License and the MIT License and is copyright 2008 A Beautiful Site, LLC.

CONTRIBUTING

Gulp is used to compile the CoffeeScript and LESS files into js and css files respectively. If you are making changes to jQueryFileTree itself (and not the connectors), you MUST make your changes inside jQueryFileTree.coffee and jQueryFileTree.less or the next time jQueryFileTree is compiled your changes will disappear.

TESTING

In order to test, you'll need Bower and Gulp. Right now, I just have a manual browser demo to test functionality.

  • In Terminal, go to the /tests/manual/ folder and type bower install to set up the Bower assets.
  • gulp coffee will compile /src/coffeescript/jQueryFileTree.coffee to JS, minify, and copy to /dist/ as well as the testing folder (if testing is set up). A non-minified version is saved to /src/ for debugging the output.
  • gulp less will compile /src/less/jQueryFileTree.less to CSS, minify, and copy to /dist/ as well as the testing folder (if testing is set up). A non-minified version is saved to /src/ for debugging the output.
  • gulp or gulp default will run coffee and less consecutively, then update the manual test folder.

SPECIAL THANKS

A special thanks goes out to FAMFAMFAM for their excellent Silk Icon Set.

jqueryfiletree's People

Contributors

adougal avatar andreynering avatar daverogers avatar gomolot avatar jackchallen avatar jeanjar avatar kimisme9386 avatar psolom avatar rfg76 avatar stonio avatar unix4you2 avatar vinceis1337 avatar vlmaksime avatar yashasvigirdhar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jqueryfiletree's Issues

Single click and double click action ?

hi,
On the original JFT I did a small change so that single-click simply sets the current path and double click opens the file (i.e. what currently single-click does).
I just added second argument "select" to the

fileTree: function(o, h, select) ...

and later :

function bindTree(t) {
$(t).find('LI A').bind(o.selectEvent, function() {
select($(this).attr('rel'));
});

$(t).find('LI A').bind(o.folderEvent, function() {
       .......................

How do I do the same to this new version. I.e. I want to add single and double click handlers.

php connector file error : undefined index

In the php connector,

$_POST['dir'] = urldecode($_POST['dir']);

throws undefined index error.

The reason most probably is, at first time we run the script without ?dir=[something] and $_POST has no key like dir.

Demos not working

The demos on your demo page are not working. they are showing an 'Unable to get file tree inforamtion' error.

The console shows a cross origin request being blocked to davidroge.rs/jqft/jqueryFileTree.php

problem with the php file

Hi,
I am trying to make it work perfectly but i couldn't ...
The page loads successfully but the tree doesn't show instead it's the .php script, all written on the left side instead of the actual tree.

i reviewed and compared the online test page, it the same code but i don't know what is the problem.

Any suggestions ?

**i am using firefox , chrome has the cross-origin problem.

Bug: Unexpected escaping/decoding of directory

When constructing a filetree instance, options.root is escaped and passed to showTree:
_this.showTree($el, escape(this.options.root), function() { ... });.

This is unnecessary and unexpected as the later call to $.ajax() will escape the directory string value anyway.

I am surprised no one has encountered issues with this because it requires double-url-decoding at the server side and then only in the case of initially creating a filetree instance.

does not work on MSWindows

If in the "dir" parameter is contained a MSWIndows style volume, for example "D:/" the jQUeryFileTree.js does not work;
the problem is probably at line 138 where
$(this).attr('rel').match(relPattern)[0])
using relPattern that don't consider the possibility of having "c:" ath the beginning of the rel.

Actually I don't undertand the purpose of this match: removing the match() :
_this.showTree($(this).parent(), $(this).attr('rel'));
the program seems to work good..

RIc

filetreeinitiated event not being triggered

I haven't had time to test, but I think line 142-143 should be changed from:

                if options.root == dir
                    $el.find('UL:hidden').show( callback? )

To:

                if options.root == dir
                    $el.find('UL:hidden').show({complete: finishCallback})

If options.root is '/' (default value), then the comparison above will be true and 'finishCallback' never gets called.

Add scriptOptions

  • allow options array intended for use in script, so developers can pass along whatever custom options they need for their filetree instance
  • fold any existing script options into that array in a backwards compatible way (e.g. onlyFolders)

Error with Bower command

Bower (version 1.7.9) command bower install jqueryfiletree --save does not work. I have the following error:

ECMDERR Failed to execute "git clone https://github.com/jqueryfiletree/jqueryfiletree.git -b 2.1.3 --progress . --depth 1", exit code of #128 Cloning into '.'... remote: Counting objeremote: Compressing objects: 100% (74/74), done.         remote: Total 82 (delta 1), reused 54 (delta 0), pack-reused 0         Checking connectivity... done. Note: checking out '7432f0899b67471016d933fa258300b44936abe2'.  You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.  If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:    git checkout -b   fatal: cannot create directory at 'dist/connectors/PHP-Laravel-5.*': Invalid argument warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'

Additional error details:
Cloning into '.'...
remote: Counting objects: 82, done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 82 (delta 1), reused 54 (delta 0), pack-reused 0
Checking connectivity... done.
Note: checking out '7432f0899b67471016d933fa258300b44936abe2'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b 

fatal: cannot create directory at 'dist/connectors/PHP-Laravel-5.*': Invalid argument
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Use of this version exposes a server-side full directory structure to the client-side

Hi, The removal of the $root (#3 fix) basically exposes the server-side directory to the client-side. Just run with a debug (firefox firebug) and you can see from root on down, thus allowing directory mining of web site's file sytem, including any shared hosting sites (depending on hosting management).

Below is a more secure approach to using Tree File, by introducing $treeFileRoot so only directories below the tree-file-root are visible, and no server-side file paths are exposed on the client-side when using debuggers.

...
<?php
// IMPORTANT: $fileTreeRoot needs to be set for this script to work (see below)
//
// THIS IS A BASE FILE, it is strongly advised that you copy this file to
// a place on your webpages with a different name, and then use the different
// name as the 'script: scriptname' in your webpage that displays the
// tree file.
//
// Once copied you may remove most comments from the script so as to save
// some space and processing time
/**
* jQuery File Tree PHP Connector
*
* Version 1.1.0
*
* @author - Cory S.N. LaViska A Beautiful Site (http://abeautifulsite.net/)
* @author - Dave Rogers - https://github.com/daverogers/jQueryFileTree
*
* History:
*
* 1.1.0 - adding multiSelect (checkbox) support (08/22/2014)
* 1.0.2 - fixes undefined 'dir' error - by itsyash (06/09/2014)
* 1.0.1 - updated to work with foreign characters in directory/file names (12 April 2008)
* 1.0.0 - released (24 March 2008)
*
* Output a list of files for jQuery File Tree
*/

// must be referred to this file from within host system
// and not via direct access (book mark) as there is sensitive $_POST information
//
// This assists in preventing users from book marking this page or attempting
// to access directly and having the invoker getting access to server
// information.
if (! array_key_exists ( 'HTTP_REFERER', $_SERVER )) {
    // redirect to the hosts root page
    // WARNING WARNING WARNING -- make sure your site has an index.html/index.php
    // so as to except this redirect
    header ( "Location: http://" . $_SERVER ['HTTP_HOST'] );
    die ();
}

/**
 * USER USER USER USER please set me
 */
$fileTreeRoot;
 /**
 * $fileTreeRoot provides the root within the server where files are to
 * be displayed from.
 *
 * Typically this will be some thing like:
 * 1) $fileTreeRoot = $_SERVER['DOCUMENT_ROOT'] . 'public';
 * 2) $fileTreeRoot = $_SERVER['DOCUMENT_ROOT'] . 'public/files';
 *
 * [ 'public' and 'files' are directory paths in your file structure
 * ---- do not terminate with '/' ]
 *
 * When combined with the "root: /" setting of the archiecture will
 * result in all files under 'public/' or 'public/files/' being
 * displayed in the tree.
 *
 * If you set $fileTreeRoot = '/'; -----> all the machines files will be exposed
 * and/or using debug users can determine your server's directory structure.
 * ---------- [BIG SECURITY ISSUE] --------
 */

// When the $fileTreeRoot has been appropriately set
// the following code may be commented out (or deleted)
if (! isset ( $fileTreeRoot )) {
    $fileMe = __FILE__;
    echo "<p>Need to configure file-tree-root variable in: $fileMe</p>";
    exit ();
}

$_POST ['dir'] = urldecode ( (isset ( $_POST ['dir'] ) ? $_POST ['dir'] : null) );

// set checkbox if multiSelect set to true
$checkbox = (isset ( $_POST ['multiSelect'] ) && $_POST ['multiSelect'] == 'true') ? "<input     type='checkbox' />" : null;

// restrict the displayed directory to be below the file-tree-root
// but need to process files and scans with asolute full paths
//
// within this PHP file the full paths are confined to the server and
// client users cannot see them
$postDir = $fileTreeRoot . $_POST ['dir'];

// when processing via scandir will be created absolute paths to files
// this information should NOT be allowed to go to the client

$fileTreeRootLen = strlen ( $fileTreeRoot );

if (file_exists ( $postDir )) {
$files = scandir ( $postDir );

// base-dir is the path that is below the $fileTreeRoot path
// which concatenate with $file will be the relative path information
// sent to the client
$baseDir = substr ( $postDir, $fileTreeRootLen );

natcasesort ( $files );

if (count ( $files ) > 2) { // The 2 accounts for . and ..
    echo "<ul class='jqueryFileTree'>";
    // All dirs
    foreach ( $files as $file ) {
        // full path info for file_exists (server-side data only)
        $postDir_File = $postDir . $file;

        if (file_exists ( $postDir_File ) && $file != '.' && $file != '..' && is_dir ( $postDir_File )) {
            // client side info is relative to $treeFIleRoot
            $htmlBaseFile = htmlentities ( $baseDir . $file );
            $htmlFile = htmlentities ( $file );

            ECHO <<<DIRCOLLAPSE
  • {$checkbox}$htmlFile
  • DIRCOLLAPSE;
                // if you don't like heredocs use
                // echo "<li class='directory collapsed'>";
                // echo "{$checkbox}<a href='#' rel='" . htmlentities ( $baseDir . $file) . "/'>" . htmlentities ( $file ) . "</a></li>";
            }
        }
        // All files
        foreach ( $files as $file ) {
            if (file_exists ( $postDir_File ) && $file != '.' && $file != '..' && ! is_dir ( $postDir_File )) {
                $ext = preg_replace ( '/^.*\./', '', $file );
    
                // client side info is relative to $treeFIleRoot
                $htmlBaseFile = htmlentities ( $baseDir . $file );
                $htmlFile = htmlentities ( $file );
    
                ECHO <<<DIREXT
    
  • {$checkbox}$htmlFile
  • DIREXT;
                // if you don't like heredocs use
                // echo "<li class='file ext_{$ext}'>{$checkbox}<a href='#' rel='" . htmlentities ( $baseDir . $file ) . "'>" . htmlentities ( $file ) . "</a></li>";
            }
        }
        echo "</ul>";
    }
    

    }

    ?>

    ...

    Use jqueryfiletree to select only folder

    I need use jqueryfiletree to select a folder (no file).
    I'd like to edit a input form when the user click on folder with REL attribute of link of selected folder.

    Is it possible? How?

    'selected' styling effect incompatible with multiple file trees

    Making a new issue for bug mentioned in issue #13

    just noticed a minor bug on this feature; if more than one file browsers are present on a page (e.g. if the user needs to select two different files), only one highlighted file appears at a time. That is to say, I click on the first file, and it highlights; when I go to click the second file, it highlights also but the first file un-highlights.

    No checkbox when using multiselect option

    used the sample index.html to try the functionality of multiselect feature. But i dont that check box to mark ticks are visible in the file tree. Rest of the code works as stated.

    Make the script function result promise aware

    Functions as script object is a good addition. Gives much control over the result generation.

    Please make the script function be 'promise' aware (so that asynchronous functions, such as async custom ajax requests can be used).

    How to know the last selected folder?

    Hi!

    I'm writting an extension for this tool that gives to the user the possibility to create a new folder or file, change permissions and more. A simplified file manager that could be attached to any jqueryfiletree but I need to know hot to get the last folder or file selected in the jqueryfiletree and if there is any possibility to select files using double click.

    Thanks!

    Enhance Code Readability

    You goddamn hipsters with your goddamn shorthand. I get the sexiness of super small JS files, but new users ought to open this and be able to instantly see how it works and how they can enhance it, fix it, and/or tailor it to their application. SIMPLIFY where possible.

    How to add folder on the fly?

    I have a function that adds new folder to the workspace.
    How to add that folder to your file tree?
    $('.tree')
    .fileTree({
    root : root,
    script : 'ViewController',
    }, function(file) {
    })
    i tried to create
    var folderToAppend = "li class="directory collapsed">a href="#" rel="" +userRoot + name + "/">"+ name + "/a/li" (with angle scopes)
    and append it to ul in working file tree.
    It works, but new folder not clickable nor selectable and shows itself like not a part of file tree.
    I can see new folder added after i collapse and expand folder where new folder was created.
    How to make adding new folder work on the fly?

    Get full path from file

    Hello,

    I'd like to know how to get the full path on click event.

    Someone can help me?

    Thanks

    'filetreeinitiated' seems not work

    it seems the 'filetreeinitiated' event will not be triggered, because of the code at 137

     $el.find('UL:hidden').show(typeof callback !== "undefined" && callback !== null);
    

    i modified as

      $el.find('UL:hidden').show({
        complete: finishCallback
      });
    

    Checked / Unchecked events not wired

    The docs mention events for checked / unchecked (filetreechecked / filetreeunchecked) - but these don't seem to actually be wired up.

    You can accomplish similar behavior binding your owns events on the custom connector's input elements.

    At very least please update docs to reflect.

    Open file

    Hello,
    I do not want to say that it is a bug, but do not know where I could ask.
    Is anyhow possible trigger/open a file?
    Better will be ask, is possible automatically add on element li which contains file attribut href=" " ...?
    Thank You

    JSLint Errors

    There are a number of JSLint errors and notifications, like redeclaring the "o" object and using jQuery .bind() instead of .on()

    refresh part/full tree

    How do you guys force refresh of part of the tree programatically ?
    For example let say I'm simulating directory tree, when I delete a file or directory I need to force the JFT to refresh portion of the tree..

    SyntaxError: expected expression, got '<' / $(...).fileTree is not a function

    HI,
    I must first thank the you who developed this wonder plugin.

    I am experiencing two errors and cannot figure out a solution.

    SyntaxError: expected expression, got '<'[details] jQueryFileTree.min.js:7
    jquery-3.3.1.js:3827 Uncaught TypeError: $(...).fileTree is not a function

    My development environment is Win10, http-server; I have tried the webpage on FireFox, Chrome, IE and Sogou, all of which produce the same error messages.

    Any help is appreciated.

    best regards
    Jim

    Access to returned list of files possible?

    How can I get access to the list of files which is returned by the connector script so that I can run a search within that list?

    I know that I could run a second scandir, however this (still) seems unnecessary and is double work and search time, since jQueryFileTree.php has already searched the files.

    Href Integration with ViewerJS

    I'm using jQueryFileTree.js to access my files and trying to use ViewerJS to display them in my iFrame. jQueryFileTree.js want to use:
    <a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $filename) . "\">" . htmlentities($name) . "</a>

    to link to a file and this works fine for it.

    I'm trying to integrate the ViewerJS example into this link <a href="/ViewerJS/#../ and it does not appear to work.

    My ViewerJS folder is at the root of my site and my files reside at the same level in a another folder structure such as \media_viewer_content\topics.

    I've tried a few different link settings having /ViewerJs/ in them and I still get the Open file dialogue.

    I know ViewerJS works because if I launch:
    http://127.0.0.1:9000/ViewerJS/#../media_viewer_content/topics/topic2/myfile.ods
    it opens in ViewerJS.

    I also know jQueryFileTree.js works because if I launch the file from its link, it wants to open the file.

    Can anyone help me find what would be the correct code to make use of both these scripts to open the file in my iFrame?

    I appreciate your help here.

    Displaying SHORTCUTs (WINDOWS .url files)

    In attachment a modified PHP connector.

    This connector will display .url files (WINDOWS shortcuts) and allow users to open the URL by clicking the item in the FileTree.

    An image for the .url ext and an example screenshot are also included.

    Kind regards.
    Marc

    jqueryFileTree.php.txt

    url

    screenshot

    Solved: Manage international characters on 2 bytes in file and dir names

    The code works well with standard European accents, but with char coded on two bytes, such as Chines, Russian, etc. it does not work (scandir returns an error)

    The work around is to use base64_encode and base64_decode instead of the htmlentities coding; that allows to pass the path as a standard string

    And of course no more escape in the js code.

    File name with single quote gets lost in php connector

    Hi,

    I noticed that files with single quotes / apostrophes were not working.
    Inspecting such an element in Google Chrome:

    <a rel="/mp3/Music For Cats/01 - David Teie - Lolo" s="" air.mp3'="">01 - David Teie - Lolo's Air.mp3</a>

    That would pass the non-existing file /mp3/Music For Cats/01 - David Teie - Lolo on.

    As for the php connector, the solution for me was to change jQueryFileTree.php from

    $htmlRel    = htmlentities($returnDir . $file);

    to

    $htmlRel    = htmlentities($returnDir . $file,ENT_QUOTES);

    Inspecting in Google Chrome now:

    <a rel="/mp3/Music For Cats/01 - David Teie - Lolo's Air.mp3">01 - David Teie - Lolo's Air.mp3</a>

    Maybe worth a pull request, but my github knowledge is too limited to create one now.

    Best Regards,
    Jan

    Issues while implementing in ASP .NET MVC

    On clicking of any displayed directory, it just doesn,t do anything. Will be really grateful if you can provide with a sample project to integrate this with MVC.

    Default expanded folder

    Hi,
    Thank you for taking care of that old plugin!
    I found that you implemented many features I need, but I haven't found how to show filetree with a specified folder being expanded by default. It would be a great to be able to pass folder path via some plugin param or use some method, if there is no another workaroun for the moment.

    Add an option to specify allowed file extensions

    What about adding an option to specify allowed file extensions to be listed?

    $('.filetree-folders-only').fileTree(
        {
            script: 'connectors/jqueryFileTree.php',
            fileExtensions: 'js,txt,html',
        }
    );

    jQuery File Tree PHP bug

    When setting onlyFiles we also get all dirs as file.
    The line:
    else if (!$onlyFolders || $onlyFiles)
    should be
    else if (!is_dir($postDir . $file) && (!$onlyFolders || $onlyFiles))

    echo "

  • {$checkbox}" . $htmlName . "
  • ";

    destroy() method

    A destroy() or refresh() method would be helpful, when you want to dynamically reinitialize the plugin on a page.

    Make list icons clickable

    Is it possible to make list icons clickable as well? End-users often think widget is broken because it does not expand after a click on a directory icon…

    By the way we could have a different action between clicking on

    • directory list text label (i.e.: open link in new window)
    • directory list icon (i.e. expand/collapse widget tree)

    JQuery File Tree doesn't work with JQuery ui draggable

    Hello,
    I'm trying to make directories draggable with Jquery UI to make a customized permission folder hierarchy by dropping it to add the permission. But it doesn't work, my Jquery UI installation work (all li elements which aren't in the tree view can move).

    my server part code for the generation:

    image

    my Jquery :

    image

    thanks for attention

    Selections don't persist across collapse/expand

    To reproduce the issue, on the demo page, in the Multiselect example, click on a directory (eg 'pictures') to expand it, select a couple of files inside the directory, then click on the directory again to collapse it.

    If you click the "View Checked Elements" button now, these files will still be considered as selected. However, if you expand the directory again, the files become deselected.

    I made a branch that persists selections by not updating directories once their data has been fetched, and that works for my needs. However, my fix breaks dynamic fetching and has at least one visual display bug that would need to be fixed before any possible merge.

    When onlyFolders is enabled, the callback passed to the second parameter is not called

    It seems the callback function set to the second parameter is not triggered when the onlyFolders option is enabled.

    $('.filetree-folders-only').fileTree(
        {
            script: 'connectors/jqueryFileTree.php',
            onlyFolders: true,
        },
        function( path ) {
            console.log( path );    // never called
        }
    );

    Is this behavior intended? If so, what would be the best way to retrieve user's selecting directory paths?

    Hebrew folders won't show

    Hey,
    I don't know how to fix it but any of the Hebrew folders that I have, won't show the sub folders.
    Can you please help?
    Thank you

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.