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,11 +177,11 @@ 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 } );
@ -193,12 +197,15 @@ var H5ai = function ( options, langs ) {
}; };
}; };
$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

@ -8,15 +8,6 @@
# Options +FollowSymLinks # Options +FollowSymLinks
################################
# IMPORTANT FOR XAMPP
# if you're running XAMPP you might need to replace the
# following line with
# <IfModule autoindex_color_module>
################################
<IfModule autoindex_module>
################################ ################################
# h5ai header and footer # h5ai header and footer
################################ ################################
@ -36,6 +27,7 @@
# table options # table options
################################ ################################
# syntax for default sort order is: IndexOrderDefault Ascending|Descending Name|Date|Size
IndexOrderDefault Ascending Name IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=%BUILD_VERSION% IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
@ -118,6 +110,4 @@
DefaultIcon /h5ai/icons/16x16/unknown.png DefaultIcon /h5ai/icons/16x16/unknown.png
</IfModule>

View file

@ -8,14 +8,6 @@
# Options +FollowSymLinks # Options +FollowSymLinks
################################
# IMPORTANT FOR XAMPP
# 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 HeaderName /h5ai/header.php
ReadmeName /h5ai/footer.php ReadmeName /h5ai/footer.php
@ -25,5 +17,3 @@
IndexOptions Charset=UTF-8 IndexOptions Charset=UTF-8
IndexOptions SuppressHTMLPreamble IndexOptions SuppressHTMLPreamble
</IfModule>