added cache clearing support for dialog.js (#411)
[openemr.git] / contrib / forms / xmlformgen / xslt / view.php.xslt
blob2ad0aafe53ddc392e0a57628bc4882336655f839
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 = 'encounter_top.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?v=<?php echo $v_js_includes; ?>"></script>
81 <!-- For jquery, required by the save, discard, and print buttons. -->
82 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.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 <!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
111 function PrintForm() {
112 newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
115 </script>
116 <title><?php echo htmlspecialchars('View '.$form_name); ?></title>
118 </head>
119 <body class="body_top">
121 <div id="title">
122 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
123 <span class="title"><?php htmlspecialchars(xl($form_name,'e')); ?></span>
124 <span class="back">(<?php xl('Back','e'); ?>)</span>
125 </a>
126 </div>
128 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
130 <!-- Save/Cancel buttons -->
131 <div id="top_buttons" class="top_buttons">
132 <fieldset class="top_buttons">
133 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
134 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
135 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
136 </fieldset>
137 </div><!-- end top_buttons -->
139 <!-- container for the main body of the form -->
140 <div id="form_container">
141 <fieldset>
143 ]]></xsl:text>
144 <xsl:apply-templates select="H2|H3|H4|manual|layout"/>
145 <xsl:text disable-output-escaping="yes"><![CDATA[
146 </fieldset>
147 </div> <!-- end form_container -->
149 <!-- Save/Cancel buttons -->
150 <div id="bottom_buttons" class="button_bar">
151 <fieldset>
152 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
153 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
154 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
155 </fieldset>
156 </div><!-- end bottom_buttons -->
157 </form>
158 <script type="text/javascript">
159 // jQuery stuff to make the page a little easier to use
161 $(document).ready(function(){
162 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
163 $(".dontsave").click(function() { location.href='<?php echo $returnurl; ?>'; });
164 $(".print").click(function() { PrintForm(); });
166 $(".sectionlabel input").click( function() {
167 var section = $(this).attr("data-section");
168 if ( $(this).attr('checked' ) ) {
169 $("#"+section).show();
170 } else {
171 $("#"+section).hide();
175 $(".sectionlabel input").attr( 'checked', 'checked' );
176 $(".section").show();
178 </script>
179 </body>
180 </html>
181 ]]></xsl:text>
182 </xsl:template>
183 </xsl:stylesheet>