331 lines
14 KiB
Cheetah
331 lines
14 KiB
Cheetah
[%# 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): Myk Melez <myk@mozilla.org>
|
|
# Max Kanat-Alexander <mkanat@bugzilla.org>
|
|
# Elliotte Martin <elliotte_martin@yahoo.com>
|
|
#%]
|
|
|
|
[%# INTERFACE:
|
|
# field: a Bugzilla::Field object
|
|
# value: The value of the field for this bug.
|
|
# value_name: (alternative) Value name, for select fields.
|
|
# override_legal_values: (optional)
|
|
# The list of legal values, for select fields.
|
|
# editable:
|
|
# Whether the field should be displayed as an editable
|
|
# <input> or as just the plain text of its value.
|
|
# allow_dont_change: display the --do_not_change-- option for select fields.
|
|
# value_span:
|
|
# A colspan for the table cell containing the field value.
|
|
# no_tds: boolean;
|
|
# If true, don't display the label <th> or the wrapping <td> for the field.
|
|
# use_divs: boolean;
|
|
# If true, display the wrapping label and the wrapping <div> for the field.
|
|
# custom_label: string;
|
|
# Label for this field. Default label is takes from the field description.
|
|
# desc_url: string;
|
|
# Normally the label of a non-custom field links to
|
|
# fields.html. If you want it to link elsewhere, specify the
|
|
# relative URL you want to link to, here. Remember to call
|
|
# url_quote on any query string arguments.
|
|
# bug: (optional)
|
|
# The current Bugzilla::Bug being displayed, or a hash
|
|
# with default field values being displayed on a page.
|
|
# tabindex: (optional) HTML tabindex.
|
|
#%]
|
|
|
|
[% IF editable || bug && bug.get_string(field.name) != '' %]
|
|
|
|
[% SET show_search_link = !no_search_link &&
|
|
bug.id && field.type != constants.FIELD_TYPE_BUG_ID_REV &&
|
|
field.type != constants.FIELD_TYPE_MULTI_SELECT &&
|
|
field.type != constants.FIELD_TYPE_TEXTAREA &&
|
|
field.type != constants.FIELD_TYPE_BUG_URLS %]
|
|
|
|
[% IF NOT no_tds %]
|
|
<th class="field_label" id="field_label_[% field.name | html %]">
|
|
[% END %]
|
|
[% IF use_divs %]
|
|
<div class="bug_field" id="field_container_[% field.name | html %]">
|
|
[% END %]
|
|
[% IF NOT no_tds OR use_divs %]
|
|
<label [% IF editable %]for="[% field.name | html %]"[% END %]>
|
|
[% IF desc_url %]
|
|
<a href="[% desc_url | html %]">
|
|
[% ELSIF !field.custom %]
|
|
<a href="page.cgi?id=fields.html#[% field.name | url_quote %]">
|
|
[% END -%]
|
|
[% custom_label || field_descs.${field.name} || field.description | html %]:
|
|
[%- '</a>' IF desc_url || !field.custom %]
|
|
</label>
|
|
[% END %]
|
|
[% IF use_divs %]
|
|
<br />
|
|
[% END %]
|
|
[% IF NOT no_tds %]
|
|
</th>
|
|
<td class="field_value" id="field_container_[% field.name | html %]"
|
|
[% " colspan=\"$value_span\"" | none IF value_span %]>
|
|
[% END %]
|
|
[% IF NOT editable AND show_search_link %]
|
|
[% PROCESS search_link %]
|
|
[% END %]
|
|
[% IF editable %]
|
|
|
|
[% IF show_search_link %]
|
|
<table width="98%"><tr><td width="100%">
|
|
[% END %]
|
|
|
|
[% SWITCH field.type %]
|
|
[% CASE constants.FIELD_TYPE_FREETEXT %]
|
|
<input id="[% field.name | html %]" class="text_input"
|
|
name="[% field.name | html %]"
|
|
value="[% value | html %]" size="40"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
maxlength="[% constants.MAX_FREETEXT_LENGTH | none %]" />
|
|
[% CASE constants.FIELD_TYPE_NUMERIC %]
|
|
<input id="[% field.name | html %]" class="numeric_input"
|
|
name="[% field.name | html %]"
|
|
value="[% value | html %]" size="14"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
maxlength="[% constants.MAX_NUMERIC_LENGTH | none %]"
|
|
onchange="this.className = 'numeric_input' + (isNaN(this.value) ? ' numeric_invalid' : '');"
|
|
onkeyup="this.className = 'numeric_input' + (isNaN(this.value) ? ' numeric_invalid' : '');" />
|
|
[% CASE constants.FIELD_TYPE_DATETIME %]
|
|
<input name="[% field.name | html %]" size="20"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
id="[% field.name | html %]"
|
|
value="[% value | html %]" />
|
|
|
|
<script type="text/javascript">
|
|
Calendar.set('[% field.name | js %]')
|
|
</script>
|
|
[% CASE constants.FIELD_TYPE_BUG_ID %]
|
|
<span id="[% field.name | html %]_input_area">
|
|
<input name="[% field.name | html %]" id="[% field.name | html %]"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
value="[% value | html %]" size="7" />
|
|
</span>
|
|
|
|
[%# Do not hide input on bug creation form %]
|
|
[% IF bug.id %]
|
|
[% IF bug.${field.name} %]
|
|
[% bug.${field.name} | bug_link(bug.${field.name}) | none %]
|
|
[% END %]
|
|
<span id="[% field.name | html %]_edit_container" class="edit_me bz_default_hidden">
|
|
(<a href="#" id="[% field.name | html %]_edit_action" [% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]>edit</a>)
|
|
</span>
|
|
<script type="text/javascript">
|
|
hideEditableField(
|
|
'[% field.name | js %]_edit_container',
|
|
'[% field.name | js %]_input_area',
|
|
'[% field.name | js %]_edit_action',
|
|
'[% field.name | js %]',
|
|
"[% bug.${field.name} | js %]"
|
|
);
|
|
</script>
|
|
[% END %]
|
|
[% CASE constants.FIELD_TYPE_EXTURL %]
|
|
<span id="[% field.name | html %]_input_area">
|
|
<input name="[% field.name | html %]" id="[% field.name | html %]"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
value="[% value | html %]" size="30" />
|
|
</span>
|
|
|
|
[% IF bug.${field.name} %]
|
|
[% SET url_quoted = bug.${field.name} | url_quote_ns %]
|
|
<a href="[% field.url.replace('\$1', url_quoted) %]">[% bug.${field.name} | html %]</a>
|
|
[% END %]
|
|
<span id="[% field.name | html %]_edit_container" class="edit_me bz_default_hidden">
|
|
(<a href="#" id="[% field.name | html %]_edit_action" [% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]>edit</a>)
|
|
</span>
|
|
<script type="text/javascript">
|
|
hideEditableField(
|
|
'[% field.name | js %]_edit_container',
|
|
'[% field.name | js %]_input_area',
|
|
'[% field.name | js %]_edit_action',
|
|
'[% field.name | js %]',
|
|
"[% bug.${field.name} | js %]"
|
|
);
|
|
</script>
|
|
[% CASE [ constants.FIELD_TYPE_SINGLE_SELECT, constants.FIELD_TYPE_MULTI_SELECT ] %]
|
|
[% IF field.use_combobox %]
|
|
[% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
|
|
[% FOREACH v = bug.get_object(field.name) %]
|
|
<input type="hidden" id="v[% v.id | html %]_[% field.name | html %]"
|
|
name="[% field.name | html %]" value="[% v.name | html %]" />
|
|
[% END %]
|
|
[% END %]
|
|
<input id="[% field.name | html %]" data-ids="[% bug.get_ids(field.name).join(',') | html %]"
|
|
[% IF field.type == constants.FIELD_TYPE_SINGLE_SELECT %] name="[% field.name | html %]"[% END %]
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
size="40" value="[% bug.get_string(field.name) | html %]"
|
|
style="border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-width: 0; z-index: 10"
|
|
onfocus="this.nextSibling.className='combo_btn combo_active'" onblur="this.nextSibling.className='combo_btn'"
|
|
/><span class="combo_btn" onclick="this.previousSibling.focus()">▾</span>
|
|
[% ELSE %]
|
|
<select id="[% field.name | html %]"
|
|
[% IF style %] style="[% style | html %]"[% END %]
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
name="[% field.name | html %]"
|
|
[% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
|
|
[% SET field_size = 5 %]
|
|
[% IF field.legal_values.size < 5 %]
|
|
[% SET field_size = field.legal_values.size %]
|
|
[% END %]
|
|
size="[% field_size | html %]" multiple="multiple"
|
|
[% END %]>
|
|
[% IF allow_dont_change %]
|
|
<option value="[% dontchange | html %]" [% ' selected="selected"' IF value == dontchange %]>
|
|
[% dontchange | html %]
|
|
</option>
|
|
[% END %]
|
|
[% IF field.type == constants.FIELD_TYPE_SINGLE_SELECT && field.check_is_nullable(bug) %]
|
|
<option value="">---</option>
|
|
[% END %]
|
|
[% IF override_legal_values %]
|
|
[% legal_values = override_legal_values %]
|
|
[% ELSIF field.value_field AND field.name != 'product' %]
|
|
[% legal_values = field.restricted_legal_values(bug.get_ids(field.value_field.name)) %]
|
|
[% ELSE %]
|
|
[% legal_values = field.legal_values %]
|
|
[% END %]
|
|
[% value_found = allow_dont_change AND value == dontchange %]
|
|
[% FOREACH legal_value = legal_values %]
|
|
<option value="[% legal_value.name | html %]" id="v[% legal_value.id | html %]_[% field.name | html %]"
|
|
[% IF value.contains(legal_value.id).size || value_name.defined && value_name.contains(legal_value.name).size %]
|
|
selected="selected"
|
|
[% value_found = 1 %]
|
|
[% END %]>
|
|
[%- legal_value.name | html ~%]
|
|
</option>
|
|
[% END %]
|
|
[% IF NOT value_found %]
|
|
[% IF bug.id %]
|
|
[% value = bug.get_object(field.name) %]
|
|
[% IF value %]
|
|
[% FOR v = value %]
|
|
<option selected="selected" value="[% v.name | html %]" id="v[% v.id | html %]_[% field.name | html %]">[% v.name | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[%# Possible only on the entry form %]
|
|
<option selected="selected" value="[% value_name | html %]">[% value_name | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
[%# When you pass an empty multi-select in the web interface,
|
|
# it doesn't appear at all in the CGI object. Instead of
|
|
# forcing all users of process_bug to always specify every
|
|
# multi-select, we have this field defined if the multi-select
|
|
# field is defined, and then if this is passed but the multi-select
|
|
# isn't, we know that the multi-select was emptied.
|
|
%]
|
|
[% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
|
|
<input type="hidden" name="defined_[% field.name | html %]" />
|
|
[% END %]
|
|
[% END %]
|
|
[% CASE constants.FIELD_TYPE_TEXTAREA %]
|
|
[% INCLUDE global/textarea.html.tmpl
|
|
id = field.name
|
|
name = field.name
|
|
minrows = 4
|
|
maxrows = 8
|
|
cols = 30
|
|
defaultcontent = value
|
|
tabindex = tabindex %]
|
|
[% CASE constants.FIELD_TYPE_BUG_URLS %]
|
|
[% '<ul class="bug_urls">' IF value.size %]
|
|
[% FOREACH url = value %]
|
|
<li>
|
|
<a href="[% url | html %]">[% url | html %]</a>
|
|
[% IF editable %]
|
|
<label><input type="checkbox" value="[% url | html %]"
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
name="remove_[% field.name | html %]" />Remove</label>
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
[% '</ul>' IF value.size %]
|
|
|
|
[% IF editable && Bugzilla.get_field('see_also').enabled %]
|
|
<label for="[% field.name | html %]">Add [% terms.Bug %] URLs:</label><br />
|
|
<input type="text" id="[% field.name | html %]" size="40"
|
|
[% IF tabindex %] tabindex="[% tabindex | html %]"[% END %]
|
|
class="text_input" name="[% field.name | html %]" />
|
|
[% END %]
|
|
[% CASE constants.FIELD_TYPE_BUG_ID_REV %]
|
|
[% FOREACH b = bug.${field.name} %]
|
|
[% ", " IF !loop.first %][% b | bug_link(b) | none %]
|
|
[% END %]
|
|
[% IF !bug.${field.name}.size %]
|
|
None
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[%# CustIS Bug 129375 - Add search link for some fields %]
|
|
[% IF show_search_link %]
|
|
</td><td style="padding-left: 5px">[% PROCESS search_link %](search)</a></td></tr></table>
|
|
[% END %]
|
|
[% ELSIF field.type == constants.FIELD_TYPE_TEXTAREA %]
|
|
<div class="uneditable_textarea">[% value | html | wrap_comment %]</div>
|
|
[% ELSIF field.type == constants.FIELD_TYPE_BUG_ID %]
|
|
[% IF bug.${field.name} %]
|
|
[% bug.${field.name} | bug_link(bug.${field.name}) | none %]
|
|
[% END %]
|
|
[% ELSIF field.type == constants.FIELD_TYPE_SINGLE_SELECT %]
|
|
[% IF value_name %]
|
|
[% value_name | html %]
|
|
[% ELSE %]
|
|
[% f = field.name _ '_obj' %]
|
|
[% bug.$f.name | html %]
|
|
[% END %]
|
|
[% ELSIF field.type == constants.FIELD_TYPE_MULTI_SELECT || field.type == constants.FIELD_TYPE_BUG_ID_REV %]
|
|
[% bug.get_string(field.name) | html %]
|
|
[% ELSE %]
|
|
[% value.join(', ') | html %]
|
|
[% END %]
|
|
[% IF NOT editable AND show_search_link %]
|
|
</a>
|
|
[% END %]
|
|
[% '</td>' IF NOT no_tds %]
|
|
[% '</div>' IF use_divs %]
|
|
[% END %]
|
|
|
|
[% BLOCK search_link %]
|
|
<a href="buglist.cgi?query_format=advanced&product=[% bug.product | uri %]
|
|
[%- IF field.name != 'product' %]&
|
|
[%- IF field.type == constants.FIELD_TYPE_DATETIME -%]
|
|
type0-1-0=greaterthaneq&field0-1-0=[% field.name %]&field0-0-0=[% field.name %]&value0-1-0=[% bug.${field.name}.substr(0,10) | uri -%]
|
|
+00%3A00%3A00&type0-0-0=lessthaneq&value0-0-0=[% bug.${field.name}.substr(0,10) | uri %]+23%3A59%3A59
|
|
[%- ELSIF field.type == constants.FIELD_TYPE_BUG_ID_REV -%]
|
|
[%- field.name %]=[% bug.${field.name}.join(' ') | uri -%]
|
|
[%- ELSIF field.type == constants.FIELD_TYPE_SINGLE_SELECT -%]
|
|
[%- field.name %]=[% bug.get_object(field.name).name | uri -%]
|
|
[%- ELSE -%]
|
|
[%- field.name %]=[% bug.${field.name} | uri -%]
|
|
[%- END -%]
|
|
[%- END -%]" target="_blank" id="search_link_[% field.name %]" class="search-link">
|
|
[% END %]
|