Nation Notes module contributed by Z&H Healthcare.
[openemr.git] / library / custom_template / custom_template.php
blob1b9cf0bc4f05c1592d926b61074b8d7d2bfac117
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.
22 //
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 //SANITIZE ALL ESCAPES
29 $sanitize_all_escapes=true;
32 //STOP FAKE REGISTER GLOBALS
33 $fake_register_globals=false;
36 require_once("../../interface/globals.php");
37 $contextName = $_REQUEST['contextName'];
38 $type = $_REQUEST['type'];
39 $rowContext = sqlQuery("SELECT * FROM customlists WHERE cl_list_type=2 AND cl_list_item_long=?",array($contextName));
42 <html lang="en">
43 <head>
44 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
45 <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
46 <script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
47 <link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
48 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
49 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
50 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
51 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui-1.7.1.custom.min.js"></script>
52 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
53 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
54 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
55 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.easydrag.handler.beta2.js"></script>
56 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/ajax_functions_writer.js"></script>
57 <script language="JavaScript" type="text/javascript">
58 $(document).ready(function(){
60 // fancy box
61 enable_modals();
63 tabbify();
65 // special size for
66 $(".iframe_small").fancybox( {
67 'overlayOpacity' : 0.0,
68 'showCloseButton' : true,
69 'frameHeight' : 120,
70 'frameWidth' : 330
71 });
72 $(".iframe_medium").fancybox( {
73 'overlayOpacity' : 0.0,
74 'showCloseButton' : true,
75 'frameHeight' : 430,
76 'frameWidth' : 680
77 });
78 $(".iframe_abvmedium").fancybox( {
79 'overlayOpacity' : 0.0,
80 'showCloseButton' : true,
81 'frameHeight' : 500,
82 'frameWidth' : 700
83 });
84 $(function(){
85 // add drag and drop functionality to fancybox
86 $("#fancy_outer").easydrag();
87 });
89 $("#menu5 > li > a.expanded + ul").slideToggle("medium");
90 $("#menu5 > li > a").click(function() {
91 $("#menu5 > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
92 $(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
93 });
94 });
95 </script>
96 <script type="text/javascript">
97 $(document).ready(function(){
99 $(function() {
100 $("#menu5 div").sortable({ opacity: 0.3, cursor: 'move', update: function() {
101 var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
102 $.post("updateDB.php", order);
108 </script>
109 </head>
110 <body class="body_top">
111 <input type="hidden" name="list_id" id="list_id" value="<?php echo $rowContext['cl_list_id'];?>">
112 <table width=100% align=left cellpadding=0 cellspacing=0 margin-left=0px>
113 <?php
114 if($rowContext['cl_list_item_long']){
116 <tr class="text"><th colspan="2" align="center"><?php echo strtoupper(htmlspecialchars(xl($rowContext['cl_list_item_long']),ENT_QUOTES));?></th></tr>
117 <tr>
118 <td>
119 <div id="tab1" class="tabset_content tabset_content_active">
120 <form>
121 <table width=100%>
122 <tr clss="text">
123 <td>
124 <a href="#" onclick="return SelectToSave('<?php echo $type;?>')" class="css_button" ><span><?php echo htmlspecialchars(xl('SAVE'),ENT_QUOTES);?></span></a>
125 </td>
126 </tr>
127 <tr class="text">
128 <td id="templateDD">
129 <select name="template" id="template" onchange="TemplateSentence(this.value)" style="width:180px">
130 <option value=""><?php echo htmlspecialchars(xl('Select category'),ENT_QUOTES);?></option>
131 <?php
132 $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']));
133 while($rowTemplates = sqlFetchArray($resTemplates)){
134 echo "<option value='".htmlspecialchars($rowTemplates['cl_list_slno'],ENT_QUOTES)."'>".htmlspecialchars(xl($rowTemplates['cl_list_item_long']),ENT_QUOTES)."</option>";
137 </select>
138 </td>
139 <td>
140 <div id="share" style="display:none"></div>
141 <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;
142 <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;
143 <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;
144 <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>
145 <?php
146 $res=sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS cl ON cl.cl_list_slno=tu.tu_template_id
147 WHERE tu.tu_user_id=? AND cl.cl_list_type=6 AND cl.cl_deleted=0 ORDER BY cl.cl_order",array($_SESSION['authId']));
148 while($row=sqlFetchArray($res)){
150 <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>
151 <?php
154 </td>
155 </tr>
156 <tr>
157 <td valign=top style="width:180px;">
158 <div style="background-color:#DFEBFE">
159 <div style="overflow-y:scroll;overflow-x:hidden;height:400px">
160 <ul id="menu5" class="example_menu" style="width:100%;">
161 <li><a class="expanded"><?php echo htmlspecialchars(xl('Components'),ENT_QUOTES);?></a>
162 <ul>
163 <div id="template_sentence">
164 </div>
165 </ul>
166 </li>
167 <?php
168 if($pid!=''){
169 $row = sqlQuery("SELECT * FROM patient_data WHERE pid=?",array($pid));
171 <li><a class="collapsed"><?php echo htmlspecialchars(xl('Patient Details'),ENT_QUOTES);?></a>
172 <ul>
173 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['fname'];?>');"><?php echo htmlspecialchars(xl('First name',ENT_QUOTES));?></a></span></li>
174 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['lname'];?>');"><?php echo htmlspecialchars(xl('Last name',ENT_QUOTES));?></a></span></li>
175 <?php
176 if($row['phone_home']){
178 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['phone_home'];?>');"><?php echo htmlspecialchars(xl('Phone',ENT_QUOTES));?></a></span></li>
179 <?php
182 <?php
183 if($row['ss']){
185 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['ss'];?>');"><?php echo htmlspecialchars(xl('SSN',ENT_QUOTES));?></a></span></li>
186 <?php
189 <?php
190 if($row['DOB']){
192 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $row['DOB'];?>');"><?php echo htmlspecialchars(xl('Date Of Birth',ENT_QUOTES));?></a></span></li>
193 <?php
196 <?php
197 if($row['providerID']){
198 $val=sqlQuery("SELECT CONCAT(lname,',',fname) AS name FROM users WHERE id='".$row['providerID']."'");
200 <li><span><a href="#" onclick="top.restoreSession();CKEDITOR.instances.textarea1.insertText('<?php echo $val['name'];?>');"><?php echo htmlspecialchars(xl('PCP',ENT_QUOTES));?></a></span></li>
201 <?php
204 </ul>
205 </li>
206 <?php
209 </ul>
210 </div>
211 </div>
212 <a href="personalize.php?list_id=<?php echo $rowContext['cl_list_id'];?>" id="personalize_link" class="iframe_medium css_button"><span><?php echo htmlspecialchars(xl('Personalize'),ENT_QUOTES);?></span></a>
213 <a href="add_custombutton.php" id="custombutton" class="iframe_medium css_button" 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>
214 </td>
215 <td valign=top style="width:700px;">
216 <textarea class="ckeditor" cols="100" id="textarea1" name="textarea1" rows="80"></textarea>
217 </td>
218 </tr>
219 </table>
220 </form>
221 </div>
223 </td>
224 </tr>
225 <?php
227 else{
228 echo htmlspecialchars(xl('NO SUCH CONTEXT NAME').$contextName,ENT_QUOTES);
231 </table>
232 <table>
233 <script type="text/javascript">
234 edit('<?php echo $type;?>');
235 </script>
236 </table>
237 </body>
238 </html>