From 2a3c2708fd1f55bd06d0b48a132d487a1745c075 Mon Sep 17 00:00:00 2001 From: "jkeiser%netscape.com" <> Date: Thu, 31 Jul 2003 03:04:48 +0000 Subject: Patch Viewer, a pretty way of viewing and manipulating patches (bug 174942). Requires PatchIterator to be installed, classes uploaded to that bug and will be soon in CPAN. --- template/en/default/attachment/diff-file.html.tmpl | 129 +++++++++ .../en/default/attachment/diff-footer.html.tmpl | 33 +++ .../en/default/attachment/diff-header.html.tmpl | 307 +++++++++++++++++++++ template/en/default/attachment/edit.html.tmpl | 107 +++++-- template/en/default/attachment/list.html.tmpl | 8 +- template/en/default/filterexceptions.pl | 35 ++- template/en/default/global/user-error.html.tmpl | 17 ++ 7 files changed, 590 insertions(+), 46 deletions(-) create mode 100644 template/en/default/attachment/diff-file.html.tmpl create mode 100644 template/en/default/attachment/diff-footer.html.tmpl create mode 100644 template/en/default/attachment/diff-header.html.tmpl (limited to 'template') diff --git a/template/en/default/attachment/diff-file.html.tmpl b/template/en/default/attachment/diff-file.html.tmpl new file mode 100644 index 000000000..51072269d --- /dev/null +++ b/template/en/default/attachment/diff-file.html.tmpl @@ -0,0 +1,129 @@ + +[%# 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): John Keiser + #%] + +[%# This line is really long for a reason: to get rid of any possible textnodes + # between the elements. This is necessary because DOM parent-child-sibling + # relations can change and screw up the javascript for restoring, collapsing + # and expanding. Do not change without testing all three of those. + #%] + + + +[% section_num = 0 %] +[% FOREACH section = sections %] + [% section_num = section_num + 1 %] + + [% FOREACH group = section.groups %] + [% IF group.context %] + [% FOREACH line = group.context %] + + [% END %] + [% END %] + [% IF group.plus.size %] + [% IF group.minus.size %] + [% i = 0 %] + [% WHILE (i < group.plus.size || i < group.minus.size) %] + [% currentloop = 0 %] + [% WHILE currentloop < 500 && (i < group.plus.size || i < group.minus.size) %] + + + + + [% currentloop = currentloop + 1 %] + [% i = i + 1 %] + [% END %] + [% END %] + [% ELSE %] + [% FOREACH line = group.plus %] + [% IF file.is_add %] + + + + [% ELSE %] + + + + + [% END %] + [% END %] + [% END %] + [% ELSE %] + [% IF group.minus.size %] + [% FOREACH line = group.minus %] + [% IF file.is_remove %] + + + + [% ELSE %] + + + + + [% END %] + [% END %] + [% END %] + [% END %] + [% END %] +[% END %] + +
[% collapsed ? '(+)' : '(-)' %] + [% IF lxr_prefix && !file.is_add %] + [% file.filename FILTER html %] + [% ELSE %] + [% file.filename FILTER html %] + [% END %] + [% IF file.plus_lines %] + [% IF file.minus_lines %] + (-[% file.minus_lines %] / +[% file.plus_lines %] lines) + [% ELSE %] + (+[% file.plus_lines %] lines) + [% END %] + [% ELSE %] + [% IF file.minus_lines %] + (-[% file.minus_lines %] lines) + [% END %] + [% END %] +
diff --git a/template/en/default/attachment/diff-footer.html.tmpl b/template/en/default/attachment/diff-footer.html.tmpl new file mode 100644 index 000000000..4eb94aca2 --- /dev/null +++ b/template/en/default/attachment/diff-footer.html.tmpl @@ -0,0 +1,33 @@ + +[%# 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): John Keiser + #%] + + + +[% IF headers %] + +
+ + [% PROCESS global/footer.html.tmpl %] + +[% ELSE %] + + +[% END %] diff --git a/template/en/default/attachment/diff-header.html.tmpl b/template/en/default/attachment/diff-header.html.tmpl new file mode 100644 index 000000000..c1b70173e --- /dev/null +++ b/template/en/default/attachment/diff-header.html.tmpl @@ -0,0 +1,307 @@ + +[%# 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): John Keiser + #%] + +[%# Define strings that will serve as the title and header of this page %] + +[% title = BLOCK %]Attachment #[% attachid %] for Bug #[% bugid %][% END %] + +[% style = BLOCK %] +.file_head { + font-size: x-large; + font-weight: bold; + background-color: #d3d3d3; + border: 1px solid black; + width: 100%; +} +.file_collapse { + display: none; +} +.section_head { + width: 100%; + font-weight: bold; + background-color: #d3d3d3; + border: 1px solid black; + text-align: left; +} +table.file_table { + table-layout: fixed; + width: 100%; + empty-cells: show; + border-spacing: 0px; + border-collapse: collapse; +} +tbody.file td { + border-left: 1px dashed black; + border-right: 1px dashed black; + width: 50%; +} +tbody.file pre { + display: inline; + white-space: -moz-pre-wrap; + font-size: 0.9em; +} +tbody.file pre:empty { + display: block; + height: 1em; +} +.changed { + background-color: lightblue; +} +.added { + background-color: lightgreen; +} +.removed { + background-color: #FFCC99; +} +.warning { + color: red +} +[% END %] + +[%# SCRIPT FUNCTIONS %] +[% javascript = BLOCK %] + function collapse_all() { + var elem = document.checkboxform.firstChild; + while (elem != null) { + if (elem.firstChild != null) { + var tbody = elem.firstChild.nextSibling; + if (tbody.className == 'file') { + tbody.className = 'file_collapse'; + twisty = get_twisty_from_tbody(tbody); + twisty.firstChild.nodeValue = '(+)'; + twisty.nextSibling.checked = false; + } + } + elem = elem.nextSibling; + } + return false; + } + + function expand_all() { + var elem = document.checkboxform.firstChild; + while (elem != null) { + if (elem.firstChild != null) { + var tbody = elem.firstChild.nextSibling; + if (tbody.className == 'file_collapse') { + tbody.className = 'file'; + twisty = get_twisty_from_tbody(tbody); + twisty.firstChild.nodeValue = '(-)'; + twisty.nextSibling.checked = true; + } + } + elem = elem.nextSibling; + } + return false; + } + + var current_restore_elem; + + function restore_all() { + current_restore_elem = null; + incremental_restore(); + } + + function incremental_restore() { + if (!document.checkboxform.restore_indicator.checked) { + return; + } + var next_restore_elem; + if (current_restore_elem) { + next_restore_elem = current_restore_elem.nextSibling; + } else { + next_restore_elem = document.checkboxform.firstChild; + } + while (next_restore_elem != null) { + current_restore_elem = next_restore_elem; + if (current_restore_elem.firstChild != null) { + restore_elem(current_restore_elem.firstChild.nextSibling); + } + next_restore_elem = current_restore_elem.nextSibling; + } + } + + function restore_elem(elem, alertme) { + if (elem.className == 'file_collapse') { + twisty = get_twisty_from_tbody(elem); + if (twisty.nextSibling.checked) { + elem.className = 'file'; + twisty.firstChild.nodeValue = '(-)'; + } + } else if (elem.className == 'file') { + twisty = get_twisty_from_tbody(elem); + if (!twisty.nextSibling.checked) { + elem.className = 'file_collapse'; + twisty.firstChild.nodeValue = '(+)'; + } + } + } + + function twisty_click(twisty) { + tbody = get_tbody_from_twisty(twisty); + if (tbody.className == 'file') { + tbody.className = 'file_collapse'; + twisty.firstChild.nodeValue = '(+)'; + twisty.nextSibling.checked = false; + } else { + tbody.className = 'file'; + twisty.firstChild.nodeValue = '(-)'; + twisty.nextSibling.checked = true; + } + return false; + } + + function get_tbody_from_twisty(twisty) { + return twisty.parentNode.parentNode.parentNode.nextSibling; + } + function get_twisty_from_tbody(tbody) { + return tbody.previousSibling.firstChild.firstChild.firstChild; + } +[% END %] + +[% onload = 'restore_all(); document.checkboxform.restore_indicator.checked = true' %] + +[% IF headers %] + [% h1 = BLOCK %] + [% IF attachid %] + [% description FILTER html %] (#[% attachid %]) + [% ELSE %] + [% old_url = url('attachment.cgi', action = 'diff', id = oldid) %] + [% new_url = url('attachment.cgi', action = 'diff', id = newid) %] + Diff Between + [% old_desc FILTER html %] + (#[% oldid %]) + and + [% new_desc FILTER html %] + (#[% newid %]) + [% END %] + for Bug #[% bugid %] + [% END %] + [% h2 = BLOCK %] + [% bugsummary FILTER html %] + [% END %] + [% PROCESS global/header.html.tmpl %] +[% ELSE %] + + + + + + +[% END %] + +[%# If we have attachid, we are in diff, otherwise we're in interdiff %] +[% IF attachid %] + [%# HEADER %] + [% IF headers %] + [% USE url('attachment.cgi', id = attachid) %] + View + | Edit + [% USE url('attachment.cgi', id = attachid, context = context, + collapsed = collapsed, headers = headers, + action = 'diff') %] + | Raw Unified + [% END %] + [% IF other_patches %] + [% IF headers %] |[%END%] + Differences between +
+ + and this patch + + + + +
+ [% END %] +
+[% ELSE %] + [% IF headers %] + [% USE url('attachment.cgi', newid = newid, oldid = oldid, action = 'interdiff') %] + Raw Unified + [% IF attachid %] +
+ [% ELSE %] + | + [% END %] + [% END %] +[% END %] + +[%# Collapse / Expand %] +Collapse All | +Expand All + +[% IF do_context %] + | Context: + [% IF context == "patch" %] + (Patch / + [% ELSE %] + (Patch / + [% END %] + [% IF context == "file" %] + File / + [% ELSE %] + File / + [% END %] + + [% IF context == "patch" || context == "file" %] + [% context = 3 %] + [% END %] + [%# textbox for context %] +
) +[% END %] + +[% IF warning %] +

Warning: + [% IF warning == "interdiff1" %] + this difference between two patches may show things in the wrong places due + to a limitation in Bugzilla when comparing patches with different sets of + files. + [% END %] + [% IF warning == "interdiff2" %] + this difference between two patches may be inaccurate due to a limitation in + Bugzilla when comparing patches made against different revisions. + [% END %] +

+[% END %] + +[%# Restore Stuff %] +
+ + + diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index 14c2dc1fe..2cfc0e088 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -42,6 +42,10 @@ diff --git a/template/en/default/attachment/list.html.tmpl b/template/en/default/attachment/list.html.tmpl index fc5852923..598f8172b 100644 --- a/template/en/default/attachment/list.html.tmpl +++ b/template/en/default/attachment/list.html.tmpl @@ -69,8 +69,12 @@ [% IF attachment.canedit %] Edit - [% ELSE %] - None + [% END %] + [% IF attachment.ispatch %] + [% IF attachment.canedit %] + | + [% END %] + Diff [% END %] diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index ba626a21b..60590d4a4 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -105,7 +105,6 @@ 'reports/components.html.tmpl' => [ 'numcols', - 'numcols - 1', 'comp.description', 'comp.initialowner', # email address 'comp.initialqacontact', # email address @@ -181,10 +180,6 @@ 'other_format.name', 'other_format.description', # 'sizeurl', - 'height + 100', - 'height - 100', - 'width + 100', - 'width - 100', 'switchbase', 'format', 'cumulate', @@ -257,7 +252,6 @@ 'list/table.html.tmpl' => [ 'id', - 'splitheader ? 2 : 1', 'abbrev.$id.title || field_descs.$id || column.title', # 'tableheader', 'bug.bug_severity', # @@ -387,9 +381,6 @@ 'dependson_ids.join(",")', 'blocked_ids.join(",")', 'dep_id', - 'hide_resolved ? 0 : 1', - 'hide_resolved ? "Show" : "Hide"', - 'realdepth < 2 || maxdepth == 1 ? "disabled" : ""', 'hide_resolved', 'realdepth < 2 ? "disabled" : ""', 'maxdepth + 1', @@ -420,7 +411,6 @@ ], 'bug/navigate.html.tmpl' => [ - 'this_bug_idx + 1', 'bug_list.first', 'bug_list.last', 'bug_list.$prev_bug', @@ -540,7 +530,6 @@ 'flag.type.name', 'flag.status', 'flag.requestee.nick', # Email - 'show_attachment_flags ? 4 : 3', 'bugid', ], @@ -553,6 +542,27 @@ 'bugid', ], +'attachment/diff-header.html.tmpl' => [ + 'attachid', + 'bugid', + 'old_url', + 'new_url', + 'oldid', + 'newid', + 'style', + 'javascript', + 'patch.id', +], + +'attachment/diff-file.html.tmpl' => [ + 'lxr_prefix', + 'file.minus_lines', + 'file.plus_lines', + 'bonsai_prefix', + 'section.old_start', + 'section_num' +], + 'admin/products/groupcontrol/confirm-edit.html.tmpl' => [ 'group.count', ], @@ -586,7 +596,6 @@ ], 'admin/flag-type/list.html.tmpl' => [ - 'type.is_active ? "active" : "inactive"', 'type.id', 'type.flag_count', ], @@ -601,7 +610,6 @@ 'account/prefs/email.html.tmpl' => [ 'watchedusers', # Email - 'useqacontact ? \'5\' : \'4\'', 'role', 'reason.name', 'reason.description', @@ -617,7 +625,6 @@ 'tab.description', 'current_tab.name', 'current_tab.description', - 'current_tab.description FILTER lower', ], ); diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 8aa3842c8..de5d60c6c 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -344,6 +344,19 @@ Valid types must be of the form foo/bar where foo is either application, audio, image, message, model, multipart, text, or video. + + [% ELSIF error == "invalid_context" %] + [% title = "Invalid Context" %] + The context [% context FILTER html %] is invalid (must be a number, + "file" or "patch"). + + [% ELSIF error == "invalid_format" %] + [% title = "Invalid Format" %] + The format "[% format FILTER html %]" is invalid (must be one of + [% FOREACH my_format = formats %] + "[% my_format FILTER html %]" + [% END %] + ). [% ELSIF error == "invalid_maxrow" %] [% title = "Invalid Max Rows" %] @@ -427,6 +440,10 @@ The query named [% queryname FILTER html %] does not exist. + [% ELSIF error == "must_be_patch" %] + [% title = "Attachment Must Be Patch" %] + Attachment #[% attach_id FILTER html %] must be a patch. + [% ELSIF error == "missing_subcategory" %] [% title = "Missing Subcategory" %] You did not specify a subcategory for this series. -- cgit v1.2.3-24-g4f1b