LBF custom template (nation notes) fancybox replace.
[openemr.git] / library / custom_template / custom_template.php
blob36d487538582d3f4d223b6815185796d9486ab13
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
26 // +------------------------------------------------------------------------------+
30 require_once("../../interface/globals.php");
31 require_once("$srcdir/lists.inc");
33 use OpenEMR\Core\Header;
35 // mdsupport : li code
36 function listitemCode($strDisp, $strInsert)
38 if ($strInsert) {
39 echo '<li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('.
40 "'" . htmlspecialchars($strInsert, ENT_QUOTES) . "'" .');">'. htmlspecialchars($strDisp, ENT_QUOTES) . '</a></span></li>';
44 $contextName = $_REQUEST['contextName'];
45 $type = $_REQUEST['type'];
46 $rowContext = sqlQuery("SELECT * FROM customlists WHERE cl_list_type=2 AND cl_list_item_long=?", array($contextName));
49 <html lang="en">
50 <head>
52 <?php Header::setupHeader(['common', 'opener', 'jquery-ui',]); ?>
53 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/ckeditor.js"></script>
54 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/ajax_functions_writer.js"></script>
56 <script language="JavaScript" type="text/javascript">
57 function refreshme() {
58 top.restoreSession();
59 document.location.reload();
61 CKEDITOR.config.customConfig = top.webroot_url + '/library/js/nncustom_config.js';
62 $(document).ready(function () {
64 tabbify();
66 $(".iframe_small").on('click', function (e) {
67 e.preventDefault();
68 e.stopPropagation();
69 dlgopen('', '', 330, 120, '', '', {
70 buttons: [
71 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
73 onClosed: 'refreshme',
74 type: 'iframe',
75 url: $(this).attr('href')
76 });
77 });
79 $(".iframe_medium").on('click', function (e) {
80 e.preventDefault();
81 e.stopPropagation();
82 dlgopen('', '', 725, 500, '', '', {
83 buttons: [
84 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
86 onClosed: 'refreshme',
87 type: 'iframe',
88 url: $(this).attr('href')
89 });
90 });
92 $(".iframe_abvmedium").on('click', function (e) {
93 e.preventDefault();
94 e.stopPropagation();
95 dlgopen('', '', 700, 500, '', '', {
96 buttons: [
97 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
99 onClosed: 'refreshme',
100 type: 'iframe',
101 url: $(this).attr('href')
105 $("#menu5 > li > a.expanded + ul").slideToggle("medium");
106 $("#menu5 > li > a").click(function () {
107 $("#menu5 > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
108 $(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
111 </script>
112 <script type="text/javascript">
113 $(document).ready(function () {
115 $(function () {
116 $("#menu5 div").sortable({
117 opacity: 0.3, cursor: 'move', update: function () {
118 var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
119 $.post("updateDB.php", order);
125 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
126 </script>
127 </head>
128 <body class="body_top">
129 <input type="hidden" name="list_id" id="list_id" value="<?php echo $rowContext['cl_list_id'];?>">
130 <table width=100% align=left cellpadding=0 cellspacing=0 margin-left=0px>
131 <?php
132 if ($rowContext['cl_list_item_long']) {
134 <tr class="text"><th colspan="2" align="center"><?php echo strtoupper(htmlspecialchars(xl($rowContext['cl_list_item_long']), ENT_QUOTES));?></th></tr>
135 <tr>
136 <td>
137 <div id="tab1" class="tabset_content tabset_content_active">
138 <form>
139 <table width=100%>
140 <tr clss="text">
141 <td>
142 <a href="#" onclick="return SelectToSave('<?php echo $type;?>')" class="css_button" ><span><?php echo htmlspecialchars(xl('SAVE'), ENT_QUOTES);?></span></a>
143 </td>
144 </tr>
145 <tr class="text">
146 <td id="templateDD">
147 <select name="template" id="template" onchange="TemplateSentence(this.value)" style="width:180px">
148 <option value=""><?php echo htmlspecialchars(xl('Select category'), ENT_QUOTES);?></option>
149 <?php
150 $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['authId'],$rowContext['cl_list_id']));
151 while ($rowTemplates = sqlFetchArray($resTemplates)) {
152 echo "<option value='".htmlspecialchars($rowTemplates['cl_list_slno'], ENT_QUOTES)."'>".htmlspecialchars(xl($rowTemplates['cl_list_item_long']), ENT_QUOTES)."</option>";
155 </select>
156 </td>
157 <td>
158 <div id="share" style="display:none"></div>
159 <a href="#" id="enter" onclick="top.restoreSession();ascii_write('13','textarea1');" title="<?php echo htmlspecialchars(xl('Enter Key'), ENT_QUOTES);?>"><img border=0 src="../../images/enter.gif"></a>&nbsp;
160 <a href="#" id="quest" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('? ');" title="<?php echo htmlspecialchars(xl('Question Mark'), ENT_QUOTES);?>"><img border=0 src="../../images/question.png"></a>&nbsp;
161 <a href="#" id="para" onclick="top.restoreSession();ascii_write('para','textarea1');" title="<?php echo htmlspecialchars(xl('New Paragraph'), ENT_QUOTES);?>"><img border=0 src="../../images/paragraph.png"></a>&nbsp;
162 <a href="#" id="space" onclick="top.restoreSession();ascii_write('32','textarea1');" class="css_button" title="<?php echo htmlspecialchars(xl('Space'), ENT_QUOTES);?>"><span><?php echo htmlspecialchars(xl('SPACE'), ENT_QUOTES);?></span></a>
163 <?php
164 $res=sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS cl ON cl.cl_list_slno=tu.tu_template_id
165 WHERE tu.tu_user_id=? AND cl.cl_list_type=6 AND cl.cl_deleted=0 ORDER BY cl.cl_order", array($_SESSION['authId']));
166 while ($row=sqlFetchArray($res)) {
168 <a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['cl_list_item_short'];?>');" class="css_button" title="<?php echo htmlspecialchars(xl($row['cl_list_item_long']), ENT_QUOTES);?>"><span><?php echo ucfirst(htmlspecialchars(xl($row['cl_list_item_long']), ENT_QUOTES));?></span></a>
169 <?php
172 </td>
173 </tr>
174 <tr>
175 <td valign=top style="width:180px;">
176 <div style="background-color:#DFEBFE">
177 <div style="overflow-y:scroll;overflow-x:hidden;height:400px">
178 <ul id="menu5" class="example_menu" style="width:100%;">
179 <li><a class="expanded"><?php echo htmlspecialchars(xl('Components'), ENT_QUOTES);?></a>
180 <ul>
181 <div id="template_sentence">
182 </div>
183 </ul>
184 </li>
185 <?php
186 if ($pid!='') {
187 $row = sqlQuery("SELECT p.*, IF(ISNULL(p.providerID), NULL, CONCAT(u.lname,',',u.fname)) pcp ".
188 "FROM patient_data p LEFT OUTER JOIN users u ".
189 "ON u.id=p.providerID WHERE pid=?", array($pid));
191 <li><a class="collapsed"><?php echo htmlspecialchars(xl('Patient Details'), ENT_QUOTES);?></a>
192 <ul>
193 <?php
194 listitemCode(xl('First name'), $row['fname']);
195 listitemCode(xl('Last name'), $row['lname']);
196 listitemCode(xl('Phone'), $row['phone_home']);
197 listitemCode(xl('SSN'), $row['ss']);
198 listitemCode(xl('Date Of Birth'), $row['DOB']);
199 listitemCode(xl('PCP'), $row['pcp']);
201 </ul>
202 </li>
203 <?php
204 foreach ($ISSUE_TYPES as $issType => $issTypeDesc) {
205 $res = sqlStatement('SELECT title, IF(diagnosis="","",CONCAT(" [",diagnosis,"]")) codes FROM lists WHERE pid=? AND type=? AND enddate IS NULL ORDER BY title', array($pid, $issType));
206 if (sqlNumRows($res)) {
208 <li><a class="collapsed"><?php echo htmlspecialchars(xl($issTypeDesc[0]), ENT_QUOTES);?></a>
209 <ul>
210 <?php
211 while ($row = sqlFetchArray($res)) {
212 listitemCode((strlen($row['title'])>20) ? (substr($row['title'], 0, 18).'..') : $row['title'], ($row['title'].$row['codes']));
215 </ul>
216 </li>
217 <?php
222 </ul>
223 </div>
224 </div>
225 <a href="personalize.php?list_id=<?php echo $rowContext['cl_list_id'];?>" id="personalize_link" class="iframe_medium css_button_small"><span><?php echo htmlspecialchars(xl('Personalize'), ENT_QUOTES);?></span></a>
226 <a href="add_custombutton.php" id="custombutton" class="iframe_medium css_button_small" 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);?>"><span><?php echo htmlspecialchars(xl('Add Buttons'), ENT_QUOTES);?></span></a>
227 </td>
228 <td valign=top style="width:700px;">
229 <textarea class="ckeditor" cols="100" id="textarea1" name="textarea1" rows="80"></textarea>
230 </td>
231 </tr>
232 </table>
233 </form>
234 </div>
236 </td>
237 </tr>
238 <?php
239 } else {
240 echo htmlspecialchars(xl('NO SUCH CONTEXT NAME').$contextName, ENT_QUOTES);
243 </table>
244 <table>
245 <script type="text/javascript">
246 edit('<?php echo $type;?>');
247 </script>
248 </table>
249 </body>
250 </html>