Switches indentation to tabs.

This commit is contained in:
Lars Jung 2012-02-12 22:35:38 +01:00
parent 231ba3013b
commit 20858a1f43
39 changed files with 3437 additions and 3440 deletions

View file

@ -31,6 +31,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
### v0.18 - *2012-02-??*
* updates year in `LICENSE.TXT`
* updates es translation
### v0.17 - *2011-11-28*

118
build.xml
View file

@ -1,75 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<project
name="h5ai"
basedir="."
default="release"
name="h5ai"
basedir="."
default="release"
>
<import file="tools/wepp.ant.xml" />
<import file="tools/wepp.ant.xml" />
<target name="init">
<property file="build.properties" />
<tstamp>
<format property="build.stamp" pattern="yyyy-MM-dd-HHmmss" />
</tstamp>
<property name="build.label" value="${project.name} ${project.version} b${build.stamp}" />
<echo>Build: ${build.label}</echo>
</target>
<target name="init">
<property file="build.properties" />
<tstamp>
<format property="build.stamp" pattern="yyyy-MM-dd-HHmmss" />
</tstamp>
<property name="build.label" value="${project.name} ${project.version} b${build.stamp}" />
<echo>Build: ${build.label}</echo>
</target>
<target name="clean" depends="init">
<delete dir="${build.dir}" />
<delete dir="${release.dir}" />
</target>
<target name="clean" depends="init">
<delete dir="${build.dir}" />
<delete dir="${release.dir}" />
</target>
<target name="build-prepare" depends="clean">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${src.dir}" />
<fileset file="LICENSE.txt" />
<fileset file="README.md" />
</copy>
<replace dir="${build.dir}">
<replacefilter token="%BUILD%" value="${build.label}" />
<replacefilter token="%BUILD_NAME%" value="${project.name}" />
<replacefilter token="%BUILD_VERSION%" value="${project.version}" />
<replacefilter token="%BUILD_STAMP%" value="${build.stamp}" />
</replace>
</target>
<target name="build-prepare" depends="clean">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${src.dir}" />
<fileset file="LICENSE.txt" />
<fileset file="README.md" />
</copy>
<replace dir="${build.dir}">
<replacefilter token="%BUILD%" value="${build.label}" />
<replacefilter token="%BUILD_NAME%" value="${project.name}" />
<replacefilter token="%BUILD_VERSION%" value="${project.version}" />
<replacefilter token="%BUILD_STAMP%" value="${build.stamp}" />
</replace>
</target>
<target name="build" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" />
<wepp.dir dir="${build.dir}/_h5ai/js" />
</target>
<target name="build" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" />
<wepp.dir dir="${build.dir}/_h5ai/js" />
</target>
<target name="build-uncompressed" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" args="--nc" />
<wepp.dir dir="${build.dir}/_h5ai/js" args="--nc" />
</target>
<target name="build-uncompressed" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" args="--nc" />
<wepp.dir dir="${build.dir}/_h5ai/js" args="--nc" />
</target>
<target name="release" depends="build">
<mkdir dir="${release.dir}" />
<zip destfile="${release.dir}/${project.name}-${project.version}.zip" basedir="${build.dir}" />
</target>
<target name="release" depends="build">
<mkdir dir="${release.dir}" />
<zip destfile="${release.dir}/${project.name}-${project.version}.zip" basedir="${build.dir}" />
</target>
<target name="pre-xint" depends="build-prepare">
<wepp file="${tool.jsxint.file}" tofile="${tool.jsxint.file}" args="--nc" />
</target>
<target name="pre-xint" depends="build-prepare">
<wepp file="${tool.jsxint.file}" tofile="${tool.jsxint.file}" args="--nc" />
</target>
<target name="lint" depends="pre-xint">
<echo>JSLint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jslint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<target name="lint" depends="pre-xint">
<echo>JSLint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jslint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<target name="hint" depends="pre-xint">
<echo>JSHint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jshint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<target name="hint" depends="pre-xint">
<echo>JSHint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jshint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<target name="xint" depends="lint,hint">
</target>
<target name="xint" depends="lint,hint">
</target>
</project>

View file

@ -19,17 +19,17 @@ AddType text/html .php
# cache images, css and js for 52 weeks
<IfModule headers_module>
<FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.css$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.js$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "thumb-.*\.jpg$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.css$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.js$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "thumb-.*\.jpg$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
</IfModule>

View file

