From d5fb0b81bce3f19153b9c74f4bc17fe7a3043a7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 18 Jan 2019 13:49:53 +0100 Subject: [PATCH] refactoring card display --- cards/cards.html.sh | 130 ------------------------------------- cards/cards.sh | 136 --------------------------------------- cards/filter_card.sh | 21 +++--- cards/l10n.sh | 139 ++++++++++++++++++++++++++++++++++++++++ cards/main.cgi | 36 +++++++++++ cards/text_cards.sh | 133 -------------------------------------- cards/widgets.sh | 85 ++++++++++++++++++++++++ frame.html.sh | 65 ++++--------------- index.cgi | 12 ++-- common.css => style.css | 0 10 files changed, 287 insertions(+), 470 deletions(-) delete mode 100755 cards/cards.html.sh create mode 100755 cards/l10n.sh create mode 100755 cards/main.cgi delete mode 100755 cards/text_cards.sh create mode 100755 cards/widgets.sh rename common.css => style.css (100%) diff --git a/cards/cards.html.sh b/cards/cards.html.sh deleted file mode 100755 index bf84eee..0000000 --- a/cards/cards.html.sh +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright 2014 - 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 . - -setchecked() { - printf 'checked="checked"' -} -check_type(){ - [ "${_GET[filter]%%:*}" = "$1" ] && setchecked -} -check_order(){ - [ "${_GET[order]}" = "$1" ] && setchecked -} - -filter_item() { -cat < - $(l10n filter_item): - - - - - - - - - - - - - - - - - - - - - - - - - -
- $(m=3 - list_categories \ - | while read cat; do - printf '' \ - "$((n + m))" "$(attribsafe "$cat")" "$(printf %s "$cat" |grep -qEx "$2" && setchecked)" "$(htmlsafe "$cat")" - m=$((m + 1)) - done - ) - $(l10n edit_categories) -
- - - -EOF -} - -cat < -

$(l10n filter_label)

