]> git.plutz.net Git - serve0/commitdiff
Page titles based on content, improved display of quicklinks
authorpaul <paul@plutz.net>
Sat, 23 Jan 2016 13:58:34 +0000 (13:58 +0000)
committerpaul <paul@plutz.net>
Sat, 23 Jan 2016 13:58:34 +0000 (13:58 +0000)
svn path=/trunk/; revision=101

pages/list.sh
pages/view.sh
templates/frame.html.sh

index 0870961fa124b7b498214dd66d2cef358a441406..deb8ce8518316311e29378f6512d3598f4496082 100755 (executable)
@@ -24,14 +24,27 @@ LF='
 filters="${_GET[f]}"
 debug "FILTERS: $filters"
 
+present_filter(){ printf %s "$*" |sed -r 's;(^|!|\^|\|)([^!\^\|:]+:);\1;g;s;\^; \&amp\; ;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="<a href="$line">$line</a>" 
     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 "<a href="$line">by ${lineo}: $(present_filter "$linef")</a>" 
+  done
 }
 
 category_selected(){
index ec873bda530c1e03665cabf19a523e1a1cbafb21..fef4f780a8066c5d203df769748b4aead5cc8bf5 100755 (executable)
@@ -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#/}"
index 7d953da972f014665bbed2df282426d4dadf278d..6350bd2f72c976008dedd831c4d16f22998dff5a 100755 (executable)
@@ -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 <<EOF
 <html>
   <head>
     <meta name="viewport" content="width=device-width">
-    <title>${PAGE}</title>
+    <title>${TITLE:-${PAGE}}</title>
     <style type="text/css">
     <!--
     $(. "${_EXEC}/templates/common.css.sh")