Skip to content
Browse files

Import of existing project

  • Loading branch information...
1 parent e490589 commit f53d0d8f3b843c0d73a1d511890b5dbfccb33c15 Jak Spalding committed Aug 1, 2012
View
44 connectors/jqueryFileTree.asp
@@ -0,0 +1,44 @@
+<%
+'
+' jQuery File Tree ASP (VBS) Connector
+' Copyright 2008 Chazzuka
+' programmer@chazzuka.com
+' http://www.chazzuka.com/
+'
+' retrive base directory
+dim BaseFileDir:BaseFileDir=Request.Form("dir")
+' if blank give default value
+if len(BaseFileDir)=0 then BaseFileDir="/userfiles/"
+
+dim ObjFSO,BaseFile,Html
+' resolve the absolute path
+BaseFile = Server.MapPath(BaseFileDir)&"\"
+' create FSO
+Set ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
+' if given folder is exists
+if ObjFSO.FolderExists(BaseFile) then
+ dim ObjFolder,ObjSubFolder,ObjFile,i__Name,i__Ext
+ Html = Html + "<ul class=""jqueryFileTree"" style=""display: none;"">"&VBCRLF
+ Set ObjFolder = ObjFSO.GetFolder(BaseFile)
+ ' LOOP THROUGH SUBFOLDER
+ For Each ObjSubFolder In ObjFolder.SubFolders
+ i__Name=ObjSubFolder.name
+ Html = Html + "<li class=""directory collapsed"">"&_
+ "<a href=""#"" rel="""+(BaseFileDir+i__Name+"/")+""">"&_
+ (i__Name)+"</a></li>"&VBCRLF
+ Next
+ 'LOOP THROUGH FILES
+ For Each ObjFile In ObjFolder.Files
+ ' name
+ i__Name=ObjFile.name
+ ' extension
+ i__Ext = LCase(Mid(i__Name, InStrRev(i__Name, ".", -1, 1) + 1))
+ Html = Html + "<li class=""file ext_"&i__Ext&""">"&_
+ "<a href=""#"" rel="""+(BaseFileDir+i__Name)+""">"&_
+ (i__name)+"</a></li>"&VBCRLF
+ Next
+ Html = Html + "</ul>"&VBCRLF
+end if
+
+Response.Write Html
+%>
View
31 connectors/jqueryFileTree.aspx
@@ -0,0 +1,31 @@
+<%@ Page Language="C#" AutoEventWireup="true" %>
+
+<%
+ //
+ // jQuery File Tree ASP Connector
+ //
+ // Version 1.0
+ //
+ // Copyright (c)2008 Andrew Sweeny
+ // asweeny@fit.edu
+ // 24 March 2008
+ //
+ string dir;
+ if(Request.Form["dir"] == null || Request.Form["dir"].Length <= 0)
+ dir = "/";
+ else
+ dir = Server.UrlDecode(Request.Form["dir"]);
+ System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dir);
+ Response.Write("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n");
+ foreach (System.IO.DirectoryInfo di_child in di.GetDirectories())
+ Response.Write("\t<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n");
+ foreach (System.IO.FileInfo fi in di.GetFiles())
+ {
+ string ext = "";
+ if(fi.Extension.Length > 1)
+ ext = fi.Extension.Substring(1).ToLower();
+
+ Response.Write("\t<li class=\"file ext_" + ext + "\"><a href=\"#\" rel=\"" + dir + fi.Name + "\">" + fi.Name + "</a></li>\n");
+ }
+ Response.Write("</ul>");
+ %>
View
19 connectors/jqueryFileTree.cf
@@ -0,0 +1,19 @@
+<!---
+
+jQuery File Tree
+ColdFusion connector script
+By Tjarko Rikkerink (http://carlosgallupa.com/)
+
+--->
+<cfparam name="form.dir" default="/somedir" />
+<cfdirectory action="LIST" directory="#expandpath('#URLDecode(form.dir)#')#" name="qDir" sort="type, name" type="all" listinfo="all" recurse="no">
+
+<ul class="jqueryFileTree" style="display: none;">
+ <cfoutput query="qDir">
+ <cfif type eq "dir">
+ <li class="directory collapsed"><a href="##" rel="#URLDecode(form.dir)##name#/">#name#</a></li>
+ <cfelseif type eq "file">
+ <li class="file ext_#listLast(name,'.')#"><a href="##" rel="#URLDecode(form.dir)##name#">#name# (#round(size/1024)#KB)</a></li>
+ </cfif>
+ </cfoutput>
+</ul>
View
49 connectors/jqueryFileTree.jsp
@@ -0,0 +1,49 @@
+<%@ page
+ import="java.io.File,java.io.FilenameFilter,java.util.Arrays"%>
+<%
+/**
+ * jQuery File Tree JSP Connector
+ * Version 1.0
+ * Copyright 2008 Joshua Gould
+ * 21 April 2008
+*/
+ String dir = request.getParameter("dir");
+ if (dir == null) {
+ return;
+ }
+
+ if (dir.charAt(dir.length()-1) == '\\') {
+ dir = dir.substring(0, dir.length()-1) + "/";
+ } else if (dir.charAt(dir.length()-1) != '/') {
+ dir += "/";
+ }
+
+ dir = java.net.URLDecoder.decode(dir, "UTF-8");
+
+ if (new File(dir).exists()) {
+ String[] files = new File(dir).list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.charAt(0) != '.';
+ }
+ });
+ Arrays.sort(files, String.CASE_INSENSITIVE_ORDER);
+ out.print("<ul class=\"jqueryFileTree\" style=\"display: none;\">");
+ // All dirs
+ for (String file : files) {
+ if (new File(dir, file).isDirectory()) {
+ out.print("<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + dir + file + "/\">"
+ + file + "</a></li>");
+ }
+ }
+ // All files
+ for (String file : files) {
+ if (!new File(dir, file).isDirectory()) {
+ int dotIndex = file.lastIndexOf('.');
+ String ext = dotIndex > 0 ? file.substring(dotIndex + 1) : "";
+ out.print("<li class=\"file ext_" + ext + "\"><a href=\"#\" rel=\"" + dir + file + "\">"
+ + file + "</a></li>");
+ }
+ }
+ out.print("</ul>");
+ }
+%>
View
43 connectors/jqueryFileTree.php
@@ -0,0 +1,43 @@
+<?php
+//
+// jQuery File Tree PHP Connector
+//
+// Version 1.01
+//
+// Cory S.N. LaViska
+// A Beautiful Site (http://abeautifulsite.net/)
+// 24 March 2008
+//
+// History:
+//
+// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
+// 1.00 - released (24 March 2008)
+//
+// Output a list of files for jQuery File Tree
+//
+
+$_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>";
+ }
+}
+
+?>
View
102 connectors/jqueryFileTree.pl
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+use strict;
+use HTML::Entities ();
+
+#-----------------------------------------------------------
+# jQuery File Tree Perl Connector
+#
+# Version 1.0
+#
+# Oleg Burlaca
+# http://www.burlaca.com/2009/02/jquery-file-tree-connector/
+# 12 February 2009
+#-----------------------------------------------------------
+
+# for security reasons, specify a root folder
+# to prevent the whole filesystem to be shown
+# for ex: the root folder of your webbrowser
+
+my $root = "/var/www/html/";
+
+#----------------------------------------------------------
+
+my $params = &getCGIParams();
+print "Content-type: text/html\n\n";
+
+my $dir = $params->{dir};
+my $fullDir = $root . $dir;
+
+exit if ! -e $fullDir;
+
+opendir(BIN, $fullDir) or die "Can't open $dir: $!";
+my (@folders, @files);
+my $total = 0;
+while( defined (my $file = readdir BIN) ) {
+ next if $file eq '.' or $file eq '..';
+ $total++;
+ if (-d "$fullDir/$file") {
+ push (@folders, $file);
+ } else {
+ push (@files, $file);
+ }
+}
+closedir(BIN);
+
+return if $total == 0;
+print "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
+
+# print Folders
+foreach my $file (sort @folders) {
+ next if ! -e $fullDir . $file;
+
+ print '<li class="directory collapsed"><a href="#" rel="' .
+ &HTML::Entities::encode($dir . $file) . '/">' .
+ &HTML::Entities::encode($file) . '</a></li>';
+}
+
+# print Files
+foreach my $file (sort @files) {
+ next if ! -e $fullDir . $file;
+
+ $file =~ /\.(.+)$/;
+ my $ext = $1;
+ print '<li class="file ext_' . $ext . '"><a href="#" rel="' .
+ &HTML::Entities::encode($dir . $file) . '/">' .
+ &HTML::Entities::encode($file) . '</a></li>';
+}
+
+print "</ul>\n";
+
+
+
+
+#--------------------------------------------------------------------------------------------------
+sub getCGIParams {
+ my $line;
+
+ if ($ENV{'REQUEST_METHOD'} eq "POST") {
+ read(STDIN, $line, $ENV{'CONTENT_LENGTH'});
+ } else {
+ $line = $ENV{'QUERY_STRING'};
+ }
+
+ my (@pairs) = split(/&/, $line);
+ my ($name, $value, %F);
+
+ foreach (@pairs) {
+ ($name, $value) = split(/=/);
+ $value =~ tr/+/ /;
+ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+
+ if (! exists $F{$name}) {
+ $F{$name} = $value;
+ } elsif (exists $F{$name} and ref($F{$name}) ne 'ARRAY') {
+ my $prev_value = $F{$name};
+ delete $F{$name};
+ $F{$name} = [ $prev_value, $value ];
+ } else { push @{ $F{$name} }, $value }
+ }
+ return \%F;
+}
+#--------------------------------------------------------------------------------------------------
+
View
25 connectors/jqueryFileTree.py
@@ -0,0 +1,25 @@
+#
+# jQuery File Tree
+# Python/Django connector script
+# By Martin Skou
+#
+import os
+import urllib
+
+def dirlist(request):
+ r=['<ul class="jqueryFileTree" style="display: none;">']
+ try:
+ r=['<ul class="jqueryFileTree" style="display: none;">']
+ d=urllib.unquote(request.POST.get('dir','c:\\temp'))
+ for f in os.listdir(d):
+ ff=os.path.join(d,f)
+ if os.path.isdir(ff):
+ r.append('<li class="directory collapsed"><a href="#" rel="%s/">%s</a></li>' % (ff,f))
+ else:
+ e=os.path.splitext(f)[1][1:] # get .ext and remove dot
+ r.append('<li class="file ext_%s"><a href="#" rel="%s">%s</a></li>' % (e,ff,f))
+ r.append('</ul>')
+ except Exception,e:
+ r.append('Could not load directory: %s' % str(e))
+ r.append('</ul>')
+ return HttpResponse(''.join(r))
View
61 connectors/jqueryFileTree.rb
@@ -0,0 +1,61 @@
+#
+# jQuery File Tree Ruby Connector
+#
+# Version 1.01
+#
+# Erik Lax
+# http://datahack.se
+# 13 July 2008
+#
+# History
+#
+# 1.01 Initial Release
+#
+# Output a list of files for jQuery File Tree
+#
+
+#<settings>
+#root = "/absolute/path/"
+# or
+root = File.expand_path(".")
+#</settings>
+
+#<code>
+require "cgi"
+cgi = CGI.new
+cgi.header("type" => "text/html")
+dir = cgi.params["dir"].to_s
+
+puts "<ul class=\"jqueryFileTree\" style=\"display: none;\">"
+begin
+ path = root + "/" + dir
+
+ # chdir() to user requested dir (root + "/" + dir)
+ Dir.chdir(File.expand_path(path).untaint);
+
+ # check that our base path still begins with root path
+ if Dir.pwd[0,root.length] == root then
+
+ #loop through all directories
+ Dir.glob("*") {
+ |x|
+ if not File.directory?(x.untaint) then next end
+ puts "<li class=\"directory collapsed\"><a href=\"#\" rel=\"#{dir}#{x}/\">#{x}</a></li>";
+ }
+
+ #loop through all files
+ Dir.glob("*") {
+ |x|
+ if not File.file?(x.untaint) then next end
+ ext = File.extname(x)[1..-1]
+ puts "<li class=\"file ext_#{ext}\"><a href=\"#\" rel=\"#{dir}#{x}\">#{x}</a></li>"
+ }
+ else
+ #only happens when someone tries to go outside your root directory...
+ puts "You are way out of your league"
+ end
+rescue
+ puts "Internal Error"
+end
+puts "</ul>"
+#</code>
View
36 connectors/jqueryFileTree_huck.lasso
@@ -0,0 +1,36 @@
+[
+ //
+ // jQuery File Tree Lasso Connector
+ //
+ // Version 1.00
+ //
+ // Jason Huck
+ // http://devblog.jasonhuck.com/
+ // 1 May 2008
+ //
+ // History:
+ //
+ // 1.00 - released (1 May 2008)
+ //
+ // Output a list of files for jQuery File Tree
+ //
+
+ !action_param('dir') ? abort;
+ var('dir') = action_param('dir');
+ var('files') = file_listdirectory($dir);
+
+ '<ul class="jqueryFileTree" style="display: none;">';
+
+ iterate($files, local('file'));
+ #file->beginswith('.') ? loop_continue;
+
+ if(#file->endswith('/'));
+ '<li class="directory collapsed"><a href="#" rel="' + $dir + #file + '">' + #file + '</a></li>';
+ else;
+ local('ext') = #file->split('.')->last;
+ '<li class="file ext_' + #ext + '"><a href="#" rel="' + $dir + #file + '">' + #file + '</a></li>';
+ /if;
+ /iterate;
+
+ '</ul>';
+]
View
48 connectors/jqueryFileTree_sabourdin.lasso
@@ -0,0 +1,48 @@
+<?LassoScript
+//
+// jQuery File Tree LASSO Connector
+//
+// Version 1.00
+//
+// Marc Sabourdin
+// CysNET (http://www.marcsabourdin.com/)
+// 23 May 2008
+//
+// History:
+//
+// 1.00 - released (23 May 2008)
+//
+// Output a list of files for jQuery File Tree
+//
+Encode_set:-EncodeNone;
+
+Variable:'root' = 'path_to_desired_and_Lasso_allowed_root';
+Variable:'_POST.dir' = (action_param:'dir');
+Variable:'files';
+
+
+if:( file_exists: ($root + $_POST.dir) )&&( File_IsDirectory:($root + $_POST.dir) );
+ $files = (File_ListDirectory:($root + $_POST.dir));
+ $files->(Sort);
+ if:( $files->(Size) > 0 );
+ output:'<ul class="jqueryFileTree" style="display: none;">';
+ // All dirs
+ Iterate:($files),(Local:'file');
+ if:( file_exists:($root + $_POST.dir + #file) )&&( #file != '.' )&&( #file != '..' )&&( File_IsDirectory:($root + $_POST.dir + #file) );
+ output:'<li class="directory collapsed"><a href="#" rel="' + (String_replace:($_POST.dir + #file),-Find=' ',-Replace='__') + '">' + (Encode_HTML:(#file)) + '</a></li>';
+ /if;
+ /Iterate;
+ // All files
+ Local:'ext';
+ Iterate:($files),(Local:'file');
+ if:( file_exists:($root + $_POST.dir + #file) )&&( #file != '.' )&&( #file != '..' )&&( (File_IsDirectory:($root + $_POST.dir + #file))==false );
+ #ext = (#file)->(Split:'.')->Last;
+ output:'<li class="file ext_' + (#ext) + '"><a href="' + ($_POST.dir + #file) + '">' + (Encode_HTML:(#file)) + '</a></li>';
+ /if;
+ /Iterate;
+ output:'</ul>';
+ /if;
+/if;
+
+/Encode_set;
+?>
View
BIN images/application.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/code.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/css.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/db.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/directory.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/doc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/file.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/film.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/flash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/folder_open.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/html.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/java.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/music.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/pdf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/php.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/picture.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/ppt.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/psd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/ruby.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/script.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/txt.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/xls.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/zip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
91 jqueryFileTree.css
@@ -0,0 +1,91 @@
+UL.jqueryFileTree {
+ font-family: Verdana, sans-serif;
+ font-size: 11px;
+ line-height: 18px;
+ padding: 0px;
+ margin: 0px;
+}
+
+UL.jqueryFileTree LI {
+ list-style: none;
+ padding: 0px;
+ padding-left: 20px;
+ margin: 0px;
+ white-space: nowrap;
+}
+
+UL.jqueryFileTree A {
+ color: #333;
+ text-decoration: none;
+ display: block;
+ padding: 0px 2px;
+}
+
+UL.jqueryFileTree A:hover {
+ background: #BDF;
+}
+
+/* Core Styles */
+.jqueryFileTree LI.directory { background: url(images/directory.png) left top no-repeat; }
+.jqueryFileTree LI.expanded { background: url(images/folder_open.png) left top no-repeat; }
+.jqueryFileTree LI.file { background: url(images/file.png) left top no-repeat; }
+.jqueryFileTree LI.wait { background: url(images/spinner.gif) left top no-repeat; }
+/* File Extensions*/
+.jqueryFileTree LI.ext_3gp { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_afp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_afpa { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_asp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_aspx { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_avi { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_bat { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_bmp { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_c { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cfm { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cgi { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_com { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cpp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_css { background: url(images/css.png) left top no-repeat; }
+.jqueryFileTree LI.ext_doc { background: url(images/doc.png) left top no-repeat; }
+.jqueryFileTree LI.ext_exe { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_gif { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_fla { background: url(images/flash.png) left top no-repeat; }
+.jqueryFileTree LI.ext_h { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_htm { background: url(images/html.png) left top no-repeat; }
+.jqueryFileTree LI.ext_html { background: url(images/html.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jar { background: url(images/java.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jpg { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_js { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_lasso { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_log { background: url(images/txt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_m4p { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mov { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mp3 { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mp4 { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mpg { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mpeg { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ogg { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pcx { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
+.jqueryFileTree LI.ext_php { background: url(images/php.png) left top no-repeat; }
+.jqueryFileTree LI.ext_png { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ppt { background: url(images/ppt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_psd { background: url(images/psd.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pl { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_py { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rb { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rbx { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rhtml { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rpm { background: url(images/linux.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ruby { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_sql { background: url(images/db.png) left top no-repeat; }
+.jqueryFileTree LI.ext_swf { background: url(images/flash.png) left top no-repeat; }
+.jqueryFileTree LI.ext_tif { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_tiff { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_txt { background: url(images/txt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_vb { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_wav { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_wmv { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_xls { background: url(images/xls.png) left top no-repeat; }
+.jqueryFileTree LI.ext_xml { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_zip { background: url(images/zip.png) left top no-repeat; }
View
95 jqueryFileTree.js
@@ -0,0 +1,95 @@
+// jQuery File Tree Plugin
+//
+// Version 1.01
+//
+// Cory S.N. LaViska
+// A Beautiful Site (http://abeautifulsite.net/)
+// 24 March 2008
+//
+// Visit http://abeautifulsite.net/notebook.php?article=58 for more information
+//
+// Usage: $('.fileTreeDemo').fileTree( options, callback )
+//
+// Options: root - root folder to display; default = /
+// script - location of the serverside AJAX file to use; default = jqueryFileTree.php
+// folderEvent - event to trigger expand/collapse; default = click
+// expandSpeed - default = 500 (ms); use -1 for no animation
+// collapseSpeed - default = 500 (ms); use -1 for no animation
+// expandEasing - easing function to use on expand (optional)
+// collapseEasing - easing function to use on collapse (optional)
+// multiFolder - whether or not to limit the browser to one subfolder at a time
+// loadMessage - Message to display while initial tree loads (can be HTML)
+//
+// History:
+//
+// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
+// 1.00 - released (24 March 2008)
+//
+// 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.
+//
+if(jQuery) (function($){
+
+ $.extend($.fn, {
+ fileTree: function(o, h) {
+ // Defaults
+ if( !o ) var o = {};
+ if( o.root == undefined ) o.root = '/';
+ if( o.script == undefined ) o.script = 'jqueryFileTree.php';
+ if( o.folderEvent == undefined ) o.folderEvent = 'click';
+ if( o.expandSpeed == undefined ) o.expandSpeed= 500;
+ if( o.collapseSpeed == undefined ) o.collapseSpeed= 500;
+ if( o.expandEasing == undefined ) o.expandEasing = null;
+ if( o.collapseEasing == undefined ) o.collapseEasing = null;
+ if( o.multiFolder == undefined ) o.multiFolder = true;
+ if( o.loadMessage == undefined ) o.loadMessage = 'Loading...';
+
+ $(this).each( function() {
+
+ function showTree(c, t) {
+ $(c).addClass('wait');
+ $(".jqueryFileTree.start").remove();
+ $.post(o.script, { dir: t }, function(data) {
+ $(c).find('.start').html('');
+ $(c).removeClass('wait').append(data);
+ if( o.root == t ) $(c).find('UL:hidden').show(); else $(c).find('UL:hidden').slideDown({ duration: o.expandSpeed, easing: o.expandEasing });
+ bindTree(c);
+ });
+ }
+
+ function bindTree(t) {
+ $(t).find('LI A').bind(o.folderEvent, function() {
+ if( $(this).parent().hasClass('directory') ) {
+ if( $(this).parent().hasClass('collapsed') ) {
+ // Expand
+ if( !o.multiFolder ) {
+ $(this).parent().parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
+ $(this).parent().parent().find('LI.directory').removeClass('expanded').addClass('collapsed');
+ }
+ $(this).parent().find('UL').remove(); // cleanup
+ showTree( $(this).parent(), escape($(this).attr('rel').match( /.*\// )) );
+ $(this).parent().removeClass('collapsed').addClass('expanded');
+ } else {
+ // Collapse
+ $(this).parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
+ $(this).parent().removeClass('expanded').addClass('collapsed');
+ }
+ } else {
+ h($(this).attr('rel'));
+ }
+ return false;
+ });
+ // Prevent A from triggering the # on non-click events
+ if( o.folderEvent.toLowerCase != 'click' ) $(t).find('LI A').bind('click', function() { return false; });
+ }
+ // Loading message
+ $(this).html('<ul class="jqueryFileTree start"><li class="wait">' + o.loadMessage + '<li></ul>');
+ // Get the initial file list
+ showTree( $(this), escape(o.root) );
+ });
+ }
+ });
+
+})(jQuery);

0 comments on commit f53d0d8

Please sign in to comment.
Something went wrong with that request. Please try again.