- - - $( - n=0; m="$(list_categories |wc -l)" - printf '%s\n' "${_GET[filter]}" |tr '^' '\n' \ - | while read filter; do - [ -n "$filter" ] && filter_item "${filter%%:*}" "${filter#*:}" "$n" - n=$((n + 3 + m)) - done - filter_item any '' "$n" - ) - -
- $(l10n filter_order): - - - -
- - - - -
- -
- -${edit:+$(edit_card "$edit")} -EOF - -listcards |grep ${edit:+-v} "$edit" \ -| while read card; do - cat <<-ENDCARD -
- $(view_card "$card")
- $(l10n edit) - $(l10n vcf_export) - ${profile_medical:+ - $(l10n new_prescription) - } -
-
- ENDCARD -done - -# vi:set filetype=html: diff --git a/cards/cards.sh b/cards/cards.sh index a90981c..a26b1fc 100755 --- a/cards/cards.sh +++ b/cards/cards.sh @@ -103,142 +103,6 @@ listcards() { | sed -r 's;^(.*/)*;;;' } -vcf_parse() { - unset key - sed -r ':X;N;$!bX; s;\r\n[ \t];;g; s;\r\n;\n;g;' "$1" \ - | sed -rn ' - # === turn property names to upper case, strip group names === - h; s;^([^;:]+);;; - x; s;^([^;:\.]+\.)?([^;:]+).*$;\2;; - y;abcdefghijklmnopqrstuvwxyz;ABCDEFGHIJKLMNOPQRSTUVWXYZ; - G; s;\n;;; - - # === strip trailing CR (but keep CRs in property value) === - s;\r$;;; - - # === Normalise various known vendor properties === - s;^X-MS-CARDPICTURE(\;|:);PHOTO\1;; - s;^X-GENDER(\;|:);GENDER\1;; - s;^X-ANNIVERSARY(\;|:);ANNIVERSARY\1;; - s;^X-EVOLUTION-ANNIVERSARY(\;|:);ANNIVERSARY\1;; - s;^X-KADDRESSBOOK-X-ANNIVERSARY(\;|:);ANNIVERSARY\1;; - s;^X-EVOLUTION-BLOG-URL(\;|:);URL\1;; - s;^AGENT(\;|:);RELATED\;VALUE=text\;TYPE=agent\1;; - s;^X-ASSISTANT(\;|:);RELATED\;VALUE=text\;TYPE=assistant\1;; - s;^X-EVOLUTION-ASSISTANT(\;|:);RELATED\;VALUE=text\;TYPE=assistant\1;; - s;^X-KADDRESSBOOK-X-ASSISTANTSNAME(\;|:);RELATED\;VALUE=text\;TYPE=assistant\1;; - s;^X-MANAGER(\;|:);RELATED\;VALUE=text\;TYPE=manager\1;; - s;^X-EVOLUTION-MANAGER(\;|:);RELATED\;VALUE=text\;TYPE=manager\1;; - s;^X-KADDRESSBOOK-X-MANAGERSNAME(\;|:);RELATED\;VALUE=text\;TYPE=manager\1;; - s;^X-SPOUSE(\;|:);RELATED\;VALUE=text\;TYPE=spouse\1;; - s;^X-EVOLUTION-SPOUSE(\;|:);RELATED\;VALUE=text\;TYPE=spouse\1;; - s;^X-KADDRESSBOOK-X-SPOUSENAME(\;|:);RELATED\;VALUE=text\;TYPE=spouse\1;; - - # === Normalise obsolete vendor IM properties === - s;^X-AIM((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:aim:;; - s;^X-ICQ((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:aim:;; - s;^X-GOOGLE-TALK((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:xmpp:;; - s;^X-JABBER((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:xmpp:;; - s;^X-MSN((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:msn:;; - s;^X-YAHOO((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):;IMPP\1:ymsgr:;; - s;^X-SIP((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):(sip:)?;IMPP\1:sip:;; - - # === Update obsolete LABEL property === - s;^LABEL((\;[A-z0-9-]+|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):(.*)$;ADR\1\;LABEL="\5":;; - - /^([A-Z0-9-]+)((\;[A-z0-9-]+=?|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):(.*)$/{ - h; - s;^([A-Z0-9-]+)((\;[A-z0-9-]+=?|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):(.*)$;key='\''\1'\'';; - H; g; - - s;^([A-Z0-9-]+)((\;[A-z0-9-]+=?|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):([^\n]*)\n.*$;\2;; - s;'\'';'\'\\\\\'\'';g - s;\;([A-Z0-9-]+)(=|=(([^\;,:"]+|"[^"]+")(,[^\;,:"]+|,"[^"]+")*))?;\ntag[\1]='\''\3'\'';g - s;^\n+;;; s;\n+$;;; - /^.+$/H; g; - - s;^([A-Z0-9-]+)((\;[A-z0-9-]+=?|\;[A-z0-9-]+=([^;,:"]+|"[^"]+")(,[^;,:"]+|,"[^"]+")*)*):([^\n]*)\n.*$;\6;; - # :X s;((^|[^\\])(\\\\)*)[;,];\1\n;g; s;((^|[^\\])(\\\\)*)\\([;,]);\4;g; tX; - s;'\'';'\'\\\\\'\'';g - s;^.*$;value='\''&'\''; - H; g; - - s;^[^\n]*[\n ]+;; - s;\n+$;;; - - p; - } - ' \ - | while read -r line; do - declare -A tag - case "$line" in - value*) eval "$line";; - tag*) eval "$line";; - key*) - if [ -z "$key" ]; then - eval "$line" - else - printf '%s\n' "$value" |sed -rn ' - :X - s;((^|[^\\])(\\\\)*),;\1\n;g; - tX; - s;\\,;,;g; - p - ' \ - | while read -r val; do - while [ -n "${values[$key$n]+x}" ]; do n=$((${n=-1} + 1)); done - if printf '%s\n' "$val" |grep -qE '((^|[^\\])(\\\\)*)\;'; then - m=0 - values[${key}${n}]="${val}" - printf '%s\n' "$val" |sed -rn ' - :X - s;((^|[^\\])(\\\\)*)\;;\1\n;g; - tX; - s;\\\;;\;;g; - p - ' \ - | while read -r v; do - values[${key}${n}+${m}]="$( - printf %s\\n "${v}" \ - | sed -rn ' - :X - s;((^|[^\\])(\\\\)*)\\n;\1\n;g; - tX; - s;\\\\;\\;g; - p - ' - )" - m=$(($m + 1)) - done - else - values[${key}${n}]="$( - printf %s\\n "${val}" \ - | sed -rn ' - :X - s;((^|[^\\])(\\\\)*)\\n;\1\n;g; - tX; - s;\\\;;\;;g; - s;\\\\;\\;g; - p - ' - )" - fi - for t in ${(k)tag}; do - values[${key}${n}_${t}]="${tag[$t]}" - done - done - - eval "$line" - unset n - while [ -n "${values[$key$n]+x}" ]; do n=$((${n=-1} + 1)); done - unset value - unset tag - fi - ;; - esac - done -} - view_card() { #Parameter: Cardfile id="$1" cardfile="$_DATA/vcard/${id}" diff --git a/cards/filter_card.sh b/cards/filter_card.sh index cc0f912..d09adab 100755 --- a/cards/filter_card.sh +++ b/cards/filter_card.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014, 2017 Paul Hänsch +# Copyright 2014, 2017, 2019 Paul Hänsch # # This file is part of Confetti. # @@ -17,17 +17,16 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -cgi_post - -if [ "${_POST[choice]}" = new_filter ]; then +if [ "$(POST choice)" = new_filter ]; then filter="$( - for n in filter{0..100}; do - # [ -z "${_POST[$n]:+x}" ] && break - printf %s "${_POST[$n]}" - done \ - | sed -r 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX; s;^\^;;; s;\^[^:]*:$;;;' + seq 0 100 |while read n; do + printf %s "$(POST filter$n)" + done | sed -r \ + 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; + :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX; + s;^\^;;; s;\^[^:]*:$;;;' )" - printf 'Location: ?p=cards&order=%s&filter=%s\n\n' "${_POST[order]}" "$filter" + REDIRECT "/cards/?order=$(POST order)&filter=${filter}" else - printf 'Location: ?p=cards\n\n' + REDIRECT '/cards/' fi diff --git a/cards/l10n.sh b/cards/l10n.sh new file mode 100755 index 0000000..c916173 --- /dev/null +++ b/cards/l10n.sh @@ -0,0 +1,139 @@ +# Copyright 2014, 2016, 2019 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 . + +l10n(){ + case $1 in + PHOTO) printf %s "Foto";; + LOGO) printf %s "Logo";; + FN) printf %s "Voller Name";; + N) printf %s "Name";; + n_pre) printf %s "Titel";; + n_first) printf %s "Vorname";; + n_middle) printf %s "Mittelnamen";; + n_last) printf %s "Nachname";; + n_post) printf %s "Zusätze";; + NICKNAME) printf %s "Spitzname";; + SOUND) printf %s "Aussprache";; + GENDER) printf %s "Geschlecht";; + KIND) printf %s "Typ";; + TITLE) printf %s "Beruf";; + ROLE) printf %s "Position";; + ORG) printf %s "Organisation";; + MEMBER) printf %s "Mitglied";; + CATEGORIES) printf %s "Kategorien";; + ANNIVERSARY) printf %s "Jubiläum";; + BDAY) printf %s "Geburtstag";; + EMAIL) printf %s "E-Mail";; + TEL) printf %s "Telefon";; + phone_typeselect) printf %s "Typ";; + phone_home) printf %s "Privat";; + phone_cell) printf %s "Mobil";; + phone_work) printf %s "Büro";; + phone_fax) printf %s "Fax";; + tHOME) printf %s "Privat:";; + tWORK) printf %s "Büro:";; + tCELL) printf %s "Mobil:";; + tFAX) printf %s "Fax:";; + tVOICE) printf %s "";; + IMPP) printf %s "Chat";; + ADR) printf %s "Anschrift";; + URL) printf %s "Webseite";; + LANG) printf %s "Sprache";; + NOTE) printf %s "Notiz";; + + RELATED) printf %s "Kontakte";; + + BEGIN) printf %s "";; + CALADRURI) printf %s "";; + CALURI) printf %s "";; + CLASS) printf %s "";; + CLIENTPIDMAP) printf %s "";; + END) printf %s "";; + FBURL) printf %s "";; + GEO) printf %s "";; + MAILER) printf %s "";; + NAME) printf %s "";; + PRODID) printf %s "";; + PROFILE) printf %s "";; + REV) printf %s "";; + SORT-STRING) printf %s "";; + SOURCE) printf %s "";; + TZ) printf %s "";; + UID) printf %s "";; + VERSION) printf %s "";; + XML) printf %s "";; + + X-HEALTH-INSURANCE) printf %s "Kran­ken­ver­sich­er­ung";; + hi_from_list) printf %s "Aus Liste";; + hi_other) printf %s "Andere";; + hi_company) printf %s "Ver­sich­er­ungs­ge­sell­schaft";; + hi_number) printf %s "Ver­sich­er­ten­num­mer";; + hi_status) printf %s "Ver­sich­er­ten­sta­tus";; + X-HEALTH-INSURANCE-NOCONTRIB) printf %s "Zu­zahl­ungs­be­frei­ung";; + X-CLIENT-REFERRAL) printf %s "Empfehl­ung durch";; + prescriptions) printf %s "Verordnungen";; + new_prescription) printf %s "Neue Verordnung";; + no_icd) printf %s "Kein ICD Code";; + + X-ZACK-JOINDATE) printf %s "An­mel­de­da­tum";; + X-ZACK-LEAVEDATE) printf %s "Ab­mel­de­da­tum";; + label_join) printf %s "Anm.";; + label_leave) printf %s "Abm.";; + + edit) printf %s "Bearbeiten";; + edit_categories) printf %s "Kategorien Bearbeiten";; + vcf_export) printf %s "Vcard Exportieren";; + control) printf %s "Aktionen";; + edit_update) printf %s "Daten übernehmen";; + edit_cancel) printf %s "Abbrechen";; + edit_delete) printf %s "Eintrag löschen";; + edit_addfieldtext) printf %s "Neues Feld";; + edit_addfield) printf %s "+";; + edit_deletefield) printf %s "X";; + filter_label) printf %s "Filter";; + filter_placeholder) printf %s "Begriffe zur Eingrenzung eingeben";; + filter_type) printf %s "Filtertyp";; + filter_order) printf %s "Sortierung";; + filter_any) printf %s "Alles";; + filter_name) printf %s "Name";; + filter_firstname) printf %s "Vorname";; + filter_lastname) printf %s "Nachname";; + filter_street) printf %s "Straße";; + filter_zip) printf %s "PLZ.";; + filter_TEL) printf %s "Telefon";; + filter_BDAY) printf %s "Geburtsjahr";; + filter_bdate) printf %s "Geburtsdatum";; + filter_course) printf %s "Kurs";; + filter_CATEGORIES) printf %s "Kategorien";; + filter_apply) printf %s "Filtern";; + filter_cancel) printf %s "Filter löschen";; + newcard) printf %s "Neuen Eintrag anlegen";; + course_attendance) printf %s "Kursteilnahme";; + + gender_none) printf %s "keine Angabe";; + gender_female) printf %s "Weiblich";; + gender_male) printf %s "Männlich";; + gender_other) printf %s "Sonstiges";; + + female) printf %s "♀";; + male) printf %s "♂";; + other) printf %s "⚥";; + none) printf %s "⚪";; + *) printf %s "$1";; + esac +} + diff --git a/cards/main.cgi b/cards/main.cgi new file mode 100755 index 0000000..6cdc8f2 --- /dev/null +++ b/cards/main.cgi @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ "$ITEM" = "cards/cards.css" ]; then + . $_EXEC/cgilite/file.sh + FILE $_EXEC/cards/cards.css + return 0 +elif [ "$(GET action)" = filter_card ]; then + . $_EXEC/cards/filter_card.sh + exit 0 +fi + +. $_EXEC/pdiread.sh +. $_EXEC/cards/l10n.sh +. $_EXEC/cards/widgets.sh + +filter="$(GET filter)" +order="$(GET order)" + +printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' + +$_EXEC/cgilite/html-sh.sed <. - -item_name[PHOTO]="Foto" -item_name[LOGO]="Logo" -item_name[FN]="Voller Name" -item_name[N]="Name" -item_name[n_pre]="Titel" -item_name[n_first]="Vorname" -item_name[n_middle]="Mittelnamen" -item_name[n_last]="Nachname" -item_name[n_post]="Zusätze" -item_name[NICKNAME]="Spitzname" -item_name[SOUND]="Aussprache" -item_name[GENDER]="Geschlecht" -item_name[KIND]="Typ" -item_name[TITLE]="Beruf" -item_name[ROLE]="Position" -item_name[ORG]="Organisation" -item_name[MEMBER]="Mitglied" -item_name[CATEGORIES]="Kategorien" -item_name[ANNIVERSARY]="Jubiläum" -item_name[BDAY]="Geburtstag" -item_name[EMAIL]="E-Mail" -item_name[TEL]="Telefon" -item_name[phone_typeselect]="Typ" -item_name[phone_home]="Privat" -item_name[phone_cell]="Mobil" -item_name[phone_work]="Büro" -item_name[phone_fax]="Fax" -item_name[tHOME]="Privat:" -item_name[tWORK]="Büro:" -item_name[tCELL]="Mobil:" -item_name[tFAX]="Fax:" -item_name[tVOICE]="" -item_name[IMPP]="Chat" -item_name[ADR]="Anschrift" -item_name[URL]="Webseite" -item_name[LANG]="Sprache" -item_name[NOTE]="Notiz" - -item_name[RELATED]="Kontakte" - -item_name[BEGIN]="" -item_name[CALADRURI]="" -item_name[CALURI]="" -item_name[CLASS]="" -item_name[CLIENTPIDMAP]="" -item_name[END]="" -item_name[FBURL]="" -item_name[GEO]="" -item_name[MAILER]="" -item_name[NAME]="" -item_name[PRODID]="" -item_name[PROFILE]="" -item_name[REV]="" -item_name[SORT-STRING]="" -item_name[SOURCE]="" -item_name[TZ]="" -item_name[UID]="" -item_name[VERSION]="" -item_name[XML]="" - -item_name[X-HEALTH-INSURANCE]="Kran­ken­ver­sich­er­ung" -item_name[hi_from_list]="Aus Liste" -item_name[hi_other]="Andere" -item_name[hi_company]="Ver­sich­er­ungs­ge­sell­schaft" -item_name[hi_number]="Ver­sich­er­ten­num­mer" -item_name[hi_status]="Ver­sich­er­ten­sta­tus" -item_name[X-HEALTH-INSURANCE-NOCONTRIB]="Zu­zahl­ungs­be­frei­ung" -item_name[X-CLIENT-REFERRAL]="Empfehl­ung durch" -item_name[prescriptions]="Verordnungen" -item_name[new_prescription]="Neue Verordnung" -item_name[no_icd]="Kein ICD Code" - -item_name[X-ZACK-JOINDATE]="An­mel­de­da­tum" -item_name[X-ZACK-LEAVEDATE]="Ab­mel­de­da­tum" -item_name[label_join]="Anm." -item_name[label_leave]="Abm." - -item_name[edit]="Bearbeiten" -item_name[edit_categories]="Kategorien Bearbeiten" -item_name[vcf_export]="Vcard Exportieren" -item_name[control]="Aktionen" -item_name[edit_update]="Daten übernehmen" -item_name[edit_cancel]="Abbrechen" -item_name[edit_delete]="Eintrag löschen" -item_name[edit_addfieldtext]="Neues Feld" -item_name[edit_addfield]="+" -item_name[edit_deletefield]="X" -item_name[filter_label]="Filter" -item_name[filter_placeholder]="Begriffe zur Eingrenzung eingeben" -item_name[filter_type]="Filtertyp" -item_name[filter_order]="Sortierung" -item_name[filter_all]="Alles" -item_name[filter_name]="Name" -item_name[filter_firstname]="Vorname" -item_name[filter_lastname]="Nachname" -item_name[filter_street]="Straße" -item_name[filter_zip]="PLZ." -item_name[filter_phone]="Telefon" -item_name[filter_birthyear]="Geburtsjahr" -item_name[filter_bdate]="Geburtsdatum" -item_name[filter_course]="Kurs" -item_name[filter_apply]="Filtern" -item_name[filter_cancel]="Filter löschen" -item_name[newcard]="Neuen Eintrag anlegen" -item_name[course_attendance]="Kursteilnahme" - -item_name[gender_none]="keine Angabe" -item_name[gender_female]="Weiblich" -item_name[gender_male]="Männlich" -item_name[gender_other]="Sonstiges" - -item_name[female]="♀" -item_name[male]="♂" -item_name[other]="⚥" -item_name[none]="⚪" - diff --git a/cards/widgets.sh b/cards/widgets.sh new file mode 100755 index 0000000..5a80ae7 --- /dev/null +++ b/cards/widgets.sh @@ -0,0 +1,85 @@ +# Copyright 2014 - 2019 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 . + +w_filter_item() { +cat <. -. "${_EXEC}/templates/text_frame.sh" -[ -x "${_EXEC}/templates/text_${PAGE}.sh" ] && . "${_EXEC}/templates/text_${PAGE}.sh" - -bmfile="${_DATA}/mappings/bookmarks" - -cat < - - - - $(l10n p_${PAGE}) - - - - - - -EOF - -debug BODY; [ -x "${BODY}" ] && . "${BODY}" || printf %s 'Error' - cat < - $(l10n configure) - -' +[!DOCTYPE HTML] + +[html [head [title $(l10n p_${PAGE}) ] + [meta name="viewport" content="width=device-width"] + [link rel="stylesheet" href="/common.css"] + [link rel="stylesheet" href="?static=${PAGE}.css"] +] [body class="$PAGE" id="CONFIGURE" + [div class="NAVIGATION" + [a "/cards/" Cards] + ] +]]' EOF - -# vi:set filetype=html: diff --git a/index.cgi b/index.cgi index e0bf125..cf70a45 100755 --- a/index.cgi +++ b/index.cgi @@ -14,18 +14,18 @@ esac; done FILTER="$(GET filter)" ORDER="$(GET o |grep -m1 -axE 'firstname|lastname|bdate' || printf firstname)" # LISTSIZE="$(COOKIE pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)" -ITEM="$(PATH "${PATH_INFO#/}")" +ITEM="$(PATH "${PATH_INFO#/}")"; ITEM="${ITEM#/}" ACTION="$(GET a)" -if [ -d "${_EXEC}/${ITEM%%/*}/main.cgi" ] +if [ -d "${_EXEC}/${ITEM%%/*}" -a -x "${_EXEC}/${ITEM%%/*}/main.cgi" ]; then . "${_EXEC}/${ITEM%%/*}/main.cgi" -elif [ "$ITEM" = "/style.css" ]; then +elif [ "$ITEM" = "style.css" ]; then . "$_EXEC/cgilite/file.sh" [ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \ || FILE "$_EXEC/style.css" -elif [ -d "${_EXEC}/${ITEM%%/*}" -a ! -x "${_EXEC}/$ITEM" ] - . "$_EXEC/cgilite/file.sh" - FILE "${_EXEC}/$ITEM" +# elif [ -d "${_EXEC}/${ITEM%%/*}" -a ! -x "${_EXEC}/$ITEM" ]; then +# . "$_EXEC/cgilite/file.sh" +# FILE "${_EXEC}/$ITEM" else printf 'Status: 404 Not Found\r\nContent-Length: 0\r\n\r\n' fi diff --git a/common.css b/style.css similarity index 100% rename from common.css rename to style.css -- 2.39.2