Improvements to the contest pages layout and added auth to it

pull/106/merge
Peter Goodhall 2011-08-19 22:10:53 +01:00
rodzic f10a604b29
commit e3d060196b
3 zmienionych plików z 61 dodań i 29 usunięć

Wyświetl plik

@ -6,15 +6,9 @@ class Contest extends CI_Controller {
// Displays available contests
public function index()
{
$this->load->model('logbook_model');
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
if($this->user_model->validate_session()) {
$this->user_model->clear_session();
show_error('Access denied<p>Click <a href="'.site_url('user/login').'">here</a> to log in as another user', 403);
} else {
redirect('user/login');
}
}
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// Load database items
$this->load->model('contests');
@ -30,15 +24,9 @@ class Contest extends CI_Controller {
Displays contest logging view based on the ID provided, allowing users to log in contest mode giving them serial numbers and scoring information.
*/
public function view($id) {
$this->load->model('logbook_model');
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
if($this->user_model->validate_session()) {
$this->user_model->clear_session();
show_error('Access denied<p>Click <a href="'.site_url('user/login').'">here</a> to log in as another user', 403);
} else {
redirect('user/login');
}
}
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// Load database information
$this->load->model('contests');
@ -94,11 +82,10 @@ class Contest extends CI_Controller {
Create a contest, these are linked to templates for scoring information. contests are per entry like a weekly RSGB Club contest etc.
*/
public function create() {
// Load database items
$this->load->model('contests');
$this->load->model('logbook_model');
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$data['templates'] = $this->contests->list_templates();
$this->load->helper(array('form', 'url'));
@ -127,6 +114,7 @@ class Contest extends CI_Controller {
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');

Wyświetl plik

@ -198,10 +198,10 @@ function settime () {
<?php echo validation_errors(); ?>
<form class="contest_qso_box" method="post" action="<?php echo site_url('contest/view/'.$info->id); ?>" name="qsos">
<div class="contest_qso_box">
<form method="post" action="<?php echo site_url('contest/view/'.$info->id); ?>" name="qsos">
<table>
<tr class="log_title">
<td class="title">Time</td>
<td class="title">Callsign</td>
@ -295,22 +295,53 @@ function settime () {
</select></td>
<td><input type="text" name="sent_serial" value="<?php echo $new_serial; ?>" size="2" /></td>
<td><input type="text" name="sent_serial" value="<?php echo $new_serial; ?>" size="4" /></td>
<td><input type="text" name="rst_recv" value="59" size="2" /></td>
<td><input type="text" name="recv_serial" value="" size="2" /></td>
<td><input type="text" name="recv_serial" value="" size="4" /></td>
<?php if($info->qra == "Y") { ?>
<td><input id="locator" type="text" name="locator" value="" size="7" /></td>
<td><input id="locator" type="text" name="locator" value="" size="8" /></td>
<?php } ?>
<td><input type="submit" value="Add QSO" /></td>
</tr>
</table>
</form>
<div class="info">
<input size="20" id="country" type="text" name="country" value="" /> <span id="locator_info"></span>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
i=0;
$(document).ready(function(){
$("#locator").keyup(function(){
if ($(this).val()) {
$('#locator_info').load("<?php echo site_url(); ?>/logbook/bearing/" + $(this).val()).fadeIn("slow");
}
});
$("#callsign").keyup(function(){
if ($(this).val()) {
$('#partial_view').load("<?php echo site_url(); ?>//logbook/partial/" + $(this).val()).fadeIn("slow");
$.get('<?php echo site_url(); ?>/logbook/find_dxcc/' + $(this).val(), function(result) {
$('#country').val(result);
});
$.get('<?php echo site_url(); ?>/logbook/callsign_qra/' + $(this).val(), function(result) {
$('#locator').val(result);
});
}
});
});
</script>

Wyświetl plik

@ -121,6 +121,19 @@ margin: 10px 0;
width: 30%;
float: right;
margin: 0 auto;
}
.contest_qso_box {
width: 695px;
margin: 5px;
padding: 5px;
border: 1px solid #dddddd;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.contest_qso_box table {
width: 695px;
}
</style>
@ -139,8 +152,8 @@ margin: 10px 0;
<li><a href="<?php echo site_url('search');?>" title="Search">Search</a></li>
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
<li><a href="<?php echo site_url('qso');?>" title="Add QSO">Add QSO</a></li>
<?php } ?>
<li><a href="<?php echo site_url('contest');?>" title="Contests">Contests</a></li>
<?php } ?>
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE){ ?>
<li><a href="<?php echo site_url('notes');?>" title="Notes">Notes</a></li>
<?php } ?>