move dicom viewer to iframe (#1395)
[openemr.git] / templates / documents / general_view.html
blob100d677d2ab8ebb8d88c27273061d89b02103b38
1 {**
2 * general document view
4 * @package OpenEMR
5 * @link http://www.open-emr.org
6 * @author Brady Miller <brady.g.miller@gmail.com>
7 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
9 *}
11 <script language="JavaScript">
13 function popoutcontent(othis) {literal}{{/literal}
14 let popsrc = $(othis).parents('body').find('#DocContents iframe').attr("src");
15 let wname = '_' + Math.random().toString(36).substr(2, 6);
16 let opt = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no";
17 window.open(popsrc,wname, opt);
19 return false;
20 {literal}}{/literal}
22 // Process click on Delete link.
23 function deleteme(docid) {literal}{{/literal}
24 dlgopen('interface/patient_file/deleter.php?document=' + docid, '_blank', 500, 450);
25 return false;
26 {literal}}{/literal}
28 // Called by the deleter.php window on a successful delete.
29 function imdeleted() {literal}{{/literal}
30 top.restoreSession();
31 window.location.href='{$REFRESH_ACTION}';
32 {literal}}{/literal}
34 // Called to show patient notes related to this document in the "other" frame.
35 function showpnotes(docid) {literal}{{/literal}
36 {literal}
37 if (top.tab_mode) {
38 let btnClose = '{/literal}{xl t="Done"|escape:"html"}{literal}';
39 let url = top.webroot_url + '/interface/patient_file/summary/pnotes.php?docid=' + docid;
40 dlgopen(url, 'pno1', 'modal-xl', 500, '', '', {
41 buttons: [
42 {text: btnClose, close: true, style: 'default btn-xs'}
44 sizeHeight: 'auto',
45 allowResize: true,
46 allowDrag: true,
47 dialogId: '',
48 type: 'iframe'
49 });
50 return false;
52 {/literal}
53 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
54 parent.left_nav.forceDual();
55 parent.left_nav.loadFrame('pno1', othername, 'patient_file/summary/pnotes.php?docid=' + docid);
56 return false;
57 {literal}}{/literal}
59 function submitNonEmpty( e ) {literal}{{/literal}
60 if ( e.elements['passphrase'].value.length == 0 ) {literal}{{/literal}
61 alert( "{xl t='You must enter a pass phrase to encrypt the document'}" );
62 {literal}}{/literal} else {literal}{{/literal}
63 e.submit();
64 {literal}}{/literal}
65 {literal}}{/literal}
67 // For tagging it encounter
68 function tagUpdate() {literal}{{/literal}
69 var f = document.forms['document_tag'];
70 if (f.encounter_check.checked) {literal}{{/literal}
71 if(f.visit_category_id.value==0) {literal}{{/literal}
72 alert(" {xl t='Please select visit category'}" );
73 return false;
74 {literal}}{/literal}
75 {literal}}{/literal} else if (f.encounter_id.value == 0 ) {literal}{{/literal}
76 alert(" {xl t='Please select encounter'}");
77 return false;
78 {literal}}{/literal}
79 //top.restoreSession();
80 document.forms['document_tag'].submit();
81 {literal}}{/literal}
83 // For new or existing encounter
84 function set_checkbox() {literal}{{/literal}
85 var f = document.forms['document_tag'];
86 if (f.encounter_check.checked) {literal}{{/literal}
87 f.encounter_id.disabled = true;
88 f.visit_category_id.disabled = false;
89 $('.hide_clear').attr('href','javascript:void(0);');
90 {literal}}{/literal} else {literal}{{/literal}
91 f.encounter_id.disabled = false;
92 f.visit_category_id.disabled = true;
93 f.visit_category_id.value = 0;
94 $('.hide_clear').attr('href','{$clear_encounter_tag}');
95 {literal}}{/literal}
96 {literal}}{/literal}
98 // For tagging it with image procedure
99 function ImgProcedure() {literal}{{/literal}
100 var f = document.forms['img_procedure_tag'];
101 if(f.image_procedure_id.value == 0 ) {literal}{{/literal}
102 alert("{xl t='Please select image procedure'}");
103 return false;
104 {literal}}{/literal}
105 f.procedure_code.value = f.image_procedure_id.options[f.image_procedure_id.selectedIndex].getAttribute('data-code');
106 document.forms['img_procedure_tag'].submit();
107 {literal}}{/literal}
108 // Process click on Import link.
109 function import_ccr(docid) {literal}{
110 top.restoreSession();
111 $.ajax({
112 url: "library/ajax/ccr_import_ajax.php",
113 type: "POST",
114 dataType: "html",
115 data:
117 ccr_ajax : "yes",
118 document_id : docid,
120 success: function(data){
121 alert(data);
122 top.restoreSession();
123 document.location.reload();
125 error:function(){
126 alert("failure");
129 }{/literal}
130 </script>
132 <table valign="top" width="100%">
133 <tr>
134 <td>
135 <div style="margin-bottom: 6px;padding-bottom: 6px;border-bottom:3px solid gray;">
136 <h4>{$file->get_url_web()|escape:'html'}
137 <div class="btn-group btn-toggle">
138 <button class="btn btn-xs btn-default properties">{xl t='Properties'|escape:'html'}</button>
139 <button class="btn btn-xs btn-primary active">{xl t='Contents'|escape:'html'}</button>
140 </div>
141 <span style="float:right;">
142 <a class="css_button" href='' onclick='return popoutcontent(this)' title="{xl t='Pop Out Full Screen.'|escape:'html'}">
143 <span class="glyphicon glyphicon-fullscreen"></span></a>
144 <a class="css_button" href="{$web_path}" title="{xl t='Original file'|escape:'html'}" onclick="top.restoreSession()"><span>{xl t='Download'|escape:'html'}</span></a>
145 <a class="css_button" href='' onclick='return showpnotes({$file->get_id()})'><span>{xl t='Show Notes'|escape:'html'}</span></a>
146 {$delete_string}
147 {if $file->get_ccr_type($file->get_id()) eq "CCR" and ($file->get_mimetype($file->get_id()) eq "application/xml" or $file->get_mimetype($file->get_id()) eq "text/xml") and
148 $file->get_imported($file->get_id()) eq 0 }
149 <a class="css_button" href='javascript:' onclick='return import_ccr({$file->get_id()})'><span>{xl t='Import'|escape:'html'}</span></a>
150 {/if}
151 </span>
152 </h4>
153 </div>
154 </td>
155 </tr>
156 <tr id="DocProperties" style="display:none;">
157 <td valign="top">
158 {if !$hide_encryption}
159 <div class="text">
160 <form method="post" name="document_encrypt" action="{$web_path}" onsubmit="return top.restoreSession()">
161 <div>
162 <div style="float:left">
163 <b>{xl t='Encryption'|escape:'html'}</b>&nbsp;
164 </div>
165 <div style="float:none">
166 <a href="javascript:;" onclick="submitNonEmpty( document.forms['document_encrypt'] );">(<span>{xl t='download encrypted file'|escape:'html'})</span></a>
167 </div>
168 </div>
169 <div>
170 {xl t='Pass Phrase'|escape:'html'}:
171 <input title="{xl t='Supports TripleDES encryption/decryption only.'|escape:'html'} {xl t='Leaving the pass phrase blank will not encrypt the document'|escape:'html'}" type='text' size='20' name='passphrase' id='passphrase' value=''/>
172 <input type="hidden" name="encrypted" value="true"></input>
173 </div>
174 </form>
175 </div>
176 <br/>
177 {/if}
178 <div class="text">
179 <form method="post" name="document_validate" action="{$VALIDATE_ACTION}" onsubmit="return top.restoreSession()">
180 <div>
181 <div style="float:left">
182 <b>{xl t='Sha-1 Hash'|escape:'html'}:</b>&nbsp;
183 <i>{$file->get_hash()|escape:'html'}</i>&nbsp;
184 </div>
185 <div style="float:none">
186 <a href="javascript:;" onclick="document.forms['document_validate'].submit();">(<span>{xl t='validate'|escape:'html'})</span></a>
187 </div>
188 </div>
189 </form>
190 </div>
191 <br/>
192 <div class="text">
193 <form method="post" name="document_update" action="{$UPDATE_ACTION}" onsubmit="return top.restoreSession()">
194 <div>
195 <div style="float:left">
196 <b>{xl t='Update'|escape:'html'}</b>&nbsp;
197 </div>
198 <div style="float:none">
199 <a href="javascript:;" onclick="document.forms['document_update'].submit();">(<span>{xl t='submit'|escape:'html'})</span></a>
200 </div>
201 </div>
202 <div>
203 {xl t='Rename'|escape:'html'}:
204 <input type='text' size='20' name='docname' id='docname' value='{$file->get_url_web()|escape:'html'}'/>
205 </div>
206 <div>
207 {xl t='Date'|escape:'html'}:
208 <input type='text' size='10' class='datepicker' name='docdate' id='docdate'
209 value='{$DOCDATE|escape:'html'}' title='{xl t='yyyy-mm-dd document date'|escape:'html'}' />
210 <select name="issue_id">{$ISSUES_LIST}</select>
211 </div>
212 </form>
213 </div>
215 <br/>
217 <div class="text">
218 <form method="post" name="document_move" action="{$MOVE_ACTION}" onsubmit="return top.restoreSession()">
219 <div>
220 <div style="float:left">
221 <b>{xl t='Move'|escape:'html'}</b>&nbsp;
222 </div>
223 <div style="float:none">
224 <a href="javascript:;" onclick="document.forms['document_move'].submit();">(<span>{xl t='submit'|escape:'html'})</span></a>
225 </div>
226 </div>
228 <div>
229 <select name="new_category_id">{$tree_html_listbox}</select>&nbsp;
230 {xl t='Move to Patient'|escape:'html'} # <input type="text" name="new_patient_id" size="4" />
231 <a href="javascript:{literal}{}{/literal}"
232 onclick="top.restoreSession();var URL='controller.php?patient_finder&find&form_id={"document_move['new_patient_id']"|escape:"url"}&form_name={"document_move['new_patient_name']"|escape:"url"}'; window.open(URL, 'document_move', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=450,height=400,left=425,top=250');">
233 <img src="images/stock_search-16.png" border="0" /></a>
234 <input type="hidden" name="new_patient_name" value="" />
235 </div>
236 </form>
237 </div>
239 <br/>
241 <div class="text">
242 <form method="post" name="document_tag" id="document_tag" action="{$TAG_ACTION}" onsubmit="return top.restoreSession()">
244 <div >
245 <div style="float:left">
246 <b>{xl t='Tag to Encounter'|escape:'html'}</b>&nbsp;
247 </div>
249 <div style="float:none">
250 <a href="javascript:;" onclick="tagUpdate();">(<span>{xl t='submit'|escape:'html'})</span></a>
251 </div>
252 </div>
254 <div>
255 <select id="encounter_id" name="encounter_id" >{$ENC_LIST}</select>&nbsp;
256 <a href="{$clear_encounter_tag}" class="hide_clear">(<span>{xl t='clear'|escape:'html'})</span></a>&nbsp;&nbsp;
257 <input type="checkbox" name="encounter_check" id="encounter_check" onclick='set_checkbox(this)'/> <label for="encounter_check"><b>{xl t='Create Encounter'|escape:'html'}</b></label>&nbsp;&nbsp;
258 {xl t='Visit Category'|escape:'html'} : &nbsp;<select id="visit_category_id" name="visit_category_id" disabled>{$VISIT_CATEGORY_LIST}</select>&nbsp;
260 </div>
261 </form>
262 </div>
263 <br/>
264 <div class="text">
265 <form method="post" name="img_procedure_tag" id="img_procedure_tag" action="{$IMG_PROCEDURE_TAG_ACTION}" onsubmit="return top.restoreSession()">
266 <input type='hidden' name='procedure_code' value=''>
267 <div>
268 <div style="float:left">
269 <b>{xl t='Tag to Image Procedure'|escape:'html'}</b>&nbsp;
270 </div>
271 <div style="float:none">
272 <a href="javascript:;" onclick="ImgProcedure();">(<span>{xl t='submit'|escape:'html'})</span></a>
273 </div>
274 </div>
275 <div>
276 <select id="image_procedure_id" name="image_procedure_id">{$IMAGE_PROCEDURE_LIST}</select>&nbsp;
277 <a href="{$clear_procedure_tag}">(<span>{xl t='clear'|escape:'html'})</span></a>
278 </div>
279 </form>
280 </div>
282 <br/>
284 <form name="notes" method="post" action="{$NOTE_ACTION}" onsubmit="return top.restoreSession()">
285 <div class="text">
286 <div>
287 <div style="float:left">
288 <b>{xl t='Notes'|escape:'html'}</b>&nbsp;
289 </div>
290 <div style="float:none">
291 <a href="javascript:;" onclick="document.notes.identifier.value='no';document.forms['notes'].submit();">(<span>{xl t='add'|escape:'html'}</span>)</a>
292 &nbsp;&nbsp;&nbsp;<b>{xl t='Email'|escape:'html'}</b>&nbsp;
293 <input type="text" size="25" name="provide_email" id="provide_email" />
294 <input type="hidden" name="identifier" id="identifier" />
295 <a href="javascript:;" onclick="javascript:document.notes.identifier.value='yes';document.forms['notes'].submit();">
296 (<span>{xl t='Send'|escape:'html'}</span>)
297 </a>
298 </div>
299 <div>
301 </div>
302 <div style="float:none">
304 </div>
305 <div>
306 <textarea cols="53" rows="8" wrap="virtual" name="note" style="width:100%"></textarea><br>
307 <input type="hidden" name="process" value="{$PROCESS|escape:'html'}" />
308 <input type="hidden" name="foreign_id" value="{$file->get_id()|escape:'html'}" />
310 {if $notes}
311 <div style="margin-top:7px">
312 {foreach name=note_loop from=$notes item=note}
313 <div>
314 {xl t='Note'|escape:'html'} #{$note->get_id()|escape:'html'}
315 {xl t='Date:'|escape:'html'} {$note->get_date()|escape:'html'}
316 {$note->get_note()|escape:'html'}
317 {if $note->get_owner()}
318 &nbsp;-{user_info id=$note->get_owner()}
319 {/if}
320 </div>
321 {/foreach}
322 {/if}
323 </div>
324 </div>
325 </div>
326 </form>
327 <h4>{xl t='Contents'|escape:'html'}</h4>
328 </td>
329 </tr>
330 <tr id="DocContents" style="height:100%">
331 <td>
332 {if $file->get_mimetype() eq "image/tiff"}
333 <embed frameborder="0" style="height:84vh" type="{$file->get_mimetype()|escape:'html'}" src="{$web_path|escape:'html'}as_file=false"></embed>
334 {elseif $file->get_mimetype() eq "image/png" or
335 $file->get_mimetype() eq "image/jpg" or
336 $file->get_mimetype() eq "image/jpeg" or
337 $file->get_mimetype() eq "image/gif" or
338 $file->get_mimetype() eq "application/pdf" }
339 <iframe frameborder="0" style="height:84vh" type="{$file->get_mimetype()|escape:'html'}" src="{$web_path|escape:'html'}as_file=false"></iframe>
340 {elseif $file->get_mimetype() eq "application/dicom"}
341 <iframe frameborder="0" style="height:84vh" type="{$file->get_mimetype()|escape:'html'}" src="{$GLOBALS.webroot}/library/dicom_frame.php?web_path={$web_path|escape:'html'}as_file=false"></iframe>
342 {elseif $file->get_ccr_type($file->get_id()) ne "CCR" and $file->get_ccr_type($file->get_id()) ne "CCD"}
343 <iframe frameborder="0" style="height:84vh" type="{$file->get_mimetype()|escape:'html'}" src="{$web_path|escape:'html'}as_file=true"></iframe>
344 {/if}
345 </td>
346 </tr>
347 </table>
348 <script language='JavaScript'>
349 {literal}
350 $('.btn-toggle').click(function() {
351 $(this).find('.btn').toggleClass('active');
353 if ($(this).find('.btn-primary').length >0) {
354 $(this).find('.btn').toggleClass('btn-primary');
357 $(this).find('.btn').toggleClass('btn-default');
358 var show_prop = ($(this).find('.properties.active').length > 0 ? 'block':'none');
359 $("#DocProperties").css('display', show_prop);
361 {/literal}
362 </script>