#!/bin/sh
-# Copyright 2022 - 2023 Paul Hänsch
+# Copyright 2022 - 2024 Paul Hänsch
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
theme_head(){
local IFS="$BR"
printf '
+ <meta charset="utf-8">
<meta name="viewport" content="width=device-width">
'
for css in "$_BASE/%5B.%5D/cgilite/common.css" "$_BASE/%5B.%5D/themes/default.css" $PAGE_CSS; do
}
theme_editor(){
- local page="$1" template="$2" title file att
- title="$(HTML "${PAGE_TITLE:-"${page}"}")"
+ local page="$1" template="$2" file att
[ "$template" ] && acl_read "$template" || template="$page"
- theme_page - "Editor: $title" <<-EOF
+ theme_page - "$(_ Editor): ${PAGE_TITLE:-"${page}"}" <<-EOF
<input checked type=radio class=tab name=edithelp value=edtr id=editor><label for=editor>$(_ Editor)</label>
<input type=radio class=tab name=edithelp value=help id=syntax><label for=syntax>$(_ Syntax)</label>
<input type=radio class=tab name=edithelp value=att id=attach><label for=attach>$(_ Attachments)</label>
theme_revisions(){ theme_page "$@"; }
-theme_search(){
- local words="$*"
- # STDIN: read result pages line by line
-
- theme_page - <<-EOF
- <article>
- <h1>$([ "$words" ] && _ "Search results" || _ "Search" )</h1>
- <form class="search" method="GET">
- <input class="search" name="q" value="$(HTML $words)"><button class="search" type="submit">$(_ Search)</button>
- </form>
- <ol class="searchresults">
- $( while read p; do
- printf '<li><a href="%s">%s</a></li>' "$(URL "$p")" "$(HTML "$p")"
- done)
- </ol>
- </article>
- EOF
-}
-
theme_attachments(){
- local page="$1" title
- title="${page%/}"; title="${title##*/}"
+ local page="$1"
if acl_write "$page"; then
- theme_page - "$(_ Attachments): $title" <<-EOF
+ theme_page - "$(_ Attachments): ${PAGE_TITLE:-"${page}"}" <<-EOF
<form class=upload method=POST enctype="multipart/form-data">
<h2>$(_ Upload)</h2>
<input type=hidden name=session_id value="$SESSION_ID">
</form>
EOF
else
- theme_page - "$(_ Attachments): $title" <<-EOF
+ theme_page - "$(_ Attachments): ${PAGE_TITLE:-"${page}"}" <<-EOF
<ul class="attachment list">
$(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do
[ "$file" = "$_EXEC/pages/$page/#attachments/${file##*/}" \