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