@ -7,405 +7,405 @@
var H5AI_CONFIG = {
"options": {
"options": {
/*
* The absolute links to webroot and h5ai.
* Do not change this unless you know what you are doing.
*/
"rootAbsHref": "/",
"h5aiAbsHref": "/_h5ai/",
/*
* The absolute links to webroot and h5ai.
* Do not change this unless you know what you are doing.
*/
"rootAbsHref": "/",
"h5aiAbsHref": "/_h5ai/",
/*
* Filenames of customized header and footer files to look for
* in each folder.
*/
"customHeader": "_h5ai.header.html",
"customFooter": "_h5ai.footer.html",
/*
* Filenames of customized header and footer files to look for
* in each folder.
*/
"customHeader": "_h5ai.header.html",
"customFooter": "_h5ai.footer.html",
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*/
"viewmodes": ["details", "icons"],
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*/
"viewmodes": ["details", "icons"],
/*
* Default sort order is a two letter code. The first letter specifies
* the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
* second letter specifies the sort order: "a" for "ascending" or "d"
* for "descending".
*/
"sortorder": "na",
/*
* Default sort order is a two letter code. The first letter specifies
* the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
* second letter specifies the sort order: "a" for "ascending" or "d"
* for "descending".
*/
"sortorder": "na",
/*
* Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* folderStatus below to avoid such requests.
* It might also affect performance significantly.
*/
"showTree": true,
/*
* Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* folderStatus below to avoid such requests.
* It might also affect performance significantly.
*/
"showTree": true,
/*
* Slide tree bar into viewport if there is enough space, boolean.
*/
"slideTree": true,
/*
* Slide tree bar into viewport if there is enough space, boolean.
*/
"slideTree": true,
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example:
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
"folderStatus": {},
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example:
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
"folderStatus": {},
/*
* Localization, for example "en", "de" etc. - see h5aiLangs below for
* possible values. Adjust it to your needs. If lang is not found in
* h5aiLangs it defaults to "en".
*/
"lang": "en",
/*
* Localization, for example "en", "de" etc. - see h5aiLangs below for
* possible values. Adjust it to your needs. If lang is not found in
* h5aiLangs it defaults to "en".
*/
"lang": "en",
/*
* Try to use browser language, falls back to previous specified lang.
*/
"useBrowserLang": true,
/*
* Try to use browser language, falls back to previous specified lang.
*/
"useBrowserLang": true,
/*
* Set parent folder labels to real folder names.
*/
"setParentFolderLabels": true,
/*
* Set parent folder labels to real folder names.
*/
"setParentFolderLabels": true,
/*
* Link the hover effects between crumb, extended view and tree.
*/
"linkHoverStates": true,
/*
* Link the hover effects between crumb, extended view and tree.
*/
"linkHoverStates": true,
/*
* Date format in detailed view, for example: "yyyy-MM-dd HH:mm:ss"
* Syntax as specified by date.js
* http://code.google.com/p/datejs/wiki/FormatSpecifiers
*/
"dateFormat": "yyyy-MM-dd HH:mm",
/*
* Date format in detailed view, for example: "yyyy-MM-dd HH:mm:ss"
* Syntax as specified by date.js
* http://code.google.com/p/datejs/wiki/FormatSpecifiers
*/
"dateFormat": "yyyy-MM-dd HH:mm",
/*
* Requires PHP on the server.
* Show thumbnails for image files.
*/
"showThumbs": false,
/*
* Requires PHP on the server.
* Show thumbnails for image files.
*/
"showThumbs": false,
/*
* Requires PHP on the server.
* Enable zipped download of selected entries.
*/
"zippedDownload": false
},
/*
* Requires PHP on the server.
* Enable zipped download of selected entries.
*/
"zippedDownload": false
},
/*
* File types mapped to file extensions.
*/
"types": {
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
"audio": [".aif", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
"authors": ["authors"],
"bin": [".class", ".o", ".so"],
"blank": [],
"bmp": [".bmp"],
"c": [".c"],
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
"cd": [".cue", ".iso"],
"copying": ["copying", "license"],
"cpp": [".cpp"],
"css": [".css", ".less"],
"deb": [".deb"],
"default": [],
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
"draw": [".drw"],
"eps": [".eps"],
"exe": [".exe"],
"folder": [],
"folder-home": [],
"folder-open": [],
"folder-page": [],
"folder-parent": [],
"gif": [".gif"],
"gzip": [".gz"],
"h": [".h"],
"hpp": [".hpp"],
"html": [".htm", ".html", ".shtml"],
"ico": [".ico"],
"image": [".xpm"],
"install": ["install"],
"java": [".java"],
"jpg": [".jpg", ".jpeg"],
"js": [".js", ".json"],
"log": [".log", "changelog"],
"makefile": [".pom", "build.xml", "pom.xml"],
"package": [],
"pdf": [".pdf"],
"php": [".php"],
"playlist": [".m3u"],
"png": [".png"],
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
"psd": [".psd"],
"py": [".py"],
"rar": [".rar"],
"rb": [".rb"],
"readme": ["readme"],
"rpm": [".rpm"],
"rss": [".rss"],
"rtf": [".rtf"],
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
"source": [],
"sql": [],
"tar": [".tar"],
"tex": [".tex"],
"text": [".markdown", ".md", ".text", ".txt"],
"tiff": [".tiff"],
"unknown": [],
"vcal": [".vcal"],
"video": [".avi", ".flv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
"xml": [".xml"],
"zip": [".bz2", ".jar", ".war", ".z", ".Z", ".zip"]
},
/*
* File types mapped to file extensions.
*/
"types": {
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
"audio": [".aif", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
"authors": ["authors"],
"bin": [".class", ".o", ".so"],
"blank": [],
"bmp": [".bmp"],
"c": [".c"],
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
"cd": [".cue", ".iso"],
"copying": ["copying", "license"],
"cpp": [".cpp"],
"css": [".css", ".less"],
"deb": [".deb"],
"default": [],
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
"draw": [".drw"],
"eps": [".eps"],
"exe": [".exe"],
"folder": [],
"folder-home": [],
"folder-open": [],
"folder-page": [],
"folder-parent": [],
"gif": [".gif"],
"gzip": [".gz"],
"h": [".h"],
"hpp": [".hpp"],
"html": [".htm", ".html", ".shtml"],
"ico": [".ico"],
"image": [".xpm"],
"install": ["install"],
"java": [".java"],
"jpg": [".jpg", ".jpeg"],
"js": [".js", ".json"],
"log": [".log", "changelog"],
"makefile": [".pom", "build.xml", "pom.xml"],
"package": [],
"pdf": [".pdf"],
"php": [".php"],
"playlist": [".m3u"],
"png": [".png"],
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
"psd": [".psd"],
"py": [".py"],
"rar": [".rar"],
"rb": [".rb"],
"readme": ["readme"],
"rpm": [".rpm"],
"rss": [".rss"],
"rtf": [".rtf"],
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
"source": [],
"sql": [],
"tar": [".tar"],
"tex": [".tex"],
"text": [".markdown", ".md", ".text", ".txt"],
"tiff": [".tiff"],
"unknown": [],
"vcal": [".vcal"],
"video": [".avi", ".flv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
"xml": [".xml"],
"zip": [".bz2", ".jar", ".war", ".z", ".Z", ".zip"]
},
/*
* Available translations.
*/
"langs": {
/*
* Available translations.
*/
"langs": {
"en": {
"lang": "english",
"details": "details",
"icons": "icons",
"name": "Name",
"lastModified": "Last modified",
"size": "Size",
"parentDirectory": "Parent Directory",
"empty": "empty",
"folders": "folders",
"files": "files",
"download": "download"
},
"en": {
"lang": "english",
"details": "details",
"icons": "icons",
"name": "Name",
"lastModified": "Last modified",
"size": "Size",
"parentDirectory": "Parent Directory",
"empty": "empty",
"folders": "folders",
"files": "files",
"download": "download"
},
"bg": {
"lang": "български",
"details": "детайли",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празно",
"folders": "папки",
"files": "файлове",
"download": "download"
},
"bg": {
"lang": "български",
"details": "детайли",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празно",
"folders": "папки",
"files": "файлове",
"download": "download"
},
"cs": {
"lang": "čeština",
"details": "podrobnosti",
"icons": "ikony",
"name": "Název",
"lastModified": "Upraveno",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "prázdný",
"folders": "složek",
"files": "souborů",
"download": "download"
},
"cs": {
"lang": "čeština",
"details": "podrobnosti",
"icons": "ikony",
"name": "Název",
"lastModified": "Upraveno",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "prázdný",
"folders": "složek",
"files": "souborů",
"download": "download"
},
"de": {
"lang": "deutsch",
"details": "Details",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download"
},
"de": {
"lang": "deutsch",
"details": "Details",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download"
},
"es": {
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "Directorios",
"files": "Archivos",
"download": "Descargar"
},
"es": {
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "Directorios",
"files": "Archivos",
"download": "Descargar"
},
"fr": {
"lang": "français",
"details": "détails",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger"
},
"fr": {
"lang": "français",
"details": "détails",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger"
},
"it": {
"lang": "italiano",
"details": "dettagli",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file",
"download": "download"
},
"it": {
"lang": "italiano",
"details": "dettagli",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file",
"download": "download"
},
"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",
"download": "lejupielādēt"
},
"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",
"download": "lejupielādēt"
},
"nl": {
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege",
"folders": "folders",
"files": "files",
"download": "download"
},
"nl": {
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege",
"folders": "folders",
"files": "files",
"download": "download"
},
"pl": {
"lang": "polski",
"details": "szczegóły",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "foldery",
"files": "pliki",
"download": "download"
},
"pl": {
"lang": "polski",
"details": "szczegóły",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "foldery",
"files": "pliki",
"download": "download"
},
"pt": {
"lang": "português",
"details": "detalhes",
"icons": "ícones",
"name": "Nome",
"lastModified": "Última modificação",
"size": "Tamanho",
"parentDirectory": "Diretório superior",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos",
"download": "download"
},
"pt": {
"lang": "português",
"details": "detalhes",
"icons": "ícones",
"name": "Nome",
"lastModified": "Última modificação",
"size": "Tamanho",
"parentDirectory": "Diretório superior",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos",
"download": "download"
},
"ru": {
"lang": "русский",
"details": "детали",
"icons": "иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "пусто",
"folders": "папки",
"files": "файлы",
"download": "download"
},
"ru": {
"lang": "русский",
"details": "детали",
"icons": "иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "пусто",
"folders": "папки",
"files": "файлы",
"download": "download"
},
"sk": {
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov",
"download": "download"
},
"sk": {
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov",
"download": "download"
},
"sv": {
"lang": "svenska",
"details": "detaljerad",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom",
"folders": "folders",
"files": "files",
"download": "download"
},
"sv": {
"lang": "svenska",
"details": "detaljerad",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom",
"folders": "folders",
"files": "files",
"download": "download"
},
"tr": {
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
},
"tr": {
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
},
"zh-cn": {
"lang": "简体中文",
"details": "详情",
"icons": "图标",
"name": "文件名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "download"
}
}
"zh-cn": {
"lang": "简体中文",
"details": "详情",
"icons": "图标",
"name": "文件名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "download"
}
}
};

View file

@ -1,280 +1,280 @@
#extended.details-view {
display: none;
display: none;
ul {
margin: 0;
padding: 0;
list-style: none;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
position: relative;
white-space: nowrap;
clear: both;
li {
position: relative;
white-space: nowrap;
clear: both;
&.header {
a, a:active, a:visited {
padding-bottom: 18px;
color: #555;
text-decoration: none;
opacity: 0.4;
cursor: pointer;
.transition(all 0.2s ease-in-out);
&.header {
a, a:active, a:visited {
padding-bottom: 18px;
color: #555;
text-decoration: none;
opacity: 0.4;
cursor: pointer;
.transition(all 0.2s ease-in-out);
img.ascending, img.descending {
position: relative;
top: -2px;
display: none;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
&.entry {
img.ascending, img.descending {
position: relative;
top: -2px;
display: none;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
&.entry {
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
border-bottom: 1px solid #ddd;
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
border-bottom: 1px solid #ddd;
&:hover, &.hover {
background-color: #f6f6f6;
color: #e80;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
&:hover, &.hover {
background-color: #f6f6f6;
color: #e80;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
.label {
.hint {
margin-left: 12px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
opacity: 1;
background-color: #f6f6f6;
color: #e80;
}
}
}
&.folder-parent {
.date, .size {
display: none;
}
}
&.folder {
.size {
display: none;
}
}
}
.icon, .label, .date, .size {
padding: 6px;
}
.icon {
display: inline-block;
position: absolute;
left: 0;
top: -2px;
width: 16px;
.label {
.hint {
margin-left: 12px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
opacity: 1;
background-color: #f6f6f6;
color: #e80;
}
}
}
&.folder-parent {
.date, .size {
display: none;
}
}
&.folder {
.size {
display: none;
}
}
}
.icon, .label, .date, .size {
padding: 6px;
}
.icon {
display: inline-block;
position: absolute;
left: 0;
top: -2px;
width: 16px;
img {
width: 16px;
height: 16px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.big {
display: none;
}
.label {
display: block;
margin: 0 270px 0 24px;
overflow: hidden;
white-space: nowrap;
text-align: left;
}
.date {
position: absolute;
right: 100px;
top: 0;
text-align: right;
width: 160px;
white-space: nowrap;
}
.size {
position: absolute;
right: 0;
top: 0;
text-align: right;
width: 80px;
white-space: nowrap;
}
&.entry.thumb .icon.small {
overflow: hidden;
padding: 5px;
img {
width: 16px;
height: 16px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.big {
display: none;
}
.label {
display: block;
margin: 0 270px 0 24px;
overflow: hidden;
white-space: nowrap;
text-align: left;
}
.date {
position: absolute;
right: 100px;
top: 0;
text-align: right;
width: 160px;
white-space: nowrap;
}
.size {
position: absolute;
right: 0;
top: 0;
text-align: right;
width: 80px;
white-space: nowrap;
}
&.entry.thumb .icon.small {
overflow: hidden;
padding: 5px;
img {
background-color: #eee;
width: 16px;
height: 16px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
text-align: center;
margin: 50px 0;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
img {
background-color: #eee;
width: 16px;
height: 16px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
text-align: center;
margin: 50px 0;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
}
#selection-rect {
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed rgba(240,100,0,0.5);
background-color: rgba(240,100,0,0.2);
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed rgba(240,100,0,0.5);
background-color: rgba(240,100,0,0.2);
}
#extended.icons-view {
display: none;
padding: 3px;
border: 1px solid #eee;
border-radius: 15px;
display: none;
padding: 3px;
border: 1px solid #eee;
border-radius: 15px;
ul {
margin: 0;
padding: 0;
list-style: none;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
&.header {
display: none;
}
&.entry {
float: left;
li {
&.header {
display: none;
}
&.entry {
float: left;
a, a:active, a:visited {
display: block;
margin: 8px;
padding: 8px;
width: 100px;
height: 120px;
float: left;
text-align: center;
text-decoration: none;
overflow: hidden;
border-radius: 5px;
color: #555;
cursor: pointer;
border: 2px solid rgba(0,0,0,0);
a, a:active, a:visited {
display: block;
margin: 8px;
padding: 8px;
width: 100px;
height: 120px;
float: left;
text-align: center;
text-decoration: none;
overflow: hidden;
border-radius: 5px;
color: #555;
cursor: pointer;
border: 2px solid rgba(0,0,0,0);
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
.icon {
display: block;
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
.icon {
display: block;
img {
min-width: 48px;
min-height: 48px;
margin-bottom: 8px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.small {
display: none;
}
.label {
display: block;
word-wrap: break-word;
}
.date, .size {
display: none;
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
text-decoration: none;
img {
min-width: 48px;
min-height: 48px;
margin-bottom: 8px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.small {
display: none;
}
.label {
display: block;
word-wrap: break-word;
}
.date, .size {
display: none;
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
text-decoration: none;
.label {
.hint {
padding: 0 6px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
}
}
}
&.entry.thumb .icon.big {
width: 100px;
height: 58px;
overflow: hidden;
.label {
.hint {
padding: 0 6px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
}
}
}
&.entry.thumb .icon.big {
width: 100px;
height: 58px;
overflow: hidden;
img {
background-color: #eee;
min-width: 46px;
min-height: 46px;
min-width: 12px;
min-height: 12px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
padding: 16px;
height: 120px;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
img {
background-color: #eee;
min-width: 46px;
min-height: 46px;
min-width: 12px;
min-height: 12px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
padding: 16px;
height: 120px;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
}

View file

@ -4,116 +4,116 @@
html.js {
.hideOnJs {
display: none;
}
.hideOnJs {
display: none;
}
}
html.no-js {
.hideOnNoJs {
display: none;
}
.hideOnNoJs {
display: none;
}
}
body {
font-family: Ubuntu, sans-serif;
font-size: 16px;
color: #555;
background-color: #fff;
margin: 80px 30px;
font-family: Ubuntu, sans-serif;
font-size: 16px;
color: #555;
background-color: #fff;
margin: 80px 30px;
}
body > nav {
position: fixed;
z-index: 1;
width: 100%;
left: 0;
top: 0;
font-size: 0.85em;
background-color: rgb(241,241,241);
border-bottom: 2px solid rgb(210,210,210);
position: fixed;
z-index: 1;
width: 100%;
left: 0;
top: 0;
font-size: 0.85em;
background-color: rgb(241,241,241);
border-bottom: 2px solid rgb(210,210,210);
span.jsDisabledFallback {
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
color: #999;
}
a, a:active, a:visited {
color: #555;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
span.jsDisabledFallback {
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
color: #999;
}
a, a:active, a:visited {
color: #555;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
}
.current a {
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span {
margin-left: 6px;
}
.crumb {
float: left;
border-right: 1px solid rgb(231,231,231);
.hint {
margin-left: 8px;
font-style: italic;
color: #999;
}
img.hint {
width: 10px;
height: 10px;
}
}
.view {
float: right;
border-left: 1px solid rgb(231,231,231);
}
#download {
display: none;
float: right;
border-left: 1px solid rgb(231,231,231);
}
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
}
.current a {
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span {
margin-left: 6px;
}
.crumb {
float: left;
border-right: 1px solid rgb(231,231,231);
.hint {
margin-left: 8px;
font-style: italic;
color: #999;
}
img.hint {
width: 10px;
height: 10px;
}
}
.view {
float: right;
border-left: 1px solid rgb(231,231,231);
}
#download {
display: none;
float: right;
border-left: 1px solid rgb(231,231,231);
}
}
#content {
max-width: 960px;
margin: 0 auto;
max-width: 960px;
margin: 0 auto;
> header {
display: none;
padding-bottom: 10px;
margin-bottom: 80px;
border-bottom: 2px dashed #ddd;
}
> footer {
display: none;
padding-top: 10px;
margin-top: 80px;
border-top: 2px dashed #ddd;
}
> header {
display: none;
padding-bottom: 10px;
margin-bottom: 80px;
border-bottom: 2px dashed #ddd;
}
> footer {
display: none;
padding-top: 10px;
margin-top: 80px;
border-top: 2px dashed #ddd;
}
}
@ -123,114 +123,114 @@ body > nav {
body > footer {
position: fixed;
z-index: 1;
width: 100%;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
background-color: rgb(241,241,241);
border-top: 2px solid rgb(210,210,210);
position: fixed;
z-index: 1;
width: 100%;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
background-color: rgb(241,241,241);
border-top: 2px solid rgb(210,210,210);
color: #999;
font-size: 0.85em;
text-align: center;
color: #999;
font-size: 0.85em;
text-align: center;
a, a:active, a:visited {
color: #555;
text-decoration: none;
.transition(all 0.2s ease-in-out);
opacity: 0.7;
a, a:active, a:visited {
color: #555;
text-decoration: none;
.transition(all 0.2s ease-in-out);
opacity: 0.7;
&:hover {
color: #e80;
opacity: 1;
}
}
.left {
display: block;
padding: 0 8px;
float: left
}
.center {
display: block;
margin: 0 100px;
}
.right {
display: block;
padding: 0 8px;
float: right
}
.noJsMsg {
color: #c33;
margin-left: 16px;
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
}
&.default {
}
&.dynamic {
display: none;
}
}
#langSelector {
position: relative;
cursor: pointer;
&:hover {
color: #e80;
opacity: 1;
}
}
.left {
display: block;
padding: 0 8px;
float: left
}
.center {
display: block;
margin: 0 100px;
}
.right {
display: block;
padding: 0 8px;
float: right
}
.noJsMsg {
color: #c33;
margin-left: 16px;
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
}
&.default {
}
&.dynamic {
display: none;
}
}
#langSelector {
position: relative;
cursor: pointer;
.langOptions {
position: absolute;
z-index: 2;
overflow: auto;
display: none;
right: 0;
top: 0;
max-height: 200px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
.langOptions {
position: absolute;
z-index: 2;
overflow: auto;
display: none;
right: 0;
top: 0;
max-height: 200px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
> .scrollbar {
margin: 0;
width: 6px;
background-color: rgb(210,210,210);
> .scrollbar {
margin: 0;
width: 6px;
background-color: rgb(210,210,210);
.drag {
background-color: rgb(180,180,180);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
.drag {
background-color: rgb(180,180,180);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
li {
padding: 8px 24px 10px 24px;
white-space: nowrap;
border-top: 1px solid rgb(231,231,231);
.transition(all 0.2s ease-in-out);
li {
padding: 8px 24px 10px 24px;
white-space: nowrap;
border-top: 1px solid rgb(231,231,231);
.transition(all 0.2s ease-in-out);
&.current {
color: #333;
background-color: rgba(255,255,255,0.8);
}
&:hover {
color: #e80;
background-color: rgba(255,255,255,0.8);
}
}
li:nth-child(3n+1) {
&.current {
color: #333;
background-color: rgba(255,255,255,0.8);
}
&:hover {
color: #e80;
background-color: rgba(255,255,255,0.8);
}
}
li:nth-child(3n+1) {
}
}
}
}
}
}
}
}
}
@import "responsive";

View file

@ -1,38 +1,38 @@
.border-radius (@radius) {
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
border-radius: @radius;
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
border-radius: @radius;
}
.box-shadow (@shadow) {
-moz-box-shadow: @shadow;
-webkit-box-shadow: @shadow;
box-shadow: @shadow;
-moz-box-shadow: @shadow;
-webkit-box-shadow: @shadow;
box-shadow: @shadow;
}
.transition (@transition) {
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
-webkit-transition: @transition;
transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
-webkit-transition: @transition;
transition: @transition;
}
.transform (@transform) {
-moz-transform: @transform;
-o-transform: @transform;
-webkit-transform: @transform;
transform: @transform;
-moz-transform: @transform;
-o-transform: @transform;
-webkit-transform: @transform;
transform: @transform;
}
.background-size (@size) {
-moz-background-size: @size;
-webkit-background-size: @size;
background-size: @size;
-moz-background-size: @size;
-webkit-background-size: @size;
background-size: @size;
}

View file

@ -1,36 +1,36 @@
@media only screen and (max-width: 500px) {
body > nav {
.view span {
display: none;
}
.view span {
display: none;
}
}
#extended.icons-view {
padding: 0;
border: none;
margin: 0 -14px;
padding: 0;
border: none;
margin: 0 -14px;
}
}
@media only screen and (max-width: 350px) {
body > nav {
.crumb {
display: none;
}
.current {
display: block;
}
.crumb {
display: none;
}
.current {
display: block;
}
}
#extended.details-view {
.header .label, .entry .label {
margin-right: 110px;
}
.header .date, .entry .date {
display: none;
}
.header .label, .entry .label {
margin-right: 110px;
}
.header .date, .entry .date {
display: none;
}
}
body > footer {
.center {
display: none;
}
.center {
display: none;
}
}
}

View file

@ -1,68 +1,68 @@
#table {
table {
display: block;
width: 100%;
border-collapse: collapse;
table {
display: block;
width: 100%;
border-collapse: collapse;
th, td {
padding: 3px 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
th, td {
padding: 3px 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
&:hover, &:hover a {
color: #555;
cursor: pointer;
opacity: 0.9;
}
a, a:visited {
color: #555;
font-weight: normal;
&:hover, &:hover a {
color: #555;
cursor: pointer;
opacity: 0.9;
}
a, a:visited {
color: #555;
font-weight: normal;
img {
width: 12px;
height: 12px;
padding: 0 8px;
}
}
}
td {
border: 1px solid #ddd;
border-left: none;
border-right: none;
}
td:nth-child(1), th:nth-child(1) {
text-align: center;
width: 16px;
img {
width: 12px;
height: 12px;
padding: 0 8px;
}
}
}
td {
border: 1px solid #ddd;
border-left: none;
border-right: none;
}
td:nth-child(1), th:nth-child(1) {
text-align: center;
width: 16px;
img {
width: 16px;
height: 16px;
padding-top: 2px;
}
}
td:nth-child(2), th:nth-child(2) {
width: 682px;
max-width: 682px;
overflow: hidden;
white-space: nowrap;
}
td:nth-child(3), th:nth-child(3) {
text-align: right;
width: 160px;
min-width: 160px;
white-space: nowrap;
}
td:nth-child(4), th:nth-child(4) {
text-align: right;
width: 70px;
min-width: 70px;
white-space: nowrap;
}
}
img {
width: 16px;
height: 16px;
padding-top: 2px;
}
}
td:nth-child(2), th:nth-child(2) {
width: 682px;
max-width: 682px;
overflow: hidden;
white-space: nowrap;
}
td:nth-child(3), th:nth-child(3) {
text-align: right;
width: 160px;
min-width: 160px;
white-space: nowrap;
}
td:nth-child(4), th:nth-child(4) {
text-align: right;
width: 70px;
min-width: 70px;
white-space: nowrap;
}
}
}

View file

@ -1,130 +1,130 @@
#tree {
display: none;
position: fixed;
left: 0;
top: 82px;
z-index: 1;
overflow: auto;
font-size: 0.85em;
padding: 8px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
border-left: none;
.border-radius(0 10px 10px 0);
display: none;
position: fixed;
left: 0;
top: 82px;
z-index: 1;
overflow: auto;
font-size: 0.85em;
padding: 8px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
border-left: none;
.border-radius(0 10px 10px 0);
> .scrollbar {
margin: 8px 8px 8px 0;
width: 6px;
background-color: rgb(210,210,210);
.border-radius(3px);
> .scrollbar {
margin: 8px 8px 8px 0;
width: 6px;
background-color: rgb(210,210,210);
.border-radius(3px);
.drag {
background-color: rgb(180,180,180);
.border-radius(3px);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
.drag {
background-color: rgb(180,180,180);
.border-radius(3px);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
.entry {
.blank, .indicator {
display: inline-block;
width: 16px;
height: 25px;
float: left;
}
.indicator {
opacity: 0.7;
.transition(all 0.2s ease-in-out);
cursor: pointer;
.entry {
.blank, .indicator {
display: inline-block;
width: 16px;
height: 25px;
float: left;
}
.indicator {
opacity: 0.7;
.transition(all 0.2s ease-in-out);
cursor: pointer;
&:hover {
opacity: 1;
}
img {
position: relative;
left: 0;
top: 3px;
width: 12px;
height: 12px;
vertical-align: bottom;
.transition(all 0.2s ease-in-out);
}
&.open {
img {
.transform(rotate(90deg));
}
}
&.unknown {
opacity: 0.3;
}
}
> a, > a:active, > a.visited {
margin-left: 16px;
padding: 4px 6px;
border: 1px solid rgba(0,0,0,0);
.border-radius(5px);
display: block;
color: #555;
text-decoration: none;
opacity: 0.7;
&:hover {
opacity: 1;
}
img {
position: relative;
left: 0;
top: 3px;
width: 12px;
height: 12px;
vertical-align: bottom;
.transition(all 0.2s ease-in-out);
}
&.open {
img {
.transform(rotate(90deg));
}
}
&.unknown {
opacity: 0.3;
}
}
> a, > a:active, > a.visited {
margin-left: 16px;
padding: 4px 6px;
border: 1px solid rgba(0,0,0,0);
.border-radius(5px);
display: block;
color: #555;
text-decoration: none;
opacity: 0.7;
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
.label {
display: inline-block;
}
.icon {
display: inline-block;
width: 20px;
img {
width: 16px;
height: 16px;
vertical-align: bottom;
}
}
.hint {
display: inline-block;
margin-left: 12px;
font-size: 0.9em;
color: #ccc;
img {
width: 10px;
height: 10px;
vertical-align: baseline;
}
}
}
&.file {
display: none;
}
&.current {
> a, > a:active, > a:visited {
border: 1px solid rgb(221,221,221);
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
}
&.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: #e80;
}
}
.hint {
color: #c55;
}
}
.content, ul.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
}
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
.label {
display: inline-block;
}
.icon {
display: inline-block;
width: 20px;
img {
width: 16px;
height: 16px;
vertical-align: bottom;
}
}
.hint {
display: inline-block;
margin-left: 12px;
font-size: 0.9em;
color: #ccc;
img {
width: 10px;
height: 10px;
vertical-align: baseline;
}
}
}
&.file {
display: none;
}
&.current {
> a, > a:active, > a:visited {
border: 1px solid rgb(221,221,221);
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
}
&.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: #e80;
}
}
.hint {
color: #c55;
}
}
.content, ul.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
}
}

View file

@ -1,3 +1,2 @@
@import "inc/main";

View file

@ -3,15 +3,15 @@
#table {
display: none;
display: none;
}
#tree, #content > header, #content > footer {
display: block;
display: block;
}
html.no-js {
#extended.details-view, #extended.icons-view {
display: block;
}
#extended.details-view, #extended.icons-view {
display: block;
}
}

View file

@ -1,34 +1,34 @@
<!-- generated code ends here -->
</section>
<section id="extended" class="clearfix"></section>
<footer></footer>
</section>
<section id="tree"></section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (js)</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-js.js"></script>
<!-- generated code ends here -->
</section>
<section id="extended" class="clearfix"></section>
<footer></footer>
</section>
<section id="tree"></section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (js)</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-js.js"></script>
</body>
</html>

View file

@ -1,4 +1,4 @@
<!-- generated code ends here -->
</section>
<!-- generated code ends here -->
</section>
</body>
</html>

View file

@ -4,28 +4,28 @@
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (js)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-js.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (js)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-js.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
</head>
<body>
<div id="selection-rect"></div>
<nav class="clearfix hideOnNoJs">
<ul id="navbar"></ul>
</nav>
<section id="content">
<header></header>
<section id="table" class="hideOnJs">
<!--
The following code was generated by Apache's autoindex module. It is not valid HTML5, but this
section gets removed from the DOM tree as soon as its information is parsed. The actual page
should render as valid HTML5, even if the produced source is not valid HTML5.
-->
<div id="selection-rect"></div>
<nav class="clearfix hideOnNoJs">
<ul id="navbar"></ul>
</nav>
<section id="content">
<header></header>
<section id="table" class="hideOnJs">
<!--
The following code was generated by Apache's autoindex module. It is not valid HTML5, but this
section gets removed from the DOM tree as soon as its information is parsed. The actual page
should render as valid HTML5, even if the produced source is not valid HTML5.
-->

View file

@ -5,56 +5,56 @@
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<?php include "php/main.php"; ?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $h5ai->getTitle(); ?></title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (php)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-php.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $h5ai->getTitle(); ?></title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (php)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-php.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
</head>
<body>
<div id="selection-rect"></div>
<nav class="clearfix">
<ul id="navbar">
<?php echo $crumb->toHtml(); ?>
</ul>
</nav>
<?php echo $tree->toHtml(); ?>
<section id="content">
<?php echo $customize->getHeader(); ?>
<?php echo $extended->toHtml(); ?>
<?php echo $customize->getFooter(); ?>
</section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (php)</a>
<span class="hideOnJs noJsMsg"> JavaScript is disabled! </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-php.js"></script>
<section id="table">
<!-- The following code was generated by Apache's autoindex module and gets ignored and removed from the DOM tree. -->
<div id="selection-rect"></div>
<nav class="clearfix">
<ul id="navbar">
<?php echo $crumb->toHtml(); ?>
</ul>
</nav>
<?php echo $tree->toHtml(); ?>
<section id="content">
<?php echo $customize->getHeader(); ?>
<?php echo $extended->toHtml(); ?>
<?php echo $customize->getFooter(); ?>
</section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (php)</a>
<span class="hideOnJs noJsMsg"> JavaScript is disabled! </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-php.js"></script>
<section id="table">
<!-- The following code was generated by Apache's autoindex module and gets ignored and removed from the DOM tree. -->

View file

@ -1,115 +1,115 @@
(function ($, H5AI) {
H5AI.connector = (function () {
H5AI.connector = (function () {
var cache = {},
pathnameStatusCache = {},
contentTypeRegEx = /^text\/html;h5ai=/,
getPath = function (folder, tableRow) {
var cache = {},
pathnameStatusCache = {},
contentTypeRegEx = /^text\/html;h5ai=/,
getPath = function (folder, tableRow) {
var absHref = H5AI.util.getAbsHref(folder, tableRow),
path = cache[absHref];
var absHref = H5AI.util.getAbsHref(folder, tableRow),
path = cache[absHref];
if (!path) {
path = H5AI.Path(folder, tableRow);
if (!path.isParentFolder) {
cache[path.absHref] = path;
}
}
if (!path) {
path = H5AI.Path(folder, tableRow);
if (!path.isParentFolder) {
cache[path.absHref] = path;
}
}
return path;
},
fetchStatus = function (pathname, callback) {
return path;
},
fetchStatus = function (pathname, callback) {
if (H5AI.core.settings.folderStatus[pathname]) {
callback(H5AI.core.settings.folderStatus[pathname]);
return;
} else if (pathnameStatusCache[pathname]) {
callback(pathnameStatusCache[pathname]);
return;
}
if (H5AI.core.settings.folderStatus[pathname]) {
callback(H5AI.core.settings.folderStatus[pathname]);
return;
} else if (pathnameStatusCache[pathname]) {
callback(pathnameStatusCache[pathname]);
return;
}
$.ajax({
url: pathname,
type: "HEAD",
complete: function (xhr) {
$.ajax({
url: pathname,
type: "HEAD",
complete: function (xhr) {
var status = xhr.status;
var status = xhr.status;
if (status === 200 && contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
status = "h5ai";
}
pathnameStatusCache[pathname] = status;
callback(status);
}
});
},
updatePath = function (path) {
if (status === 200 && contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
status = "h5ai";
}
pathnameStatusCache[pathname] = status;
callback(status);
}
});
},
updatePath = function (path) {
if (path.isFolder && !path.isParentFolder && path.status === undefined) {
fetchStatus(path.absHref, function (status) {
if (path.isFolder && !path.isParentFolder && path.status === undefined) {
fetchStatus(path.absHref, function (status) {
if (status !== "h5ai") {
path.status = status;
}
H5AI.html.updateHtml(path);
H5AI.core.linkHoverStates();
});
}
},
updatePaths = function () {
if (status !== "h5ai") {
path.status = status;
}
H5AI.html.updateHtml(path);
H5AI.core.linkHoverStates();
});
}
},
updatePaths = function () {
$.each(cache, function (ref, cached) {
updatePath(cached);
});
},
fetchStatusAndContent = function (pathname, includeParent, callback) {
$.each(cache, function (ref, cached) {
updatePath(cached);
});
},
fetchStatusAndContent = function (pathname, includeParent, callback) {
fetchStatus(pathname, function (status) {
fetchStatus(pathname, function (status) {
if (status !== "h5ai") {
callback(status, {});
return;
}
if (status !== "h5ai") {
callback(status, {});
return;
}
$.ajax({
url: pathname,
type: "GET",
dataType: "html",
error: function (xhr) {
$.ajax({
url: pathname,
type: "GET",
dataType: "html",
error: function (xhr) {
callback(xhr.status, {}); // since it was checked before this should never happen
},
success: function (html, status, xhr) {
callback(xhr.status, {}); // since it was checked before this should never happen
},
success: function (html, status, xhr) {
var content = {};
var content = {};
if (!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
callback(xhr.status, {}); // since it was checked before this should never happen
return;
}
if (!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
callback(xhr.status, {}); // since it was checked before this should never happen
return;
}
$(html).find("#table td").closest("tr").each(function () {
$(html).find("#table td").closest("tr").each(function () {
var path = getPath(pathname, this);
var path = getPath(pathname, this);
if (path.isFolder && (!path.isParentFolder || includeParent)) {
content[path.absHref] = path;
updatePath(path);
}
});
callback("h5ai", content);
}
});
});
};
if (path.isFolder && (!path.isParentFolder || includeParent)) {
content[path.absHref] = path;
updatePath(path);
}
});
callback("h5ai", content);
}
});
});
};
return {
getPath: getPath,
updatePaths: updatePaths,
fetchStatusAndContent: fetchStatusAndContent
};
}());
return {
getPath: getPath,
updatePaths: updatePaths,
fetchStatusAndContent: fetchStatusAndContent
};
}());
}(jQuery, H5AI));

View file

@ -1,399 +1,399 @@
(function (window, $, H5AI, config) {
H5AI.core = (function () {
H5AI.core = (function () {
var $window = $(window),
defaults = {
store: {
viewmode: "h5ai.pref.viewmode",
lang: "h5ai.pref.lang"
},
callbacks: {
pathClick: []
},
var $window = $(window),
defaults = {
store: {
viewmode: "h5ai.pref.viewmode",
lang: "h5ai.pref.lang"
},
callbacks: {
pathClick: []
},
rootAbsHref: "/",
h5aiAbsHref: "/_h5ai/",
customHeader: "_h5ai.header.html",
customFooter: "_h5ai.footer.html",
rootAbsHref: "/",
h5aiAbsHref: "/_h5ai/",
customHeader: "_h5ai.header.html",
customFooter: "_h5ai.footer.html",
viewmodes: ["details", "icons"],
sortorder: "na",
showTree: true,
slideTree: true,
folderStatus: {},
lang: null,
useBrowserLang: true,
setParentFolderLabels: true,
linkHoverStates: true,
dateFormat: "yyyy-MM-dd HH:mm",
showThumbs: false,
zippedDownload: false
},
settings = $.extend({}, defaults, config.options),
currentDateFormat = settings.dateFormat,
extToFileType = (function (types) {
var map = {};
$.each(types, function (type, exts) {
$.each(exts, function (idx, ext) {
map[ext] = type;
});
});
return map;
}(config.types)),
api = function () {
viewmodes: ["details", "icons"],
sortorder: "na",
showTree: true,
slideTree: true,
folderStatus: {},
lang: null,
useBrowserLang: true,
setParentFolderLabels: true,
linkHoverStates: true,
dateFormat: "yyyy-MM-dd HH:mm",
showThumbs: false,
zippedDownload: false
},
settings = $.extend({}, defaults, config.options),
currentDateFormat = settings.dateFormat,
extToFileType = (function (types) {
var map = {};
$.each(types, function (type, exts) {
$.each(exts, function (idx, ext) {
map[ext] = type;
});
});
return map;
}(config.types)),
api = function () {
return settings.h5aiAbsHref + "php/api.php";
},
image = function (id) {
return settings.h5aiAbsHref + "php/api.php";
},
image = function (id) {
return settings.h5aiAbsHref + "images/" + id + ".png";
},
icon = function (id, big) {
return settings.h5aiAbsHref + "images/" + id + ".png";
},
icon = function (id, big) {
return settings.h5aiAbsHref + "icons/" + (big ? "48x48" : "16x16") + "/" + id + ".png";
},
viewmode = function (viewmode) {
return settings.h5aiAbsHref + "icons/" + (big ? "48x48" : "16x16") + "/" + id + ".png";
},
viewmode = function (viewmode) {
var $viewDetails = $("#viewdetails"),
$viewIcons = $("#viewicons"),
$extended = $("#extended");
var $viewDetails = $("#viewdetails"),
$viewIcons = $("#viewicons"),
$extended = $("#extended");
if (viewmode) {
amplify.store(settings.store.viewmode, viewmode);
} else {
viewmode = amplify.store(settings.store.viewmode);
}
viewmode = $.inArray(viewmode, settings.viewmodes) >= 0 ? viewmode : settings.viewmodes[0];
if (viewmode) {
amplify.store(settings.store.viewmode, viewmode);
} else {
viewmode = amplify.store(settings.store.viewmode);
}
viewmode = $.inArray(viewmode, settings.viewmodes) >= 0 ? viewmode : settings.viewmodes[0];
$viewDetails.add($viewIcons).removeClass("current");
if (viewmode === "details") {
$viewDetails.addClass("current");
$extended.addClass("details-view").removeClass("icons-view").show();
} else if (viewmode === "icons") {
$viewIcons.addClass("current");
$extended.removeClass("details-view").addClass("icons-view").show();
} else {
$extended.hide();
}
},
initTopSpace = function () {
$viewDetails.add($viewIcons).removeClass("current");
if (viewmode === "details") {
$viewDetails.addClass("current");
$extended.addClass("details-view").removeClass("icons-view").show();
} else if (viewmode === "icons") {
$viewIcons.addClass("current");
$extended.removeClass("details-view").addClass("icons-view").show();
} else {
$extended.hide();
}
},
initTopSpace = function () {
var $body = $("body"),
$tree = $("#tree"),
adjustTopSpace = function () {
var $body = $("body"),
$tree = $("#tree"),
adjustTopSpace = function () {
var winHeight = $window.height(),
navHeight = $("body > nav").outerHeight(),
footerHeight = $("body > footer").outerHeight(),
contentSpacing = 50,
treeSpacing = 30;
var winHeight = $window.height(),
navHeight = $("body > nav").outerHeight(),
footerHeight = $("body > footer").outerHeight(),
contentSpacing = 50,
treeSpacing = 30;
$body.css({
"margin-top": navHeight + contentSpacing,
"margin-bottom": footerHeight + contentSpacing
});
$body.css({
"margin-top": navHeight + contentSpacing,
"margin-bottom": footerHeight + contentSpacing
});
$tree.css({
top: navHeight + treeSpacing,
height: winHeight - navHeight - footerHeight - 18 - 2 * treeSpacing
});
$tree.css({
top: navHeight + treeSpacing,
height: winHeight - navHeight - footerHeight - 18 - 2 * treeSpacing
});
try {
$tree.get(0).updateScrollbar();
} catch (err) {}
};
try {
$tree.get(0).updateScrollbar();
} catch (err) {}
};
$window.resize(function () {
adjustTopSpace();
});
adjustTopSpace();
},
initViews = function () {
$window.resize(function () {
adjustTopSpace();
});
adjustTopSpace();
},
initViews = function () {
var $navbar = $("#navbar"),
$extended = $("#extended");
var $navbar = $("#navbar"),
$extended = $("#extended");
$("#table").remove();
$("#table").remove();
if (settings.viewmodes.length > 1) {
if ($.inArray("icons", settings.viewmodes) >= 0) {
$("<li id='viewicons' class='view'><a href='#'><img alt='view-icons' /><span class='l10n-icons'>icons</span></a></li>")
.find("img").attr("src", image("view-icons")).end()
.click(function () { viewmode("icons"); })
.appendTo($navbar);
}
if ($.inArray("details", settings.viewmodes) >= 0) {
$("<li id='viewdetails' class='view'><a href='#'><img alt='view-details' /><span class='l10n-details'>details</span></a></li>")
.find("img").attr("src", image("view-details")).end()
.click(function () { viewmode("details"); })
.appendTo($navbar);
}
}
if (settings.viewmodes.length > 1) {
if ($.inArray("icons", settings.viewmodes) >= 0) {
$("<li id='viewicons' class='view'><a href='#'><img alt='view-icons' /><span class='l10n-icons'>icons</span></a></li>")
.find("img").attr("src", image("view-icons")).end()
.click(function () { viewmode("icons"); })
.appendTo($navbar);
}
if ($.inArray("details", settings.viewmodes) >= 0) {
$("<li id='viewdetails' class='view'><a href='#'><img alt='view-details' /><span class='l10n-details'>details</span></a></li>")
.find("img").attr("src", image("view-details")).end()
.click(function () { viewmode("details"); })
.appendTo($navbar);
}
}
// status update
$extended.find(".entry a").hover(
function () {
if ($extended.hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
// status update
$extended.find(".entry a").hover(
function () {
if ($extended.hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
},
shiftTree = function (forceVisible, dontAnimate) {
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
},
shiftTree = function (forceVisible, dontAnimate) {
var $tree = $("#tree"),
$extended = $("#extended");
var $tree = $("#tree"),
$extended = $("#extended");
if ((settings.slideTree && $tree.outerWidth() < $extended.offset().left) || forceVisible) {
if (dontAnimate) {
$tree.stop().css({ left: 0 });
} else {
$tree.stop().animate({ left: 0 });
}
} else {
if (dontAnimate) {
$tree.stop().css({ left: 18 - $tree.outerWidth() });
} else {
$tree.stop().animate({ left: 18 - $tree.outerWidth() });
}
}
},
initTree = function () {
if ((settings.slideTree && $tree.outerWidth() < $extended.offset().left) || forceVisible) {
if (dontAnimate) {
$tree.stop().css({ left: 0 });
} else {
$tree.stop().animate({ left: 0 });
}
} else {
if (dontAnimate) {
$tree.stop().css({ left: 18 - $tree.outerWidth() });
} else {
$tree.stop().animate({ left: 18 - $tree.outerWidth() });
}
}
},
initTree = function () {
$("#tree").hover(
function () { shiftTree(true); },
function () { shiftTree(); }
);
$window.resize(function () { shiftTree(); });
shiftTree(false, true);
},
selectLinks = function (href) {
$("#tree").hover(
function () { shiftTree(true); },
function () { shiftTree(); }
);
$window.resize(function () { shiftTree(); });
shiftTree(false, true);
},
selectLinks = function (href) {
var elements = [];
$("a[href^='/']").each(function () {
var elements = [];
$("a[href^='/']").each(function () {
if ($(this).attr("href") === href) {
elements.push(this);
}
});
return $(elements);
},
linkHoverStates = function () {
if ($(this).attr("href") === href) {
elements.push(this);
}
});
return $(elements);
},
linkHoverStates = function () {
if (settings.linkHoverStates) {
$("a[href^='/']:not(.linkedHoverStates)").each(function () {
if (settings.linkHoverStates) {
$("a[href^='/']:not(.linkedHoverStates)").each(function () {
var $a = $(this).addClass("linkedHoverStates"),
href = $a.attr("href");
var $a = $(this).addClass("linkedHoverStates"),
href = $a.attr("href");
$a.hover(
function () { selectLinks(href).addClass("hover"); },
function () { selectLinks(href).removeClass("hover"); }
);
});
}
},
formatDates = function (dateFormat) {
$a.hover(
function () { selectLinks(href).addClass("hover"); },
function () { selectLinks(href).removeClass("hover"); }
);
});
}
},
formatDates = function (dateFormat) {
if (dateFormat) {
currentDateFormat = dateFormat;
}
if (dateFormat) {
currentDateFormat = dateFormat;
}
$("#extended .entry .date").each(function () {
$("#extended .entry .date").each(function () {
var $this = $(this),
time = $this.data("time"),
formattedDate = time ? new Date(time).toString(currentDateFormat) : "";
var $this = $(this),
time = $this.data("time"),
formattedDate = time ? new Date(time).toString(currentDateFormat) : "";
$this.text(formattedDate);
});
},
localize = function (langs, lang, useBrowserLang) {
$this.text(formattedDate);
});
},
localize = function (langs, lang, useBrowserLang) {
var storedLang = amplify.store(settings.store.lang),
browserLang, selected, key;
var storedLang = amplify.store(settings.store.lang),
browserLang, selected, key;
if (langs[storedLang]) {
lang = storedLang;
} else if (useBrowserLang) {
browserLang = navigator.language;
if (langs[browserLang]) {
lang = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
lang = browserLang.substr(0, 2);
}
}
if (langs[storedLang]) {
lang = storedLang;
} else if (useBrowserLang) {
browserLang = navigator.language;
if (langs[browserLang]) {
lang = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
lang = browserLang.substr(0, 2);
}
}
if (!langs[lang]) {
lang = "en";
}
if (!langs[lang]) {
lang = "en";
}
selected = langs[lang];
if (selected) {
$.each(selected, function (key, value) {
$(".l10n-" + key).text(value);
});
$(".lang").text(lang);
$(".langOption").removeClass("current");
$(".langOption." + lang).addClass("current");
}
selected = langs[lang];
if (selected) {
$.each(selected, function (key, value) {
$(".l10n-" + key).text(value);
});
$(".lang").text(lang);
$(".langOption").removeClass("current");
$(".langOption." + lang).addClass("current");
}
formatDates(selected.dateFormat || settings.dateFormat);
},
initLangSelector = function (langs) {
formatDates(selected.dateFormat || settings.dateFormat);
},
initLangSelector = function (langs) {
var $langOptions = $("#langSelector .langOptions"),
sortedLangsKeys = [],
$ul;
var $langOptions = $("#langSelector .langOptions"),
sortedLangsKeys = [],
$ul;
$.each(langs, function (lang) {
sortedLangsKeys.push(lang);
});
sortedLangsKeys.sort();
$.each(langs, function (lang) {
sortedLangsKeys.push(lang);
});
sortedLangsKeys.sort();
$ul = $("<ul />");
$.each(sortedLangsKeys, function (idx, lang) {
$("<li class='langOption' />")
.addClass(lang)
.text(lang + " - " + langs[lang].lang)
.appendTo($ul)
.click(function () {
amplify.store(settings.store.lang, lang);
localize(langs, lang, false);
});
});
$langOptions
.append($ul)
.scrollpanel();
$ul = $("<ul />");
$.each(sortedLangsKeys, function (idx, lang) {
$("<li class='langOption' />")
.addClass(lang)
.text(lang + " - " + langs[lang].lang)
.appendTo($ul)
.click(function () {
amplify.store(settings.store.lang, lang);
localize(langs, lang, false);
});
});
$langOptions
.append($ul)
.scrollpanel();
$("#langSelector").hover(
function () {
$langOptions
.css("top", "-" + $langOptions.outerHeight() + "px")
.stop(true, true)
.fadeIn();
$langOptions.get(0).updateScrollbar();
},
function () {
$langOptions
.stop(true, true)
.fadeOut();
}
);
},
onIndicatorClick = function (event) {
$("#langSelector").hover(
function () {
$langOptions
.css("top", "-" + $langOptions.outerHeight() + "px")
.stop(true, true)
.fadeIn();
$langOptions.get(0).updateScrollbar();
},
function () {
$langOptions
.stop(true, true)
.fadeOut();
}
);
},
onIndicatorClick = function (event) {
var $indicator = $(this),
$entry = $indicator.closest(".entry"),
updateTreeScrollbar = $("#tree").get(0).updateScrollbar;
var $indicator = $(this),
$entry = $indicator.closest(".entry"),
updateTreeScrollbar = $("#tree").get(0).updateScrollbar;
if ($indicator.hasClass("unknown")) {
$.get(api(), { "action": "tree", "href": $entry.find("> a").attr("href") }, function (html) {
if ($indicator.hasClass("unknown")) {
$.get(api(), { "action": "tree", "href": $entry.find("> a").attr("href") }, function (html) {
var $content = $(html);
var $content = $(html);
$indicator.removeClass("unknown");
if ($content.find("> li").size() === 0) {
$indicator.replaceWith($("<span class='blank' />"));
} else {
$indicator.addClass("open");
$entry.find("> .content").replaceWith($content);
updateTreeScrollbar();
$content.find(".indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
}
});
} else if ($indicator.hasClass("open")) {
$indicator.removeClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideUp(function () {
updateTreeScrollbar();
});
} else {
$indicator.addClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideDown(function () {
updateTreeScrollbar();
});
}
},
initIndicators = function () {
$indicator.removeClass("unknown");
if ($content.find("> li").size() === 0) {
$indicator.replaceWith($("<span class='blank' />"));
} else {
$indicator.addClass("open");
$entry.find("> .content").replaceWith($content);
updateTreeScrollbar();
$content.find(".indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
}
});
} else if ($indicator.hasClass("open")) {
$indicator.removeClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideUp(function () {
updateTreeScrollbar();
});
} else {
$indicator.addClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideDown(function () {
updateTreeScrollbar();
});
}
},
initIndicators = function () {
$("#tree .entry.folder .indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
},
getFileType = function (filename) {
$("#tree .entry.folder .indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
},
getFileType = function (filename) {
var dotidx = filename.lastIndexOf('.'),
ext = dotidx >= 0 ? filename.substr(dotidx) : filename;
var dotidx = filename.lastIndexOf('.'),
ext = dotidx >= 0 ? filename.substr(dotidx) : filename;
return extToFileType[ext.toLowerCase()] || "unknown";
},
formatSizes = function () {
return extToFileType[ext.toLowerCase()] || "unknown";
},
formatSizes = function () {
$("#extended .entry .size").each(function () {
$("#extended .entry .size").each(function () {
var $this = $(this),
bytes = $this.data("bytes"),
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
var $this = $(this),
bytes = $this.data("bytes"),
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
$this.text(formattedSize);
});
},
setTotals = function () {
$this.text(formattedSize);
});
},
setTotals = function () {
var $extended = $("#extended");
var $extended = $("#extended");
$(".folderTotal").text($extended.find(".entry.folder:not(.folder-parent)").length);
$(".fileTotal").text($extended.find(".entry.file").length);
},
init = function () {
$(".folderTotal").text($extended.find(".entry.folder:not(.folder-parent)").length);
$(".fileTotal").text($extended.find(".entry.file").length);
},
init = function () {
initViews();
viewmode();
initTopSpace();
initTree();
linkHoverStates();
initLangSelector(config.langs);
localize(config.langs, settings.lang, settings.useBrowserLang);
formatSizes();
setTotals();
initIndicators();
};
initViews();
viewmode();
initTopSpace();
initTree();
linkHoverStates();
initLangSelector(config.langs);
localize(config.langs, settings.lang, settings.useBrowserLang);
formatSizes();
setTotals();
initIndicators();
};
return {
settings: settings,
api: api,
image: image,
icon: icon,
shiftTree: shiftTree,
linkHoverStates: linkHoverStates,
initIndicators: initIndicators,
formatDates: formatDates,
getFileType: getFileType,
init: init
};
}());
return {
settings: settings,
api: api,
image: image,
icon: icon,
shiftTree: shiftTree,
linkHoverStates: linkHoverStates,
initIndicators: initIndicators,
formatDates: formatDates,
getFileType: getFileType,
init: init
};
}());
}(window, jQuery, H5AI, H5AI_CONFIG));

View file

@ -1,127 +1,127 @@
(function (document, $, H5AI) {
H5AI.extended = (function () {
H5AI.extended = (function () {
var initBreadcrumb = function () {
var initBreadcrumb = function () {
var $ul = $("body > nav ul"),
pathname = "/",
path = H5AI.connector.getPath(pathname),
pathnameParts = document.location.pathname.split("/"),
lastPart = "",
title = document.domain;
var $ul = $("body > nav ul"),
pathname = "/",
path = H5AI.connector.getPath(pathname),
pathnameParts = document.location.pathname.split("/"),
lastPart = "",
title = document.domain;
$ul.append(H5AI.html.updateCrumbHtml(path));
$ul.append(H5AI.html.updateCrumbHtml(path));
$.each(pathnameParts, function (idx, part) {
if (part !== "") {
pathname += part + "/";
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
lastPart = part + " - ";
title += " > " + part;
}
});
$.each(pathnameParts, function (idx, part) {
if (part !== "") {
pathname += part + "/";
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
lastPart = part + " - ";
title += " > " + part;
}
});
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
},
initExtendedView = function () {
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
},
initExtendedView = function () {
var $ul, $li;
var $ul, $li;
$ul = $("<ul/>");
$li = $("<li class='header' />")
.appendTo($ul)
.append($("<a class='icon'></a>"))
.append($("<a class='label' href='#'><span class='l10n-name'></span></a>"))
.append($("<a class='date' href='#'><span class='l10n-lastModified'></span></a>"))
.append($("<a class='size' href='#'><span class='l10n-size'></span></a>"));
$ul = $("<ul/>");
$li = $("<li class='header' />")
.appendTo($ul)
.append($("<a class='icon'></a>"))
.append($("<a class='label' href='#'><span class='l10n-name'></span></a>"))
.append($("<a class='date' href='#'><span class='l10n-lastModified'></span></a>"))
.append($("<a class='size' href='#'><span class='l10n-size'></span></a>"));
// entries
$("#table td").closest("tr").each(function () {
var path = H5AI.connector.getPath(document.location.pathname, this);
$ul.append(H5AI.html.updateExtendedHtml(path));
});
// entries
$("#table td").closest("tr").each(function () {
var path = H5AI.connector.getPath(document.location.pathname, this);
$ul.append(H5AI.html.updateExtendedHtml(path));
});
$("#extended").append($ul);
$("#extended").append($ul);
// empty
if ($ul.children(".entry:not(.folder-parent)").size() === 0) {
$("#extended").append($("<div class='empty l10n-empty'>empty</div>"));
}
},
customize = function () {
// empty
if ($ul.children(".entry:not(.folder-parent)").size() === 0) {
$("#extended").append($("<div class='empty l10n-empty'>empty</div>"));
}
},
customize = function () {
$.ajax({
url: H5AI.core.settings.customHeader,
dataType: "html",
success: function (data) {
$("#content > header").append($(data)).show();
}
});
$.ajax({
url: H5AI.core.settings.customHeader,
dataType: "html",
success: function (data) {
$("#content > header").append($(data)).show();
}
});
$.ajax({
url: H5AI.core.settings.customFooter,
dataType: "html",
success: function (data) {
$("#content > footer").prepend($(data)).show();
}
});
},
fetchPath = function (pathname, callback) {
$.ajax({
url: H5AI.core.settings.customFooter,
dataType: "html",
success: function (data) {
$("#content > footer").prepend($(data)).show();
}
});
},
fetchPath = function (pathname, callback) {
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
var path = H5AI.connector.getPath(pathname);
var path = H5AI.connector.getPath(pathname);
path.status = status;
path.content = content;
callback(path);
});
},
fetchTree = function (pathname, callback, childPath) {
path.status = status;
path.content = content;
callback(path);
});
},
fetchTree = function (pathname, callback, childPath) {
fetchPath(pathname, function (path) {
fetchPath(pathname, function (path) {
var parent = H5AI.util.splitPath(pathname).parent;
var parent = H5AI.util.splitPath(pathname).parent;
path.treeOpen = true;
if (childPath) {
path.content[childPath.absHref] = childPath;
}
if (parent === null) {
callback(path);
} else {
fetchTree(parent, callback, path);
}
});
},
populateTree = function () {
path.treeOpen = true;
if (childPath) {
path.content[childPath.absHref] = childPath;
}
if (parent === null) {
callback(path);
} else {
fetchTree(parent, callback, path);
}
});
},
populateTree = function () {
fetchTree(document.location.pathname, function (path) {
$("#tree")
.append(H5AI.html.updateTreeHtml(path))
.scrollpanel()
.show();
H5AI.core.shiftTree(false, true);
H5AI.core.linkHoverStates();
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
});
},
init = function () {
fetchTree(document.location.pathname, function (path) {
$("#tree")
.append(H5AI.html.updateTreeHtml(path))
.scrollpanel()
.show();
H5AI.core.shiftTree(false, true);
H5AI.core.linkHoverStates();
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
});
},
init = function () {
initBreadcrumb();
initExtendedView();
customize();
H5AI.connector.updatePaths();
if (H5AI.core.settings.showTree) {
populateTree();
}
};
initBreadcrumb();
initExtendedView();
customize();
H5AI.connector.updatePaths();
if (H5AI.core.settings.showTree) {
populateTree();
}
};
return {
init: init
};
}());
return {
init: init
};
}());
}(document, jQuery, H5AI));

View file

@ -1,264 +1,264 @@
(function ($, H5AI) {
H5AI.html = (function () {
H5AI.html = (function () {
var thumbTypes = ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
onClick = function (path, context) {
var thumbTypes = ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
onClick = function (path, context) {
},
updateCrumbHtml = function (path) {
},
updateCrumbHtml = function (path) {
var $html, $a;
var $html, $a;
if (path.html.$crumb && path.html.$crumb.data("status") === path.status) {
return path.html.$crumb;
}
if (path.html.$crumb && path.html.$crumb.data("status") === path.status) {
return path.html.$crumb;
}
$html = $("<li class='crumb'><a><img alt='>' /><span></span></a></li>")
.addClass(path.isFolder ? "folder" : "file");
$html = $("<li class='crumb'><a><img alt='>' /><span></span></a></li>")
.addClass(path.isFolder ? "folder" : "file");
if (path.status) {
$html.data("status", path.status);
}
if (path.status) {
$html.data("status", path.status);
}
$a = $html.find("a")
.attr("href", path.absHref)
.click(function() { onClick(path, "crumb"); })
.find("img").attr("src", H5AI.core.image("crumb")).end()
.find("span").text(path.label).end();
$a = $html.find("a")
.attr("href", path.absHref)
.click(function() { onClick(path, "crumb"); })
.find("img").attr("src", H5AI.core.image("crumb")).end()
.find("span").text(path.label).end();
if (path.isDomain) {
$html.addClass("domain");
$a.find("img").attr("src", H5AI.core.image("home"));
}
if (path.isDomain) {
$html.addClass("domain");
$a.find("img").attr("src", H5AI.core.image("home"));
}
if (path.isCurrentFolder) {
$html.addClass("current");
}
if (path.isCurrentFolder) {
$html.addClass("current");
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.append($("<img class='hint' src='" + H5AI.core.image("page") + "' alt='not listable' />"));
} else {
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
}
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.append($("<img class='hint' src='" + H5AI.core.image("page") + "' alt='not listable' />"));
} else {
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
}
}
if (path.html.$crumb) {
path.html.$crumb.replaceWith($html);
}
path.html.$crumb = $html;
if (path.html.$crumb) {
path.html.$crumb.replaceWith($html);
}
path.html.$crumb = $html;
return $html;
},
updateExtendedHtml = function (path) {
return $html;
},
updateExtendedHtml = function (path) {
var $html, $a, $label,
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
imgClass = "",
icon16 = H5AI.core.icon(path.type),
icon48 = H5AI.core.icon(path.type, true);
var $html, $a, $label,
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
imgClass = "",
icon16 = H5AI.core.icon(path.type),
icon48 = H5AI.core.icon(path.type, true);
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
return path.html.$extended;
}
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
return path.html.$extended;
}
$html = $("<li class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
$html = $("<li class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
if (path.status) {
$html.data("status", path.status);
}
if (path.status) {
$html.data("status", path.status);
}
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, thumbTypes) >= 0) {
imgClass = "class='thumb'";
icon16 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=16&height=16&mode=square";
icon48 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=96&height=46&mode=rational";
}
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, thumbTypes) >= 0) {
imgClass = "class='thumb'";
icon16 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=16&height=16&mode=square";
icon48 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=96&height=46&mode=rational";
}
$label = $("<span class='label'>" + path.label + "</span>");
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "extended"); })
.appendTo($html)
.append($("<span class='icon small'><img " + imgClass + " src='" + icon16 + "' alt='" + path.type + "' /></span>"))
.append($("<span class='icon big'><img " + imgClass + " src='" + icon48 + "' alt='" + path.type + "' /></span>"))
.append($label)
.append($("<span class='date' data-time='" + path.time + "'></span>"))
.append($("<span class='size' data-bytes='" + path.size + "'></span>"));
$label = $("<span class='label'>" + path.label + "</span>");
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "extended"); })
.appendTo($html)
.append($("<span class='icon small'><img " + imgClass + " src='" + icon16 + "' alt='" + path.type + "' /></span>"))
.append($("<span class='icon big'><img " + imgClass + " src='" + icon48 + "' alt='" + path.type + "' /></span>"))
.append($label)
.append($("<span class='date' data-time='" + path.time + "'></span>"))
.append($("<span class='size' data-bytes='" + path.size + "'></span>"));
$a.hover(
function () {
if ($("#extended").hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
$a.hover(
function () {
if ($("#extended").hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
if (path.isParentFolder) {
if (!H5AI.core.settings.setParentFolderLabels) {
$label.addClass("l10n-parentDirectory");
}
$html.addClass("folder-parent");
}
if (path.isParentFolder) {
if (!H5AI.core.settings.setParentFolderLabels) {
$label.addClass("l10n-parentDirectory");
}
$html.addClass("folder-parent");
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$html.addClass("page");
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-page"));
$a.find(".icon.big img").attr("src", H5AI.core.icon("folder-page", true));
} else {
$html.addClass("error");
$label.append($("<span class='hint'> " + path.status + " </span>"));
}
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$html.addClass("page");
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-page"));
$a.find(".icon.big img").attr("src", H5AI.core.icon("folder-page", true));
} else {
$html.addClass("error");
$label.append($("<span class='hint'> " + path.status + " </span>"));
}
}
if (path.html.$extended) {
path.html.$extended.replaceWith($html);
H5AI.core.formatDates();
}
path.html.$extended = $html;
if (path.html.$extended) {
path.html.$extended.replaceWith($html);
H5AI.core.formatDates();
}
path.html.$extended = $html;
return $html;
},
updateTreeHtml = function (path) {
return $html;
},
updateTreeHtml = function (path) {
var $html, $blank, $a, $indicator, $ul, idx;
var $html, $blank, $a, $indicator, $ul, idx;
$html = $("<div class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
$html = $("<div class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
$blank = $("<span class='blank' />").appendTo($html);
$blank = $("<span class='blank' />").appendTo($html);
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "tree"); })
.appendTo($html)
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
.append($("<span class='label'>" + path.label + "</span>"));
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "tree"); })
.appendTo($html)
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
.append($("<span class='label'>" + path.label + "</span>"));
if (path.isFolder) {
// indicator
if (path.status === undefined || !path.isEmpty()) {
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
.click(function (event) {
if (path.isFolder) {
// indicator
if (path.status === undefined || !path.isEmpty()) {
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
.click(function (event) {
var $entry = $indicator.closest(".entry"); // $html
var $entry = $indicator.closest(".entry"); // $html
if ($indicator.hasClass("unknown")) {
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
if ($indicator.hasClass("unknown")) {
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
path.status = status;
path.content = content;
path.treeOpen = true;
$("#tree").get(0).updateScrollbar(true);
updateTreeHtml(path);
$("#tree").get(0).updateScrollbar();
});
} else if ($indicator.hasClass("open")) {
path.treeOpen = false;
$indicator.removeClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideUp(function() {
path.status = status;
path.content = content;
path.treeOpen = true;
$("#tree").get(0).updateScrollbar(true);
updateTreeHtml(path);
$("#tree").get(0).updateScrollbar();
});
} else if ($indicator.hasClass("open")) {
path.treeOpen = false;
$indicator.removeClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideUp(function() {
$("#tree").get(0).updateScrollbar();
});
} else {
path.treeOpen = true;
$indicator.addClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideDown(function() {
$("#tree").get(0).updateScrollbar();
});
} else {
path.treeOpen = true;
$indicator.addClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideDown(function() {
$("#tree").get(0).updateScrollbar();
});
}
$("#tree").get(0).updateScrollbar();
});
}
});
});
if (path.status === undefined) {
$indicator.addClass("unknown");
} else if (path.treeOpen) {
$indicator.addClass("open");
}
if (path.status === undefined) {
$indicator.addClass("unknown");
} else if (path.treeOpen) {
$indicator.addClass("open");
}
$blank.replaceWith($indicator);
}
$blank.replaceWith($indicator);
}
// is path the domain?
if (path.isDomain) {
$html.addClass("domain");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
}
// is path the domain?
if (path.isDomain) {
$html.addClass("domain");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
}
// is path the current folder?
if (path.isCurrentFolder) {
$html.addClass("current");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-open"));
}
// is path the current folder?
if (path.isCurrentFolder) {
$html.addClass("current");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-open"));
}
// does it have subfolders?
if (!path.isEmpty()) {
$ul = $("<ul class='content' />").appendTo($html);
$.each(path.content, function (idx, entry) {
$("<li />").append(updateTreeHtml(entry)).appendTo($ul);
});
if (path.status === undefined || !path.treeOpen) {
$ul.hide();
}
}
// does it have subfolders?
if (!path.isEmpty()) {
$ul = $("<ul class='content' />").appendTo($html);
$.each(path.content, function (idx, entry) {
$("<li />").append(updateTreeHtml(entry)).appendTo($ul);
});
if (path.status === undefined || !path.treeOpen) {
$ul.hide();
}
}
// reflect folder status
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
} else {
$html.addClass("error");
$a.append($("<span class='hint'>" + path.status + "</span>"));
}
}
}
// reflect folder status
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
} else {
$html.addClass("error");
$a.append($("<span class='hint'>" + path.status + "</span>"));
}
}
}
if (path.html.$tree) {
path.html.$tree.replaceWith($html);
}
path.html.$tree = $html;
if (path.html.$tree) {
path.html.$tree.replaceWith($html);
}
path.html.$tree = $html;
return $html;
},
updateHtml = function (path) {
return $html;
},
updateHtml = function (path) {
updateCrumbHtml(path);
updateExtendedHtml(path);
updateTreeHtml(path);
};
updateCrumbHtml(path);
updateExtendedHtml(path);
updateTreeHtml(path);
};
return {
updateCrumbHtml: updateCrumbHtml,
updateExtendedHtml: updateExtendedHtml,
updateTreeHtml: updateTreeHtml,
updateHtml: updateHtml
};
}());
return {
updateCrumbHtml: updateCrumbHtml,
updateExtendedHtml: updateExtendedHtml,
updateTreeHtml: updateTreeHtml,
updateHtml: updateHtml
};
}());
}(jQuery, H5AI));

View file

@ -1,95 +1,95 @@
(function (document, $, H5AI) {
H5AI.Path = function (folder, tableRow) {
H5AI.Path = function (folder, tableRow) {
var path = {},
$tds, $a, date, size, splits;
var path = {},
$tds, $a, date, size, splits;
// path.parentFolder: undefined
// path.label: undefined
// path.type: undefined
// path.href: undefined
// path.time: undefined
// path.size: undefined
// path.absHref: undefined
// path.isFolder: undefined
// path.isParentFolder: undefined
// path.isCurrentFolder: undefined
// path.isDomain: undefined
// path.parentFolder: undefined
// path.label: undefined
// path.type: undefined
// path.href: undefined
// path.time: undefined
// path.size: undefined
// path.absHref: undefined
// path.isFolder: undefined
// path.isParentFolder: undefined
// path.isCurrentFolder: undefined
// path.isDomain: undefined
path.status = undefined; // undefined, "h5ai" or HTTP response code
path.content = undefined; // associative array path.absHref -> path
path.html = {
$crumb: undefined,
$extended: undefined,
$tree: undefined
};
path.treeOpen = false;
path.status = undefined; // undefined, "h5ai" or HTTP response code
path.content = undefined; // associative array path.absHref -> path
path.html = {
$crumb: undefined,
$extended: undefined,
$tree: undefined
};
path.treeOpen = false;
if (!H5AI.util.pathEndsWithSlash(folder)) {
folder += "/";
}
if (!H5AI.util.pathEndsWithSlash(folder)) {
folder += "/";
}
if (tableRow) {
$tds = $(tableRow).find("td");
$a = $tds.eq(1).find("a");
date = Date.parse($tds.eq(2).text());
size = H5AI.util.parseSize($tds.eq(3).text());
if (tableRow) {
$tds = $(tableRow).find("td");
$a = $tds.eq(1).find("a");
date = Date.parse($tds.eq(2).text());
size = H5AI.util.parseSize($tds.eq(3).text());
path.parentFolder = folder;
path.label = $a.text();
path.type = $tds.eq(0).find("img").attr("alt") === "[DIR]" ? "folder" : H5AI.core.getFileType(path.label);
path.href = $a.attr("href");
path.time = date ? date.getTime() : 0;
path.size = size;
} else {
splits = H5AI.util.splitPath(folder);
path.parentFolder = folder;
path.label = $a.text();
path.type = $tds.eq(0).find("img").attr("alt") === "[DIR]" ? "folder" : H5AI.core.getFileType(path.label);
path.href = $a.attr("href");
path.time = date ? date.getTime() : 0;
path.size = size;
} else {
splits = H5AI.util.splitPath(folder);
path.parentFolder = splits.parent || "";
path.label = H5AI.util.checkedDecodeUri(splits.name);
if (path.label === "/") {
path.label = H5AI.util.checkedDecodeUri(document.domain);
}
path.type = "folder";
path.href = splits.name;
path.time = 0;
path.size = -1;
}
path.parentFolder = splits.parent || "";
path.label = H5AI.util.checkedDecodeUri(splits.name);
if (path.label === "/") {
path.label = H5AI.util.checkedDecodeUri(document.domain);
}
path.type = "folder";
path.href = splits.name;
path.time = 0;
path.size = -1;
}
if (H5AI.util.pathEndsWithSlash(path.label)) {
path.label = path.label.slice(0, -1);
}
if (H5AI.util.pathEndsWithSlash(path.label)) {
path.label = path.label.slice(0, -1);
}
path.isFolder = (path.type === "folder");
path.isParentFolder = (path.label === "Parent Directory");
if (path.isParentFolder) {
path.isFolder = true;
path.type = "folder-parent";
}
path.absHref = path.isParentFolder ? path.href : path.parentFolder + path.href;
path.isCurrentFolder = (path.absHref === document.location.pathname);
path.isDomain = (path.absHref === "/");
path.isFolder = (path.type === "folder");
path.isParentFolder = (path.label === "Parent Directory");
if (path.isParentFolder) {
path.isFolder = true;
path.type = "folder-parent";
}
path.absHref = path.isParentFolder ? path.href : path.parentFolder + path.href;
path.isCurrentFolder = (path.absHref === document.location.pathname);
path.isDomain = (path.absHref === "/");
if (path.isParentFolder && H5AI.core.settings.setParentFolderLabels) {
if (path.isDomain) {
path.label = H5AI.util.checkedDecodeUri(document.domain);
} else {
splits = H5AI.util.splitPath(path.parentFolder);
path.label = H5AI.util.checkedDecodeUri(splits.parentname);
}
}
if (path.isParentFolder && H5AI.core.settings.setParentFolderLabels) {
if (path.isDomain) {
path.label = H5AI.util.checkedDecodeUri(document.domain);
} else {
splits = H5AI.util.splitPath(path.parentFolder);
path.label = H5AI.util.checkedDecodeUri(splits.parentname);
}
}
path.isEmpty = function () {
path.isEmpty = function () {
return !path.content || $.isEmptyObject(path.content);
};
path.onClick = function (context) {
return !path.content || $.isEmptyObject(path.content);
};
path.onClick = function (context) {
H5AI.core.triggerPathClick(path, context);
};
H5AI.core.triggerPathClick(path, context);
};
return path;
};
return path;
};
}(document, jQuery, H5AI));

View file

@ -1,157 +1,157 @@
(function ($, H5AI) {
H5AI.sort = (function () {
H5AI.sort = (function () {
var type = function (entry) {
var type = function (entry) {
var $entry = $(entry);
var $entry = $(entry);
if ($entry.hasClass("folder-parent")) {
return 0;
} else if ($entry.hasClass("folder")) {
return 1;
}
return 2;
},
cmp = function (entry1, entry2, rev, getVal) {
if ($entry.hasClass("folder-parent")) {
return 0;
} else if ($entry.hasClass("folder")) {
return 1;
}
return 2;
},
cmp = function (entry1, entry2, rev, getVal) {
var res, val1, val2;
var res, val1, val2;
res = type(entry1) - type(entry2);
if (res !== 0) {
return res;
}
res = type(entry1) - type(entry2);
if (res !== 0) {
return res;
}
val1 = getVal(entry1);
val2 = getVal(entry2);
if (val1 < val2) {
return rev ? 1 : -1;
} else if (val1 > val2) {
return rev ? -1 : 1;
}
return 0;
},
cmpName = function (entry1, entry2) {
val1 = getVal(entry1);
val2 = getVal(entry2);
if (val1 < val2) {
return rev ? 1 : -1;
} else if (val1 > val2) {
return rev ? -1 : 1;
}
return 0;
},
cmpName = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTime = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTime = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSize = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSize = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
cmpNameRev = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
cmpNameRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTimeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTimeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSizeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSizeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
sort = function (fn) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
sort = function (fn) {
$("#extended .entry").detach().sort(fn).appendTo($("#extended > ul"));
},
$all, orders,
sortBy = function (id) {
$("#extended .entry").detach().sort(fn).appendTo($("#extended > ul"));
},
$all, orders,
sortBy = function (id) {
var order = orders[id];
var order = orders[id];
$all.removeClass("ascending").removeClass("descending");
order.head.addClass(order.clas).attr("href", "#!/sort=" + id);
sort(order.fn);
},
init = function () {
$all.removeClass("ascending").removeClass("descending");
order.head.addClass(order.clas).attr("href", "#!/sort=" + id);
sort(order.fn);
},
init = function () {
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
initialOrder = /^.*#!.*\/sort=(.*?)(?:\/.*)?$/.exec(document.location),
$header = $("#extended li.header"),
$label = $header.find("a.label"),
$date = $header.find("a.date"),
$size = $header.find("a.size");
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
initialOrder = /^.*#!.*\/sort=(.*?)(?:\/.*)?$/.exec(document.location),
$header = $("#extended li.header"),
$label = $header.find("a.label"),
$date = $header.find("a.date"),
$size = $header.find("a.size");
$all = $header.find("a.label,a.date,a.size");
orders = {
na: {
head: $label,
clas: "ascending",
fn: cmpName
},
nd: {
head: $label,
clas: "descending",
fn: cmpNameRev
},
da: {
head: $date,
clas: "ascending",
fn: cmpTime
},
dd: {
head: $date,
clas: "descending",
fn: cmpTimeRev
},
sa: {
head: $size,
clas: "ascending",
fn: cmpSize
},
sd: {
head: $size,
clas: "descending",
fn: cmpSizeRev
}
};
$all = $header.find("a.label,a.date,a.size");
orders = {
na: {
head: $label,
clas: "ascending",
fn: cmpName
},
nd: {
head: $label,
clas: "descending",
fn: cmpNameRev
},
da: {
head: $date,
clas: "ascending",
fn: cmpTime
},
dd: {
head: $date,
clas: "descending",
fn: cmpTimeRev
},
sa: {
head: $size,
clas: "ascending",
fn: cmpSize
},
sd: {
head: $size,
clas: "descending",
fn: cmpSizeRev
}
};
sortBy(initialOrder ? initialOrder[1] : H5AI.core.settings.sortorder);
sortBy(initialOrder ? initialOrder[1] : H5AI.core.settings.sortorder);
$label
.attr("href", "#!/sort=na")
.append($ascending.clone()).append($descending.clone())
.click(function () {
sortBy("n" + ($label.hasClass("ascending") ? "d" : "a"));
});
$label
.attr("href", "#!/sort=na")
.append($ascending.clone()).append($descending.clone())
.click(function () {
sortBy("n" + ($label.hasClass("ascending") ? "d" : "a"));
});
$date
.attr("href", "#!/sort=da")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("d" + ($date.hasClass("ascending") ? "d" : "a"));
});
$date
.attr("href", "#!/sort=da")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("d" + ($date.hasClass("ascending") ? "d" : "a"));
});
$size
.attr("href", "#!/sort=sa")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("s" + ($size.hasClass("ascending") ? "d" : "a"));
});
};
$size
.attr("href", "#!/sort=sa")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("s" + ($size.hasClass("ascending") ? "d" : "a"));
});
};
return {
init: init
};
}());
return {
init: init
};
}());
}(jQuery, H5AI));

