-cat <<EOF
- <input type=hidden name=$sid value=exists>
- <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
- <label class="tab" for="${sid}_open">
- <span class=no>${session_n}.</span><!--
- --><span class=date>${tpy[${sid}_date]}</span><!--
- --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
- --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
- --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
- --><span class=signature><input type=checkbox name="${sid}_signature" value=pos $sigcheck><button type=submit name=${sid}_sigset value=$sig></button></span>
- </label>
- <div class=tab>
- <input class="dotmark ov" type="image" name=dotmark value="$sid" src="/therapies/${id%.tpy}_${sid}.png" alt="">
- $(n=1; while [ -n "${tpy[${sid}_note${n}]+x}" ]; do
- t_session_note $session_n $n
- n=$(($n+1))
- done
- printf '<button type=submit name=%s_note%s value="">+</button>' "$sid" "$n"
- )
-
- <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
- <button type=submit>$(l10n save)</button>
- </div>
-EOF
+ cat <<-EOF
+ <input type=hidden name=$sid value=exists>
+ <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
+ <label class="tab" for="${sid}_open">
+ <span class=no>${session_n}.</span><!--
+ --><span class=date>${tpy[${sid}_date]}</span><!--
+ --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
+ --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
+ --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
+ --><span class=signature><input type="checkbox" name="${sid}_sigset" value="pos" $sigcheck></span>
+ </label>
+ <div class=tab>
+ <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
+ $(n=1;
+ while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do
+ if [ -n "${tpy[session${session_n}_note${n}]}" ]; then
+ x=$n
+ fi
+ n=$(($n + 1))
+ done
+ for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done
+ )
+ <button class="trailbtn" type="submit">$(l10n trailsave)</button>
+ <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
+ </div>
+ EOF