summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorJesse Clark <jjclark1982@gmail.com>2010-02-08 01:10:03 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-08 01:10:03 +0100
commitd73a83506def7c6b43e5ad720777ec700f6af2e8 (patch)
treeee858870f5355c6551ee18546a82269df2602592 /template
parent463c56db162f0b6e13a87c2499557f8dba7b9644 (diff)
downloadbugzilla-d73a83506def7c6b43e5ad720777ec700f6af2e8.tar.gz
bugzilla-d73a83506def7c6b43e5ad720777ec700f6af2e8.tar.xz
Bug 251556: Allow "Bug ID" fields to have one-way mutual relationships (like blocks/dependson)
r=mkanat, a=mkanat
Diffstat (limited to 'template')
-rw-r--r--template/en/default/admin/custom_fields/cf-js.js.tmpl10
-rw-r--r--template/en/default/admin/custom_fields/create.html.tmpl37
-rw-r--r--template/en/default/admin/custom_fields/edit.html.tmpl36
-rw-r--r--template/en/default/bug/edit.html.tmpl8
-rw-r--r--template/en/default/bug/field.html.tmpl23
-rw-r--r--template/en/default/bug/show-multiple.html.tmpl7
-rw-r--r--template/en/default/global/user-error.html.tmpl6
7 files changed, 102 insertions, 25 deletions
diff --git a/template/en/default/admin/custom_fields/cf-js.js.tmpl b/template/en/default/admin/custom_fields/cf-js.js.tmpl
index 778dd3373..4c95a1690 100644
--- a/template/en/default/admin/custom_fields/cf-js.js.tmpl
+++ b/template/en/default/admin/custom_fields/cf-js.js.tmpl
@@ -50,6 +50,16 @@ function onChangeType(type_field) {
else {
value_field.disabled = true;
}
+
+ var reverse_desc = document.getElementById('reverse_desc');
+ if (type_field.value == [% constants.FIELD_TYPE_BUG_ID %])
+ {
+ reverse_desc.disabled = false;
+ }
+ else {
+ reverse_desc.disabled = true;
+ reverse_desc.value = '';
+ }
}
function onChangeVisibilityField() {
diff --git a/template/en/default/admin/custom_fields/create.html.tmpl b/template/en/default/admin/custom_fields/create.html.tmpl
index a2db4708b..d23be0fe2 100644
--- a/template/en/default/admin/custom_fields/create.html.tmpl
+++ b/template/en/default/admin/custom_fields/create.html.tmpl
@@ -28,8 +28,14 @@
onload = "document.getElementById('new_bugmail').disabled = true;"
javascript_urls = [ 'js/util.js' ]
doc_section = "custom-fields.html#add-custom-fields"
+ style_urls = ['skins/standard/admin.css']
%]
+[%# set initial editability of fields such as Reverse Relationship Description %]
+<script type="text/javascript">
+YAHOO.util.Event.onDOMReady(function() {onChangeType(document.getElementById('type'))});
+</script>
+
<p>
Adding custom fields can make the interface of [% terms.Bugzilla %] very
complicated. Many admins who are new to [% terms.Bugzilla %] start off
@@ -48,14 +54,14 @@
</ul>
<form id="add_field" action="editfields.cgi" method="GET">
- <table border="0" cellspacing="0" cellpadding="5">
+ <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
<tr>
- <th align="right"><label for="name">Name:</label></th>
+ <th class="narrow_label"><label for="name">Name:</label></th>
<td>
<input type="text" id="name" name="name" value="cf_" size="40" maxlength="64">
</td>
- <th align="right">
+ <th>
<label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
</th>
<td>
@@ -64,16 +70,16 @@
</td>
</tr>
<tr>
- <th align="right"><label for="desc">Description:</label></th>
+ <th class="narrow_label"><label for="desc">Description:</label></th>
<td><input type="text" id="desc" name="desc" value="" size="40"></td>
- <th align="right">
+ <th>
<label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
</th>
<td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"></td>
</tr>
<tr>
- <th align="right"><label for="type">Type:</label></th>
+ <th class="narrow_label"><label for="type">Type:</label></th>
<td>
<select id="type" name="type" onchange="onChangeType(this)">
[% FOREACH type = field_types.keys %]
@@ -83,16 +89,16 @@
</select>
</td>
- <th align="right"><label for="obsolete">Is obsolete:</label></th>
+ <th><label for="obsolete">Is obsolete:</label></th>
<td><input type="checkbox" id="obsolete" name="obsolete" value="1"></td>
</tr>
<tr>
- <th align="right"><label for="sortkey">Sortkey:</label></th>
+ <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
<td>
<input type="text" id="sortkey" name="sortkey" size="6" maxlength="6">
</td>
- <th align="right">
+ <th>
<label for="visibility_field_id">Field only appears when:</label>
</th>
<td>
@@ -114,7 +120,18 @@
</tr>
<tr>
- <td colspan="2">&nbsp;</td>
+ <th class="narrow_label">
+ <label for="reverse_desc">Reverse Relationship Description:</label>
+ </th>
+ <td>
+ <input type="text" id="reverse_desc" name="reverse_desc" value="" size="40" disabled="disabled">
+ <br/>
+ Use this label for the list of [% terms.bugs %] that link to a [% terms.bug %]
+ with this [% field_types.${constants.FIELD_TYPE_BUG_ID} %] field.
+ For example, if the description is "Is a duplicate of",
+ the reverse description would be "Duplicates of this [% terms.bug %]".
+ Leave blank to disable the list for this field.
+ </td>
<th>
<label for="value_field_id">
Field that controls the values<br>
diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl
index 981668260..01a8dcccb 100644
--- a/template/en/default/admin/custom_fields/edit.html.tmpl
+++ b/template/en/default/admin/custom_fields/edit.html.tmpl
@@ -32,6 +32,7 @@
onload = "toggleCheckbox(document.getElementById('enter_bug'), 'new_bugmail');"
javascript_urls = [ 'js/util.js' ]
doc_section = "custom-fields.html#edit-custom-fields"
+ style_urls = ['skins/standard/admin.css']
%]
<p>
@@ -40,12 +41,12 @@
</p>
<form id="edit_field" action="editfields.cgi" method="GET">
- <table border="0" cellspacing="0" cellpadding="5">
+ <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
<tr>
- <th align="right">Name:</th>
+ <th class="narrow_label">Name:</th>
<td>[% field.name FILTER html %]</td>
- <th align="right">
+ <th>
<label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
</th>
<td><input type="checkbox" id="enter_bug" name="enter_bug" value="1"
@@ -53,31 +54,31 @@
onchange="toggleCheckbox(this, 'new_bugmail');"></td>
</tr>
<tr>
- <th align="right"><label for="desc">Description:</label></th>
+ <th class="narrow_label"><label for="desc">Description:</label></th>
<td><input type="text" id="desc" name="desc" size="40"
value="[% field.description FILTER html %]"></td>
- <th align="right">
+ <th>
<label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
</th>
<td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"
[%- " checked" IF field.mailhead %]></td>
</tr>
<tr>
- <th align="right">Type:</th>
+ <th class="narrow_label">Type:</th>
<td>[% field_types.${field.type} FILTER html %]</td>
- <th align="right"><label for="obsolete">Is obsolete:</label></th>
+ <th><label for="obsolete">Is obsolete:</label></th>
<td><input type="checkbox" id="obsolete" name="obsolete" value="1"
[%- " checked" IF field.obsolete %]></td>
</tr>
<tr>
- <th align="right"><label for="sortkey">Sortkey:</label></th>
+ <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
<td>
<input type="text" id="sortkey" name="sortkey" size="6" maxlength="6"
value="[% field.sortkey FILTER html %]">
</td>
- <th align="right">
+ <th>
<label for="visibility_field_id">Field only appears when:</label>
</th>
<td>
@@ -140,6 +141,23 @@
</td>
</tr>
[% END %]
+ [% IF field.type == constants.FIELD_TYPE_BUG_ID %]
+ <tr>
+ <th class="narrow_label">
+ <label for="reverse_desc">Reverse Relationship Description:</label>
+ </th>
+ <td>
+ <input type="text" id="reverse_desc" name="reverse_desc" size="40"
+ value="[% field.reverse_desc FILTER html %]">
+ <br/>
+ Use this label for the list of [% terms.bugs %] that link to a [% terms.bug %]
+ with this [% field_types.${constants.FIELD_TYPE_BUG_ID} %] field.
+ For example, if the description is "Is a duplicate of",
+ the reverse description would be "Duplicates of this [% terms.bug %]".
+ Leave blank to disable the list for this field.
+ </td>
+ </tr>
+ [% END %]
</table>
<br>
<input type="hidden" name="action" value="update">
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 63b81d733..1a35df916 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -888,10 +888,16 @@
[% USE Bugzilla %]
[% FOREACH field = Bugzilla.active_custom_fields %]
<tr>
- [% PROCESS bug/field.html.tmpl value=bug.${field.name}
+ [% PROCESS bug/field.html.tmpl value = bug.${field.name}
editable = bug.check_can_change_field(field.name, 0, 1)
value_span = 2 %]
</tr>
+ [% IF extra_field_item %]
+ <tr>
+ <th class="field_label">[% extra_field_item.header FILTER none %]</th>
+ <td>[% extra_field_item.data FILTER none %]</td>
+ </tr>
+ [% END %]
[% END %]
[% END %]
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index ac62bf7ba..482f88219 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -99,8 +99,8 @@
value="[% value FILTER html %]" size="7">
</span>
- [% IF bug.${field.name} %]
- [% bug.${field.name} FILTER bug_link(bug.${field.name}) FILTER none %]
+ [% IF value %]
+ [% value FILTER bug_link(value, use_alias => 1) FILTER none %]
[% END %]
<span id="[% field.name FILTER html %]_edit_container" class="edit_me bz_default_hidden">
(<a href="#" id="[% field.name FILTER html %]_edit_action">edit</a>)
@@ -110,7 +110,7 @@
'[% field.name FILTER js %]_input_area',
'[% field.name FILTER js %]_edit_action',
'[% field.name FILTER js %]',
- "[% bug.${field.name} FILTER js %]");
+ "[% value FILTER js %]");
</script>
[% CASE [ constants.FIELD_TYPE_SINGLE_SELECT
constants.FIELD_TYPE_MULTI_SELECT ] %]
@@ -198,11 +198,24 @@
<div class="uneditable_textarea">[% value FILTER wrap_comment(60)
FILTER html %]</div>
[% ELSIF field.type == constants.FIELD_TYPE_BUG_ID %]
- [% IF bug.${field.name} %]
- [% bug.${field.name} FILTER bug_link(bug.${field.name}) FILTER none %]
+ [% IF value %]
+ [% value FILTER bug_link(value, use_alias => 1) FILTER none %]
[% END %]
[% ELSE %]
[% value.join(', ') FILTER html %]
[% END %]
[% Hook.process('end_field_column') %]
[% '</td>' IF NOT no_tds %]
+
+[%# for reverse relationships, we show this pseudo-field after the main field %]
+[% IF bug.id && field.is_relationship %]
+ [% extra_field_item = {} %]
+ [% extra_field_item.header = field.reverse_desc _ ":" FILTER html %]
+ [% extra_field_item.data = BLOCK %]
+ [% FOREACH depbug = bug.related_bugs(field) %]
+ [% depbug.id FILTER bug_link(depbug, use_alias => 1) FILTER none %][% " " %]
+ [% END %]
+ [% END %]
+[% ELSE %]
+ [% extra_field_item = '' %]
+[% END %]
diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl
index 177bea14f..0949ffc20 100644
--- a/template/en/default/bug/show-multiple.html.tmpl
+++ b/template/en/default/bug/show-multiple.html.tmpl
@@ -186,6 +186,13 @@
[% PROCESS bug/field.html.tmpl value=bug.${field.name} editable=0 %]
[%# Even-numbered fields get a closing <tr> %]
[% '</tr>' IF !(field_counter % 2) %]
+ [% IF extra_field_item %]
+ [% field_counter = field_counter + 1 %]
+ [% '<tr>' IF field_counter % 2 %]
+ <th>[% extra_field_item.header FILTER none %]</th>
+ <td>[% extra_field_item.data FILTER none %]</td>
+ [% '</tr>' IF !(field_counter % 2) %]
+ [% END %]
[% END %]
[%# And we have to finish the row if we ended on an odd number. %]
[% '<th></th><td></td></tr>' IF field_counter % 2 %]
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index eca7ef058..bdedc4172 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1450,6 +1450,12 @@
To file this [% terms.bug %], you must first choose a component.
If necessary, just guess.
+ [% ELSIF error == "relationship_loop_single" %]
+ [% title = "Relationship Loop Detected" %]
+ [% field_descs.$field_name FILTER html %]
+ for [% terms.bug %] [%+ bug_id FILTER html %]
+ has a circular dependency on [% terms.bug %] [%+ dep_id FILTER html %].
+
[% ELSIF error == "require_new_password" %]
[% title = "New Password Needed" %]
You cannot change your password without choosing a new one.