]> git.plutz.net Git - busy/commitdiff
basic user interface for creating a task
authorpaul <paul@plutz.net>
Thu, 22 Sep 2011 01:01:02 +0000 (01:01 +0000)
committerpaul <paul@plutz.net>
Thu, 22 Sep 2011 01:01:02 +0000 (01:01 +0000)
svn path=/trunk/; revision=12

Tasks.css [new file with mode: 0644]
Tasks.page [new file with mode: 0644]

diff --git a/Tasks.css b/Tasks.css
new file mode 100644 (file)
index 0000000..e7b8f24
--- /dev/null
+++ b/Tasks.css
@@ -0,0 +1,17 @@
+.Task{
+  margin: .5em;
+  width: 95%;
+  background-color: #DDF;
+  color: #000;
+  padding: .5em;
+  border-width: 1px;
+  border-color: #00A;
+  border-style: solid solid solid solid;
+}
+.Task h1{
+  margin: 0em;
+  text-size: 2em;
+}
+.Task div{
+  position: absolute;
+}
diff --git a/Tasks.page b/Tasks.page
new file mode 100644 (file)
index 0000000..6274be8
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/zsh
+
+info="$(egrep -o '(^|&)(i=)[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
+edit="$(egrep -o '(^|&)(e=)[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&e=')"
+search="$(egrep -o '(^|&)(s=).+(&|$)' <<<"${QUERY_STRING}" |sed -r 's:^&?s=::;s:\+: :g;s:%:\\x:g')"
+search="$(echo -e "${search}" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' |head -n1)"
+new="$(egrep -o '(^|&)(n=).+(&|$)' <<<"${QUERY_STRING}" |sed -r 's:^&?n=::;s:\+: :g;s:%:\\x:g')"
+new="$(echo -e "${new}" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' |head -n1)"
+
+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
+if [ -n "$search" ]; then
+  echo "<h1>Tasks search results for: $search</h1>"
+  for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>.task); do
+    id=$(sed -r 's:^.*/::;s:.task$::' <<<$each)
+    echo "<div class='search'><a href='#task_$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">'
+
+[ -n "$new" ] && cat <<TaskEnd
+<form class="Task" style="height:20em;" method="post" action="write/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 -x '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" value="Create Task">
+  </div>
+</form>
+TaskEnd
+
+[ -z "$new" ] && stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do
+  headline="$(egrep -x 'headline=.+' "$each" |sed 's:headline=::')"
+  status="$(egrep -x 'status=.+' "$each" |sed 's:status=::')"
+  section="$(egrep -x 'section=.+' "$each" |sed 's:section=::')"
+  attendant="$(egrep -x 'attendant=.+' "$each" |sed 's:attendant=::')"
+  cat <<TasksEND
+   <div class="Task">
+     <b>$headline</b><br>
+     <span><b>Status:</b> $status</span>
+     <span><b>Section:</b> $Section</span>
+     <span><b>Attendant:</b> $attendant</span>
+   </div>
+TasksEND
+done
+
+echo '</div> <div id="RIGHT">'
+$LOGIN && [ -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>'