OLD | NEW |
---|---|
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html i18n-values="dir:textdirection;"> | 2 <html i18n-values="dir:textdirection;"> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"/> | 4 <meta charset="utf-8"/> |
5 <title i18n-content="title"></title> | 5 <title i18n-content="page-title"></title> |
6 <link rel="stylesheet" href="bug_report.css"/> | 6 <!-- We want to keep our style in sync with the options page. --> |
7 <link rel="stylesheet" href="dom_ui.css"> | |
8 <link rel="stylesheet" href="options/options_page.css"> | |
9 <link rel="stylesheet" href="bug_report.css"> | |
7 | 10 |
8 <script src="shared/js/local_strings.js"></script> | 11 <script src="shared/js/local_strings.js"></script> |
9 <script src="shared/js/util.js"></script> | 12 <script src="shared/js/util.js"></script> |
10 <script src="bug_report.js"></script> | 13 <script src="bug_report.js"></script> |
11 <script> | 14 <script> |
12 | 15 |
13 /////////////////////////////////////////////////////////////////////////////// | 16 /////////////////////////////////////////////////////////////////////////////// |
14 // Document Functions: | 17 // Document Functions: |
15 /** | 18 /** |
16 * Window onload handler, sets up the page. | 19 * Window onload handler, sets up the page. |
17 */ | 20 */ |
18 function load() { | 21 function load() { |
19 $('sysinfo-url').onclick = function(event) { | 22 $('sysinfo-url').onclick = function(event) { |
20 chrome.send('openSystemTab'); | 23 chrome.send('openSystemTab'); |
21 }; | 24 }; |
25 | |
26 var menuOffPattern = /(^\?|&)menu=off($|&)/; | |
27 var menuDisabled = menuOffPattern.test(window.location.search); | |
28 document.documentElement.setAttribute('hide-menu', menuDisabled); | |
29 | |
22 | 30 |
23 // textContent on description-text textarea seems to default | 31 // textContent on description-text textarea seems to default |
24 // to several spaces, this resets it to empty. | 32 // to several spaces, this resets it to empty. |
25 $('description-text').textContent = ''; | 33 $('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 | 34 |
47 // Get a list of issues that we allow the user to select from. | 35 // Get a list of issues that we allow the user to select from. |
48 // Note, the order and the issues types themselves are different | 36 // Note, the order and the issues types themselves are different |
49 // between Chromium and Chromium OS, so this code needs to be | 37 // between Chromium and Chromium OS, so this code needs to be |
50 // maintained individually between the bug_report.html and | 38 // maintained individually between in these two sections. |
arv (Not doing code reviews)
2010/11/29 23:20:34
<del>in</del>
| |
51 // bug_report_cros.html files. | |
52 var issueTypeText = []; | 39 var issueTypeText = []; |
53 issueTypeText[0] = localStrings.getString('issue-choose'); | 40 issueTypeText[0] = localStrings.getString('issue-choose'); |
54 <if expr="not pp_ifdef('chromeos')"> | 41 <if expr="not pp_ifdef('chromeos')"> |
55 issueTypeText[1] = localStrings.getString('issue-page-formatting'); | 42 issueTypeText[1] = localStrings.getString('issue-page-formatting'); |
56 issueTypeText[2] = localStrings.getString('issue-page-load'); | 43 issueTypeText[2] = localStrings.getString('issue-page-load'); |
57 issueTypeText[3] = localStrings.getString('issue-plugins'); | 44 issueTypeText[3] = localStrings.getString('issue-plugins'); |
58 issueTypeText[4] = localStrings.getString('issue-tabs'); | 45 issueTypeText[4] = localStrings.getString('issue-tabs'); |
59 issueTypeText[5] = localStrings.getString('issue-sync'); | 46 issueTypeText[5] = localStrings.getString('issue-sync'); |
60 issueTypeText[6] = localStrings.getString('issue-crashes'); | 47 issueTypeText[6] = localStrings.getString('issue-crashes'); |
61 issueTypeText[7] = localStrings.getString('issue-extensions'); | 48 issueTypeText[7] = localStrings.getString('issue-extensions'); |
(...skipping 12 matching lines...) Expand all Loading... | |
74 </if> | 61 </if> |
75 // Add all the issues to the selection box. | 62 // Add all the issues to the selection box. |
76 for (var i = 0; i < issueTypeText.length; i++) { | 63 for (var i = 0; i < issueTypeText.length; i++) { |
77 var option = document.createElement('option'); | 64 var option = document.createElement('option'); |
78 option.className = 'bug-report-text'; | 65 option.className = 'bug-report-text'; |
79 option.textContent = issueTypeText[i]; | 66 option.textContent = issueTypeText[i]; |
80 $('issue-with-combo').add(option); | 67 $('issue-with-combo').add(option); |
81 } | 68 } |
82 | 69 |
83 chrome.send('getDialogDefaults', []); | 70 chrome.send('getDialogDefaults', []); |
84 chrome.send('refreshScreenshots', []); | 71 chrome.send('refreshCurrentScreenshot', []); |
85 }; | 72 }; |
86 | 73 |
87 function setupScreenshots(screenshots) { | 74 function setupCurrentScreenshot(screenshot) { |
88 if (screenshots.length == 1) { | 75 addScreenshot('current-screenshots', screenshot); |
89 addScreenshot('current-screenshots', screenshots[0]); | 76 } |
77 | |
78 function setupSavedScreenshots(screenshots) { | |
79 if (screenshots.length == 0) { | |
80 $('saved-screenshots').innerText = | |
arv (Not doing code reviews)
2010/11/29 23:20:34
textContent
| |
81 localStrings.getString('no-saved-screenshots'); | |
82 | |
83 // Make sure we make the display the message | |
84 $('saved-screenshots').style.display = 'block'; | |
85 | |
86 // In case the user tries to send now; fail safe, do not send a screenshot | |
87 // at all versus sending the current screenshot. | |
88 selectedThumbnailDivId = ''; | |
89 selectedThumbnailId = ''; | |
90 } else { | 90 } else { |
91 // We're in Chromium OS. | 91 for (i = 0; i < screenshots.length; ++i) |
arv (Not doing code reviews)
2010/11/29 23:20:34
missing var
| |
92 currentScreenshot = screenshots[0]; | 92 addScreenshot('saved-screenshots', screenshots[i]); |
93 addScreenshot('current-screenshots', currentScreenshot); | 93 |
94 | 94 // Now that we have our screenshots, try selecting the saved screenshots |
95 savedScreenshots = screenshots[1]; | 95 // again. |
96 if (savedScreenshots.length == 0) { | 96 savedSelected(); |
97 $('saved-screenshots').disabled = true; | |
98 return; | |
99 } | |
100 for (i = 0; i < savedScreenshots.length; ++i) | |
101 addScreenshot('saved-screenshots', savedScreenshots[i]); | |
102 } | 97 } |
103 } | 98 } |
104 | 99 |
100 | |
105 function setupDialogDefaults(defaults) { | 101 function setupDialogDefaults(defaults) { |
106 if (defaults.length > 0) { | 102 if (defaults.length > 0) { |
107 $('page-url-text').value = defaults[0]; | 103 $('page-url-text').value = defaults[0]; |
104 if (defaults[0] == '') | |
105 $('page-url-checkbox').checked = false; | |
106 | |
108 if (defaults.length > 2) { | 107 if (defaults.length > 2) { |
109 // We're in Chromium OS. | 108 // We're in Chromium OS. |
110 $('user-email-text').value = defaults[2]; | 109 $('user-email-text').textContent = defaults[2]; |
110 if (defaults[2] == '') { | |
111 // if we didn't get an e-mail address from cros, | |
112 // disable the user email display totally | |
113 $('user-email-table').style.display = 'none'; | |
114 | |
115 // this also means we are in privacy mode, so no saved screenshots | |
116 $('screenshot-link-tosaved').style.display = 'none'; | |
117 } | |
111 } | 118 } |
112 } | 119 } |
113 } | 120 } |
114 | 121 |
115 window.addEventListener('DOMContentLoaded', load); | 122 window.addEventListener('DOMContentLoaded', load); |
116 </script> | 123 </script> |
117 </head> | 124 </head> |
118 <body> | 125 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
119 <div> | 126 <div id="main-content"> |
120 <div id="main-panel"> | 127 <div id="navbar-container"> |
121 <div class="formpane"> | 128 <h1 id="settings-title" i18n-content="page-title"> |
122 <table> | 129 </h1> |
123 <!-- Issue type dropdown --> | 130 </div> |
124 <tr> | 131 <div id="mainview" class> |
125 <th id="issue-with" class="bug-report-label" i18n-content="issue-with" > | 132 <!-- Even though we really don't need these many nested DIV's, we're staying |
126 </th> | 133 as close to the settings page layout as possible, re-using all our styles |
127 </tr> | 134 from there --> |
oshima
2010/11/29 23:00:22
If this is a copy from other file, please say from
rkc
2010/11/29 23:15:59
Done.
| |
128 <tr> | 135 <div id="mainview-content"> |
129 <td> | 136 <div class="page"> |
130 <select id="issue-with-combo" class="bug-report-text"> | 137 <h1 i18n-content="title"></h1> |
131 </select> | 138 <table id="main-table"> |
132 </td> | 139 <!-- Issue type dropdown --> |
133 </tr> | 140 <tbody> |
arv (Not doing code reviews)
2010/11/29 23:20:34
thead seems more correct here
| |
134 <!-- Page URL text box --> | 141 <tr> |
135 <tr> | 142 <th id="issue-with" class="bug-report-label" |
136 <th colspan="2" id="page-url" class="bug-report-label" | 143 i18n-content="issue-with"></th> |
137 i18n-content="page-url"> | 144 </tr> |
138 </th> | 145 <tr> |
139 </tr> | 146 <td> |
140 <tr> | 147 <select id="issue-with-combo" class="bug-report-text"> |
141 <td colspan="2"> | 148 </select> |
142 <input id='page-url-text' maxlength=200 class="bug-report-text"> | 149 </td> |
143 </td> | 150 </tr> |
144 </tr> | 151 <!-- Description --> |
145 <!-- Description --> | 152 <tr> |
146 <tr> | 153 <th id="description" colspan="2" class="bug-report-label" |
147 <th id="description" colspan="2" class="bug-report-label" | 154 i18n-content="description"></th> |
148 i18n-content="description"> | 155 </tr> |
149 </th> | 156 <tr> |
150 </tr> | 157 <td colspan="2"> |
151 <tr> | 158 <textarea id="description-text" rows="10" |
152 <td colspan="2"> | 159 class="bug-report-text"></textarea> |
153 <textarea id='description-text' rows="10" class="bug-report-text"> | 160 </td> |
154 </textarea> | 161 </tr> |
155 </td> | 162 <tr> |
156 </tr> | 163 <td> |
157 </table> | 164 <table style="-webkit-border-vertical-spacing: 0px;"> |
arv (Not doing code reviews)
2010/11/29 23:20:34
move to css
| |
158 </div> | 165 <!-- Page URL --> |
159 <div class="formpane"> | 166 <tr> |
160 <table> | 167 <td> |
161 <if expr="pp_ifdef('chromeos')"> | 168 <table class="bug-report-table"> |
arv (Not doing code reviews)
2010/11/29 23:20:34
Do we really need all these tables? tables makes l
| |
162 <!-- Page URL text box --> | 169 <tr> |
163 <tr> | 170 <td class="bug-report-fieldlabel"> |
164 <th id="user-email" class="bug-report-label" i18n-content="user-email" > | 171 <input id="page-url-checkbox" type="checkbox" |
arv (Not doing code reviews)
2010/11/29 23:20:34
Missing label.
All input[type=checkbox] and input
| |
165 </th> | 172 value="pageurl" checked> |
166 </tr> | 173 <span id="page-url-label" i18n-content="page-url"> |
167 <tr> | 174 </span> |
168 <td> | 175 </td> |
169 <input id='user-email-text' maxlength=200 class="bug-report-text"> | 176 <td> |
170 </td> | 177 <input id="page-url-text" class="bug-report-field" |
171 </tr> | 178 maxlength="200"> |
172 <!-- System Information checkbox --> | 179 </td> |
173 <tr> | 180 </tr> |
174 <td> | 181 </table> |
175 <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checke d> | 182 </td> |
176 <span id="sysinfo-label"></span> | 183 </tr> |
177 <a id="sysinfo-url" href="#" > | 184 <!-- User e-mail --> |
178 <span i18n-content="sysinfo"></span> | 185 <tr> |
179 </a> | 186 <td> |
180 </td> | 187 <if expr="pp_ifdef('chromeos')"> |
181 </tr> | 188 <table id="user-email-table" class="bug-report-table"> |
182 </if> | 189 <tr> |
183 <!-- Screenshot radio buttons --> | 190 <td class="bug-report-fieldlabel"> |
184 <tr> | 191 <input id="user-email-checkbox" type="checkbox" |
185 <th id="screenshot" class="bug-report-label" i18n-content="screenshot" > | 192 checked> |
186 </th> | 193 <span id="user-email-label" |
187 </tr> | 194 i18n-content="user-email"></span> |
188 <tr> | 195 </td> |
189 <td> | 196 <td> |
190 <input id="no-screenshot" type="radio" name="screenshot-group" | 197 <label id="user-email-text" |
191 value="none" onclick="noneSelected()"> | 198 class="bug-report-field"></label> |
192 <br> | 199 </td> |
193 <if expr="pp_ifdef('chromeos')"> | 200 </tr> |
194 <input id="saved-screenshot" type="radio" name="screenshot-group" | 201 </table> |
195 value="saved" onclick="savedSelected()"> | 202 </if> |
196 <br> | 203 </td> |
197 <div id="saved-screenshots" style="display: none;" | 204 </tr> |
198 class="thumbnail-list"> | 205 <!-- System Information --> |
199 </div> | 206 <tr> |
200 </if> | 207 <td> |
201 <input id="current-screenshot" type="radio" name="screenshot-group" | 208 <table class="bug-report-table"> |
202 value="current" checked onclick="currentSelected()"> | 209 <tr> |
203 <br> | 210 <td class="bug-report-fieldlabel"> |
204 <div id="current-screenshots" class="thumbnail-list"> | 211 <input id="sys-info-checkbox" type="checkbox" |
205 </div> | 212 checked> |
206 </td> | 213 <span id="sysinfo-label"> |
207 </tr> | 214 <a id="sysinfo-url" href="#" |
208 </table> | 215 i18n-content="sysinfo"></a> |
216 </span> | |
217 </td> | |
218 </tr> | |
219 </table> | |
220 </td> | |
221 </tr> | |
222 <!-- Screenshot --> | |
223 <tr> | |
224 <td> | |
225 <table class="bug-report-table"> | |
226 <tr> | |
227 <td class="bug-report-fieldlabel"> | |
228 <input id="screenshot-checkbox" type="checkbox" | |
229 checked> | |
230 <span id="screenshot-label-current" | |
231 i18n-content="current-screenshot"> | |
232 </span> | |
233 <if expr="pp_ifdef('chromeos')"> | |
234 <span id="screenshot-label-saved" | |
235 style="display: none;" | |
236 i18n-content="saved-screenshot"> | |
237 </span> | |
238 <a id="screenshot-link-tosaved" href="#" | |
239 onclick="changeToSaved()" | |
240 i18n-content="choose-different-screenshot"> | |
241 </a> | |
242 <a id="screenshot-link-tocurrent" href="#" | |
243 style="display: none;" | |
244 onclick="changeToCurrent()" | |
245 i18n-content="choose-original-screenshot"> | |
246 </a> | |
247 </if> | |
248 </td> | |
249 </tr> | |
250 </table> | |
251 </td> | |
252 </tr> | |
253 <tr> | |
254 <td> | |
255 <if expr="pp_ifdef('chromeos')"> | |
256 <div id="saved-screenshots" style="display: none;" | |
257 class="thumbnail-list"></div> | |
258 </if> | |
259 <div id="current-screenshots" class="thumbnail-list"> | |
260 </div> | |
261 </td> | |
262 </tr> | |
263 </table> | |
264 </td> | |
265 </tr> | |
266 <tr> | |
267 <td> | |
268 <div id="buttons-pane"> | |
269 <!-- Buttons --> | |
270 <input id="send-report-button" type="submit" | |
arv (Not doing code reviews)
2010/11/29 23:20:34
I prefer <button> for buttons
| |
271 class="bug-report-button" onclick="sendReport()" | |
272 i18n-values="value:send-report"> | |
273 <input id="cancel-button" type="submit" | |
274 class="bug-report-button" i18n-values="value:cancel" | |
275 onclick="cancel()"> | |
276 </div> | |
277 <if expr="pp_ifdef('chromeos')"> | |
278 <div id="privacy-note" i18n-values=".innerHTML:privacy-note"> | |
279 </div> | |
280 </if> | |
281 </td> | |
282 </tr> | |
283 </tbody> | |
284 </table> | |
285 </div> | |
209 </div> | 286 </div> |
210 </div> | 287 </div> |
211 </div> | 288 </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> | 289 </body> |
220 </html> | 290 </html> |
OLD | NEW |