Skip to content

Commit

Permalink
Update files
Browse files Browse the repository at this point in the history
Update bootstrap to 3.3.7 and jQuery to 3.1.0, UI revamping (WIP), code
cleaning (WIP)
  • Loading branch information
99leonchang committed Aug 5, 2016
1 parent c17f83a commit 3b9c09a
Show file tree
Hide file tree
Showing 25 changed files with 6,073 additions and 6,534 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
scripts/config.py
*.pyc
*~
.idea
2 changes: 1 addition & 1 deletion Web Interface/.gitignore
@@ -1,3 +1,3 @@
errors.txt
tags

.idea
48 changes: 34 additions & 14 deletions Web Interface/components.php
Expand Up @@ -5,8 +5,11 @@
function loginbox() {
if (!isset($_SESSION['loggedin'])) {
?>
<h4>Login</h4>
<center>
<div class="panel-heading text-center">
<h3 class="panel-title">Login</h3>
</div>
<div class="panel-body text-center">

<form action="<?php echo SITE_URL; ?>/process.php" method="post" role="form">
<div class="input-group" style="margin-bottom: -1px;">
<span class="input-group-addon" style="border-bottom-left-radius: 0;"><i class="glyphicon glyphicon-user"></i></span>
Expand All @@ -19,19 +22,30 @@ function loginbox() {
<input type="submit" name="login" value="Log In" class="btn btn-primary btn-block"/>
</form>
<a href='<?php echo SITE_URL; ?>/register'>New Team? Register Here.</a>
</center>
</div>
<?php
} else {
?>
<h4>Team</h4>
<table class='table table-condensed'>
<tr><th>Team Name</th><th>Score</th><th>Overall Rank</th></tr>
<?php
$query = "SELECT count(*)+1 as rank, (select score from teams where tid = " . $_SESSION['team']['id'] . ") as sco FROM `teams` WHERE (score > (select score from teams where tid = " . $_SESSION['team']['id'] . ") and status = 'Normal') or (score = (select score from teams where tid = " . $_SESSION['team']['id'] . ") and penalty < (select penalty from teams where tid = " . $_SESSION['team']['id'] . ") and status='Normal') ";
$res = DB::findOneFromQuery($query);
echo "<tr><td><a href='" . SITE_URL . "/teams/" . $_SESSION['team']['name'] . "'>" . $_SESSION['team']['name'] . "</a></td><td>$res[sco]</td><td style='text-align: center'>$res[rank]</td></tr>";
?>
</table>
<div class="panel-heading text-center">
<h3 class="panel-title">Team</h3>
</div>
<div class="panel-body text-center">

<table class='table table-hover'>
<thead>
<tr>
<th>Name</th>
<th>Score</th>
<th>Overall Rank</th>
</tr>
</thead>
<?php
$query = "SELECT count(*)+1 as rank, (select score from teams where tid = " . $_SESSION['team']['id'] . ") as sco FROM `teams` WHERE (score > (select score from teams where tid = " . $_SESSION['team']['id'] . ") and status = 'Normal') or (score = (select score from teams where tid = " . $_SESSION['team']['id'] . ") and penalty < (select penalty from teams where tid = " . $_SESSION['team']['id'] . ") and status='Normal') ";
$res = DB::findOneFromQuery($query);
echo "<tr><td><a href='" . SITE_URL . "/teams/" . $_SESSION['team']['name'] . "'>" . $_SESSION['team']['name'] . "</a></td><td>$res[sco]</td><td style='text-align: center'>$res[rank]</td></tr>";
?>
</table>
</div>
<?php
}
}
Expand Down Expand Up @@ -61,7 +75,13 @@ function contest_status() {
}
?>
<table class='table table-condensed'>
<tr><th>Mode</th><th>Judge</th><th>End Time</th></tr>
<thead>
<tr>
<th>Mode</th>
<th>Judge</th>
<th>End Time</th>
</tr>
</thead>
<tr><td><div id="ajax-contest-mode">
<?php
if ($status['mode'] == "Active" && $status['endtime'] < time())
Expand Down Expand Up @@ -126,7 +146,7 @@ function rankings() {
$result = DB::findAllWithCount($select, $body, 1, 10);
$data = $result['data'];
$i = 1;
echo "<table class='table table-condensed elipsis_sizer'><tr><th>Rank</th><th>Name</th><th>Score</th></tr>";
echo "<table class='table table-condensed'><tr><th>Rank</th><th>Name</th><th>Score</th></tr>";
foreach ($data as $row) {
echo "<tr><td>" . $i++ . "</td><td><a href='" . SITE_URL . "/teams/$row[teamname]'>" . $row['teamname'] . "</a></td><td>" . $row['score'] . "</td></tr>";
}
Expand Down
3 changes: 2 additions & 1 deletion Web Interface/config.php
@@ -1,6 +1,7 @@
<?php
// Change the following parameters according to the instructions beside them
define("SITE_URL", "http://" . $_SERVER['HTTP_HOST'] . "/aurora"); // path to directory
//define("SITE_URL", "http://" . $_SERVER['HTTP_HOST'] . "/aurora"); // path to directory
define("SITE_URL", "http://" . $_SERVER['HTTP_HOST'] . "/aurora/Web Interface"); //Dev only, please use the above line
define("SQL_USER", "aurora"); // Database username
define("SQL_PASS", "aurora"); // Database password
define("SQL_DB", "aurora_main"); // Database name
Expand Down

0 comments on commit 3b9c09a

Please sign in to comment.