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
### 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*
* added PHP implementation! (should work with PHP 5.2+)

View file

@ -3,7 +3,7 @@ custom = true
# project
project.name = h5ai
project.version = 0.13
project.version = 0.13.1
# 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
AddHandler application/x-httpd-php .php
# cache images, css and js for 52 weeks
<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 = {
defaultSortOrder: "C=N;O=A",
customHeader: "h5ai.header.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 );
// header sort icons
var order = document.location.search;
if ( order === "" ) {
order = this.config.defaultSortOrder;
var sortquery = document.location.search;
var order = {
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;
if ( order.indexOf( "O=A" ) >= 0 ) {
if ( order.ascending ) {
$icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" );
} else {
$icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" );
};
if ( order.indexOf( "C=N" ) >= 0 ) {
$li.find( "a.label" ).append( $icon );
} else if ( order.indexOf( "C=M" ) >= 0 ) {
if ( order.column === "date" ) {
$li.find( "a.date" ).prepend( $icon );
} else if ( order.indexOf( "C=S" ) >= 0 ) {
} else if ( order.column === "size" ) {
$li.find( "a.size" ).prepend( $icon );
} else {
$li.find( "a.label" ).append( $icon );
};
$.timer.log( "start entries" );
// entries
$( "#table td" ).closest( "tr" ).each( function () {
var path = pathCache.getPathForTableRow( document.location.pathname, this );
$ul.append( path.updateExtendedHtml() );
} );
$.timer.log( "end entries" );
$( "#extended" ).append( $ul );
$.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" ],
sortorder: {
column: "name",
ascending: true
},
showTree: true,
folderStatus: {
},
@ -173,11 +177,11 @@ var H5ai = function ( options, langs ) {
* init tree
*******************************/
this.initTree = function () {
this.shiftTree = function ( forceVisible, dontAnimate ) {
var $tree = $( "#tree" );
var $extended = $( "#extended" );
var shiftTree = function ( forceVisible, dontAnimate ) {
if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
if ( dontAnimate === true ) {
$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 ) {
event.preventDefault();
var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height();
$wrapper.scrollTop( $content.outerHeight() * clickFrac );
update();
@ -74,7 +75,8 @@
position: "absolute",
top: 0,
right: 0,
overflow: "hidden"
overflow: "hidden",
cursor: "pointer"
} )
.mousedown( function ( event ) {
mouseOffsetY = $drag.outerHeight() / 2;
@ -88,10 +90,8 @@
scroll( event );
event.stopPropagation();
} );
event.stopPropagation();
event.preventDefault();
} )
.attr( "unselectable", "on" )
.css( "-moz-user-select", "none" )
.each( function () {
this.onselectstart = function () {
return false;

View file

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

View file

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

View file

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

View file

@ -15,6 +15,17 @@ h5aiOptions = {
*/
"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.
* Note that this tree might have side effects as it sends HEAD requests
@ -71,6 +82,9 @@ h5aiOptions = {
"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.
* Files/folders that should never be listed. Specified
* by the complete filename or by a regular expression.
@ -114,7 +128,7 @@ h5aiLangs = {
},
"fr": {
"lang": "française",
"lang": "français",
"details": "détails",
"icons": "icônes",
"name": "Nom",
@ -122,8 +136,8 @@ h5aiLangs = {
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "[?folders?]",
"files": "[?files?]"
"folders": "Répertoires",
"files": "Fichiers"
},
"nl": {
@ -153,7 +167,7 @@ h5aiLangs = {
},
"cs": {
"lang": "[?lang?]",
"lang": "čeština",
"details": "podrobnosti",
"icons": "ikony",
"name": "Název",
@ -161,12 +175,12 @@ h5aiLangs = {
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "prázdný",
"folders": "[?folders?]",
"files": "[?files?]"
"folders": "složek",
"files": "souborů"
},
"sk": {
"lang": "[?lang?]",
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
@ -174,8 +188,8 @@ h5aiLangs = {
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "[?folders?]",
"files": "[?files?]"
"folders": "priečinkov",
"files": "súborov"
},
"es": {
@ -213,12 +227,12 @@ h5aiLangs = {
"size": "Tamanho",
"parentDirectory": "Diretório superior",
"empty": "vazio",
"folders": "[?folders?]",
"files": "[?files?]"
"folders": "pastas",
"files": "arquivos"
},
"bg": {
"lang": "[?lang?]",
"lang": "български",
"details": "детайли",
"icons": "икони",
"name": "Име",
@ -226,7 +240,20 @@ h5aiLangs = {
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празно",
"folders": "[?folders?]",
"files": "[?files?]"
"folders": "папки",
"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->ignoreRE = $this->options["options"]["ignoreRE"];
$defaultSortOrder = $this->options["options"]["sortorder"];
$this->sortOrder = array(
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : H5ai::$SORT_ORDER["column"],
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : H5ai::$SORT_ORDER["ascending"]
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : $defaultSortOrder["column"],
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : $defaultSortOrder["ascending"]
);
$this->dateFormat = $this->options["options"]["dateFormat"];
$this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0];

View file

@ -8,15 +8,6 @@
# 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
################################
@ -36,6 +27,7 @@
# table options
################################
# syntax for default sort order is: IndexOrderDefault Ascending|Descending Name|Date|Size
IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
@ -118,6 +110,4 @@
DefaultIcon /h5ai/icons/16x16/unknown.png
</IfModule>

View file

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