misc fixes to indexing

This commit is contained in:
Jaromil 2014-10-19 18:53:23 +02:00
parent c7f194f2b1
commit 5be5585483
3 changed files with 27 additions and 6 deletions

View File

@ -117,7 +117,7 @@ apache alias. To configure this use `FILES_ROOT` in config.zsh.
Bleeding edge is on GitHub. see https://github.com/dyne/webnomad
Pull requests may be welcome.
Pull requests and translations of this documentation are welcome.
Come on IRC channel #dyne via https://irc.dyne.org to get in touch.

27
index
View File

@ -303,16 +303,19 @@ EOF
index_long_preview() {
dir="${1}"
func "index_long_preview \"$dir\""
func "index data: $archive/$dir"
func "index url: $url / $dir"
{ test -d "$archive/$dir" } || { error "cannot index: not a directory '$archive/$dir'"; return 1 }
{ test -d "$dir" } || { error "cannot index: not a directory '$dir'"; return 1 }
files=()
ttmp=`ls -l --time-style=long-iso "$dir" | awk '
ttmp=`ls -l --time-style=long-iso "${archive}/${dir}" | awk '
/^total/ { next }
/^$/ { next }
{ printf "files+=(\"%s;%s;%s\");", $8, $5, $6 }
'`
{ test $? = 0 } || {
error "Error parsing directory: $dir"
error "Error parsing directory: ${archive}/${dir}"
return 1 }
eval "$ttmp"
@ -334,6 +337,24 @@ index_long_preview() {
<th class="col-sm-3 col-md-4 col-lg-5">Preview</th>
</tr></thead>
EOF
# if not parent offer to go up
[[ "$dir" = "" ]] || {
func "parent: $parent"
cat <<EOF
<tr>
<td style="vertical-align:middle;">
<a href="${parent}/index${EXTENSION}">
<img src="${WEB_ROOT}/icons${THUMB_SIZE}/go-up.png"
alt="parent directory" title="go to parent"></a></td>
<td style="vertical-align:middle;font-size:1.5em;word-wrap:break-word" colspan="4">
<a href="${parent}/index${EXTENSION}">
.. [ parent ]</a></td>
</tr>
EOF
}
for f in ${files}; do
name="${f[(ws:;:)1]}"
size="${f[(ws:;:)2]}"

4
test
View File

@ -5,9 +5,9 @@ STYLING=0
# make it work to browse results on file://
baseurl="file://`pwd`/test/"
includejs+=(jquery.min.js jquery.sidr.js)
# includejs+=(jquery.min.js jquery.sidr.js)
includecss+=(jquery.sidr.dark.css)
# includecss+=(jquery.sidr.dark.css)
{ test "$STYLING" = "1" } || { render_test_footer() { return 0 }; return 0 }