View file

@ -1,115 +1,115 @@
(function ($, H5AI) {
H5AI.util = (function () {
H5AI.util = (function () {
var reSplitPath = /^\/([^\/]+\/?)$/,
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
splitPath = function (pathname) {
var reSplitPath = /^\/([^\/]+\/?)$/,
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
splitPath = function (pathname) {
var match;
var match;
if (pathname === "/") {
return {
parent: null,
parentname: null,
name: "/"
};
}
match = reSplitPath2.exec(pathname);
if (match) {
return {
parent: match[1],
parentname: match[2],
name: match[3]
};
}
match = reSplitPath.exec(pathname);
if (match) {
return {
parent: "/",
parentname: "/",
name: match[1]
};
}
},
rePathEndsWithSlash = /\/$/,
pathEndsWithSlash = function (pathname) {
if (pathname === "/") {
return {
parent: null,
parentname: null,
name: "/"
};
}
match = reSplitPath2.exec(pathname);
if (match) {
return {
parent: match[1],
parentname: match[2],
name: match[3]
};
}
match = reSplitPath.exec(pathname);
if (match) {
return {
parent: "/",
parentname: "/",
name: match[1]
};
}
},
rePathEndsWithSlash = /\/$/,
pathEndsWithSlash = function (pathname) {
return rePathEndsWithSlash.test(pathname);
},
getAbsHref = function (folder, tableRow) {
return rePathEndsWithSlash.test(pathname);
},
getAbsHref = function (folder, tableRow) {
var $a, isParentFolder, href;
var $a, isParentFolder, href;
if (!pathEndsWithSlash(folder)) {
folder += "/";
}
if (!tableRow) {
return folder;
}
$a = $(tableRow).find("td").eq(1).find("a");
isParentFolder = ($a.text() === "Parent Directory");
href = $a.attr("href");
return isParentFolder ? undefined : folder + href;
},
kilo = 1000.0,
reParseSize = /^\s*([\.\d]+)\s*([kmg]?)b?\s*$/i,
parseSize = function (str) {
if (!pathEndsWithSlash(folder)) {
folder += "/";
}
if (!tableRow) {
return folder;
}
$a = $(tableRow).find("td").eq(1).find("a");
isParentFolder = ($a.text() === "Parent Directory");
href = $a.attr("href");
return isParentFolder ? undefined : folder + href;
},
kilo = 1000.0,
reParseSize = /^\s*([\.\d]+)\s*([kmg]?)b?\s*$/i,
parseSize = function (str) {
var match = reParseSize.exec(str),
val, unit;
var match = reParseSize.exec(str),
val, unit;
if (!match) {
return -1;
}
if (!match) {
return -1;
}
val = parseFloat(match[1]);
unit = match[2].toLowerCase();
if (unit === "k") {
val *= kilo;
} else if (unit === "m") {
val *= kilo * kilo;
} else if (unit === "g") {
val *= kilo * kilo * kilo;
} else if (unit === "t") {
val *= kilo * kilo * kilo * kilo;
}
return val;
},
sizeUnits = ["B", "KB", "MB", "GB", "TB"],
formatSize = function (size) {
val = parseFloat(match[1]);
unit = match[2].toLowerCase();
if (unit === "k") {
val *= kilo;
} else if (unit === "m") {
val *= kilo * kilo;
} else if (unit === "g") {
val *= kilo * kilo * kilo;
} else if (unit === "t") {
val *= kilo * kilo * kilo * kilo;
}
return val;
},
sizeUnits = ["B", "KB", "MB", "GB", "TB"],
formatSize = function (size) {
var th = 1000.0,
i = 0,
maxI = sizeUnits.length - 1;
var th = 1000.0,
i = 0,
maxI = sizeUnits.length - 1;
if (isNaN(size)) {
return size;
}
if (isNaN(size)) {
return size;
}
while (size >= th && i < maxI) {
size /= kilo;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + " " + sizeUnits[i];
},
checkedDecodeUri = function (uri) {
while (size >= th && i < maxI) {
size /= kilo;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + " " + sizeUnits[i];
},
checkedDecodeUri = function (uri) {
try {
return decodeURI(uri);
} catch (err) {}
return uri;
};
try {
return decodeURI(uri);
} catch (err) {}
return uri;
};
return {
splitPath: splitPath,
pathEndsWithSlash: pathEndsWithSlash,
getAbsHref: getAbsHref,
parseSize: parseSize,
formatSize: formatSize,
checkedDecodeUri: checkedDecodeUri
};
}());
return {
splitPath: splitPath,
pathEndsWithSlash: pathEndsWithSlash,
getAbsHref: getAbsHref,
parseSize: parseSize,
formatSize: formatSize,
checkedDecodeUri: checkedDecodeUri
};
}());
}(jQuery, H5AI));

View file

@ -1,110 +1,110 @@
(function ($, H5AI) {
H5AI.zippedDownload = (function () {
H5AI.zippedDownload = (function () {
var x = 0,
y = 0,
$document = $(document),
$selectionRect = $("#selection-rect"),
updateDownloadBtn = function () {
var x = 0,
y = 0,
$document = $(document),
$selectionRect = $("#selection-rect"),
updateDownloadBtn = function () {
var $selected = $("#extended a.selected"),
$downloadBtn = $("#download"),
query, href;
var $selected = $("#extended a.selected"),
$downloadBtn = $("#download"),
query, href;
if ($selected.size() > 0) {
$selected.each(function () {
href = $(this).attr("href");
query = query ? query + ":" + href : href;
});
query = H5AI.core.api() + "?action=zip&hrefs=" + query;
$downloadBtn.show().find("a").attr("href", query);
} else {
$downloadBtn.hide().find("a").attr("href", "#");
}
},
selectionUpdate = function (event) {
if ($selected.size() > 0) {
$selected.each(function () {
href = $(this).attr("href");
query = query ? query + ":" + href : href;
});
query = H5AI.core.api() + "?action=zip&hrefs=" + query;
$downloadBtn.show().find("a").attr("href", query);
} else {
$downloadBtn.hide().find("a").attr("href", "#");
}
},
selectionUpdate = function (event) {
var l = Math.min(x, event.pageX),
t = Math.min(y, event.pageY),
w = Math.abs(x - event.pageX),
h = Math.abs(y - event.pageY),
selRect;
var l = Math.min(x, event.pageX),
t = Math.min(y, event.pageY),
w = Math.abs(x - event.pageX),
h = Math.abs(y - event.pageY),
selRect;
event.preventDefault();
$selectionRect.css({left: l, top: t, width: w, height: h});
event.preventDefault();
$selectionRect.css({left: l, top: t, width: w, height: h});
selRect = $selectionRect.fracs("rect");
$("#extended a").removeClass("selecting").each(function () {
selRect = $selectionRect.fracs("rect");
$("#extended a").removeClass("selecting").each(function () {
var $a = $(this),
rect = $a.fracs("rect"),
inter = selRect.intersection(rect);
if (inter && !$a.closest(".entry").hasClass("folder-parent")) {
$a.addClass("selecting");
}
});
},
selectionEnd = function (event) {
var $a = $(this),
rect = $a.fracs("rect"),
inter = selRect.intersection(rect);
if (inter && !$a.closest(".entry").hasClass("folder-parent")) {
$a.addClass("selecting");
}
});
},
selectionEnd = function (event) {
event.preventDefault();
$document.off("mousemove", selectionUpdate);
$selectionRect.hide().css({left: 0, top: 0, width: 0, height: 0});
$("#extended a.selecting.selected").removeClass("selecting").removeClass("selected");
$("#extended a.selecting").removeClass("selecting").addClass("selected");
updateDownloadBtn();
},
selectionStart = function (event) {
event.preventDefault();
$document.off("mousemove", selectionUpdate);
$selectionRect.hide().css({left: 0, top: 0, width: 0, height: 0});
$("#extended a.selecting.selected").removeClass("selecting").removeClass("selected");
$("#extended a.selecting").removeClass("selecting").addClass("selected");
updateDownloadBtn();
},
selectionStart = function (event) {
var view = $.fracs.viewport();
var view = $.fracs.viewport();
x = event.pageX;
y = event.pageY;
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
return;
}
x = event.pageX;
y = event.pageY;
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
return;
}
event.preventDefault();
if (!event.ctrlKey) {
$("#extended a").removeClass("selected");
updateDownloadBtn();
}
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
selectionUpdate(event);
event.preventDefault();
if (!event.ctrlKey) {
$("#extended a").removeClass("selected");
updateDownloadBtn();
}
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
selectionUpdate(event);
$document
.on("mousemove", selectionUpdate)
.one("mouseup", selectionEnd);
},
noSelection = function (event) {
$document
.on("mousemove", selectionUpdate)
.one("mouseup", selectionEnd);
},
noSelection = function (event) {
event.stopPropagation();
return false;
},
noSelectionUnlessCtrl = function (event) {
event.stopPropagation();
return false;
},
noSelectionUnlessCtrl = function (event) {
if (!event.ctrlKey) {
noSelection(event);
}
},
init = function () {
if (!event.ctrlKey) {
noSelection(event);
}
},
init = function () {
if (H5AI.core.settings.zippedDownload) {
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
.find("img").attr("src", H5AI.core.image("download")).end()
.appendTo($("#navbar"));
if (H5AI.core.settings.zippedDownload) {
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
.find("img").attr("src", H5AI.core.image("download")).end()
.appendTo($("#navbar"));
$("body>nav,body>footer,#tree").on("mousedown", noSelection);
$("#extended").on("mousedown", "a", noSelectionUnlessCtrl);
$document.on("mousedown", selectionStart);
}
};
$("body>nav,body>footer,#tree").on("mousedown", noSelection);
$("#extended").on("mousedown", "a", noSelectionUnlessCtrl);
$document.on("mousedown", selectionStart);
}
};
return {
init: init
};
}());
return {
init: init
};
}());
}(jQuery, H5AI));

