1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <!-- Generated by Hand -->
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.
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"/>
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 */
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
&return=encounter
&id='.$_GET['id'];]]
></xsl:text>
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
&return=encounter
&id='.$_GET['id'];]]
></xsl:text>
50 <xsl:text disable-output-escaping=
"yes"><![CDATA[
52 if ($_GET['mode']=='noencounter') {
53 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new
&return=show
&id='.$_GET['id'];
54 $returnurl = 'show.php';
59 $returnurl = 'encounter_top.php';
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 */
67 <xsl:apply-templates select=
"//field[@type='date']" mode=
"split_timeofday"/>
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">
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 -->
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"/>
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>
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>
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; ?>");
116 <title><?php echo htmlspecialchars('View '.$form_name);
?></title>
119 <body class=
"body_top">
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>
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'); ?>" />
137 </div><!-- end top_buttons -->
139 <!-- container for the main body of the form -->
140 <div id=
"form_container">
144 <xsl:apply-templates select=
"H2|H3|H4|manual|layout"/>
145 <xsl:text disable-output-escaping=
"yes"><![CDATA[
147 </div> <!-- end form_container -->
149 <!-- Save/Cancel buttons -->
150 <div id=
"bottom_buttons" class=
"button_bar">
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'); ?>" />
156 </div><!-- end bottom_buttons -->
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();
171 $(
"#"+section).hide();
175 $(
".sectionlabel input").attr( 'checked', 'checked' );
176 $(
".section").show();