Skip to content

Commit

Permalink
Merge branch 'rc/2024-12-19/Sprint-86-c2' into feature/LEAF-4581/exte…
Browse files Browse the repository at this point in the history
…nded-character-sets
  • Loading branch information
shaneodd authored Dec 19, 2024
2 parents e710967 + 3dc416d commit 1aae9e4
Show file tree
Hide file tree
Showing 44 changed files with 1,615 additions and 663 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ name: CodeQL
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
schedule:
- cron: 1 21 * * 2
workflow_dispatch: null
Expand Down
28 changes: 28 additions & 0 deletions LEAF_Nexus/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,32 @@
#editor_tools>span:hover {
background-color: #2372b0;
color: white;
}

#visual_alert_box_container {
max-width: 354px;
box-sizing: border-box;
margin-left: auto;
}
#visual_alert_box {
text-align: left;
position: relative;
padding: 0.25em;
background-color:#fff;
}
#visual_alert_box_container label {
display: flex;
justify-content:flex-end;
padding-top: 0.25rem;
}
#visual_alert_box.hide, #visual_alert_box_container label.hide {
display: none;
}

#visual_alert_box_container label input {
margin: 0 0 0 0.25rem;
}

#visual_alert_box_title {
font-weight: bolder;
}
3 changes: 3 additions & 0 deletions LEAF_Nexus/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
Date: September 11, 2007
*/
/*
* test comment for 4583
*/

use App\Leaf\XSSHelpers;

