xml form generator (version from 1/28/2011)
[openemr.git] / contrib / forms / xmlformgen / xslt / view.php.xslt
blobd10c82ba41e93c3f36e141d63b2dcb53e8aacf0c
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 /* for acl_check(), ?? */
33 require_once($GLOBALS['srcdir'].'/api.inc');
34 /* for generate_form_field, ?? */
35 require_once($GLOBALS['srcdir'].'/options.inc.php');
36 /* note that we cannot include options_listadd.inc here, as it generates code before the <html> tag */
38 ]]></xsl:text>
39 <!-- These templates generate PHP code -->
40 <xsl:apply-templates select="table|RealName|safename|acl|style"/>
41 <!-- Fetch form contents from the database. -->
42 <xsl:apply-templates select="table" mode="fetch"/>
43 <xsl:apply-templates select="layout|manual" mode="head"/>
44 <xsl:if test="//table[@type='extended']">
45 <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>
46 </xsl:if>
47 <xsl:if test="//table[@type='form']">
48 <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>
49 </xsl:if>
50 <xsl:text disable-output-escaping="yes"><![CDATA[
51 if ($_GET['mode']) {
52 if ($_GET['mode']=='noencounter') {
53 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=show&amp;id='.$_GET['id'];
54 $returnurl = 'show.php';
57 else
59 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
62 ]]></xsl:text>
63 <!-- FIXME: this needs to work for layout based fields, as well. ideas? -->
64 <xsl:if test="//field[@type='date']">
65 <xsl:text disable-output-escaping="yes"><![CDATA[/* remove the time-of-day from all date fields */
66 ]]></xsl:text>
67 <xsl:apply-templates select="//field[@type='date']" mode="split_timeofday"/>
68 </xsl:if>
69 <xsl:call-template name="generate_chkdata"/>
70 <xsl:text disable-output-escaping="yes"><![CDATA[
71 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
72 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
73 <head>
75 <!-- declare this document as being encoded in UTF-8 -->
76 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
78 <!-- supporting javascript code -->
79 <!-- for dialog -->
80 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script>
81 <!-- For jquery, required by the save, discard, and print buttons. -->
82 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script>
83 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script>
85 <!-- Global Stylesheet -->
86 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css"/>
87 <!-- Form Specific Stylesheet. -->
88 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
90 ]]></xsl:text>
91 <xsl:if test="//field[@type='date']">
92 <xsl:text disable-output-escaping="yes"><![CDATA[<!-- supporting code for the pop up calendar(date picker) -->
93 <style type="text/css">@import url(<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.css);</style>
94 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script>
95 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
96 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script>
97 ]]></xsl:text>
98 </xsl:if>
99 <xsl:if test="//field[@type='time']">
100 <xsl:text disable-output-escaping="yes"><![CDATA[<!-- supporting code for the time picker -->
101 <script type="text/javascript" src="<?php echp $GLOBALS['webroot']; ?>/library/ui.timepicker.js"></script>
102 ]]></xsl:text>
103 </xsl:if>
104 <xsl:text disable-output-escaping="yes"><![CDATA[
106 <script type="text/javascript">
107 // this line is to assist the calendar text boxes
108 var mypcc = '<?php echo $GLOBALS['phone_country_code']; ?>';
110 <!-- support code for collapsing sections -->
111 function divclick(cb, divid) {
112 var divstyle = document.getElementById(divid).style;
113 if (cb.checked) {
114 divstyle.display = 'block';
115 } else {
116 divstyle.display = 'none';
118 return true;
121 <!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
122 function PrintForm() {
123 newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
126 </script>
127 <title><?php echo htmlspecialchars('View '.$form_name); ?></title>
129 </head>
130 <body class="body_top">
132 <div id="title">
133 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
134 <span class="title"><?php htmlspecialchars(xl($form_name,'e')); ?></span>
135 <span class="back">(<?php xl('Back','e'); ?>)</span>
136 </a>
137 </div>
139 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
141 <!-- Save/Cancel buttons -->
142 <div id="top_buttons" class="top_buttons">
143 <fieldset class="top_buttons">
144 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
145 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
146 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
147 </fieldset>
148 </div><!-- end top_buttons -->
150 <!-- container for the main body of the form -->
151 <div id="form_container">
152 <fieldset>
154 ]]></xsl:text>
155 <xsl:apply-templates select="H2|H3|H4|manual|layout"/>
156 <xsl:text disable-output-escaping="yes"><![CDATA[
157 </fieldset>
158 </div> <!-- end form_container -->
160 <!-- Save/Cancel buttons -->
161 <div id="bottom_buttons" class="button_bar">
162 <fieldset>
163 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
164 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
165 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
166 </fieldset>
167 </div><!-- end bottom_buttons -->
168 </form>
169 <script type="text/javascript">
170 // jQuery stuff to make the page a little easier to use
172 $(document).ready(function(){
173 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
174 $(".dontsave").click(function() { location.href='<?php echo $returnurl; ?>'; });
175 $(".print").click(function() { PrintForm(); });
177 </script>
178 </body>
179 </html>
180 ]]></xsl:text>
181 </xsl:template>
182 </xsl:stylesheet>