Skip to content

Commit

Permalink
Dialog styles (openemr#7797)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sjpadgett authored Nov 12, 2024
1 parent a0cd2bd commit e049bf2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
6 changes: 4 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 2 additions & 2 deletions library/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
type: 'Alert',
sizeHeight: 'auto',
resolvePromiseOn: 'close',
html: '<p class="text-center">' + data + '</p>'
html: '<p class="text-center bg-light text-dark">' + data + '</p>'
});
}

Expand All @@ -62,7 +62,7 @@
type: 'Confirm',
resolvePromiseOn: 'confirm',
sizeHeight: 'auto',
html: '<p class="text-center">' + data + '</p>'
html: '<p class="text-center bg-light text-dark">' + data + '</p>'
});
}

Expand Down
38 changes: 26 additions & 12 deletions portal/sign/assets/signer_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div class='container text-center' id='signerAlertBox' style='" + style + "'></div>");
let mHtml = '<div id="alertMessage" class="alert alert-' + type + ' alert-dismissable">' +
'<button type="button" class="close btn btn-link btn-cancel" data-dismiss="alert" aria-hidden="true">&times;</button>' +
'<h5 class="alert-heading text-center">Alert!</h5><hr>' +
'<p>' + message + '</p>' +
'</div>';
$('#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(`
<div class="container text-center" id="signerAlertBox" style="${style}">
<div id="alertMessage" class="alert alert-${type} border border-dark alert-dismissible fade show" role="alert">
<div class="alert-heading bg-dark text-light text-center"><h5 class="p-0 pb-2 ">` + jsText('Alert Message!') + `</h5></div>
<p>${message}</p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
`);

$('#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);
}
Expand Down
10 changes: 7 additions & 3 deletions src/Services/LogoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @copyright Copyright (C) 2024 Open Plan IT Ltd. <[email protected]>
* @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']) }}
<style>
input[type="checkbox"],
input[type="radio"] {
Expand Down

0 comments on commit e049bf2

Please sign in to comment.