Skip to content

Commit

Permalink
tag to 2.0.1 fix labels. set new tablet as default
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsito committed Aug 5, 2015
1 parent 44c81fa commit ea9ab2f
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 190 deletions.
12 changes: 5 additions & 7 deletions agility/tablet2/index.php → agility/old_tablet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<script src="/agility/scripts/auth.js.php" type="text/javascript" charset="utf-8" > </script>
<script src="/agility/scripts/competicion.js" type="text/javascript" charset="utf-8" > </script>
<script src="/agility/scripts/events.js" type="text/javascript" charset="utf-8" > </script>
<script src="/agility/tablet2/tablet.js" type="text/javascript" charset="utf-8" > </script>
<script src="/agility/old_tablet/tablet.js" type="text/javascript" charset="utf-8" > </script>

<script type="text/javascript" charset="utf-8">
function initialize() {
Expand Down Expand Up @@ -261,7 +261,7 @@ class="easyui-validatebox" data-options="required:true,validType:'length[1,255]'
if (p===null) return; // no selection
if (parseInt(p.Inscritos) > parseInt(p.UserLimit)) {
var message='<img src="/agility/images/sad_dog.png" width="100" alt="sad dog" style="float:right;"/>'+
'<p style="font-weight:bold;">Los permisos de la licencia instalada<br/> ' +
'<p style="font-weight:bold;">Los permisos de la licencia instalada<br /> ' +
'no permiten la gesti&oacute;n de pruebas</br> con m&aacute;s de '+p.UserLimit+' inscripciones</p>';
$.messager.alert({
title: 'Access denied',
Expand Down Expand Up @@ -377,12 +377,12 @@ function() {
workingData.datosSesion=s;
workingData.nombreJornada=j.Nombre;
// jornadas "normales", equipos3 y Open comparten el mismo fichero
var page="/agility/tablet2/tablet_main.php";
var page="/agility/tablet/tablet_competicion.php";
if (workingData.datosJornada.Equipos4==1) {
page="/agility/tablet2/tablet_main.php"; // parche temporal
page="/agility/tablet/tablet_competicion.php"; // parche temporal
}
if (workingData.datosJornada.KO==1) {
page="/agility/tablet2/tablet_main_ko.php";
page="/agility/tablet/tablet_competicion_ko.php";
}
$('#seltablet-dialog').dialog('close');
// and load page
Expand All @@ -392,8 +392,6 @@ function(response,status,xhr){
if (status=='error') $('#tablet_contenido').load('/agility/frm_notavailable.php');
// start event manager
startEventMgr(workingData.sesion,tablet_processEvents);
setDataEntryEnabled(false);
$('#tablet-layout').layout('panel','west').panel('setTitle',p.Nombre+" - "+ j.Nombre);
}
); // load
} // close dialog; open main window
Expand Down
151 changes: 29 additions & 122 deletions agility/tablet2/tablet.js → agility/old_tablet/tablet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,14 @@ function tandasStyler(val,row,idx) {
return str;
}

/******************* funciones de manejo del panel de orden de tandas y orden de salida en el tablet *******************/
/******************* funciones de manejo de las ventana de orden de tandas y orden de salida en el tablet *******************/

/**
* expande/contrae activa/desactiva entrada de datos en el tablet
* @param {boolean} flag true if activate; false on deactivate
*/
function setDataEntryEnabled(flag) {
$('#tdialog-fieldset').prop('disabled',!flag);
if (flag) $('#tablet-layout').layout('collapse','west');
else $('#tablet-layout').layout('expand','west');
function tablet_showOrdenSalida() {
$('#tablet-window').window('open');
$('#tdialog-window').window('close');
}

/******************* funciones de manejo del panel de entrada de resultados del tablet *****************/
/******************* funciones de manejo de la ventana de entrada de resultados del tablet *****************/

/**
* send events
Expand Down Expand Up @@ -79,8 +74,8 @@ function tablet_updateSession(row) {
Tanda: row.ID
};
if (parseInt(row.Manga)==0) {
var str= row.Nombre.toLowerCase();
if (str.indexOf("econo")>0) return false;
var str= strval(row.Nombre).toLowerCase();
if ( strpos(str,"econo")>0 ) return false;
else tablet_reconocimiento();
}
$.ajax({
Expand Down Expand Up @@ -320,8 +315,7 @@ function tablet_cancel() {
doBeep();
// retrieve original data from parent datagrid
var dgname=$('#tdialog-Parent').val();
var dg=$(dgname).datagrid();
var row =dg.datagrid('getSelected');
var row =$(dgname).datagrid('getSelected');
if (row) {
// update database according row data
row.Operation='update';
Expand All @@ -345,31 +339,14 @@ function tablet_cancel() {
);
}
});
var index=row =dg.datagrid('getRowIndex',row);
dg.datagrid('scrollTo',index);
}
// and close panel
tablet_cronoManual('stop');
tablet_cronoManual('reset');
setDataEntryEnabled(false);
$('#tdialog-window').window('close');
return false;
}

function nextRow(dg, cb){
var opts = dg.datagrid('options');
var row = dg.datagrid('getSelected');
var index = dg.datagrid('getRowIndex', row);
if (index>=(opts.numRows-1)) return false;
dg.datagrid('scrollTo', {
index: index+1,
callback: function(index){
$(this).datagrid('selectRow', index);
cb(index, $(this).datagrid('getRows')[index]);
}
});
return true;
}

function tablet_accept() {
doBeep();
// save results
Expand Down Expand Up @@ -409,102 +386,32 @@ function tablet_accept() {
tablet_cronoManual('reset');
}
if (!ac_config.tablet_next) { // no go to next row entry
setDataEntryEnabled(false);
$('#tdialog-window').window('close'); // close window
dg.datagrid('refreshRow',rowindex);
return false;
}
// seleccionamos fila siguiente
var res=nextRow(dg,function(index,data) {
// alert ("index:"+index+" data:"+JSON.stringify(data));
if (index<0) return false; // no selection
if (data==null) { // at end of rows. should not occurs
dg.datagrid('scrollTo',rowindex);
setDataEntryEnabled(false);
return false;
}
data.Session=workingData.sesion;
data.RowIndex=index; // not really used, but....
data.Parent=dgname; // store datagrid reference
$('#tdialog-form').form('load',data);
});
if (res==false) { // at end of list
setDataEntryEnabled(false);
dg.datagrid('refreshRow',rowindex);
}
return false; // prevent follow onClick event chain
}

/**
* retrieve from server data row on provided dorsal
* call to callback(idx,row) provided function
* @param {array} tanda current selected tanda
* @param {object} dg datagrid for current selected tanda
* @param {int} dorsal Dog dorsal to search for
* @param cb(page) what to do if Dorsal found in tanda
*/
function loadDorsalPage(tanda,dg,dorsal,cb) {
$.ajax({
type: 'GET',
url: "/agility/server/database/tandasFunctions.php",
dataType:'json',
data: {
Operation: 'getDataByDorsal',
Prueba: tanda.Prueba,
Jornada: tanda.Jornada,
Sesion: tanda.Sesion,
ID: tanda.ID,
Dorsal: dorsal
},
success: function(row) {
var idx=row.RowIndex;
if (idx<0) {
$.messager.alert("Not found","El perro con dorsal "+dorsal+" no participa en esta manga","info");
$('#tablet-datagrid-search').val('---- Dorsal ----');
return false;
}
cb(idx);
},
error: function(XMLHttpRequest,textStatus,errorThrown) {
alert("error: "+textStatus + " "+ errorThrown );
}
});
}

function tablet_editByDorsal() {
var i,len;
var dg=$('#tablet-datagrid');
var drs=$('#tablet-datagrid-search');
var rows=dg.datagrid('getRows');
var dorsal=parseInt(drs.val());
drs.blur();// remove focus to hide tooltip
// si no hay tandas activas muestra error e ignora
for (i=0,len=rows.length;i<len;i++) {
if (typeof(rows[i].expanded)==="undefined") continue;
if (rows[i].expanded==0) continue;
// obtenemos el datagrid y buscamos el dorsal
var dgname='#tablet-datagrid-'+rows[i].ID;
var dg2=$(dgname);
loadDorsalPage(rows[i],dg2,dorsal,function(idx){
dg2.datagrid('scrollTo', {
index: idx,
callback: function (index) {
if (index < 0) return false; // no selection
dg2.datagrid('selectRow', index);
var data = dg2.datagrid('getRows')[index];
data.Session = workingData.sesion;
data.RowIndex = index; // not really used, but....
data.Parent = dgname; // store datagrid reference
$('#tdialog-form').form('load', data);
setDataEntryEnabled(true);
}
});
});
drs.val('---- Dorsal ----');
/*
var count=dg.datagrid('getRows').length; // row count
if ( (rowindex)>=count ) { // at end of datagrid
$('#tdialog-window').window('close'); // close window
dg.datagrid('refreshRow',rowindex-1);
return false;
}
*/
dg.datagrid('scrollTo',rowindex+1);
dg.datagrid('selectRow', rowindex+1);
var data=dg.datagrid('getSelected');
if (data==null) {// at end of datagrid
$('#tdialog-window').window('close'); // close window
dg.datagrid('refreshRow',rowindex);
return false;
}
// arriving here means that there are no expanded row
$.messager.alert("No selection","No hay ninguna manga seleccionada","error");
drs.val('---- Dorsal ----');
data.Session=workingData.sesion;
data.RowIndex=rowindex; // not really used, but....
data.Parent=dgname; // store datagrid reference
$('#tdialog-form').form('load',data);
return false; // prevent follow onClick event chain
}

function isExpected(event) {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions agility/server/auth/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ restricted = "0"
debug_level = "8"
register_events = "1"
reset_events = "1"
version_name = "2.0.0"
version_date = "20150723_1935"
version_name = "2.0.1"
version_date = "20150805_2139"
lang = "es_ES.UTF-8"
proximity_alert = "5"
database_name = "agility"
Expand Down
5 changes: 3 additions & 2 deletions agility/server/pdf/print_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class PrintCommon extends FPDF {
protected $myDBObject;
protected $pageName; // name of file to be printed
protected $authManager;
protected $regInfo; // registration info from current license

protected $centro;

Expand Down Expand Up @@ -99,8 +100,8 @@ function __construct($orientacion,$file,$prueba,$jornada=0) {
if ($this->icon==$this->icon2) $this->icon2=$this->federation->getParentLogo();
}
$this->authManager=new AuthManager("print_common");
$ri=$this->authManager->getRegistrationInfo();
if ($ri['Serial']==="00000000") $this->icon="agilitycontest.png";
$this->regInfo=$this->authManager->getRegistrationInfo();
if ($this->regInfo['Serial']==="00000000") $this->icon="agilitycontest.png";
}

/**
Expand Down
28 changes: 14 additions & 14 deletions agility/server/pdf/print_etiquetas_pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ class Etiquetas_PDF extends PrintCommon {
protected $manga1;
protected $manga2;
public $resultados;
protected $icon;

function ac_SetDrawColor($str) {
$val=intval(str_replace('#','0x',$str),0);
$r=(0x00FF0000&$val)>>16;
$g=(0x0000FF00&$val)>>8;
$b=(0x000000FF&$val);
$this->SetDrawColor($r,$g,$b);
}
protected $serialno;

/** Constructor
* @param {obj} $manga datos de la manga
Expand All @@ -63,9 +55,10 @@ function __construct($prueba,$jornada,$mangas) {
$dbobj=new DBObject("print_etiquetas_pdf");
$this->manga1=$dbobj->__getObject("Mangas",$mangas[0]);
$this->manga2=$dbobj->__getObject("Mangas",$mangas[1]);
// evaluage logo info
$this->icon="rsce.png";
if (isset($this->club)) $this->icon=$this->club->Logo;
// add version date and license serial to every label
$ser= substr( $this->regInfo['Serial'],4,4);
$ver= substr( $this->config->getEnv("version_date"),2,6) ;
$this->serialno="{$ver}-${ser}";
}

// No tenemos cabecera: no cabe
Expand Down Expand Up @@ -93,7 +86,8 @@ function writeCell($idx,$row) {
$y10= $top+17*$idx+10;
$y7= $top+17*$idx+7;
$y8= $top+17*$idx+8;
$y9= $top+17*$idx+9;
$y9= $top+17*$idx+9;
$y12= $top+17*$idx+12;
$ynext=$top+17*($idx+1);

$this->SetFont('Arial','B',24); // bold 11px
Expand All @@ -119,6 +113,12 @@ function writeCell($idx,$row) {
//Fecha (45,y+5,38,5) left
$this->SetXY($left+36,$y9);
$this->Cell(38,5,$this->jornada->Fecha,0,0,'L',false);
// licencia
$this->SetFont('Arial','',5); // font for licencia
$this->SetXY($left+36,$y12);
$this->Cell(38,5,$this->serialno,0,0,'L',false);
$this->SetFont('Arial','I',8); // font for prueba,name

//Perro (45,y+10,38,7) right
$this->SetXY($left+36,$y10);
$this->Cell(38,7,"{$row['Licencia']} - {$row['Nombre']}",0,0,'R',false);
Expand Down Expand Up @@ -232,7 +232,7 @@ function composeTable($rowcount=0,$listadorsales="") {
$dbobj=new DBObject("print_etiquetas_csv");
$mng=$dbobj->__getObject("Mangas",$mangas[0]);
$prb=$dbobj->__getObject("Pruebas",$prueba);
$c= new Clasificaciones("print_podium_pdf",$prueba,$jornada);
$c= new Clasificaciones("print_etiquetas_pdf",$prueba,$jornada);

// obtenemos la clasificacion de la tanda seleccionada
$r=$c->clasificacionFinal($rondas,$mangas,$mode);
Expand Down
Loading

0 comments on commit ea9ab2f

Please sign in to comment.