summaryrefslogtreecommitdiffstats
path: root/usr/local/www/installer/installer.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-21 18:33:18 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-21 18:33:29 -0500
commit19f6b3c5a52c0274a191169dc04252c556c4ddd1 (patch)
tree350f2dd10c8d0460278e3a4bcd8fb98c97388b5c /usr/local/www/installer/installer.php
parent503f3c65b8127a402875cdf49fb50668484a2c2d (diff)
downloadpfsense-19f6b3c5a52c0274a191169dc04252c556c4ddd1.zip
pfsense-19f6b3c5a52c0274a191169dc04252c556c4ddd1.tar.gz
Show the capacity of all allocated disks in addition to the amount of space allocated
Diffstat (limited to 'usr/local/www/installer/installer.php')
-rw-r--r--usr/local/www/installer/installer.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php
index 508a1dc..56f27d3 100644
--- a/usr/local/www/installer/installer.php
+++ b/usr/local/www/installer/installer.php
@@ -705,13 +705,27 @@ function installer_custom() {
global $select_txt, $custom_disks;
if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log"))
unlink("/tmp/.pc-sysinstall/pc-sysinstall.log");
+ $disks = installer_find_all_disks();
+ // Pass size of disks down to javascript.
+ $disk_sizes_js_txt = "var disk_sizes = new Array();\n";
+ foreach($disks as $disk)
+ $disk_sizes_js_txt .= "disk_sizes['{$disk['disk']}'] = '{$disk['size']}';\n";
head_html();
body_html();
page_table_start($g['product_name'] . " installer - Customize disk(s) layout");
echo <<<EOF
<script type="text/javascript">
+ Array.prototype.in_array = function(p_val) {
+ for(var i = 0, l = this.length; i < l; i++) {
+ if(this[i] == p_val) {
+ return true;
+ }
+ }
+ return false;
+ }
function row_helper_dynamic_custom() {
var totalsize = 0;
+ {$disk_sizes_js_txt}
// Run through all rows and process data
for(var x = 0; x<99; x++) { //optimize me better
if(\$('fstype' + x)) {
@@ -741,6 +755,22 @@ function installer_custom() {
}
\$('totalsize').disabled = 1;
}
+ if(\$('disktotals')) {
+ var disks_seen = new Array();
+ var tmp_sizedisks = 0;
+ var disksseen = 0;
+ for(var xx = 0; xx<99; xx++) {
+ if(\$('disk' + xx)) {
+ if(!disks_seen.in_array(\$('disk' + xx).value)) {
+ tmp_sizedisks += parseInt(disk_sizes[\$('disk' + xx).value]);
+ disks_seen[disksseen] = \$('disk' + xx).value;
+ disksseen++;
+ }
+ }
+ }
+ \$('disktotals').value = tmp_sizedisks;
+ \$('disktotals').disabled = 1;
+ }
}
</script>
<script type="text/javascript" src="/javascript/row_helper_dynamic.js"></script>
@@ -797,7 +827,6 @@ function installer_custom() {
</div>
EOF;
ob_flush();
- $disks = installer_find_all_disks();
if(file_exists("/tmp/webInstaller_disk_bootmanager.txt"))
$bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt"));
if($bootmanager == "none")
@@ -890,7 +919,8 @@ EOF;
// tfoot and tbody are used by rowhelper
$custom_txt .= "</tr>";
$custom_txt .= "<tfoot></tfoot></tbody>";
- $custom_txt .= "<tr><td></td><td></td><td align='right'>Total allocated:</td><td><input size=\"8\" id='totalsize' name='totalsize'></td></tr>";
+ $custom_txt .= "<tr><td></td><td></td><td align='right'>Total allocated:</td><td><input size='8' id='totalsize' name='totalsize'></td></tr>";
+ $custom_txt .= "<tr><td></td><td></td><td align='right'>Disk capacity total:</td><td><input size='8' id='disktotals' name='disktotals'></td></tr>";
$custom_txt .= "</table>";
$custom_txt .= "<script type=\"text/javascript\">row_helper_dynamic_custom();</script>";
}
OpenPOWER on IntegriCloud