Make spectrum optional

This commit is contained in:
Daniel Berteaud 2013-11-13 12:11:18 +01:00
parent 45bd7fca68
commit f26d208fcd
1 changed files with 10 additions and 7 deletions

View File

@ -220,12 +220,14 @@ sub change_settings {
$rec = $db->get('spectrum');
foreach my $proto (@transports){
if (grep ($proto, @gateways)){
$rec->set_prop("$proto",'enabled');
}
else{
$rec->set_prop("$proto",'disabled');
if ($rec){
foreach my $proto (@transports){
if (grep ($proto, @gateways)){
$rec->set_prop("$proto",'enabled');
}
else{
$rec->set_prop("$proto",'disabled');
}
}
}
@ -266,6 +268,8 @@ sub print_gateways
my ($self) = @_;
my $q = $self->{cgi};
my $spectrum = $db->get('spectrum') || return undef;
print "<tr><td class=\"sme-noborders-label\">",
$self->localise('LABEL_GATEWAYS'),
"</td><td>\n";
@ -275,7 +279,6 @@ sub print_gateways
esmith::cgi::genSmallCell($q, $self->localise('PROTOCOL'),"header"),
esmith::cgi::genSmallCell($q, $self->localise('STATUS'),"header"),
);
my $spectrum = $db->get('spectrum');
foreach my $proto (@transports){
my $status = $spectrum->prop($proto) || 'disabled';