3 info="$(sed -r 's:(^|.*&)i=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
4 edit="$(sed -r 's:(^|.*&)e=([0-9]{10}_[0-9]{3}).*|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")"
5 search="$(sed -r 's:(^|.*&)s=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
6 search="$(echo -e "${search}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
7 new="$(sed -r 's:(^|.*&)n=(.*)|.*:\2:;s:&.*::;s:\+: :g;s:%:\\x:g' <<<"${QUERY_STRING}")"
8 new="$(echo -e "${new}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
10 [ -z "$ACL_CREATETASK" ] && ACL_CREATETASK=false
14 <form method="GET" action="/${SCRIPTNAME}" accept-charset="utf-8">
15 <input type="hidden" name="p" value="Tasks">
16 <input type="text" name="s" placeholder="Search"><br>
17 <input type="submit" value="Search Tasks">
22 if [ -n "$search" ]; then
23 echo "<h1>Tasks search results for: $search</h1>"
24 for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>); do
25 id=$(sed -r 's:^.*/::;s:.task$::' <<<$each)
26 echo "<div class='search'><a href='${SCRIPTNAME}?p=Tasks&i=$id'><h2>$(date -d @$(cut -d_ -f1 <<<"$id"))</h2></a>"
27 grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g"
32 echo '</div><div id="MAIN">'
35 if [ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ]; then
36 datafile="Tasks/$info"
37 metafile="Tasks/$info.meta"
38 headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
39 taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
40 section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
41 attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")"
42 [ -z "$section" ] && section='(none)'
43 [ -z "$attendant" ] && attendant='(none)'
46 <div class="wikitext">
53 <td><b>Section</b><br>
55 <td><b>Attendant</b><br>
62 #create task main dialog
63 [ -z "$info" -a -n "$new" ] && cat <<TaskEnd
64 <form class="Task" style="height:20em;" method="post" action="write/$($LOGIN && echo user_)taskmeta.cgi" accept-charset="UTF-8">
66 <input type="hidden" name="headline" value="$new">
67 <input type="hidden" name="status" value="new">
68 <div style="width:60%;left:3.5em;">
69 <b>Description:</b><br>
70 <textarea name="description" rows="11"></textarea>
71 </div><div style="width:30%;right:.5em;">
73 <select name="section" size="6" style="width:80%">
74 $(for each in $(egrep -hx 'section=.+' Tasks/<0000000000-9999999999>_<000-999>.meta |sort -u); do
75 echo "<option>$(sed 's:section=::' <<<"$each")</option>"
78 <b>other section:</b><br>
79 <input type="text" name="section">
80 <input type="submit" name="submit" value="Robots click here" style="display:none;">
81 <input type="submit" name="submit" value="Create Task">
82 <input type="submit" name="submit" value="Robots click here" style="display:none;">
87 #Plain list of tasks (default)
88 [ -z "$info" -a -z "$new" ] && stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do
89 info="$(basename "$each" |sed 's:.meta$::')"
90 headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
91 taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
92 section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
93 attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")"
94 [ -z "$section" ] && section='(none)'
95 [ -z "$attendant" ] && attendant='(none)'
98 <a href="${SCRIPTNAME}?p=Tasks&i=${info}"><b>$headline</b></a><br>
99 <span><b>Status:</b> $taskstatus</span>
100 <span><b>Section:</b> $section</span>
101 <span><b>Attendant:</b> $attendant</span>
106 #dropdown dialog for adding a task
107 echo '</div> <div id="RIGHT">'
108 $ACL_CREATETASK && [ -z "$new" ] && cat <<TasksEND
109 <a id='newTask_button' class='function' href='#' onclick='javascript:show_screen("newTask");hide_screen("newTask_button");'>New Task</a>
110 <div id="newTask" style="display: none;">
111 <form action="/${SCRIPTNAME}" method="get" accept-charset="UTF-8">
113 <input type="hidden" name="p" value="Tasks">
114 <textarea name="n" rows="2" style="width:99%;"></textarea><br>
115 <input type="submit" value="Submit">
116 <a class="function" href="#" onclick="javascript:hide_screen('newTask');show_screen('newTask_button');">Cancel</a>