From 8751c1e2a712bf50ab850b8645f49f5bf4c91ffa Mon Sep 17 00:00:00 2001 From: jantonio Date: Mon, 19 Jul 2021 16:11:50 +0200 Subject: [PATCH] PerroEnPista: add missing variables from events, to allow multidata tracking. Update version/release --- ChangeLog | 4 +++ agility/ajax/database/clubFunctions.php | 10 ++++++- agility/livestream/perroenpista.html | 31 +++++++++++++++++++--- agility/livestream/perroenpista.js | 22 ++++++++++----- agility/server/database/classes/Clubes.php | 13 +++++---- config/system.ini | 4 +-- web/blog/index.php | 14 ++++++++++ 7 files changed, 81 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53a125fee..abd5a6172 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 4.5.2 20210719_1000 + - Multilicense handling support + - New "livestream" webapp "perroenpista" + - Typos and strings fixes Version 4.5.1 20210712_1930 - Fix: messager.password behavior ( do not fire onchange when focus lost ) - Fix: updater should handle new naming convention from github diff --git a/agility/ajax/database/clubFunctions.php b/agility/ajax/database/clubFunctions.php index 23b8eff79..d1d137d71 100644 --- a/agility/ajax/database/clubFunctions.php +++ b/agility/ajax/database/clubFunctions.php @@ -28,6 +28,8 @@ $operation=http_request("Operation","s",null); $federation=http_request("Federation","i",-1); // force exception if undefined $idclub=http_request("ID","i",0); + $perro=http_request("Perro","i",0); + $guia=http_request("Guia","i",0); if ($operation===null) throw new Exception("Call to clubFunctions without 'Operation' requested"); $clubes= new Clubes("clubFunctions",$federation); @@ -41,8 +43,14 @@ case "enumerate": $result=$clubes->enumerate(); break; case "countries": $c=new Country(); $result=$c->enumerate(); break; case "getlogo": // not a json function; just return an image - $result=$clubes->getLogo($idclub); + $result=$clubes->getLogo($idclub,$perro); return; + case "getLogoByPerro": // not a json function; just return an image + $result=$clubes->getLogoByPerro($perro); + return; + case "getLogoByGuia": // not a json function; just return an image + $result=$clubes->getLogoByGuia($guia); + return; case "setlogo": $am->access(PERMS_OPERATOR); // this call provides an image in base64 encoded format. Needs special handling diff --git a/agility/livestream/perroenpista.html b/agility/livestream/perroenpista.html index ac6a3cfd5..caf5cc2e7 100644 --- a/agility/livestream/perroenpista.html +++ b/agility/livestream/perroenpista.html @@ -30,24 +30,41 @@ Source: 'videowall', Name: 'perroenpista', Destination: '', // empty - Sname: 'perroenpista:0:0:0:videowall@1.2.3.4' + Sname: 'perroenpista:0:0:0:videowall@1.2.3.4', + myImage: null }; function initialize() { + // initialize logo canvas + var c = document.getElementById("pp_Logo"); + var ctx = c.getContext("2d"); + ac_config.myImage = new Image(150,150); + ac_config.myImage.onload = function() { ctx.drawImage(ac_config.myImage, 0, 0); }; + + // extract ring and server host name ac_config.Host= new URL(window.location).hostname; // AgilityContest server name ac_config.Ring= new URL(window.location).searchParams.get('ring'); // ring to parse if ( !ac_config.Host || ac_config.Host==='') ac_config.Host='localhost'; if ( !ac_config.Ring || ac_config.Ring==='') ac_config.Ring=1; + + // and fire up event manager findSessionID() } - +

Perro en pista

+

Prueba: Esperando a que tablet esté activo...

+

Jornada:

+

Manga:

+


- +
+ + + @@ -61,6 +78,14 @@

Perro en pista

Equipo:
Categoría:
Grado:
+

+Faltas:
+Rehuses:
+Tocados:
+Eliminado:
+No Presentado:
+

+

