ReportHead = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" \
             "<html><head><title>Unigraf Test Report</title>\n" \
             "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">\n" \
             "<style>\n" \
             "html {scroll-behavior: smooth;}\n" \
             " TABLE.DOCUMENT{width: 100%;}\n" \
             " P.CONTENTS{font-weight: bold;font-family: \"Arial\";font-size: 11pt;margin-left: 0.3cm;margin-top: 10;margin-bottom: 0.3cm;color: #000000;}\n" \
             " P.HEADING{background-color: #BBC3FF;margin-top: 0;margin-bottom: 0.5cm;margin-left: 0cm;font-weight: bold;font-family: \"Arial\";font-size: 16pt;color: #000000;}\n" \
             " P.SUBHEADING{background-color: #BBC3FF;margin-top: 1.25cm;margin-bottom: 0.5cm;margin-left: 0.5cm;margin-right: 0;font-weight: bold;font-family: \"Arial\";font-size: 12pt;color: #000000;text-transform: uppercase;}\n" \
             " P.GREENSUBHEADING{background-color: #DCFABC;margin-top: 0.5cm;margin-bottom: 0.5cm;margin-left: 0.6cm;    margin-right: 0;    font-weight: bold;font-family: \"Arial\";font-size: 12pt;color: #000000;}\n" \
             " P.BODYTEXT{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " P.BODYWARNINGS{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 14pt;color: #ff0000;}\n" \
             " P.TESTBODY{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Courier New\";font-size: 11pt;color: #000000;}\n" \
             " PRE.TESTBODY{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Courier New\";font-size: 11pt;color: #000000;}\n" \
             " P.BODYDETAILTEXT{margin-top: 0;margin-bottom: 0;margin-left: 1.4cm;font-weight: medium;font-family: \"Arial\";font-size: 9pt;color: #000000;}\n" \
             " P.CONTENTS SELECT{font-weight: normal;font-family: \"Arial\";font-size: 11pt;width: 98%;margin-top: 0;text-align: left;}\n" \
             "P.TABLE_HEADERS{background-color: #DCFABC;margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: " \
             "medium;font-family: \"Arial\";font-size: 12pt;color: #000000;}\n" \
             " P.TABLE_LINKS{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 11pt;}\n" \
             " P.TABLE_LINKS2{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 11pt; background-color: #DDDDDD;}\n" \
             " P.FAILED{margin-top: 0;margin-bottom: 0;background-color: #FFBCBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " P.PASSED{margin-top: 0;margin-bottom: 0;background-color: #BCFFBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " P.SKIPPED{margin-top: 0;margin-bottom: 0;background-color: #BCBCBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " P.ERROR_CODE{margin-top: 0;margin-bottom: 0;background-color: #FFFFFF; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " P.ABORTED{margin-top: 0;margin-bottom: 0;background-color: #FFFFFF; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
             " .TOPBUTTON{display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99; font-size: 18px; border: solid black 1px; outline: none; background-color: #DCFABC; cursor: pointer; padding: 15px; border-radius: 5px;}\n" \
             "</style>\n" \
             "<script type=\"text/javascript\">\n" \
             "var base64Content = #configInfo#;\n"\
             "window.current_index = 2;\n" \
             "window.min_value = 2;\n" \
             "window.max_value = #count# - 1;\n" \
             "window.onscroll = function() {scrollFunction()};\n" \
             "function Hide(iElementIndex) { document.getElementById(\"ID\"+iElementIndex).style.display = 'none'; }\n" \
             "function Show(iElementIndex) { document.getElementById(\"ID\"+iElementIndex).style.display = 'inline'; }\n" \
             "function HideAll(iDivCount) { for(var i=0;i<iDivCount;i++) { Hide(i); }}\n" \
             "function ShowAll(iDivCount) { for(var i=0;i<iDivCount;i++) { Show(i); }}\n" \
             "function SetIndex(value) { window.current_index = value; }\n" \
             "function GetIndex() { return parseInt(window.current_index, 10); }\n" \
             "function HideButtons() { document.getElementById(\"top_buttons\").style.display = 'none'; document.getElementById(\"bottom_buttons\").style.display = 'none'; }\n" \
             "function ShowButtons() { document.getElementById(\"top_buttons\").style.display = 'inline'; document.getElementById(\"bottom_buttons\").style.display = 'inline'; }\n" \
             "function UpdateButtonsState() { GetIndex() >= window.min_value && window.max_value ? ShowButtons() : HideButtons(); }\n" \
             "function ListHandler (iOptionValue) { if(iOptionValue==-1) { ShowAll(#count#); Hide(1); SetIndex(1); UpdateButtonsState(); return; } HideAll(#count#); Show(iOptionValue); SetIndex(iOptionValue > 1 ? iOptionValue : 1); UpdateButtonsState();}\n" \
             "function NextTest() { var index = GetIndex(); ListHandler ((index + 1 > window.max_value) ? (window.min_value) : (index + 1)); }\n" \
             "function PreviousTest() { var index = GetIndex(); ListHandler ((index - 1 < window.min_value) ? (window.max_value) : (index - 1)); }\n" \
             "function scrollFunction() { let topButton = document.getElementById('topBtn'); if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {topButton.style.display = 'block';} else {topButton.style.display = 'none';} }\n" \
             "function TopFunction() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0;}\n" \
             "function SaveConfig() { var jsonData = atob(base64Content[GetIndex()-2]); var blob = new Blob([jsonData], { type: 'application/json' }); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); var currentPageURL = window.location.href; var decodedURL = decodeURIComponent(currentPageURL); link.download = getText() + \".json\"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }\n"\
             "function getText() { var index = GetIndex(); let a = document.getElementById(\"testlist\");  let option = a.options[index]; return option.text.replace('/', '').replace('>', '').replace(':', '') }\n"\
             "</script>\n" \
             "</head>\n"

OptionListLine = "              <option value=\"#number#\"> #test_name# (#test_result#)</option>\n"

TestDescriptionLine = ("<tr><td><p class=\"TABLE_LINKS#ending#\"><a href=\"javascript:ListHandler(#handler_number#)\">"
                       "#test_group# / #test_name#</a></p></td><td align=\"center\"><p class=\"#SUCCESS#\">"
                       "&nbsp;#test_result#&nbsp;</p></td><td align=\"center\"><p class=\"ERROR_CODE\">&nbsp;#error#&nbsp;</p></td></tr>\n")

Tables = "<div id=\"ID1\">\n" \
         "<p class=\"BODYTEXT\">\n" \
         "<p class=\"SUBHEADING\" style=\"margin-left: 0; margin-top: " \
         "0;\">&nbsp;&nbsp;&nbsp;Summary of individual test runs</p>\n" \
         "<p class=\"BODYWARNINGS\">\n#warning#</p>\n" \
         "<table width=\"80%\"><colgroup><col span=\"1\" style=\"width: 85%;\"><col span=\"1\" style=\"width: 10%;\"><col span=\"1\" style=\"width: 5%;\"></colgroup>\n" \
         "<tr><th><p class=\"TABLE_HEADERS\">Test name</p></th><th><p class=\"TABLE_HEADERS\" style=\"margin-left: 0;\">Result</p></th><th><p class=\"TABLE_HEADERS\" style=\"margin-left: 0;\">Error</p></th></tr>\n" \
         "#test_description_lines#\n" \
         "</table>\n" \
         "#test_tables_list#\n"

DeviceDescription = "<p class=\"BODYTEXT\">\n" \
                    "Device: #device_name#\n" \
                    "<br>Firmware Package: #detailed_vdata#\n" \
                    "<br>UniTAP: #console_app_version#\n" \
                    "<br>Software Bundle: #console_bundle_version#\n" \
                    "<br>Frontend Info: #frontend_version#\n" \
                    "<br>Device total memory size: #memory_size#\n" \
                    "<br><br>Report generated: #date_time#<br>\n" \
                    "</p></p><p class=\"GREENSUBHEADING\">&nbsp;&nbsp;&nbsp;DUT<p class=\"BODYTEXT\">\n" \
                    "Device/Model name: #model_name#\n" \
                    "<br>HW Revision: #revision#\n" \
                    "<br>Serial number: #serial_number#\n" \
                    "<br>Firmware: #firmware_version#\n" \
                    "<br>Driver: #driver_version#\n" \
                    "<br><br>Testing conducted by: #conducted_by#\n" \
                    "<br><br>Remarks: #remarks#\n" \
                    "<p class=\"BODYDETAILTEXT\">\n"

TestTable = "<br><br></p></div><div id=\"ID#number#\">\n" \
            "<p class=\"SUBHEADING\" style=\"margin-left: 0; margin-top: 0;\">&nbsp;&nbsp;&nbsp;Test Details, Test #test_number#</p>\n" \
            "<p class=\"GREENSUBHEADING\">&nbsp;&nbsp;&nbsp;#test_name#</p>\n" \
            "<p class=\"BODYWARNINGS\">\n" \
            "#warning#</p>\n" \
            "<p class=\"BODYTEXT\">\n" \
            "Test Set: <b>#test_group#</b><br>\n" \
            "Test Result: <b>#result#</b>\n" \
            "<br><br><b>Test Settings:</b></p>\n" \
            "<p class=\"BODYTEXT\">\n" \
            "Delay between tests = #test_delay#ms\n<br>" \
            "#test_parameters#\n" \
            "</p><p class=\"GREENSUBHEADING\">&nbsp;&nbsp;&nbsp;Test Log</p><pre class=\"TESTBODY\">" \
            "#test_log#" \
            "\n"

ReportBody = "<body onload='ListHandler(0);'>\n" \
             "    <button class=\"TOPBUTTON\" onclick=\"TopFunction()\" id=\"topBtn\" title=\"Go to top\">&#8593;</button>\n" \
             "    <div><p class=\"HEADING\" id=\"top\">&nbsp;&nbsp;Unigraf Test Report</p></div>\n" \
             "    <div>\n" \
             "        <table class=\"DOCUMENT\" cellpadding=\"0\" cellspacing=\"0\">\n" \
             "            <colgroup>\n" \
             "                <col width=\"200\">\n" \
             "                <col width=\"*\">\n" \
             "            </colgroup>\n" \
             "            <td><p class=\"CONTENTS\">Select item to display</p></td>	\n" \
             "            <td><select id=\"testlist\" onchange=\"ListHandler (document.getElementById ('testlist').value)\" onkeyup=\"ListHandler (document.getElementById ('testlist').value)\"></span>\n" \
             "               <option value=\"0\">Report Summary</option>\n" \
             "               <option value=\"1\">Test Summary</option>\n" \
             "#optionList#\n" \
             "                    <option value=\"-1\">Show everything</option>\n" \
             "                </select>\n" \
             "            </td>\n" \
             "        </table>\n" \
             "<div id=\"top_buttons\" style='margin-left: 12'>\n" \
             "<button type=\"button\" onclick=\"PreviousTest()\">Previous</button>\n" \
             "<button type=\"button\" onclick=\"ListHandler(1)\">Summary</button>\n" \
             "<button type=\"button\" onclick=\"SaveConfig()\">Save Test Config</button>\n" \
             "<button type=\"button\" onclick=\"NextTest()\">Next</button>\n" \
             "<br>\n" \
             "</div>\n" \
             "<br>\n" \
             "<div id=\"ID0\">\n" \
             "<p class=\"SUBHEADING\" style=\"margin-left: 0; margin-top: 0;\">&nbsp;&nbsp;&nbsp;Report summary</p>\n" \
             "<p class=\"GREENSUBHEADING\">&nbsp;&nbsp;&nbsp;Unigraf device\n" \
             "#device_description#\n" \
             "</p></p></p><p class=\"GREENSUBHEADING\">&nbsp;&nbsp;&nbsp;Test results summary<p class=\"BODYWARNINGS\">\n#warning#</p>\n<p class=\"BODYTEXT\">\n" \
             "Total number of test runs: #runs#<br>Passed test runs: #passed#<br>Failed test runs: #failed#<br>Skipped test runs: #skipped#<br>Aborted test runs: #aborted#\n" \
             "<br></p></p></div>\n"

ReportFooter = "<br><br></pre></div>\n" \
               "<div id=\"bottom_buttons\" style='margin-left: 12'>\n" \
               "<button type=\"button\" onclick=\"PreviousTest()\">Previous</button>\n" \
               "<button type=\"button\" onclick=\"ListHandler(1)\">Summary</button>\n" \
               "<button type=\"button\" onclick=\"SaveConfig()\">Save Test Config</button>\n" \
               "<button type=\"button\" onclick=\"NextTest()\">Next</button>\n" \
               "</div>\n" \
               "</div>\n" \
               "    <hr>\n" \
               "    <p class=\"BODYTEXT\" style=\"text-align: center;\">\n" \
               "        Unigraf Oy<span style=\"color:#808080;\"> |</span> Piispantilankuja 4 <span style=\"color:#808080;\">|</span> 02240 Espoo <span style=\"color:#808080;\">|</span> Finland <span style=\"color:#808080;\">|</span> +358-9-859 550<br />\n" \
               "        E-mail: <a href=\"mailto:info@unigraf.fi\">info@unigraf.fi</a><span style=\"color:#808080;\"> " \
               "|</span> Web site: <a href=\"http://www.unigraf.fi\">www.unigraf.fi</a>\n" \
               "    </p>\n" \
               "</body>\n" \
               "</html>\n"