View file

@ -6,7 +6,7 @@
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.5
*
*
* Requires: 1.2.2+
*/
@ -15,73 +15,70 @@
var types = ['DOMMouseScroll', 'mousewheel'];
if ($.event.fixHooks) {
for ( var i=types.length; i; ) {
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
}
for ( var i=types.length; i; ) {
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
}
}
$.event.special.mousewheel = {
setup: function() {
if ( this.addEventListener ) {
for ( var i=types.length; i; ) {
this.addEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i=types.length; i; ) {
this.removeEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
}
setup: function() {
if ( this.addEventListener ) {
for ( var i=types.length; i; ) {
this.addEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i=types.length; i; ) {
this.removeEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
},
unmousewheel: function(fn) {
return this.unbind("mousewheel", fn);
}
mousewheel: function(fn) {
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
},
unmousewheel: function(fn) {
return this.unbind("mousewheel", fn);
}
});
function handler(event) {
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
event = $.event.fix(orgEvent);
event.type = "mousewheel";
// Old school scrollwheel delta
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
if ( event.detail ) { delta = -event.detail/3; }
// New school multidimensional scroll (touchpads) deltas
deltaY = delta;
// Gecko
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaY = 0;
deltaX = -1*delta;
}
// Webkit
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
return ($.event.dispatch || $.event.handle).apply(this, args);
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
event = $.event.fix(orgEvent);
event.type = "mousewheel";
// Old school scrollwheel delta
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
if ( event.detail ) { delta = -event.detail/3; }
// New school multidimensional scroll (touchpads) deltas
deltaY = delta;
// Gecko
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaY = 0;
deltaX = -1*delta;
}
// Webkit
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
})(jQuery);