diff --git a/agility/livestream/perroenpista.js b/agility/livestream/perroenpista.js index 053e294c4..1884445bc 100644 --- a/agility/livestream/perroenpista.js +++ b/agility/livestream/perroenpista.js @@ -67,14 +67,24 @@ Ejemplo del json devuelto en la llamada "listEvents()" * @param {string} data received json decoded data */ function parseEvent(entry) { - // ignore every events but 'llamada' as we only want running dog data - if(entry.Type!=='llamada') return; + let lista=[]; let data=JSON.parse(entry.Data); + switch (entry.Type) { + case "open": + lista=['NombrePrueba','NombreJornada','NombreManga','NombreRing']; + break; + case "llamada": + // ajustamos logo y timestamp + $('#pp_Timestamp').html(entry.Timestamp); + ac_config.myImage.src="../ajax/database/clubFunctions.php?Operation=getLogoByPerro&Federation=0&Perro="+data['Dog']; + lista=['Drs','Nombre','NombreLargo','NombreGuia','NombreClub','NombreEquipo',"Categoria",'Grado']; + // no break; + case "aceptar": + lista=lista.concat(['Flt','Toc','Reh','Eli','NPr']); + break; + } // rellenamos pagina - $.each(data, function(key, value){ - if (key==='TimeStamp') value=entry.Timestamp; // use gmtime format instead of epoch integer - $('#pp_'+key).html(value); - }); + $.each(lista, function(key, value){ $('#pp_'+value).html(data[value]); }); } // wait for new events diff --git a/agility/server/database/classes/Clubes.php b/agility/server/database/classes/Clubes.php index 701a30100..c2c194559 100644 --- a/agility/server/database/classes/Clubes.php +++ b/agility/server/database/classes/Clubes.php @@ -287,13 +287,13 @@ private function composeLogoName($name) { /** * Retorna el logo asociado al club de id indicado * NOTA: esto no retorna una respuesta json, sino una imagen - * @param $id + * @param $id id club * @return null|string {string} "" on success; else error string */ - function getLogo($id) { + function getLogo($id,$perro=0) { $this->myLogger->enter(); - if ($id==0) $id=1; // on insert, select default logo - $row=$this->__selectObject("Logo","clubes","ID=$id"); + if ($id==0) $id=1; + $row=$this->__selectObject("Logo","clubes","ID={$id}"); if (!$row) return $this->error($this->conn->error); $name=$row->Logo; $fname=getIconPath($this->curFederation->get('Name'),$name); @@ -302,6 +302,7 @@ function getLogo($id) { $fname=getIconPath($this->curFederation->get('Name'),$this->curFederation->get('Logo')); // use default name } $size = getimagesize($fname); + header("Access-Control-Allow-Origin: https://{$_SERVER['SERVER_NAME']}",false); header('Content-Type: '.$size['mime']); readfile($fname); return ""; @@ -316,7 +317,7 @@ function getLogo($id) { function getLogoByPerro($id) { $this->myLogger->enter(); if ($id==0) $id=1; // on insert, select default logo - $row=$this->__selectObject("Logo","perros,guias,clubes","(perros.Guia=guias.ID ) AND (guias.Club=clubes.ID) AND (perros.ID=$id)"); + $row=$this->__selectObject("LogoClub AS Logo","perroguiaclub","(ID=$id)"); if (!$row) return $this->error($this->conn->error); $name=$row->Logo; $fname=getIconPath($this->curFederation->get('Name'),$name); @@ -325,6 +326,7 @@ function getLogoByPerro($id) { $fname=getIconPath($this->curFederation->get('Name'),$this->curFederation->get('Logo')); // use default name } $size = getimagesize($fname); + header("Access-Control-Allow-Origin: https://{$_SERVER['SERVER_NAME']}",false); header('Content-Type: '.$size['mime']); readfile($fname); return ""; @@ -348,6 +350,7 @@ function getLogoByGuia($id) { $fname=getIconPath($this->curFederation->get('Name'),$this->curFederation->get('Logo')); // use default name } $size = getimagesize($fname); + header("Access-Control-Allow-Origin: https://{$_SERVER['SERVER_NAME']}",false); header('Content-Type: '.$size['mime']); readfile($fname); return ""; diff --git a/config/system.ini b/config/system.ini index 6e6e6c841..cf5c178fc 100644 --- a/config/system.ini +++ b/config/system.ini @@ -3,8 +3,8 @@ program_name = "AgilityContest" author = "Juan Antonio Martinez" email = "juansgaviota@gmail.com" license = "GPL" -version_name = "4.5.1" -version_date = "20210712_1930" +version_name = "4.5.2" +version_date = "20210719_1000" database_name = "agility" database_host = "localhost" database_user = "YWdpbGl0eV9vcGVyYXRvcg==" diff --git a/web/blog/index.php b/web/blog/index.php index 60343df88..cef466abb 100644 --- a/web/blog/index.php +++ b/web/blog/index.php @@ -33,6 +33,20 @@ + + 2021-Jul-19
+

+ Versión 4.5.2 +

+

+ La nueva versión incluye soporte para registrar múltiples licencias
+ No obstante, se recuerda que en todo momento solo estará activa la última licencia seleccionada +

+

+ Nueva opción para livestream: utilidad para mostrar el perro en pista +

+ + 2021-Jul-06