Fixes on PHP interpretation and tree display.

This commit is contained in:
Lars Jung 2011-08-12 15:58:03 +02:00
parent b9835ebaad
commit 7d6ced78da
16 changed files with 196 additions and 169 deletions

View file

@ -9,6 +9,16 @@ It uses the [Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-1733
## Changelog ## Changelog
### v0.13.1 · *2011-08-12*
* hopefully fixed that PHP doesn't get interpreted
* fixed initial tree display
* added sort order option
* added/fixed some translations
* added lv translation by Sandis Veinbergs
### v0.13 · *2011-08-06* ### v0.13 · *2011-08-06*
* added PHP implementation! (should work with PHP 5.2+) * added PHP implementation! (should work with PHP 5.2+)

View file

@ -3,7 +3,7 @@ custom = true
# project # project
project.name = h5ai project.name = h5ai
project.version = 0.13 project.version = 0.13.1
# src # src

BIN
release/h5ai-0.13.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,8 @@
AddType text/html .php AddType text/html .php
AddHandler application/x-httpd-php .php
# cache images, css and js for 52 weeks # cache images, css and js for 52 weeks
<IfModule headers_module> <IfModule headers_module>

View file

@ -1,5 +1,5 @@
var Extended = function ( pathCache ) { var Extended = function ( pathCache, h5ai ) {
/******************************* /*******************************
@ -7,7 +7,6 @@ var Extended = function ( pathCache ) {
*******************************/ *******************************/
this.config = { this.config = {
defaultSortOrder: "C=N;O=A",
customHeader: "h5ai.header.html", customHeader: "h5ai.header.html",
customFooter: "h5ai.footer.html" customFooter: "h5ai.footer.html"
}; };
@ -78,31 +77,30 @@ var Extended = function ( pathCache ) {
$( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-size'>" + $size.text() + "</span></a>" ).appendTo( $li ); $( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-size'>" + $size.text() + "</span></a>" ).appendTo( $li );
// header sort icons // header sort icons
var order = document.location.search; var sortquery = document.location.search;
if ( order === "" ) { var order = {
order = this.config.defaultSortOrder; column: ( sortquery.indexOf( "C=N" ) >= 0 ) ? "name" : ( sortquery.indexOf( "C=M" ) >= 0 ) ? "date" : ( sortquery.indexOf( "C=S" ) >= 0 ) ? "size" : h5ai.config.sortorder.column,
ascending: ( sortquery.indexOf( "O=A" ) >= 0 ) ? true : ( sortquery.indexOf( "O=D" ) >= 0 ) ? false : h5ai.config.sortorder.ascending
}; };
var $icon; var $icon;
if ( order.indexOf( "O=A" ) >= 0 ) { if ( order.ascending ) {
$icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" ); $icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" );
} else { } else {
$icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" ); $icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" );
}; };
if ( order.indexOf( "C=N" ) >= 0 ) { if ( order.column === "date" ) {
$li.find( "a.label" ).append( $icon );
} else if ( order.indexOf( "C=M" ) >= 0 ) {
$li.find( "a.date" ).prepend( $icon ); $li.find( "a.date" ).prepend( $icon );
} else if ( order.indexOf( "C=S" ) >= 0 ) { } else if ( order.column === "size" ) {
$li.find( "a.size" ).prepend( $icon ); $li.find( "a.size" ).prepend( $icon );
} else {
$li.find( "a.label" ).append( $icon );
}; };
$.timer.log( "start entries" );
// entries // entries
$( "#table td" ).closest( "tr" ).each( function () { $( "#table td" ).closest( "tr" ).each( function () {
var path = pathCache.getPathForTableRow( document.location.pathname, this ); var path = pathCache.getPathForTableRow( document.location.pathname, this );
$ul.append( path.updateExtendedHtml() ); $ul.append( path.updateExtendedHtml() );
} ); } );
$.timer.log( "end entries" );
$( "#extended" ).append( $ul ); $( "#extended" ).append( $ul );
$.log( document.location.pathname, "folders:", $( "#extended .folder" ).size() , "files:", $( "#extended .file" ).size() ); $.log( document.location.pathname, "folders:", $( "#extended .folder" ).size() , "files:", $( "#extended .file" ).size() );

View file

@ -16,6 +16,10 @@ var H5ai = function ( options, langs ) {
}, },
viewmodes: [ "details", "icons" ], viewmodes: [ "details", "icons" ],
sortorder: {
column: "name",
ascending: true
},
showTree: true, showTree: true,
folderStatus: { folderStatus: {
}, },
@ -173,32 +177,35 @@ var H5ai = function ( options, langs ) {
* init tree * init tree
*******************************/ *******************************/
this.initTree = function () { this.shiftTree = function ( forceVisible, dontAnimate ) {
var $tree = $( "#tree" ); var $tree = $( "#tree" );
var $extended = $( "#extended" ); var $extended = $( "#extended" );
var shiftTree = function ( forceVisible, dontAnimate ) {
if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) { if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
if ( dontAnimate === true ) { if ( dontAnimate === true ) {
$tree.stop().css( { left: 0 } ); $tree.stop().css( { left: 0 } );
} else {
$tree.stop().animate( { left: 0 } );
};
} else { } else {
if ( dontAnimate === true ) { $tree.stop().animate( { left: 0 } );
$tree.stop().css( { left: 18 - $tree.outerWidth() } ); };
} else { } else {
$tree.stop().animate( { left: 18 - $tree.outerWidth() } ); if ( dontAnimate === true ) {
}; $tree.stop().css( { left: 18 - $tree.outerWidth() } );
} else {
$tree.stop().animate( { left: 18 - $tree.outerWidth() } );
}; };
}; };
};
$tree.hover( function () { shiftTree( true ); }, function () { shiftTree(); } );
$( window ).resize( function() {
shiftTree();
} );
shiftTree( false, true ); this.initTree = function () {
$( "#tree" ).hover(
$.proxy( function () { this.shiftTree( true ); }, this ),
$.proxy( function () { this.shiftTree(); }, this )
);
$( window ).resize( $.proxy( function () { this.shiftTree(); }, this ) );
this.shiftTree( false, true );
}; };

View file

@ -49,6 +49,7 @@
}; };
}; };
var scroll = function ( event ) { var scroll = function ( event ) {
event.preventDefault();
var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height(); var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height();
$wrapper.scrollTop( $content.outerHeight() * clickFrac ); $wrapper.scrollTop( $content.outerHeight() * clickFrac );
update(); update();
@ -74,7 +75,8 @@
position: "absolute", position: "absolute",
top: 0, top: 0,
right: 0, right: 0,
overflow: "hidden" overflow: "hidden",
cursor: "pointer"
} ) } )
.mousedown( function ( event ) { .mousedown( function ( event ) {
mouseOffsetY = $drag.outerHeight() / 2; mouseOffsetY = $drag.outerHeight() / 2;
@ -88,10 +90,8 @@
scroll( event ); scroll( event );
event.stopPropagation(); event.stopPropagation();
} ); } );
event.stopPropagation(); event.preventDefault();
} ) } )
.attr( "unselectable", "on" )
.css( "-moz-user-select", "none" )
.each( function () { .each( function () {
this.onselectstart = function () { this.onselectstart = function () {
return false; return false;

View file

@ -40,6 +40,7 @@ var Tree = function ( pathCache, h5ai ) {
.append( path.updateTreeHtml() ) .append( path.updateTreeHtml() )
.scrollpanel() .scrollpanel()
.show(); .show();
h5ai.shiftTree( false, true );
h5ai.linkHoverStates(); h5ai.linkHoverStates();
pathCache.storeCache(); pathCache.storeCache();
setTimeout( function () { setTimeout( function () {

View file

@ -14,11 +14,9 @@
* create * create
*******************************/ *******************************/
$.timer.log( "start pathcache" );
var pathCache = new PathCache(); var pathCache = new PathCache();
$.timer.log( "end pathcache" );
var extended = new Extended( pathCache );
var h5ai = new H5ai( h5aiOptions, h5aiLangs ); var h5ai = new H5ai( h5aiOptions, h5aiLangs );
var extended = new Extended( pathCache, h5ai );
var tree = new Tree( pathCache, h5ai ); var tree = new Tree( pathCache, h5ai );

View file

@ -31,6 +31,7 @@
h5ai.init(); h5ai.init();
$( "#tree" ).scrollpanel(); $( "#tree" ).scrollpanel();
h5ai.shiftTree( false, true );
} ); } );
} )( jQuery ); } )( jQuery );

View file

@ -15,6 +15,17 @@ h5aiOptions = {
*/ */
"viewmodes": [ "details", "icons" ], "viewmodes": [ "details", "icons" ],
/*
* Default sort order. Valid values for column are "name", "date" and
* "size".
* If you are using the JavaScript version please make sure to change
* IndexOrderDefault in js.htaccess as well.
*/
"sortorder": {
"column": "name",
"ascending": true
},
/* /*
* Show a folder tree, boolean. * Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests * Note that this tree might have side effects as it sends HEAD requests
@ -71,6 +82,9 @@ h5aiOptions = {
"dateFormat": "Y-m-d H:i", "dateFormat": "Y-m-d H:i",
/* /*
* IMPORTANT: PHP implementation doesn't care about Apache's
* ignores, so you have to specify this here.
*
* Only used in PHP implementation. * Only used in PHP implementation.
* Files/folders that should never be listed. Specified * Files/folders that should never be listed. Specified
* by the complete filename or by a regular expression. * by the complete filename or by a regular expression.
@ -114,7 +128,7 @@ h5aiLangs = {
}, },
"fr": { "fr": {
"lang": "française", "lang": "français",
"details": "détails", "details": "détails",
"icons": "icônes", "icons": "icônes",
"name": "Nom", "name": "Nom",
@ -122,8 +136,8 @@ h5aiLangs = {
"size": "Taille", "size": "Taille",
"parentDirectory": "Dossier parent", "parentDirectory": "Dossier parent",
"empty": "vide", "empty": "vide",
"folders": "[?folders?]", "folders": "Répertoires",
"files": "[?files?]" "files": "Fichiers"
}, },
"nl": { "nl": {
@ -153,7 +167,7 @@ h5aiLangs = {
}, },
"cs": { "cs": {
"lang": "[?lang?]", "lang": "čeština",
"details": "podrobnosti", "details": "podrobnosti",
"icons": "ikony", "icons": "ikony",
"name": "Název", "name": "Název",
@ -161,12 +175,12 @@ h5aiLangs = {
"size": "Velikost", "size": "Velikost",
"parentDirectory": "Nadřazený adresář", "parentDirectory": "Nadřazený adresář",
"empty": "prázdný", "empty": "prázdný",
"folders": "[?folders?]", "folders": "složek",
"files": "[?files?]" "files": "souborů"
}, },
"sk": { "sk": {
"lang": "[?lang?]", "lang": "slovenčina",
"details": "podrobnosti", "details": "podrobnosti",
"icons": "ikony", "icons": "ikony",
"name": "Názov", "name": "Názov",
@ -174,8 +188,8 @@ h5aiLangs = {
"size": "Velkosť", "size": "Velkosť",
"parentDirectory": "Nadriadený priečinok", "parentDirectory": "Nadriadený priečinok",
"empty": "prázdny", "empty": "prázdny",
"folders": "[?folders?]", "folders": "priečinkov",
"files": "[?files?]" "files": "súborov"
}, },
"es": { "es": {
@ -213,12 +227,12 @@ h5aiLangs = {
"size": "Tamanho", "size": "Tamanho",
"parentDirectory": "Diretório superior", "parentDirectory": "Diretório superior",
"empty": "vazio", "empty": "vazio",
"folders": "[?folders?]", "folders": "pastas",
"files": "[?files?]" "files": "arquivos"
}, },
"bg": { "bg": {
"lang": "[?lang?]", "lang": "български",
"details": "детайли", "details": "детайли",
"icons": "икони", "icons": "икони",
"name": "Име", "name": "Име",
@ -226,7 +240,20 @@ h5aiLangs = {
"size": "Размер", "size": "Размер",
"parentDirectory": "Предходна директория", "parentDirectory": "Предходна директория",
"empty": "празно", "empty": "празно",
"folders": "[?folders?]", "folders": "папки",
"files": "[?files?]" "files": "файлове"
},
"lv": {
"lang": "latviešu",
"details": "detaļas",
"icons": "ikonas",
"name": "Nosaukums",
"lastModified": "Pēdējoreiz modificēts",
"size": "Izmērs",
"parentDirectory": "Vecākdirektorijs",
"empty": "tukšs",
"folders": "mapes",
"files": "faili"
} }
}; };

View file

@ -22,9 +22,11 @@ class H5ai {
$this->ignore = $this->options["options"]["ignore"]; $this->ignore = $this->options["options"]["ignore"];
$this->ignoreRE = $this->options["options"]["ignoreRE"]; $this->ignoreRE = $this->options["options"]["ignoreRE"];
$defaultSortOrder = $this->options["options"]["sortorder"];
$this->sortOrder = array( $this->sortOrder = array(
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : H5ai::$SORT_ORDER["column"], "column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : $defaultSortOrder["column"],
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : H5ai::$SORT_ORDER["ascending"] "ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : $defaultSortOrder["ascending"]
); );
$this->dateFormat = $this->options["options"]["dateFormat"]; $this->dateFormat = $this->options["options"]["dateFormat"];
$this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0]; $this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0];

View file

@ -9,115 +9,105 @@
################################ ################################
# IMPORTANT FOR XAMPP # h5ai header and footer
# if you're running XAMPP you might need to replace the
# following line with
# <IfModule autoindex_color_module>
################################ ################################
<IfModule autoindex_module>
HeaderName /h5ai/header.html
ReadmeName /h5ai/footer.html
################################ ################################
# h5ai header and footer # hide h5ai folder and config files from index
################################ ################################
HeaderName /h5ai/header.html IndexIgnore h5ai h5ai.header.html h5ai.footer.html
ReadmeName /h5ai/footer.html
################################ ################################
# hide h5ai folder and config files from index # table options
################################ ################################
IndexIgnore h5ai h5ai.header.html h5ai.footer.html # syntax for default sort order is: IndexOrderDefault Ascending|Descending Name|Date|Size
IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
IndexOptions Charset=UTF-8
IndexOptions FancyIndexing
IndexOptions HTMLTable
IndexOptions XHTML
IndexOptions SuppressHTMLPreamble
IndexOptions SuppressRules
IndexOptions SuppressDescription
IndexOptions FoldersFirst
IndexOptions IgnoreCase
IndexOptions IconsAreLinks
IndexOptions VersionSort
IndexOptions NameWidth=*
################################ ################################
# table options # icon mapping
################################ ################################
IndexOrderDefault Ascending Name AddIcon /h5ai/icons/16x16/folder-parent.png ..
AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^
AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^
IndexOptions Type=text/html;h5ai=%BUILD_VERSION% AddIcon /h5ai/icons/16x16/readme.png README
IndexOptions Charset=UTF-8 AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
IndexOptions FancyIndexing AddIcon /h5ai/icons/16x16/install.png INSTALL
IndexOptions HTMLTable AddIcon /h5ai/icons/16x16/authors.png AUTHORS
IndexOptions XHTML AddIcon /h5ai/icons/16x16/log.png LOG Log log
IndexOptions SuppressHTMLPreamble
IndexOptions SuppressRules AddIcon /h5ai/icons/16x16/css.png .less
IndexOptions SuppressDescription AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
IndexOptions FoldersFirst AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
IndexOptions IgnoreCase AddIcon /h5ai/icons/16x16/bin.png .so .o
IndexOptions IconsAreLinks
IndexOptions VersionSort AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
IndexOptions NameWidth=* AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2
AddIcon /h5ai/icons/16x16/tar.png .tar
AddIcon /h5ai/icons/16x16/pdf.png .pdf
################################ AddIcon /h5ai/icons/16x16/deb.png .deb
# icon mapping AddIcon /h5ai/icons/16x16/rpm.png .rpm
################################ AddIcon /h5ai/icons/16x16/cd.png .iso .cue
AddIcon /h5ai/icons/16x16/folder-parent.png .. AddIconByType /h5ai/icons/16x16/png.png image/png
AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^ AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg
AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^ AddIconByType /h5ai/icons/16x16/gif.png image/gif
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon
AddIcon /h5ai/icons/16x16/readme.png README AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp
AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
AddIcon /h5ai/icons/16x16/install.png INSTALL AddIconByType /h5ai/icons/16x16/html.png text/html
AddIcon /h5ai/icons/16x16/authors.png AUTHORS AddIconByType /h5ai/icons/16x16/css.png text/css
AddIcon /h5ai/icons/16x16/log.png LOG Log log AddIconByType /h5ai/icons/16x16/xml.png application/xml
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json
AddIcon /h5ai/icons/16x16/css.png .less AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml AddIconByType /h5ai/icons/16x16/py.png text/x-python
AddIcon /h5ai/icons/16x16/bin.png .so .o AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby
AddIconByType /h5ai/icons/16x16/java.png text/x-java
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2 AddIconByType /h5ai/icons/16x16/cpp.png text/x-c++src
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2 AddIconByType /h5ai/icons/16x16/hpp.png text/x-c++hdr
AddIcon /h5ai/icons/16x16/tar.png .tar AddIconByType /h5ai/icons/16x16/c.png text/x-csrc
AddIcon /h5ai/icons/16x16/pdf.png .pdf AddIconByType /h5ai/icons/16x16/h.png text/x-chdr
AddIcon /h5ai/icons/16x16/deb.png .deb
AddIcon /h5ai/icons/16x16/rpm.png .rpm AddIconByType /h5ai/icons/16x16/pdf.png application/pdf
AddIcon /h5ai/icons/16x16/cd.png .iso .cue
AddIconByType /h5ai/icons/16x16/rtf.png text/rtf application/rtf
AddIconByType /h5ai/icons/16x16/png.png image/png AddIconByType /h5ai/icons/16x16/tex.png text/x-tex
AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg AddIconByType /h5ai/icons/16x16/makefile.png text/x-makefile
AddIconByType /h5ai/icons/16x16/gif.png image/gif
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon AddIconByType /h5ai/icons/16x16/bin.png application/java-vm
AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp AddIconByType /h5ai/icons/16x16/exe.png application/x-executable application/x-msdos-program
AddIconByType /h5ai/icons/16x16/html.png text/html AddIconByType /h5ai/icons/16x16/text.png text/*
AddIconByType /h5ai/icons/16x16/css.png text/css AddIconByType /h5ai/icons/16x16/image.png image/*
AddIconByType /h5ai/icons/16x16/xml.png application/xml AddIconByType /h5ai/icons/16x16/audio.png audio/*
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json AddIconByType /h5ai/icons/16x16/video.png video/*
AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
AddIconByEncoding /h5ai/icons/16x16/zip.png x-compress x-gzip x-bzip2
AddIconByType /h5ai/icons/16x16/py.png text/x-python
AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby DefaultIcon /h5ai/icons/16x16/unknown.png
AddIconByType /h5ai/icons/16x16/java.png text/x-java
AddIconByType /h5ai/icons/16x16/cpp.png text/x-c++src
AddIconByType /h5ai/icons/16x16/hpp.png text/x-c++hdr
AddIconByType /h5ai/icons/16x16/c.png text/x-csrc
AddIconByType /h5ai/icons/16x16/h.png text/x-chdr
AddIconByType /h5ai/icons/16x16/pdf.png application/pdf
AddIconByType /h5ai/icons/16x16/rtf.png text/rtf application/rtf
AddIconByType /h5ai/icons/16x16/tex.png text/x-tex
AddIconByType /h5ai/icons/16x16/makefile.png text/x-makefile
AddIconByType /h5ai/icons/16x16/bin.png application/java-vm
AddIconByType /h5ai/icons/16x16/exe.png application/x-executable application/x-msdos-program
AddIconByType /h5ai/icons/16x16/text.png text/*
AddIconByType /h5ai/icons/16x16/image.png image/*
AddIconByType /h5ai/icons/16x16/audio.png audio/*
AddIconByType /h5ai/icons/16x16/video.png video/*
AddIconByEncoding /h5ai/icons/16x16/zip.png x-compress x-gzip x-bzip2
DefaultIcon /h5ai/icons/16x16/unknown.png
</IfModule>

View file

@ -8,22 +8,12 @@
# Options +FollowSymLinks # Options +FollowSymLinks
################################ HeaderName /h5ai/header.php
# IMPORTANT FOR XAMPP ReadmeName /h5ai/footer.php
# if you're running XAMPP you might need to replace the
# following line with
# <IfModule autoindex_color_module>
################################
<IfModule autoindex_module>
HeaderName /h5ai/header.php IndexIgnore *
ReadmeName /h5ai/footer.php
IndexIgnore * IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
IndexOptions Charset=UTF-8
IndexOptions Type=text/html;h5ai=%BUILD_VERSION% IndexOptions SuppressHTMLPreamble
IndexOptions Charset=UTF-8
IndexOptions SuppressHTMLPreamble
</IfModule>