bug_report.html revision 731df977c0511bca2206b5f333555b1205ff1f43
1<!DOCTYPE HTML>
2<html i18n-values="dir:textdirection;">
3<head>
4<meta charset="utf-8"/>
5<title i18n-content="title"></title>
6<link rel="stylesheet" href="bug_report.css"/>
7
8<script src="shared/js/local_strings.js"></script>
9<script src="shared/js/util.js"></script>
10<script src="bug_report.js"></script>
11<script>
12
13///////////////////////////////////////////////////////////////////////////////
14// Document Functions:
15/**
16 * Window onload handler, sets up the page.
17 */
18function load() {
19  $('sysinfo-url').onclick = function(event) {
20    chrome.send('openSystemTab');
21  };
22
23  // textContent on description-text textarea seems to default
24  // to several spaces, this resets it to empty.
25  $('description-text').textContent = '';
26  $('send-report-button').disabled = true;
27
28  $('issue-with-combo').addEventListener('change', function(e) {
29    $('send-report-button').disabled =
30        this.selectedIndex <= 0 || $('description-text').value.length == 0;
31  });
32
33  $('description-text').addEventListener('keyup', function(e) {
34    $('send-report-button').disabled =
35        $('issue-with-combo').selectedIndex <= 0 || this.value.length == 0;
36  });
37
38  $('current-screenshot').nextSibling.textContent =
39      localStrings.getString('currentscreenshots');
40<if expr="pp_ifdef('chromeos')">
41  $('saved-screenshot').nextSibling.textContent =
42      localStrings.getString('savedscreenshots');
43</if>
44  $('no-screenshot').nextSibling.textContent =
45      localStrings.getString('noscreenshot');
46
47  // Get a list of issues that we allow the user to select from.
48  // Note, the order and the issues types themselves are different
49  // between Chromium and Chromium OS, so this code needs to be
50  // maintained individually between the bug_report.html and
51  // bug_report_cros.html files.
52  var issueTypeText = [];
53  issueTypeText[0] = localStrings.getString('issue-choose');
54<if expr="not pp_ifdef('chromeos')">
55  issueTypeText[1] = localStrings.getString('issue-page-formatting');
56  issueTypeText[2] = localStrings.getString('issue-page-load');
57  issueTypeText[3] = localStrings.getString('issue-plugins');
58  issueTypeText[4] = localStrings.getString('issue-tabs');
59  issueTypeText[5] = localStrings.getString('issue-sync');
60  issueTypeText[6] = localStrings.getString('issue-crashes');
61  issueTypeText[7] = localStrings.getString('issue-extensions');
62  issueTypeText[8] = localStrings.getString('issue-phishing');
63  issueTypeText[9] = localStrings.getString('issue-other');
64</if>
65<if expr="pp_ifdef('chromeos')">
66  issueTypeText[1] = localStrings.getString('issue-connectivity');
67  issueTypeText[2] = localStrings.getString('issue-sync');
68  issueTypeText[3] = localStrings.getString('issue-crashes');
69  issueTypeText[4] = localStrings.getString('issue-page-formatting');
70  issueTypeText[5] = localStrings.getString('issue-extensions');
71  issueTypeText[6] = localStrings.getString('issue-standby');
72  issueTypeText[7] = localStrings.getString('issue-phishing');
73  issueTypeText[8] = localStrings.getString('issue-other');
74</if>
75  // Add all the issues to the selection box.
76  for (var i = 0; i < issueTypeText.length; i++) {
77    var option = document.createElement('option');
78    option.className = 'bug-report-text';
79    option.textContent = issueTypeText[i];
80    $('issue-with-combo').add(option);
81  }
82
83  chrome.send('getDialogDefaults', []);
84  chrome.send('refreshScreenshots', []);
85};
86
87function setupScreenshots(screenshots) {
88  if (screenshots.length == 1) {
89    addScreenshot('current-screenshots', screenshots[0]);
90  } else {
91    // We're in Chromium OS.
92    currentScreenshot = screenshots[0];
93    addScreenshot('current-screenshots', currentScreenshot);
94
95    savedScreenshots = screenshots[1];
96    if (savedScreenshots.length == 0) {
97      $('saved-screenshots').disabled = true;
98      return;
99    }
100    for (i = 0; i < savedScreenshots.length; ++i)
101      addScreenshot('saved-screenshots', savedScreenshots[i]);
102  }
103}
104
105function setupDialogDefaults(defaults) {
106  if (defaults.length > 0) {
107    $('page-url-text').value = defaults[0];
108    if (defaults.length > 2) {
109      // We're in Chromium OS.
110      $('user-email-text').value = defaults[2];
111    }
112  }
113}
114
115window.addEventListener('DOMContentLoaded', load);
116</script>
117</head>
118<body>
119<div>
120  <div id="main-panel">
121    <div class="formpane">
122      <table>
123        <!--  Issue type dropdown -->
124        <tr>
125          <th id="issue-with" class="bug-report-label" i18n-content="issue-with">
126          </th>
127        </tr>
128        <tr>
129          <td>
130            <select id="issue-with-combo" class="bug-report-text">
131            </select>
132          </td>
133        </tr>
134        <!--  Page URL text box -->
135        <tr>
136          <th colspan="2" id="page-url" class="bug-report-label"
137              i18n-content="page-url">
138          </th>
139        </tr>
140        <tr>
141          <td colspan="2">
142            <input id='page-url-text' maxlength=200 class="bug-report-text">
143          </td>
144        </tr>
145        <!--  Description -->
146        <tr>
147          <th id="description" colspan="2" class="bug-report-label"
148              i18n-content="description">
149          </th>
150        </tr>
151        <tr>
152          <td colspan="2">
153            <textarea id='description-text' rows="10" class="bug-report-text">
154            </textarea>
155          </td>
156        </tr>
157      </table>
158    </div>
159    <div class="formpane">
160      <table>
161<if expr="pp_ifdef('chromeos')">
162        <!--  Page URL text box -->
163        <tr>
164          <th id="user-email" class="bug-report-label" i18n-content="user-email">
165          </th>
166        </tr>
167        <tr>
168          <td>
169            <input id='user-email-text' maxlength=200 class="bug-report-text">
170          </td>
171        </tr>
172        <!--  System Information checkbox -->
173        <tr>
174          <td>
175            <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checked>
176            <span id="sysinfo-label"></span>
177            <a id="sysinfo-url" href="#" >
178              <span i18n-content="sysinfo"></span>
179            </a>
180          </td>
181        </tr>
182</if>
183        <!--  Screenshot radio buttons -->
184        <tr>
185          <th id="screenshot" class="bug-report-label" i18n-content="screenshot">
186          </th>
187        </tr>
188        <tr>
189          <td>
190            <input id="no-screenshot" type="radio" name="screenshot-group"
191                   value="none" onclick="noneSelected()">
192            <br>
193<if expr="pp_ifdef('chromeos')">
194            <input id="saved-screenshot" type="radio" name="screenshot-group"
195                   value="saved" onclick="savedSelected()">
196            <br>
197            <div id="saved-screenshots" style="display: none;"
198                 class="thumbnail-list">
199            </div>
200</if>
201            <input id="current-screenshot" type="radio" name="screenshot-group"
202                   value="current" checked onclick="currentSelected()">
203            <br>
204            <div id="current-screenshots" class="thumbnail-list">
205            </div>
206          </td>
207        </tr>
208      </table>
209    </div>
210  </div>
211</div>
212<div id="buttons">
213    <!--  Buttons -->
214    <input id='send-report-button' type="submit" class="bug-report-button"
215          i18n-values="value:send-report" onclick="sendReport()">
216    <input id='cancel-button' type="submit" class="bug-report-button"
217           i18n-values="value:cancel" onclick="cancel()">
218</div>
219</body>
220</html>
221