JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
reorganized main page, and got my name out of the code
authorJason Woofenden <jason@jasonwoof.com>
Wed, 4 Nov 2009 15:53:41 +0000 (10:53 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Wed, 4 Nov 2009 15:53:41 +0000 (10:53 -0500)
code/wfpl
index.html
index.php
su.php
tasks.css
template.html

index dfd0f15..23c5e09 160000 (submodule)
--- a/code/wfpl
+++ b/code/wfpl
@@ -1 +1 @@
-Subproject commit dfd0f158f89020b3142e41127d21e48c8512aa1e
+Subproject commit 23c5e0913ba24aa1c689dc75577de581661858e6
index 34d035c..a162800 100644 (file)
 <body>
   <!--~main_body {~-->
 
-  <h2>Progress Manager</h2>
+    <h2>Progress Manager</h2>
 
-  <p>This page is for giving Jason Woofenden work and figuring out the details of the associated tasks, costs and priorities.</p>
+    <p>This page is for giving ~contractor_full_name html~ work and figuring out the details of the associated tasks, costs and priorities.</p>
 
-  <p><a href="tasks?tasks_new=1">Add a task</a> &bull; <!--~not_contractor_links {~--><a href="tasks?tasks_new_bug=1">Report a problem</a><!-- &bull; <a href="pay">Pay Jason</a>--><!--~}~--><!--~contractor_links {~--><a href="people">Manage accounts</a><!--~}~--><!--~su_link {~--> &bull; <a href="su">Switch login</a><!--~}~--></p>
+    <p><a href="tasks?tasks_new=1">Add a task</a> &bull; <!--~not_contractor_links {~--><a href="tasks?tasks_new_bug=1">Report a problem</a><!-- &bull; <a href="pay">Pay ~contractor_name html~</a>--><!--~}~--><!--~contractor_links {~--><a href="people">Manage accounts</a><!--~}~--><!--~su_link {~--> &bull; <a href="su">Switch login</a><!--~}~--></p>
 
-  <!--~needs_attention_header {~-->
-    <h3>Tasks needing your attention:</h3>
-  <!--~}~-->
-    <!--~needs_approval_row {~-->
-    <div class="task_link">~client html~ <a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_state~)</div>
+    <div class="cb1">
+    <div class="cb2">
+    <div class="cb3">
+
+
+
+    <!--~contractor_todo {~-->
+      <div class="cbh1"><div class="cbh2"><div class="cbh3">Do these soon!</div></div></div>
+      <div>(And don't forget the queue below this section.)</div>
     <!--~}~-->
-    <!--~needs_fixing_row {~-->
-    <div class="task_link">~client html~ <a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_state~)</div>
+
+    <!--~nothing_needs_your_attention {~-->
+      <div class="cbh1"><div class="cbh2"><div class="cbh3">Nothing is waiting for you!</div></div></div>
+      <div>There are no tasks in the database that are waiting for your attention.</div>
     <!--~}~-->
 
-  <!--~jason {~-->
-    <h3>Tasks waiting for Jason:</h3>
-    <!--~jason_row {~-->
-    <div class="task_link"><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_state~)</div>
+    <!--~these_need_your_attention {~-->
+      <div class="cbh1"><div class="cbh2"><div class="cbh3">Tasks waiting for you</div></div></div>
+      <div>These tasks are waiting for your attention.</div>
     <!--~}~-->
-  <!--~}~-->
 
-  <!--~jason_working {~-->
-    <h4>Jason is currently working on:</h4>
-    <!--~jason_working_row {~-->
-    <div class="task_link"><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_price money~)</div>
+    <!--~this_needs_your_attention {~-->
+      <div class="cbh1"><div class="cbh2"><div class="cbh3">A task waiting on you</div></div></div>
+      <div>This task is waiting for your attention.</div>
+    <!--~}~-->
+
+    <!--~do_fix {~-->
+      <h3>Fix</h3>
+      <!--~do_fix_row {~-->
+        <div class="task_link">~client html~: <a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_finish {~-->
+      <h3>Finish</h3>
+      <!--~do_finish_row {~-->
+        <div class="task_link">~client html~: <a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_price {~-->
+      <h3>Price</h3>
+      <!--~do_price_row {~-->
+        <div class="task_link">~client html~: <a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+
+
+
+    <!--~do_approve_price {~-->
+      <h3>Approve Prices</h3>
+      <!--~do_approve_price_plural {~-->
+        <div class="task_state_note">(These tasks are waiting for you to approve their prices.)</div>
+      <!--~}~-->
+      <!--~do_approve_price_singular {~-->
+        <div class="task_state_note">(This task is waiting for you to approve its price.)</div>
+      <!--~}~-->
+      <!--~do_approve_price_row {~-->
+        <div class="task_link"><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_clarify {~-->
+      <h3>Clarify</h3>
+      <!--~do_clarify_plural {~-->
+        <div class="task_state_note">(These tasks are waiting for you to clarify their descriptions. Please replace all occurences of "FIXME" in their descriptions with details on exactly what you'd like.)</div>
+      <!--~}~-->
+      <!--~do_clarify_singular {~-->
+        <div class="task_state_note">(This task is waiting for you to clarify its description. Please replace all occurences of "FIXME" in the description with details on exactly what you'd like.)</div>
+      <!--~}~-->
+      <!--~do_clarify_row {~-->
+        <div class="task_link"><a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_test {~-->
+      <h3>Test</h3>
+      <!--~do_test_plural {~-->
+        <div class="task_state_note">(These tasks are waiting for you to test them. Please read through each description, and see that every part of it has been finished before clicking "Mark this task as finished".)</div>
+      <!--~}~-->
+      <!--~do_test_singular {~-->
+        <div class="task_state_note">(This tasks is waiting for you to test it. Please read through the description, and see that every part of it has been finished before clicking "Mark this task as finished".)</div>
+      <!--~}~-->
+      <!--~do_test_row {~-->
+        <div class="task_link"><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_draft {~-->
+      <h3>Drafts</h3>
+      <!--~do_draft_plural {~-->
+        <div class="task_state_note">(When you are finished writing these task descriptions, you can click "Save and request price".)</div>
+      <!--~}~-->
+      <!--~do_draft_singular {~-->
+        <div class="task_state_note">(When you are finished writing this task description, you can click "Save and request price".)</div>
+      <!--~}~-->
+      <!--~do_draft_row {~-->
+        <div class="task_link"><a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+    <!--~do_on_hold {~-->
+      <h3>On Hold</h3>
+      <!--~do_on_hold_plural {~-->
+        <div class="task_state_note">(These tasks are on hold. When/if you are ready for one to be implemented, click on it, then click "Save and request price".)</div>
+      <!--~}~-->
+      <!--~do_on_hold_singular {~-->
+        <div class="task_state_note">(This task is on hold. When/if you are ready for it to be implemented, click on it, then click "Save and request price".)</div>
+      <!--~}~-->
+      <!--~do_on_hold_row {~-->
+        <div class="task_link"><a href="tasks?tasks_edit_id=~task_id~">#~task_id~: ~task_title html~</a></div>
+      <!--~}~-->
+    <!--~}~-->
+
+  </div>
+  </div>
+  </div>
+
+
+  <!--~contractor_will {~-->
+    <h3>~contractor_name html~'s To-Do list</h3>
+    <!--~contractor_will_plural {~-->
+      <div class="task_state_note">(These tasks are waiting for ~contractor_name html~'s attention.)</div>
+    <!--~}~-->
+    <!--~contractor_will_singular {~-->
+      <div class="task_state_note">(This task is waiting for ~contractor_name html~'s attention.)</div>
+    <!--~}~-->
+    <!--~contractor_will_row {~-->
+    <div class="task_link"><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_state~)</div>
     <!--~}~-->
   <!--~}~-->
 
   <!--~queue {~-->
-    <h4>Queued tasks</h4>
-    <div>Jason hasn't started on these yet. You can use the arrows to set the priority order. Jason will do the top one first.</div>
+    <h3>Queued tasks</h3>
+    <!--~queue_plural {~-->
+      <div class="task_state_note">(You can use the arrows to set which tasks ~contractor_name html~ will do next.)</div>
+    <!--~}~-->
+    <!--~queue_singular {~-->
+      <div class="task_state_note">(~contractor_name html~ will do the following task next.)</div>
+    <!--~}~-->
     <!--~queue_row {~-->
-    <div class="task_link"><span class="updown"><div class="updown_links"> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=down">later</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=up">sooner</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=bottom">last</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=top">first</a></div></span> ~client html~ <a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_price money~)</div>
+    <div class="task_link"><!--~not_the_only_queued {~--><span class="updown"><div class="updown_links"> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=down">later</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=up">sooner</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=bottom">last</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=top">first</a></div></span> <!--~}~--><!--~queued_for {~-->~client html~: <!--~}~--><a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title html~</a> (~task_price money~)</div>
     <!--~}~-->
   <!--~}~-->
 
index 03e3077..88b09f6 100644 (file)
--- a/index.php
+++ b/index.php
@@ -34,8 +34,14 @@ function task_summary($tem_prefix, $where_clause/*, ... */) {
        $args = array_slice($args, 1);
        array_unshift($args, 'tasks', 'id,price,title,state,client_id,paid');
        $rows = call_user_func_array('db_get_rows', $args);
-       #$rows = db_get_rows('tasks', 'id,price,title,state,client_id', $where_clause);
+       $num_rows = 0;
        if($rows) {
+               $num_rows = count($rows);
+               if($num_rows > 1) {
+                       tem_show($tem_prefix . '_plural');
+               } else {
+                       tem_show($tem_prefix . '_singular');
+               }
                $total = 0.0;
                foreach($rows as $row) {
                        list($id, $price, $title, $state, $client_id, $paid) = $row;
@@ -45,6 +51,12 @@ function task_summary($tem_prefix, $where_clause/*, ... */) {
                        tem_set('task_state', task_state_pretty($state));
                        if(logged_in_as_contractor()) {
                                tem_set('client', db_get_value('people', 'username', 'where id=%i', $client_id));
+                               if($tem_prefix == 'queue') {
+                                       tem_show('queued_for');
+                               }
+                       }
+                       if($num_rows > 1 && $tem_prefix == 'queue') {
+                               tem_show('not_the_only_queued');
                        }
                        tem_show($tem_prefix . '_row');
                        if(!$paid && isset($GLOBALS['unpaid_totals'])) {
@@ -63,6 +75,8 @@ function task_summary($tem_prefix, $where_clause/*, ... */) {
 
                tem_show($tem_prefix);
        }
+
+       return $num_rows;
 }
 
 # pass multi-dimensional hash arr[client_id][status].
@@ -87,8 +101,8 @@ function totals_summary($arr) {
                        if(isset($t['queue'])) {
                                $queue = $t['queue'];
                        }
-                       if(isset($t['needs_approval'])) { # administrator page re-uses this for TASK_WORKING
-                               $working = $t['needs_approval'];
+                       if(isset($t['do_finish'])) {
+                               $working = $t['do_finish'];
                        }
                        tem_set('tested_total', $finished_unpaid);
                        tem_set('done_total', $finished_unpaid + $finished_untested);
@@ -117,6 +131,15 @@ function _index_main() {
        $client_id = logged_in();
        $ever_was_contractor = ever_was_contractor();
 
+       $contractor_full_name = db_get_value('people', 'name', 'where id=1');
+       if(!$contractor_full_name) {
+               die('To finish installing this site, make yourself an account in the people table with id=1');
+       }
+       list($contractor_name,) = explode(' ', $contractor_full_name, 2);
+       tem_set('contractor_name', $contractor_name);
+       tem_set('contractor_full_name', $contractor_full_name);
+
+
        # make sure the client (not the contractor) has filled out the tiny agreement
        if(!$ever_was_contractor) {
                $tiny_agreement = db_get_value('people', 'tiny_agreement', 'where id=%i', $client_id);
@@ -131,14 +154,13 @@ function _index_main() {
 
        if(logged_in_as_contractor()) {
                tem_show('contractor_links');
-               tem_show('needs_attention_header');
+               tem_show('contractor_todo');
 
                $GLOBALS['unpaid_totals'] = array();
-               # things with a view link:
-               task_summary('needs_approval', 'where state=%i order by id desc', TASK_WORKING); # this affects queued_total
+               task_summary('do_finish', 'where state=%i order by id desc', TASK_WORKING); # this affects queued_total
+               task_summary('do_fix', 'where state=%i order by client_id desc', TASK_BUG);
+               task_summary('do_price', 'where state=%i order by client_id desc', TASK_NEEDS_QUOTE);
 
-               # things with an edit link:
-               task_summary('needs_fixing', 'where state=%i || state=%i order by id desc', TASK_NEEDS_QUOTE, TASK_BUG);
                task_summary('finished_untested', 'where state=%i order by client_id, finished_at desc', TASK_NEEDS_TESTING);
                task_summary('finished_unpaid', 'where state=%i && paid=0 order by finished_at desc', TASK_FINISHED);
                task_summary('queue', 'where state=%i order by client_id, ord desc', TASK_QUEUED);
@@ -146,14 +168,25 @@ function _index_main() {
                task_summary('finished_paid', 'where state=%i && paid = 1 order by finished_at desc limit 20', TASK_FINISHED);
        } else {
                tem_show('not_contractor_links');
-               if(db_count('tasks', 'where client_id=%i && (state=%i || state=%i || state=%i || state=%i || state=%i)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_ON_HOLD, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) {
-                       tem_show('needs_attention_header');
-                       task_summary('needs_approval', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING);
-                       task_summary('needs_fixing', 'where client_id=%i && (state=%i || state=%i || state=%i) order by id', $client_id, TASK_ON_HOLD, TASK_DRAFT, TASK_NEEDS_CLARIFICATION);
+               $num_rows = 0;
+               $num_rows += task_summary('do_approve_price', 'where client_id=%i && state=%i order by id', $client_id, TASK_NEEDS_GO_AHEAD);
+               $num_rows += task_summary('do_clarify', 'where client_id=%i && state=%i order by id', $client_id, TASK_NEEDS_CLARIFICATION);
+               $num_rows += task_summary('do_test', 'where client_id=%i && state=%i order by id', $client_id, TASK_NEEDS_TESTING);
+               $num_rows += task_summary('do_draft', 'where client_id=%i && state=%i order by id', $client_id, TASK_DRAFT);
+               $num_rows += task_summary('do_on_hold', 'where client_id=%i && state=%i order by id', $client_id, TASK_ON_HOLD);
+
+               if($num_rows == 0) {
+                       tem_show('nothing_needs_your_attention');
+               } elseif($num_rows == 1) {
+                       tem_show('this_needs_your_attention');
+               } else {
+                       tem_show('these_need_your_attention');
                }
+
                task_summary('queue', 'where client_id=%i && state=%i order by ord desc', $client_id, TASK_QUEUED);
-               task_summary('jason', 'where client_id=%i && (state=%i || state=%i) order by id desc', $client_id, TASK_NEEDS_QUOTE, TASK_BUG);
-               task_summary('jason_working', 'where client_id=%i && state=%i order by id desc', $client_id, TASK_WORKING);
+
+               task_summary('contractor_will', 'where client_id=%i && (state=%i || state=%i || state=%i) order by id desc', $client_id, TASK_NEEDS_QUOTE, TASK_BUG, TASK_WORKING);
+
                task_summary('finished_unpaid', 'where client_id=%i && state=%i && paid=0 order by finished_at desc', $client_id, TASK_FINISHED);
                task_summary('finished_paid', 'where client_id=%i && state=%i && paid=1 order by finished_at desc', $client_id, TASK_FINISHED);
        }
diff --git a/su.php b/su.php
index 6f26627..a6acd12 100644 (file)
--- a/su.php
+++ b/su.php
@@ -18,8 +18,7 @@
 require_once('code/wfpl/format.php');
 
 function su_main() {
-       # If you log in to the admin account, you can su to a customer account and still have access to su back to admin. That's why we're checking for admin not "contractor" here.
-       if(!logged_in_as_admin()) {
+       if(!ever_was_contractor()) {
                $GLOBALS['url'] = this_url();
                message('You must be logged in as an administrator to access that function');
                return 'login';
index 24104b2..7c57459 100644 (file)
--- a/tasks.css
+++ b/tasks.css
@@ -1,6 +1,15 @@
+h2.plate {
+       margin-top: 40px;
+       text-align: left;
+       margin-bottom: 0;
+}
 .index_body h3, .index_body h4 {
        text-align: left;
-       margin: 15px 0px 5px;
+       margin: 25px 0px 0px;
+}
+
+div.task_state_note {
+       font-size: 80%;
 }
 
 th {
index 447d351..09aa128 100644 (file)
 
           <div id="body" class="~basename~_body">
             <!--~logout_bar~-->
-            <!--~message_container {~-->
-                 <div style="border: 2px solid red; background: #fbb; padding: 5px; margin: 20px 0px">
-                 <!--~message_box {~-->
-                     <!--~message_divider {~-->
-                         <hr />
-                     <!--~}~-->
-                     <p style="font-size: 120%; padding: 5px; margin: 0px">~message_text html~</p>
-                 <!--~}~-->
-                 </div>
+            <!--~wfpl_messages {~-->
+              <!--~ first {~-->
+                <div style="border: 2px solid red; background: #fbb; padding: 5px; margin: 20px 0px">
+              <!--~}~-->
+                  <p style="font-size: 120%; padding: 5px; margin: 0px">~data html~</p>
+              <!--~ sep {~-->
+                  <hr />
+              <!--~}~-->
+              <!--~ last {~-->
+                </div>
+              <!--~}~-->
             <!--~}~-->
             <!--~main_body~-->
           </div>