diff-header.html.tmpl 9.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
[%# 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 <jkeiser@netscape.com>
  #%]

[%# Define strings that will serve as the title and header of this page %]

23 24 25
[% PROCESS global/variables.none.tmpl %]

[% title = BLOCK %]
26
  [% IF attachid %]
27
Attachment #[% attachid %] for [% terms.bug %] #[% bugid %]
28
  [% ELSE %]
29
Interdiff of #[% oldid %] and #[% newid %] for [% terms.bug %] #[% bugid %]
30
  [% END %]
31
[% END %]
32 33 34 35

[% style = BLOCK %]
.file_head {
  font-weight: bold;
36 37
  font-size: 1em;
  background-color: #c3c3c3;
38 39
  border: 1px solid black;
}
40 41 42 43 44 45 46

.file_head a {
  text-decoration: none; 
  font-family: monospace; 
  font-size: 1.1em;
}

47 48 49
.file_collapse {
  display: none;
}
50

51
.section_head {
52
  background-color: #f0f0f0;
53 54 55
  border: 1px solid black;
  text-align: left;
}
56

57 58 59 60 61 62
table.file_table {
  table-layout: fixed;
  width: 100%;
  empty-cells: show;
  border-spacing: 0px;
  border-collapse: collapse;
63 64
  /* draw border below last open context section in listing */
  border-bottom: 1px solid black;
65
}
66

67 68 69 70
tbody.file td {
  border-left: 1px dashed black;
  border-right: 1px dashed black;
}
71

72 73 74 75 76
tbody.file pre {
  display: inline;
  white-space: -moz-pre-wrap;
  font-size: 0.9em;
}
77

78 79 80
tbody.file pre:empty {
  display: block;
}
81

82 83 84
.changed {
  background-color: lightblue;
}
85

86 87 88
.added {
  background-color: lightgreen;
}
89

90 91 92
.removed {
  background-color: #FFCC99;
}
93

94 95 96 97 98 99 100
.num {
  background-color: #ffe9ae;
  text-align:right;
  padding: 0 0.3em;
  width: 3em;
}

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
.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) {
202
    return tbody.previousSibling.firstChild.nextSibling.firstChild.firstChild;
203 204 205 206 207
  }
[% END %]

[% onload = 'restore_all(); document.checkboxform.restore_indicator.checked = true' %]

208 209 210 211
[% BLOCK viewurl %]attachment.cgi?id=[% id %][% END %]
[% BLOCK editurl %][% PROCESS viewurl %]&amp;action=edit[% END %]
[% BLOCK diffurl %][% PROCESS viewurl %]&amp;action=diff[% END %]

212
[% IF headers %]
213
  [% header = BLOCK %]
214
    [% IF attachid %]
215
      Attachment #[% attachid %]: [% description FILTER html %]
216 217
    [% ELSE %]
      Diff Between 
218
       #[% oldid %]: <a href="[% PROCESS diffurl id=oldid %]">[% old_desc FILTER html %]</a>
219
      and 
220
       #[% newid %]: <a href="[% PROCESS diffurl id=newid %]">[% new_desc FILTER html %]</a>
221
    [% END %]
222
    for <a href="show_bug.cgi?id=[% bugid %]">[% terms.bug %] #[% bugid %]</a>
223
  [% END %]
224
  [% subheader = BLOCK %]
225 226
    [% bugsummary FILTER html %]
  [% END %]
227
  [% PROCESS global/header.html.tmpl doc_section = "attachments.html#patchviewer" %]
228 229 230 231 232 233
[% ELSE %]
  <html>
  <head>
  <style type="text/css">
  [% style %]
  </style>
234
  <script type="text/javascript">
235 236 237 238 239 240 241 242 243 244 245 246
  <!--
  [% javascript %]
  -->
  </script>
  </head>
  <body onload="[% onload FILTER html %]">
[% END %]
  
[%# If we have attachid, we are in diff, otherwise we're in interdiff %]
[% IF attachid %]
  [%# HEADER %]
  [% IF headers %]
247
    <a href="[% PROCESS viewurl id=attachid %]">View</a>
248
    | <a href="[% PROCESS editurl id=attachid %]">Details</a>
249
    | <a href="[% PROCESS diffurl id=attachid %]&amp;context=[% context FILTER url_quote %]&amp;collapsed=[% collapsed FILTER url_quote %]&amp;headers=[% headers FILTER url_quote %]&amp;format=raw">Raw&nbsp;Unified</a>
250
  [% END %]
251
  [% IF other_patches.size > 0 %]
252 253
    [% IF headers %] |[%END%]
    Differences between
254
    <form style="display: inline" action="attachment.cgi">
255 256 257 258 259 260 261 262
      <select name="oldid">
      [% FOREACH patch = other_patches %]
        <option value="[% patch.id %]"
        [% IF patch.selected %] selected[% END %]
        >[% patch.desc FILTER html %]</option>
      [% END %]
      </select>
      and this patch
263
      <input type="submit" id="diff" value="Diff">
264 265 266 267 268 269 270 271
      <input type="hidden" name="action" value="interdiff">
      <input type="hidden" name="newid" value="[% attachid %]">
      <input type="hidden" name="headers" value="[% headers FILTER html %]">
    </form>
  [% END %]
  <br>
[% ELSE %]
  [% IF headers %]
272
    <a href="attachment.cgi?oldid=[% oldid %]&amp;newid=[% newid %]&amp;action=interdiff&amp;format=raw">Raw Unified</a>
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
    |
  [% END %]
[% END %]
  
[%# Collapse / Expand %]
<a href="#"
   onmouseover="lastStatus = window.status; window.status='Collapse All'; return true"
   onmouseout="window.status = lastStatus; return true"
   onclick="return collapse_all()">Collapse All</a> | 
<a href="#"
   onmouseover="lastStatus = window.status; window.status='Expand All'; return true"
   onmouseout="window.status = lastStatus; return true"
   onclick="return expand_all()">Expand All</a>

[% IF do_context %]
288
  [%# only happens for normal viewing, not interdiff %]
289 290 291 292
  | <span style='font-weight: bold'>Context:</span>
  [% IF context == "patch" %]
    (<strong>Patch</strong> / 
  [% ELSE %]
293
    (<a href="[% PROCESS diffurl id=attachid %]&amp;headers=[% headers FILTER url_quote %]">Patch</a> / 
294 295 296 297
  [% END %]
  [% IF context == "file" %]
    <strong>File</strong> /
  [% ELSE %]
298
    <a href="[% PROCESS diffurl id=attachid %]&amp;headers=[% headers FILTER url_quote %]&amp;context=file">File</a> / 
299 300 301 302 303 304
  [% END %]

  [% IF context == "patch" || context == "file" %]
    [% context = 3 %]
  [% END %]
  [%# textbox for context %]
305
  <form style="display: inline" action="attachment.cgi"><input type="hidden" name="action" value="diff"><input type="hidden" name="id" value="[% attachid %]"><input type="hidden" name="collapsed" value="[% collapsed FILTER html %]"><input type="hidden" name="headers" value="[% headers FILTER html %]"><input type="text" name="context" value="[% context FILTER html %]" size="3"></form>)
306 307 308 309 310 311
[% END %]

[% IF warning %]
<h2 class="warning">Warning: 
  [% IF warning == "interdiff1" %]
  this difference between two patches may show things in the wrong places due
312 313
  to a limitation in [% terms.Bugzilla %] when comparing patches with different
  sets of files.
314 315 316
  [% END %]
  [% IF warning == "interdiff2" %]
  this difference between two patches may be inaccurate due to a limitation in
317
  [%+ terms.Bugzilla %] when comparing patches made against different revisions.
318 319
  [% END %]
</h2>
320 321
[% ELSE %]
    <br><br>
322 323 324
[% END %]
 
[%# Restore Stuff %]
325
<form name="checkboxform" action="attachment.cgi">
326 327 328
<input type="checkbox" name="restore_indicator" style="display: none">