]> git.plutz.net Git - confetti/blob - templates/frame.html.sh
return to configure interface after bookmark change
[confetti] / templates / frame.html.sh
1 #!/bin/zsh
2
3 # Copyright 2014, 2015, 2017 Paul Hänsch
4 #
5 # This file is part of Confetti.
6
7 # Confetti is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 # Confetti is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Affero General Public License for more details.
16
17 # You should have received a copy of the GNU Affero General Public License
18 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
19
20 . "${_EXEC}/templates/text_frame.sh"
21 [ -x "${_EXEC}/templates/text_${PAGE}.sh" ] && . "${_EXEC}/templates/text_${PAGE}.sh"
22
23 bmfile="${_DATA}/mappings/bookmarks"
24
25 cat <<EOF
26 <!Doctype HTML>
27
28 <html>
29   <head>
30     <title>$(l10n p_${PAGE})</title>
31     <meta name="viewport" content="width=device-width">
32     <link rel="stylesheet" href="?static=common.css">
33     <link rel="stylesheet" href="?static=${PAGE}.css">
34   </head>
35   <body class="$PAGE" id="CONFIGURE">
36     <div class="NAVIGATION">
37       $(sed -rn '/^[^ ]+\t[^ ]+$/p' "$bmfile" \
38         | while read page name; do
39         printf '<a href="%s">%s</a>' "${page}" "${name}"
40       done)
41       <label for="navigationconfig">$(l10n nc_edit)</label>
42       <input  id="navigationconfig" class="config" type="checkbox" />
43       <form class="config" method="POST" action="?action=update_bookmarks">
44         $(for page in "${_EXEC}/pages/"*.sh; do
45           page="${page##*/}"
46           page="${page%.sh}"
47           printf '<a href="?p=%s">%s</a>\n' "${page}" "$(l10n "p_${page}")"
48         done |grep -E '^<a href="\?p='"${page_filter}" )
49         $(if grep -qF "$REQUEST_URI" "$bmfile"; then
50           printf '<input type="hidden" name="bm_url" value="%s" />
51                   <input type="text" name="bm_name" value="%s" readonly="readonly" /
52                   ><button type="submit" name="submit" value="del">%s</button>' \
53                   "$(attribsafe ${REQUEST_URI})" \
54                   "$(attribsafe $(grep -m1 -F "$REQUEST_URI     " "$bmfile" |sed -r 's;.*\t;;'))" \
55                   "$(l10n bm_del)"
56         else
57           printf '<input type="hidden" name="bm_url" value="%s" />
58                   <input type="text" name="bm_name" placeholder="%s" /
59                   ><button type="submit" name="submit" value="add">%s</button>' \
60                   "$(attribsafe ${REQUEST_URI})" "$(l10n Bookmark)" "$(l10n bm_add)"
61         fi)
62       </form>
63     </div>
64 EOF
65
66 debug BODY; [ -x "${BODY}" ] && . "${BODY}" || printf %s 'Error'
67
68 cat <<EOF
69   <div id="footer">
70     <a href="#CONFIGURE">$(l10n configure)</a>
71   </div>
72 </body></html>'
73 EOF
74
75 # vi:set filetype=html: