]> git.plutz.net Git - lobster/commitdiff
moved some decision logic out of template
authorpaul <paul@plutz.net>
Wed, 1 Jun 2016 12:47:44 +0000 (12:47 +0000)
committerpaul <paul@plutz.net>
Wed, 1 Jun 2016 12:47:44 +0000 (12:47 +0000)
svn path=/trunk/; revision=110

pages/cards.sh
templates/cards.html.sh

index 50fee63b76c70040b1a776172e19d3385337b5f4..056f4d2efc2ae96ec7c7b8a6e93027e291983768 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-[ -z "${_GET[order]}" ] && _GET[order]="firstname"
-
 BR='
 '
 
+case $PROFILE in
+medical)
+  view_card="$_EXEC/templates/view_client.sh"
+  edit_card="$_EXEC/templates/edit_client.sh"
+  _GET[order]="${_GET[order]:-lastname}"
+  profile_medical=x
+;;
+circus)
+  view_card="$_EXEC/templates/view_attendee.sh"
+  edit_card="$_EXEC/templates/edit_attendee.sh"
+  _GET[order]="${_GET[order]:-firstname}"
+  profile_circus=x
+;;
+esac
+
+edit="${_GET[edit]}"
+[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit=''
+_GET[filtertype]="${_GET[filtertype]:-any}"
+
 listcourses() {
   ls -1 ${_DATA}/ical/*ics |while read file; do
     icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")"
index c3d277fb09ef6e8ded69171992b033413864e4b9..df630c0e0d8ffd89460b0fc9f1c84182585a9be6 100755 (executable)
@@ -22,30 +22,11 @@ check_order(){
   [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"'
 }
 
-edit="${_GET[edit]}"
-[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit=''
-[ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any"
-
-case $PROFILE in
-medical)
-  view_card=${0%/*}/view_client.sh
-  edit_card=${0%/*}/edit_client.sh
-  _GET[order]="${_GET[order]:-lastname}"
-  profile_medical=x
-;;
-circus)
-  view_card=${0%/*}/view_attendee.sh
-  edit_card=${0%/*}/edit_attendee.sh
-  _GET[order]="${_GET[order]:-firstname}"
-  profile_circus=x
-;;
-esac
-
 cat <<EOF
 <form class="filter" action="?action=filter_card" method="POST">
   <h1>$(l10n filter_label)</h1>
   <input type="hidden" name="page" value="cards"/>
-  <input type="text" name="filter" value="$_GET["filter"]" placeholder="$(l10n filter_placeholder)"/>
+  <input type="text" name="filter" value="${_GET[filter]}" placeholder="$(l10n filter_placeholder)"/>
   <br />
   <fieldset>
   <legend>$(l10n filter_type):</legend>