Skip to content

Commit

Permalink
issue_811: Upgraded Jquery, upgraded datatables, deleted older datata…
Browse files Browse the repository at this point in the history
…bles file, replaced var with let in other script tags, currently figuring out how to upgrade bootstrap.
  • Loading branch information
ThatSilentCoder committed Feb 25, 2025
1 parent 93b7145 commit a174d84
Show file tree
Hide file tree
Showing 282 changed files with 159,029 additions and 40,703 deletions.
18 changes: 9 additions & 9 deletions HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/banner.tag
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<link type="text/css" rel="stylesheet" href="${common}/banner.css"/>
<script>
$(document).ready(function(){
var headerHeight = $('#header').height();
var topBannerHeight = $(".topBanner").height();
let headerHeight = $('#header').height();
let topBannerHeight = $(".topBanner").height();
//Add margins
$('body').css({'padding-top': headerHeight + topBannerHeight });
Expand All @@ -26,23 +26,23 @@
function setHeights(){
//Set bannerColor
var bannerColor = "${banner.bannerColor}";
let bannerColor = "${banner.bannerColor}";
$('.bannerColor').css({'background-color': bannerColor});
//get basic heights
var mainHeight = $('.main, .main-without-navigation').height();
var contentHeight = $('.content').height();
var spacerHeight = $('.spacer').height() + $('.extra-spacer').height();
var bottomBannerHeight = $(".bottomBanner").height() + $(".bottomBannerInfo").height();
var pageHeaderHeight = $('.page-header').height() +
let mainHeight = $('.main, .main-without-navigation').height();
let contentHeight = $('.content').height();
let spacerHeight = $('.spacer').height() + $('.extra-spacer').height();
let bottomBannerHeight = $(".bottomBanner").height() + $(".bottomBannerInfo").height();
let pageHeaderHeight = $('.page-header').height() +
parseInt($('.page-header').css('margin-top').replace('px', '')) +
parseInt($('.page-header').css('margin-bottom').replace('px', '')) +
parseInt($('.page-header').css('padding-top').replace('px', '')) +
parseInt($('.page-header').css('padding-bottom').replace('px', '')) +
parseInt($('.page-header').css('border-bottom-width').replace('px', '')) + 1;
//Current total
var totalHeight = pageHeaderHeight + contentHeight + spacerHeight + bottomBannerHeight;
let totalHeight = pageHeaderHeight + contentHeight + spacerHeight + bottomBannerHeight;
//Check if there is still space
if(mainHeight > totalHeight) {
Expand Down
12 changes: 6 additions & 6 deletions HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/page.tag
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@
<link type="text/css" rel="stylesheet" href="${common}/sidebar.css"/>

<link type="text/css" rel="stylesheet" href="${lib}/bootstrap-3.3.7/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="${lib}/jquery.dataTables-1.10.13/media/css/jquery.dataTables.min.css" />
<link type="text/css" rel="stylesheet" href="${lib}/jquery.dataTables-2.2.2/media/css/datatables.min.css" />

<%-- page-specific style --%>
<jsp:invoke fragment="style"/>

<%-- SCRIPTS --%>
<script type="text/javascript" src="${lib}/jquery/jquery-3.6.2.min.js"></script>
<script type="text/javascript" src="${lib}/jquery.dataTables-1.10.13/media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${lib}/jquery/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="${lib}/jquery.dataTables-2.2.2/media/js/datatables.min.js"></script>
<script type="text/javascript" src="${lib}/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${lib}/moment.min.js"></script>
<script type="text/javascript" src="${common}/date.js"></script>
<script type="text/javascript" src="${common}/common.js"></script>

<script>
//Set global variables
var portal = '${portal}';
var pagePath = '${pagePath}';
var icons = '${icons}';
let portal = '${portal}';
let pagePath = '${pagePath}';
let icons = '${icons}';
</script>

<%-- page-specific script --%>
Expand Down
139 changes: 72 additions & 67 deletions HIRS_AttestationCAPortal/src/main/webapp/common/common.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
//Convert a byte to HEX
function byteToHexString(arr){
var str = "";
$.each(arr, function(index, value){
/**
* Converts a byte to HEX.
*/
function byteToHexString(arr) {
let str = "";
$.each(arr, function (index, value) {
str += ('0' + (value & 0xFF).toString(16)).slice(-2) + ":​";
});
return (str.substring(0, str.length - 2)).toUpperCase();
}

//Parse hex string for display
/**
Parses hex string for display.
*/
function parseHexString(hexString) {
var str = hexString.toUpperCase();
let str = hexString.toUpperCase();
//Do not parse if there is 2 characters
if(str.length === 2) {
if (str.length === 2) {
return str;
}
return str.match(/.{2}/g).join(':​');
}

//Parse the HEX string value to display as byte hex string
function parseSerialNumber(hexString){
var str = hexString.toUpperCase();
if(str.length % 2 !== 0) {
/**
* Parses the HEX string value to display as byte hex string.
*/
function parseSerialNumber(hexString) {
let str = hexString.toUpperCase();
if (str.length % 2 !== 0) {
str = '0' + hexString;
}
//Do not parse if there is 2 characters
if(str.length === 2) {
if (str.length === 2) {
return str;
}
//Parse and return
Expand All @@ -38,9 +44,9 @@ function parseSerialNumber(hexString){
* a POST call to delete the credential.
*/
function handleDeleteRequest(id) {
if (confirm("Delete certificate?")) {
$('#deleteForm' + id).submit();
}
if (confirm("Delete certificate?")) {
$('#deleteForm' + id).submit();
}
}

/**
Expand All @@ -49,9 +55,9 @@ function handleDeleteRequest(id) {
* a POST call to delete the reference integrity manifest.
*/
function handleRimDeleteRequest(id) {
if (confirm("Delete RIM?")) {
$('#deleteForm' + id).submit();
}
if (confirm("Delete RIM?")) {
$('#deleteForm' + id).submit();
}
}

/**
Expand All @@ -63,7 +69,7 @@ function handleRimDeleteRequest(id) {
*
*/
function setDataTables(id, url, columns) {
var dtable = $(id).DataTable({
let dtable = $(id).DataTable({
processing: true,
serverSide: true,
ajax: {
Expand All @@ -87,21 +93,21 @@ function setDataTables(id, url, columns) {
* @param sameType boolean indicating if the details is the same
* certificate type.
*/
function certificateDetailsLink(type, id, sameType){
var href = portal + '/certificate-details?id=' + id + '&type=' + type;
var title = "";
var icon = icons;
function certificateDetailsLink(type, id, sameType) {
let href = portal + '/certificate-details?id=' + id + '&type=' + type;
let title = "";
let icon = icons;

//If the details is the same certificate type use assignment icon,
//otherwise use the icon for the certificate type.
if(sameType){
title = "Details";
if (sameType) {
title = "Details";
icon += '/ic_assignment_black_24dp.png';
} else {
switch(type){
switch (type) {
case "issued":
icon += "/ic_library_books_black_24dp.png";
title="View Issued Attestation Certificate Details"
title = "View Issued Attestation Certificate Details"
break;
case "platform":
icon += "/ic_important_devices_black_24dp.png";
Expand All @@ -117,8 +123,8 @@ function certificateDetailsLink(type, id, sameType){
break;
}
}
var html = '<a href=' + href + '>'
+ '<img src="' + icon + '" title="' + title + '"></a>';
let html = '<a href=' + href + '>'
+ '<img src="' + icon + '" title="' + title + '"></a>';
return html;
}

Expand All @@ -127,16 +133,16 @@ function certificateDetailsLink(type, id, sameType){
* type and ID with the corresponding icon.
* @param id of the rim
*/
function rimDetailsLink(id){
var href = portal + '/rim-details?id=' + id;
var title = "";
var icon = icons;
function rimDetailsLink(id) {
let href = portal + '/rim-details?id=' + id;
let title = "";
let icon = icons;

title = "Details";
title = "Details";
icon += '/ic_assignment_black_24dp.png';

var html = '<a href=' + href + '>'
+ '<img src="' + icon + '" title="' + title + '"></a>';
let html = '<a href=' + href + '>'
+ '<img src="' + icon + '" title="' + title + '"></a>';
return html;
}

Expand All @@ -145,14 +151,14 @@ function rimDetailsLink(id){
* @param id of the certificate
* @param pagePath path to the link
*/
function certificateDeleteLink(id, pagePath){
var icon = icons + '/ic_delete_black_24dp.png';
var formURL = pagePath + "/delete";

var html = '<a href="#!" onclick="handleDeleteRequest(\'' + id + '\')">'
+ '<img src="' + icon + '" title="Delete"></a>'
+ '<form id="deleteForm' + id + '" action="' + formURL + '" method="post">'
+ '<input name="id" type="hidden" value="' + id + '"></form>';
function certificateDeleteLink(id, pagePath) {
let icon = icons + '/ic_delete_black_24dp.png';
let formURL = pagePath + "/delete";

let html = '<a href="#!" onclick="handleDeleteRequest(\'' + id + '\')">'
+ '<img src="' + icon + '" title="Delete"></a>'
+ '<form id="deleteForm' + id + '" action="' + formURL + '" method="post">'
+ '<input name="id" type="hidden" value="' + id + '"></form>';
return html;
}

Expand All @@ -161,14 +167,14 @@ function certificateDeleteLink(id, pagePath){
* @param id of the RIM
* @param pagePath path to the link
*/
function rimDeleteLink(id, pagePath){
var icon = icons + '/ic_delete_black_24dp.png';
var formURL = pagePath + "/delete";

var html = '<a href="#!" onclick="handleRimDeleteRequest(\'' + id + '\')">'
+ '<img src="' + icon + '" title="Delete"></a>'
+ '<form id="deleteForm' + id + '" action="' + formURL + '" method="post">'
+ '<input name="id" type="hidden" value="' + id + '"></form>';
function rimDeleteLink(id, pagePath) {
let icon = icons + '/ic_delete_black_24dp.png';
let formURL = pagePath + "/delete";

let html = '<a href="#!" onclick="handleRimDeleteRequest(\'' + id + '\')">'
+ '<img src="' + icon + '" title="Delete"></a>'
+ '<form id="deleteForm' + id + '" action="' + formURL + '" method="post">'
+ '<input name="id" type="hidden" value="' + id + '"></form>';
return html;
}

Expand All @@ -177,12 +183,12 @@ function rimDeleteLink(id, pagePath){
* @param id of the certificate
* @param pagePath path to the link
*/
function certificateDownloadLink(id, pagePath){
var icon = icons + '/ic_file_download_black_24dp.png';
var href = pagePath + '/download?id=' + id;
var html = '<a href="' + href + '">'
+ '<img src="' + icon + '" title="Download Certificate"></a>';
function certificateDownloadLink(id, pagePath) {
let icon = icons + '/ic_file_download_black_24dp.png';
let href = pagePath + '/download?id=' + id;

let html = '<a href="' + href + '">'
+ '<img src="' + icon + '" title="Download Certificate"></a>';

return html;
}
Expand All @@ -192,12 +198,12 @@ function certificateDownloadLink(id, pagePath){
* @param id of the rim
* @param pagePath path to the link
*/
function rimDownloadLink(id, pagePath){
var icon = icons + '/ic_file_download_black_24dp.png';
var href = pagePath + '/download?id=' + id;
var html = '<a href="' + href + '">'
+ '<img src="' + icon + '" title="Download Reference Integrity Manifest"></a>';
function rimDownloadLink(id, pagePath) {
let icon = icons + '/ic_file_download_black_24dp.png';
let href = pagePath + '/download?id=' + id;

let html = '<a href="' + href + '">'
+ '<img src="' + icon + '" title="Download Reference Integrity Manifest"></a>';

return html;
}
Expand All @@ -207,10 +213,9 @@ function rimDownloadLink(id, pagePath){
* @param date to format
*/
function formatCertificateDate(dateText) {
var date = +dateText; // Convert to numeric
let date = +dateText; // Convert to numeric

if (date == 253402300799000)
{
if (date == 253402300799000) {
return 'Indefinite';
}

Expand Down
10 changes: 5 additions & 5 deletions HIRS_AttestationCAPortal/src/main/webapp/common/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* Requires moment.js
*/

var dateTimeOutputFormat = "YYYY-MM-DD HH:mm:ss";
let dateTimeOutputFormat = "YYYY-MM-DD HH:mm:ss";

var dateInputFormat = ["YYYY-MM-DD","YYYY/MM/DD","MM-DD-YYYY","MM/DD/YYYY"];
var dateOutputFormat = "YYYY-MM-DD";
let dateInputFormat = ["YYYY-MM-DD","YYYY/MM/DD","MM-DD-YYYY","MM/DD/YYYY"];
let dateOutputFormat = "YYYY-MM-DD";

var timeInputFormat = "HH:mm:ss.SSS";
var timeOutputFormat = "HH:mm";
let timeInputFormat = "HH:mm:ss.SSS";
let timeOutputFormat = "HH:mm";

function parseDate(dt, inputFormat) {
return moment(dt, inputFormat);
Expand Down
Loading

0 comments on commit a174d84

Please sign in to comment.