Expand Down
3 changes: 2 additions & 1 deletion LEAF_Nexus/js/ui/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ position.prototype.initialize = function (parentContainerID) {
$("#" + prefixedPID + "_title").on("click keydown mouseenter", function(ev) {
//if they are newly focusing an open card just update the tab focus
const isNewFocus = document.activeElement !== ev.currentTarget;
if (ev.type === "click" && isNewFocus) {
const cardDataAttr = ev.currentTarget.parentNode.getAttribute('data-moving');
if (ev.type === "click" && isNewFocus || cardDataAttr === "true") {
ev.currentTarget.focus();
return;
}
Expand Down
102 changes: 66 additions & 36 deletions LEAF_Nexus/templates/editor.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ placeholder<br />
<button type="button" class="buttonNorm" onclick="window.location='mailto:?subject=FW:%20Org.%20Chart%20-%20&amp;body=Organizational%20Chart%20URL:%20<!--{if $smarty.server.HTTPS == on}-->https<!--{else}-->http<!--{/if}-->://<!--{$smarty.server.SERVER_NAME}--><!--{$smarty.server.REQUEST_URI|escape:'url'}-->%0A%0A'">
<img src="dynicons/?img=mail-forward.svg&amp;w=24" style="vertical-align: middle" alt="" /> Forward as Email
</button>
<div id="visual_alert_box_container">
<div id="visual_alert_box" class="hide">
You are moving the <span id="visual_alert_box_title"></span> card<br />
Esc - return to original location<br />
Enter - save current location
</div>
<label for="MovementInfoToggle" class="hide">Hide Movement Info
<input type="checkbox" id="MovementInfoToggle" onchange="toggleHideClass('visual_alert_box')">
</label>
</div>
</span>
</span>
<div id="visual_alert_box" role="status" aria-live="assertive" aria-label="" style="position:absolute;opacity:0; z-index:999;background:#fff"></div>

<div id="pageloadIndicator" style="visibility: visible">
<div style="opacity: 0.8; z-index: 1000; position: absolute; background: #f3f3f3; height: 97%; width: 97%"></div>
<div style="z-index: 1001; position: absolute; padding: 16px; width: 97%; text-align: center; font-size: 24px; font-weight: bold; background-color: white">Loading... <img src="images/largespinner.gif" alt="" /></div>
Expand Down Expand Up @@ -120,6 +130,17 @@ function applyZoomLevel() {
}
}
function toggleHideClass( elementID = '') {
let el = document.getElementById(elementID);
if(el !== null) {
if(el.classList.contains('hide')) {
el.classList.remove('hide');
} else {
el.classList.add('hide');
}
}
}
function viewSupervisor() {
$.ajax({
url: './api/position/<!--{$rootID}-->/supervisor',
Expand All @@ -134,7 +155,7 @@ function viewSupervisor() {
});
}
function saveLayout(positionID) {
function saveLayout(positionID, repaint = false) {
const position = $('#' + positions[positionID].getDomID()).offset();
let newPosition = new Object();
newPosition.x = parseInt(position.left);
Expand All @@ -153,6 +174,9 @@ function saveLayout(positionID) {
if (+res === 1) {
positions[positionID].x = newPosition.x;
positions[positionID].y = newPosition.y;
if(repaint === true) {
jsPlumb.repaintEverything();
}
}
$('#busyIndicator').css('visibility', 'hidden');
},
Expand Down Expand Up @@ -259,72 +283,78 @@ function addSupervisor(positionID) {
}
function moveCoordinates(prefix, position) {
let card = document.getElementById(prefix + position);
const cardStyle = window.getComputedStyle(card);
const originalTopOrg = cardStyle.getPropertyValue('top');
const originalLeftOrg = cardStyle.getPropertyValue('left');
const moveCard = (e) => {
if (e.key === "Tab") {
saveLayout(position);
saveLayout(position, true);
$('#' + prefix + position).css('box-shadow', 'none');
$('#visual_alert_box').css('opacity', '0');
$('#visual_alert_box').addClass('hide');
document.removeEventListener('keydown', moveCard);
return;
} else if (controlKeys.includes(e.key)) {
e.preventDefault();
const cardStyle = window.getComputedStyle(card);
const topValue = Number(cardStyle.getPropertyValue('top').replace("px", ""));
const leftValue = Number(cardStyle.getPropertyValue('left').replace("px", ""));
//only show extra info if keyboard is being used to move the card
if(['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(e.key)) {
card.setAttribute("data-moving", "true");
if( $('#visual_alert_box_container label').hasClass('hide')) {
$('#visual_alert_box_container label').removeClass('hide');
$('#visual_alert_box').removeClass('hide');
} else {
if(document.getElementById('MovementInfoToggle').checked !== true) {
$('#visual_alert_box').removeClass('hide');
}
}
} else {
card.removeAttribute("data-moving");
}
switch (e.key) {
case "ArrowLeft":
leftValue = (Number(leftValue) - 10);
card.style.left = leftValue + "px";
card.style.left = leftValue - 10 + "px";
break;
case "ArrowRight":
leftValue = (Number(leftValue) + 10);
card.style.left = leftValue + "px";
card.style.left = leftValue + 10 + "px";
break;
case "ArrowUp":
topValue = (Number(topValue) - 10);
card.style.top = topValue + "px";
card.style.top = topValue - 10 + "px";
break;
case "ArrowDown":
topValue = (Number(topValue) + 10);
card.style.top = topValue + "px";
card.style.top = topValue + 10 + "px";
break;
case "Enter":
// save the coordinates as they are now
saveLayout(position);
abort = true;
saveLayout(position, true);
break;
case "Escape":
// revert coordinates back to original
card.style.top = topOrg;
card.style.left = leftOrg;
abort = true;
card.style.top = originalTopOrg;
card.style.left = originalLeftOrg
$('#' + prefix + position).css('box-shadow', 'none');
$('#visual_alert_box').addClass('hide');
document.removeEventListener('keydown', moveCard);
break;
}
if (abort) {
$('#' + prefix + position).css('box-shadow', 'none');
$('#visual_alert_box').css('opacity', '0');
document.removeEventListener('keydown', moveCard);
return;
}
}
};
$('div.positionSmall').css('box-shadow', 'none');
$('#' + prefix + position).css('box-shadow', ' 0 0 6px #c00');
let alert_box = document.getElementById('visual_alert_box');
let alert_box_card_title = document.getElementById('visual_alert_box_title');
let title = document.getElementById(prefix + position + '_title');
let titleText = title.innerHTML;
alert_box.innerHTML = "You are moving the " + titleText + " card<br />Esc - return to original location<br />Enter - save current location<br />Tab - Save and move to next card";
$('#visual_alert_box').css('opacity', '100');
alert_box_card_title.textContent = titleText;
let card = document.getElementById(prefix + position);
let cardStyle = window.getComputedStyle(card);
let topOrg = cardStyle.getPropertyValue('top');
let leftOrg = cardStyle.getPropertyValue('left');
let topValue = cardStyle.getPropertyValue('top').replace("px", "");
let leftValue = cardStyle.getPropertyValue('left').replace("px", "");
let key;
let abort = false;
const controlKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Enter', 'Escape'];
document.addEventListener('keydown', moveCard);
title.addEventListener('blur', () => document.removeEventListener('keydown', moveCard));
title.addEventListener('blur', () => {
card.removeAttribute("data-moving");
document.removeEventListener('keydown', moveCard)
});
}
function addSubordinate(parentID) {
Expand Down
1 change: 1 addition & 0 deletions LEAF_Request_Portal/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function hasDevConsoleAccess($login, $oc_db)
$main->assign('logo', '<img src="../images/VA_icon_small.png" alt="VA seal, U.S. Department of Veterans Affairs" />');

$t_login->assign('name', $login->getName());
$main->assign('display_name', $login->getName());

$qrcodeURL = "https://" . HTTP_HOST . $_SERVER['REQUEST_URI'];
$main->assign('qrcodeURL', urlencode($qrcodeURL));
Expand Down
5 changes: 4 additions & 1 deletion LEAF_Request_Portal/admin/templates/main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
{/if}

<header id="header" class="usa-header site-header">
<div class="usa-navbar site-header-navbar">
<div class="usa-navbar site-header-navbar" style="position:relative;">
<div class="usa-logo site-logo" id="logo">
<em class="usa-logo__text">
<a tabindex="0" onclick="window.location='./'" title="Admin Home" class="leaf-cursor-pointer">
Expand All @@ -78,6 +78,9 @@
<div><img class="print nodisplay" style="width: 72px" src="{$abs_portal_path}/qrcode/?encode={$qrcodeURL}" alt="QR code" /></div>
{/if}
</div>
<div style="position:absolute;right:0;top:0;padding:0 0.75rem;font-size:14px;">
Welcome, <b>{$display_name|sanitize}</b>! | <a href="../?a=logout" style="color:#00bde3">Sign out</a>
</div>
<div class="leaf-header-right">
{$emergency}<!--{$login}-->
<nav aria-label="main menu" id="nav">{$menu}</nav>
Expand Down
33 changes: 0 additions & 33 deletions LEAF_Request_Portal/admin/templates/menu.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@

</li>

<li class="leaf-width-4rem leaf-mob-menu lev2">
<a href="javascript:void(0);" aria-label="user account menu" aria-expanded="false" role="button"
aria-controls="user_account_menu"><i class='fas fa-user-circle leaf-usericon'></i></a>
<ul class="leaf-usernavmenu" id="user_account_menu">
<li tabindex="0" style="padding-left:0.4rem;">User:<br/><span class="leaf-user-menu-name">{$name}</span></li>
<li tabindex="0" style="padding-left:0.4rem;">Primary Admin:<br/><span id="primary-admin" class="leaf-user-menu-name"></span></li>
<li><a href="../?a=logout">Sign Out</a></li>
</ul>
</li>

</ul>

<script>
Expand Down Expand Up @@ -221,26 +211,3 @@ $('li:has(ul)').on('mouseover click mouseleave focusout', function(e) {
});
</script>

<script type="text/javascript">
$.ajax({
url: "../api/system/primaryadmin",
dataType: "json",
success: function(response) {
const emailString = response['Email'] != '' ? ' - <br><a href="mailto:' + response['Email'] + '" style="padding:0">' + response['Email'] + '</a>' : '';
if(response["Fname"] !== undefined)
{
$('#primary-admin').html(response['Fname'] + " " + response['Lname'] + emailString);
}
else if(response["userName"] !== undefined)
{
$('#primary-admin').html(response['userName']);
}
else
{
$('#primary-admin').html('Not Set');
}
}
});
</script>
19 changes: 14 additions & 5 deletions LEAF_Request_Portal/admin/templates/mod_workflow.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2087,11 +2087,11 @@
routes = res;
if (endPoints[-1] == undefined) {
endPoints[-1] = jsPlumb.addEndpoint('step_-1', {anchor: 'Continuous'}, endpointOptions);
jsPlumb.draggable('step_-1');
jsPlumb.draggable('step_-1', { allowNegative: false });
}
if (endPoints[0] == undefined) {
endPoints[0] = jsPlumb.addEndpoint('step_0', {anchor: 'Continuous'}, endpointOptions);
jsPlumb.draggable('step_0');
jsPlumb.draggable('step_0', { allowNegative: false });
}
// draw connector
Expand Down Expand Up @@ -2249,14 +2249,22 @@
type: 'GET',
url: '../api/workflow/' + workflowID,
success: function(res) {
var minY = 80;
var maxY = 80;
const minY = 80;
const minX = 0;
let maxY = 80;
let posY = 0;
let posX = 0;
for (let i in res) {
steps[res[i].stepID] = res[i];
posY = parseFloat(res[i].posY);
posX = parseFloat(res[i].posX);
if (posY < minY) {
posY = minY;
}
if (posX < minX) {
posX = minX;
}
let emailNotificationIcon = '';
if (typeof res[i].stepData == 'string' && isJSON(res[i].stepData)) {
Expand All @@ -2279,14 +2287,15 @@
);
$('#step_' + res[i].stepID).css({
'left': parseFloat(res[i].posX) + 'px',
'left': posX + 'px',
'top': posY + 'px',
'background-color': res[i].stepBgColor
});
if (endPoints[res[i].stepID] == undefined) {
endPoints[res[i].stepID] = jsPlumb.addEndpoint('step_' + res[i].stepID, {anchor: 'Continuous'}, endpointOptions);
jsPlumb.draggable('step_' + res[i].stepID, {
allowNegative: false,
// save position of the box when moved
stop: function(stepID) {
return function() {
Expand Down
2 changes: 1 addition & 1 deletion LEAF_Request_Portal/ajaxJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// this method does not exist in Form class
// echo $form->getProgressJSON($_GET['recordID']);
// but this one does
echo $form->getProgress($_GET['recordID']);
echo $form->getProgress((int)$_GET['recordID']);

break;
case 'getrecentactions':
Expand Down
2 changes: 1 addition & 1 deletion LEAF_Request_Portal/api/controllers/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function get($act)
});

$this->index['GET']->register('form/[digit]/progress', function ($args) use ($form) {
$return = $form->getProgress($args[0]);
$return = $form->getProgress((int)$args[0]);
return $return;
});

Expand Down
Loading

0 comments on commit 1aae9e4

Please sign in to comment.