diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/js/pfSenseHelpers.js | 11 | ||||
-rw-r--r-- | src/usr/local/www/services_ntpd.php | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/usr/local/www/js/pfSenseHelpers.js b/src/usr/local/www/js/pfSenseHelpers.js index e8898ba..80d3361 100644 --- a/src/usr/local/www/js/pfSenseHelpers.js +++ b/src/usr/local/www/js/pfSenseHelpers.js @@ -314,7 +314,16 @@ function checkLastRow() { function add_row() { // Find the last repeatable group - var lastRepeatableGroup = $('.repeatable:last'); + var lastRepeatableGroup = $('.repeatable:last'); + + // If the number of repeats exceeds the maximum, do not add another clone + if ($('.repeatable').length >= lastRepeatableGroup.attr('max_repeats')) { + // Alert user if alert message is specified + if (typeof lastRepeatableGroup.attr('max_repeats_alert') !== 'undefined') { + alert(lastRepeatableGroup.attr('max_repeats_alert')); + } + return; + } // Clone it var newGroup = lastRepeatableGroup.clone(); diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php index 0c18906..7d1fbd3 100644 --- a/src/usr/local/www/services_ntpd.php +++ b/src/usr/local/www/services_ntpd.php @@ -252,7 +252,9 @@ $timeservers = explode(' ', $config['system']['timeservers']); $maxrows = max(count($timeservers), 1); for ($counter=0; $counter < $maxrows; $counter++) { $group = new Form_Group($counter == 0 ? 'Time Servers':''); - $group->addClass('repeatable'); + $group->addClass('repeatable'); + $group->setAttribute('max_repeats', NUMTIMESERVERS); + $group->setAttribute('max_repeats_alert', NUMTIMESERVERS . ' is the maximum number of configured servers.'); $group->add(new Form_Input( 'server' . $counter, |