View file

@ -2,156 +2,156 @@
* jQuery.scrollpanel
* author: Lars Jung
* license: MIT
*
* bad and ugly coded!
*
* still quick and dirty!
*/
(function (window, $) {
"use strict";
"use strict";
var $window = $(window),
init = function (htmlElement) {
var $window = $(window),
init = function (htmlElement) {
var $element = $(htmlElement),
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
update, scroll;
var $element = $(htmlElement),
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
update, scroll;
if (!$element.css("position") || $element.css("position") === "static") {
$element.css("position", "relative");
}
if (!$element.css("position") || $element.css("position") === "static") {
$element.css("position", "relative");
}
$scrollbar = $("<div class='scrollbar' />");
$drag = $("<div class='drag' />").appendTo($scrollbar);
$element
.wrapInner("<div class='wrapper'><div class='content' /></div>")
.append($scrollbar);
$wrapper = $element.find("> .wrapper");
$content = $wrapper.find("> .content");
mouseOffsetY = 0;
$scrollbar = $("<div class='scrollbar' />");
$drag = $("<div class='drag' />").appendTo($scrollbar);
$element
.wrapInner("<div class='wrapper'><div class='content' /></div>")
.append($scrollbar);
$wrapper = $element.find("> .wrapper");
$content = $wrapper.find("> .content");
mouseOffsetY = 0;
update = function (repeat) {
update = function (repeat) {
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
if (updateId && !repeat) {
clearInterval(updateId);
updateId = undefined;
} else if (!updateId && repeat) {
updateId = setInterval(function() { update(true); }, 50);
}
if (updateId && !repeat) {
clearInterval(updateId);
updateId = undefined;
} else if (!updateId && repeat) {
updateId = setInterval(function() { update(true); }, 50);
}
$wrapper.css("height", $element.height());
visibleHeight = $element.height();
contentHeight = $content.outerHeight();
scrollTop = $wrapper.scrollTop();
scrollTopFrac = scrollTop / contentHeight;
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
$wrapper.css("height", $element.height());
visibleHeight = $element.height();
contentHeight = $content.outerHeight();
scrollTop = $wrapper.scrollTop();
scrollTopFrac = scrollTop / contentHeight;
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
if (visVertFrac < 1) {
$scrollbar
.fadeIn(50)
.css({
height: $element.innerHeight() + $scrollbar.height() - $scrollbar.outerHeight(true)
});
$drag
.css({
top: $scrollbar.height() * scrollTopFrac,
height: $scrollbar.height() * visVertFrac
});
} else {
$scrollbar.fadeOut(50);
}
};
if (visVertFrac < 1) {
$scrollbar
.fadeIn(50)
.css({
height: $element.innerHeight() + $scrollbar.height() - $scrollbar.outerHeight(true)
});
$drag
.css({
top: $scrollbar.height() * scrollTopFrac,
height: $scrollbar.height() * visVertFrac
});
} else {
$scrollbar.fadeOut(50);
}
};
scroll = function (event) {
scroll = function (event) {
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);
update();
event.preventDefault();
};
$wrapper.scrollTop($content.outerHeight() * clickFrac);
update();
event.preventDefault();
};
$element
.mousewheel(function (event, delta) {
$wrapper.scrollTop($wrapper.scrollTop() - 50 * delta);
update();
event.stopPropagation();
event.preventDefault();
})
.scroll(update);
$element.get(0).updateScrollbar = update;
$wrapper
.css({
"padding-right": $scrollbar.outerWidth(true),
height: $element.height(),
overflow: "hidden"
});
$scrollbar
.css({
position: "absolute",
top: 0,
right: 0,
overflow: "hidden",
cursor: "pointer"
})
.mousedown(function (event) {
$element
.mousewheel(function (event, delta) {
mouseOffsetY = $drag.outerHeight() / 2;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
$wrapper.scrollTop($wrapper.scrollTop() - 50 * delta);
update();
event.stopPropagation();
event.preventDefault();
})
.scroll(update);
$element.get(0).updateScrollbar = update;
$wrapper
.css({
"padding-right": $scrollbar.outerWidth(true),
height: $element.height(),
overflow: "hidden"
});
$scrollbar
.css({
position: "absolute",
top: 0,
right: 0,
overflow: "hidden",
cursor: "pointer"
})
.mousedown(function (event) {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.preventDefault();
})
.each(function () {
mouseOffsetY = $drag.outerHeight() / 2;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
this.onselectstart = function () {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.preventDefault();
})
.each(function () {
return false;
};
});
$drag
.css({
position: "absolute",
left: 0,
width: "100%"
})
.mousedown(function (event) {
this.onselectstart = function () {
mouseOffsetY = event.pageY - $drag.offset().top;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
return false;
};
});
$drag
.css({
position: "absolute",
left: 0,
width: "100%"
})
.mousedown(function (event) {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.stopPropagation();
});
mouseOffsetY = event.pageY - $drag.offset().top;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
update();
};
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.stopPropagation();
});
update();
};
$.fn.scrollpanel = function () {
$.fn.scrollpanel = function () {
return this.each(function () {
return this.each(function () {
init(this);
});
};
init(this);
});
};
}(window, jQuery));

