diff options
author | Phil Davis <phil.davis@inf.org> | 2016-03-16 16:41:08 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2016-03-16 16:41:08 +0545 |
commit | 68b0c1c28a78af3c392e7fcda5ba90bd4878ac8e (patch) | |
tree | 257f2858c36086ebfc6be872d72ca727dba105a6 /src/usr/local/www/services_ntpd_gps.php | |
parent | 0d5c2f413c311231d5e8e3bcc9a70b2fd87517e7 (diff) | |
download | pfsense-68b0c1c28a78af3c392e7fcda5ba90bd4878ac8e.zip pfsense-68b0c1c28a78af3c392e7fcda5ba90bd4878ac8e.tar.gz |
services_ntpd_gps fix handling of initcmd
1) When reading the (encoded) initcmd string into Form_Textarea(), decode it.
Previously the encoded value was displaying in the text area and when the user presses save, that encode string is itself encoded again in the config and thus stuffs things up.
2) When loading the page, only use set_gps_default() to set initcmd if initcmd is currently empty.
Previously the initcmd value would be set to the default string for the GPS type every time the page loaded, which would override any change that the user had made.
Note: After this is fixed, then I will also submit changes to make the Advanced button work in the new ways.
Diffstat (limited to 'src/usr/local/www/services_ntpd_gps.php')
-rw-r--r-- | src/usr/local/www/services_ntpd_gps.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php index 099d607..a0a045f 100644 --- a/src/usr/local/www/services_ntpd_gps.php +++ b/src/usr/local/www/services_ntpd_gps.php @@ -389,7 +389,7 @@ $section->addInput(new Form_StaticText( $section->addInput(new Form_Textarea( 'gpsinitcmd', null, - $pconfig['initcmd'] + base64_decode($pconfig['initcmd']) ))->setHelp('Commands entered here will be sent to the GPS during initialization. Please read and understand your GPS documentation before making any changes here'); $group = new Form_Group('NMEA Checksum Calculator'); @@ -525,7 +525,7 @@ events.push(function() { $('#result').val(NMEAChecksum($('#nmeastring').val())); }); - // When the 'GPS' selector is changed, we set tth gps defaults + // When the 'GPS' selector is changed, we set the gps defaults $('#gpstype').on('change', function() { set_gps_default($(this).val()); }); @@ -533,7 +533,9 @@ events.push(function() { hideInput('gpsinitcmd', true); hideClass('calculator', true); - set_gps_default('<?=$pconfig['type']?>'); + if ('<?=$pconfig['initcmd']?>' == '') { + set_gps_default('<?=$pconfig['type']?>'); + } // Checkboxes gpsprefer and gpsnoselect are mutually exclusive $('#gpsprefer').click(function() { |