X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fedit_card.sh;fp=actions%2Ffilter_card.sh;h=4239cc5968c03b5e58d11a96d0e0ae22f68de41f;hp=cc0f9127e404fbbaf52ba752ad97d4545dc70ddc;hb=76c1e7bff1a8604ef2ef7da5d274d0db0e639139;hpb=90288ab07bb1ec83a91581fadc674a87a250a853 diff --git a/actions/filter_card.sh b/cards/edit_card.sh similarity index 57% rename from actions/filter_card.sh rename to cards/edit_card.sh index cc0f912..4239cc5 100755 --- a/actions/filter_card.sh +++ b/cards/edit_card.sh @@ -1,6 +1,6 @@ -#!/bin/zsh +#!/bin/sh -# Copyright 2014, 2017 Paul Hänsch +# Copyright 2019 Paul Hänsch # # This file is part of Confetti. # @@ -17,17 +17,20 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -cgi_post +locktimeout=900 +. "$_EXEC"/session_lock.sh -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;\^[^:]*:$;;;' - )" - printf 'Location: ?p=cards&order=%s&filter=%s\n\n' "${_POST[order]}" "$filter" +card="$(GET card |PATH)" +cardfile="$_DATA/vcard/${card##*/}" +filter="$(REF f)" +order="$(REF o)" + +if tempfile="$(SLOCK "$cardfile" "$locktimeout")"; then + REDIRECT "/cards/?o=${order}&f=${filter}&e=${card}" +elif [ -f "$tempfile" ]; then + SET_COOKIE session message="SESSLOCK" + REDIRECT "/cards/?o=${order}&f=${filter}#${card}" else - printf 'Location: ?p=cards\n\n' + SET_COOKIE session message="EDITLOCK" + REDIRECT "/cards/?o=${order}&f=${filter}#${card}" fi