From 6f33e20247c43c759f5236b6ca24a94886dfdbfc Mon Sep 17 00:00:00 2001 From: jonsito Date: Wed, 9 Dec 2015 12:12:59 +0100 Subject: [PATCH] Fix access level warning when opening some dialogs --- agility/console/dialogs/infomanga.php | 2 +- agility/console/frm_competicion.php | 2 +- agility/console/frm_inscripciones.php | 2 +- agility/console/frm_inscripciones2.php | 2 +- agility/console/index.php | 10 +++++----- agility/scripts/common.js.php | 12 +++++++++++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/agility/console/dialogs/infomanga.php b/agility/console/dialogs/infomanga.php index 8237674e4..38dfe5ecf 100644 --- a/agility/console/dialogs/infomanga.php +++ b/agility/console/dialogs/infomanga.php @@ -395,5 +395,5 @@ // if user has no write permission, show proper message info // TODO: force reload on logout session -$('#infomanga_readonly').css('display',(check_perms(1,null))?'none':'inline-block'); +$('#infomanga_readonly').css('display',(check_perms(access_level.PERMS_OPERATOR,null))?'none':'inline-block'); \ No newline at end of file diff --git a/agility/console/frm_competicion.php b/agility/console/frm_competicion.php index 5f2ccdfd2..0b61af143 100644 --- a/agility/console/frm_competicion.php +++ b/agility/console/frm_competicion.php @@ -62,7 +62,7 @@ extra=" ( )"; dialogs= {}; } - check_perms( 1, function() { loadContents( page, ''+extra, dialogs ); } ); + check_perms( access_level.PERMS_OPERATOR, function() { loadContents( page, ''+extra, dialogs ); } ); } }).window('open'); diff --git a/agility/console/frm_inscripciones.php b/agility/console/frm_inscripciones.php index a36d70540..99cc306c7 100644 --- a/agility/console/frm_inscripciones.php +++ b/agility/console/frm_inscripciones.php @@ -104,7 +104,7 @@ function acceptSelectPrueba() { title=''; } $('#selprueba-window').window('close'); - check_perms(1,function() {loadContents(page,title,{'inscripciones':'#new_inscripcion-dialog', 'equipos':'#team_datagrid-dialog'});}); + check_perms(access_level.PERMS_OPERATOR,function() {loadContents(page,title,{'inscripciones':'#new_inscripcion-dialog', 'equipos':'#team_datagrid-dialog'});}); } function cancelSelectPrueba() { diff --git a/agility/console/frm_inscripciones2.php b/agility/console/frm_inscripciones2.php index 394455353..2a6198f80 100644 --- a/agility/console/frm_inscripciones2.php +++ b/agility/console/frm_inscripciones2.php @@ -213,7 +213,7 @@ }); // set visibility of read-only warning -$('#inscripciones-readonly').css('display',check_perms(1,null)?'none':'inline-block'); +$('#inscripciones-readonly').css('display',check_perms(access_level.PERMS_OPERATOR,null)?'none':'inline-block'); // key handler addSimpleKeyHandler('#inscripciones-jornadas',null,editJornadaFromPrueba); diff --git a/agility/console/index.php b/agility/console/index.php index 08563c95b..678daf1e6 100644 --- a/agility/console/index.php +++ b/agility/console/index.php @@ -176,15 +176,15 @@ function myRowStyler(idx,row) {
  • diff --git a/agility/scripts/common.js.php b/agility/scripts/common.js.php index c80e292b5..73e048629 100644 --- a/agility/scripts/common.js.php +++ b/agility/scripts/common.js.php @@ -54,7 +54,7 @@ function setHeader(msg) { $('#Header_Operation').html('

    '+msg+'

    '); } // permisos de ejecucion -var access_perms = { +const access_perms = { ENABLE_TEAM3 :1, // permite gestionar pruebas de equipos 3 ENABLE_TEAM4 :2, // permite gestionar pruebas de equipos 4 ENABLE_KO :4, // permite gestionar pruebas K.O @@ -64,6 +64,16 @@ function setHeader(msg) { $('#Header_Operation').html('

    '+msg+'

    '); } ENABLE_CHRONO :64 // permite gestion desde cronometro }; +// permisos de acceso +const access_level = { + PERMS_ROOT :0, + PERMS_ADMIN :1, + PERMS_OPERATOR :2, + PERMS_ASSISTANT :3, + PERMS_GUEST :4, + PERMS_NONE :5 +} + /** * returns Categoria's long string according provided categoria and fereration * @param {string} cat Categoria