View file

@ -3,27 +3,27 @@
/*global jQuery, amplify, H5AI_CONFIG */
(function ($) {
"use strict";
"use strict";
var H5AI = {};
var H5AI = {};
// @include "inc/Util.js"
// @include "inc/Core.js"
// @include "inc/Sort.js"
// @include "inc/ZippedDownload.js"
// @include "inc/Util.js"
// @include "inc/Core.js"
// @include "inc/Sort.js"
// @include "inc/ZippedDownload.js"
// @include "inc/Path.js"
// @include "inc/Connector.js"
// @include "inc/Html.js"
// @include "inc/Extended.js"
// @include "inc/Path.js"
// @include "inc/Connector.js"
// @include "inc/Html.js"
// @include "inc/Extended.js"
$(function () {
$(function () {
H5AI.extended.init();
H5AI.extended.init();
H5AI.core.init();
H5AI.sort.init();
H5AI.zippedDownload.init();
});
H5AI.core.init();
H5AI.sort.init();
H5AI.zippedDownload.init();
});
}(jQuery));

View file

@ -3,23 +3,23 @@
/*global jQuery, amplify, H5AI_CONFIG */
(function ($) {
"use strict";
"use strict";
var H5AI = {};
var H5AI = {};
// @include "inc/Util.js"
// @include "inc/Core.js"
// @include "inc/Sort.js"
// @include "inc/ZippedDownload.js"
// @include "inc/Util.js"
// @include "inc/Core.js"
// @include "inc/Sort.js"
// @include "inc/ZippedDownload.js"
$(function () {
$(function () {
H5AI.core.init();
H5AI.sort.init();
H5AI.zippedDownload.init();
H5AI.core.init();
H5AI.sort.init();
H5AI.zippedDownload.init();
$("#tree").scrollpanel();
H5AI.core.shiftTree(false, true);
});
$("#tree").scrollpanel();
H5AI.core.shiftTree(false, true);
});
}(jQuery));

View file

@ -2,19 +2,19 @@
function fail($code, $msg, $cond = true) {
if ($cond) {
echo "$code: $msg";
exit;
}
if ($cond) {
echo "$code: $msg";
exit;
}
}
function checkKeys($keys) {
$values = array();
foreach ($keys as $key) {
fail(1, "parameter '$key' is missing", !array_key_exists($key, $_REQUEST));
$values[] = $_REQUEST[$key];
}
return $values;
$values = array();
foreach ($keys as $key) {
fail(1, "parameter '$key' is missing", !array_key_exists($key, $_REQUEST));
$values[] = $_REQUEST[$key];
}
return $values;
}
@ -29,97 +29,97 @@ $options = $h5ai->getOptions();
if ($action === "httpcodes") {
list($hrefs) = checkKeys(array("hrefs"));
list($hrefs) = checkKeys(array("hrefs"));
function getHttpCodes($h5ai, $hrefs) {
function getHttpCodes($h5ai, $hrefs) {
$codes = array();
foreach ($hrefs as $href) {
$href = trim($href);
if (strlen($href) > 0) {
$codes[$href] = $h5ai->getHttpCode($href);
}
}
return $codes;
}
$codes = array();
foreach ($hrefs as $href) {
$href = trim($href);
if (strlen($href) > 0) {
$codes[$href] = $h5ai->getHttpCode($href);
}
}
return $codes;
}
$hrefs = preg_split("/;/", $hrefs);
$codes = getHttpCodes($h5ai, $hrefs);
$hrefs = preg_split("/;/", $hrefs);
$codes = getHttpCodes($h5ai, $hrefs);
echo count($codes) === 0 ? "{}" : json_encode($codes);
echo count($codes) === 0 ? "{}" : json_encode($codes);
}
else if ($action === "thumb") {
fail(0, "thumbs are disabled", !$options["showThumbs"]);
list($srcAbsHref, $width, $height, $mode) = checkKeys(array("href", "width", "height", "mode"));
fail(0, "thumbs are disabled", !$options["showThumbs"]);
list($srcAbsHref, $width, $height, $mode) = checkKeys(array("href", "width", "height", "mode"));
require_once "inc/Thumbnail.php";
require_once "inc/Image.php";
require_once "inc/Thumbnail.php";
require_once "inc/Image.php";
$srcAbsPath = $h5ai->getDocRoot() . rawurldecode($srcAbsHref);
$srcAbsPath = $h5ai->getDocRoot() . rawurldecode($srcAbsHref);
if (!Thumbnail::isUsable()) {
Image::showImage($srcAbsPath);
exit;
}
if (!Thumbnail::isUsable()) {
Image::showImage($srcAbsPath);
exit;
}
$thumbnail = new Thumbnail($h5ai, $srcAbsHref, $mode, $width, $height);
$thumbnail->create(1);
if (file_exists($thumbnail->getPath())) {
Image::showImage($thumbnail->getPath());
} else {
$image = new Image();
$image->setSource($srcAbsPath);
$image->thumb($mode, $width, $height);
$image->showDest();
}
$thumbnail = new Thumbnail($h5ai, $srcAbsHref, $mode, $width, $height);
$thumbnail->create(1);
if (file_exists($thumbnail->getPath())) {
Image::showImage($thumbnail->getPath());
} else {
$image = new Image();
$image->setSource($srcAbsPath);
$image->thumb($mode, $width, $height);
$image->showDest();
}
}
else if ($action === "tree") {
list($href) = checkKeys(array("href"));
list($href) = checkKeys(array("href"));
require_once "inc/Tree.php";
require_once "inc/Tree.php";
$absHref = trim($href);
$absPath = $h5ai->getAbsPath($absHref);
$absHref = trim($href);
$absPath = $h5ai->getAbsPath($absHref);
$tree = new TreeEntry($h5ai, $absPath, $absHref);
$tree->loadContent();
$tree = new TreeEntry($h5ai, $absPath, $absHref);
$tree->loadContent();
echo $tree->contentToHtml();
echo $tree->contentToHtml();
}
else if ($action === "zip") {
fail(0, "zipped download is disabled", !$options["zippedDownload"]);
list($hrefs) = checkKeys(array("hrefs"));
fail(0, "zipped download is disabled", !$options["zippedDownload"]);
list($hrefs) = checkKeys(array("hrefs"));
require_once "inc/ZipIt.php";
require_once "inc/ZipIt.php";
$zipit = new ZipIt($h5ai);
$zipit = new ZipIt($h5ai);
$hrefs = explode(":", trim($hrefs));
$zipFile = $zipit->zip($hrefs);
$hrefs = explode(":", trim($hrefs));
$zipFile = $zipit->zip($hrefs);
if ($zipFile === false) {
fail(2, "something went wrong while building the zip");
}
if ($zipFile === false) {
fail(2, "something went wrong while building the zip");
}
header("Content-Disposition: attachment; filename=\"h5ai-selection.zip\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($zipFile));
header("Connection: close");
readfile($zipFile);
header("Content-Disposition: attachment; filename=\"h5ai-selection.zip\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($zipFile));
header("Connection: close");
readfile($zipFile);
}
else {
fail(1, "unsupported 'action' specified");
fail(1, "unsupported 'action' specified");
}

View file

@ -7,87 +7,87 @@
##############################################
class Cache {
private $dir;
private $dir;
function __construct($dir) {
function __construct($dir) {
$this->dir = $dir;
}
$this->dir = $dir;
}
private function _name($key) {
private function _name($key) {
return $this->dir . "/" . sha1($key);
}
return $this->dir . "/" . sha1($key);
}
public function get($key, $expiration = 3600) {
public function get($key, $expiration = 3600) {
if (!is_dir($this->dir) || !is_writable($this->dir)) {
return false;
}
if (!is_dir($this->dir) || !is_writable($this->dir)) {
return false;
}
$cache_path = $this->_name($key);
$cache_path = $this->_name($key);
if (!@file_exists($cache_path)) {
return false;
}
if (!@file_exists($cache_path)) {
return false;
}
if (filemtime($cache_path) < (time() - $expiration)) {
$this->clear($key);
return false;
}
if (filemtime($cache_path) < (time() - $expiration)) {
$this->clear($key);
return false;
}
if (!$fp = @fopen($cache_path, "rb")) {
return false;
}
if (!$fp = @fopen($cache_path, "rb")) {
return false;
}
flock($fp, LOCK_SH);
$cache = "";
flock($fp, LOCK_SH);
$cache = "";
if (filesize($cache_path) > 0) {
$cache = unserialize(fread($fp, filesize($cache_path)));
} else {
$cache = null;
}
if (filesize($cache_path) > 0) {
$cache = unserialize(fread($fp, filesize($cache_path)));
} else {
$cache = null;
}
flock($fp, LOCK_UN);
fclose($fp);
flock($fp, LOCK_UN);
fclose($fp);
return $cache;
}
return $cache;
}
public function set($key, $data) {
public function set($key, $data) {
if (!is_dir($this->dir) || !is_writable($this->dir)) {
return false;
}
if (!is_dir($this->dir) || !is_writable($this->dir)) {
return false;
}
$cache_path = $this->_name($key);
$cache_path = $this->_name($key);
if (! $fp = fopen($cache_path, "wb")) {
return false;
}
if (! $fp = fopen($cache_path, "wb")) {
return false;
}
if (flock($fp, LOCK_EX)) {
fwrite($fp, serialize($data));
flock($fp, LOCK_UN);
} else {
return false;
}
fclose($fp);
@chmod($cache_path, 0777);
return true;
}
if (flock($fp, LOCK_EX)) {
fwrite($fp, serialize($data));
flock($fp, LOCK_UN);
} else {
return false;
}
fclose($fp);
@chmod($cache_path, 0777);
return true;
}
public function clear($key) {
public function clear($key) {
$cache_path = $this->_name($key);
$cache_path = $this->_name($key);
if (file_exists($cache_path)) {
unlink($cache_path);
return true;
}
return false;
}
if (file_exists($cache_path)) {
unlink($cache_path);
return true;
}
return false;
}
}
?>

View file

@ -1,52 +1,52 @@
<?php
class Crumb {
private $h5ai, $parts;
private $h5ai, $parts;
public function __construct($h5ai) {
public function __construct($h5ai) {
$this->h5ai = $h5ai;
$this->parts = array();
$this->h5ai = $h5ai;
$this->parts = array();
$href = $h5ai->getAbsHref();
while ($href !== "/" && $href !== "//") {
$this->parts[] = $href;
$href = dirname($href) . "/";
}
$this->parts[] = "/";
$href = $h5ai->getAbsHref();
while ($href !== "/" && $href !== "//") {
$this->parts[] = $href;
$href = dirname($href) . "/";
}
$this->parts[] = "/";
$this->parts = array_reverse($this->parts);
}
$this->parts = array_reverse($this->parts);
}
public function toHtml() {
public function toHtml() {
$html = "";
$idx = 0;
foreach($this->parts as $href) {
$idx++;
$classes = "crumb folder" . ($idx === 1 ? " domain" : "") . ($idx === count($this->parts) ? " current" : "");
$image = $this->h5ai->image($idx === 1 ? "home" : "crumb");
$label = $this->h5ai->getLabel($href);
$hint = "";
$html = "";
$idx = 0;
foreach($this->parts as $href) {
$idx++;
$classes = "crumb folder" . ($idx === 1 ? " domain" : "") . ($idx === count($this->parts) ? " current" : "");
$image = $this->h5ai->image($idx === 1 ? "home" : "crumb");
$label = $this->h5ai->getLabel($href);
$hint = "";
$code = $this->h5ai->getHttpCode($href);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$hint = "<img class='hint' src='" . $this->h5ai->image("page") . "' alt='page' />";
} else {
$hint = "<span class='hint'>(" . $code . ")</span>";
}
}
$code = $this->h5ai->getHttpCode($href);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$hint = "<img class='hint' src='" . $this->h5ai->image("page") . "' alt='page' />";
} else {
$hint = "<span class='hint'>(" . $code . ")</span>";
}
}
$html .= "<li class='$classes'>\n";
$html .= "\t<a href='$href'>\n";
$html .= "\t\t<img src='$image' alt='>' /><span>" . $label . "</span>" . $hint . "\n";
$html .= "\t</a>\n";
$html .= "</li>\n";
}
return $html;
}
$html .= "<li class='$classes'>\n";
$html .= "\t<a href='$href'>\n";
$html .= "\t\t<img src='$image' alt='>' /><span>" . $label . "</span>" . $hint . "\n";
$html .= "\t</a>\n";
$html .= "</li>\n";
}
return $html;
}
}
?>

View file

@ -1,30 +1,30 @@
<?php
class Customize {
private $customHeader, $customFooter;
private $customHeader, $customFooter;
public function __construct($h5ai) {
public function __construct($h5ai) {
$absPath = $h5ai->getAbsPath();
$options = $h5ai->getOptions();
$this->customHeader = $absPath . "/" . $options["customHeader"];
$this->customFooter = $absPath . "/" . $options["customFooter"];
}
$absPath = $h5ai->getAbsPath();
$options = $h5ai->getOptions();
$this->customHeader = $absPath . "/" . $options["customHeader"];
$this->customFooter = $absPath . "/" . $options["customFooter"];
}
public function getHeader() {
public function getHeader() {
return $this->getContent($this->customHeader, "header");
}
return $this->getContent($this->customHeader, "header");
}
public function getFooter() {
public function getFooter() {
return $this->getContent($this->customFooter, "footer");
}
return $this->getContent($this->customFooter, "footer");
}
private function getContent($file, $tag) {
private function getContent($file, $tag) {
return file_exists($file) ? ("<" . $tag . ">" . file_get_contents($file) . "</" . $tag . ">") : "";
}
return file_exists($file) ? ("<" . $tag . ">" . file_get_contents($file) . "</" . $tag . ">") : "";
}
}
?>

View file

@ -4,141 +4,141 @@ require_once "Thumbnail.php";
class Entry {
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size, $thumbTypes;
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size, $thumbTypes;
public function __construct($h5ai, $absPath, $absHref, $type = null, $label = null) {
public function __construct($h5ai, $absPath, $absHref, $type = null, $label = null) {
$this->h5ai = $h5ai;
$this->label = $label !== null ? $label : $this->h5ai->getLabel($absHref);
$this->absPath = $this->h5ai->normalizePath($absPath, false);
$this->isFolder = is_dir($this->absPath);
$this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder);
$this->h5ai = $h5ai;
$this->label = $label !== null ? $label : $this->h5ai->getLabel($absHref);
$this->absPath = $this->h5ai->normalizePath($absPath, false);
$this->isFolder = is_dir($this->absPath);
$this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder);
$this->date = filemtime($this->absPath);
$this->date = filemtime($this->absPath);
if ($this->isFolder) {
$this->type = $type !== null ? $type : "folder";
$this->size = "";
} else {
$this->type = $type !== null ? $type : $this->h5ai->getType($this->absPath);
$this->size = filesize($this->absPath);
}
if ($this->isFolder) {
$this->type = $type !== null ? $type : "folder";
$this->size = "";
} else {
$this->type = $type !== null ? $type : $this->h5ai->getType($this->absPath);
$this->size = filesize($this->absPath);
}
$this->thumbTypes = array("bmp", "gif", "ico", "image", "jpg", "png", "tiff");
}
$this->thumbTypes = array("bmp", "gif", "ico", "image", "jpg", "png", "tiff");
}
public function isFolder() {
public function isFolder() {
return $this->isFolder;
}
return $this->isFolder;
}
public function toHtml() {
public function toHtml() {
$classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type;
$imgClass = "";
$img = $this->type;
$smallImg = $this->h5ai->icon($this->type);
$bigImg = $this->h5ai->icon($this->type, true);
$hint = "";
$classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type;
$imgClass = "";
$img = $this->type;
$smallImg = $this->h5ai->icon($this->type);
$bigImg = $this->h5ai->icon($this->type, true);
$hint = "";
if ($this->isFolder && $this->type !== "folder-parent") {
$code = $this->h5ai->getHttpCode($this->absHref);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$img = "folder-page";
$smallImg = $this->h5ai->icon("folder-page");
$bigImg = $this->h5ai->icon("folder-page", true);
} else {
$classes .= " error";
$hint = "<span class='hint'> " . $code . " </span>";
}
}
}
if ($this->h5ai->showThumbs() && in_array($this->type, $this->thumbTypes)) {
$imgClass = " class='thumb' ";
$thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16);
$thumbnail->create();
$smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
$thumbnail = new Thumbnail($this->h5ai,$this->absHref, "rational", 96, 46);
$thumbnail->create();
$bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
}
if ($this->isFolder && $this->type !== "folder-parent") {
$code = $this->h5ai->getHttpCode($this->absHref);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$img = "folder-page";
$smallImg = $this->h5ai->icon("folder-page");
$bigImg = $this->h5ai->icon("folder-page", true);
} else {
$classes .= " error";
$hint = "<span class='hint'> " . $code . " </span>";
}
}
}
if ($this->h5ai->showThumbs() && in_array($this->type, $this->thumbTypes)) {
$imgClass = " class='thumb' ";
$thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16);
$thumbnail->create();
$smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
$thumbnail = new Thumbnail($this->h5ai,$this->absHref, "rational", 96, 46);
$thumbnail->create();
$bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
}
$html = "\t<li class='" . $classes . "'>\n";
$html .= "\t\t<a href='" . $this->absHref . "'>\n";
$html .= "\t\t\t<span class='icon small'><img " . $imgClass . " src='" . $smallImg . "' alt='" . $img . "' /></span>\n";
$html .= "\t\t\t<span class='icon big'><img " . $imgClass . " src='" . $bigImg . "' alt='" . $img . "' /></span>\n";
$html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
$html .= "\t\t\t<span class='date' data-time='" . $this->date . "000'></span>\n";
$html .= "\t\t\t<span class='size' data-bytes='" . $this->size . "'>" . $this->size . "</span>\n";
$html .= "\t\t</a>\n";
$html .= "\t</li>\n";
return $html;
}
$html = "\t<li class='" . $classes . "'>\n";
$html .= "\t\t<a href='" . $this->absHref . "'>\n";
$html .= "\t\t\t<span class='icon small'><img " . $imgClass . " src='" . $smallImg . "' alt='" . $img . "' /></span>\n";
$html .= "\t\t\t<span class='icon big'><img " . $imgClass . " src='" . $bigImg . "' alt='" . $img . "' /></span>\n";
$html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
$html .= "\t\t\t<span class='date' data-time='" . $this->date . "000'></span>\n";
$html .= "\t\t\t<span class='size' data-bytes='" . $this->size . "'>" . $this->size . "</span>\n";
$html .= "\t\t</a>\n";
$html .= "\t</li>\n";
return $html;
}
}
class Extended {
private $h5ai, $parent, $content;
private $h5ai, $parent, $content;
public function __construct($h5ai) {
public function __construct($h5ai) {
$this->h5ai = $h5ai;
$this->parent = null;
$this->content = array();
$this->loadContent();
}
$this->h5ai = $h5ai;
$this->parent = null;
$this->content = array();
$this->loadContent();
}
private function loadContent() {
private function loadContent() {
if ($this->h5ai->getAbsHref() !== "/") {
$options = $this->h5ai->getOptions();
$parentPath = dirname($this->h5ai->getAbsPath());
$parentHref = dirname($this->h5ai->getAbsHref());
$label = $options["setParentFolderLabels"] === true ? $this->h5ai->getLabel($parentHref) : "<span class='l10n-parentDirectory'>Parent Directory</span>";
$this->parent = new Entry($this->h5ai, $parentPath, $parentHref, "folder-parent", $label);
}
if ($this->h5ai->getAbsHref() !== "/") {
$options = $this->h5ai->getOptions();
$parentPath = dirname($this->h5ai->getAbsPath());
$parentHref = dirname($this->h5ai->getAbsHref());
$label = $options["setParentFolderLabels"] === true ? $this->h5ai->getLabel($parentHref) : "<span class='l10n-parentDirectory'>Parent Directory</span>";
$this->parent = new Entry($this->h5ai, $parentPath, $parentHref, "folder-parent", $label);
}
$this->content = array();
$this->content = array();
$files = $this->h5ai->readDir($this->h5ai->getAbsPath());
foreach ($files as $file) {
$absPath = $this->h5ai->getAbsPath() . "/" . $file;
$absHref = $this->h5ai->getAbsHref() . rawurlencode($file);
$this->content[$absPath] = new Entry($this->h5ai, $absPath, $absHref);
}
}
$files = $this->h5ai->readDir($this->h5ai->getAbsPath());
foreach ($files as $file) {
$absPath = $this->h5ai->getAbsPath() . "/" . $file;
$absHref = $this->h5ai->getAbsHref() . rawurlencode($file);
$this->content[$absPath] = new Entry($this->h5ai, $absPath, $absHref);
}
}
public function toHtml() {
public function toHtml() {
$html = "<section id='extended' class='" . $this->h5ai->getView() . "-view clearfix'>\n";
$html .= "<ul>\n";
$html .= $this->generateHeaders();
if ($this->parent !== null) {
$html .= $this->parent->toHtml();
}
foreach($this->content as $entry) {
$html .= $entry->toHtml();
}
$html .= "</ul>\n";
if (count($this->content) === 0) {
$html .= "<div class='empty l10n-empty'>empty</div>";
}
$html .="</section>";
return $html;
}
$html = "<section id='extended' class='" . $this->h5ai->getView() . "-view clearfix'>\n";
$html .= "<ul>\n";
$html .= $this->generateHeaders();
if ($this->parent !== null) {
$html .= $this->parent->toHtml();
}
foreach($this->content as $entry) {
$html .= $entry->toHtml();
}
$html .= "</ul>\n";
if (count($this->content) === 0) {
$html .= "<div class='empty l10n-empty'>empty</div>";
}
$html .="</section>";
return $html;
}
public function generateHeaders() {
public function generateHeaders() {
$html = "\t<li class='header'>\n";
$html .= "\t\t<a class='icon'></a>\n";
$html .= "\t\t<a class='label' href='#'><span class='l10n-name'>Name</span></a>\n";
$html .= "\t\t<a class='date' href='#'><span class='l10n-lastModified'>Last modified</span></a>\n";
$html .= "\t\t<a class='size' href='#'><span class='l10n-size'>Size</span></a>\n";
$html .= "\t</li>\n";
return $html;
}
$html = "\t<li class='header'>\n";
$html .= "\t\t<a class='icon'></a>\n";
$html .= "\t\t<a class='label' href='#'><span class='l10n-name'>Name</span></a>\n";
$html .= "\t\t<a class='date' href='#'><span class='l10n-lastModified'>Last modified</span></a>\n";
$html .= "\t\t<a class='size' href='#'><span class='l10n-size'>Size</span></a>\n";
$html .= "\t</li>\n";
return $html;
}
}
?>

