prososy listo
This commit is contained in:
@@ -30,30 +30,30 @@ sub candy{
|
||||
my $c=shift;
|
||||
my $r="-1";
|
||||
if (connectT()) {
|
||||
if ($c->param("command") =~/^isOn$/){ $r = isOn(); }
|
||||
elsif( $c->session("pmid") == 4 ){
|
||||
$r = turnOn() if ($c->param("command") =~/^on$/);
|
||||
$r = isOn() if ($c->param("command") =~/^isOn$/);
|
||||
$r = turnOn() if ($c->param("command") =~/^on$/);
|
||||
$r = turnOff() if ($c->param("command") =~/^off$/);
|
||||
}}
|
||||
disconnectT();
|
||||
}
|
||||
else {$r="connection error";};
|
||||
$c->render(json => {a=>$r});
|
||||
# $c->render(json => {a=>$server_name});
|
||||
}
|
||||
|
||||
sub turnOff{
|
||||
return 1 unless (isOn());
|
||||
grep(/Result: true/,sendT("host:deactivate('$server_name')"))?1:0;
|
||||
grep(/Result: true/,join('',sendT('host:deactivate("'.$server_name.'")')))?1:0
|
||||
unless (isOn()==0);
|
||||
}
|
||||
sub turnOn{
|
||||
return 1 unless (!isOn());
|
||||
grep(/Result: true/,sendT("host:activate('$server_name')"))?1:0;
|
||||
grep(/Result: true/,join('',sendT('host:activate("'.$server_name.'")')))?1:0
|
||||
unless (isOn()==1);
|
||||
}
|
||||
|
||||
sub isOn{ grep(/\s$server_name/,sendT("host:list()"))? 1:0; }
|
||||
sub isOn{return grep(/\s$server_name/,sendT("host:list()"))? 1:0; }
|
||||
|
||||
sub sendT{
|
||||
commandT(shift);
|
||||
my @r = $t->getlines(All=>0);
|
||||
disconnectT();
|
||||
return @r
|
||||
}
|
||||
sub connectT{
|
||||
|
||||
@@ -100,6 +100,17 @@ sub tst{
|
||||
$c->stash($c->dbv->conf_radio);
|
||||
$c->stash(nick=>$c->session("nick"));
|
||||
}
|
||||
|
||||
sub candy{
|
||||
my $c=shift;
|
||||
$c->stash( css=>["/ext/candy/libs.min.css","/home/candy/default.css"]);
|
||||
$c->stash( js=>["/home/candy/loader.js","/ext/candy/libs.min.js","/ext/candy/candy.min.js"]);
|
||||
|
||||
$c->stash(layout=> "clean");
|
||||
$c->stash($c->dbv->conf_chat);
|
||||
$c->stash(nick=>$c->session("nick"));
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ sub new { bless {}, shift };
|
||||
sub conf_radio{
|
||||
return $Dojo::Conf::radio;
|
||||
}
|
||||
sub conf_chat{
|
||||
return $Dojo::Conf::chat;
|
||||
}
|
||||
#==============================================================================
|
||||
|
||||
# Read vdg admin ==============================================================
|
||||
|
||||
Reference in New Issue
Block a user