diff --git a/README.md b/README.md index e02ccc99..a06f381b 100644 --- a/README.md +++ b/README.md @@ -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+) diff --git a/build.properties b/build.properties index b247f078..4b2ddeed 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ custom = true # project project.name = h5ai -project.version = 0.13 +project.version = 0.13.1 # src diff --git a/release/h5ai-0.13.1.tar.gz b/release/h5ai-0.13.1.tar.gz new file mode 100644 index 00000000..dc3b5e44 Binary files /dev/null and b/release/h5ai-0.13.1.tar.gz differ diff --git a/release/h5ai-0.13.zip b/release/h5ai-0.13.1.zip similarity index 85% rename from release/h5ai-0.13.zip rename to release/h5ai-0.13.1.zip index 5f414a1a..79838a38 100644 Binary files a/release/h5ai-0.13.zip and b/release/h5ai-0.13.1.zip differ diff --git a/release/h5ai-0.13.tar.gz b/release/h5ai-0.13.tar.gz deleted file mode 100644 index 51e8964e..00000000 Binary files a/release/h5ai-0.13.tar.gz and /dev/null differ diff --git a/src/h5ai/.htaccess b/src/h5ai/.htaccess index cf7f738f..a3a4c553 100644 --- a/src/h5ai/.htaccess +++ b/src/h5ai/.htaccess @@ -1,5 +1,8 @@ + AddType text/html .php +AddHandler application/x-httpd-php .php + # cache images, css and js for 52 weeks diff --git a/src/h5ai/js/inc/extended.js b/src/h5ai/js/inc/extended.js index d857db73..62ee8bf1 100644 --- a/src/h5ai/js/inc/extended.js +++ b/src/h5ai/js/inc/extended.js @@ -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 ) { $( "" + $size.text() + "" ).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 = $( "ascending" ); } else { $icon = $( "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() ); diff --git a/src/h5ai/js/inc/h5ai.js b/src/h5ai/js/inc/h5ai.js index b3b06b44..6650c683 100644 --- a/src/h5ai/js/inc/h5ai.js +++ b/src/h5ai/js/inc/h5ai.js @@ -16,6 +16,10 @@ var H5ai = function ( options, langs ) { }, viewmodes: [ "details", "icons" ], + sortorder: { + column: "name", + ascending: true + }, showTree: true, folderStatus: { }, @@ -173,32 +177,35 @@ 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 } ); - } else { - $tree.stop().animate( { left: 0 } ); - }; + + if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) { + if ( dontAnimate === true ) { + $tree.stop().css( { left: 0 } ); } else { - if ( dontAnimate === true ) { - $tree.stop().css( { left: 18 - $tree.outerWidth() } ); - } else { - $tree.stop().animate( { left: 18 - $tree.outerWidth() } ); - }; + $tree.stop().animate( { left: 0 } ); + }; + } else { + 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 ); }; diff --git a/src/h5ai/js/inc/jquery.scrollpanel.js b/src/h5ai/js/inc/jquery.scrollpanel.js index 0c25df38..f5aff77e 100644 --- a/src/h5ai/js/inc/jquery.scrollpanel.js +++ b/src/h5ai/js/inc/jquery.scrollpanel.js @@ -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; diff --git a/src/h5ai/js/inc/tree.js b/src/h5ai/js/inc/tree.js index 3ccc1e47..daf1db59 100644 --- a/src/h5ai/js/inc/tree.js +++ b/src/h5ai/js/inc/tree.js @@ -40,6 +40,7 @@ var Tree = function ( pathCache, h5ai ) { .append( path.updateTreeHtml() ) .scrollpanel() .show(); + h5ai.shiftTree( false, true ); h5ai.linkHoverStates(); pathCache.storeCache(); setTimeout( function () { diff --git a/src/h5ai/js/main-js.js b/src/h5ai/js/main-js.js index 04feca45..35c6f6d5 100644 --- a/src/h5ai/js/main-js.js +++ b/src/h5ai/js/main-js.js @@ -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 ); diff --git a/src/h5ai/js/main-php.js b/src/h5ai/js/main-php.js index a4a6e24b..4ad5b5a9 100644 --- a/src/h5ai/js/main-php.js +++ b/src/h5ai/js/main-php.js @@ -31,6 +31,7 @@ h5ai.init(); $( "#tree" ).scrollpanel(); + h5ai.shiftTree( false, true ); } ); } )( jQuery ); \ No newline at end of file diff --git a/src/h5ai/options.js b/src/h5ai/options.js index 95174dd6..db1b1b8b 100644 --- a/src/h5ai/options.js +++ b/src/h5ai/options.js @@ -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" } }; diff --git a/src/h5ai/php/h5ai.php b/src/h5ai/php/h5ai.php index 5f513803..50ccfd28 100644 --- a/src/h5ai/php/h5ai.php +++ b/src/h5ai/php/h5ai.php @@ -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]; diff --git a/src/js.htaccess b/src/js.htaccess index 3e01a4b5..a7a37233 100644 --- a/src/js.htaccess +++ b/src/js.htaccess @@ -9,115 +9,105 @@ ################################ -# IMPORTANT FOR XAMPP -# if you're running XAMPP you might need to replace the -# following line with -# +# h5ai header and footer ################################ - + +HeaderName /h5ai/header.html +ReadmeName /h5ai/footer.html - ################################ - # h5ai header and footer - ################################ +################################ +# hide h5ai folder and config files from index +################################ - HeaderName /h5ai/header.html - ReadmeName /h5ai/footer.html +IndexIgnore h5ai h5ai.header.html 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% - 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=* - - - ################################ - # icon mapping - ################################ - - AddIcon /h5ai/icons/16x16/folder-parent.png .. - AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^ - AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^ - - AddIcon /h5ai/icons/16x16/readme.png README - AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE - AddIcon /h5ai/icons/16x16/install.png INSTALL - AddIcon /h5ai/icons/16x16/authors.png AUTHORS - AddIcon /h5ai/icons/16x16/log.png LOG Log log - - AddIcon /h5ai/icons/16x16/css.png .less - AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl - AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml - AddIcon /h5ai/icons/16x16/bin.png .so .o - - AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2 - 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 - AddIcon /h5ai/icons/16x16/rpm.png .rpm - AddIcon /h5ai/icons/16x16/cd.png .iso .cue - - AddIconByType /h5ai/icons/16x16/png.png image/png - AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg - AddIconByType /h5ai/icons/16x16/gif.png image/gif - AddIconByType /h5ai/icons/16x16/ico.png image/x-icon - AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp - - AddIconByType /h5ai/icons/16x16/html.png text/html - AddIconByType /h5ai/icons/16x16/css.png text/css - AddIconByType /h5ai/icons/16x16/xml.png application/xml - AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json - AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php - - AddIconByType /h5ai/icons/16x16/py.png text/x-python - AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby - 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 - - +AddIcon /h5ai/icons/16x16/readme.png README +AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE +AddIcon /h5ai/icons/16x16/install.png INSTALL +AddIcon /h5ai/icons/16x16/authors.png AUTHORS +AddIcon /h5ai/icons/16x16/log.png LOG Log log + +AddIcon /h5ai/icons/16x16/css.png .less +AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl +AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml +AddIcon /h5ai/icons/16x16/bin.png .so .o + +AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2 +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 +AddIcon /h5ai/icons/16x16/rpm.png .rpm +AddIcon /h5ai/icons/16x16/cd.png .iso .cue + +AddIconByType /h5ai/icons/16x16/png.png image/png +AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg +AddIconByType /h5ai/icons/16x16/gif.png image/gif +AddIconByType /h5ai/icons/16x16/ico.png image/x-icon +AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp + +AddIconByType /h5ai/icons/16x16/html.png text/html +AddIconByType /h5ai/icons/16x16/css.png text/css +AddIconByType /h5ai/icons/16x16/xml.png application/xml +AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json +AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php + +AddIconByType /h5ai/icons/16x16/py.png text/x-python +AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby +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 diff --git a/src/php.htaccess b/src/php.htaccess index b7fc6ddf..604db3ac 100644 --- a/src/php.htaccess +++ b/src/php.htaccess @@ -8,22 +8,12 @@ # Options +FollowSymLinks -################################ -# IMPORTANT FOR XAMPP -# if you're running XAMPP you might need to replace the -# following line with -# -################################ - +HeaderName /h5ai/header.php +ReadmeName /h5ai/footer.php - HeaderName /h5ai/header.php - ReadmeName /h5ai/footer.php +IndexIgnore * - IndexIgnore * - - IndexOptions Type=text/html;h5ai=%BUILD_VERSION% - IndexOptions Charset=UTF-8 - IndexOptions SuppressHTMLPreamble - - +IndexOptions Type=text/html;h5ai=%BUILD_VERSION% +IndexOptions Charset=UTF-8 +IndexOptions SuppressHTMLPreamble