Source of
filetree.html:
<!-- vim: ts=2:sw=2:nu:fdc=2:spell
FileTree Application Example Page
@author Ing.Jozef Sakáloš
@copyright (c) 2008, by Ing. Jozef Sakáloš
@date 30. March 2008
@version $Id: filetree.html 113 2009-02-02 02:27:23Z jozo $
@license filetree.html is licensed under the terms of the Open Source
LGPL 3.0 license. Commercial use is permitted to the extent that the
code/component(s) do NOT become part of another Open Source or Commercially
licensed development library or toolkit without explicit permission.
License details: http://www.gnu.org/licenses/lgpl.html
-->
<html>
<head>
<meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./ext/resources/css/ext-all.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/icons.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/webpage.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/filetree.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/filetype.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/famflag.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/Ext.ux.IconCombo.css"
>
<link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"./css/empty.css"
id
=
"theme"
>
<link
rel
=
"shortcut icon"
href
=
"../img/extjs.ico"
>
<script
type
=
"text/javascript"
src
=
"./ext/adapter/ext/ext-base.js"
></script>
<script
type
=
"text/javascript"
src
=
"./ext/ext-all-debug.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/WebPage.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.form.BrowseButton.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.FileUploader.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.UploadPanel.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.FileTreeMenu.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.FileTreePanel.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.form.ThemeCombo.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.form.IconCombo.js"
></script>
<script
type
=
"text/javascript"
src
=
"./js/Ext.ux.form.LangSelectCombo.js"
></script>
<script
type
=
"text/javascript"
src
=
"./filetree.js"
></script>
<script
type
=
"text/javascript"
src
=
"./locale/<?=@$_REQUEST['locale']?$_REQUEST['locale']:(@$_COOKIE['locale']?$_COOKIE['locale']:'en_US');?>.js"
></script>
<title
id
=
"page-title"
>
Ext.ux.FileTreePanel Extension by Saki
</title>
</head>
<body>
<div
id
=
"west-content"
class
=
"x-hidden"
>
<div
id
=
"treepanel"
></div>
<br>
<p>
<a
href
=
"http://extjs.com/forum/showthread.php?t=29090"
target
=
"_blank"
>
FileTreePanel Forum Thread
</a><br><br>
<a
href
=
"http://aariadne.com/filetree"
target
=
"_blank"
>
Previous implementation (Ext
1
.x)
</a><br><br>
<b>
View Sources:
</b><br>
<a
href
=
"source.php?file=js/Ext.ux.FileTreePanel.js"
target
=
"_blank"
>
Ext.ux.FileTreePanel.js
</a><br>
<a
href
=
"source.php?file=js/Ext.ux.FileTreeMenu.js"
target
=
"_blank"
>
Ext.ux.FileTreeMenu.js
</a><br>
<a
href
=
"source.php?file=js/Ext.ux.UploadPanel.js"
target
=
"_blank"
>
Ext.ux.UploadPanel.js
</a><br>
<a
href
=
"source.php?file=js/Ext.ux.form.BrowseButton.js"
target
=
"_blank"
>
Ext.ux.form.BrowseButton.js
</a><br>
<a
href
=
"source.php?file=js/Ext.ux.FileUploader.js"
target
=
"_blank"
>
Ext.ux.FileUploader.js
</a><br>
<a
href
=
"source.php?file=filetree.html"
target
=
"_blank"
>
filetree.html
</a><br>
<a
href
=
"source.php?file=filetree.js"
target
=
"_blank"
>
filetree.js
</a><br>
<a
href
=
"source.php?file=css/filetree.css"
target
=
"_blank"
>
filetree.css
</a><br>
<br><a
href
=
"http://famfamfam.com/lab/icons/silk"
target
=
"_blank"
>
Silk Icons
</a><br>
</p>
<p>
</p>
<div
id
=
"paypal"
>
<!-- PayPal Donate Button -->
<form
action
=
"https://www.paypal.com/cgi-bin/webscr"
method
=
"post"
>
<input
type
=
"hidden"
name
=
"cmd"
value
=
"_s-xclick"
>
<input
type
=
"image"
src
=
"https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif"
border
=
"0"
name
=
"submit"
alt
=
"PayPal - The safer, easier way to pay online!"
>
<img
alt
=
""
border
=
"0"
src
=
"https://www.paypal.com/en_US/i/scr/pixel.gif"
width
=
"1"
height
=
"1"
>
<input
type
=
"hidden"
name
=
"encrypted"
value
=
"-----BEGIN PKCS7-----MIIHTwYJKoZIhvcNAQcEoIIHQDCCBzwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAFGo92onHXz2epdMI5x9tJ1dIuZiy3k1noe5dB0E/cr2hL6nj84AiHVlsVA1g1/AxPkwkJAah3IqDZTHk83eATXdY1yOBZY52AU9Krn1NldKmnveps0aPTctrxdYAN9lgXbI4fR/sbh4jGt+VwCjx+NroHwbrGinr8/G1KRweEOzELMAkGBSsOAwIaBQAwgcwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIHIAma51SNGCAgajlLE4x44z3qj1dNO2sN+yQJfIMFJrUkZu0G7SKBVdOJCM1CJXd7jWTTjQlvmh3P3ta6wuhb746LWjjz662FTNaUAV9wMGPoFZkkP1RpBmsW0DTrm2Ce+iP5zGL5+KWTemrQU8DoK6dQbk1hjEz75cBDxFqefHb96yNnUjgJKxWHBF8Y52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QUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wODAzMTYxNTQxMTlaMCMGCSqGSIb3DQEJBDEWBBRzmSZqFGSxb3BdglhGpyXb4DDuHTANBgkqhkiG9w0BAQEFAASBgHaiVnpSHKeox2Hy/gdNQU6PpO6IKJuwbaIt5dwKhyqDP5N//imbxNgMFGve2CF2vr1wdFsV7F/qm4FT36+ylr/wKZbBxMVuaZrT1wkRBMDzOQTE5EY9DoY/c4qwXg9az9MxvJ2VrQloIbktPeQu5ixPcmZUjxShI/fFKzWaI9Sf-----END PKCS7-----
"
>
</form>
<!-- PayPal Donate Button End-->
</div>
<p><b>
Downloads:
</b></p>
<a
href
=
"http://extjs.eu/phpmv2/phpmyvisites.php?url=http%3A//filetree.extjs.eu/filetree.tar.bz2&id=1&pagename=FILE: download/filetree/filetree.tar.bz2"
>
filetree.tar.bz2
</a><br>
<a
href
=
"http://extjs.eu/phpmv2/phpmyvisites.php?url=http%3A//filetree.extjs.eu/filetree.tar.gz&id=1&pagename=FILE: download/filetree/filetree.tar.gz"
>
filetree.tar.gz
</a><br>
<a
href
=
"http://extjs.eu/phpmv2/phpmyvisites.php?url=http%3A//filetree.extjs.eu/filetree.zip&id=1&pagename=FILE: download/filetree/filetree.zip"
>
filetree.zip
</a></br>
<br>
<p>
Info:
<a
href
=
"http://extjs.com/forum/showthread.php?p=147056"
target
=
"_blank"
>
I want Saki's FileTree backend
</a>
</p>
<p>
<b><a
href
=
"http://extjs.eu"
target
=
"_blank"
>
Other Extensions and Plugins
</a></b>
</p>
<!-- digg -->
<div
id
=
"digg"
>
<script>
digg_url = 'http://filetree.extjs.eu';
</script>
<script
src
=
"http://digg.com/api/diggthis.js"
></script>
</div>
<!-- digg -->
<a
href
=
"http://www.stumbleupon.com/submit?url=<?=urlencode('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);?>"
><img
border=
0
src
=
"../img/stumble7.gif"
alt
=
"StumbleUpon Toolbar"
></a>
</div>
<div
id
=
"center-content"
class
=
"x-hidden"
>
<h1>
FileTreePanel Client-Server Interface Specification
</h1>
<p>
FileTreePanel is client-server application where client (browser) provides
the user interface (UI) which displays the tree and context menu, handles
drag
&
drop operations, etc. The filesystem that is displayed and managed by
the UI is stored on a server.
</p>
<p>
Therefore, we need some communication layer between client and server. Client sends
a command to server, server processes this command and responds with a result. Client
in turn processes the response and display results.
</p>
<p>
All this communication is running in the background by
<a
href
=
"http://developer.mozilla.org/en/docs/XMLHttpRequest"
>
Ajax (XMLHttpRequest)
</a>
calls. The XMLHttpRequest is not used directly but the
<a
href
=
"http://extjs.com"
>
Ext JS - JavaScript Library
</a>
ajax layer is used for this purpose.
<p>
<p>
Client requests data from server with standard POST method and server is expected to respond
with
<a
href
=
"http://json.org"
>
JSON
</a>
(JavaScript Object Notation) string and appropriate
HTTP headers.
</p>
<h3>
Example of rename command:
</h3>
<h4>
POST Request:
</h4>
<pre>
cmd rename
newname root/abc.txt
oldname root/a.txt
</pre>
<h4>
Response headers:
</h4>
<pre>
Content-Type: application/json, charset=utf-
8
</pre>
<h4>
Response content of success:
</h4>
<pre>
{
"success"
:true}
</pre>
<h4>
Response content of failure:
</h4>
<pre>
{
"success"
:false,
"error"
:
"Cannot rename file root/a.txt to root/abc.txt"
}
</pre>
<p>
The response headers are same as above for all responses, unless mentioned otherwise,
and they are therefore omitted from the following specification.
</p>
<div
class
=
"adsense x-hidden"
>
<script
type
=
"text/javascript"
>
<!--
google_ad_client = "pub-2768521146228687";
/* 468x60, in-text */
google_ad_slot = "4459222165";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script
type
=
"text/javascript"
src
=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
>
</script>
</div>
<h2>
Paths
</h2>
<p>
The server side filesystem that is managed by FileTreePanel starts at a directory
that is defined by the server for security purposes. Client cannot change its root
by any command.
</p>
<h3>
Example of filesystem:
</h3>
<h4>
Server viewpoint:
</h4>
<pre>
/data/userfiles/root_for_client/dir1/file1
/data/userfiles/root_for_client/dir1/file2
/data/userfiles/root_for_client/dir2/file1
/data/userfiles/root_for_client/dir2/file2
</pre>
<h4>
Client viewpoint:
</h4>
<pre>
root_for_client/dir1/file1
root_for_client/dir1/file2
root_for_client/dir2/file1
root_for_client/dir2/file2
</pre>
<p>
Now, when client asks server
"gimme nodes in <code>root_for_client</code>"
the
server prepends absolute or relative root path, reads relevant part of the filesystem
and returns nodes. In our example, the server would prepend
<code>
/data/userfiles/
</code>
to each client's request.
</p>
<p>
It is server job to handle invalid requests or requests that can be potentially insecure
like ones starting with
<b>
/
</b>
or
<b>
..
</b>
The same must be true for all commands sent
from the client.
</p>
<p>
</p>
<h1>
Commands
</h1>
<h2><i>
get
</i>
command
</h2>
<h4>
Request:
</h4>
<pre>
cmd get
path root/a
</pre>
<h4>
Response:
</h4>
<pre>
[
{
"text"
:
"b"
,
"iconcls"
:
"folder"
,
"disabled"
:false,
"leaf"
:false},
{
"text"
:
"a.txt"
,
"iconCls"
:
"file-txt"
,
"disabled"
:false,
"leaf"
:true,
"qtip"
:
"Size: 1047552"
}
]
</pre>
<p><b><i>
Note:
</i></b>
The response above is shown in four lines only for the purposes
of this specification to be more readable by humans. The line breaks must not be sent
from the server as a part of JSON string.
</p>
<p>
In the above example, we request server to deliver nodes of path
<code>
root/a
</code>
and it responds with one directory named
<code>
b
</code>
and one file named
<code>
a.txt
</code>
.
<code>
"text"
:
"b"
</code>
in the response is the name of the directory and
<code>
"text"
:
"a.txt"
</code>
is the name of the file. Note that server sends just names, not
full paths of nodes.
</p>
<p>
<code>
"iconCls"
:
"file-txt"
</code>
in the response is to display correct file type icon by client and
<code>
"qtip"
:
"Size: 1047552"
</code>
is optional text for file tooltip.
<code>
leaf
</code>
property
distinguishes files from folders and
<code>
disabled
</code>
is true for read-only files or folders.
</p>
<p>
For the other possible properties that the tree can process if they are sent from the server consult
<a
href
=
"http://extjs.com/deploy/dev/docs/"
>
Ext JS Documentation
</a>
.
</p>
<div
class
=
"adsense x-hidden"
>
<script
type
=
"text/javascript"
>
<!--
google_ad_client = "pub-2768521146228687";
/* 468x60, in-text */
google_ad_slot = "4459222165";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script
type
=
"text/javascript"
src
=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
>
</script>
</div>
<h2><i>
rename
</i>
command
</h2>
<h4>
Request:
</h4>
<pre>
cmd rename
newname root/abc.txt
oldname root/a.txt
</pre>
<h4>
Response of success:
</h4>
<pre>
{
"success"
:true}
</pre>
<h4>
Response of failure:
</h4>
<pre>
{
"success"
:false,
"error"
:
"Cannot rename file root/a.txt to root/abc.txt"
}
</pre>
<p>
Error message text in the above example is not obligatory - server can send any kind of an
error message, e.g. localized text.
</p>
<p>
</p>
<h2><i>
newdir
</i>
command
</h2>
<h4>
Request:
</h4>
<pre>
cmd newdir
dir root/a/b
</pre>
<h4>
Response of success:
</h4>
<pre>
{
"success"
:true}
</pre>
<h4>
Response of failure:
</h4>
<pre>
{
"success"
:false,
"error"
:
"Cannot create directory: root/a/b"
}
</pre>
<p>
</p>
<h2><i>
delete
</i>
command
</h2>
<h4>
Request:
</h4>
<pre>
cmd delete
file root/a/b
</pre>
<h4>
Response of success:
</h4>
<pre>
{
"success"
:true}
</pre>
<h4>
Response of failure:
</h4>
<pre>
{
"success"
:false,
"error"
:
"Cannot delete: root/a/b"
}
</pre>
<p>
</p>
<h2><i>
upload
</i>
command
</h2>
<h4>
Request:
</h4>
<pre>
cmd upload
path root/a
</pre>
<h4>
Response headers:
</h4>
<pre>
Content-Type: text/html, charset=utf-
8
</pre>
<h4>
Response of success:
</h4>
<pre>
{
"success"
:true}
</pre>
<h4>
Response of failure:
</h4>
<pre>
{
"success"
:false,
"errors"
:{
"ext-gen524"
:
"File upload error."
}}
</pre>
<p>
File uploads are handled differently. First of all, server has to respond with
<code>
text/html
</code>
content type and, in the case of failure, it has to respond with
<code>
errors
</code>
object
with an error message for each uploaded file. Properties of
<code>
errors
</code>
object are
<
input
type
=
"file"
>
field names. These names are auto-generated and they
are available at server while processing the file uploads.
</p>
<p>
Server has to ignore
<code>
NO_FILE
</code>
error and it has to report
<code>
"success"
:true
</code>
only if
all files have been uploaded successfully.
</p>
</div>
<div
id
=
"adrow-content"
class
=
"adsense x-hidden"
>
<div
id
=
"adsense-top"
>
<script
type
=
"text/javascript"
>
<!--
google_ad_client = "pub-2768521146228687";
/* recordform top row wide */
google_ad_slot = "3909046423";
google_ad_width = 728;
google_ad_height = 15;
//-->
</script>
<script
type
=
"text/javascript"
src
=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
>
</script>
</div>
</div>
<?if(
"filetree.extjs.eu"
===$_SERVER[
"SERVER_NAME"
])include(
"stats.php"
);?
>
</body>
</html>
<!-- eof -->
Free web analytics, website statistics