JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
really made it so you can put tasks on hold. contractor can switch logins multiple...
authorJason Woofenden <jason283@herkamire.com>
Tue, 26 May 2009 19:06:01 +0000 (15:06 -0400)
committerJason Woofenden <jason283@herkamire.com>
Tue, 26 May 2009 19:06:01 +0000 (15:06 -0400)
.gitignore
Makefile [new file with mode: 0644]
code/config.php
code/tasks.php
index.html
index.php
su.php
tasks.html
tasks.php

index d648379..9184ef1 100644 (file)
@@ -3,3 +3,4 @@ images
 *.tgz
 style*.css
 w
+tags
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..a5a48a3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,2 @@
+tags: *.php code/*.php code/wfpl/*.php
+       exuberant-ctags *.php code/*.php code/wfpl/*.php
index d863f7d..82fb0cc 100644 (file)
@@ -21,6 +21,14 @@ function logged_in_as_contractor() {
        return logged_in_as_admin();
 }
 
+function ever_was_contractor() {
+       return logged_in_as_contractor() || session_get('auth_was_contractor') == 'Yes';
+}
+
+function set_was_contractor() {
+       session_set('auth_was_contractor', 'Yes');
+}
+
 function enc_money($float) {
        return format_money($float, $cents = false);
 }
index a716fa2..a442381 100644 (file)
@@ -46,6 +46,8 @@ function task_state_pretty($state) {
                        return "to be priced";
                case TASK_NEEDS_GO_AHEAD:
                        return "waiting for you to approve the price";
+               case TASK_ON_HOLD:
+                       return "on hold";
                case TASK_QUEUED:
                        return "queued";
                case TASK_WORKING:
index eb1236d..1310540 100644 (file)
@@ -13,7 +13,7 @@
 
   <p>This page is for giving Jason Woofenden 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 start~--><a href="tasks?tasks_new_bug=1">Report a problem</a><!-- &bull; <a href="pay">Pay Jason</a>--><!--~end~--><!--~contractor_links start~--><a href="people">Manage accounts</a> &bull; <a href="su">Switch login</a><!--~end~--></p>
+  <p><a href="tasks?tasks_new=1">Add a task</a> &bull; <!--~not_contractor_links start~--><a href="tasks?tasks_new_bug=1">Report a problem</a><!-- &bull; <a href="pay">Pay Jason</a>--><!--~end~--><!--~contractor_links start~--><a href="people">Manage accounts</a><!--~end~--><!--~su_link start~--> &bull; <a href="su">Switch login</a><!--~end~--></p>
 
   <!--~needs_attention_header start~-->
     <h3>Tasks needing your attention:</h3>
index ab4ff12..88e5605 100644 (file)
--- a/index.php
+++ b/index.php
@@ -122,6 +122,10 @@ function _index_main() {
                return './tiny_agreement';
        }
 
+       if(ever_was_contractor()) {
+               tem_show('su_link');
+       }
+
        if(logged_in_as_contractor()) {
                tem_show('contractor_links');
                tem_show('needs_attention_header');
@@ -139,10 +143,10 @@ 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)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) {
+               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) order by id', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION);
+                       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);
                }
                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);
diff --git a/su.php b/su.php
index 0c45cf1..2ff23ae 100644 (file)
--- a/su.php
+++ b/su.php
@@ -18,7 +18,9 @@
 require_once('code/wfpl/format.php');
 
 function su_main() {
-       if(!logged_in_as_contractor()) {
+       if(logged_in_as_contractor()) {
+               set_was_contractor();
+       } elseif(!ever_was_contractor()) {
                $GLOBALS['url'] = this_url();
                message('You must be logged in as an administrator to access that function');
                return 'login';
index 08e7a47..192426b 100644 (file)
   <!--~normal_edit_link start~--><p><a href="tasks?tasks_edit_id=~task_id.attr~">Edit this task</a></p><!--~end~-->
   <!--~warning_edit_link start~--><p><a href="tasks?tasks_edit_id=~task_id.attr~" onclick="return confirm('Editing this task will invalidate the price, proceed anyway?')">Edit this task</a></p><!--~end~-->
 
-  <!--~working_link start~--><p><a href="tasks?tasks_working_id=~task_id.attr~">I'm starting on this now</a>.</p><!--~end~-->
+  <!--~working_link start~--><p><a href="tasks?tasks_working_id=~task_id.attr~">I'm starting on this now</a></p><!--~end~-->
 
-  <!--~hold_link start~--><p><a href="tasks?tasks_hold_id=~task_id.attr~">Place this task on hold</a>.</p><!--~end~-->
+  <!--~hold_link start~--><p><a href="tasks?tasks_hold_id=~task_id.attr~">Place this task on hold</a></p><!--~end~-->
 
-  <!--~needs_testing_link start~--><p><a href="tasks?tasks_needs_testing_id=~task_id.attr~">Mark this task as finished (request testing)</a>.</p><!--~end~-->
+  <!--~needs_testing_link start~--><p><a href="tasks?tasks_needs_testing_id=~task_id.attr~">Mark this task as finished (request testing)</a></p><!--~end~-->
 
   <!--~finished_link start~--><p>Please test everything in the narrative! If everything is working, <a href="tasks?tasks_finished_id=~task_id.attr~">Mark this task as finished</a> Otherwise please e-mail or call Jason.</p><!--~end~-->
 
index 19010f8..8418502 100644 (file)
--- a/tasks.php
+++ b/tasks.php
@@ -141,8 +141,12 @@ function tasks_display_main() {
                        switch($state) {
                                case TASK_DRAFT:
                                case TASK_NEEDS_CLARIFICATION:
-                               case TASK_NEEDS_QUOTE:
                                case TASK_BUG:
+                               case TASK_ON_HOLD:
+                                       tem_show('normal_edit_link');
+                               break;
+                               case TASK_NEEDS_QUOTE:
+                                       tem_show('hold_link');
                                        tem_show('normal_edit_link');
                                break;
                                case TASK_NEEDS_GO_AHEAD:
@@ -153,6 +157,7 @@ function tasks_display_main() {
                                case TASK_QUEUED:
                                        tem_show('price_row');
                                        tem_show('warning_edit_link');
+                                       tem_show('hold_link');
                                break;
                                case TASK_WORKING:
                                        tem_show('price_row');