View file

@ -3,301 +3,301 @@
require_once "Cache.php";
class H5ai {
private static $VIEWMODES = array("details", "icons");
private static $VIEWMODES = array("details", "icons");
private $docRoot, $h5aiRoot, $h5aiAbsHref, $domain,
$config, $options, $types, $langs,
$cache,
$absHref, $absPath,
$ignore, $ignoreRE,
$view;
private $docRoot, $h5aiRoot, $h5aiAbsHref, $domain,
$config, $options, $types, $langs,
$cache,
$absHref, $absPath,
$ignore, $ignoreRE,
$view;
public function __construct() {
public function __construct() {
global $H5AI_CONFIG;
global $H5AI_CONFIG;
$this->docRoot = $H5AI_CONFIG["DOCUMENT_ROOT"];
$this->h5aiRoot = $H5AI_CONFIG["H5AI_ROOT"];
$this->ignore = $H5AI_CONFIG["IGNORE"];
$this->ignoreRE = $H5AI_CONFIG["IGNORE_PATTERNS"];
$this->docRoot = $H5AI_CONFIG["DOCUMENT_ROOT"];
$this->h5aiRoot = $H5AI_CONFIG["H5AI_ROOT"];
$this->ignore = $H5AI_CONFIG["IGNORE"];
$this->ignoreRE = $H5AI_CONFIG["IGNORE_PATTERNS"];
$this->config = $this->loadConfig($this->h5aiRoot . "/config.js");
$this->options = $this->config["options"];
$this->types = $this->config["types"];
$this->langs = $this->config["langs"];
$this->config = $this->loadConfig($this->h5aiRoot . "/config.js");
$this->options = $this->config["options"];
$this->types = $this->config["types"];
$this->langs = $this->config["langs"];
$this->cache = new Cache($this->h5aiRoot . "/cache");
$this->cache = new Cache($this->h5aiRoot . "/cache");
$this->hrefRoot = $this->options["rootAbsHref"];
$this->h5aiAbsHref = $this->options["h5aiAbsHref"];
$this->domain = getenv("HTTP_HOST");
$this->hrefRoot = $this->options["rootAbsHref"];
$this->h5aiAbsHref = $this->options["h5aiAbsHref"];
$this->domain = getenv("HTTP_HOST");
$this->absHref = $this->normalizePath(preg_replace('/\\?.*/', '', getenv("REQUEST_URI")), true);
$this->absPath = $this->getAbsPath($this->absHref);
$this->absHref = $this->normalizePath(preg_replace('/\\?.*/', '', getenv("REQUEST_URI")), true);
$this->absPath = $this->getAbsPath($this->absHref);
$this->view = $this->options["viewmodes"][0];
if (!in_array($this->view, H5ai::$VIEWMODES)) {
$this->view = H5ai::$VIEWMODES[0];
}
}
$this->view = $this->options["viewmodes"][0];
if (!in_array($this->view, H5ai::$VIEWMODES)) {
$this->view = H5ai::$VIEWMODES[0];
}
}
private function loadConfig($file) {
private function loadConfig($file) {
$str = file_exists($file) ? file_get_contents($file) : "";
$str = file_exists($file) ? file_get_contents($file) : "";
// remove comments and change expression to pure json
$str = preg_replace("/\/\*.*?\*\//s", "", $str);
$str = preg_replace("/^.*H5AI_CONFIG\s*=\s*/s", "", $str);
$str = preg_replace("/;.*/s", "", $str);
$config = json_decode($str, true);
// remove comments and change expression to pure json
$str = preg_replace("/\/\*.*?\*\//s", "", $str);
$str = preg_replace("/^.*H5AI_CONFIG\s*=\s*/s", "", $str);
$str = preg_replace("/;.*/s", "", $str);
$config = json_decode($str, true);
return $config;
}
return $config;
}
public function getDocRoot() {
public function getDocRoot() {
return $this->docRoot;
}
return $this->docRoot;
}
public function getH5aiRoot() {
public function getH5aiRoot() {
return $this->h5aiRoot;
}
return $this->h5aiRoot;
}
public function getHrefRoot() {
public function getHrefRoot() {
return $this->hrefRoot;
}
return $this->hrefRoot;
}
public function getH5aiAbsHref() {
public function getH5aiAbsHref() {
return $this->h5aiAbsHref;
}
return $this->h5aiAbsHref;
}
public function getDomain() {
public function getDomain() {
return $this->domain;
}
return $this->domain;
}
public function getView() {
public function getView() {
return $this->view;
}
return $this->view;
}
public function api() {
public function api() {
return $this->h5aiAbsHref . "php/api.php";
}
return $this->h5aiAbsHref . "php/api.php";
}
public function image($id) {
public function image($id) {
return $this->h5aiAbsHref . "images/" . $id . ".png";
}
return $this->h5aiAbsHref . "images/" . $id . ".png";
}
public function icon($id, $big = false) {
public function icon($id, $big = false) {
return $this->h5aiAbsHref . "icons/" . ($big ? "48x48" : "16x16") . "/" . $id . ".png";
}
return $this->h5aiAbsHref . "icons/" . ($big ? "48x48" : "16x16") . "/" . $id . ".png";
}
public function getOptions() {
public function getOptions() {
return $this->options;
}
return $this->options;
}
public function getLangs() {
public function getLangs() {
return $this->langs;
}
return $this->langs;
}
public function getAbsHref($absPath = null, $endWithSlash = true) {
public function getAbsHref($absPath = null, $endWithSlash = true) {
if ($absPath === null) {
return $this->absHref;
}
if ($absPath === null) {
return $this->absHref;
}
//
$absPath=substr($absPath, strlen($this->docRoot));
//
$absPath=substr($absPath, strlen($this->docRoot));
$absHref = preg_replace("!^" . $this->docRoot . "!", "", $absPath);
$parts = explode("/", $absHref);
$encodedParts = array();
foreach ($parts as $part) {
$encodedParts[] = rawurlencode($part);
}
$endodedAbsHref = implode("/", $encodedParts);
$absHref = preg_replace("!^" . $this->docRoot . "!", "", $absPath);
$parts = explode("/", $absHref);
$encodedParts = array();
foreach ($parts as $part) {
$encodedParts[] = rawurlencode($part);
}
$endodedAbsHref = implode("/", $encodedParts);
//
$endodedAbsHref = $this->hrefRoot . $endodedAbsHref;
//
$endodedAbsHref = $this->hrefRoot . $endodedAbsHref;
return $this->normalizePath($endodedAbsHref, $endWithSlash);
}
return $this->normalizePath($endodedAbsHref, $endWithSlash);
}
public function getAbsPath($absHref = null) {
public function getAbsPath($absHref = null) {
if ($absHref === null) {
return $this->absPath;
}
if ($absHref === null) {
return $this->absPath;
}
//
$absHref=substr($absHref, strlen($this->hrefRoot));
//
$absHref=substr($absHref, strlen($this->hrefRoot));
return $this->normalizePath($this->docRoot . "/" . rawurldecode($absHref), false);
}
return $this->normalizePath($this->docRoot . "/" . rawurldecode($absHref), false);
}
public function showThumbs() {
public function showThumbs() {
return $this->options["showThumbs"] === true;
}
return $this->options["showThumbs"] === true;
}
public function getTitle() {
public function getTitle() {
$title = $this->domain . rawurldecode($this->absHref);
$title = preg_replace("/\/$/", "", $title);
$title = preg_replace("/\//", " > ", $title);
if ($this->absHref !== "/") {
$title = basename($this->absPath) . " - " . $title;
}
return $title;
}
$title = $this->domain . rawurldecode($this->absHref);
$title = preg_replace("/\/$/", "", $title);
$title = preg_replace("/\//", " > ", $title);
if ($this->absHref !== "/") {
$title = basename($this->absPath) . " - " . $title;
}
return $title;
}
public function getType($absPath) {
public function getType($absPath) {
foreach($this->types as $type => $exts) {
foreach($exts as $ext) {
if ($this->endsWith($absPath, $ext)) {
return $type;
}
}
}
return "unknown";
}
foreach($this->types as $type => $exts) {
foreach($exts as $ext) {
if ($this->endsWith($absPath, $ext)) {
return $type;
}
}
}
return "unknown";
}
public function ignoreThisFile($file) {
public function ignoreThisFile($file) {
# always ignore
if ($file === "." || $file === ".." || $this->startsWith($file, '.ht')) {
return true;
}
# always ignore
if ($file === "." || $file === ".." || $this->startsWith($file, '.ht')) {
return true;
}
if (in_array($file, $this->ignore)) {
return true;
}
foreach ($this->ignoreRE as $re) {
if (preg_match($re, $file)) {
return true;
}
}
return false;
}
public function readDir($path) {
$content = array();
if (is_dir($path)) {
if ($dir = opendir($path)) {
while (($file = readdir($dir)) !== false) {
if (!$this->ignoreThisFile($file)) {
$content[] = $file;
}
}
closedir($dir);
}
}
return $content;
}
public function getLabel($absHref) {
return $absHref === "/" ? $this->domain : rawurldecode(basename($absHref));
}
public function normalizePath($path, $endWithSlash) {
return ($path === "/") ? "/" : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
}
public function startsWith($sequence, $start) {
return strcasecmp(substr($sequence, 0, strlen($start)), $start) === 0;
}
public function endsWith($sequence, $end) {
return strcasecmp(substr($sequence, -strlen($end)), $end) === 0;
}
public function getHttpCode($absHref) {
return $this->cachedHttpCode($absHref);
#return $this->fetchHttpCode($absHref);
#return $this->guessHttpCode($absHref);
}
public function cachedHttpCode($absHref) {
$cached = $this->cache->get($absHref);
if ($cached === false) {
$folderStatus = $this->options["folderStatus"];
if (array_key_exists($absHref, $folderStatus)) {
$code = $folderStatus[$absHref];
} else {
$code = $this->fetchHttpCode($absHref);
}
$cached = array("href" => $absHref, "code" => $code);
$this->cache->set($absHref, $cached);
}
return $cached["code"];
}
public function fetchHttpCode($absHref) {
$contentType = "Content-Type:";
$h5aiContentType = "Content-Type: text/html;h5ai=";
$host = getenv("HTTP_HOST");
$port = getenv("SERVER_PORT");
$msg = "HEAD $absHref HTTP/1.1\r\nHost: $host\r\nConnection: Close\r\n";
if (isset($_SERVER['PHP_AUTH_USER'])) {
$msg .= "Authorization: Basic " . base64_encode($_SERVER['PHP_AUTH_USER'] . ":" . $_SERVER['PHP_AUTH_PW']) . "\r\n";
}
$msg .= "\r\n";
$errno = "";
$errstr = "";
$socket = fsockopen($host, $port, $errno, $errstr, 30);
if($socket === 0) {
return null;
}
fwrite($socket, $msg);
$content = fgets($socket);
$code = intval(trim(substr($content, 9, 4)));
if ($code === 200) {
while (! $this->startsWith($content, $contentType)) {
$content = fgets($socket);
}
if ($this->startsWith($content, $h5aiContentType)) {
$code = "h5ai";
}
}
fclose($socket);
return $code;
}
public function guessHttpCode($absHref) {
$indexFiles = array("index.html", "index.cgi", "index.pl", "index.php", "index.xhtml", "index.htm");
$absPath = $this->getAbsPath($absHref);
$files = $this->readDir($absPath);
foreach ($files as $file) {
if (in_array($file, $indexFiles)) {
return 200;
}
}
return "h5ai";
}
if (in_array($file, $this->ignore)) {
return true;
}
foreach ($this->ignoreRE as $re) {
if (preg_match($re, $file)) {
return true;
}
}
return false;
}
public function readDir($path) {
$content = array();
if (is_dir($path)) {
if ($dir = opendir($path)) {
while (($file = readdir($dir)) !== false) {
if (!$this->ignoreThisFile($file)) {
$content[] = $file;
}
}
closedir($dir);
}
}
return $content;
}
public function getLabel($absHref) {
return $absHref === "/" ? $this->domain : rawurldecode(basename($absHref));
}
public function normalizePath($path, $endWithSlash) {
return ($path === "/") ? "/" : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
}
public function startsWith($sequence, $start) {
return strcasecmp(substr($sequence, 0, strlen($start)), $start) === 0;
}
public function endsWith($sequence, $end) {
return strcasecmp(substr($sequence, -strlen($end)), $end) === 0;
}
public function getHttpCode($absHref) {
return $this->cachedHttpCode($absHref);
#return $this->fetchHttpCode($absHref);
#return $this->guessHttpCode($absHref);
}
public function cachedHttpCode($absHref) {
$cached = $this->cache->get($absHref);
if ($cached === false) {
$folderStatus = $this->options["folderStatus"];
if (array_key_exists($absHref, $folderStatus)) {
$code = $folderStatus[$absHref];
} else {
$code = $this->fetchHttpCode($absHref);
}
$cached = array("href" => $absHref, "code" => $code);
$this->cache->set($absHref, $cached);
}
return $cached["code"];
}
public function fetchHttpCode($absHref) {
$contentType = "Content-Type:";
$h5aiContentType = "Content-Type: text/html;h5ai=";
$host = getenv("HTTP_HOST");
$port = getenv("SERVER_PORT");
$msg = "HEAD $absHref HTTP/1.1\r\nHost: $host\r\nConnection: Close\r\n";
if (isset($_SERVER['PHP_AUTH_USER'])) {
$msg .= "Authorization: Basic " . base64_encode($_SERVER['PHP_AUTH_USER'] . ":" . $_SERVER['PHP_AUTH_PW']) . "\r\n";
}
$msg .= "\r\n";
$errno = "";
$errstr = "";
$socket = fsockopen($host, $port, $errno, $errstr, 30);
if($socket === 0) {
return null;
}
fwrite($socket, $msg);
$content = fgets($socket);
$code = intval(trim(substr($content, 9, 4)));
if ($code === 200) {
while (! $this->startsWith($content, $contentType)) {
$content = fgets($socket);
}
if ($this->startsWith($content, $h5aiContentType)) {
$code = "h5ai";
}
}
fclose($socket);
return $code;
}
public function guessHttpCode($absHref) {
$indexFiles = array("index.html", "index.cgi", "index.pl", "index.php", "index.xhtml", "index.htm");
$absPath = $this->getAbsPath($absHref);
$files = $this->readDir($absPath);
foreach ($files as $file) {
if (in_array($file, $indexFiles)) {
return 200;
}
}
return "h5ai";
}
}
?>

View file

