Skip to content

Instantly share code, notes, and snippets.

@r351574nc3
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save r351574nc3/c0d86252e4bb3aefdbf2 to your computer and use it in GitHub Desktop.

Select an option

Save r351574nc3/c0d86252e4bb3aefdbf2 to your computer and use it in GitHub Desktop.
hiloPreApproval
diff --git a/03_hiloPreApproval_eDocLite.xml b/03_hiloPreApproval_eDocLite-leo.xml
index 6a7fda6..5846765 100644
--- a/03_hiloPreApproval_eDocLite.xml
+++ b/03_hiloPreApproval_eDocLite-leo.xml
@@ -109,33 +109,6 @@
<script language="javascript" />
<xsl:call-template name="htmlHead" />
-<script language="JavaScript">
-$(document).ready( function () {
-
-debugger;
-
-$('table#RRCS_table input[name=RRCS_HILO]').change(function()
-{
- updateRRCS();
-});
-
-$('table#RRCS_table input[name=RRCS_3RD]').change(function()
-{
- updateRRCS();
-});
-
-$('table#RRCS_table input[name=RRCS_OTHER]').change(function()
-{
- updateRRCS();
-});
-
-function updateRRCS() {
- var rccs_sum = parseInt($('input[name=RRCS_HILO]').val()) + parseInt($('input[name=RRCS_3RD]').val()) + parseInt($('input[name=RRCS_OTHER]').val());
- $('input[name=RRCS_Total]').val(rccs_sum);validateField(getFieldInputs(fieldName), fieldName);
- }
-
-</script>
-
<style type="text/css">
html, body, td {
@@ -168,7 +141,7 @@ function updateRRCS() {
width:238px;
font-weight:bold;
}
-
+
.formTable td.fieldNotes {
color:#011F5B;
text-align:left;
@@ -236,7 +209,7 @@ function updateRRCS() {
<br />
<br />
- <table id = 'RRCStable' border="0" cellspacing="0" cellpadding="0" class="formTable" width="640">
+ <table id = 'RRCS_table' border="0" cellspacing="0" cellpadding="0" class="formTable" width="640">
<tr>
<td class="fieldLabel">Resource Requirements for Cost Sharing Total $</td>
@@ -302,6 +275,26 @@ function updateRRCS() {
</table>
+<script
+ src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
+<script language="JavaScript">
+var rrcsHilo = $('input[name=RRCS_HILO]')
+var rrcs3rd = $('input[name=RRCS_3RD]')
+var rrcsOther = $('input[name=RRCS_OTHER]')
+var rrcsTotal = $('input[name=RRCS_Total]')
+
+$(document).ready(function() {
+$('#RRCS_table input[name!=RRCS_Total]').change(function() {
+var rccs_sum = getValue(rrcsHilo) + getValue(rrcs3rd) + getValue(rrcsOther);
+rrcsTotal.val(rccs_sum);
+});
+}
+);
+
+function getValue(element) {
+return isNaN(parseInt(element.val())) ? 0 : parseInt(element.val())
+}</script>
+
</xsl:template>
<xsl:template name="nbsp">
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="ns:workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="ns:workflow resource:WorkflowData">
<edoclite xmlns="ns:workflow/EDocLite" xsi:schemaLocation="ns:workflow/EDocLite resource:EDocLite">
<edl name="hiloPreApproval.form" title="hiloPreApproval">
<security />
<createInstructions>** Questions with an asterisk are required.</createInstructions>
<instructions>** Questions with an asterisk are required.</instructions>
<validations />
<attributes />
<fieldDef name="RRCS_Total" title="Resource Requirements for Cost Sharing Total $">
<display>
<type>text</type>
<meta>
<name>size</name>
<value>40</value>
</meta>
</display>
</fieldDef>
<fieldDef name="RRCS_HILO" title="Hilo:">
<display>
<type>text</type>
<meta>
<name>size</name>
<value>40</value>
</meta>
</display>
<validation required="true">
<message>Please enter Resource Requirements for Cost Sharing Hilo Portion (zero if none)</message>
</validation>
</fieldDef>
<fieldDef name="RRCS_3RD" title="3rd Party:">
<display>
<type>text</type>
<meta>
<name>size</name>
<value>40</value>
</meta>
</display>
<validation required="true">
<message>Please enter Resource Requirements for Cost Sharing 3rd Party Portion (zero if none)</message>
</validation>
</fieldDef>
<fieldDef name="RRCS_OTHER" title="Other:">
<display>
<type>text</type>
<meta>
<name>size</name>
<value>40</value>
</meta>
</display>
<validation required="true">
<message>Please enter Resource Requirements for Cost Sharing Other Portion (zero if none)</message>
</validation>
</fieldDef>
<fieldDef name="space" title="Space Requirements">
<display>
<type>text</type>
<meta>
<name>size</name>
<value>40</value>
</meta>
</display>
<validation required="true">
<message>Please enter Space Requirements</message>
</validation>
</fieldDef>
</edl>
<style name="hiloPreApproval.style">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my-class="xalan://org.kuali.rice.kew.edl.WorkflowFunctions" version="1.0"
xmlns:java="http://xml.apache.org/xalan/java">
<!--
widgets is simply more xslt that contains common functionality that greatly
simplifies html rendering. It is somewhat complicated but does not require
changes or full understanding unless enhancements are required.
-->
<xsl:include href="widgets" />
<xsl:output indent="yes" method="html" omit-xml-declaration="yes"
version="4.01" />
<!--
variables in the current version of xslt cannot be changed once set. Below they
are set to various values often fed by java classes or to values contained in
workflow xml. Not all of these are used in this form but are shown because often
they can be useful. The ones prefixed with my-class are methods that are exposed
by workflow to Edoclite.
-->
<xsl:variable name="actionable" select="/documentContent/documentState/actionable" />
<xsl:variable name="docHeaderId" select="/documentContent/documentState/docId" />
<xsl:variable name="editable" select="/documentContent/documentState/editable" />
<xsl:variable name="globalReadOnly"
select="/documentContent/documentState/editable != 'true'" />
<xsl:variable name="docStatus" select="//documentState/workflowDocumentState/status" />
<xsl:variable name="isAtNodeInitiated" select="my-class:isAtNode($docHeaderId, 'Initiated')" />
<xsl:variable name="isPastInitiated"
select="my-class:isNodeInPreviousNodeList('Initiated', $docHeaderId)" />
<xsl:variable name="isUserInitiator" select="my-class:isUserInitiator($docHeaderId)" />
<xsl:variable name="workflowUser"
select="my-class:getWorkflowUser().authenticationUserId().id()" />
<xsl:param name="overrideMain" select="'true'" />
<!--
mainForm begins here. Execution of stylesheet begins here. It calls other
templates which can call other templates. Position of templates beyond this
point do not matter.
-->
<xsl:template name="mainForm">
<html xmlns="">
<head>
<script language="javascript" />
<xsl:call-template name="htmlHead" />
<style type="text/css">
html, body, td {
font-family:Tahoma,Arial,Helvetica,sans-serif;
font-size:11px;
}
h1 {
font-size:22px;
line-height:22px;
}
h2 {
border-bottom:1px solid #6699CC;
color:#990000;
font-size:16px;
font-weight:bold;
line-height:20px;
width:650px;
}
.formTable td {
padding:2px 0;
}
.formTable td.fieldLabel {
color:#011F5B;
text-align:right;
vertical-align:top;
width:238px;
font-weight:bold;
}
.formTable td.fieldNotes {
color:#011F5B;
text-align:left;
vertical-align:top;
width:238px;
font-weight:bold;
}
.formTable td.fieldAsterisk {
color:#990000;
text-align:left;
width:12px;
vertical-align:top;
}
.formTable td.fieldInfo {
text-align:left;
width:auto;
}
p {
width: 650px;
}
div.mainDiv {
width: 900px;
}
</style>
</head>
<body onload="onPageLoad()">
<xsl:call-template name="errors" />
<!--
the header is usefule because it tells the user whether they are in
'Editing' mode or 'Read Only' mode.
-->
<xsl:call-template name="header" />
<xsl:call-template name="instructions" />
<xsl:variable name="formTarget" select="'EDocLite'" />
<!--
validateOnSubmit is a function in edoclite1.js which also supports
edloclite forms and can be somewhat complicated but does not require
modification unless enhancements are required.
-->
<form action="{$formTarget}" enctype="multipart/form-data" id="edoclite"
method="post" onsubmit="return validateOnSubmit(this)">
<xsl:call-template name="hidden-params" />
<xsl:call-template name="mainBody" />
<xsl:call-template name="notes" />
<br />
<xsl:call-template name="buttons" />
<br />
</form>
<xsl:call-template name="footer" />
</body>
</html>
</xsl:template>
<!--
mainBody template begins here. It calls other templates which can call other
templates. Position of templates do not matter.
-->
<xsl:template name="mainBody">
<h1>Hilo Proposal Development Pre-Approval Form</h1>
<br />
<br />
<table id = 'RRCS_table' border="0" cellspacing="0" cellpadding="0" class="formTable" width="640">
<tr>
<td class="fieldLabel">Resource Requirements for Cost Sharing Total $</td>
<td valign="top" class="fieldAsterisk">*</td>
<td class="fieldInfo" id="userId">
<xsl:call-template name="widget_render">
<xsl:with-param name="fieldName" select="'RRCS_Total'" />
<xsl:with-param name="renderCmd" select="'input'" />
</xsl:call-template>
</td>
</tr>
<tr>
<td class="fieldLabel">UH Hilo:</td>
<td valign="top" class="fieldAsterisk"></td>
<td class="fieldInfo" id="userId">
<xsl:call-template name="widget_render">
<xsl:with-param name="fieldName" select="'RRCS_HILO'" />
<xsl:with-param name="renderCmd" select="'input'" />
</xsl:call-template>
</td>
</tr>
<tr>
<td class="fieldLabel">3rd Party:</td>
<td valign="top" class="fieldAsterisk"></td>
<td class="fieldInfo" id="userId">
<xsl:call-template name="widget_render">
<xsl:with-param name="fieldName" select="'RRCS_3RD'" />
<xsl:with-param name="renderCmd" select="'input'" />
</xsl:call-template>
</td>
</tr>
<tr>
<td class="fieldLabel">Other:</td>
<td valign="top" class="fieldAsterisk">*</td>
<td class="fieldInfo" id="userId">
<xsl:call-template name="widget_render">
<xsl:with-param name="fieldName" select="'RRCS_OTHER'" />
<xsl:with-param name="renderCmd" select="'input'" />
</xsl:call-template>
</td>
</tr>
<tr>
<td/>
<td/>
<td class="fieldNotes">
Note: When developing propsoals for extramural support. UH discourages investigators from<br />
making cost sharing commitments unless such commitments are required to meet<br/>
sponsor requirements. See <a href="http://www.ors.hawaii.edu/index.php/apply/80-apply/134-cost-sharing" target="_blank">link</a> to learn more about cost sharing.
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="formTable" width="640">
<tr>
<td class="fieldLabel">Space Requirements</td>
<td valign="top" class="fieldAsterisk">*</td>
<td class="fieldInfo" id="userId">
<xsl:call-template name="widget_render">
<xsl:with-param name="fieldName" select="'space'" />
<xsl:with-param name="renderCmd" select="'input'" />
</xsl:call-template>
</td>
</tr>
</table>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script language="JavaScript">
var rrcsHilo = $('input[name=RRCS_HILO]')
var rrcs3rd = $('input[name=RRCS_3RD]')
var rrcsOther = $('input[name=RRCS_OTHER]')
var rrcsTotal = $('input[name=RRCS_Total]')
$(document).ready(function() {
$('#RRCS_table input[name!=RRCS_Total]').change(function() {
var rccs_sum = getValue(rrcsHilo) + getValue(rrcs3rd) + getValue(rrcsOther);
rrcsTotal.val(rccs_sum);
});
}
);
function getValue(element) {
return isNaN(parseInt(element.val())) ? 0 : parseInt(element.val())
}</script>
</xsl:template>
<xsl:template name="nbsp">
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</xsl:template>
</xsl:stylesheet>
</style>
<association>
<docType>hiloPreApproval.doctype</docType>
<definition>hiloPreApproval.form</definition>
<style>hiloPreApproval.style</style>
<active>true</active>
</association>
</edoclite>
</data>
var rrcsHilo = $('input[name=RRCS_HILO]')
var rrcs3rd = $('input[name=RRCS_3RD]')
var rrcsOther = $('input[name=RRCS_OTHER]')
var rrcsTotal = $('input[name=RRCS_Total]')
$(document).ready(function() {
$('#RRCStable input[name!=RRCS_Total]').change(function() {
var rccs_sum = getValue(rrcsHilo) + getValue(rrcs3rd) + getValue(rrcsOther);
rrcsTotal.val(rccs_sum);
});
}
);
function getValue(element) {
return isNaN(parseInt(element.val())) ? 0 : parseInt(element.val())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment