Improvements to the contest pages layout and added auth to it

这个提交包含在:
Peter Goodhall 2011-08-19 22:10:53 +01:00
父节点 f10a604b29
当前提交 e3d060196b
共有 3 个文件被更改,包括 61 次插入29 次删除

查看文件

@ -6,15 +6,9 @@ class Contest extends CI_Controller {
// Displays available contests // Displays available contests
public function index() public function index()
{ {
$this->load->model('user_model'); $this->load->model('logbook_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { $this->load->model('user_model');
if($this->user_model->validate_session()) { if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$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');
}
}
// Load database items // Load database items
$this->load->model('contests'); $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. 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) { public function view($id) {
$this->load->model('user_model'); $this->load->model('logbook_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { $this->load->model('user_model');
if($this->user_model->validate_session()) { if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$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');
}
}
// Load database information // Load database information
$this->load->model('contests'); $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. 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() { public function create() {
$this->load->model('logbook_model');
// Load database items
$this->load->model('contests');
$this->load->model('user_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'); } 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(); $data['templates'] = $this->contests->list_templates();
$this->load->helper(array('form', 'url')); $this->load->helper(array('form', 'url'));
@ -127,6 +114,7 @@ class Contest extends CI_Controller {
$this->load->model('user_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'); } 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->helper(array('form', 'url'));
$this->load->library('form_validation'); $this->load->library('form_validation');

查看文件

@ -198,10 +198,10 @@ function settime () {
<?php echo validation_errors(); ?> <?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> <table>
<tr class="log_title"> <tr class="log_title">
<td class="title">Time</td> <td class="title">Time</td>
<td class="title">Callsign</td> <td class="title">Callsign</td>
@ -295,22 +295,53 @@ function settime () {
</select></td> </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="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") { ?> <?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 } ?> <?php } ?>
<td><input type="submit" value="Add QSO" /></td> <td><input type="submit" value="Add QSO" /></td>
</tr> </tr>
</table> </table>
</form>
<div class="info"> <div class="info">
<input size="20" id="country" type="text" name="country" value="" /> <span id="locator_info"></span> <input size="20" id="country" type="text" name="country" value="" /> <span id="locator_info"></span>
</div> </div>
</form> </div>
</div> </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>

查看文件

@ -121,6 +121,19 @@ margin: 10px 0;
width: 30%; width: 30%;
float: right; float: right;
margin: 0 auto; 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> </style>
@ -139,8 +152,8 @@ margin: 10px 0;
<li><a href="<?php echo site_url('search');?>" title="Search">Search</a></li> <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) { ?> <?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> <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> <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){ ?> <?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> <li><a href="<?php echo site_url('notes');?>" title="Notes">Notes</a></li>
<?php } ?> <?php } ?>