Project

General

Profile

« Previous | Next » 

Revision 0f5bd6f8

Added by Stephen Jones over 7 years ago

Fixed #8091 Force Integers in GUI
It will use the ceil() function to always use the ceiling after loading a config.
Also onchange of bandwidth will call the ceil function to put in a whole number.

View differences:

src/etc/inc/shaper.inc
32 32
include_once("interfaces.inc");//required for convert_real_interface_to_friendly_interface_name() in get_queue_stats() to get altq interface name.
33 33

  
34 34
function get_queue_stats() {
35
	// due to sysutils\qstats not providing accurate stats with 'currently' valid numbers 
35
	// due to sysutils\qstats not providing accurate stats with 'currently' valid numbers
36 36
	// in its current implementation this php function does the job for now..
37 37
	$result = array();
38 38
	$result['timestamp'] = gettimeofday(true);
......
57 57
			$currentqueueif = $items[$level+2];
58 58
			$newqueue['name'] = $currentqueuename;
59 59
			$newqueue['interface'] = $items[$level+2];
60
			
60

  
61 61
			if ($items[$level+3] == "bandwidth") {
62 62
				$level += 2;
63 63
			}
......
71 71
			if (substr($tmp,strlen($tmp)-1) == "(") {
72 72
				$newqueue['shapertype'] = substr($tmp, 0, strlen($tmp)-1);
73 73
			}
74
			
74

  
75 75
			$interfacestats[$currentqueueif][$currentqueuename] = &$newqueue;
76 76
			if (is_array($contains)) {
77 77
				$newqueue['contains'] = $contains;
......
3800 3800
	var d = el.parentNode.parentNode.rowIndex;
3801 3801
	document.getElementById('maintable').deleteRow(d);
3802 3802
}
3803

  
3804
function ceil_func(el){
3805
	el.value = Math.ceil(el.value);
3806

  
3807
}
3803 3808
//]]>
3804 3809
</script>
3805 3810

  
......
3846 3851
			foreach ($bandwidth as $bwidx => $bw) {
3847 3852
				$form .= '<tr>';
3848 3853
				$form .= '<td class="col-xs-4">';
3849
				$form .= "<input class='form-control' type=\"number\" id=\"bandwidth{$bwidx}\" name=\"bandwidth{$bwidx}\" value=\"{$bw['bw']}\" />";
3854
				$form .= "<input class='form-control' onchange=\"ceil_func(this)\" type=\"number\" id=\"bandwidth{$bwidx}\" name=\"bandwidth{$bwidx}\" value=\"" . ceil($bw['bw']) ."\" min=\"0\" step=\"1\"/>";
3850 3855
				//$form .= "</td><td width='20%'>";
3851 3856
				//$form .= "<input class='formfld unknown' size='10' type=\"text\" id=\"burst{$bwidx}\" name=\"burst{$bwidx}\" value=\"{$bw['burst']}\" />";
3852 3857
				$form .= "</td>";

Also available in: Unified diff