create-chart.html.tmpl 8.75 KB
Newer Older
1
[%# 1.0@bugzilla.org %]
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
[%# 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): Gervase Markham <gerv@gerv.net>
  #%]

[%# INTERFACE:
  # chart: Chart object representing the currently assembled chart.
  # category: hash (keyed by category) of hashes (keyed by subcategory) of
  #           hashes (keyed by name), with value being the series_id of the
  #           series. Contains details of all series the user can see.
  #%]

[% PROCESS global/header.html.tmpl 
  title = "Create Chart"
%]

[% PROCESS "reports/series-common.html.tmpl" 
  donames = 1 
%]

37
<script type="text/javascript">
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
[%# This function takes necessary action on selection of a subcategory %]
function subcatSelected() {
  var cat = document.chartform.category.value;
  var subcat = document.chartform.subcategory.value;
  var names = series[cat][subcat];
  
  var namewidget = document.chartform.name;

  namewidget.options.length = 0;
  var i = 0;

  for (x in names) {
    namewidget.options[i] = new Option(x, names[x]);
    i++;
  }

  namewidget.options[0].selected = true;
  
  checkNewState();
}
</script>
  
[% gttext = "Grand Total" %]

62 63 64 65 66 67 68 69 70 71 72
<form method="get" action="chart.cgi" name="chartform">  
  
  <table cellpadding="2" cellspacing="2" border="0">
    [% IF NOT category OR category.size == 0 %]
      <tr>
        <td>
          <i>No data sets exist, or none are visible to you.</i>
        </td>
      </tr>
    [% ELSE %]
      <tr>
73
        <th><label for="category">Category</label>:</th>
74
        <th></th>
75
        <th><label for="subcategory">Sub-category</label>:</th>
76
        <th></th>
77
        <th><label for="name" accesskey="N">Name</label>:</th>
78 79 80 81 82 83 84 85 86 87
        <th><br>
        </th>
      </tr>
      <tr>
      
        [% PROCESS series_select sel = { name => 'category', 
                                         size => 5,
                                         onchange = "catSelected();
                                                     subcatSelected();" } %]
                                   
88 89
        <td>
          <noscript>
90 91
            <input type="submit" name="action-assemble" value="Update --&gt;"
                   id="action-assemble">
92 93
          </noscript>
        </td>
94 95 96 97 98
        
        [% PROCESS series_select sel = { name => 'subcategory', 
                                         size => 5,
                                         onchange = "subcatSelected()" } %]
                                   
99 100
        <td>
          <noscript>
101 102
            <input type="submit" name="action-assemble" value="Update --&gt;"
                   id="action-assemble">
103 104
          </noscript>
        </td>
105 106
        
        <td align="left">
107 108 109 110 111 112 113 114 115 116 117
          <select name="name" id="name" style="width: 15em"
                  size="5" multiple="multiple"
                  [%+ "disabled=\"disabled\"" UNLESS name.keys.size %]>
            [% FOREACH x = name.keys.sort %]
              <option value="[% name.$x FILTER html %]">
                [% x FILTER html %]</option>
            [% END %]
            [% UNLESS name.keys.size %]
              <option value="" disabled="disabled"></option>
            [% END %]
          </select>
118 119 120
        </td>

        <td align="center" valign="middle"> 
121 122
          <input type="submit" name="action-add" value="Add To List"
                 id="action-add"><br>
123 124 125 126 127
        </td>
      </tr>
    [% END %]
  </table>

128
  <script type="text/javascript">
129
    document.chartform.category[0].selected = true;
130 131
    document.chartform.subcategory.disabled = '';
    document.chartform.name.disabled = '';
132 133 134 135 136
    catSelected();
    subcatSelected();
  </script>

  <h3>List Of Data Sets To Plot</h3>
137 138

  [% IF chart.lines.size > 0 %]
139
    <table cellspacing="2" cellpadding="2">
140
      <tr>
141
        <th style="width: 5em;">Select</th>
142
        <th>Label</th>
143 144
        <th></th>
        <th>Data Set</th>
145
        <th></th>
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
      </tr>
      
      [%# The external loop has two counters; one which keeps track of where we
        #  are in the old labels array, and one which keeps track of the new
        #  indexes for the form elements. They are different if chart.lines has
        #  empty slots in it. 
        #%]
      [% labelidx = 0 %]
      [% newidx = 0 %]
      
      [% FOREACH line = chart.lines %]
        [% IF NOT line %]
          [%# chart.lines has an empty slot, so chart.labels will too. We
            # increment labelidx only to keep the labels in sync with the data.
            #%]
          [% labelidx = labelidx + 1 %]
          [% NEXT %]
        [% END %]
        
        [% FOREACH series = line %]
          <tr>
            [% IF loop.first %]
              <td align="center" rowspan="[% line.size %]">
                <input type="checkbox" value="1" name="select[% newidx %]">
              </td>
              <td rowspan="[% line.size %]">
                <input type="text" size="20" name="label[% newidx %]"
                       value="[% (chart.labels.$labelidx OR series.name) 
                                                               FILTER html %]">
              </td>
            [% END %]

            <td>
              [% "{" IF line.size > 1 %]
            </td>

            <td>
              [% series.category FILTER html %] / 
              [%+ series.subcategory FILTER html %] /
              [%+ series.name FILTER html %]
              <input type="hidden" name="line[% newidx %]" 
                     value="[% series.series_id %]">
            </td>

            <td align="center">
191
              [% IF user.id == series.creator OR UserInGroup("admin") %]
192
               <a href="chart.cgi?action=edit&series_id=
193
                       [% series.series_id %]">Edit</a> |
194
              [% END %]
195
              <a href="buglist.cgi?cmdtype=dorem&amp;namedcmd=
196 197 198
                [% series.category FILTER url_quote %]%20/%20
                [% series.subcategory FILTER url_quote %]%20/%20
                [% series.name FILTER url_quote -%]&amp;series_id=
199
                [% series.series_id %]&amp;remaction=runseries">Run Search</a>
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
            </td>        
          </tr>
        [% END %]
        [% labelidx = labelidx + 1 %]
        [% newidx = newidx + 1 %]
      [% END %]

      [% IF chart.gt %]
        <tr>
          <td align="center">
            <input type="checkbox" value="1" name="select65536">
            <input type="hidden" value="1" name="gt">
          </td>
          <td>
            <input type="text" size="20" name="labelgt"
                   value="[% (chart.labelgt OR gttext) FILTER html %]">
          </td>
          <td></td>
          <td>
            <i>[% gttext FILTER html %]</i>
          </td>
          <td></td>
        </tr>
      [% END %]
      <tr>
        <td colspan="6">&nbsp;</td>
      </tr>

      <tr>
        <td valign="bottom" style="text-align: center;">
          <input type="submit" name="action-sum" value="Sum" 
231
                 style="width: 5em;" id="action-sum"><br>
232
          <input type="submit" name="action-remove" value="Remove"
233
                 style="width: 5em;" id="action-remove">
234 235 236
        </td>

        <td style="text-align: right; vertical-align: bottom;">
237 238
          <label for="cumulate"><b>Cumulate</b></label>:
          <input type="checkbox" name="cumulate" id="cumulate" value="1"
239
          [% " checked" IF chart.cumulate %]>
240 241 242
        </td>

        <td></td>
243 244 245
        <td valign="bottom">
          <label for="datefrom"><b>Date Range</b></label>:
          <input type="text" size="12" name="datefrom" id="datefrom"
246
            value="[% time2str("%Y-%m-%d", chart.datefrom) IF chart.datefrom%]">
247 248
          <label for="dateto"><b>to</b></label>
          <input type="text" size="12" name="dateto" id="dateto"
249 250 251 252
            value="[% time2str("%Y-%m-%d", chart.dateto) IF chart.dateto %]">
        </td>

        <td style="text-align: right" valign="bottom">
253 254
          <input type="submit" name="action-wrap" value="Chart This List"
                 id="action-wrap">
255 256 257 258 259
        </td>
      </tr>
    </table>
  [% ELSE %]
  <p><i>None</i></p>
260 261
  [% END %]  
</form>
262 263

[% IF UserInGroup('editbugs') %]
264
  <h3><a href="query.cgi?format=create-series">Create New Data Set</a></h3>
265
[% END %]                 
266 267

[% PROCESS global/footer.html.tmpl %]
268