@ -2,202 +2,202 @@
class Image {
private $sourceFile;
private $source;
private $width;
private $height;
private $type;
private $sourceFile;
private $source;
private $width;
private $height;
private $type;
private $dest;
private $dest;
public static function isUsable() {
public static function isUsable() {
return GD_VERSION != "GD_VERSION";
}
return GD_VERSION != "GD_VERSION";
}
public static function showImage($filename) {
public static function showImage($filename) {
$image = file_get_contents($filename);
header("content-type: image");
echo $image;
}
$image = file_get_contents($filename);
header("content-type: image");
echo $image;
}
public function __construct($filename = null) {
public function __construct($filename = null) {
$this->sourceFile = null;
$this->source = null;
$this->width = null;
$this->height = null;
$this->type = null;
$this->sourceFile = null;
$this->source = null;
$this->width = null;
$this->height = null;
$this->type = null;
$this->dest = null;
$this->dest = null;
$this->setSource($filename);
}
$this->setSource($filename);
}
public function __destruct() {
public function __destruct() {
$this->releaseSource();
$this->releaseDest();
}
$this->releaseSource();
$this->releaseDest();
}
public function setSource($filename) {
public function setSource($filename) {
$this->releaseSource();
$this->releaseDest();
$this->releaseSource();
$this->releaseDest();
if (is_null($filename)) {
return;
}
if (is_null($filename)) {
return;
}
$this->sourceFile = $filename;
$this->sourceFile = $filename;
list($this->width, $this->height, $this->type) = getimagesize($this->sourceFile);
list($this->width, $this->height, $this->type) = getimagesize($this->sourceFile);
$this->source = imagecreatefromstring(file_get_contents($this->sourceFile));
}
$this->source = imagecreatefromstring(file_get_contents($this->sourceFile));
}
public function showDest() {
public function showDest() {
if (!is_null($this->dest)) {
header("Content-type: image/jpeg");
imagejpeg($this->dest, null, 100);
}
}
if (!is_null($this->dest)) {
header("Content-type: image/jpeg");
imagejpeg($this->dest, null, 100);
}
}
public function saveDest($filename) {
public function saveDest($filename) {
if (!is_null($this->dest)) {
@imagejpeg($this->dest, $filename, 90);
@chmod($filename, 0775);
}
}
if (!is_null($this->dest)) {
@imagejpeg($this->dest, $filename, 90);
@chmod($filename, 0775);
}
}
public function releaseDest() {
public function releaseDest() {
if (!is_null($this->dest)) {
imagedestroy($this->dest);
$this->dest = null;
}
}
if (!is_null($this->dest)) {
imagedestroy($this->dest);
$this->dest = null;
}
}
public function releaseSource() {
public function releaseSource() {
if (!is_null($this->source)) {
imagedestroy($this->source);
$this->sourceFile = null;
$this->source = null;
$this->width = null;
$this->height = null;
$this->type = null;
}
}
if (!is_null($this->source)) {
imagedestroy($this->source);
$this->sourceFile = null;
$this->source = null;
$this->width = null;
$this->height = null;
$this->type = null;
}
}
private function magic($destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight, $canWidth = null, $canHeight = null, $color = null) {
private function magic($destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight, $canWidth = null, $canHeight = null, $color = null) {
if (!is_null($canWidth) && !is_null($canHeight)) {
$this->dest = imagecreatetruecolor($canWidth, $canHeight);
} else {
$this->dest = imagecreatetruecolor($destWidth, $destHeight);
}
if (!is_null($canWidth) && !is_null($canHeight)) {
$this->dest = imagecreatetruecolor($canWidth, $canHeight);
} else {
$this->dest = imagecreatetruecolor($destWidth, $destHeight);
}
if (is_null($color)) {
$color = array(255, 255, 255);
}
$icol = imagecolorallocate($this->dest, $color[0], $color[1], $color[2]);
imagefill($this->dest, 0, 0, $icol);
if (is_null($color)) {
$color = array(255, 255, 255);
}
$icol = imagecolorallocate($this->dest, $color[0], $color[1], $color[2]);
imagefill($this->dest, 0, 0, $icol);
imagecopyresampled($this->dest, $this->source, $destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight);
}
imagecopyresampled($this->dest, $this->source, $destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight);
}
public function thumb($mode, $width, $height = null, $color = null) {
public function thumb($mode, $width, $height = null, $color = null) {
if ($height === null) {
$height = $width;
}
if ($mode === "square") {
$this->squareThumb($width);
} elseif ($mode === "rational") {
$this->rationalThumb($width, $height);
} elseif ($mode === "center") {
$this->centerThumb($width, $height, $color);
} else {
$this->freeThumb($width, $height);
}
}
if ($height === null) {
$height = $width;
}
if ($mode === "square") {
$this->squareThumb($width);
} elseif ($mode === "rational") {
$this->rationalThumb($width, $height);
} elseif ($mode === "center") {
$this->centerThumb($width, $height, $color);
} else {
$this->freeThumb($width, $height);
}
}
public function squareThumb($width) {
public function squareThumb($width) {
$a = min($this->width, $this->height);
$x = intval(($this->width - $a) / 2);
$y = intval(($this->height - $a) / 2);
$a = min($this->width, $this->height);
$x = intval(($this->width - $a) / 2);
$y = intval(($this->height - $a) / 2);
$this->magic(0, 0, $x, $y, $width, $width, $a, $a);
}
$this->magic(0, 0, $x, $y, $width, $width, $a, $a);
}
public function rationalThumb($width, $height) {
public function rationalThumb($width, $height) {
$r = 1.0 * $this->width / $this->height;
$r = 1.0 * $this->width / $this->height;
$h = $height;
$w = $r * $h;
$h = $height;
$w = $r * $h;
if ($w > $width) {
if ($w > $width) {
$w = $width;
$h = 1.0 / $r * $w;
}
$w = $width;
$h = 1.0 / $r * $w;
}
$w = intval($w);
$h = intval($h);
$w = intval($w);
$h = intval($h);
$this->magic(0, 0, 0, 0, $w, $h, $this->width, $this->height);
}
$this->magic(0, 0, 0, 0, $w, $h, $this->width, $this->height);
}
public function centerThumb($width, $height, $color = null) {
public function centerThumb($width, $height, $color = null) {
$r = 1.0 * $this->width / $this->height;
$r = 1.0 * $this->width / $this->height;
$h = $height;
$w = $r * $h;
$h = $height;
$w = $r * $h;
if ($w > $width) {
if ($w > $width) {
$w = $width;
$h = 1.0 / $r * $w;
}
$w = $width;
$h = 1.0 / $r * $w;
}
$w = intval($w);
$h = intval($h);
$w = intval($w);
$h = intval($h);
$x = intval(($width - $w) / 2);
$y = intval(($height - $h) / 2);
$x = intval(($width - $w) / 2);
$y = intval(($height - $h) / 2);
$this->magic($x, $y, 0, 0, $w, $h, $this->width, $this->height, $width, $height, $color);
}
$this->magic($x, $y, 0, 0, $w, $h, $this->width, $this->height, $width, $height, $color);
}
public function freeThumb($width, $height) {
public function freeThumb($width, $height) {
$w = intval($width);
$h = intval($height);
$w = intval($width);
$h = intval($height);
$this->magic(0, 0, 0, 0, $w, $h, $this->width, $this->height);
}
$this->magic(0, 0, 0, 0, $w, $h, $this->width, $this->height);
}
}
?>

View file

@ -5,55 +5,55 @@ require_once "Image.php";
class Thumbnail {
private $srcAbsHref, $srcAbsPath, $width, $height, $name, $href, $path;
private $srcAbsHref, $srcAbsPath, $width, $height, $name, $href, $path;
public static function isUsable() {
public static function isUsable() {
return Image::isUsable();
}
return Image::isUsable();
}
public function __construct($h5ai, $absHref, $mode, $width, $height) {
public function __construct($h5ai, $absHref, $mode, $width, $height) {
$this->h5ai = $h5ai;
$this->srcAbsHref = $absHref;
$this->srcAbsPath = $this->h5ai->getDocRoot() . urldecode($absHref);
$this->width = $width;
$this->height = $height;
$this->mode = $mode;
$this->name = sha1("$this->srcAbsPath-$this->width-$this->height-$this->mode");
$this->href = $this->h5ai->getH5aiAbsHref() . "/cache/thumb-" . $this->name . ".jpg";
$this->path = $this->h5ai->getDocRoot() . $this->href;
$this->liveHref = $this->h5ai->api() . "?action=thumb&href=" . $this->srcAbsHref . "&width=" . $this->width . "&height=" . $this->height . "&mode=" . $this->mode;
}
$this->h5ai = $h5ai;
$this->srcAbsHref = $absHref;
$this->srcAbsPath = $this->h5ai->getDocRoot() . urldecode($absHref);
$this->width = $width;
$this->height = $height;
$this->mode = $mode;
$this->name = sha1("$this->srcAbsPath-$this->width-$this->height-$this->mode");
$this->href = $this->h5ai->getH5aiAbsHref() . "/cache/thumb-" . $this->name . ".jpg";
$this->path = $this->h5ai->getDocRoot() . $this->href;
$this->liveHref = $this->h5ai->api() . "?action=thumb&href=" . $this->srcAbsHref . "&width=" . $this->width . "&height=" . $this->height . "&mode=" . $this->mode;
}
public function create($force = 0) {
public function create($force = 0) {
if (
$force === 2
|| ($force === 1 && !file_exists($this->path))
|| (file_exists($this->path) && filemtime($this->srcAbsPath) >= filemtime($this->path))
) {
$image = new Image();
$image->setSource($this->srcAbsPath);
$image->thumb($this->mode, $this->width, $this->height);
$image->saveDest($this->path);
}
}
if (
$force === 2
|| ($force === 1 && !file_exists($this->path))
|| (file_exists($this->path) && filemtime($this->srcAbsPath) >= filemtime($this->path))
) {
$image = new Image();
$image->setSource($this->srcAbsPath);
$image->thumb($this->mode, $this->width, $this->height);
$image->saveDest($this->path);
}
}
public function getHref() {
public function getHref() {
return $this->href;
}
return $this->href;
}
public function getPath() {
public function getPath() {
return $this->path;
}
return $this->path;
}
public function getLiveHref() {
public function getLiveHref() {
return $this->liveHref;
}
return $this->liveHref;
}
}
?>

View file

@ -1,146 +1,146 @@
<?php
class TreeEntry {
private $h5ai, $label, $absPath, $absHref, $isFolder, $type, $content;
private $h5ai, $label, $absPath, $absHref, $isFolder, $type, $content;
public function __construct($h5ai, $absPath, $absHref, $type = null) {
public function __construct($h5ai, $absPath, $absHref, $type = null) {
$this->h5ai = $h5ai;
$this->h5ai = $h5ai;
$this->label = $this->h5ai->getLabel($absHref);
$this->absPath = $this->h5ai->normalizePath($absPath, false);
$this->isFolder = is_dir($this->absPath);
$this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder);
$this->label = $this->h5ai->getLabel($absHref);
$this->absPath = $this->h5ai->normalizePath($absPath, false);
$this->isFolder = is_dir($this->absPath);
$this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder);
$this->type = $type !== null ? $type : ($this->isFolder ? "folder" : $this->h5ai->getType($this->absPath));
$this->content = null;
}
$this->type = $type !== null ? $type : ($this->isFolder ? "folder" : $this->h5ai->getType($this->absPath));
$this->content = null;
}
public function loadContent() {
public function loadContent() {
$this->content = array();
$this->content = array();
if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") {
return;
}
if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") {
return;
}
$files = $this->h5ai->readDir($this->absPath);
foreach ($files as $file) {
$tree = new TreeEntry($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file));
$files = $this->h5ai->readDir($this->absPath);
foreach ($files as $file) {
$tree = new TreeEntry($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file));
if ($tree->isFolder) {
$this->content[$tree->absPath] = $tree;
}
}
if ($tree->isFolder) {
$this->content[$tree->absPath] = $tree;
}
}
$this->sort();
}
$this->sort();
}
public function cmpTrees($t1, $t2) {
public function cmpTrees($t1, $t2) {
if ($t1->isFolder && !$t2->isFolder) {
return -1;
}
if (!$t1->isFolder && $t2->isFolder) {
return 1;
}
return strcasecmp($t1->absPath, $t2->absPath);
}
if ($t1->isFolder && !$t2->isFolder) {
return -1;
}
if (!$t1->isFolder && $t2->isFolder) {
return 1;
}
return strcasecmp($t1->absPath, $t2->absPath);
}
public function sort() {
public function sort() {
if ($this->content !== null) {
uasort($this->content, array($this, "cmpTrees"));
}
}
if ($this->content !== null) {
uasort($this->content, array($this, "cmpTrees"));
}
}
public function toHtml() {
public function toHtml() {
$classes = "entry " . $this->type . ($this->absHref === $this->h5ai->getAbsHref() ? " current" : "");
$icon = $this->type;
if ($this->absHref === "/") {
$icon = "folder-home";
}
$hint = "";
$code = "h5ai";
$classes = "entry " . $this->type . ($this->absHref === $this->h5ai->getAbsHref() ? " current" : "");
$icon = $this->type;
if ($this->absHref === "/") {
$icon = "folder-home";
}
$hint = "";
$code = "h5ai";
if ($this->isFolder) {
$code = $this->h5ai->getHttpCode($this->absHref);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$icon = "folder-page";
$hint = "<span class='hint'><img src='" . $this->h5ai->image("page") . "' alt='page' /></span>";
} else {
$classes .= " error";
$hint = "<span class='hint'> " . $code . " </span>";
}
}
}
if ($this->isFolder) {
$code = $this->h5ai->getHttpCode($this->absHref);
$classes .= " checkedHttpCode";
if ($code !== "h5ai") {
if ($code === 200) {
$icon = "folder-page";
$hint = "<span class='hint'><img src='" . $this->h5ai->image("page") . "' alt='page' /></span>";
} else {
$classes .= " error";
$hint = "<span class='hint'> " . $code . " </span>";
}
}
}
$html = "<div class='" . $classes ."'>\n";
if ($this->content !== null && count($this->content) === 0 || $code !== "h5ai") {
$html .= "<span class='blank'></span>\n";
} else {
$indicatorState = $this->content === null ? " unknown" : " open";
$html .= "<span class='indicator" . $indicatorState . "'><img src='" . $this->h5ai->image("tree") . "' alt='>' /></span>\n";
}
$html .= "<a href='" . $this->absHref . "'>\n";
$html .= "<span class='icon'><img src='" . $this->h5ai->icon($icon) . "' alt='" . $icon . "' /></span>\n";
$html .= "<span class='label'>" . $this->label . "</span>" . $hint . "\n";
$html .= "</a>\n";
$html .= $this->contentToHtml();
$html .= "</div>\n";
return $html;
}
$html = "<div class='" . $classes ."'>\n";
if ($this->content !== null && count($this->content) === 0 || $code !== "h5ai") {
$html .= "<span class='blank'></span>\n";
} else {
$indicatorState = $this->content === null ? " unknown" : " open";
$html .= "<span class='indicator" . $indicatorState . "'><img src='" . $this->h5ai->image("tree") . "' alt='>' /></span>\n";
}
$html .= "<a href='" . $this->absHref . "'>\n";
$html .= "<span class='icon'><img src='" . $this->h5ai->icon($icon) . "' alt='" . $icon . "' /></span>\n";
$html .= "<span class='label'>" . $this->label . "</span>" . $hint . "\n";
$html .= "</a>\n";
$html .= $this->contentToHtml();
$html .= "</div>\n";
return $html;
}
public function contentToHtml() {
public function contentToHtml() {
$html = "<ul class='content'>\n";
if ($this->content !== null) {
foreach($this->content as $tree) {
$html .= "<li>" . $tree->toHtml() . "</li>";
}
}
$html .= "</ul>\n";
return $html;
}
$html = "<ul class='content'>\n";
if ($this->content !== null) {
foreach($this->content as $tree) {
$html .= "<li>" . $tree->toHtml() . "</li>";
}
}
$html .= "</ul>\n";
return $html;
}
public function getRoot() {
public function getRoot() {
if ($this->absHref === "/") {
return $this;
};
if ($this->absHref === "/") {
return $this;
};
$tree = new TreeEntry($this->h5ai, dirname($this->absPath), dirname($this->absHref));
$tree->loadContent();
$tree->content[$this->absPath] = $this;
$tree = new TreeEntry($this->h5ai, dirname($this->absPath), dirname($this->absHref));
$tree->loadContent();
$tree->content[$this->absPath] = $this;
return $tree->getRoot();
}
return $tree->getRoot();
}
}
class Tree {
private $h5ai;
private $h5ai;
public function __construct($h5ai) {
public function __construct($h5ai) {
$this->h5ai = $h5ai;
}
$this->h5ai = $h5ai;
}
public function toHtml() {
public function toHtml() {
$options = $this->h5ai->getOptions();
if ($options["showTree"] === false) {
return "";
}
$options = $this->h5ai->getOptions();
if ($options["showTree"] === false) {
return "";
}
$tree = new TreeEntry($this->h5ai, $this->h5ai->getAbsPath(), $this->h5ai->getAbsHref());
$tree->loadContent();
$root = $tree->getRoot();
return "<section id='tree'>\n" . $root->toHtml() . "</section>\n";
}
$tree = new TreeEntry($this->h5ai, $this->h5ai->getAbsPath(), $this->h5ai->getAbsHref());
$tree->loadContent();
$root = $tree->getRoot();
return "<section id='tree'>\n" . $root->toHtml() . "</section>\n";
}
}

View file

@ -1,63 +1,63 @@
<?php
class ZipIt {
private $h5ai;
private $h5ai;
public function __construct($h5ai) {
public function __construct($h5ai) {
$this->h5ai = $h5ai;
}
$this->h5ai = $h5ai;
}
public function zip($hrefs) {
public function zip($hrefs) {
$zipFile = tempnam("/tmp", "h5ai-download");
$zip = new ZipArchive();
$zipFile = tempnam("/tmp", "h5ai-download");
$zip = new ZipArchive();
if (!$zip->open($zipFile, ZIPARCHIVE::CREATE)) {
return false;
}
if (!$zip->open($zipFile, ZIPARCHIVE::CREATE)) {
return false;
}
foreach ($hrefs as $href) {
$d = dirname($href);
$n = basename($href);
if ($this->h5ai->getHttpCode($this->h5ai->getAbsHref($d)) === "h5ai" && !$this->h5ai->ignoreThisFile($n)) {
$localFile = $this->h5ai->getAbsPath($href);
$file = preg_replace("!^" . $this->h5ai->getDocRoot() . "!", "", $localFile);
if (is_dir($localFile)) {
$this->zipDir($zip, $localFile, $file);
} else {
$this->zipFile($zip, $localFile, $file);
}
}
}
foreach ($hrefs as $href) {
$d = dirname($href);
$n = basename($href);
if ($this->h5ai->getHttpCode($this->h5ai->getAbsHref($d)) === "h5ai" && !$this->h5ai->ignoreThisFile($n)) {
$localFile = $this->h5ai->getAbsPath($href);
$file = preg_replace("!^" . $this->h5ai->getDocRoot() . "!", "", $localFile);
if (is_dir($localFile)) {
$this->zipDir($zip, $localFile, $file);
} else {
$this->zipFile($zip, $localFile, $file);
}
}
}
$zip->close();
return $zipFile;
}
$zip->close();
return $zipFile;
}
private function zipFile($zip, $localFile, $file) {
private function zipFile($zip, $localFile, $file) {
if (is_readable($localFile)) {
$zip->addFile($localFile, $file);
}
}
if (is_readable($localFile)) {
$zip->addFile($localFile, $file);
}
}
private function zipDir($zip, $localDir, $dir) {
private function zipDir($zip, $localDir, $dir) {
if ($this->h5ai->getHttpCode($this->h5ai->getAbsHref($localDir)) === "h5ai") {
$zip->addEmptyDir($dir);
$files = $this->h5ai->readDir($localDir);
foreach ($files as $file) {
$localFile = $localDir . "/" . $file;
$file = $dir . "/" . $file;
if (is_dir($localFile)) {
$this->zipDir($zip, $localFile, $file);
} else {
$this->zipFile($zip, $localFile, $file);
}
}
}
}
if ($this->h5ai->getHttpCode($this->h5ai->getAbsHref($localDir)) === "h5ai") {
$zip->addEmptyDir($dir);
$files = $this->h5ai->readDir($localDir);
foreach ($files as $file) {
$localFile = $localDir . "/" . $file;
$file = $dir . "/" . $file;
if (is_dir($localFile)) {
$this->zipDir($zip, $localFile, $file);
} else {
$this->zipFile($zip, $localFile, $file);
}
}
}
}
}
?>

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="wepp.macros" basedir=".">
<macrodef name="wepp">
<attribute name="file" />
<attribute name="toFile" />
<attribute name="args" default="" />
<sequential>
<exec executable="${tool.wepp}">
<arg line="@{args}" />
<arg value="--in" />
<arg value="@{file}" />
<arg value="--out" />
<arg value="@{toFile}" />
</exec>
</sequential>
</macrodef>
<macrodef name="wepp">
<attribute name="file" />
<attribute name="toFile" />
<attribute name="args" default="" />
<sequential>
<exec executable="${tool.wepp}">
<arg line="@{args}" />
<arg value="--in" />
<arg value="@{file}" />
<arg value="--out" />
<arg value="@{toFile}" />
</exec>
</sequential>
</macrodef>
<macrodef name="wepp.dir">
<attribute name="dir" />
<attribute name="args" default="" />
<sequential>
<exec executable="${tool.wepp}">
<arg line="@{args}" />
<arg value="--inDir" />
<arg value="@{dir}" />
<arg value="--outDir" />
<arg value="@{dir}" />
</exec>
<delete dir="@{dir}/inc">
<fileset
dir="."
includes="@{dir}/**/*.less"
excludes="@{dir}/inc/**,@{dir}/lib/**"
/>
</delete>
</sequential>
</macrodef>
<macrodef name="wepp.dir">
<attribute name="dir" />
<attribute name="args" default="" />
<sequential>
<exec executable="${tool.wepp}">
<arg line="@{args}" />
<arg value="--inDir" />
<arg value="@{dir}" />
<arg value="--outDir" />
<arg value="@{dir}" />
</exec>
<delete dir="@{dir}/inc">
<fileset
dir="."
includes="@{dir}/**/*.less"
excludes="@{dir}/inc/**,@{dir}/lib/**"
/>
</delete>
</sequential>
</macrodef>
</project>