Skip to content

Commit

Permalink
Revamp document templates (openemr#4705)
Browse files Browse the repository at this point in the history
* Revamp document templates
- new template management service.

* php8 warning

* - Catching up with templates refactor and rework

* careful with new keyword and ci!

* third times a charm!

* more template management.

* fix config for jspdf dependency wrong path

* more refactor and features

* session write fixes

* add draganddrop to utility.js
review cleanup

* new DB table and default templates
some other changes to UX

* add help file

* change insert binary to hexadecimal notation
  • Loading branch information
sjpadgett authored Nov 22, 2021
1 parent 560d7f4 commit 22112dd
Show file tree
Hide file tree
Showing 27 changed files with 1,366 additions and 564 deletions.
56 changes: 56 additions & 0 deletions Documentation/help_files/template_maintenace_help.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* import_template.php
*
* @package OpenEMR
* @link https://www.open-emr.org
* @author Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2021 Jerry Padgett <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

?>

<div id='help-panel' class='container-fluid border-0 my-2 collapse'>
<div class='card'>
<div class='card-block bg-light px-2'>
<div class='card-title'><h5><?php echo xlt('In General'); ?></h5></div>
<div class='card-text px-1'>
<ul>
<li><?php echo xlt('The Scope toolbar is global to the entire form. It consists of Location, Category and action buttons. "Refresh" to clear Location selections, "Send" to send templates to patient(s), "Files" for uploading templates and a Submit to submit Location and Category current selections. By selecting location and or category, all the tables in the form will reflect those selection.'); ?></li>
<li><?php echo xlt('Additionally, to the right is a toggle to select if you want to use the pop out window or dialog editor. The window allows having multiple editors open at the same time where the dialog is more appropriate for making quick edits'); ?></li>
<li><?php echo xlt('Best practice is to select Location(s) then a Category for the location then click the appropriate action button.'); ?></li>
<li><?php echo xlt('There are three main template views. The first is the Repository where you can store templates for future edits and disposal. '); ?><?php echo xlt('Second is the All Patients. This View shows all current templates that are default to all patients.'); ?><?php echo xlt('Lastly is the view to show templates assigned to various patients.'); ?></li>
<li><?php echo xlt('Concerning the General category. After being assigned to an active view, the General template will always appear as a base template in portal Pending documents i.e no category and as Default in the dashboard view.'); ?></li>
<li><?php echo xlt('Once a template is uploaded, you may change the category at anytime from the repository view.'); ?></li>
</ul>
</div>
</div>
<div class='card-block bg-light px-2'>
<div class='card-title'><h5><?php echo xlt('Template Uploads'); ?></h5></div>
<div class='card-text px-1'>
<ul>
<li><?php echo xlt('To upload local text or html templates, select the destination Location(s), a Category then click Files to show the file browser. You may select as many files to upload with in reason'); ?>&nbsp;
<?php echo xlt('Eventually file name becomes a Pending document selection in Portal Documents.'); ?><br />
<em><?php echo xlt('For example: Privacy_Agreement.txt becomes "Privacy Agreement" button in Patient Documents.'); ?></em></li>
<li><?php echo xlt('While you may choose to upload directly to patient locations, it is best practice to upload to the repository then send to patients from there.'); ?></li>
<!--<li><?php /*echo xlt(''); */ ?></li>
<li><?php /*echo xlt(''); */ ?></li>
<li><?php /*echo xlt(''); */ ?></li>-->
</ul>
</div>
</div>
<div class='card-block bg-light px-2'>
<div class='card-title'><h5><?php echo xlt('Sending Templates'); ?></h5></div>
<div class='card-text px-1'>
<ul>
<li><?php echo xlt('To send template(s) to patient(s), simply select be patient(s) from the Location select then select the templates to send from the repository send check box.'); ?></li>
<li><?php echo xlt('Once a template has been selected, the Send button will show in the Scope toolbar. Click it to perform the action. A confirmation popup will then show on success or an error message otherwise.'); ?></li>
</ul>
</div>
</div>
<button type='button' data-toggle='collapse' data-target='#help-panel' class='btn btn-sm btn-secondary'><?php echo xlt('Dismiss'); ?></button>
</div>
<br />
</div>
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ assets:
script: jszip.min.js
jspdf:
basePath: '%assets_static_relative%/jspdf/dist/'
script: jspdf.min.js
script: jspdf.umd.min.js
dwv:
basePath: '%assets_static_relative%/dwv/'
script:
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

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'] ?? '')) {
$site_id = $_SERVER['HTTP_HOST'] ?? '';
} else {
$site_id = 'default';
}
Expand Down
52 changes: 50 additions & 2 deletions library/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
root.confirm = confirm;
root.closeAjax = closeAjax;
root.close = close;

root.popUp = popUp;
return root;

function ajax(data) {
Expand Down Expand Up @@ -66,6 +66,54 @@
});
}

/* popUp
* Borrowed from a CKEditor Source plugin and modified to suit my purpose.
* Licensed under the GPL 2 or greater.
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
function popUp( url, data, name, width, height) {
width = width || '80%'; height = height || '85%';

if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) === '%') {
width = parseInt(window.screen.width * parseInt(width, 10) / 100, 10);
}
if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) === '%') {
height = parseInt(window.screen.height * parseInt(height, 10) / 100, 10);
}
if ( width < 640 ) {
width = 640;
}
if ( height < 420 ) {
height = 420;
}
let top = parseInt(( window.screen.height - height ) / 2, 10);
let left = parseInt(( window.screen.width - width ) / 2, 10);

let options = ('location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes') +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;

let modalWindow = window.open('', name, options, true);
if ( !modalWindow ) {
return false;
}
try {
modalWindow.focus();
if (data) {
modalWindow.document.body.innerHTML = data;
} else {
modalWindow.location.href = url;
}
} catch ( e ) {
window.open(url, null, options, true);
}

return true;
}

function closeAjax() {
dlgCloseAjax();
}
Expand Down Expand Up @@ -462,7 +510,7 @@ function dlgopen(url, winname, width, height, forceNewWindow, title, opts) {
onClosed: false,
allowExternal: false, // allow a dialog window to a URL that is external to the current url
callBack: false, // use {call: 'functionName, args: args, args} if known or use dlgclose.
resolvePromiseOn: '' // this may be useful values are init, shown, show, confirm, alert and closed which coincide with dialog events.
resolvePromiseOn: '' // this may be useful. values are init, shown, show, confirm, alert and closed which coincide with dialog events.
};

if (!opts) {
Expand Down
Loading

0 comments on commit 22112dd

Please sign in to comment.