+++ /dev/null
-#!/bin/zsh
-
-info="$(sed -r 's:(^|.*&)i=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
-edit="$(sed -r 's:(^|.*&)e=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
-search="$(sed -r 's:(^|.*&)s=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
-search="$(echo -e "${search}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
-new="$(sed -r 's:(^|.*&)n=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
-new="$(echo -e "${new}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
-
-[ -z "$ACL_CREATETASK" ] && ACL_CREATETASK=false
-
-cat <<TasksEND
- <div id="LEFT">
- <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
- <input type="hidden" name="p" value="Tasks">
- <input type="text" name="s" placeholder="Search"><br>
- <input type="submit" value="Search Tasks">
- </form>
- <hr>
-TasksEND
-#search results
-if [ -n "$search" ]; then
- echo "<h1>Tasks search results for: $search</h1>"
- for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>); do
- id=$(sed -r 's:^.*/::;s:.task$::' <<<$each)
- echo "<div class='search'><a href='${SCRIPTNAME}?p=Tasks&i=$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
- grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
- echo '</div>'
- done
- echo '<hr>'
-fi
-echo '</div><div id="MAIN">'
-
-#Display single task
-if [ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ]; then
- datafile="Tasks/$info"
- metafile="Tasks/$info.meta"
- headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
- [ -z "$section" ] && section='(none)'
- [ -z "$attendant" ] && attendant='(none)'
- cat <<TasksEND
- <div class="Task">
- <div class="wikitext">
- <h1>$headline</h1>
- $(_wiki "$datafile")
- </div>
- <table><tr>
- <td><b>Status</b><br>
- $taskstatus</td>
- <td><b>Section</b><br>
- $section</td>
- <td><b>Attendant</b><br>
- $attendant</td>
- </tr></table>
- </div>
-TasksEND
-fi
-
-#create task main dialog
-[ -z "$info" -a -n "$new" ] && cat <<TaskEnd
-<form class="Task" style="height:20em;" method="post" action="write/$($LOGIN && echo user_)taskmeta.cgi" accept-charset="UTF-8">
- <h1>$new</h1>
- <input type="hidden" name="headline" value="$new">
- <input type="hidden" name="status" value="new">
- <div style="width:60%;left:3.5em;">
- <b>Description:</b><br>
- <textarea name="description" rows="11"></textarea>
- </div><div style="width:30%;right:.5em;">
- <b>Section:</b><br>
- <select name="section" size="6" style="width:80%">
- $(for each in $(egrep -hx 'section=.+' Tasks/<0000000000-9999999999>_<000-999>.meta |sort -u); do
- echo "<option>$(sed 's:section=::' <<<"$each")</option>"
- done)
- </select><br>
- <b>other section:</b><br>
- <input type="text" name="section">
- <input type="submit" name="submit" value="Robots click here" style="display:none;">
- <input type="submit" name="submit" value="Create Task">
- <input type="submit" name="submit" value="Robots click here" style="display:none;">
- </div>
-</form>
-TaskEnd
-
-#Plain list of tasks (default)
-[ -z "$info" -a -z "$new" ] && stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do
- info="$(basename "$each" |sed 's:.meta$::')"
- headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
- [ -z "$section" ] && section='(none)'
- [ -z "$attendant" ] && attendant='(none)'
- cat <<TasksEND
- <div class="Task">
- <a href="${SCRIPTNAME}?p=Tasks&i=${info}"><b>$headline</b></a><br>
- <span><b>Status:</b> $taskstatus</span>
- <span><b>Section:</b> $section</span>
- <span><b>Attendant:</b> $attendant</span>
- </div>
-TasksEND
-done
-
-#dropdown dialog for adding a task
-echo '</div> <div id="RIGHT">'
-$ACL_CREATETASK && [ -z "$new" ] && cat <<TasksEND
- <a id='newTask_button' class='function' href='#' onclick='javascript:show_screen("newTask");hide_screen("newTask_button");'>New Task</a>
- <div id="newTask" style="display: none;">
- <form action="/${SCRIPTNAME}" method="get" accept-charset="UTF-8">
- <b>Headline:</b><br>
- <input type="hidden" name="p" value="Tasks">
- <textarea name="n" rows="2" style="width:99%;"></textarea><br>
- <input type="submit" value="Submit">
- <a class="function" href="#" onclick="javascript:hide_screen('newTask');show_screen('newTask_button');">Cancel</a>
- </form>
- </div>
-TasksEND
-echo '</div>'