]> git.plutz.net Git - busy/blobdiff - Tasks.page
introduced simple acl engine
[busy] / Tasks.page
index 7ca263d5b08cf9901e8630af5bac2d3bb149493d..333efe43a0fe3ef8b3b739d055fc5132784b1f85 100644 (file)
@@ -7,6 +7,8 @@ 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">
@@ -16,6 +18,7 @@ cat <<TasksEND
     </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
@@ -28,6 +31,7 @@ if [ -n "$search" ]; then
 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"
@@ -55,6 +59,7 @@ if [ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ]; then
 TasksEND
 fi
 
+#create task main dialog
 [ -z "$info" -a -n "$new" ] && cat <<TaskEnd
 <form class="Task" style="height:20em;" method="post" action="write/taskmeta.cgi" accept-charset="UTF-8">
   <h1>$new</h1>
@@ -66,17 +71,19 @@ fi
   </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
+    $(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" value="Robots click here" style="display:none;">
     <input type="submit" value="Create Task">
   </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")"
@@ -95,8 +102,9 @@ TaskEnd
 TasksEND
 done
 
+#dropdown dialog for adding a task
 echo '</div> <div id="RIGHT">'
-$LOGIN && [ -z "$new" ] && cat <<TasksEND
+$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">