Skip to content

Commit

Permalink
Fix access level warning when opening some dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsito committed Dec 9, 2015
1 parent ddc25bc commit 6f33e20
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion agility/console/dialogs/infomanga.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
</script>
2 changes: 1 addition & 1 deletion agility/console/frm_competicion.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
extra=" ( <?php _e('K.O. Rounds');?> )";
dialogs= {};
}
check_perms( 1, function() { loadContents( page, '<?php _e('Journey deployment');?>'+extra, dialogs ); } );
check_perms( access_level.PERMS_OPERATOR, function() { loadContents( page, '<?php _e('Journey deployment');?>'+extra, dialogs ); } );
}
}).window('open');

Expand Down
2 changes: 1 addition & 1 deletion agility/console/frm_inscripciones.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function acceptSelectPrueba() {
title='<?php _e("Inscriptions - Registering form");?>';
}
$('#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() {
Expand Down
2 changes: 1 addition & 1 deletion agility/console/frm_inscripciones2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions agility/console/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ function myRowStyler(idx,row) {
</li>
<li><?php _e('DATABASE'); ?>
<ul>
<li><a href="javascript:check_perms(1,function(){loadCountryOrClub();});"><span id="menu-clubes"><?php _e('Clubs'); ?></span></a></li>
<li><a href="javascript:check_perms(1,function(){loadContents('/agility/console/frm_guias.php','<?php _e('Handlers Database Management');?>');});"><?php _e('Handlers'); ?></a></li>
<li><a href="javascript:check_perms(1,function(){loadContents('/agility/console/frm_perros.php','<?php _e('Dogs Database Management');?>');});"><?php _e('Dogs'); ?></a></li>
<li><a href="javascript:check_perms(1,function(){loadContents('/agility/console/frm_jueces.php','<?php _e('Judges Database Management');?>');});"><?php _e('Judges'); ?></a></li>
<li><a href="javascript:check_perms(access_level.PERMS_OPERATOR,function(){loadCountryOrClub();});"><span id="menu-clubes"><?php _e('Clubs'); ?></span></a></li>
<li><a href="javascript:check_perms(access_level.PERMS_OPERATOR,function(){loadContents('/agility/console/frm_guias.php','<?php _e('Handlers Database Management');?>');});"><?php _e('Handlers'); ?></a></li>
<li><a href="javascript:check_perms(access_level.PERMS_OPERATOR,function(){loadContents('/agility/console/frm_perros.php','<?php _e('Dogs Database Management');?>');});"><?php _e('Dogs'); ?></a></li>
<li><a href="javascript:check_perms(access_level.PERMS_OPERATOR,function(){loadContents('/agility/console/frm_jueces.php','<?php _e('Judges Database Management');?>');});"><?php _e('Judges'); ?></a></li>
</ul>
</li>
<li><?php _e('CONTESTS'); ?>
<ul>
<li><a href="javascript:check_perms(1,function(){loadContents('/agility/console/frm_pruebas.php','<?php _e('Create and Edit Contests');?>');});"><?php _e('Create Contests'); ?></a></li>
<li><a href="javascript:check_perms(access_level.PERMS_OPERATOR,function(){loadContents('/agility/console/frm_pruebas.php','<?php _e('Create and Edit Contests');?>');});"><?php _e('Create Contests'); ?></a></li>
<li><a href="javascript:loadContents('/agility/console/frm_inscripciones.php','<?php _e('Inscriptions - Contest selection');?>',{'s':'#selprueba-window'});"><?php _e('Handle Inscriptions'); ?></a></li>
<li><a href="javascript:loadContents('/agility/console/frm_competicion.php','<?php _e('Competition - Contest and Journey selection');?>');"><?php _e('Running Contests'); ?></a></li>
</ul>
Expand Down
12 changes: 11 additions & 1 deletion agility/scripts/common.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
function setHeader(msg) { $('#Header_Operation').html('<p>'+msg+'</p>'); }

// 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
Expand All @@ -64,6 +64,16 @@ function setHeader(msg) { $('#Header_Operation').html('<p>'+msg+'</p>'); }
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
Expand Down

0 comments on commit 6f33e20

Please sign in to comment.