forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show.php.xslt
132 lines (111 loc) · 4.51 KB
/
show.php.xslt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Generated by Hand -->
<!--
Copyright (C) 2011 Julia Longtin <[email protected]>
This program is free software; you can redistribute it and/or
Modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http:https://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:include href="common_objects.xslt"/>
<xsl:include href="report_objects.xslt"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates select="form"/>
</xsl:template>
<!-- The variable telling field_objects.xslt what form is calling it -->
<xsl:variable name="page">show</xsl:variable>
<!-- if fetchrow has contents, a variable with that name will be created by field_objects.xslt, and all fields created by it will retreive values from it. -->
<xsl:variable name="fetchrow">xyzzy</xsl:variable>
<xsl:template match="form">
<xsl:text disable-output-escaping="yes"><![CDATA[<?php
/*
* The page shown when the user requests to see this form in a "report view". does not allow editing contents, or saving. has 'print' and 'delete' buttons.
*/
/* for $GLOBALS[], ?? */
require_once('../../globals.php');
require_once($GLOBALS['srcdir'].'/api.inc');
/* for display_layout_rows(), ?? */
require_once($GLOBALS['srcdir'].'/options.inc.php');
use OpenEMR\Common\Acl\AclMain;
use OpenEMR\Core\Header;
]]></xsl:text>
<!-- These templates generate PHP code -->
<xsl:apply-templates select="table|RealName|safename|acl|style"/>
<!-- Fetch form contents from the database. -->
<xsl:apply-templates select="table" mode="fetch"/>
<!-- set up for using the layouts engine -->
<xsl:apply-templates select="layout" mode="head"/>
<!-- and set up the fake table of layouts for fields using the manual engine -->
<xsl:apply-templates select="manual" mode="head"/>
<xsl:text disable-output-escaping="yes"><![CDATA[
/* since we have no-where to return, abuse returnurl to link to the 'edit' page */
/* FIXME: pass the ID, create blank rows if necissary. */
$returnurl = "../../forms/$form_folder/view.php?mode=noencounter";
]]></xsl:text>
<!-- FIXME: this needs to work for layout based fields added after form creation. ideas? -->
<xsl:if test="//field[@type='date']">
<xsl:text disable-output-escaping="yes"><![CDATA[/* remove the time-of-day from all date fields */
]]></xsl:text>
<xsl:apply-templates select="//field[@type='date']" mode="split_timeofday"/>
</xsl:if>
<xsl:call-template name="generate_chkdata"/>
<xsl:text disable-output-escaping="yes"><![CDATA[
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http:https://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http:https://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<!-- declare this document as being encoded in UTF-8 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
<!-- assets -->
<?php Header::setupHeader(); ?>
<!-- Form Specific Stylesheet. -->
<link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
<script type="text/javascript">
<!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
function PrintForm() {
newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
}
</script>
<title><?php echo htmlspecialchars('Show '.$form_name); ?></title>
</head>
<body class="body_top">
<div id="title">
<span class="title"><?php xl($form_name,'e'); ?></span>
<?php
if ($thisauth_write_addonly)
{ ?>
<a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
<span class="back"><?php xl($tmore,'e'); ?></span>
</a>
<?php }; ?>
</div>
<form method="post" id="<?php echo $form_folder; ?>" action="">
<!-- container for the main body of the form -->
<div id="form_container">
<div id="show">
]]></xsl:text>
<xsl:apply-templates select="H2|H3|H4|layout|manual"/>
<xsl:text disable-output-escaping="yes"><![CDATA[
</div><!-- end show -->
</div><!-- end form_container -->
<!-- Print button -->
<div id="button_bar" class="button_bar">
<fieldset class="button_bar">
<input type="button" class="print" value="<?php xl('Print','e'); ?>" />
</fieldset>
</div><!-- end button_bar -->
</form>
<script type="text/javascript">
// jQuery stuff to make the page a little easier to use
$(function () {
$(".print").click(function() { PrintForm(); });
});
</script>
</body>
</html>
]]></xsl:text>
</xsl:template>
</xsl:stylesheet>