Updated acknowledgements page
[openemr.git] / library / custom_template / custom_template.php
blob88131c2e4e03f1bf8d286bba134ff6d063e8c48c
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 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
109 </script>
110 </head>
111 <body class="body_top">
112 <input type="hidden" name="list_id" id="list_id" value="<?php echo $rowContext['cl_list_id'];?>">
113 <table width=100% align=left cellpadding=0 cellspacing=0 margin-left=0px>
114 <?php
115 if($rowContext['cl_list_item_long']){
117 <tr class="text"><th colspan="2" align="center"><?php echo strtoupper(htmlspecialchars(xl($rowContext['cl_list_item_long']),ENT_QUOTES));?></th></tr>
118 <tr>
119 <td>
120 <div id="tab1" class="tabset_content tabset_content_active">
121 <form>
122 <table width=100%>
123 <tr clss="text">
124 <td>
125 <a href="#" onclick="return SelectToSave('<?php echo $type;?>')" class="css_button" ><span><?php echo htmlspecialchars(xl('SAVE'),ENT_QUOTES);?></span></a>
126 </td>
127 </tr>
128 <tr class="text">
129 <td id="templateDD">
130 <select name="template" id="template" onchange="TemplateSentence(this.value)" style="width:180px">
131 <option value=""><?php echo htmlspecialchars(xl('Select category'),ENT_QUOTES);?></option>
132 <?php
133 $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']));
134 while($rowTemplates = sqlFetchArray($resTemplates)){
135 echo "<option value='".htmlspecialchars($rowTemplates['cl_list_slno'],ENT_QUOTES)."'>".htmlspecialchars(xl($rowTemplates['cl_list_item_long']),ENT_QUOTES)."</option>";
138 </select>
139 </td>
140 <td>
141 <div id="share" style="display:none"></div>
142 <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;
143 <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;
144 <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;
145 <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>
146 <?php
147 $res=sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS cl ON cl.cl_list_slno=tu.tu_template_id
148 WHERE tu.tu_user_id=? AND cl.cl_list_type=6 AND cl.cl_deleted=0 ORDER BY cl.cl_order",array($_SESSION['authId']));
149 while($row=sqlFetchArray($res)){
151 <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>
152 <?php
155 </td>
156 </tr>
157 <tr>
158 <td valign=top style="width:180px;">
159 <div style="background-color:#DFEBFE">
160 <div style="overflow-y:scroll;overflow-x:hidden;height:400px">
161 <ul id="menu5" class="example_menu" style="width:100%;">
162 <li><a class="expanded"><?php echo htmlspecialchars(xl('Components'),ENT_QUOTES);?></a>
163 <ul>
164 <div id="template_sentence">
165 </div>
166 </ul>
167 </li>
168 <?php
169 if($pid!=''){
170 $row = sqlQuery("SELECT * FROM patient_data WHERE pid=?",array($pid));
172 <li><a class="collapsed"><?php echo htmlspecialchars(xl('Patient Details'),ENT_QUOTES);?></a>
173 <ul>
174 <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>
175 <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>
176 <?php
177 if($row['phone_home']){
179 <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>
180 <?php
183 <?php
184 if($row['ss']){
186 <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>
187 <?php
190 <?php
191 if($row['DOB']){
193 <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>
194 <?php
197 <?php
198 if($row['providerID']){
199 $val=sqlQuery("SELECT CONCAT(lname,',',fname) AS name FROM users WHERE id='".$row['providerID']."'");
201 <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>
202 <?php
205 </ul>
206 </li>
207 <?php
210 </ul>
211 </div>
212 </div>
213 <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>
214 <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>
215 </td>
216 <td valign=top style="width:700px;">
217 <textarea class="ckeditor" cols="100" id="textarea1" name="textarea1" rows="80"></textarea>
218 </td>
219 </tr>
220 </table>
221 </form>
222 </div>
224 </td>
225 </tr>
226 <?php
228 else{
229 echo htmlspecialchars(xl('NO SUCH CONTEXT NAME').$contextName,ENT_QUOTES);
232 </table>
233 <table>
234 <script type="text/javascript">
235 edit('<?php echo $type;?>');
236 </script>
237 </table>
238 </body>
239 </html>