From 5128251de7e25e60838369d83945cc7af40a579e Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Wed, 4 Mar 2009 21:01:06 -0500 Subject: [PATCH] made css_mangler.php handle versioning (strips numerical postfixes) and made contractor explicitly choose a client when adding a new task --- css_mangler.php | 11 +++++++++++ tasks.html | 2 +- tasks.php | 11 +++++++++-- tasks2.css | 1 - template.html | 4 ++-- 5 files changed, 23 insertions(+), 6 deletions(-) delete mode 120000 tasks2.css diff --git a/css_mangler.php b/css_mangler.php index 03e55f9..40f0e8e 100644 --- a/css_mangler.php +++ b/css_mangler.php @@ -13,7 +13,18 @@ function css_mangler() { $file = substr($file, 1); + $file = ereg_replace('_[0-9]*[.]css', '.css', $file); + + $mtime = filemtime($file); + if($mtime === false) { + header('Content-Type: text/plain'); + print("cannot stat $file"); + return; + } + header('Content-Type: text/css'); + header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime) . ' GMT'); + header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime) . ' GMT'); if(ie5or6()) { echo(ereg_replace("\n[^\n]*remove this line for IE 5.5 and 6[^\n]*\n", "\n", read_whole_file($file))); diff --git a/tasks.html b/tasks.html index cf845df..da0188e 100644 --- a/tasks.html +++ b/tasks.html @@ -47,7 +47,7 @@ - + diff --git a/tasks.php b/tasks.php index 7966987..44ff813 100644 --- a/tasks.php +++ b/tasks.php @@ -426,7 +426,7 @@ function tasks_edit_main() { } } - if("you're happy with the POSTed values") { # if you change this change the one above + if(!logged_in_as_contractor() || $_REQUEST['client_id']) { # if you change this change the one above if($edit_id) { $tables = 'title,url,description,state'; $values = array($title, $url, $description, $state); @@ -447,6 +447,7 @@ function tasks_edit_main() { $client_id = logged_in(); if(logged_in_as_contractor() && $_REQUEST['client_id']) { $client_id = format_int($_REQUEST['client_id']); + $client_name = db_get_value('people', 'name', 'where id=%i', $client_id); } else { # if client entered the task, no price is set $price = 0; @@ -457,7 +458,11 @@ function tasks_edit_main() { $ord = 0; } db_insert('tasks', 'client_id,title,url,description,state,paid,price,ord', $client_id, $title, $url, $description, $state, $paid, $price, $ord); - message('Task saved.'); + if(logged_in_as_contractor()) { + message("Task saved for $client_name."); + } else { + message('Task saved.'); + } } if($GLOBALS['tasks_form_recipient'] != "fixme@example.com") { $to = $GLOBALS['tasks_form_recipient']; @@ -481,6 +486,8 @@ function tasks_edit_main() { if($error !== true) { return './'; } + } else { + message('Error: you must select a client for the task'); } # otherwise, we display the form again. tasks_get_fields() has # already put the posted values back into the template engine, so they will diff --git a/tasks2.css b/tasks2.css deleted file mode 120000 index 57d3998..0000000 --- a/tasks2.css +++ /dev/null @@ -1 +0,0 @@ -tasks.css \ No newline at end of file diff --git a/template.html b/template.html index a5eef75..b475f29 100644 --- a/template.html +++ b/template.html @@ -4,8 +4,8 @@ JasonWoof -- Website Services - - + + -- 1.7.10.4
Client:
Client:
Title: