From 211e710efdd58cdd4f275f58c69edd7cca808290 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 25 Jul 2018 20:48:58 +0000 Subject: [PATCH] prososy listo --- lib/Dojo.pm | 3 +- lib/Dojo/Controller/Data.pm | 20 +++++----- lib/Dojo/Controller/Home.pm | 11 ++++++ lib/Dojo/Model/Vuelo.pm | 3 ++ public/home/admin/candySwitch/jsCSwitch.js | 4 +- public/home/candy/default.css | 44 +++++++++++----------- public/home/candy/loader.js | 4 +- public/home/radio/jsLink.js | 4 +- templates/home/candy.html.ep | 16 ++++---- templates/home/radio.html.ep | 1 + templates/layouts/clean.html.ep | 19 ++++++++++ 11 files changed, 81 insertions(+), 48 deletions(-) create mode 100644 templates/layouts/clean.html.ep diff --git a/lib/Dojo.pm b/lib/Dojo.pm index f1f2c43..949f381 100644 --- a/lib/Dojo.pm +++ b/lib/Dojo.pm @@ -37,8 +37,9 @@ use Dojo::Model::Data; # candy ======================================================================= $r->any('/json/candy/:command')->to('data#candy'); + $r->any('/candy')->to('home#candy'); # ============================================================================= - + # admin ======================================================================= $r->any('/admin/home')->to('home#admin_home'); $r->any('/admin/radio')->to('home#admin_radio'); diff --git a/lib/Dojo/Controller/Data.pm b/lib/Dojo/Controller/Data.pm index 7f70449..9b58464 100644 --- a/lib/Dojo/Controller/Data.pm +++ b/lib/Dojo/Controller/Data.pm @@ -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{ diff --git a/lib/Dojo/Controller/Home.pm b/lib/Dojo/Controller/Home.pm index 91828b3..7dca256 100644 --- a/lib/Dojo/Controller/Home.pm +++ b/lib/Dojo/Controller/Home.pm @@ -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")); + } + #============================================================================== diff --git a/lib/Dojo/Model/Vuelo.pm b/lib/Dojo/Model/Vuelo.pm index caafad3..2d32a89 100644 --- a/lib/Dojo/Model/Vuelo.pm +++ b/lib/Dojo/Model/Vuelo.pm @@ -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 ============================================================== diff --git a/public/home/admin/candySwitch/jsCSwitch.js b/public/home/admin/candySwitch/jsCSwitch.js index 2cc085b..138020e 100755 --- a/public/home/admin/candySwitch/jsCSwitch.js +++ b/public/home/admin/candySwitch/jsCSwitch.js @@ -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(); } diff --git a/public/home/candy/default.css b/public/home/candy/default.css index 3d9e2e3..18be005 100755 --- a/public/home/candy/default.css +++ b/public/home/candy/default.css @@ -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 { diff --git a/public/home/candy/loader.js b/public/home/candy/loader.js index 66230fa..041e88e 100755 --- a/public/home/candy/loader.js +++ b/public/home/candy/loader.js @@ -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();}); diff --git a/public/home/radio/jsLink.js b/public/home/radio/jsLink.js index c3b4a22..31025d7 100755 --- a/public/home/radio/jsLink.js +++ b/public/home/radio/jsLink.js @@ -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");} diff --git a/templates/home/candy.html.ep b/templates/home/candy.html.ep index 9c329c4..6bc7d8f 100755 --- a/templates/home/candy.html.ep +++ b/templates/home/candy.html.ep @@ -1,15 +1,13 @@ - -<%= javascript "/ext/libs.min.js"; %> -<%= javascript "/ext/candy.min.js"; %> -<%= stylesheet "/ext/lib.min.css"; %> -
+ + diff --git a/templates/home/radio.html.ep b/templates/home/radio.html.ep index c749d2a..71654b7 100755 --- a/templates/home/radio.html.ep +++ b/templates/home/radio.html.ep @@ -37,6 +37,7 @@