From 2edcbbf297550b107825697e22e3a19c82ed51f2 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 23 Jan 2016 13:58:34 +0000 Subject: [PATCH] Page titles based on content, improved display of quicklinks svn path=/trunk/; revision=101 --- pages/list.sh | 17 +++++++++++++++-- pages/view.sh | 2 ++ templates/frame.html.sh | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/pages/list.sh b/pages/list.sh index 0870961..deb8ce8 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -24,14 +24,27 @@ LF=' filters="${_GET[f]}" debug "FILTERS: $filters" +present_filter(){ printf %s "$*" |sed -r 's;(^|!|\^|\|)([^!\^\|:]+:);\1;g;s;\^; \&\; ;g' } + +if [ -n "$search" ]; then + TITLE="$search by $order" +elif [ -n $filter ]; then + TITLE="$(present_filter "$filter") by $order" +else + TITLE="List by $order" +fi + quicklinks(){ output='' tac ${_DATA}/meta/recent \ | while [ "$(printf %s "$output" |wc -l)" -lt 10 ] && read line; do - line="$line" printf %s "$output" |grep -qF "$line" || output="$output$line$LF" done - printf %s\\n "$output" + printf %s "$output" |while read line; do + linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g') + lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g') + printf %s "by ${lineo}: $(present_filter "$linef")" + done } category_selected(){ diff --git a/pages/view.sh b/pages/view.sh index ec873bd..fef4f78 100755 --- a/pages/view.sh +++ b/pages/view.sh @@ -23,6 +23,8 @@ info="${_GET[i]}" location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)" directory="${location%/*}" +TITLE="$info" + meta="${_DATA}/meta/$info.meta" [ -n "$info" ] && video="${_DATA}/videos/$info" \ || video="${treeroot%/}/${location#/}" diff --git a/templates/frame.html.sh b/templates/frame.html.sh index 7d953da..6350bd2 100755 --- a/templates/frame.html.sh +++ b/templates/frame.html.sh @@ -1,4 +1,4 @@ -# Copyright 2014, 2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Serve0 # @@ -21,7 +21,7 @@ cat < - ${PAGE} + ${TITLE:-${PAGE}}