prososy listo

This commit is contained in:
Ubuntu
2018-07-25 20:48:58 +00:00
parent 3dfefd9b30
commit 211e710efd
11 changed files with 81 additions and 48 deletions

View File

@@ -37,6 +37,7 @@ use Dojo::Model::Data;
# candy =======================================================================
$r->any('/json/candy/:command')->to('data#candy');
$r->any('/candy')->to('home#candy');
# =============================================================================
# admin =======================================================================

View File

@@ -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{

View File

@@ -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"));
}
#==============================================================================

View File

@@ -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 ==============================================================

View File

@@ -1,8 +1,8 @@
d3.select("#clink").on("click",function(){
var newWindow = window.open('candy','_blank');
var newWindow = window.open('/candy','_blank');
});
// revisa que llama dos veces a la pagina
var ciface =" #exec candy_loader/candyInterface.pl&v=";
var ciface ="/json/candy/";
d3.json(ciface+"isOn" ,function(d){
if(d != undefined){
if (d.a==1) { on(); }

View File

@@ -68,7 +68,7 @@ ul {
padding: 0;
width: 30px;
height: 30px;
background: url( #ext candy/res/img/tab-transitions.png) repeat-y left;
background: url(/ext/candy/res/img/tab-transitions.png) repeat-y left;
border-radius: 0 3px 0 0;
}
@@ -84,7 +84,7 @@ ul {
}
#chat-tabs .active .transition {
background: url( #ext candy/res/img/tab-transitions.png) repeat-y -50px;
background: url(/ext/candy/res/img/tab-transitions.png) repeat-y -50px;
}
#chat-tabs .close:hover {
@@ -134,11 +134,11 @@ ul {
}
#chat-toolbar #emoticons-icon {
background-image: url( #ext candy/res/img/action/emoticons.png);
background-image: url(/ext/candy/res/img/action/emoticons.png);
}
#chat-toolbar .context {
background-image: url( #ext candy/res/img/action/settings.png);
background-image: url(/ext/candy/res/img/action/settings.png);
display: none;
}
@@ -147,31 +147,31 @@ ul {
}
#chat-sound-control {
background-image: url( #ext candy/res/img/action/sound-off.png);
background-image: url(/ext/candy/res/img/action/sound-off.png);
}
#chat-sound-control.checked {
background-image: url( #ext candy/res/img/action/sound-on.png);
background-image: url(/ext/candy/res/img/action/sound-on.png);
}
#chat-autoscroll-control {
background-image: url( #ext candy/res/img/action/autoscroll-off.png);
background-image: url(/ext/candy/res/img/action/autoscroll-off.png);
}
#chat-autoscroll-control.checked {
background-image: url( #ext candy/res/img/action/autoscroll-on.png);
background-image: url(/ext/candy/res/img/action/autoscroll-on.png);
}
#chat-statusmessage-control {
background-image: url( #ext candy/res/img/action/statusmessage-off.png);
background-image: url(/ext/candy/res/img/action/statusmessage-off.png);
}
#chat-statusmessage-control.checked {
background-image: url( #ext candy/res/img/action/statusmessage-on.png);
background-image: url(/ext/candy/res/img/action/statusmessage-on.png);
}
#chat-toolbar .usercount {
background-image: url( #ext candy/res/img/action/usercount.png);
background-image: url(/ext/candy/res/img/action/usercount.png);
cursor: default;
padding-left: 20px;
width: auto;
@@ -259,17 +259,17 @@ ul {
}
.roster-pane li.role-moderator {
background-image: url( #ext candy/res/img/roster/role-moderator.png);
background-image: url(/ext/candy/res/img/roster/role-moderator.png);
display: block;
}
.roster-pane li.affiliation-owner {
background-image: url( #ext candy/res/img/roster/affiliation-owner.png);
background-image: url(/ext/candy/res/img/roster/affiliation-owner.png);
display: block;
}
.roster-pane li.ignore {
background-image: url( #ext candy/res/img/roster/ignore.png);
background-image: url(/ext/candy/res/img/roster/ignore.png);
display: none;
}
@@ -470,7 +470,7 @@ ul {
}
.arrow {
background: url( #ext candy/res/img/tooltip-arrows.gif) no-repeat left bottom;
background: url(/ext/candy/res/img/tooltip-arrows.gif) no-repeat left bottom;
height: 5px;
display: block;
position: relative;
@@ -536,27 +536,27 @@ ul {
}
#context-menu .private {
background-image: url( #ext candy/res/img/action/private.png);
background-image: url(/ext/candy/res/img/action/private.png);
}
#context-menu .ignore {
background-image: url( #ext candy/res/img/action/ignore.png);
background-image: url(/ext/candy/res/img/action/ignore.png);
}
#context-menu .unignore {
background-image: url( #ext candy/res/img/action/unignore.png);
background-image: url(/ext/candy/res/img/action/unignore.png);
}
#context-menu .kick {
background-image: url( #ext candy/res/img/action/kick.png);
background-image: url(/ext/candy/res/img/action/kick.png);
}
#context-menu .ban {
background-image: url( #ext candy/res/img/action/ban.png);
background-image: url(/ext/candy/res/img/action/ban.png);
}
#context-menu .subject {
background-image: url( #ext candy/res/img/action/subject.png);
background-image: url(/ext/candy/res/img/action/subject.png);
}
#context-menu .emoticons {
@@ -602,7 +602,7 @@ ul {
right: 0;
bottom: 0;
z-index: 90;
background-image: url( #ext candy/res/img/overlay.png);
background-image: url(/ext/candy/res/img/overlay.png);
}
#chat-modal.modal-login {

View File

@@ -10,9 +10,9 @@ window.onload = function(){
debug: false,
autojoin: [chat_channel]
},
view: { language: 'es', assets: 'ext/candy/res/'}
view: { language: 'es', assets: '/ext/candy/res/'}
});
Candy.Core.connect(chat_srv,null," <%= nick %>");
Candy.Core.connect(chat_srv,null,nick);
Candy.Core.onWindowUnload = function(){window.close();};
$(Candy).on("candy:view.connection.status-6",function(){
window.close();});

View File

@@ -1,12 +1,12 @@
d3.select("#clink").on("click",function(){
var newWindow = window.open('ext/candy','_blank');
var newWindow = window.open('/candy','_blank');
});
checkChat();
function checkChat(){
d3.json("json/candy/candy_loader/candyInterface.pl&v=isOn",function(d){
d3.json("/json/candy/isOn",function(d){
if(d != undefined){
if (d.a==1) { d3.select("#clink").style("visibility","visible");}
else if (d.a==0) { d3.select("#clink").style("visibility","hidden");}

View File

@@ -1,15 +1,13 @@
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous">
</script>
<script>
const chat_addr= <%= $chat_addr %>;
const chat_srv= <%= $chat_srv %>;
const chat_channel= <%= $chat_channel %>;
</script>
<%= javascript "/ext/libs.min.js"; %>
<%= javascript "/ext/candy.min.js"; %>
<%= stylesheet "/ext/lib.min.css"; %>
<section id="schat" class="chat">
<div id="candy"></div>
</section>
<script>
const nick="<%= $nick %>";
const chat_addr="<%= $chat_addr %>";
const chat_srv="<%= $chat_srv %>";
const chat_channel="<%= $chat_channel %>";
</script>

View File

@@ -37,6 +37,7 @@
<section class="flex chat"><article>
</section></article> </section>
<script>
const nick="<%= $nick %>";
const radio_server="<%= $radio_server %>";
const listen_url="<%= $listen_url %>";
const channel="<%= $channel %>";

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script> -->
<% map{%><%= stylesheet "$_"%><%}(@{stash('css')}) if defined(stash('css'));%>
</head>
<body>
<% map{%><%= include "$_"%><%}(@{stash('prepend')})
if defined(stash('prepend'));%>
<%= content %>
<% map{%><%= include "$_"%><%}(@{stash('apend')})
if defined(stash('apend'));%>
<% map{%><%= javascript "$_"%><%}(@{stash('js')}) if defined(stash('js'));%>
</body>
</html>