3 // +-----------------------------------------------------------------------------+
4 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
19 // A copy of the GNU General Public License is included along with this program:
20 // openemr/interface/login/GnuGPL.html
21 // For more information write to the Free Software
22 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 // Author: Eldho Chacko <eldho@zhservices.com>
25 // Jacob T Paul <jacob@zhservices.com>
26 // Jerry Padgett <sjpadgett@gmail.com> 2019-2021
28 // +------------------------------------------------------------------------------+
30 require_once("../../interface/globals.php");
31 require_once("$srcdir/lists.inc.php");
32 require_once("$srcdir/user.inc.php");
34 use OpenEMR\Core\Header
;
35 use OpenEMR\Common\Csrf\CsrfUtils
;
37 // mdsupport : li code
38 function listitemCode($strDisp, $strInsert, $ref = '')
45 echo '<li><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText(' .
46 "'" . text($strInsert) . $ref . "'" . ');">' . text($strDisp) . '</a></li>';
50 $allowTemplateWarning = checkUserSetting('disable_template_warning', '1') === true ?
0 : 1;
51 $contextName = !empty($_GET['contextName']) ?
$_GET['contextName'] : '';
52 $type = $_GET['type'] ??
'';
53 $cc_flag = $_GET['ccFlag'] ??
'';
55 $isNN = empty($cc_flag) ?
1 : 0;
57 $contextName = empty($contextName) ?
"Encounters" : $contextName;
59 // either NN context from layout or text template default.
60 $rowContext = sqlQuery("SELECT * FROM customlists WHERE cl_list_type = 2 AND cl_list_item_long = ?", array($contextName));
61 if (empty($isNN) && empty($rowContext)) {
62 $contextName .= " <small><em>(" . xlt("Add Missing Context Template.") . ")</em></small>";
69 cursor
: pointer
!important
;
72 cursor
: move
!important
;
75 <?php Header
::setupHeader(['common', 'opener', 'select2', 'ckeditor']); ?
>
76 <script src
="<?php echo $GLOBALS['webroot'] ?>/library/js/ajax_functions_writer.js"></script
>
79 let allowTemplateWarning
= <?php
echo $allowTemplateWarning; ?
>;
80 <?php
if (!$isNN) { ?
>
82 $
('#contextSearch').select2({
83 placeholder
: <?php
echo xlj('Select Template Context'); ?
>,
87 url
: top
.webroot_url +
'/library/ajax/template_context_search.php',
88 data
: function (params
) {
91 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
97 <?php
require($GLOBALS['srcdir'] . '/js/xl/select2.js.php'); ?
>
100 $
('#contextSearch').on('select2:select', function (e
) {
101 let data
= e
.params
.data
;
102 top
.restoreSession();
103 $
("#contextName").val(data
.text
);
104 $
("#mainForm").submit();
109 function refreshme() {
110 top
.restoreSession();
111 document
.location
.reload();
114 CKEDITOR
.config
.customConfig
= top
.webroot_url +
'/library/js/nncustom_config.js';
119 $
(".iframe_small").on('click', function (e
) {
122 dlgopen('', '', 330, 120, '', '', {
124 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'secondary btn-sm'}
126 onClosed
: 'refreshme',
128 url
: $
(this
).attr('href')
132 $
(".iframe_medium").on('click', function (e
) {
135 dlgopen('', '', 725, 575, '', '', {
137 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'secondary btn-sm'}
139 onClosed
: 'refreshme',
141 url
: $
(this
).attr('href')
145 $
(".iframe_abvmedium").on('click', function (e
) {
148 dlgopen('', '', 700, 500, '', '', {
150 {text
: '<?php echo xla('Close
'); ?>', close
: true, style
: 'secondary btn-sm'}
152 onClosed
: 'refreshme',
154 url
: $
(this
).attr('href')
158 $
("#menu5 > li > a.expanded + ul").slideToggle("medium");
159 $
("#menu5 > li > a").click(function () {
160 $
("#menu5 > li > a.expanded").not(this
).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
161 $
(this
).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
167 function sortableCallback(elem
){
169 for (let i
=0; i
< elem
.length
; i++
) {
171 if(ele
.tagName
== "DIV"){
172 clorder
.push("clorder[]="+ele
.firstElementChild
.id
.split("_")[1]);
175 $
.post("updateDB.php", clorder
.join('&')+
"&action=updateRecordsListings");
177 oeSortable(sortableCallback
);
179 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
182 <body
class="body_top">
183 <div
class="container-fluid">
184 <input type
="hidden" name
="list_id" id
="list_id" value
="<?php echo $rowContext['cl_list_id'] ?? ''; ?>" />
185 <?php
if (($rowContext['cl_list_item_long'] ??
null) ||
!$isNN) { ?
>
186 <!-- don
't escape $contextName it's html
-->
187 <h3
class="text-center"><?php
echo (text($rowContext['cl_list_item_long'] ??
'')) ?
: $contextName; ?
></h3
>
188 <div id
="tab1" class="tabset_content tabset_content_active">
190 <input type
="hidden" name
="type" id
="type" value
="<?php echo attr($type); ?>" />
191 <input type
="hidden" name
="ccFlag" id
="type" value
="<?php echo attr($cc_flag); ?>" />
192 <input type
="hidden" name
="contextName" id
="contextName" value
="<?php echo attr($contextName); ?>" />
194 <div
class="col-md-12">
195 <?php
if (!$isNN) { ?
>
196 <div id
="searchCriteria">
197 <div
class="select-box form-inline mb-1">
198 <label
for="contextId"><?php
echo xlt('Context') . ':'; ?
></label
>
199 <select id
="contextSearch" name
="contextId" class="form-control form-control-sm w-50">
200 <option value
=""></option
>
206 <div
class="col-md-4 text mb-2" id
="templateDD">
207 <select
class="form-control form-control-sm" name
="template" id
="template" onchange
="TemplateSentence(this.value)">
208 <option value
=""><?php
echo htmlspecialchars(xl('Select category'), ENT_QUOTES
); ?
></option
>
210 $resTemplates = sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS c ON tu.tu_template_id=c.cl_list_slno WHERE tu.tu_user_id=? AND c.cl_list_type=3 AND cl_list_id=? AND cl_deleted=0 ORDER BY c.cl_list_item_long", array($_SESSION['authUserID'], ($rowContext['cl_list_id'] ??
null)));
211 while ($rowTemplates = sqlFetchArray($resTemplates)) {
212 echo "<option value='" . htmlspecialchars($rowTemplates['cl_list_slno'], ENT_QUOTES
) . "'>" . htmlspecialchars(xl($rowTemplates['cl_list_item_long']), ENT_QUOTES
) . "</option>";
217 <div
class="col-md-8 text mb-1">
218 <div id
="share" style
="display:none"></div
>
220 <a href
="#" id
="enter" onclick
="top.restoreSession();ascii_write('13','textarea1');" title
="<?php echo htmlspecialchars(xl('Enter Key'), ENT_QUOTES); ?>"><i
class="fas fa-sign-in-alt"></i
></a
> 
;
221 <!-- Question Mark
!-->
222 <a href
="#" id
="quest" onclick
="top.restoreSession();CKEDITOR.instances.textarea1.insertText('? ');" title
="<?php echo htmlspecialchars(xl('Question Mark'), ENT_QUOTES); ?>"><i
class="fas fa-question-circle"></i
></a
> 
;
224 <a href
="#" id
="para" onclick
="top.restoreSession();ascii_write('para','textarea1');" title
="<?php echo htmlspecialchars(xl('New Paragraph'), ENT_QUOTES); ?>"><i
class="fas fa-paragraph"></i
></a
> 
;
226 <a href
="#" id
="space" onclick
="top.restoreSession();ascii_write('32','textarea1');" class="btn btn-primary btn-sm" title
="<?php echo htmlspecialchars(xl('Space'), ENT_QUOTES); ?>"><?php
echo htmlspecialchars(xl('Space'), ENT_QUOTES
); ?
></a
>
228 $res = sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS cl ON cl.cl_list_slno = tu.tu_template_id WHERE tu.tu_user_id = ? AND cl.cl_list_type = 6 AND cl.cl_deleted = 0 ORDER BY cl.cl_order", array($_SESSION['authUserID']));
229 while ($row = sqlFetchArray($res)) { ?
>
230 <a href
="#" onclick
="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['cl_list_item_short']; ?>');" class="btn btn-primary" title
="<?php echo htmlspecialchars(xl($row['cl_list_item_long']), ENT_QUOTES); ?>"><?php
echo ucfirst(htmlspecialchars(xl($row['cl_list_item_long']), ENT_QUOTES
)); ?
></a
>
232 <a
class="btn btn-primary btn-sm btn-transmit float-right" href
="#" onclick
="return SelectToSave(<?php echo attr_js($type); ?>, <?php echo attr_js($cc_flag); ?>)"><?php
echo xlt('Insert in Form'); ?
></a
>
234 <div
class="col-md-4">
235 <div
class="bg-light">
236 <div style
="overflow-y: scroll; overflow-x: hidden; height: 400px">
237 <ul id
="menu5" class="example_menu w-100">
239 <a
class="expanded"><?php
echo htmlspecialchars(xl('Components'), ENT_QUOTES
); ?
></a
>
241 <div id
="template_sentence"></div
>
246 $row = sqlQuery("SELECT p.*, IF(ISNULL(p.providerID), NULL, CONCAT(u.lname,',',u.fname)) pcp " .
247 "FROM patient_data p LEFT OUTER JOIN users u " .
248 "ON u.id=p.providerID WHERE pid=?", array($pid));
251 <a
class="collapsed"><?php
echo htmlspecialchars(xl('Patient Details'), ENT_QUOTES
); ?
></a
>
254 listitemCode(xl('First name'), $row['fname']);
255 listitemCode(xl('Last name'), $row['lname']);
256 listitemCode(xl('Phone'), $row['phone_home']);
257 listitemCode(xl('SSN'), $row['ss']);
258 listitemCode(xl('Date Of Birth'), $row['DOB']);
259 listitemCode(xl('PCP'), $row['pcp']);
264 foreach ($ISSUE_TYPES as $issType => $issTypeDesc) {
265 $res = sqlStatement('SELECT title, id, IF(diagnosis="","",CONCAT(" [",diagnosis,"]")) codes FROM lists WHERE pid=? AND type=? AND enddate IS NULL ORDER BY title', array($pid, $issType));
266 if (sqlNumRows($res)) { ?
>
268 <a
class="collapsed"><?php
echo htmlspecialchars(xl($issTypeDesc[0]), ENT_QUOTES
); ?
></a
>
271 while ($row = sqlFetchArray($res)) {
275 listitemCode((strlen($row['title']) > 20) ?
(substr($row['title'], 0, 18) . '..') : $row['title'], ($row['title'] . $row['codes']), $row['id']);
286 <a href
="personalize.php?list_id=<?php echo $rowContext['cl_list_id'] ?? ''; ?>" id
="personalize_link" class="iframe_medium btn btn-primary btn-sm"><?php
echo htmlspecialchars(xl('Personalize'), ENT_QUOTES
); ?
></a
>
287 <a href
="add_custombutton.php" id
="custombutton" class="iframe_medium btn btn-primary btn-sm" title
="<?php echo htmlspecialchars(xl('Add Buttons for Special Chars,Texts to be Displayed on Top of the Editor for inclusion to the text on a Click'), ENT_QUOTES); ?>"><?php
echo htmlspecialchars(xl('Add Buttons'), ENT_QUOTES
); ?
></a
>
289 <div
class="col-md-8">
290 <textarea
class="ckeditor" cols
="100" rows
="180" id
="textarea1" name
="textarea1"></textarea
>
291 <span
class="float-right my-1"><a href
="#" onclick
="return SelectToSave(<?php echo attr_js($type); ?>, <?php echo attr_js($cc_flag); ?>)" class="btn btn-primary btn-sm btn-save float-right"><?php
echo xlt('Insert in Form'); ?
></a
></span
>
298 echo htmlspecialchars(xl('NO SUCH CONTEXT NAME') . $contextName, ENT_QUOTES
);
304 <?php
if (!$isNN) { ?
>
305 CKEDITOR
.on('instanceReady', function(){$
("#cke_1_toolbar_collapser").click();});
308 edit(<?php
echo js_escape($type); ?
>, <?php
echo js_escape($cc_flag); ?
>);
310 <?php
if ($allowTemplateWarning && !$isNN) { ?
>
312 let msg
= xl("These templates are text only and will not render any other formatting other than pure text.") +
" ";
313 msg +
= xl("You may still use formatting if template is also used in Nation Notes however, pure text will still render here.") +
315 msg +
= xl("Click Got it icon to dismiss this alert forever.");
316 alertMsg(msg
, 10000, 'danger', 'lg', 'disable_template_warning');