Commit generated changelog for 7.0.2.1 (#7458)
[openemr.git] / contrib / forms / xmlformgen / xslt / view.php.xslt
blob3b2127f1f45ba03669d0d1db9024e8e1169c1eac
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!-- Generated by Hand -->
3 <!--
4 Copyright (C) 2011 Julia Longtin <julia.longtin@gmail.com>
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.
10 -->
11 <xsl:stylesheet version="1.0"
12 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
13 <xsl:output method="xml" omit-xml-declaration="yes"/>
14 <xsl:include href="common_objects.xslt"/>
15 <xsl:include href="field_objects.xslt"/>
16 <xsl:strip-space elements="*"/>
17 <xsl:template match="/">
18 <xsl:apply-templates select="form"/>
19 </xsl:template>
20 <!-- The variable telling field_objects.xslt what form is calling it -->
21 <xsl:variable name="page">view</xsl:variable>
22 <!-- 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. -->
23 <xsl:variable name="fetchrow">xyzzy</xsl:variable>
24 <xsl:template match="form">
25 <xsl:text disable-output-escaping="yes"><![CDATA[<?php
27 * The page shown when the user requests to see this form. Allows the user to edit form contents, and save. has a button for printing the saved form contents.
30 /* for $GLOBALS[], ?? */
31 require_once('../../globals.php');
32 require_once($GLOBALS['srcdir'].'/api.inc.php');
33 /* for generate_form_field, ?? */
34 require_once($GLOBALS['srcdir'].'/options.inc.php');
35 /* note that we cannot include options_listadd.inc.php here, as it generates code before the <html> tag */
37 use OpenEMR\Common\Acl\AclMain;
38 use OpenEMR\Core\Header;
40 ]]></xsl:text>
41 <!-- These templates generate PHP code -->
42 <xsl:apply-templates select="table|RealName|safename|acl|style"/>
43 <!-- Fetch form contents from the database. -->
44 <xsl:apply-templates select="table" mode="fetch"/>
45 <xsl:apply-templates select="layout|manual" mode="head"/>
46 <xsl:if test="//table[@type='extended']">
47 <xsl:text disable-output-escaping="yes"><![CDATA[$submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=encounter&amp;id='.$_GET['id'];]]></xsl:text>
48 </xsl:if>
49 <xsl:if test="//table[@type='form']">
50 <xsl:text disable-output-escaping="yes"><![CDATA[$submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=update&amp;return=encounter&amp;id='.$_GET['id'];]]></xsl:text>
51 </xsl:if>
52 <xsl:text disable-output-escaping="yes"><![CDATA[
53 if ($_GET['mode']) {
54 if ($_GET['mode']=='noencounter') {
55 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=show&amp;id='.$_GET['id'];
56 $returnurl = 'show.php';
59 else
61 $returnurl = $GLOBALS['form_exit_url'];
64 ]]></xsl:text>
65 <!-- FIXME: this needs to work for layout based fields, as well. ideas? -->
66 <xsl:if test="//field[@type='date']">
67 <xsl:text disable-output-escaping="yes"><![CDATA[/* remove the time-of-day from all date fields */
68 ]]></xsl:text>
69 <xsl:apply-templates select="//field[@type='date']" mode="split_timeofday"/>
70 </xsl:if>
71 <xsl:call-template name="generate_chkdata"/>
72 <xsl:text disable-output-escaping="yes"><![CDATA[
73 ?><!DOCTYPE html>
74 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
75 <head>
77 <!-- declare this document as being encoded in UTF-8 -->
78 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
80 <!-- assets -->
81 <?php Header::setupHeader('datetime-picker'); ?>
82 <!-- Form Specific Stylesheet. -->
83 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css">
85 <script>
86 // this line is to assist the calendar text boxes
87 var mypcc = <?php echo js_escape($GLOBALS['phone_country_code']); ?>;
89 <!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
90 function PrintForm() {
91 newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
94 </script>
95 <title><?php echo htmlspecialchars('View '.$form_name); ?></title>
97 </head>
98 <body class="body_top">
100 <div id="title">
101 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
102 <span class="title"><?php htmlspecialchars(xl($form_name,'e')); ?></span>
103 <span class="back">(<?php xl('Back','e'); ?>)</span>
104 </a>
105 </div>
107 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
109 <!-- Save/Cancel buttons -->
110 <div id="top_buttons" class="top_buttons">
111 <fieldset class="top_buttons">
112 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
113 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
114 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
115 </fieldset>
116 </div><!-- end top_buttons -->
118 <!-- container for the main body of the form -->
119 <div id="form_container">
120 <fieldset>
122 ]]></xsl:text>
123 <xsl:apply-templates select="H2|H3|H4|manual|layout"/>
124 <xsl:text disable-output-escaping="yes"><![CDATA[
125 </fieldset>
126 </div> <!-- end form_container -->
128 <!-- Save/Cancel buttons -->
129 <div id="bottom_buttons" class="button_bar">
130 <fieldset>
131 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
132 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
133 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
134 </fieldset>
135 </div><!-- end bottom_buttons -->
136 </form>
137 <script>
138 // jQuery stuff to make the page a little easier to use
140 $(function () {
141 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
143 <?php if ($returnurl == 'show.php') { ?>
144 $(".dontsave").click(function() { location.href='<?php echo $returnurl; ?>'; });
145 <?php } else { ?>
146 $(".dontsave").click(function() { parent.closeTab(window.name, false); });
147 <?php } ?>
149 $(".print").click(function() { PrintForm(); });
150 $(".sectionlabel input").click( function() {
151 var section = $(this).attr("data-section");
152 if ( $(this).attr('checked' ) ) {
153 $("#"+section).show();
154 } else {
155 $("#"+section).hide();
159 $(".sectionlabel input").attr( 'checked', 'checked' );
160 $(".section").show();
162 $('.datepicker').datetimepicker({
163 <?php $datetimepicker_timepicker = false; ?>
164 <?php $datetimepicker_showseconds = false; ?>
165 <?php $datetimepicker_formatInput = false; ?>
166 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
167 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
169 $('.datetimepicker').datetimepicker({
170 <?php $datetimepicker_timepicker = true; ?>
171 <?php $datetimepicker_showseconds = false; ?>
172 <?php $datetimepicker_formatInput = false; ?>
173 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
174 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
177 </script>
178 </body>
179 </html>
180 ]]></xsl:text>
181 </xsl:template>
182 </xsl:stylesheet>