forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fax Custom Module Support (openemr#2658)
* Fax Custom Module Support - add dispatch events to patient documents for fax send. - New patient documents event class * - path fix - use organize * - custom report fax support - dialog grab focus not supported any longer(crosssite etc) - fix alertMsg dialog * - add fax enable/disable to key areas - menu enable is in bootstrap * - Revert document dispatcher event for fax button * - new smarty plugin to make event dispatcher work * - normalized directory separators
- Loading branch information
Showing
9 changed files
with
172 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,10 @@ | |
* @link http:https://www.open-emr.org | ||
* @author Brady Miller <[email protected]> | ||
* @copyright Copyright (c) 2017-2018 Brady Miller <[email protected]> | ||
* @author Stephen Nielson <[email protected]> | ||
* @copyright Copyright (c) 2019 Stephen Nielson <[email protected]> | ||
* @author Jerry Padgett <[email protected]> | ||
* @copyright Copyright (c) 2019 Jerry Padgett <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
|
@@ -34,6 +38,7 @@ | |
$auth_med = acl_check('patients', 'med'); | ||
$auth_demo = acl_check('patients', 'demo'); | ||
|
||
$oefax = !empty($GLOBALS['oefax_enable']) ? $GLOBALS['oefax_enable'] : 0; | ||
/** | ||
* @var EventDispatcherInterface $eventDispatcher The event dispatcher / listener object | ||
*/ | ||
|
@@ -268,7 +273,9 @@ function show_date_fun(){ | |
<button type="button" class="genportal btn btn-default btn-send-msg btn-sm" value="<?php echo xla('Send to Portal'); ?>" ><?php echo xlt('Send to Portal'); ?></button> | ||
<?php } ?> | ||
<?php | ||
$eventDispatcher->dispatch(OpenEMR\Events\PatientReport::ACTIONS_RENDER_POST, new GenericEvent()); | ||
if ($oefax) { | ||
$eventDispatcher->dispatch(PatientReportEvent::ACTIONS_RENDER_POST, new GenericEvent()); | ||
} | ||
?> | ||
<input type='hidden' name='pdf' value='0'> | ||
<br> | ||
|
@@ -751,7 +758,9 @@ function(data) { | |
<?php } ?> | ||
|
||
<?php | ||
$eventDispatcher->dispatch(PatientReportEvent::JAVASCRIPT_READY_POST, new GenericEvent()); | ||
if ($oefax) { | ||
$eventDispatcher->dispatch(PatientReportEvent::JAVASCRIPT_READY_POST, new GenericEvent()); | ||
} | ||
?> | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
library/smarty/plugins/function.dispatchPatientDocumentEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Smarty plugin | ||
* @package Smarty | ||
* @subpackage plugins | ||
* dispatchPatientDocumentEvent() version for smarty templates | ||
* | ||
* Copyright (C) 2019 Brady Miller <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
*/ | ||
|
||
use OpenEMR\Events\PatientDocuments\PatientDocumentEvent; | ||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
use Symfony\Component\EventDispatcher\GenericEvent; | ||
|
||
/** | ||
* Smarty {dispatchPatientDocumentEvent} function plugin | ||
* | ||
* Type: function<br> | ||
* Name: dispatchPatientDocumentEvent<br> | ||
* Purpose: Event listener for PatientDocumentEvent<br> | ||
* | ||
* Examples: | ||
* | ||
* {dispatchPatientDocumentEvent event="javascript_ready_fax_dialog"} | ||
* {dispatchPatientDocumentEvent event="actions_render_fax_anchor"} | ||
* | ||
* @param array | ||
* @param Smarty | ||
*/ | ||
|
||
|
||
function smarty_function_dispatchPatientDocumentEvent($params, &$smarty) | ||
{ | ||
if (empty($params['event'])) { | ||
$smarty->trigger_error("dispatchPatientDocumentEvent: missing 'event' parameter"); | ||
return; | ||
} else { | ||
$event = $params['event']; | ||
} | ||
|
||
$eventDispatcher = $GLOBALS['kernel']->getEventDispatcher(); | ||
if ($event == "javascript_ready_fax_dialog") { | ||
$eventDispatcher->dispatch(PatientDocumentEvent::JAVASCRIPT_READY_FAX_DIALOG, new GenericEvent()); | ||
} else if ($event == "actions_render_fax_anchor") { | ||
$eventDispatcher->dispatch(PatientDocumentEvent::ACTIONS_RENDER_FAX_ANCHOR, new GenericEvent()); | ||
} else { | ||
$smarty->trigger_error("dispatchPatientDocumentEvent: invalid 'event' parameter"); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* PatientDocumentEvents | ||
* | ||
* @package OpenEMR | ||
* @link http:https://www.open-emr.org | ||
* @author Jerry Padgett <[email protected]> | ||
* @copyright Copyright (c) 2019 Jerry Padgett <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
namespace OpenEMR\Events\PatientDocuments; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
class PatientDocumentEvent extends Event | ||
{ | ||
const ACTIONS_RENDER_FAX_ANCHOR = 'documents.actions.render.fax.anchor'; | ||
const JAVASCRIPT_READY_FAX_DIALOG = 'documents.javascript.fax.dialog'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<?php | ||
/** | ||
* PatientReportEvent class. | ||
* | ||
* @package OpenEMR | ||
* @link http:https://www.open-emr.org | ||
* | ||
* @author Stephen Nielson <[email protected]> | ||
* @copyright Copyright (c) 2019 Stephen Nielson <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
namespace OpenEMR\Events\PatientReport; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
class PatientReportEvent extends Event | ||
{ | ||
|
||
/** | ||
* This event fires after the action buttons for the report have rendered. | ||
* It allows listeners to render additional content or buttons. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,15 @@ | |
* @link http:https://www.open-emr.org | ||
* @author Brady Miller <brady[email protected]> | ||
* @copyright Copyright (c) 2017-2019 Brady Miller <brady[email protected]> | ||
* @author Jerry Padgett <sjpadgett@gmail.com> | ||
* @copyright Copyright (c) 2018-2019 Jerry Padgett <sjpadgett@gmail.com> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*} | ||
|
||
<script language="JavaScript"> | ||
|
||
{if $GLOBALS.oefax_enable} | ||
{dispatchPatientDocumentEvent event="javascript_ready_fax_dialog"} | ||
{/if} | ||
function popoutcontent(othis) {literal}{{/literal} | ||
let popsrc = $(othis).parents('body').find('#DocContents iframe').attr("src"); | ||
let wname = '_' + Math.random().toString(36).substr(2, 6); | ||
|
@@ -38,12 +42,7 @@ | |
dlgopen(url, 'pno1', 'modal-xl', 500, '', '', { | ||
buttons: [ | ||
{text: btnClose, close: true, style: 'default btn-xs'} | ||
], | ||
sizeHeight: 'auto', | ||
allowResize: true, | ||
allowDrag: true, | ||
dialogId: '', | ||
type: 'iframe' | ||
] | ||
}); | ||
return false; | ||
}{/literal} | ||
|
@@ -132,8 +131,11 @@ <h4>{$file->get_url_web()|text} | |
<button class="btn btn-xs btn-primary active">{xlt t='Contents'}</button> | ||
</div> | ||
<span style="float:right;"> | ||
<a class="css_button" href='' onclick='return popoutcontent(this)' title="{xla t='Pop Out Full Screen.'}"> | ||
<span class="glyphicon glyphicon-fullscreen"></span></a> | ||
<script>var file = {$file->get_url()|js_escape};</script> | ||
{if $GLOBALS.oefax_enable} | ||
{dispatchPatientDocumentEvent event="actions_render_fax_anchor"} | ||
{/if} | ||
<a class="css_button" href='' onclick='return popoutcontent(this)' title="{xla t='Pop Out Full Screen.'}">{xlt t='Pop Out'}</a> | ||
<a class="css_button" href="{$web_path|attr}" title="{xla t='Original file'}" onclick="top.restoreSession()"><span>{xlt t='Download'}</span></a> | ||
<a class="css_button" href='' onclick='return showpnotes({$file->get_id()|attr_js})'><span>{xlt t='Show Notes'}</span></a> | ||
{$delete_string} | ||
|