bug 3973: make auto-fill button work on budget planning form

Also fixed a variety of XHTML validation errors.

Programming note: it is invalid XHTML and can break Javascript
to use element IDs and class names that start with digits.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
Galen Charlton 2010-02-17 06:17:31 -05:00
parent d746d80199
commit 1e09f54a97
2 changed files with 12 additions and 15 deletions

View file

@ -559,7 +559,7 @@ function calcTotalRow(cell) {
var bud_id = cell.className; var bud_id = cell.className;
var val1 = cell.value; var val1 = cell.value;
var remainingTotal = document.getElementById("budget_est_"+bud_id) ; var remainingTotal = document.getElementById("budget_est_"+bud_id).textContent;
var remainingNew =0; var remainingNew =0;
var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent; var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent;
var arr = getElementsByClass(bud_id); var arr = getElementsByClass(bud_id);
@ -594,10 +594,10 @@ function calcTotalRow(cell) {
function autoFillRow(bud_id) { function autoFillRow(bud_id) {
var remainingTotal = document.getElementById("budget_est_"+bud_id) ; var remainingTotal = document.getElementById("budget_est_"+bud_id).textContent;
var remainingNew = new Number; var remainingNew = new Number;
var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent; var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent;
var arr = getElementsByClass(bud_id); var arr = getElementsByClass("plan_entry_" + bud_id);
budgetTotal = budgetTotal.replace(/\,/, ""); budgetTotal = budgetTotal.replace(/\,/, "");
var qty = new Number; var qty = new Number;

View file

@ -1,6 +1,6 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --> <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title> <title>
Budget planning Budget &amp; fund planning
</title> </title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" --> <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="calendar.inc" --> <!-- TMPL_INCLUDE NAME="calendar.inc" -->
@ -13,11 +13,11 @@ Budget planning
<script src="<!-- TMPL_VAR NAME="yuipath" -->/event/event.js" type="text/javascript"></script> <script src="<!-- TMPL_VAR NAME="yuipath" -->/event/event.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/dom/dom.js" type="text/javascript"></script> <script src="<!-- TMPL_VAR NAME="yuipath" -->/dom/dom.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/menu/menu.js" type="text/javascript"></script> <script src="<!-- TMPL_VAR NAME="yuipath" -->/menu/menu.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/container/menu.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script> <script src="<!-- TMPL_VAR NAME="yuipath" -->/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script> <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Javascript // Javascript
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
@ -75,12 +75,9 @@ YAHOO.util.Event.onAvailable("popmenu", function () {
// oMenu.removeItem(2); // TODO..... // oMenu.removeItem(2); // TODO.....
}); });
//]]>
</script> </script>
<title>
Budget & Fund Planning
</title>
</head> </head>
<body> <body>
<!-- TMPL_INCLUDE NAME="header.inc" --> <!-- TMPL_INCLUDE NAME="header.inc" -->
@ -118,7 +115,7 @@ Budget & Fund Planning
<label for="show_mine">Show my funds only</label> <label for="show_mine">Show my funds only</label>
</td> </td>
<td> <td>
<label for="authcat_dropbox" > Select planning type:</label> <label for="authcat" > Select planning type:</label>
<!-- TMPL_VAR NAME="authcat_dropbox" --> <!-- TMPL_VAR NAME="authcat_dropbox" -->
<input type="submit" name="option_submit" value="Select" /> <input type="submit" name="option_submit" value="Select" />
</td> </td>
@ -192,7 +189,7 @@ Budget & Fund Planning
<!--/TMPL_IF --> <!--/TMPL_IF -->
<td align='left'><!-- TMPL_VAR NAME="budget_name_indent"--></td> <td align='left'><!-- TMPL_VAR NAME="budget_name_indent"--></td>
<td align='right'><span id='budget_tot_formatted" -->'><!-- TMPL_VAR NAME="budget_amount_formatted"-->&nbsp;</span> <td align='right'><span id='budget_tot_formatted_<!-- TMPL_VAR NAME="budget_id" -->'><!-- TMPL_VAR NAME="budget_amount_formatted"-->&nbsp;</span>
<!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS --> <!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
<div style="display:none;" id='budget_tot_<!-- TMPL_VAR NAME="budget_id" -->'><!-- TMPL_VAR NAME="budget_amount"--></div></td> <div style="display:none;" id='budget_tot_<!-- TMPL_VAR NAME="budget_id" -->'><!-- TMPL_VAR NAME="budget_amount"--></div></td>
@ -212,7 +209,7 @@ Budget & Fund Planning
<!-- TMPL_VAR NAME="estimated_amount" -->&nbsp; <!-- TMPL_VAR NAME="estimated_amount" -->&nbsp;
<input type="hidden" style="text-align: right;" name='<!-- TMPL_VAR NAME="cell_name"-->' value="<!-- TMPL_VAR NAME="estimated_amount" -->" /> <input type="hidden" style="text-align: right;" name='<!-- TMPL_VAR NAME="cell_name"-->' value="<!-- TMPL_VAR NAME="estimated_amount" -->" />
<!--TMPL_ELSE --> <!--TMPL_ELSE -->
<input type="text" style="text-align: right; width:90%; " size='6' name='<!-- TMPL_VAR NAME="cell_name"-->' value="<!-- TMPL_VAR NAME="estimated_amount" -->" id='<!-- TMPL_VAR NAME="budget_id"-->' class='<!-- TMPL_VAR NAME="budget_id"-->' onchange="calcTotalRow(this);" /> <input type="text" style="text-align: right; width:90%; " size='6' name='<!-- TMPL_VAR NAME="cell_name"-->' value="<!-- TMPL_VAR NAME="estimated_amount" -->" id='budget_<!-- TMPL_VAR NAME="budget_id"--><!-- TMPL_VAR NAME="colnum"-->' class='plan_entry_<!-- TMPL_VAR NAME="budget_id"-->' onchange="calcTotalRow(this);" />
<!--/TMPL_IF --> <!--/TMPL_IF -->
</td></tr> </td></tr>
@ -235,7 +232,7 @@ Budget & Fund Planning
<td width="50%" align="right" <td width="50%" align="right"
<!-- TMPL_IF NAME="est_negative" --> style="color: red;" <!--/TMPL_IF --> <!-- TMPL_IF NAME="est_negative" --> style="color: red;" <!--/TMPL_IF -->
<!-- TMPL_IF NAME="est_positive" --> style="color: green;" <!--/TMPL_IF --> <!-- TMPL_IF NAME="est_positive" --> style="color: green;" <!--/TMPL_IF -->
name="est_total" id='budget_est_<!-- TMPL_VAR NAME="budget_id"-->'> <!-- TMPL_VAR NAME="budget_est_remain"-->&nbsp; id='budget_est_<!-- TMPL_VAR NAME="budget_id"-->'> <!-- TMPL_VAR NAME="budget_est_remain"-->&nbsp;
</td> </td>
</tr> </tr>
</table> </table>
@ -250,7 +247,7 @@ Budget & Fund Planning
</td> </td>
</tr> </tr>
<!-- /TMPL_LOOP --> <!-- /TMPL_LOOP -->
<tbody> </tbody>
</table> </table>
<!-- TMPL_IF NAME="show_actual" --> <!-- TMPL_IF NAME="show_actual" -->
@ -281,7 +278,7 @@ Budget & Fund Planning
<form method="post" action="/cgi-bin/koha/admin/aqplan.pl"> <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
<fieldset class="rows"> <fieldset class="rows">
<ol> <ol>
<li><label for="outputfile">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /> <li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" />
<label class="inline" for="MIME">Into an application <label class="inline" for="MIME">Into an application
</label><!-- TMPL_VAR NAME="CGIextChoice" --> </label><!-- TMPL_VAR NAME="CGIextChoice" -->
<!-- TMPL_VAR NAME="CGIsepChoice" --> &nbsp;&nbsp;&nbsp; <!-- TMPL_VAR NAME="CGIsepChoice" --> &nbsp;&nbsp;&nbsp;