bugfix: node description not saving properly (#101)

This commit is contained in:
dman776 2018-08-02 15:58:01 -05:00 committed by GitHub
parent 52a8b79f98
commit 560070d2d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 10 deletions

View File

@ -30,3 +30,5 @@ dtdlink_ip=10.<DTDMAC>
time_zone = UTC
ntp_server = us.pool.ntp.org
description_node =

View File

@ -32,3 +32,5 @@ dtdlink_ip=10.<DTDMAC>
time_zone = UTC
time_zone_name = UTC
ntp_server = us.pool.ntp.org
description_node =

View File

@ -1,6 +1,7 @@
config 'system'
option 'hostname' '<NODE>'
option 'timezone' '<time_zone>'
option 'description' '<description_node>'
config 'timeserver' 'ntp'
list 'server' '<ntp_server>'

View File

@ -573,7 +573,7 @@ sub save_setup
open(FILE, ">$_[0]") or return 0;
foreach(sort keys %parms)
{
next unless /^(aprs|dhcp|dmz|lan|olsrd|wan|wifi|dtdlink|ntp|time)_/;
next unless /^(aprs|dhcp|dmz|lan|olsrd|wan|wifi|dtdlink|ntp|time|description)_/;
print FILE "$_ = $parms{$_}\n";
}
close(FILE);

View File

@ -433,17 +433,13 @@ if($parms{button_save})
push (@errors, "OK") unless @errors;
}
if($parms{nodedesc})
if($description_node)
{
if($parms{nodedesc} =~ /<.*>|<\/.*>/) {
if($description_node =~ /<.*>|<\/.*>/) {
push(@errors, "Node description cannot contain html like tags")
}
else
{
$rc = &uci_set_indexed_option("system", "system", "0", "description", "$parms{nodedesc}");
push(@errors, "unable to store node description. ($rc | $rc2") if($rc);
}
}
unless(@errors)
{
$parms{node} = $node;
@ -469,7 +465,7 @@ reboot_page("/cgi-bin/status") if $parms{button_reboot};
#
# retrieve node description
#
$nodedesc = &uci_get_indexed_option("system", "system", 0, "description");
$desc = &uci_get_indexed_option("system", "system", 0, "description");
#
# Retreive map url, css, and js locations
#
@ -646,7 +642,7 @@ print "
</tr>
<tr>
<td>Node Description (optional)</td>
<td><input type='text' size='50' name='nodedesc' value=\"$nodedesc\" tabindex='4'</input></td>";
<td><input type='text' size='50' name='description_node' value=\"$description_node\" tabindex='4'</input></td>";
push @hidden, "<input type=hidden name=config value='mesh'>";
print "
<td>Verify Password</td>