php7 bug fix 7
[openemr.git] / library / custom_template / quest_popup.php
blobd235cd828dc181545328e6405cd2404072ed5217
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 $content = $_REQUEST['content'];
39 <html>
40 <head>
41 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
42 <script type="text/javascript">
43 function showWhereInTextarea(){
44 opener.restoreSession();
45 var textarea = document.getElementById('quest');
46 start = textarea.value.indexOf("??");
47 len =2;
48 if(textarea.setSelectionRange){
49 textarea.setSelectionRange(parseInt(start), (parseInt(start)+parseInt(len)));
51 else{
52 var range = textarea.createTextRange();
53 range.collapse(true);
55 range.moveStart('character',parseInt(start) );
56 range.moveEnd('character',parseInt(len));
57 range.select();
60 document.getElementById('quest').focus();
62 function replace_quest(val){
63 opener.restoreSession();
64 var textarea = document.getElementById('quest').value;
65 textarea=textarea.replace(/\?\?/i,val);
66 document.getElementById('quest').value=textarea;
68 function save_this(){
69 opener.restoreSession();
70 var textFrom = document.getElementById('quest').value;
71 window.opener.CKEDITOR.instances.textarea1.insertText(textFrom);
72 window.close();
74 </script>
75 </head>
76 <body class="body_top" onload="showWhereInTextarea()">
77 <table>
78 <tr class="text">
79 <td>
80 <?php
81 $res = sqlStatement("SELECT * FROM list_options WHERE list_id='nation_notes_replace_buttons' ORDER BY seq");
82 while($row = sqlFetchArray($res)){
84 <a href="#" onclick="replace_quest('<?php echo htmlspecialchars($row['option_id'],ENT_QUOTES);?>')" class="css_button"><span><?php echo htmlspecialchars($row['title'],ENT_QUOTES);?></span></a>
85 <?php
88 </td>
89 </tr>
90 <tr class="text">
91 <td>
92 <textarea name="quest" id="quest" rows="5" cols="70"><?php echo htmlspecialchars($content,ENT_QUOTES);?></textarea>
93 </td>
94 </tr>
95 <tr>
96 <td colspan="2" align="center">
97 <input type="button" name="save" value="<?php echo htmlspecialchars(xl('Save'),ENT_QUOTES);?>" onclick="save_this()">
98 <input type="button" name="cancel" value="<?php echo htmlspecialchars(xl('Cancel'),ENT_QUOTES);?>" onclick="javascript:window.close()">
99 </td>
100 </tr>
101 </table>
103 </body>
104 </html>