Project

General

Profile

« Previous | Next » 

Revision 5a1d67b1

Added by Jack Booth over 8 years ago

Bug #7164 Limit NTP time source fields to the maximum number saved to configuration.

View differences:

src/usr/local/www/js/pfSenseHelpers.js
290 290

  
291 291
function add_row() {
292 292
	// Find the last repeatable group
293
	var lastRepeatableGroup = $('.repeatable:last');
293
    var lastRepeatableGroup = $('.repeatable:last');
294

  
295
    // If the number of repeats exceeds the maximum, do not add another clone
296
    if ($('.repeatable').length >= lastRepeatableGroup.attr('max_repeats')) {
297
        // Alert user if alert message is specified
298
        if (typeof lastRepeatableGroup.attr('max_repeats_alert') !== 'undefined') {
299
            alert(lastRepeatableGroup.attr('max_repeats_alert'));
300
        }
301
        return;
302
    }
294 303

  
295 304
	// Clone it
296 305
	var newGroup = lastRepeatableGroup.clone();
src/usr/local/www/services_ntpd.php
227 227
$auto_pool_suffix = "pool.ntp.org";
228 228
for ($counter=0; $counter < $maxrows; $counter++) {
229 229
	$group = new Form_Group($counter == 0 ? 'Time Servers':'');
230
	$group->addClass('repeatable');
230
    $group->addClass('repeatable');
231
    $group->setAttribute('max_repeats', NUMTIMESERVERS);
232
    $group->setAttribute('max_repeats_alert', NUMTIMESERVERS . ' is the maximum number of configured servers.');
231 233

  
232 234
	$group->add(new Form_Input(
233 235
		'server' . $counter,

Also available in: Unified diff