Commit f6c796ad authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 185090: Add revamped whining system

patch by: Erik r=joel r=jouni a=justdave
parent e9402c22
......@@ -172,10 +172,14 @@ sub queries {
return [] unless $self->id;
my $dbh = Bugzilla->dbh;
my $sth = $dbh->prepare(q{ SELECT name, query, linkinfooter
FROM namedqueries
WHERE userid=?
ORDER BY UPPER(name)});
my $sth = $dbh->prepare(q{ SELECT
DISTINCT name, query, linkinfooter,
IF(whine_queries.id IS NOT NULL, 1, 0)
FROM namedqueries
LEFT JOIN whine_queries
ON whine_queries.query_name = name
WHERE userid=?
ORDER BY UPPER(name)});
$sth->execute($self->{id});
my @queries;
......@@ -184,6 +188,7 @@ sub queries {
name => $row->[0],
query => $row->[1],
linkinfooter => $row->[2],
usedinwhine => $row->[3],
});
}
$self->{queries} = \@queries;
......
......@@ -1262,7 +1262,8 @@ WriteParams();
# These are the files which need to be marked executable
my @executable_files = ('whineatnews.pl', 'collectstats.pl',
'checksetup.pl', 'importxml.pl', 'runtests.sh', 'testserver.pl');
'checksetup.pl', 'importxml.pl', 'runtests.sh', 'testserver.pl',
'whine.pl');
# tell me if a file is executable. All CGI files and those in @executable_files
# are executable
......@@ -1989,6 +1990,37 @@ $table{series_categories} =
unique(name)';
# whine system
$table{whine_queries} =
'id mediumint auto_increment primary key,
eventid mediumint not null,
query_name varchar(64) not null default \'\',
sortkey smallint not null default 0,
onemailperbug tinyint not null default 0,
title varchar(128) not null,
index(eventid)';
$table{whine_schedules} =
'id mediumint auto_increment primary key,
eventid mediumint not null,
run_day varchar(32),
run_time varchar(32),
run_next datetime,
mailto_userid mediumint not null,
index(run_next),
index(eventid)';
$table{whine_events} =
'id mediumint auto_increment primary key,
owner_userid mediumint not null,
subject varchar(128),
body mediumtext';
###########################################################################
# Create tables
###########################################################################
......@@ -4012,6 +4044,18 @@ if (!GroupDoesExist("canconfirm")) {
}
# Create bz_canusewhineatothers and bz_canusewhines
if (!GroupDoesExist('bz_canusewhines')) {
my $whine_group = AddGroup('bz_canusewhines',
'User can configure whine reports for self');
my $whineatothers_group = AddGroup('bz_canusewhineatothers',
'Can configure whine reports for ' .
'other users');
$dbh->do("INSERT IGNORE INTO group_group_map " .
"(member_id, grantor_id, grant_type) " .
"VALUES (${whine_group}, ${whineatothers_group}, " .
GROUP_MEMBERSHIP . ")");
}
###########################################################################
# Create Administrator --ADMIN--
......
This diff is collapsed. Click to expand it.
......@@ -70,8 +70,12 @@
<a href="query.cgi?[% q.query FILTER html %]">Edit</a>
</td>
<td>
<a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd=
[% q.name FILTER html %]">Forget</a>
[% IF q.usedinwhine %]
Remove from <a href="editwhines.cgi">whining</a> first
[% ELSE %]
<a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd=
[% q.name FILTER html %]">Forget</a>
[% END %]
</td>
<td align="center">
<input type="checkbox"
......
......@@ -37,6 +37,19 @@
%::safe = (
'whine/schedule.html.tmpl' => [
'event.key',
'query.id',
'query.sort',
'schedule.id',
'option.0',
'option.1',
],
'whine/mail.html.tmpl' => [
'bug.bug_id',
],
'sidebar.xul.tmpl' => [
'template_version',
],
......
......@@ -104,6 +104,8 @@
href="editgroups.cgi">' IF user.groups.creategroups %]
[% '<link rel="Administration" title="Keywords"
href="editkeywords.cgi">' IF user.groups.editkeywords %]
[% '<link rel="Administration" title="Whining"
href="editwhines.cgi">' IF user.groups.bz_canusewhines %]
[% '<link rel="Administration" title="Sanity Check"
href="sanitycheck.cgi">' IF user.groups.tweakparams %]
[% END %]
......
......@@ -81,6 +81,8 @@
IF user.groups.creategroups %]
[% ' | <a href="editkeywords.cgi">Keywords</a>'
IF user.groups.editkeywords %]
[% ' | <a href="editwhines.cgi">Whining</a>'
IF user.groups.bz_canusewhines %]
</div>
</div>
[% END %]
......
......@@ -846,6 +846,11 @@
Value is out of range for field
<em>[% field_descs.$field FILTER html %]</em>.
[% ELSIF error == "whine_access_denied" %]
[% title = "Access Denied" %]
Sorry, you aren't a member of the 'bz_canusewhines' group, and so
you aren't allowed to schedule whine reports.
[% ELSIF error == "zero_length_file" %]
[% title = "File Is Empty" %]
The file you are trying to attach is empty!
......
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Erik Stambaugh <erik@dasbistro.com>
#%]
[%# INTERFACE:
# subject: subject line of message
# body: message body, shown before the query tables
# queries: array of hashes containing:
# bugs: array containing hashes of fieldnames->values for each bug
# title: the title given in the whine scheduling mechanism
# author: user object for the person who scheduled this whine
# recipient: user object for the intended recipient of the message
#%]
[% PROCESS global/variables.none.tmpl %]
[%# assignee_login_string is a literal string used for getting the
# assignee's name out of the bug data %]
[% SET assignee_login_string="map_assigned_to.login_name" %]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
[[% terms.Bugzilla %]] [% subject FILTER html %]
</title>
</head>
<body bgcolor="#FFFFFF">
<p align="left">
[% body FILTER html %]
</p>
<p align="left">
[% IF author.login == recipient.login %]
<a href="[%+ Param('urlbase') FILTER html %]editwhines.cgi">Click
here to edit your whine schedule</a>
[% ELSE %]
This search was scheduled by [% author.login FILTER html %].
[% END %]
</p>
[% FOREACH query=queries %]
<h2>[%+ query.title FILTER html %]</h2>
<table width="100%">
<tr>
<th align="left">ID</th>
<th align="left">Sev</th>
<th align="left">Pri</th>
<th align="left">Plt</th>
<th align="left">Assignee</th>
<th align="left">Status</th>
<th align="left">Resolution</th>
<th align="left">Summary</th>
</tr>
[% FOREACH bug=query.bugs %]
<tr>
<td align="left"><a href="[%+ Param('urlbase') FILTER html %]show_bug.cgi?id=
[%- bug.bug_id %]">[% bug.bug_id %]</a></td>
<td align="left">[% bug.bug_severity FILTER html %]</td>
<td align="left">[% bug.priority FILTER html %]</td>
<td align="left">[% bug.rep_platform FILTER html %]</td>
<td align="left">[% bug.$assignee_login_string FILTER html %]</td>
<td align="left">[% bug.bug_status FILTER html %]</td>
<td align="left">[% bug.resolution FILTER html %]</td>
<td align="left">[% bug.short_desc FILTER html %]</td>
</tr>
[% END %]
</table>
[% END %]
</body>
</html>
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Erik Stambaugh <erik@dasbistro.com>
#%]
[%# INTERFACE:
# subject: subject line of message
# body: message body, shown before the query tables
# queries: array of hashes containing:
# bugs: array containing hashes of fieldnames->values for each bug
# title: the title given in the whine scheduling mechanism
# author: user object for the person who scheduled this whine
# recipient: user object for the intended recipient of the message
#%]
[% PROCESS global/variables.none.tmpl %]
[%# assignee_login_string is a literal string used for getting the
# assignee's name out of the bug data %]
[% SET assignee_login_string="map_assigned_to.login_name" %]
[% body %]
[% IF author.login == recipient.login %]
To edit your whine schedule, visit the following URL:
[%+ Param('urlbase') %]editwhines.cgi
[% ELSE %]
This search was scheduled by [% author.login %].
[% END %]
[% FOREACH query=queries %]
[%+ query.title +%]
[%+ "-" FILTER repeat(query.title.length) %]
[% FOREACH bug=query.bugs %]
[% terms.Bug +%] [%+ bug.bug_id %]:
[%+ Param('urlbase') %]show_bug.cgi?id=[% bug.bug_id +%]
Priority: [%+ bug.priority -%]
Severity: [%+ bug.bug_severity -%]
Platform: [%+ bug.rep_platform %]
Assignee: [%+ bug.$assignee_login_string %]
Status: [%+ bug.bug_status %]
[%- IF bug.resolution -%] Resolution: [% bug.resolution -%]
[%- END %]
Summary: [% bug.short_desc %]
[% END %]
[% END %]
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Erik Stambaugh <erik@dasbistro.com>
#%]
[%# INTERFACE:
# subject: subject line of message
# alternatives: array of hashes containing:
# type: MIME type
# content: verbatim content
# boundary: a string that has been generated to be a unique boundary
# recipient: user object for the intended recipient of the message
# from: Bugzilla system email address
#%]
[% PROCESS global/variables.none.tmpl %]
From: [% from %]
To: [% recipient.login %]
Subject: [[% terms.Bugzilla %]] [% subject %]
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="[% boundary %]"
This is a MIME multipart message. It is possible that your mail program
doesn't quite handle these properly. Some or all of the information in this
message may be unreadable.
[% FOREACH part=alternatives %]
--[% boundary %]
Content-type: [% part.type +%]
[%+ part.content %]
[%+ END %]
This diff is collapsed. Click to expand it.
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