en el moras

This commit is contained in:
mynah
2018-07-18 16:04:47 -05:00
parent 4f0061cd7d
commit 5a7566eaf7
21 changed files with 94 additions and 55 deletions

View File

@@ -35,6 +35,7 @@ sub startup {
$r->any('/json/candy/:command')->to('data#candy');
$r->any('/admin/:section'=> {section =>'home'})->to('home#admin');
$r->any('/admin/json/:dreq/:id/')->to('data#admin');
$r->any('/login')->to('users#login');
$r->any('/logout')->to('users#logout');

View File

@@ -15,6 +15,14 @@ sub simple{
$c->render(json=>$json);
}
sub admin{
my $c=shift;
my $n=$c->param("dreq")//"";
my $json = {status => "304"};
$json= ($c->dbv->rmsgid($c->param('id')))[0] if ($n =~m/^mensajes$/);
$c->render(json=>$json);
}
#==== candy =====================================================
sub candy{
my $c=shift;
my $r="-1";
@@ -57,6 +65,7 @@ sub candy{
}
sub disconnectT{ $t->close();}
#=========================================================
1
__END__

View File

@@ -101,12 +101,35 @@ sub admin{
if ($c->param("hup")=~/Cambiar/){
$c->dbv->umod($c->param('link'),$c->param('update'));
};
if ($c->param("section")=~/home/){
my $v=(load_module("home/admin"))[0];
my ($x,$w)= load_module("home/admin/home");
$c->stash( merge_hash($x,$v) );
$c->stash(apend => ["home/admin/home"]);
$c->stash( map{ $_->{nombre} => $_->{contenido}} @{$c->dbv->mod});
}
elsif ( $c->param("section")=~/radio/ ){
$c->stash(
merge_hash( (load_module("home/admin"))[0],
merge_hash( (load_module("home/admin/candySwitch"))[0],
(load_module("home/admin/radio"))[0],
)));
$c->stash(apend => ["home/admin/radio","home/admin/candySwitch"]);
$c->stash(%{($c->dbv->radio)->[0]});
$c->stash($Dojo::Conf::radio);
}
elsif ( $c->param("section")=~/event/ ){
}
elsif ( $c->param("section")=~/mensajes/ ){
$c->stash(merge_hash(
(load_module("home/admin"))[0],
(load_module("home/admin/mensajes"))[0]
));
$c->stash(apend => ["home/admin/mensajes"]);
my $h = $c->dbv->rmsg;
$c->stash( h=>$h );
}
}

View File

@@ -17,11 +17,6 @@ sub mod{
return \@{_read($q)};
}
sub umod{
my $c=shift;
my $q="update casa set contenido = ? where nombre = 'mod' ;";
return _write($q,@_);
}
sub pang{
my ($c,$q)=@_;
return {map { basename($_,".md") => load_md("public/$_")}@{$q->{md}}};
@@ -58,6 +53,39 @@ sub radio{
return _read($q);
}
sub umod{
my $c=shift;
my $q="update casa set contenido = ? where nombre = ? ;";
return _write($q,@_);
}
sub urmod{
my $c=shift;
my $q="update casa set contenido = ? where nombre = ? ;";
return _write($q,@_);
}
sub rmsg{
my @empty;
my $q= path("public/home/admin/mensajes/qEntries.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP);
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind);
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return $h;
}
sub rmsgid{
my ($c,@bind)=@_;
my @empty;
my $q= path("public/home/admin/mensajes/json/qGetInfo.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP);
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind);
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return $h;
}
sub _read{
my ($q,@bind)=@_;
my (@empty,$arr);

View File

@@ -1,5 +1,5 @@
d3.select("#clink").on("click",function(){
var newWindow = window.open(' #nav candy','_blank');
var newWindow = window.open('candy','_blank');
});
var ciface =" #exec candy_loader/candyInterface.pl&v=";

View File

@@ -1,7 +1,7 @@
d3.select("select#sentry").on("change",function(){
var msg_id=d3.select("select#sentry").node().value;
d3.json(" #data admin/mensajes/json/qGetInfo.q&imid="+msg_id ,function(d){
d3.json("/admin/json/mensajes/"+msg_id ,function(d){
if(d[0] !=undefined) {if(d[0] != 0){
d3.select("p#fecha").text(d[0].imdate);
d3.select("p#correo").text(d[0].imail);

View File

@@ -1,11 +1,3 @@
/* c#host localhost*/
/* c#database #dbmsg */
/* c#user #dbmsg_user */
/* c#password #dbmsg_pass */
select
e.id as imid,
concat(day(e.fecha)," de ",m.nombre," ", year(e.fecha)) as imdate,
@@ -15,5 +7,5 @@ select
from entrada as e
inner join vuelo.mes as m on m.id=month(e.fecha)
where e.id= " #imid ";
where e.id= ? ; #imid

View File

@@ -1,13 +1,7 @@
/* c#host localhost*/
/* c#database #dbmsg */
/* c#user #dbmsg_user */
/* c#password #dbmsg_pass */
select
"mlist" as tag,
id as mid,
concat(nombre," ",date(fecha)) as "entry"
from entrada
order by fecha;
order by fecha desc
limit 100;

View File

@@ -1,7 +1,7 @@
dataUpdate();
// let radio_server = xxx.info;
function dataUpdate(){
d3.json(" #radio_server /status-json.xsl",function(d){
d3.json(radio_server+"/status-json.xsl",function(d){
if (d.icestats.source != undefined){
d3.select("#now").text(d.icestats.source.title);
d3.select("#onAir").style("background-color","green");

View File

@@ -1,10 +1,3 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
update casa set contenido= q#link where nombre = q#update ;
# update casa set contenido= q#link where nombre = q#update ;
update casa set contenido= ? where nombre = ? ;

View File

@@ -1,13 +1,9 @@
<section class="flex messages">
<article class="select">
<select id="sentry" class="entry" size=10>
<!-- ##mlist -->
<!-- r##hide -->
<!-- c#mlist <option value=" #mid " class="entry"> #entry </option> -->
<!-- rr#hide -->
% foreach (@{stash('h')}){
<option value="<%= $_->{'mid'} %>" class=entry"> <%= $_->{'entry'} %></option>
% }
</select>
</article>
<article class="view">

View File

@@ -13,12 +13,15 @@
</article>
<article class="rmod">
<form action=" #nav adminr" method="POST">
<form action="/admin/radio" method="POST">
<label>Aviso para el radio</label>
<textarea name="link" id="tmod" class="rmod"> #rContent </textarea> <!-- a#dropvar -->
<textarea name="link" id="tmod" class="rmod"><%= $rmod %></textarea> <!-- a#dropvar -->
<input type="hidden" name="update" value="rmod"> <!-- a#dropvar -->
<input type="submit" name="hup" value="Cambiar"> <!-- a#dropvar -->
</form>
</article>
</section>
<script>
const radio_server="<%= $radio_server %>";
</script>

View File

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