added cache clearing support for dialog.js (#411)
[openemr.git] / contrib / forms / xmlformgen / xslt / new.php.xslt
blob14edfffdca70d1286779b8f0336898870f9fc539
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">new</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"></xsl:variable>
24 <xsl:template match="form">
25 <xsl:text disable-output-escaping="yes"><![CDATA[<?php
27 * The page shown when the user requests a new form. allows the user to enter form contents, and save.
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 <!-- no call to table's fetch, don't fetch form contents from the DB. -->
42 <xsl:apply-templates select="layout|manual" mode="head"/>
43 <xsl:if test="//table[@type='extended']">
44 <xsl:text disable-output-escaping="yes"><![CDATA[
45 /* new is only called from encounters. */
46 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=encounter';]]></xsl:text>
47 </xsl:if>
48 <xsl:if test="//table[@type='form']">
49 <xsl:text disable-output-escaping="yes"><![CDATA[$submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=encounter';]]></xsl:text>
50 </xsl:if>
51 <xsl:text disable-output-escaping="yes"><![CDATA[
52 /* no get logic here */
53 $returnurl = 'encounter_top.php';
54 ]]></xsl:text>
55 <!-- FIXME: this needs to work for layout based fields, as well. ideas? -->
56 <!-- no call to split_timeofday, no data from the db in the new form. -->
57 <!-- no check data call, as no data from the db goes into a new form -->
58 <xsl:text disable-output-escaping="yes"><![CDATA[
59 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
60 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
61 <head>
63 <!-- declare this document as being encoded in UTF-8 -->
64 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
66 <!-- supporting javascript code -->
67 <!-- for dialog -->
68 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
69 <!-- For jquery, required by the save and discard buttons. -->
70 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script>
71 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script>
73 <!-- Global Stylesheet -->
74 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css"/>
75 <!-- Form Specific Stylesheet. -->
76 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
78 <!-- pop up calendar -->
79 <style type="text/css">@import url(<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.css);</style>
80 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script>
81 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
82 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script>
84 <script type="text/javascript">
85 // this line is to assist the calendar text boxes
86 var mypcc = '<?php echo $GLOBALS['phone_country_code']; ?>';
88 <!-- a validator for all the fields expected in this form -->
89 function validate() {
90 return true;
93 <!-- a callback for validating field contents. executed at submission time. -->
94 function submitme() {
95 var f = document.forms[0];
96 if (validate(f)) {
97 top.restoreSession();
98 f.submit();
102 </script>
104 ]]></xsl:text>
105 <xsl:if test="//field[@type='dropdown_list_add']">
106 <xsl:text disable-output-escaping="yes"><![CDATA[<?php
108 /* support for the list-add selectbox feature. must be included inside of the <html> tags. */
109 require_once($GLOBALS['srcdir'].'/options_listadd.inc');
111 ?>]]></xsl:text>
112 </xsl:if>
113 <xsl:text disable-output-escaping="yes"><![CDATA[
115 <title><?php echo htmlspecialchars('New '.$form_name); ?></title>
117 </head>
118 <body class="body_top">
120 <div id="title">
121 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
122 <span class="title"><?php xl($form_name,'e'); ?></span>
123 <span class="back">(<?php xl('Back','e'); ?>)</span>
124 </a>
125 </div>
127 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
129 <!-- Save/Cancel buttons -->
130 <div id="top_buttons" class="top_buttons">
131 <fieldset class="top_buttons">
132 <input type="button" class="save" value="<?php xl('Save','e'); ?>" />
133 <input type="button" class="dontsave" value="<?php xl('Don\'t Save','e'); ?>" />
134 </fieldset>
135 </div><!-- end top_buttons -->
137 <!-- container for the main body of the form -->
138 <div id="form_container">
139 <fieldset>
141 ]]></xsl:text>
142 <xsl:apply-templates select="H2|H3|H4|manual|layout"/>
143 <xsl:text disable-output-escaping="yes"><![CDATA[
144 </fieldset>
145 </div> <!-- end form_container -->
147 <!-- Save/Cancel buttons -->
148 <div id="bottom_buttons" class="button_bar">
149 <fieldset>
150 <input type="button" class="save" value="<?php xl('Save','e'); ?>" />
151 <input type="button" class="dontsave" value="<?php xl('Don\'t Save','e'); ?>" />
152 </fieldset>
153 </div><!-- end bottom_buttons -->
154 </form>
155 <script type="text/javascript">
156 // jQuery stuff to make the page a little easier to use
158 $(document).ready(function(){
159 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
160 $(".dontsave").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl"; ?>'; });
162 $(".sectionlabel input").click( function() {
163 var section = $(this).attr("data-section");
164 if ( $(this).attr('checked' ) ) {
165 $("#"+section).show();
166 } else {
167 $("#"+section).hide();
171 $(".sectionlabel input").attr( 'checked', 'checked' );
172 $(".section").show();
174 </script>
175 </body>
176 </html>
177 ]]></xsl:text>
178 </xsl:template>
179 </xsl:stylesheet>