aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freenas/www
diff options
context:
space:
mode:
authorDaniel Stefan Haischt <dsh@pfsense.org>2007-01-08 02:34:06 +0000
committerDaniel Stefan Haischt <dsh@pfsense.org>2007-01-08 02:34:06 +0000
commit57a4bc69ba39d6f030ca97011aefb6bb617929ee (patch)
treee10ae4b9c4af50f8e51253d02ba50a9661ec31b8 /packages/freenas/www
parentb851eccedef9ff677cd6d2ee0d193fd724e5591d (diff)
downloadpfsense-packages-57a4bc69ba39d6f030ca97011aefb6bb617929ee.tar.gz
pfsense-packages-57a4bc69ba39d6f030ca97011aefb6bb617929ee.tar.bz2
pfsense-packages-57a4bc69ba39d6f030ca97011aefb6bb617929ee.zip
* fix: output an Ajax compliant error message if the disk is still mounted
Diffstat (limited to 'packages/freenas/www')
-rw-r--r--packages/freenas/www/disks_manage_init.php27
-rw-r--r--packages/freenas/www/disks_mount.php47
-rw-r--r--packages/freenas/www/disks_mount_edit.php12
3 files changed, 54 insertions, 32 deletions
diff --git a/packages/freenas/www/disks_manage_init.php b/packages/freenas/www/disks_manage_init.php
index cfadcdaf..0d5642d9 100644
--- a/packages/freenas/www/disks_manage_init.php
+++ b/packages/freenas/www/disks_manage_init.php
@@ -486,7 +486,21 @@ if (! empty($_POST))
$notinitmbr= $_POST['notinitmbr'];
/* Check if disk is mounted. */
- if(disks_check_mount_fullname($disk)) {
+ if(isAjax() && disks_check_mount_fullname($disk)) {
+ $statustxt = sprintf(gettext("The disk is currently mounted! <a href=%s>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&amp;action=umount");
+
+ $divcontents = "<div style='background:#990000'><table>";
+ $divcontents .= "<tr><td>";
+ $divcontents .= "<img src='/themes/{$g['theme']}/images/icons/icon_error.gif' width='28' height='32'>";
+ $divcontents .= "</td><td><font color='white'><br>&nbsp;&nbsp;The following errors have occured:<p><ul>";
+ $divcontents .= "<font color='white'><li> " . $statustxt . "</li>";
+ $divcontents .= "</ul></td></table></div><br />";
+
+ header("HTTP/1.0 500 Internal Server Error");
+ header("Status: 500 Internal Server Error. {$statustxt}");
+ echo $divcontents;
+ exit;
+ } else {
$errormsg = sprintf(gettext("The disk is currently mounted! <a href=%s>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount");
$do_format = false;
}
@@ -630,11 +644,20 @@ function toggle_cmdout(image, totoggle) {
"<?=$_SERVER['SCRIPT_NAME'];?>", {
method : "post",
parameters : Form.serialize($("iform")),
- onSuccess : execFormatComplete
+ onSuccess : execFormatComplete,
+ onFailure : execFormatFailure
}
);
}
+ function execFormatFailure(req) {
+ if($('doFormatSubmit')) $('doFormatSubmit').style.visibility = 'visible';
+ if($('loading')) $('loading').style.visibility = 'hidden';
+ if($('inputerrors')) window.scrollTo(0, 0);
+ if($('inputerrors')) new Effect.Shake($('inputerrors'));
+ if($('inputerrors')) $('inputerrors').innerHTML = req.responseText;
+ }
+
function execFormatComplete(req) {
$("formatOutputTD").innerHTML = req.responseText;
$('loading').style.visibility = 'hidden';
diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php
index e8c7d4d5..c72b0d82 100644
--- a/packages/freenas/www/disks_mount.php
+++ b/packages/freenas/www/disks_mount.php
@@ -175,30 +175,29 @@ echo $pfSenseHead->getHTML();
<td valign="middle" class="listr">
<?=htmlspecialchars($mount['desc']);?>&nbsp;
</td>
- </td>
- <td valign="middle" class="listbg" style="color: #FFFFFF;">
- <?php
- if (file_exists($d_mountdirty_path)) {
- $stat = gettext("configuring");
- } else {
- $stat = disks_check_mount($mount);
- if ($stat == 0) {
- $stat = "ERROR - <a href=\"disks_mount.php?act=ret&id=$i\">retry</a>";
- } else {
- $stat = gettext("OK");
- }
- }
- echo $stat;
- ?>
- </td>
- <td valign="middle" class="list">
- <a href="disks_mount_edit.php?id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" />
- </a>
- <a href="disks_mount.php?act=del&id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<?= gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" />
- </a>
- </td>
+ <td valign="middle" class="listbg" style="color: #FFFFFF;">
+ <?php
+ if (file_exists($d_mountdirty_path)) {
+ $stat = gettext("configuring");
+ } else {
+ $stat = disks_check_mount($mount);
+ if ($stat == false) {
+ $stat = "ERROR - <a href=\"disks_mount.php?act=ret&amp;id=$i\">retry</a>";
+ } else {
+ $stat = gettext("OK");
+ }
+ }
+ echo $stat;
+ ?>
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_mount_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_mount.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<?= gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
</tr>
<?php $i++; endforeach; ?>
<tr>
diff --git a/packages/freenas/www/disks_mount_edit.php b/packages/freenas/www/disks_mount_edit.php
index b4cd7378..6b7a2248 100644
--- a/packages/freenas/www/disks_mount_edit.php
+++ b/packages/freenas/www/disks_mount_edit.php
@@ -116,7 +116,7 @@ if (! empty($_POST))
$pconfig = $_POST;
/* input validation */
- $reqdfields = split(" ", "partition mdisk fstype");
+ $reqdfields = split(" ", "partitionno mdisk fstype");
$reqdfieldsn = split(",", "Partition,Mdisk,Fstype");
do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
@@ -134,7 +134,7 @@ if (! empty($_POST))
"field" => "desc");
}
- $device=$_POST['mdisk'].$_POST['partition'];
+ $device=$_POST['mdisk'].$_POST['partitionno'];
if ($device == $cfdevice )
{
@@ -179,12 +179,12 @@ if (! empty($_POST))
{
$mount = array();
$mount['mdisk'] = $_POST['mdisk'];
- $mount['partition'] = $_POST['partition'];
+ $mount['partition'] = $_POST['partitionno'];
$mount['fstype'] = $_POST['fstype'];
$mount['desc'] = $_POST['desc'];
/* if not sharename given, create one */
if (!$_POST['sharename'])
- $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partition']}";
+ $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partitionno']}";
else
$mount['sharename'] = $_POST['sharename'];
@@ -238,7 +238,7 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td>
<td width="78%" class="vtable">
- <select name="partition" class="formselect" id="partition number">
+ <select name="partitionno" class="formselect" id="partition_number">
<option value="s1" <?php if ($pconfig['partition'] == "s1") echo "selected"; ?>>1 (or new software RAID method)</option>
<option value="s2" <?php if ($pconfig['partition'] == "s2") echo "selected"; ?>>2</option>
<option value="s3" <?php if ($pconfig['partition'] == "s3") echo "selected"; ?>>3</option>
@@ -246,7 +246,7 @@ echo $pfSenseHead->getHTML();
<option value="gmirror" <?php if ($pconfig['partition'] == "gmirror") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gmirror</option>
<option value="graid5" <?php if ($pconfig['partition'] == "graid5") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - graid5</option>
<option value="gvinum" <?php if ($pconfig['partition'] == "gvinum") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gvinum</option>
- <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected"; ?>>GPT (or new software RAID method with GPT)</option>
+ <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected"; ?>>GPT (or new software RAID method with GPT)</option>
</select>
</td>
</tr>