Commit af4793c8 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 389313: summarize_time.cgi needs some cleanup - Patch by Fré©ric Buclin…

Bug 389313: summarize_time.cgi needs some cleanup - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent c14f288a
...@@ -152,7 +152,7 @@ if (defined $cgi->param('id')) { ...@@ -152,7 +152,7 @@ if (defined $cgi->param('id')) {
} }
# Make sure there are bugs to process. # Make sure there are bugs to process.
scalar(@idlist) || ThrowUserError("no_bugs_chosen"); scalar(@idlist) || ThrowUserError("no_bugs_chosen", {action => 'modify'});
# Build a bug object using the first bug id, for validations. # Build a bug object using the first bug id, for validations.
my $bug = $bug_objects[0]; my $bug = $bug_objects[0];
......
...@@ -11,18 +11,19 @@ ...@@ -11,18 +11,19 @@
# The Original Code is the Bugzilla Bug Tracking System. # The Original Code is the Bugzilla Bug Tracking System.
# #
# Contributor(s): Christian Reis <kiko@async.com.br> # Contributor(s): Christian Reis <kiko@async.com.br>
# Frédéric Buclin <LpSolit@gmail.com>
#%] #%]
[% USE date %] [% USE date %]
[% PROCESS global/variables.none.tmpl %] [% PROCESS "global/field-descs.none.tmpl" %]
[% title = "Time Summary " %] [% title = "Time Summary " %]
[% IF do_depends %] [% IF do_depends %]
[% title = title _ "for " %] [% title = title _ "for " %]
[% header = title _ "$terms.Bug $ids.0" FILTER bug_link(ids.0) FILTER none %] [% header = "$terms.Bug $ids.0" FILTER bug_link(ids.0) FILTER none %]
[% title = title _ "$terms.Bug $ids.0: " %] [% header = title _ header _ " (and $terms.bugs blocking it)" %]
[% header = (header _ " (and $terms.bugs blocking it)") IF do_depends %] [% title = title _ "$terms.Bug $ids.0" %]
[% ELSE %] [% ELSE %]
[% title = title _ "($ids.size $terms.bugs selected)" %] [% title = title _ "($ids.size $terms.bugs selected)" %]
[% header = title %] [% header = title %]
...@@ -34,19 +35,14 @@ ...@@ -34,19 +35,14 @@
style_urls = ["skins/standard/summarize-time.css"] style_urls = ["skins/standard/summarize-time.css"]
%] %]
[% IF ids.size == 0 %] [% INCLUDE query_form %]
<p>No [% terms.bugs %] specified or visible.</p> [% IF do_report %]
[% ELSE %]
[% INCLUDE query_form %]
[% IF do_report %]
[% global.grand_total = 0 %] [% global.grand_total = 0 %]
[% FOREACH workdata = part_list %] [% FOREACH workdata = part_list %]
[%# parts contains date ranges (from, to). %]
[% part = parts.shift %] [% part = parts.shift %]
<div align="right"> <div align="right">
<h4 style="padding-right: 2em; margin: 0;"> <h4 style="padding-right: 2em; margin: 0;">
...@@ -69,12 +65,9 @@ ...@@ -69,12 +65,9 @@
<hr noshade size="1"> <hr noshade size="1">
[% END %] [% END %]
[% IF null.keys.size > 0 %] [% IF null.size > 0 %]
[% INCLUDE inactive_report %] [% INCLUDE inactive_report %]
<h4 style="margin: 0">Total of [% null.keys.size %] <h4 style="margin: 0">Total of [% null.size %] inactive [% terms.bugs %]</h4>
inactive [% terms.bugs %]</h4>
[% END %]
[% END %] [% END %]
[% END %] [% END %]
...@@ -88,7 +81,7 @@ ...@@ -88,7 +81,7 @@
#%] #%]
[% BLOCK owner_report %] [% BLOCK owner_report %]
[% global.total = 0 global.bug_count = {} global.owner_count = {}%] [% global.total = 0 global.bug_count = {} global.owner_count = {} %]
<table cellpadding="4" cellspacing="0" width="90%" class="realitems owner"> <table cellpadding="4" cellspacing="0" width="90%" class="realitems owner">
[% FOREACH owner = workdata.keys.sort %] [% FOREACH owner = workdata.keys.sort %]
[% INCLUDE do_one_owner owner=owner ownerdata=workdata.$owner [% INCLUDE do_one_owner owner=owner ownerdata=workdata.$owner
...@@ -111,19 +104,13 @@ ...@@ -111,19 +104,13 @@
[% bug_id = bugdata.bug_id %] [% bug_id = bugdata.bug_id %]
[% global.bug_count.$bug_id = 1 %] [% global.bug_count.$bug_id = 1 %]
[% IF detailed %] [% IF detailed %]
[%# XXX oy what a hack %] [% INCLUDE bug_header cid=col id=bug_id bugdata=bugdata extra=1 %]
[% timerow = '<td width="100" align="right" valign="top">' _ bugdata.total_time _ '</td>' %]
[% INCLUDE bug_header cid=col id=bug_id bug_status=bugdata.bug_status
short_desc=bugdata.short_desc extra=timerow %]
[% col = col + 1 %] [% col = col + 1 %]
[% END %] [% END %]
[% subtotal = subtotal + bugdata.total_time %] [% subtotal = subtotal + bugdata.total_time %]
[% END %] [% END %]
<tr> <tr>
<td colspan="3">&nbsp;</td> <td colspan="4" align="right"><b>Total</b>:</td>
<td align="right">
<b>Total</b>:
</td>
<td align="right" class="subtotal" width="100"> <td align="right" class="subtotal" width="100">
<b>[% subtotal FILTER format("%.2f") %]</b></td> <b>[% subtotal FILTER format("%.2f") %]</b></td>
[% global.total = global.total + subtotal %] [% global.total = global.total + subtotal %]
...@@ -140,13 +127,12 @@ ...@@ -140,13 +127,12 @@
[% global.total = 0 global.owner_count = {} global.bug_count = {} %] [% global.total = 0 global.owner_count = {} global.bug_count = {} %]
<table cellpadding="4" cellspacing="0" width="90%" class="realitems number"> <table cellpadding="4" cellspacing="0" width="90%" class="realitems number">
[% keys = sort_bug_keys(workdata.keys) %] [% FOREACH bug = workdata.keys.nsort %]
[% FOREACH bug = keys %] [% INCLUDE do_one_bug id=bug bugdata=workdata.$bug
[% INCLUDE do_one_bug bug=bug bugdata=workdata.$bug
detailed=detailed %] detailed=detailed %]
[% END %] [% END %]
[% additional = "$global.bug_count.size $terms.bugs &amp; [% additional = "$global.bug_count.size $terms.bugs &
$global.owner_count.size developers" %] $global.owner_count.size developers" %]
[% INCLUDE section_total additional=additional colspan=2 %] [% INCLUDE section_total additional=additional colspan=2 %]
</table> </table>
...@@ -154,13 +140,8 @@ ...@@ -154,13 +140,8 @@
[% BLOCK do_one_bug %] [% BLOCK do_one_bug %]
[% subtotal = 0.00 cid = 0 %] [% subtotal = 0.00 cid = 0 %]
[%# hack apart the ID and summary. Sad. %]
[% items = bug.split(";") %]
[% id = items.shift %]
[% status = items.shift %]
[% global.bug_count.$id = 1 %] [% global.bug_count.$id = 1 %]
[% INCLUDE bug_header id=id bug_status=status short_desc=items.join(";") %] [% INCLUDE bug_header id=id %]
[% FOREACH owner = bugdata.sort("login_name") %] [% FOREACH owner = bugdata.sort("login_name") %]
[% work_time = owner.total_time %] [% work_time = owner.total_time %]
...@@ -184,17 +165,21 @@ ...@@ -184,17 +165,21 @@
</td> </td>
<td align="right" class="subtotal" width="100"> <td align="right" class="subtotal" width="100">
<b>[% subtotal FILTER format("%.2f") %]</b> <b>[% subtotal FILTER format("%.2f") %]</b>
</td></tr> </td>
</tr>
[% global.total = global.total + subtotal %] [% global.total = global.total + subtotal %]
[% END %] [% END %]
[% BLOCK bug_header %] [% BLOCK bug_header %]
<tr class="bug_header[% '2' IF cid % 2 %]"> <tr class="bug_header[% '2' IF cid % 2 %]">
<td width="10" valign="top"> <td width="80" valign="top">
[% INCLUDE buglink id=id %]</td> <b>[% "$terms.Bug $id" FILTER bug_link(id) FILTER none %]</b>
<td width="10"><b>[% bug_status FILTER html %]</b></td> </td>
<td colspan="2">[% short_desc FILTER html %]</td> <td width="100"><b>[% get_status(bugs.$id.bug_status) FILTER html %]</b></td>
[% extra FILTER none %] <td colspan="2">[% bugs.$id.short_desc FILTER html %]</td>
[% IF extra %]
<td align="right" valign="top">[% bugdata.total_time FILTER html %]</td>
[% END %]
</tr> </tr>
[% END %] [% END %]
...@@ -203,9 +188,8 @@ ...@@ -203,9 +188,8 @@
<h3>Inactive [% terms.bugs %]</h3> <h3>Inactive [% terms.bugs %]</h3>
<table cellpadding="4" cellspacing="0" width="90%" class="zeroitems"> <table cellpadding="4" cellspacing="0" width="90%" class="zeroitems">
[% cid = 0 %] [% cid = 0 %]
[% FOREACH bug_id = null.keys.nsort %] [% FOREACH bug_id = null.nsort %]
[% INCLUDE bug_header id=bug_id bug_status=null.$bug_id.1 [% INCLUDE bug_header id=bug_id cid=cid %]
short_desc=null.$bug_id.0 cid=cid %]
[% cid = cid + 1 %] [% cid = cid + 1 %]
[% END %] [% END %]
</table> </table>
...@@ -215,16 +199,14 @@ ...@@ -215,16 +199,14 @@
[% BLOCK section_total %] [% BLOCK section_total %]
[% IF global.total > 0 %] [% IF global.total > 0 %]
<tr class="section_total"> <tr class="section_total">
<td align="left" width="10"> <td><b>Totals</b></td>
<b>Totals</b></td> <td colspan="[% colspan FILTER html %]" align="right"><b>[% additional FILTER html %]</b></td>
<td colspan="[% colspan FILTER none %]" align="right"><b>[% additional FILTER none %]</b></td> <td align="right"><b>[% global.total FILTER format("%.2f") %]</b></td>
<td align="right">&nbsp;&nbsp; </tr>
<b>[% global.total FILTER format("%.2f") %]</b>
</td></tr>
[% ELSE %] [% ELSE %]
<tr><td> <tr>
No time allocated during the specified period. <td>No time allocated during the specified period.</td>
</td></tr> </tr>
[% END %] [% END %]
[% global.grand_total = global.grand_total + global.total %] [% global.grand_total = global.grand_total + global.total %]
[% END %] [% END %]
...@@ -301,20 +283,9 @@ ...@@ -301,20 +283,9 @@
</tr></table> </tr></table>
</form> </form>
<script type="application/x-javascript"> <script type="text/javascript">
<!-- <!--
document.forms['summary'].start_date.focus() document.forms['summary'].start_date.focus()
//--></script> //--></script>
<hr noshade size=1> <hr noshade size=1>
[% END %] [% END %]
[%#
#
# Utility
#
#%]
[% BLOCK buglink %]
<a href="show_bug.cgi?id=[% id FILTER url_quote %]"><b>[% terms.Bug %]&nbsp;[% id FILTER html %]</b></a>
[% END %]
...@@ -1043,7 +1043,12 @@ ...@@ -1043,7 +1043,12 @@
[% ELSIF error == "no_bugs_chosen" %] [% ELSIF error == "no_bugs_chosen" %]
[% title = BLOCK %]No [% terms.Bugs %] Selected[% END %] [% title = BLOCK %]No [% terms.Bugs %] Selected[% END %]
You apparently didn't choose any [% terms.bugs %] to modify. You apparently didn't choose any [% terms.bugs %]
[% IF action == "modify" %]
to modify.
[% ELSIF action == "view" %]
to view.
[% END %]
[% ELSIF error == "no_bug_ids" %] [% ELSIF error == "no_bug_ids" %]
[% title = BLOCK %]No [% terms.Bugs %] Selected[% END %] [% title = BLOCK %]No [% terms.Bugs %] Selected[% END %]
......
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