mirror of
https://github.com/unraid/webgui.git
synced 2026-01-05 00:59:48 -06:00
Modprobe file update.
This commit is contained in:
@@ -61,13 +61,34 @@ function showDrivers(options) {
|
||||
$.post('/webGui/include/SysDrivers.php',{table:'t1',option:option},function(data){
|
||||
clearTimeout(timers.refresh);
|
||||
$('#t1').html(data);
|
||||
|
||||
$('div.spinner.fixed').hide('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function textedit(module) {
|
||||
var i=module ;
|
||||
$('#text'+module).prop('disabled', false);
|
||||
$('#save'+module).attr('hidden', false);
|
||||
$('#text'+module).attr('hidden', false);
|
||||
|
||||
}
|
||||
|
||||
$('.tabs').append("<span class='status'><span class='lite label'>_(Select View)_:</span><select onchange='showDrivers(this.value)'><option value='inuse' selected>Inuse Drivers</option><option value='all' >All Drivers</option><option value='confonly'>Modprode Configs Only</option></select>");
|
||||
function textsave(module) {
|
||||
var i=module ;
|
||||
$('#text'+module).prop('disabled', true);
|
||||
$('#save'+module).attr('hidden', true);
|
||||
var x = document.getElementById("text" + module).value;
|
||||
$.post('/webGui/include/SysDrivers.php',{table:'update',module:module,conf:x},function(data){
|
||||
|
||||
select = document.getElementById("select").value;
|
||||
showDrivers(select) ;
|
||||
var message = "_(System Drivers)_: _(A reboot is required to apply changes)_";
|
||||
addRebootNotice(message);
|
||||
});
|
||||
}
|
||||
|
||||
$('.tabs').append("<span class='status'><span class='lite label'>_(Select View)_:</span><select id='select' onchange='showDrivers(this.value)'><option value='inuse' selected>Inuse Drivers</option><option value='all' >All Drivers</option><option value='confonly'>Modprode Configs Only</option></select>");
|
||||
</script>
|
||||
|
||||
<pre><form id="vfiopci" class="js-confirm-leave" onsubmit="return false"><table id='t1' class='pre'><tr><td><div class="spinner"></div></td></tr></table></form></pre><br>
|
||||
|
||||
@@ -120,14 +120,15 @@ foreach($procmodules as $line) {
|
||||
}
|
||||
|
||||
|
||||
echo "<tr><td>"._("Module/Driver")."</td><td>"._("Description")."</td><td>"._("State")."</td><td>"._("Type")."</td><td>"._("Modeprobe.d config file")."</td></tr>";
|
||||
|
||||
echo "<tr><td><b>"._("Module/Driver")."</td><td><b>"._("Description")."</td><td><b>"._("State")."</td><td><b>"._("Type")."</td><td><b>"._("Modeprobe.d config file")."</td></tr>";
|
||||
|
||||
if (is_array($arrModules)) ksort($arrModules) ;
|
||||
foreach($arrModules as $modname => $module)
|
||||
{
|
||||
|
||||
switch ($_POST['option']){
|
||||
case "inuse":
|
||||
|
||||
if ($module['state'] == "Available" || $module['state'] == "(builtin)") continue(2) ;
|
||||
break ;
|
||||
case "confonly":
|
||||
@@ -136,18 +137,22 @@ foreach($procmodules as $line) {
|
||||
case "all":
|
||||
break ;
|
||||
}
|
||||
|
||||
echo "<tr><td>$modname</td><td>{$module['description']}</td><td>{$module['state']}</td><td>{$module['type']}</td>";
|
||||
if (substr($module['state'],0,9) == "(builtin)") $disable = "disabled" ; else $disable = "" ;
|
||||
$disable = "disabled" ;
|
||||
echo "<tr><td><span $disable onclick=\"textedit('".$modname."')\" ><a><i $disable title='"._("Edit Modprobe config")."' id=\"icon'.$modname.'\" class='fa fa-edit' ></i></a></span> $modname</td><td>{$module['description']}</td><td>{$module['state']}</td><td>{$module['type']}</td>";
|
||||
$text = "" ;
|
||||
if (is_array($module["modprobe"])) {
|
||||
$i = 0 ;
|
||||
foreach($module["modprobe"] as $line) {
|
||||
if ($i) echo "<tr><td></td><td></td><td></td><td></td><td>$line</td></tr>" ; else echo "<td>$line</td></tr>" ;
|
||||
$i++ ;
|
||||
}
|
||||
}
|
||||
$text = implode("\n",$module["modprobe"]) ;
|
||||
echo "<td><textarea id=\"text".$modname."\" rows=3 disabled>$text</textarea><span id=\"save$modname\" hidden onclick=\"textsave('".$modname."')\" ><a><i title='"._("Save Modprobe config")."' class='fa fa-save' ></i></a></span></td></tr>";
|
||||
} else echo "<td><textarea id=\"text".$modname."\" rows=1 hidden disabled >$text</textarea><span id=\"save$modname\" hidden onclick=\"textsave('".$modname."')\" ><a><i title='"._("Save Modprobe config")."' class='fa fa-save' ></i></a></span></td></tr>";
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "update":
|
||||
$conf = $_POST['conf'] ;
|
||||
$module = $_POST['module'] ;
|
||||
if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ;
|
||||
else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ;
|
||||
echo $error ;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user