Commit 57cfa23b authored by Timothy Stack's avatar Timothy Stack

Patches against the revision of flyspray we use at the moment (r502).

parent 99320434
Tweaks for notification stuff:
* Put mail addresses in the To: header so mailman doesn't get upset.
* Add meaningful subject lines, even though they aren't localized.
* Squelch notifications for some events.
Index: includes/notify.inc.php
===================================================================
--- includes/notify.inc.php (revision 502)
+++ includes/notify.inc.php (working copy)
@@ -27,9 +27,9 @@
// This function is the wrapper for the others in this class
// It addresses, creates and stores/sends the notifications
- function Create ( $type, $task_id, $info )
+ function Create ( $type, $task_id, $info = '')
{
- $to = $this->Address($task_id);
+ $to = $this->Address($type, $task_id);
$msg = $this->GenerateMsg($type, $task_id, $info);
$this->SendEmail($to[0], $msg[0], $msg[1]);
$this->StoreJabber($to[1], $msg[0], $msg[1]);
@@ -271,11 +271,11 @@
if (is_array($to))
{
- $mail->AddAddress($fs->prefs['admin_email']);
+ // $mail->AddAddress($fs->prefs['admin_email']);
foreach ($to as $key => $val)
{
// Unlike the docs say, it *does (appear to)* work with mail()
- $mail->AddBcc($val); // Add each address
+ $mail->AddAddress($val); // Add each address
}
} else {
@@ -361,6 +361,8 @@
///////////////////////////////////////////////////////////////
if ($type == '1')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " '" . $task_details['item_summary'] . "' opened";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['newtaskopened'] . "\n\n";
$body .= $notify_text['userwho'] . ' - ' . $user->infos['real_name'] . ' (' . $user->infos['user_name'] . ")\n\n";
@@ -389,6 +391,9 @@
//////////////////////////
if ($type == '2')
{
+ // Generate the nofication message
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " changed";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['taskchanged'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -420,6 +425,9 @@
/////////////////
if ($type == '3')
{
+ // Generate the nofication message
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " closed";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['taskclosed'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -444,6 +452,8 @@
////////////////////
if ($type == '4')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " re-opened";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['taskreopened'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -460,8 +470,11 @@
//////////////////////
if ($type == '5')
{
+ // Generate the nofication message
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " dependency added";
+
$depend_task = $fs->getTaskDetails($arg1);
-
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['depadded'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -481,6 +494,9 @@
////////////////////////
if ($type == '6')
{
+ // Generate the nofication message
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " dependency removed";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['depremoved'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -508,6 +524,9 @@
);
$comment = $db->FetchArray($result);
+ // Generate the nofication message
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " comment added";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['commentadded'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -532,6 +551,8 @@
//////////////////////
if ($type == '8')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " attachment added";
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['attachmentadded'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -548,6 +569,7 @@
////////////////////////
if ($type == '9')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " related task added";
$related_task = $fs->getTaskDetails($arg1);
$body = $notify_text['donotreply'] . "\n\n";
@@ -569,6 +591,8 @@
/////////////////////
if ($type == '10')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " assigned to " . $task_details['assigned_to_name'];
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $task_details['assigned_to_name'] . ' ' . $notify_text['takenownership'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n\n";
@@ -635,6 +659,8 @@
//////////////////
if ($type == '14')
{
+ $subject = $proj->prefs['project_title'] . " FS#" . $task_id . " assigned to " . $current_user['user_name'];
+
$body = $notify_text['donotreply'] . "\n\n";
$body .= $notify_text['assignedtoyou'] . "\n\n";
$body .= 'FS#' . $task_id . ' - ' . $task_details['item_summary'] . "\n";
@@ -706,7 +732,7 @@
// This sends a notification to multiple users, usually from the notifications tab on a task
- function Address($task_id)
+ function Address($type, $task_id)
{
global $db;
global $fs;
@@ -772,7 +798,9 @@
// Now, we add the project contact addresses...
// ...but only if the task is public
$task_details = $fs->getTaskDetails($task_id);
- if ($task_details['mark_private'] != '1')
+ if (($task_details['mark_private'] != '1') &&
+ (($type == 1) || ($type == 3) || ($type == 4) || ($type == 10) ||
+ ($type == 14)))
{
$proj_emails = explode(",", $proj->prefs['notify_email']);
$proj_jids = explode(",", $proj->prefs['notify_jabber']);
Performance tweak for a slow SQL statement.
Index: index.php
===================================================================
--- index.php (revision 502)
+++ index.php (working copy)
@@ -130,10 +130,12 @@
// or, if the user is logged in
$sql = $db->Query(
"SELECT p.project_id, p.project_title
- FROM {projects} p
- LEFT JOIN {groups} g ON p.project_id=g.belongs_to_project AND g.view_tasks=1
- LEFT JOIN {users_in_groups} uig ON uig.group_id = g.group_id AND uig.user_id = ?
- WHERE p.project_is_active='1' AND (p.others_view OR uig.user_id IS NOT NULL)
+ FROM {users_in_groups} uig
+ LEFT JOIN {groups} g ON uig.group_id = g.group_id
+ LEFT JOIN {projects} p ON g.belongs_to_project = p.project_id
+ WHERE uig.user_id = ? AND p.project_is_active='1' AND
+ g.view_tasks='1' AND
+ (p.others_view OR uig.user_id IS NOT NULL)
ORDER BY p.project_title", array($user->id));
}
else {
This diff is collapsed.
Adapt the default "Bluey" theme to make it Emulab friendly.
* Change out the flyspray header with the emulab one.
* Make disabled form fields look disabled.
* Hide the logout button.
Index: themes/Bluey/theme.css
===================================================================
--- themes/Bluey/theme.css (revision 502)
+++ themes/Bluey/theme.css (working copy)
@@ -49,11 +49,10 @@
/* the main title; h1 alone is also used in the popup windows. */
h1#title {
- background:#47617b url("title.png") no-repeat;
- height:45px;
+ background:#ffffff url("http://www.emulab.net/headerbgbb.jpg") repeat;
+ height:100px;
margin:0;
- padding:1ex 0;
- text-indent:-9000px;
+ padding:0 0;
}
h2 {
@@ -86,6 +85,14 @@
margin:2px;
}
+input.disabled, textarea.disabled, select.disabled, button.disabled {
+ background-color : #dde6ee;
+ color : #02007e;
+ border : 1px ridge #000000;
+ margin : 2px;
+ font-size : 100%;
+}
+
textarea {
width:95%;
}
@@ -290,6 +297,13 @@
margin:3px 0 0;
}
+div#search select.disabled,div#search input.disabled {
+ background-color : #dde6ee;
+ color : #02007e;
+ border : 1px ridge #000000;
+ margin : 3px 0 0;
+}
+
div#search input.mainbutton {
color:#FFF;
}
@@ -1030,4 +1044,8 @@
table.requests td {
border:solid 1px black;
padding:0.2em 0.5em;
-}
\ No newline at end of file
+}
+
+#logoutlink {
+ visibility: hidden;
+}
Index: templates/common.profile.tpl
===================================================================
--- templates/common.profile.tpl (revision 502)
+++ templates/common.profile.tpl (working copy)
@@ -4,15 +4,23 @@
<tr>
<td><label for="realname">{$admin_text['realname']}</label></td>
<td>
+ <?php if (0): ?>
<input id="realname" type="text" name="real_name" size="50" maxlength="100"
value="{$theuser->infos['real_name']}" />
+ <?php else: ?>
+ {$theuser->infos['real_name']}
+ <?php endif; ?>
</td>
</tr>
<tr>
<td><label for="emailaddress">{$admin_text['emailaddress']}</label></td>
<td>
+ <?php if (0): ?>
<input id="emailaddress" type="text" name="email_address" size="50" maxlength="100"
value="{$theuser->infos['email_address']}" />
+ <?php else: ?>
+ {$theuser->infos['email_address']}
+ <?php endif; ?>
</td>
</tr>
<tr>
@@ -71,6 +79,7 @@
</td>
</tr>
<?php endif; ?>
+ <?php if (0): ?>
<tr>
<td colspan="2"><hr /></td>
</tr>
@@ -82,6 +91,7 @@
<td><label for="confirmpass">{$admin_text['confirmpass']}</label></td>
<td><input id="confirmpass" type="password" name="confirmpass" size="40" maxlength="100" /></td>
</tr>
+ <?php endif; ?>
<tr>
<td colspan="2" class="buttons">
<input type="hidden" name="do" value="modify" />
@@ -93,4 +103,4 @@
</tr>
</table>
</form>
-</fieldset>
\ No newline at end of file
+</fieldset>
Index: templates/common.groups.tpl
===================================================================
--- templates/common.groups.tpl (revision 502)
+++ templates/common.groups.tpl (working copy)
@@ -45,7 +45,7 @@
</form>
<?php endforeach; ?>
-<?php if ($proj->id): ?>
+<?php if (0 && $proj->id): ?>
<form action="{$baseurl}" method="post">
<div>
<input type="hidden" name="do" value="modify" />
Index: templates/links.tpl
===================================================================
--- templates/links.tpl (revision 502)
+++ templates/links.tpl (working copy)
@@ -5,7 +5,7 @@
<a href="{$fs->CreateURL('myprofile', null)}" title="{$language['editmydetails']}">
<em>{$user->infos['real_name']} ({$user->infos['user_name']})</em>
</a>
- <div id="permissions">
+ <div id="permissions" onmouseout='perms.do_later("hide")'>
{!tpl_draw_perms($user->perms)}
</div>
</li>
Index: templates/header.tpl
===================================================================
--- templates/header.tpl (revision 502)
+++ templates/header.tpl (working copy)
@@ -1,7 +1,7 @@
<!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" lang="{$language['locale']}" xml:lang="{$language['locale']}">
<head>
- <title>Flyspray::&nbsp;&nbsp;{$proj->prefs['project_title']}:&nbsp;&nbsp;</title>
+ <title>Flyspray::{$proj->prefs['project_title']}:</title>
<meta name="description" content="Flyspray, a Bug Tracking System written in PHP." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -32,7 +32,7 @@
</head>
<body onload="perms = new Perms('permissions')">
<!-- Remove this to remove the logo -->
- <h1 id="title">{$proj->prefs['project_title']}</h1>
+ <h1 id="title"><a href="https://www.emulab.net"><img src="https://www.emulab.net/overlay.emulab.net.gif" border=0></a></h1>
<?php
if ($user->isAnon()):
$this->display('loginbox.tpl');
@@ -83,4 +83,8 @@
</form>
</div>
+ <?php if (Get::val('project') == '0'): ?>
+ <div id="intromessage">This is the bug listing for all projects.<br></div>
+ <?php else: ?>
<div id="intromessage">{!@$intro_message}</div>
+ <?php endif; ?>
Index: templates/newtask.tpl
===================================================================
--- templates/newtask.tpl (revision 502)
+++ templates/newtask.tpl (working copy)
@@ -34,7 +34,7 @@
<tr>
<td><label for="status">{$newtask_text['status']}</label></td>
<td>
- <select id="status" name="item_status" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled"';?>>
+ <select id="status" name="item_status" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled" class="disabled"';?>>
{!tpl_options($status_list, 2)}
</select>
</td>
@@ -49,7 +49,7 @@
<label for="assignedto">{$newtask_text['assignedto']}</label>
</td>
<td>
- <select id="assignedto" name="assigned_to" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled"';?>>
+ <select id="assignedto" name="assigned_to" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled" class="disabled"';?>>
<option value="0">{$newtask_text['noone']}</option>
<?php $fs->ListUsers($proj->id); ?>
</select>
@@ -79,7 +79,7 @@
<tr>
<td><label for="priority">{$newtask_text['priority']}</label></td>
<td>
- <select id="priority" name="task_priority" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled"';?>>
+ <select id="priority" name="task_priority" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled" class="disabled"';?>>
{!tpl_options($priority_list, 2)}
</select>
</td>
@@ -95,7 +95,7 @@
<tr>
<td><label for="dueversion">{$newtask_text['dueinversion']}</label></td>
<td>
- <select id="dueversion" name="closedby_version" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled"';?>>
+ <select id="dueversion" name="closedby_version" <?php if (!$user->perms['modify_all_tasks']) echo ' disabled="disabled" class="disabled"';?>>
<option value="">{$newtask_text['undecided']}</option>
{!tpl_options($proj->listVersions(false, 3))}
</select>
Index: includes/class.tpl.php
===================================================================
--- includes/class.tpl.php (revision 502)
+++ includes/class.tpl.php (working copy)
@@ -370,7 +370,7 @@
function tpl_disableif($if)
{
if ($if) {
- return 'disabled="disabled"';
+ return 'disabled="disabled" class="disabled"';
}
}
Index: includes/perms.js
===================================================================
--- includes/perms.js (revision 502)
+++ includes/perms.js (working copy)
@@ -19,7 +19,7 @@
Perms.prototype.do_later = function(action) {
this.clearTimeout();
closure = createClosure(this, action);
- this.timeout = setTimeout(closure, 1000);
+ this.timeout = setTimeout(closure, 250);
}
Perms.prototype.show = function() {
Bring the XML-RPC interface back up to date.
Index: remote.php
===================================================================
--- remote.php (revision 502)
+++ remote.php (working copy)
@@ -41,6 +41,7 @@
// use xmlrpc library (library + server library)
require_once $conf['general']['baseurl'] . 'includes/xmlrpc.inc';
require_once $conf['general']['baseurl'] . 'includes/xmlrpcs.inc';
+require_once "$basedir/includes/class.tpl.php";
//////////////////////////////////////////////////
// Login/Authentication functions //
@@ -95,6 +96,7 @@
function getTask($args)
{
global $fs;
+ global $user;
$task_id = php_xmlrpc_decode($args->getParam(2));
@@ -108,13 +110,13 @@
return loginErrorResponse();
}
+ $user = new User($user_id);
-
// Get the task details
$task_details = $fs->getTaskDetails($task_id);
// Get the user's permissions for the project this task belongs to
- $permissions = $fs->getPermissions($user_id, $task_details['attached_to_project']);
+ $permissions = $user->perms;
// If the task doesn't exist, stop.
if (!is_numeric($task_details['task_id']))
@@ -236,16 +238,16 @@
**/
function taskTypeArray()
{
- return arrayForQuery("SELECT tasktype_id, tasktype_name FROM flyspray_list_tasktype ORDER BY list_position"
- ,'tasktype_id','tasktype_name');
+ return arrayForQuery("SELECT tasktype_name, tasktype_id FROM flyspray_list_tasktype ORDER BY list_position"
+ ,'tasktype_name','tasktype_id');
}
/**
** returns an array of possible task category values
**/
function categoryArray()
{
- return arrayForQuery("SELECT category_id, category_name FROM flyspray_list_category ORDER BY list_position"
- ,'category_id','category_name');
+ return arrayForQuery("SELECT category_name, category_id FROM flyspray_list_category ORDER BY list_position"
+ ,'category_name','category_id');
}
/**
** returns an array of possible task status values
@@ -463,6 +465,7 @@
global $fs;
global $db;
global $be;
+ global $user;
include_once('includes/notify.inc.php');
$notify = new Notifications();
@@ -479,15 +482,26 @@
return loginErrorResponse();
}
+ $user = new User($user_id);
+
// Get the task details
$task_details = @$fs->getTaskDetails($task_id);
- // Get the user's permissions for the project this task belongs to
- $permissions = $fs->getPermissions($user_id, $taskData['project_id']);
+ if (!empty($taskData['project_title'])) {
+ $get_pid = $db->Query("SELECT project_id
+ FROM {projects}
+ WHERE project_title = ?",
+ $taskData['project_title']);
+ if ($db->CountRows($get_pid) != 1) {
+ return new xmlrpcresp (0,PERMISSION_DENIED, 'No such project.');
+ }
+ else {
+ $row = $db->FetchArray($get_pid);
+ $taskData['project_id'] = $row['project_id'];
+ }
+ }
-
-
// compulsory args
$taskData[0] = $user_id;
$taskData[1] = $taskData['project_id'];
@@ -495,6 +509,15 @@
$taskData[2] = $taskData['item_summary'];
$taskData[3] = $taskData['detailed_desc'];
+ if (empty($taskData['product_category']))
+ $taskData['product_category'] = 0;
+ if (empty($taskData['product_version']))
+ $taskData['product_version'] = 0;
+ if (empty($taskData['operating_system']))
+ $taskData['operating_system'] = 0;
+ if (empty($taskData['task_severity']))
+ $taskData['task_severity'] = 1;
+
$taskData[4] = $taskData['task_type'];
$taskData[5] = $taskData['product_category'];
$taskData[6] = $taskData['product_version'];
@@ -515,13 +538,19 @@
// data should now be loaded
+ $proj = new Project($taskData['project_id']);
+ $proj->checkExists();
+ // Get the user's permissions for the project this task belongs to
+ $user->get_perms($proj);
+ $permissions = $user->perms;
+
// get permissions for the project
- $project_prefs = $fs->GetProjectPrefs($taskData['project_id']);
+ $project_prefs = $proj->prefs;
// check permissions here rather than waiting until we get to
// the backend module. Saves time and effort
- if ($permissions['open_new_tasks'] != '1' && $project_prefs['anon_open'] != '1') {
+ if (!$user->can_open_task($proj)) {
return new xmlrpcresp (0,PERMISSION_DENIED, 'You do not have permission to perform this function.');
}
@@ -558,6 +587,7 @@
{
global $fs;
global $db;
+ global $user;
include_once('includes/notify.inc.php');
$notify = new Notifications;
@@ -577,11 +607,13 @@
return loginErrorResponse();
}
+ $user = new User($user_id);
+
// Get the task details
$task_details = @$fs->getTaskDetails($task_id);
// Get the user's permissions for the project this task belongs to
- $permissions = $fs->getPermissions($user_id, $task_details['attached_to_project']);
+ $permissions = $user->perms;
// If the task doesn't exist, stop.
if (!is_numeric($task_details['task_id']))
@@ -655,6 +687,7 @@
{
global $fs;
global $db;
+ global $user;
$req_user = php_xmlrpc_decode($args->getParam(2));
@@ -668,8 +701,10 @@
return loginErrorResponse();
}
+ $user = new User($user_id);
+
// Get the user's permissions
- $permissions = $fs->getPermissions($user_id, true);
+ $permissions = $user->perms;
if ($permissions['is_admin'] == '1' or $user_id == $req_user)
{
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment