Hide Format button when wrong encryption key is ignored

This commit is contained in:
bergware
2017-09-12 20:05:21 +02:00
parent fc62b54d5c
commit 60c081c7b1
2 changed files with 33 additions and 6 deletions
+12 -6
View File
@@ -15,6 +15,8 @@ Tag="snowflake-o"
*/
?>
<?
$hide = '/var/tmp/hide_format_button.tmp';
function maintenance_mode() {
echo "<tr>";
echo "<td></td>";
@@ -40,9 +42,13 @@ var ask2 = <?=$confirm['down'] ? 'true' : 'false'?>;
var ctrl = "<span class='status'><a style='cursor:pointer' class='tooltip_diskio' title='Toggle reads/writes display' onclick='toggle_diskio();return false'><i class='toggle fa'></i></a></span>";
function verify(form) {
swal({title:'Found wrong encryption key',text:'Format unmountable disk(s) and ERASE ALL data?',type:'warning',showCancelButton:true},function(){
$(form).append('<input type="hidden" name="cmdFormat" value="Format">');
form.submit();
swal({title:'Found wrong encryption key',text:'Format unmountable disk(s) and erase all data?',type:'warning',confirmButtonText:'Format',cancelButtonText:'Ignore',showCancelButton:true},function(p){
if (p) {
$(form).append('<input type="hidden" name="cmdFormat" value="Format">');
form.submit();
} else {
$.post('/webGui/include/HideFormatButton.php',{hide:'yes'},function(){refresh();});
}
});
}
function tab0() {
@@ -80,9 +86,9 @@ function parity_warning(form) {
function stop_array(form) {
$(form).append('<input type="hidden" name="cmdStop" value="Stop">');
if (ask1) {
swal({title:'Proceed?',text:'This will stop the array',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdStop"]').remove();});
swal({title:'Proceed?',text:'This will stop the array',type:'warning',showCancelButton:true},function(p){if (p) $.post('/webGui/include/HideFormatButton.php',{hide:'no'},function(){form.submit();}); else $('input[name="cmdStop"]').remove();});
} else {
form.submit();
$.post('/webGui/include/HideFormatButton.php',{hide:'no'},function(){form.submit();});
}
}
function stop_parity(form,text) {
@@ -144,7 +150,7 @@ toggle_diskio(true);
<td><input type="button" value="Stop" onclick="stop_array(this.form)"<?if ($parity||$mover):?> disabled<?endif;?>></td>
<td><strong>Stop</strong> will take the array off-line.<?=$parity?"<br>$parity":($mover?"<br>$mover":"")?></td>
</tr>
<? if ($var['fsNumUnmountable']>0):?>
<? if ($var['fsNumUnmountable']>0 && !file_exists($hide)):?>
<tr>
<td><strong>Unmountable disk<?=$var['fsNumUnmountable']==1?'':'s'?> present:</strong><br>
<? $verify = false;
@@ -0,0 +1,21 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$hide = '/var/tmp/hide_format_button.tmp';
$flag = file_exists($hide);
switch ($_POST['hide']) {
case 'yes': if (!$flag) touch($hide); break;
case 'no' : if ($flag) unlink($hide); break;
}
?>