Menu="IPMI:2"
Title="Fan Control"
---
<form markdown="1" name="ipmifan_settings" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="ipmitool-plugin/ipmitool-plugin.cfg" />
<input type="hidden" id="FANCMD" name="#command" value="" />

IPMI Fan Control: 
:  <select name="IPMIFAN" size="1">
	<?=mk_option($ipmifan, "disable", "No")?>
	<?=mk_option($ipmifan, "enable", "Yes")?>
	</select><label><font class="red"><b>NOT FUNTIONAL YET</b></font></label>

Motherboard Manufacturer: 
:  <select name="IPMIBOARD" size="1">
	<?=mk_option($ipmi_board, "ASRock", "ASRock")?>
	<?=mk_option($ipmi_board, "", "Other")?>
	</select>

&nbsp;

<?php if ($ipmi_fans[0]): ?>

<?=$ipmi_fans[0];?> temperature sensor:
:  <select name="FAN_<?=$ipmi_fans[0];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors, 'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[0]], true);?>
	</select>

<?=$ipmi_fans[0];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[0];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[0]]);?>
	</select>

<?=$ipmi_fans[0];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[0];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[0]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[1]): ?>

<?=$ipmi_fans[1];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[1];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[1]], true);?>
	</select>

<?=$ipmi_fans[1];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[1];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[1]]);?>
	</select>

<?=$ipmi_fans[1];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[1];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[1]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[2]): ?>

<?=$ipmi_fans[2];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[2];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[2]], true);?>
	</select>

<?=$ipmi_fans[2];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[2];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[2]]);?>
	</select>

<?=$ipmi_fans[2];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[2];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[2]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[3]): ?>

<?=$ipmi_fans[3];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[3];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[3]], true);?>
	</select>

<?=$ipmi_fans[3];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[3];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[3]]);?>
	</select>

<?=$ipmi_fans[3];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[3];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[3]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[4]): ?>

<?=$ipmi_fans[4];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[4];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[4]], true);?>
	</select>

<?=$ipmi_fans[4];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[4];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[4]]);?>
	</select>

<?=$ipmi_fans[4];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[4];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[4]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[5]): ?>

<?=$ipmi_fans[5];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[5];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[5]], true);?>
	</select>

<?=$ipmi_fans[5];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[5];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[5]]);?>
	</select>

<?=$ipmi_fans[5];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[5];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[5]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[6]): ?>

<?=$ipmi_fans[6];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[6];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[6]], true);?>
	</select>

<?=$ipmi_fans[6];?> Low temperature threshold:
: <select name="<FAN_LOW_<?=$ipmi_fans[6];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[6]]);?>
	</select>

<?=$ipmi_fans[6];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[6];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[6]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[7]): ?>

<?=$ipmi_fans[7];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[7];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[7]], true);?>
	</select>

<?=$ipmi_fans[7];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[7];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[7]]);?>
	</select>

<?=$ipmi_fans[7];?> High temperature threshold:
: <select name="<FAN_HIGH_<?=$ipmi_fans[7];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[7]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[8]): ?>

<?=$ipmi_fans[8];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[8];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[8]], true);?>
	</select>

<?=$ipmi_fans[8];?> Low temperature threshold:
: <select name="FAN_LOW_<?=$ipmi_fans[8];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[8]]);?>
	</select>

<?=$ipmi_fans[8];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[8];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[8]]);?>
	</select>

&nbsp;

<?php endif; ?>

<?php if ($ipmi_fans[9]): ?>

<?=$ipmi_fans[9];?> temperature sensor:
: <select name="FAN_<?=$ipmi_fans[9];?>">
		<option value='0'>Auto</option>
		<?=ipmi_get_options($ipmi_sensors,  'Temperature', $ipmi_cfg['FAN_'.$ipmi_fans[9]], true);?>
	</select>

<?=$ipmi_fans[9];?> Low temperature threshold:
: <select name="<FAN_LOW_<?=$ipmi_fans[9];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('LOW', $ipmi_cfg['FAN_LOW_'.$ipmi_fans[9]]);?>
	</select>

<?=$ipmi_fans[9];?> High temperature threshold:
: <select name="FAN_HIGH_<?=$ipmi_fans[9];?>">
		<option value='0'>Auto</option>
		<?=temp_get_options('HIGH', $ipmi_cfg['FAN_HIGH_'.$ipmi_fans[9]]);?>
	</select>

<?php endif; ?>

&nbsp;

<input id="FAN_DEFAULT" class="ipmifan-run" type="button" value="Default" onClick="resetFANDATA(this.form);">
: <input id="btnFANApply" type="submit" value="Apply" onClick="verifyFANDATA(this.form)"><input type="button" value="Done" onClick="done()">
</form>

<script type="text/javascript">
function resetFANDATA(form) {
		form.submit();
}

function checkIPMIFAN(form) {
	if ("<?=$ipmifan_running;?>" == true)
	{
		$(".ipmifan-run").prop("disabled", true);
		form.btnFANApply.disabled = "disabled";
   }else{
   	$(".ipmifan-run").prop("disabled", false);
		$("#btnFANApply").prop("disabled", false);
	}
	if (form.IPMIFAN.value == "enable")
		form.FANCMD.value = "/usr/local/emhttp/plugins/ipmitool-plugin/scripts/fancontrol_start";
	else {
		form.FANCMD.value = "/usr/local/emhttp/plugins/ipmitool-plugin/scripts/fabcontrol_stop";
	}
}

function verifyFANDATA(form) {
	form.IPMIFAN.value = form.IPMIFAN.value.replace(/ /g,"_");
}
</script>
