diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-12-19 16:14:44 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-12-19 16:14:44 -0500 |
commit | a17f284ccf3279b1f04b174b8a58d6de5396c849 (patch) | |
tree | d3851a613ebb7483cc30ac251237a595da6cb1cc /usr | |
parent | a1532937b1c5b5be837d7400dcb43f2f53018efc (diff) | |
download | pfsense-a17f284ccf3279b1f04b174b8a58d6de5396c849.zip pfsense-a17f284ccf3279b1f04b174b8a58d6de5396c849.tar.gz |
Add rowhelper_onChange variable for row helper and remove the previous function detection code
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/installer/installer.php | 40 | ||||
-rwxr-xr-x | usr/local/www/javascript/row_helper_dynamic.js | 28 |
2 files changed, 34 insertions, 34 deletions
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php index cfc2d57..dae33f6 100644 --- a/usr/local/www/installer/installer.php +++ b/usr/local/www/installer/installer.php @@ -709,7 +709,27 @@ function installer_custom() { page_table_start($g['product_name'] . " installer - Customize disk(s) layout"); echo <<<EOF <script type="text/javascript"> - function row_helper_dynamic_custom(tr) { + function onfstypeChange() { + for(var x = 0; x<99; x++) { //optimize me better + if(\$('fstype' + x)) { + var fstype = \$F('fstype' + x); + if(fstype.substring(fstype.length - 4) == ".eli") { + \$('encpass' + x).disabled = 0; + if(!encryption_warning_shown) { + alert('NOTE: If you define a disk encryption password you will need to enter it on *EVERY* bootup!'); + encryption_warning_shown = true; + } + } else { + \$('encpass' + x).disabled = 1; + } + } + } + } + onfstypeChange(); + </script> + <script type="text/javascript"> + function row_helper_dynamic_custom() { + onfstypeChange(); var totalsize = 0; for(var x = 0; x<99; x++) { //optimize me better if(\$('size' + x)) { @@ -742,6 +762,7 @@ function installer_custom() { rows = 1; totalrows = 1; loaded = 1; + rowhelper_onChange = " onChange='javascript:row_helper_dynamic_custom()' "; </script> <form action="installer.php" method="post"> <input type="hidden" name="state" value="verify_before_install"> @@ -886,23 +907,6 @@ EOF; <script type="text/javascript"> var encryption_warning_shown = false; \$('contentdiv').appear(); - function onfstypeChange() { - for(var x = 0; x<99; x++) { //optimize me better - if(\$('fstype' + x)) { - var fstype = \$F('fstype' + x); - if(fstype.substring(fstype.length - 4) == ".eli") { - \$('encpass' + x).disabled = 0; - if(!encryption_warning_shown) { - alert('NOTE: If you define a disk encryption password you will need to enter it on *EVERY* bootup!'); - encryption_warning_shown = true; - } - } else { - \$('encpass' + x).disabled = 1; - } - } - } - } - onfstypeChange(); </script> </center> </td></tr> diff --git a/usr/local/www/javascript/row_helper_dynamic.js b/usr/local/www/javascript/row_helper_dynamic.js index a69529c..e0d3811 100755 --- a/usr/local/www/javascript/row_helper_dynamic.js +++ b/usr/local/www/javascript/row_helper_dynamic.js @@ -1,8 +1,9 @@ // Global Variables -var rowname = new Array(99); -var rowtype = new Array(99); -var newrow = new Array(99); -var rowsize = new Array(99); +var rowname = new Array(99); +var rowtype = new Array(99); +var newrow = new Array(99); +var rowsize = new Array(99); +var rowhelper_onChange = ''; for (i = 0; i < 99; i++) { rowname[i] = ''; @@ -19,16 +20,11 @@ var temp_streaming_text = ""; var addRowTo = (function() { return (function (tableId, objectSize) { var d, tbody, tr, td, bgc, i, ii, j; - var onChange; d = document; tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0); tr = d.createElement("tr"); totalrows++; - // Check to see if our hook function is defined. If it is defined we will - // call into the hook for every row change event allowing javascript - // to enable/disable and do other things to the row. - if(function_exists('row_helper_dynamic_custom') == true) - onChange = " onChange='javascript:row_helper_dynamic_custom(" + tr + ")' "; + alert(rowhelper_onChange); if (!objectSize) objectSize = rowsize[i]; for (i = 0; i < field_counter_js; i++) { @@ -36,17 +32,17 @@ var addRowTo = (function() { if(typeof(rowtype[i]) == 'function') { td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input>" + rowtype[i](rowname[i], objectSize, totalrows) + " "; } else if(rowtype[i] == 'textbox') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + onChange + " size='" + rowsize[i] + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " size='" + rowsize[i] + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; } else if(rowtype[i] == 'select') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> "; } else if(rowtype[i] == 'select_source') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select " + rowhelper_onChange + " name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'>" + newrow[i] + "</select> "; } else if(rowtype[i] == 'checkbox') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + onChange + " type='checkbox'name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " type='checkbox'name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; } else if(rowtype[i] == 'input') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + onChange + " class='formfld unknown' size='" + objectSize + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " class='formfld unknown' size='" + objectSize + "' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; } else if(rowtype[i] == 'password') { - td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + onChange + " class='formfld pwd' type='password' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; + td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input " + rowhelper_onChange + " class='formfld pwd' type='password' name='" + rowname[i] + totalrows + "' id='" + rowname[i] + totalrows + "'></input> "; } tr.appendChild(td); } |