Chromium Code Reviews| 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. |
| 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 = | |
| 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) |
| 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] == "") | |
|
oshima
2010/11/29 19:09:22
single quote for strings.
rkc
2010/11/29 22:41:08
Done.
| |
| 105 $('page-url-checkbox').checked = false; | |
| 108 if (defaults.length > 2) { | 106 if (defaults.length > 2) { |
| 109 // We're in Chromium OS. | 107 // We're in Chromium OS. |
| 110 $('user-email-text').value = defaults[2]; | 108 $('user-email-text').textContent = defaults[2]; |
| 109 if (defaults[2] == "") { | |
|
oshima
2010/11/29 19:09:22
same here
rkc
2010/11/29 22:41:08
Done.
| |
| 110 // if we didn't get an e-mail address from cros, disable the checkbox | |
| 111 $('user-email-checkbox').checked = false; | |
| 112 $('user-email-checkbox').disabled = true; | |
| 113 } | |
| 111 } | 114 } |
| 112 } | 115 } |
| 113 } | 116 } |
| 114 | 117 |
| 115 window.addEventListener('DOMContentLoaded', load); | 118 window.addEventListener('DOMContentLoaded', load); |
| 116 </script> | 119 </script> |
| 117 </head> | 120 </head> |
| 118 <body> | 121 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
| 119 <div> | 122 <div id="main-content"> |
| 120 <div id="main-panel"> | 123 <div id="navbar-container"> |
| 121 <div class="formpane"> | 124 <h1 id="settings-title" i18n-content="page-title"> |
| 122 <table> | 125 </h1> |
| 123 <!-- Issue type dropdown --> | 126 </div> |
| 124 <tr> | 127 <div id="mainview" class> |
| 125 <th id="issue-with" class="bug-report-label" i18n-content="issue-with" > | 128 <!-- Even though we really don't need these many nested DIV's, we're staying |
| 126 </th> | 129 as close to the settings page layout as possible, re-using all our styles |
| 127 </tr> | 130 from there --> |
| 128 <tr> | 131 <div id="mainview-content"> |
| 129 <td> | 132 <div class="page"> |
| 130 <select id="issue-with-combo" class="bug-report-text"> | 133 <h1 i18n-content="title"></h1> |
| 131 </select> | 134 <table id="main-table"> |
| 132 </td> | 135 <!-- Issue type dropdown --> |
| 133 </tr> | 136 <tbody> |
| 134 <!-- Page URL text box --> | 137 <tr> |
| 135 <tr> | 138 <th id="issue-with" class="bug-report-label" |
| 136 <th colspan="2" id="page-url" class="bug-report-label" | 139 i18n-content="issue-with"></th> |
| 137 i18n-content="page-url"> | 140 </tr> |
| 138 </th> | 141 <tr> |
| 139 </tr> | 142 <td> |
| 140 <tr> | 143 <select id="issue-with-combo" class="bug-report-text"> |
| 141 <td colspan="2"> | 144 </select> |
| 142 <input id='page-url-text' maxlength=200 class="bug-report-text"> | 145 </td> |
| 143 </td> | 146 </tr> |
| 144 </tr> | 147 <!-- Description --> |
| 145 <!-- Description --> | 148 <tr> |
| 146 <tr> | 149 <th id="description" colspan="2" class="bug-report-label" |
| 147 <th id="description" colspan="2" class="bug-report-label" | 150 i18n-content="description"></th> |
| 148 i18n-content="description"> | 151 </tr> |
| 149 </th> | 152 <tr> |
| 150 </tr> | 153 <td colspan="2"> |
| 151 <tr> | 154 <textarea id="description-text" rows="10" |
| 152 <td colspan="2"> | 155 class="bug-report-text"></textarea> |
| 153 <textarea id='description-text' rows="10" class="bug-report-text"> | 156 </td> |
| 154 </textarea> | 157 </tr> |
| 155 </td> | 158 <tr> |
| 156 </tr> | 159 <td> |
| 157 </table> | 160 <table style="-webkit-border-vertical-spacing: 0px;"> |
| 158 </div> | 161 <!-- Page URL --> |
| 159 <div class="formpane"> | 162 <tr> |
| 160 <table> | 163 <td> |
| 161 <if expr="pp_ifdef('chromeos')"> | 164 <table class="bug-report-table"> |
| 162 <!-- Page URL text box --> | 165 <tr> |
| 163 <tr> | 166 <td class="bug-report-fieldlabel"> |
| 164 <th id="user-email" class="bug-report-label" i18n-content="user-email" > | 167 <input id="page-url-checkbox" type="checkbox" |
| 165 </th> | 168 value="pageurl" checked> |
| 166 </tr> | 169 <span id="page-url-label" i18n-content="page-url"> |
| 167 <tr> | 170 </span> |
| 168 <td> | 171 </td> |
| 169 <input id='user-email-text' maxlength=200 class="bug-report-text"> | 172 <td> |
| 170 </td> | 173 <input id="page-url-text" class="bug-report-field" |
| 171 </tr> | 174 maxlength="200"> |
| 172 <!-- System Information checkbox --> | 175 </td> |
| 173 <tr> | 176 </tr> |
| 174 <td> | 177 </table> |
| 175 <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checke d> | 178 </td> |
| 176 <span id="sysinfo-label"></span> | 179 </tr> |
| 177 <a id="sysinfo-url" href="#" > | 180 <!-- User e-mail --> |
| 178 <span i18n-content="sysinfo"></span> | 181 <tr> |
| 179 </a> | 182 <td> |
| 180 </td> | 183 <table class="bug-report-table"> |
| 181 </tr> | 184 <tr> |
| 182 </if> | 185 <td class="bug-report-fieldlabel"> |
| 183 <!-- Screenshot radio buttons --> | 186 <input id="user-email-checkbox" type="checkbox" |
| 184 <tr> | 187 checked> |
| 185 <th id="screenshot" class="bug-report-label" i18n-content="screenshot" > | 188 <span id="user-email-label" |
| 186 </th> | 189 i18n-content="user-email"></span> |
| 187 </tr> | 190 </td> |
| 188 <tr> | 191 <td> |
| 189 <td> | 192 <label id="user-email-text" |
| 190 <input id="no-screenshot" type="radio" name="screenshot-group" | 193 class="bug-report-field"></label> |
| 191 value="none" onclick="noneSelected()"> | 194 </td> |
| 192 <br> | 195 </tr> |
| 193 <if expr="pp_ifdef('chromeos')"> | 196 </table> |
| 194 <input id="saved-screenshot" type="radio" name="screenshot-group" | 197 </td> |
| 195 value="saved" onclick="savedSelected()"> | 198 </tr> |
| 196 <br> | 199 <!-- System Information --> |
| 197 <div id="saved-screenshots" style="display: none;" | 200 <tr> |
| 198 class="thumbnail-list"> | 201 <td> |
| 199 </div> | 202 <table class="bug-report-table"> |
| 200 </if> | 203 <tr> |
| 201 <input id="current-screenshot" type="radio" name="screenshot-group" | 204 <td class="bug-report-fieldlabel"> |
| 202 value="current" checked onclick="currentSelected()"> | 205 <input id="sys-info-checkbox" type="checkbox" |
| 203 <br> | 206 checked> |
| 204 <div id="current-screenshots" class="thumbnail-list"> | 207 <span id="sysinfo-label"> |
| 205 </div> | 208 <a id="sysinfo-url" href="#" |
| 206 </td> | 209 i18n-content="sysinfo"></a> |
| 207 </tr> | 210 </span> |
| 208 </table> | 211 </td> |
| 212 </tr> | |
| 213 </table> | |
| 214 </td> | |
| 215 </tr> | |
| 216 <!-- Screenshot --> | |
| 217 <tr> | |
| 218 <td> | |
| 219 <table class="bug-report-table"> | |
| 220 <tr> | |
| 221 <td class="bug-report-fieldlabel"> | |
| 222 <input id="screenshot-checkbox" type="checkbox" | |
| 223 checked> | |
| 224 <span id="screenshot-label" | |
| 225 i18n-content="current-screenshot"> | |
| 226 </span> | |
| 227 <a id="screenshot-link" href="#" | |
| 228 onclick="toggleScreenshotType()" | |
| 229 i18n-content="choose-different-screenshot"> | |
| 230 </a> | |
| 231 </td> | |
| 232 </tr> | |
| 233 </table> | |
| 234 </td> | |
| 235 </tr> | |
| 236 <tr> | |
| 237 <td> | |
| 238 <div id="saved-screenshots" style="display: none;" | |
| 239 class="thumbnail-list"></div> | |
| 240 <div id="current-screenshots" class="thumbnail-list"> | |
| 241 </div> | |
| 242 </td> | |
| 243 </tr> | |
| 244 </table> | |
| 245 </td> | |
| 246 </tr> | |
| 247 <tr> | |
| 248 <td> | |
| 249 <div id="buttons-pane"> | |
| 250 <!-- Buttons --> | |
| 251 <input id="send-report-button" type="submit" | |
| 252 class="bug-report-button" onclick="sendReport()" | |
| 253 i18n-values="value:send-report"> | |
| 254 <input id="cancel-button" type="submit" | |
| 255 class="bug-report-button" i18n-values="value:cancel" | |
| 256 onclick="cancel()"> | |
| 257 </div> | |
| 258 <div id="privacy-note" i18n-values=".innerHTML:privacy-note"></d iv> | |
| 259 </td> | |
| 260 </tr> | |
| 261 </tbody> | |
| 262 </table> | |
| 263 </div> | |
| 209 </div> | 264 </div> |
| 210 </div> | 265 </div> |
| 211 </div> | 266 </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> | 267 </body> |
| 220 </html> | 268 </html> |
| OLD | NEW |