From e049bf2daab53f754ed5b5c06679c81bae28a770 Mon Sep 17 00:00:00 2001 From: Jerry Padgett Date: Tue, 12 Nov 2024 14:05:30 -0500 Subject: [PATCH] Dialog styles (#7797) * Dialog styles Add style to dialog Alert and Confirm * Add missing portal-theme to custom reports. * fix following warnings [06-Nov-2024 10:48:26 America/New_York] PHP Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\openemr\index.php on line 12 [06-Nov-2024 12:46:07 America/New_York] You must call one of in() or append() methods before iterating over a Finder. * fix double x out alert in signer_api * add back fade out --- index.php | 6 ++- library/dialog.js | 4 +- portal/sign/assets/signer_api.js | 38 +++++++++++++------ src/Services/LogoService.php | 10 +++-- .../reports/patient_report/_head.html.twig | 2 +- 5 files changed, 40 insertions(+), 20 deletions(-) diff --git a/index.php b/index.php index ba6c24ce746..1f5ad001690 100644 --- a/index.php +++ b/index.php @@ -7,10 +7,12 @@ // Set the site ID if required. This must be done before any database // access is attempted. +$site_id = ''; + if (!empty($_GET['site'])) { $site_id = $_GET['site']; -} elseif (is_dir("sites/" . $_SERVER['HTTP_HOST'] ?? '')) { - $site_id = $_SERVER['HTTP_HOST'] ?? ''; +} elseif (is_dir("sites/" . ($_SERVER['HTTP_HOST'] ?? 'default'))) { + $site_id = ($_SERVER['HTTP_HOST'] ?? 'default'); } else { $site_id = 'default'; } diff --git a/library/dialog.js b/library/dialog.js index 64db046ac18..dbc25079a55 100644 --- a/library/dialog.js +++ b/library/dialog.js @@ -46,7 +46,7 @@ type: 'Alert', sizeHeight: 'auto', resolvePromiseOn: 'close', - html: '

' + data + '

' + html: '

' + data + '

' }); } @@ -62,7 +62,7 @@ type: 'Confirm', resolvePromiseOn: 'confirm', sizeHeight: 'auto', - html: '

' + data + '

' + html: '

' + data + '

' }); } diff --git a/portal/sign/assets/signer_api.js b/portal/sign/assets/signer_api.js index 6bbe8d0aee8..e653b5da520 100644 --- a/portal/sign/assets/signer_api.js +++ b/portal/sign/assets/signer_api.js @@ -35,23 +35,37 @@ if (typeof cuser === 'undefined') { } function signerAlertMsg(message, timer = 5000, type = 'danger', size = '') { + // Remove any existing alert box $('#signerAlertBox').remove(); - size = (size == 'lg') ? 'left:25%;width:50%;' : 'left:35%;width:30%;'; - let style = "position:fixed;top:25%;" + size + " bottom:0;z-index:1020;z-index:5000"; - $("body").prepend("
"); - let mHtml = '
' + - '' + - '
Alert!

' + - '

' + message + '

' + - '
'; - $('#signerAlertBox').append(mHtml); + + // Set width and positioning based on size lg parameter + const alertWidth = size === 'lg' ? '50%' : '30%'; + const alertLeft = size === 'lg' ? '25%' : '35%'; + const style = `position:fixed;left:${alertLeft};width:${alertWidth};z-index:5000;`; + + if (type === 'alert-error') { + type = 'danger'; + } + $("body").prepend(` +
+ +
+ `); + $('#alertMessage').on('closed.bs.alert', function () { clearTimeout(AlertMsg); $('#signerAlertBox').remove(); }); - let AlertMsg = setTimeout(function () { - $('#alertMessage').fadeOut(800, function () { - $('#signerAlertBox').remove(); + + const AlertMsg = setTimeout(function () { + $('#alertMessage').fadeOut(950, function () { + $('#alertMessage').alert('close'); }); }, timer); } diff --git a/src/Services/LogoService.php b/src/Services/LogoService.php index c2a2c0658eb..cc5b6d5a88b 100644 --- a/src/Services/LogoService.php +++ b/src/Services/LogoService.php @@ -83,7 +83,7 @@ public function getLogo(string $type, string $filename = "logo.*"): string $logo = ""; } - // This is critical, the finder must be completely reinstantiated to ensure the proper directories are searched next time. + // This is critical, the finder must be completely re-instantiated to ensure the proper directories are searched next time. $this->resetFinder(); return $this->convertToWebPath($logo); @@ -113,13 +113,17 @@ private function convertToWebPath(string $path): string * By default, will search in the directory array for any file named "logo" (extension agnostic). If found, only * the last file found will be returned. By default, will append a query string for time modified to cache bust. * - * @param array $directory Array of directories to search - * @param string $filename File to look for + * @param array $directory Array of directories to search + * @param string $filename File to look for * @param boolean $timestamp Will return with a query string of the last modified time * @return string|null String of real path or null if no file found */ private function findLogo(array $directory, string $filename = 'logo.*', $timestamp = true): string { + if (empty($directory)) { + return ""; + } + $this->finder->files()->in($directory)->name($filename); if ($this->finder->hasResults()) { diff --git a/templates/portal/partial/reports/patient_report/_head.html.twig b/templates/portal/partial/reports/patient_report/_head.html.twig index d9d3c1c1eeb..e68403647a6 100644 --- a/templates/portal/partial/reports/patient_report/_head.html.twig +++ b/templates/portal/partial/reports/patient_report/_head.html.twig @@ -9,7 +9,7 @@ * @copyright Copyright (C) 2024 Open Plan IT Ltd. * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 #} -{{ setupHeader(['textformat', 'datetime-picker','datetime-picker-translated']) }} +{{ setupHeader(['no_main-theme', 'portal-theme', 'textformat', 'datetime-picker','datetime-picker-translated']) }}