<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> • <a href="tasks?tasks_new_bug=1">Report a problem</a><!-- • <a href="pay">Pay Jason</a>--></p>
+ <p><a href="tasks?tasks_new=1">Add a task</a> • <a href="tasks?tasks_new_bug=1">Report a problem</a><!--~su_link start~--> • <a href="su">Switch login</a><!--~end~--><!-- • <a href="pay">Pay Jason</a>--></p>
<!--~needs_attention_header start~-->
<h3>Tasks needing your attention:</h3>
}
if(logged_in_as_contractor()) {
+ tem_show('su_link');
tem_show('needs_attention_header');
task_summary('needs_approval', 'where state=%i order by id desc', TASK_WORKING);
task_summary('needs_fixing', 'where (state=%i || state=%i) || (client_id=1 && state<%i) order by id desc', TASK_NEEDS_QUOTE, TASK_BUG, TASK_QUEUED);
}
function people_main() {
- if(logged_in() != 1) { # FIXME get more sophisticated than first person in database is admin
+ if(!logged_in_as_contractor()) {
$GLOBALS['url'] = this_url();
message('You must be logged in as an administrator to access that function');
return 'login';
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>people entry</title>
+ <link rel="stylesheet" href="style.css" type="text/css" />
+</head>
+
+<body>
+ <!--~main_body start~-->
+ <h2>SU to be logged in as someone else</h2>
+
+ <!--~su_row start~-->
+ <p><a href="su?as=~client_id~">log in as ~client_name~</a></p>
+ <!--~end~-->
+
+<!--~end~-->
+</body>
+</html>
--- /dev/null
+<?php
+
+require_once('code/wfpl/format.php');
+
+function su_main() {
+ if(!logged_in_as_contractor()) {
+ $GLOBALS['url'] = this_url();
+ message('You must be logged in as an administrator to access that function');
+ return 'login';
+ }
+
+ $ret = _su_main();
+ if($ret) {
+ return $ret;
+ }
+ tem_show('main_body');
+}
+
+function _su_main() {
+ $client_id = format_int($_REQUEST['as']);
+ if($client_id) {
+ session_set('auth_username', $client_id);
+ message('Switched Login');
+ return './';
+ }
+
+ $rows = db_get_rows('people', 'id,name');
+
+ if($rows) foreach($rows as $row) {
+ list($id, $name) = $row;
+ tem_set('client_id', $id);
+ tem_set('client_name', $name);
+ tem_show('su_row');
+ }
+}
+
+?>