Commit a44e1524 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 519142: Replace IF/ELSE statements about bug_status/resolution with just a…

Bug 519142: Replace IF/ELSE statements about bug_status/resolution with just a display_value call, and use display_value in more places to translate field values. Patch by Vitaly Fedrushkov <vitaly.fedrushkov@gmail.com> r=mkanat, a=mkanat
parent bc19f61c
......@@ -22,6 +22,8 @@
# panel: hash representing the current panel.
#%]
[% PROCESS "global/field-descs.none.tmpl" %]
[% sortlist_separator = '---' %]
<dl>
......@@ -115,7 +117,17 @@
[% FOREACH item = param.choices %]
<option value="[% item FILTER html %]"
[% " selected=\"selected\"" IF item == Param(param.name) %]>
[% IF param.name == "defaultseverity" %]
[% display_value("bug_severity", item) FILTER html %]
[% ELSIF param.name == "defaultplatform" %]
[% display_value("rep_platform", item) FILTER html %]
[% ELSIF param.name == "defaultopsys" %]
[% display_value("op_sys", item) FILTER html %]
[% ELSIF param.name == "duplicate_or_move_bug_status" %]
[% display_value("bug_status", item) FILTER html %]
[% ELSE %]
[% item FILTER html %]
[% END %]
</option>
[% END %]
</select>
......
......@@ -49,7 +49,7 @@
<th>&nbsp;</th>
[% FOREACH status = statuses %]
<th class="col-header[% status.is_open ? " open-status" : " closed-status" %]">
[% status.name FILTER html %]
[% display_value("bug_status", status.name) FILTER html %]
</th>
[% END %]
</tr>
......@@ -59,7 +59,7 @@
[% FOREACH status = p.merge(statuses) %]
<tr class="highlight">
<th align="right" class="[% status.is_open ? "open-status" : "closed-status" %]">
[% status.name FILTER html %]
[% display_value("bug_status", status.name) FILTER html %]
</th>
[% FOREACH new_status = statuses %]
......
......@@ -54,7 +54,7 @@
<th>&nbsp;</th>
[% FOREACH status = statuses %]
<th class="col-header[% status.is_open ? " open-status" : " closed-status" %]">
[% status.name FILTER html %]
[% display_value("bug_status", status.name) FILTER html %]
</th>
[% END %]
</tr>
......@@ -64,7 +64,7 @@
[% FOREACH status = p.merge(statuses) %]
<tr class="highlight">
<th align="right" class="[% status.is_open ? "open-status" : "closed-status" %]">
[% status.name FILTER html %]
[% display_value("bug_status", status.name) FILTER html %]
</th>
[% FOREACH new_status = statuses %]
......@@ -89,7 +89,7 @@
<p>
When [% terms.abug %] is marked as a duplicate of another one or is moved
to another installation, the [% terms.bug %] status is automatically set to
<b>[% Param("duplicate_or_move_bug_status") FILTER html %]</b>. All transitions to
<b>[% display_value("bug_status", Param("duplicate_or_move_bug_status")) FILTER html %]</b>. All transitions to
this [% terms.bug %] status must then be valid (this is the reason why you cannot edit
them above).<br>
Note: you can change this setting by visiting the
......
......@@ -80,15 +80,11 @@
change.fieldname == 'remaining_time' ||
change.fieldname == 'work_time' %]
[% PROCESS formattimeunit time_unit=change.removed %]
[% ELSIF change.fieldname == 'bug_status' %]
[% display_value("bug_status", change.removed) FILTER html %]
[% ELSIF change.fieldname == 'resolution' %]
[% display_value("resolution", change.removed) FILTER html %]
[% ELSIF change.fieldname == 'blocked' ||
change.fieldname == 'dependson' %]
[% change.removed FILTER bug_list_link FILTER none %]
[% ELSE %]
[% change.removed FILTER email FILTER html %]
[% display_value(change.fieldname, change.removed) FILTER email FILTER html %]
[% END %]
[% ELSE %]
&nbsp;
......@@ -100,15 +96,11 @@
change.fieldname == 'remaining_time' ||
change.fieldname == 'work_time' %]
[% PROCESS formattimeunit time_unit=change.added %]
[% ELSIF change.fieldname == 'bug_status' %]
[% display_value("bug_status", change.added) FILTER html %]
[% ELSIF change.fieldname == 'resolution' %]
[% display_value("resolution", change.added) FILTER html %]
[% ELSIF change.fieldname == 'blocked' ||
change.fieldname == 'dependson' %]
[% change.added FILTER bug_list_link FILTER none %]
[% ELSE %]
[% change.added FILTER email FILTER html %]
[% display_value(change.fieldname, change.added) FILTER email FILTER html %]
[% END %]
[% ELSE %]
&nbsp;
......
......@@ -664,11 +664,8 @@ TUI_hide_default('expert_fields');
[%- FOREACH x = ${sel.name} %]
<option value="[% x FILTER html %]"
[% " selected=\"selected\"" IF x == default.${sel.name} %]>
[% IF sel.name == "bug_status" %]
[% display_value("bug_status", x) FILTER html %]
[% ELSE %]
[% x FILTER html %]
[% END %]</option>
[% display_value(sel.name, x) FILTER html %]
</option>
[% END %]
</select>
......
......@@ -139,7 +139,7 @@
<tr>
<th>[% field_descs.bug_severity FILTER html %]:</th>
<td class="bz_[% bug.bug_severity FILTER css_class_quote -%]">
[% bug.bug_severity FILTER html %]
[% display_value("bug_severity", bug.bug_severity) FILTER html %]
</td>
[% PROCESS rightcell %]
......@@ -301,7 +301,7 @@
[% BLOCK row %]
<tr>
<th>[% field_descs.${cell} FILTER html %]:</th>
<td[% " colspan=3" IF fullrow %]>[% bug.${cell} FILTER html %]</td>
<td[% " colspan=3" IF fullrow %]>[% display_value(cell, bug.${cell}) FILTER html %]</td>
[% PROCESS rightcell IF !fullrow %]
</tr>
[% fullrow = 0 %]
......@@ -357,7 +357,7 @@
</td>
[% ELSIF name != "" %]
<th class="rightcell">[% field_descs.${name} FILTER html %]:</th>
<td>[% bug.${name} FILTER html %]</td>
<td>[% display_value(name, bug.${name}) FILTER html %]</td>
[% ELSE %]
<td>&nbsp;</td>
<td>&nbsp;</td>
......
......@@ -327,7 +327,7 @@
A valid quipid is needed.
[% ELSIF error == "no_manual_moved" %]
You cannot set the resolution of [% terms.abug %] to MOVED without
You cannot set the resolution of [% terms.abug %] to display_value("resolution", "MOVED") FILTER html %] without
moving the [% terms.bug %].
[% ELSIF error == "no_open_bug_status" %]
......
......@@ -146,6 +146,7 @@
},
"resolution" => {
"" => "---",
# "FIXED" => "NO LONGER AN ISSUE",
# "MOVED" => "BYE-BYE",
},
......
......@@ -368,7 +368,7 @@
</option>
[% FOREACH menuitem = menuitems %]
[% IF property %][% menuitem = menuitem.$property %][% END %]
<option value="[% menuitem FILTER html %]">[% menuitem FILTER html %]</option>
<option value="[% menuitem FILTER html %]">[% display_value(menuname, menuitem) FILTER html %]</option>
[% END %]
</select>
[% END %]
......
......@@ -23,7 +23,7 @@
# This is a template for generating an Atom representation of a buglist.
#%]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS "global/field-descs.none.tmpl" %]
[% DEFAULT title = "$terms.Bugzilla $terms.Bugs" %]
......@@ -71,16 +71,16 @@
<td>[% bug.reporter_realname FILTER html %]</td>
</tr><tr class="bz_feed_bug_status">
<td>[% columns.bug_status.title FILTER html %]</td>
<td>[% bug.bug_status FILTER html %]</td>
<td>[% display_value("bug_status", bug.bug_status) FILTER html %]</td>
</tr><tr class="bz_feed_resolution">
<td>[% columns.resolution.title FILTER html %] </td>
<td>[% bug.resolution FILTER html %]</td>
<td>[% display_value("resolution", bug.resolution) FILTER html %]</td>
</tr><tr class="bz_feed_priority">
<td>[% columns.priority.title FILTER html %]</td>
<td>[% bug.priority FILTER html %]</td>
<td>[% display_value("priority", bug.priority) FILTER html %]</td>
</tr><tr class="bz_feed_severity">
<td>[% columns.bug_severity.title FILTER html %] </td>
<td>[% bug.bug_severity FILTER html %]</td>
<td>[% display_value("bug_severity", bug.bug_severity) FILTER html %]</td>
[% IF Param("usetargetmilestone") %]
</tr><tr class="bz_feed_target_milestone">
<td>[% columns.target_milestone.title FILTER html %]</td>
......
......@@ -91,16 +91,8 @@
[% IF shown_types.contains(desc_item.type) || debug %]
([% search_descs.${desc_item.type} FILTER html %])
[% END %]
[% IF desc_item.field == 'bug_status' %]
[% FOREACH status IN desc_item.value.split(',') %]
[%+ display_value("bug_status", status) FILTER html %][% ',' UNLESS loop.last %]
[% END %]
[% ELSIF desc_item.field == 'resolution' %]
[% FOREACH resolution IN desc_item.value.split(',') %]
[%+ display_value("resolution", resolution) FILTER html %][% ',' UNLESS loop.last %]
[% END %]
[% ELSE %]
[%+ desc_item.value FILTER html %]
[% FOREACH val IN desc_item.value.split(',') %]
[%+ display_value(desc_item.field, val) FILTER html %][% ',' UNLESS loop.last %]
[% END %]
[% IF debug %]
(<code>[% desc_item.term FILTER html %]</code>)
......
......@@ -201,14 +201,7 @@
[% FOREACH column = displaycolumns %]
<td [% 'style="white-space: nowrap"' IF NOT abbrev.$column.wrap %]>
[% IF abbrev.$column.maxlength %]
<span title="
[%- IF column == 'bug_status' %]
[%- display_value("bug_status", bug.$column) FILTER html %]
[% ELSIF column == 'resolution' %]
[%- display_value("resolution", bug.$column) FILTER html %]
[% ELSE %]
[%- bug.$column FILTER html %]
[% END %]">
<span title="[%- display_value(column, bug.$column) FILTER html %]">
[% END %]
[% IF abbrev.$column.format_value %]
[%- bug.$column FILTER format(abbrev.$column.format_value) FILTER html -%]
......@@ -216,11 +209,6 @@
column == 'remaining_time' ||
column == 'estimated_time' %]
[% PROCESS formattimeunit time_unit=bug.$column %]
[% ELSIF column == 'bug_status' %]
[%- display_value("bug_status", bug.$column).truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html %]
[% ELSIF column == 'resolution' %]
[%- display_value("resolution", bug.$column).truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html %]
[%# Display the login name of the user if their real name is empty. %]
[% ELSIF column.match('_realname$') && bug.$column == '' %]
[% SET login_column = column.remove('_realname$') %]
......@@ -228,7 +216,7 @@
abbrev.$column.ellipsis) FILTER html %]
[% ELSE %]
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
[%- display_value(column, bug.$column).truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
[% END %]
[% IF abbrev.$column.maxlength %]
</span>
......
......@@ -78,8 +78,8 @@ no-one else appears to have reported it, then:</p>
it?
(e.g. Linux, Windows XP, Mac OS X.)<br>
If you know the [% terms.bug %] happens on more than one type of
operating system, choose "All".
If your OS isn't listed, choose Other.</p>
operating system, choose <em>[% display_value("op_sys", "All") FILTER html %]</em>.
If your OS isn't listed, choose <em>[% display_value("op_sys", "Other") FILTER html %]</em>.</p>
<p><b>Summary:</b> How would you describe the [% terms.bug %], in
approximately 60 or fewer characters?<br>
......
......@@ -19,7 +19,6 @@
# Gervase Markham <gerv@gerv.net>
#%]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS "global/field-descs.none.tmpl" %]
[% INCLUDE global/header.html.tmpl title = "A $terms.Bug's Life Cycle" %]
......@@ -221,46 +220,46 @@ This field describes the impact of [% terms.abug %].
<table>
<tr>
<th>Blocker</th>
<th>[% display_value("bug_severity", "blocker") FILTER html %]</th>
<td>Blocks development and/or testing work</td>
</tr>
<tr>
<th>Critical</th>
<th>[% display_value("bug_severity", "critical") FILTER html %]</th>
<td>crashes, loss of data, severe memory leak</td>
</tr>
<tr>
<th>Major</th>
<th>[% display_value("bug_severity", "major") FILTER html %]</th>
<td>major loss of function</td>
</tr>
<tr>
<th>Normal</th>
<th>[% display_value("bug_severity", "normal") FILTER html %]</th>
<td>regular issue, some loss of functionality under specific circumstances</td>
</tr>
<tr>
<th>Minor</th>
<th>[% display_value("bug_severity", "minor") FILTER html %]</th>
<td>minor loss of function, or other problem where easy
workaround is present</td>
</tr>
<tr>
<th>Trivial</th>
<th>[% display_value("bug_severity", "trivial") FILTER html %]</th>
<td>cosmetic problem like misspelled words or misaligned
text</td>
</tr>
<tr>
<th>Enhancement</th>
<th>[% display_value("bug_severity", "enhancement") FILTER html %]</th>
<td>Request for enhancement</td>
</table>
......@@ -270,23 +269,25 @@ This is the hardware platform against which the [% terms.bug %] was
reported. Legal platforms include:
<ul>
<li>All (happens on all platforms; cross-platform [% terms.bug %])</li>
<li>[% display_value("rep_platform", "All") FILTER html %] (happens on all platforms; cross-platform [% terms.bug %])</li>
<li>Macintosh</li>
<li>[% display_value("rep_platform", "Macintosh") FILTER html %]</li>
<li>PC</li>
<li>[% display_value("rep_platform", "PC") FILTER html %]</li>
</ul>
<b>Note:</b> When searching, selecting the option "All" does not
<b>Note:</b> When searching, selecting the option
<em>[% display_value("rep_platform", "All") FILTER html %]</em> does not
select [% terms.bugs %]
assigned against any platform. It merely selects [% terms.bugs %] that are
marked as occurring on all platforms, i.e. are designated "All".
marked as occurring on all platforms, i.e. are designated
<em>[% display_value("rep_platform", "All") FILTER html %]</em>.
<h2><a name="op_sys">Operating System</a></h2>
This is the operating system against which the [% terms.bug %] was
reported. Legal operating systems include:
<ul>
<li>All (happens on all operating systems; cross-platform
<li>[% display_value("op_sys", "All") FILTER html %] (happens on all operating systems; cross-platform
[% terms.bug %])</li>
<li>Windows</li>
......
......@@ -127,9 +127,9 @@
<td><center>[% bug.delta %]</center></td>
<td>[% bug.component FILTER html %]</td>
<td><center>[% bug.bug_severity FILTER html %]</center></td>
<td><center>[% bug.op_sys FILTER html %]</center></td>
<td><center>[% bug.target_milestone FILTER html %]</center></td>
<td><center>[% display_value("bug_severity", bug.bug_severity ) FILTER html %]</center></td>
<td><center>[% display_value("op_sys", bug.op_sys ) FILTER html %]</center></td>
<td><center>[% display_value("target_milestone", bug.target_milestone) FILTER html %]</center></td>
<td>[% bug.short_desc FILTER html %]</td>
</tr>
[% END %]
......
......@@ -26,28 +26,12 @@
[% col_field_disp = field_descs.$col_field || col_field %]
[% IF col_field == 'bug_status' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("bug_status", data.0.0.$i) %]
[% END %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value(col_field, data.0.0.$i) %]
[% END %]
[% IF col_field == 'resolution' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("resolution", data.0.0.$i) %]
[% END %]
[% END %]
[% IF row_field == 'bug_status' %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value("bug_status", row_names.$i) %]
[% END %]
[% END %]
[% IF row_field == 'resolution' %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value("resolution", row_names.$i) %]
[% END %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value(row_field, row_names.$i) %]
[% END %]
[% FILTER null;
......
......@@ -26,28 +26,12 @@
[% col_field_disp = field_descs.$col_field || col_field %]
[% IF col_field == 'bug_status' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("bug_status", data.0.0.$i) %]
[% END %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value(col_field, data.0.0.$i) %]
[% END %]
[% IF col_field == 'resolution' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("resolution", data.0.0.$i) %]
[% END %]
[% END %]
[% IF row_field == 'bug_status' %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value("bug_status", row_names.$i) %]
[% END %]
[% END %]
[% IF row_field == 'resolution' %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value("resolution", row_names.$i) %]
[% END %]
[% FOR i IN [ 0 .. row_names.max ] %]
[% row_names.$i = display_value(row_field, row_names.$i) %]
[% END %]
[% IF cumulate %]
......
......@@ -22,16 +22,8 @@
[% col_field_disp = field_descs.$col_field || col_field %]
[% IF col_field == 'bug_status' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("bug_status", data.0.0.$i) %]
[% END %]
[% END %]
[% IF col_field == 'resolution' %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value("resolution", data.0.0.$i) %]
[% END %]
[% FOR i IN [ 0 .. data.0.0.max ] %]
[% data.0.0.$i = display_value(col_field, data.0.0.$i) %]
[% END %]
[% FILTER null;
......
......@@ -67,12 +67,8 @@
[% END %]
[% BLOCK value_display %]
[% SET disp_value = value %]
[% IF field == 'bug_status' %]
[% SET disp_value = display_value("bug_status", value) %]
[% ELSIF field == 'resolution' %]
[% SET disp_value = display_value("resolution", value) %]
[% ELSIF field == 'assigned_to' OR field == 'reporter'
[% SET disp_value = display_value(field, value) %]
[% IF field == 'assigned_to' OR field == 'reporter'
OR field == 'qa_contact'
%]
[% disp_value = value FILTER email %]
......
......@@ -154,12 +154,8 @@
</table>
[% BLOCK value_display %]
[% SET disp_value = value %]
[% IF field == 'bug_status' %]
[% SET disp_value = display_value("bug_status", value) %]
[% ELSIF field == 'resolution' %]
[% SET disp_value = display_value("resolution", value) %]
[% ELSIF field == 'assigned_to' OR field == 'reporter'
[% SET disp_value = display_value(field, value) %]
[% IF field == 'assigned_to' OR field == 'reporter'
OR field == 'qa_contact'
%]
[% disp_value = value FILTER email %]
......
......@@ -617,19 +617,11 @@ function doOnSelectProduct(selectmode) {
[%# This only applies for Resolution really %]
<option value="[% value.name OR '---' FILTER html %]"
[% " selected" IF lsearch(default.${sel.name}, value.name) != -1 %]>
[% IF sel.name == "bug_status" %]
[% display_value("bug_status", value.name) FILTER html %]
[% ELSIF sel.name == "resolution" %]
[%# Again, resolution has that odd empty value. Replace it with '---' %]
[% display_value("resolution", value.name) OR '---' FILTER html %]
[% ELSE %]
[% value.name FILTER html %]
[% END %]
</option>
[% display_value(sel.name, value.name) FILTER html %]
[% ELSE %]
<option value="[% value OR '---' FILTER html %]"
[% " selected" IF lsearch(default.${sel.name}, value) != -1 %]>
[% value FILTER html %]
[% display_value(sel.name, value) FILTER html %]
</option>
[% END %]
[% END %]
......
......@@ -78,9 +78,9 @@
<tr>
<td align="left"><a href="[%+ 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">[% display_value("bug_severity", bug.bug_severity) FILTER html %]</td>
<td align="left">[% display_value("priority", bug.priority) FILTER html %]</td>
<td align="left">[% display_value("rep_platform", bug.rep_platform) FILTER html %]</td>
<td align="left">[% bug.$assignee_login_string FILTER html %]</td>
<td align="left">[% display_value("bug_status", bug.bug_status) FILTER html %]</td>
<td align="left">[% display_value("resolution", bug.resolution) FILTER html %]</td>
......
......@@ -53,9 +53,9 @@
[% FOREACH bug=query.bugs %]
[% terms.Bug +%] [%+ bug.bug_id %]:
[%+ urlbase %]show_bug.cgi?id=[% bug.bug_id +%]
Priority: [%+ bug.priority -%]
Severity: [%+ bug.bug_severity -%]
Platform: [%+ bug.rep_platform %]
Priority: [%+ display_value("priority", bug.priority) -%]
Severity: [%+ display_value("bug_severity", bug.bug_severity) -%]
Platform: [%+ display_value("rep_platform", bug.rep_platform) %]
Assignee: [%+ bug.$assignee_login_string %]
Status: [%+ display_value("bug_status", bug.bug_status) %]
[%- IF bug.resolution -%] Resolution: [% display_value("resolution", bug.resolution) -%]
......
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