--- /dev/null
+#!/bin/zsh
+
+# Copyright 2017 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
+
+bmfile="${_DATA}/mappings/bookmarks"
+ url="$(validate "${_POST[bm_url]}" '/.+' '/')"
+name="$(validate "${_POST[bm_name]}" '.+' "$url")"
+
+case "${_POST[submit]}" in
+ add) printf '%s\t%s\n' "${url}" "${name}" >>"${bmfile}"
+ ;;
+ del) cp "${bmfile}" "${bmfile}.temp"
+ grep -vF "${url} ${name}" "${bmfile}.temp" >"${bmfile}"
+ rm "${bmfile}.temp"
+ ;;
+esac
+
+
+redirect "${url}"
body {
background: #EEE;
margin: 0;
- padding: 2.5em 0 0 0;
+ padding: 0;
+ padding-top: 2.5em;
}
.NAVIGATION {
position: fixed;
border-style: none solid solid solid;
border-width: 0 1px 1px 1px;
border-radius: 0 0 4px 4px;
- margin: 0 auto auto 3%;
- padding: .5em 1ex .5em 1ex;
+ margin: 0 2em;
+ padding: .5em 1ex;
background: #FFF;
z-index: 1;
}
+.NAVIGATION label,
.NAVIGATION a {
color: #008;
border: solid 1px #BBF;
padding: .2em 3ex .2em 3ex;
background: #EFF;
}
+.NAVIGATION label:hover,
.NAVIGATION a:hover {
- border-width: 2px 1px 2px 1px;
+ border-width: 2px 1px;
background: #F3FFFF;
}
+.NAVIGATION input#navigationconfig { display: none; }
+.NAVIGATION label[for=navigationconfig] { }
+.NAVIGATION input + label + form.config {
+ position: static;
+ display: none;
+}
+.NAVIGATION .config a { display: block; }
+.NAVIGATION .config a:hover { border-width: 1px 2px; }
+.NAVIGATION input:checked + label + form.config { display: block; }
+.NAVIGATION .config input[type=text],
+.NAVIGATION .config button {
+ font-size: .875em;
+ line-height: 1.5em;
+ height: 1.75em;
+ padding: 0 .25em;
+ vertical-align: bottom;
+ border: 1px solid #000;
+ background-color: #FFF;
+}
+.NAVIGATION .config input[type=text] {
+ margin: .25em 0 0 .375em;
+ border-right: none;
+ width: 70%;
+}
+.NAVIGATION .config button {
+ min-width: 2.5em;
+ text-align: center;
+ max-width: 30%;
+}
+.NAVIGATION .config button[value=del] {
+ background: #FCC;
+}
+
+
.trailbtn { display: none; }
.trailbtn + .trailbox { display: none; }
.trailbtn:checked + .trailbox { display: inline-block; }
form > button[type=submit] {
position: fixed; display: block;
- top: 0; left: 15em;
+ top: 0; right: 2.5em;
height: 2.25em; padding: 0 3ex;
font-size: 1em; font-weight: bold;
color: #000; background-color: #FDD;
#!/bin/zsh
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014, 2015, 2017 Paul Hänsch
#
# This file is part of Confetti.
#
. "${_EXEC}/templates/text_frame.sh"
[ -x "${_EXEC}/templates/text_${PAGE}.sh" ] && . "${_EXEC}/templates/text_${PAGE}.sh"
+bmfile="${_DATA}/mappings/bookmarks"
+
cat <<EOF
<!Doctype HTML>
</head>
<body class="$PAGE">
<div class="NAVIGATION">
- $(debug NAVIGATION = "$NAVIGATION"; for each in ${NAVIGATION}; do printf %s "<a href=\"?p=${each}\">$(l10n "p_${each}")</a>"; done)
+ $(sed -rn '/^[^ ]+\t[^ ]+$/p' "$bmfile" \
+ | while read page name; do
+ printf '<a href="%s">%s</a>' "${page}" "${name}"
+ done)
+ <input id="navigationconfig" class="config" type="checkbox" />
+ <label for="navigationconfig">$(l10n nc_edit)</label>
+ <form class="config" method="POST" action="?action=update_bookmarks">
+ $(for page in "${_EXEC}/pages/"*.sh; do
+ page="${page##*/}"
+ page="${page%.sh}"
+ printf '<a href="?p=%s">%s</a>' "${page}" "$(l10n "p_${page}")"
+ done)
+ $(if grep -qF "$REQUEST_URI" "$bmfile"; then
+ printf '<input type="hidden" name="bm_url" value="%s" />
+ <input type="text" name="bm_name" value="%s" readonly="readonly" /
+ ><button type="submit" name="submit" value="del">%s</button>' \
+ "$(attribsafe ${REQUEST_URI})" "$(attribsafe $(grep -F "$REQUEST_URI " "$bmfile" |sed -r 's;.*\t;;'))" "$(l10n bm_del)"
+ else
+ printf '<input type="hidden" name="bm_url" value="%s" />
+ <input type="text" name="bm_name" placeholder="%s" /
+ ><button type="submit" name="submit" value="add">%s</button>' \
+ "$(attribsafe ${REQUEST_URI})" "$(l10n Bookmark)" "$(l10n bm_add)"
+ fi)
+ </form>
</div>
EOF
item_name[p_categories]="Kategorien"
item_name[p_prescriptions]="Verschreibungen"
item_name[p_therapy]="Therapie"
+item_name[nc_edit]="⚙"
+#item_name[nc_edit]="☰"
+item_name[bm_add]="+"
+item_name[bm_del]="-"
case $PROFILE in
medical)