Skip to content

Commit

Permalink
Merge pull request #47 from belivipro9x99/indev
Browse files Browse the repository at this point in the history
merge branch indev into master
  • Loading branch information
Belikhun authored Mar 3, 2020
2 parents 9d335e3 + ba01c1f commit b6b2f44
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 69 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

## Thay đổi trong v0.6.0

* **Bug:** Sửa lỗi cửa sổ danh sách đề bài không hiển thị thanh trượt khi đề bài tràn ra ngoài cửa số (a3bd9e6e2358dc3850fc82abf4ecb0f122622397)
* **Bug:** Sửa lỗi `undefined index` ở một số API khi dùng **PHP/7.4** (22f60e20861b38e64e3a5e0a69144ebd35412775)
* **Bug:** Sửa lỗi không thể bật tắt cài đặt **Mở Đề Bài trong hộp thoại** (d961a4cb9b249a6579a48f297ff9a2560a6b0c94)
* **Thay đổi:** Thay đổi font của tiêu đề cửa sổ (0c73b0239801080ade3ad876b766b64d205e0361)

* **Bug:** Sửa lỗi module `sounds` không tương thích với trình duyệt khác không chạy nhân `chromium` (1ca99107554bd5d59bf21eae07c179461a906f3f)
* **Bug:** Sửa lỗi request không được gửi lại sau khi hết `ratelimited` (f78e98f8f5ba43258544a423789fe4d771169c22)
* **Thêm:** Thêm tính năng đăng kí tài khoản! (a27eafd40de8fedbff0f9c1245c1e47bc7c2183f)
Expand Down
28 changes: 0 additions & 28 deletions CONTRIBUTING.md

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ An **beautiful** and **easy-to-use** Web Interface for **[Themis](https://dsapbl

<img src="https://lh3.googleusercontent.com/SYT2hlU7_rxmCgHz0kt6089Md1V-j-ePWUUQBFtUVF5DTlcSjmGhr14J7Qsgx262KBZuhGKZ4eZD3ChYzdBaFMytEw0aBD3dRLi0bZskyK3-6MQ7rMkDMfcED18JgPyfeZEee50h8g=w2400" width="500px">

[![version](https://img.shields.io/badge/release-v0.6.0-brightgreen.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-webinterface/releases/)
[![version](https://img.shields.io/badge/rev1-v0.6.0-brightgreen.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-webinterface/releases/)
[![license](https://img.shields.io/badge/license-MIT-orange.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-web-interface/blob/master/LICENSE)
[![status](https://img.shields.io/badge/status-near_stable-blue.svg?longCache=true&style=for-the-badge)]()
[![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface.svg?style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface)
[![codefactor](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface/badge/master?style=for-the-badge)](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface)
[![codefactor](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface/badge/release?style=for-the-badge)](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface)

[![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface/master.svg?label=master&style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface)
[![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface/indev.svg?label=indev&style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface)
Expand Down
4 changes: 2 additions & 2 deletions api/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ function setting(String $key, &$target, $type) {
stop(3, "Loại biến không khớp! Yêu cầu form ". $key ."". $type["string"], 400);
}

setting("contest_name" , $rawConfig["contest"]["name"] , $TYPE_STRING);
setting("contest_description" , $rawConfig["contest"]["description"] , $TYPE_STRING);
setting("app_title" , $rawConfig["app"]["title"] , $TYPE_STRING);
setting("app_description" , $rawConfig["app"]["description"] , $TYPE_STRING);
setting("uploadDir" , $rawConfig["uploadDir"] , $TYPE_STRING);
setting("time_zone" , $rawConfig["time"]["zone"] , $TYPE_STRING);
setting("time_begin_seconds" , $rawConfig["time"]["begin"]["seconds"] , $TYPE_NUMBER);
Expand Down
4 changes: 2 additions & 2 deletions api/contest/rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@
$header = Array("#", "username", "name", "total");

foreach ($list as $id)
array_push($header, $nameList[$id] || $id);
array_push($header, isset($nameList[$id]) ? $nameList[$id] : $id);

array_push($data, $header);

foreach ($res as $i => $item) {
$line = Array($i + 1, $item["username"], $item["name"], $item["total"]);

foreach ($list as $id)
array_push($line, $item["point"][$id] || null);
array_push($line, isset($item["point"][$id]) ? $item["point"][$id] : null);

array_push($data, $line);
}
Expand Down
5 changes: 3 additions & 2 deletions api/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"version" => VERSION,
"versionTag" => VERSION_TAG,
"author" => AUTHOR,
"contestName" => $config["contest"]["name"],
"contestDescription" => $config["contest"]["description"],
"contestName" => $config["app"]["title"],
"contestDescription" => $config["app"]["description"],
"username" => $_SESSION["username"] ?: null,
"CONTACT" => CONTACT_LINK,
"API_TOKEN" => isset($_SESSION["apiToken"]) ? $_SESSION["apiToken"] : null,
"REPO_ADDRESS" => REPO_ADDRESS,
"REPORT_ERROR" => REPORT_ERROR,
Expand Down
18 changes: 14 additions & 4 deletions assets/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ body #container .flexColumn.small {
panel {
position: relative;
display: flex;
flex-flow: column wrap;
flex-direction: column;
width: 350px;
height: auto;
background-color: white;
Expand All @@ -178,8 +178,9 @@ panel .head .le {
display: inline-block;
flex: 1 1 0;

font-size: 14px;
font-weight: 500;
font-family: Calibri;
font-size: 16px;
font-weight: bold;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
Expand Down Expand Up @@ -256,7 +257,7 @@ panel .main .showEmpty:empty::after {
#problemp {
flex-grow: 1;
width: auto;
height: 100%;
height: calc(100% - 10px);
}

#uploadp {
Expand Down Expand Up @@ -285,6 +286,14 @@ panel .main .showEmpty:empty::after {
min-height: calc(100vh - 90px);
}

body #container .flexRow:last-child {
height: 100%;
}

body #container .flexRow:last-child > #rankp {
max-height: calc(100% - 10px);
}

body #container .flexColumn {
width: 100%;
}
Expand Down Expand Up @@ -1217,6 +1226,7 @@ body.guest #problemp.hide {
max-height: 100%;
box-sizing: border-box;
padding: 10px;
overflow: auto;

animation: problemsListShow 0.5s cubic-bezier(0.23, 1, 0.32, 1) 0s 1 normal forwards;
}
Expand Down
14 changes: 7 additions & 7 deletions assets/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ var landingImage = $("#landingImage");
var landingImageInput = $("#landingImageInput");
var landingImageReset = $("#landingImageReset");

var contest = {
name: $("#contest_name"),
desc: $("#contest_description")
var app = {
title: $("#contest_name"),
description: $("#contest_description")
}
var uploadDir = $("#uploadDir");
var time = {
Expand Down Expand Up @@ -102,8 +102,8 @@ function update() {
}, response => {
let data = response.data;

contest.name.value = data.contest.name;
contest.desc.value = data.contest.description;
app.title.value = data.app.title;
app.description.value = data.app.description;
uploadDir.value = data.uploadDir;
time.zone.value = data.time.zone;
time.beginDate.value = cvdate(
Expand Down Expand Up @@ -291,8 +291,8 @@ $("#formContainer").addEventListener("submit", e => {
url: "/api/config",
method: "POST",
form: {
"contest.name": contest.name.value,
"contest.description": contest.desc.value,
"app.title": app.title.value,
"app.description": app.description.value,
"uploadDir": uploadDir.value,
"time.zone": time.zone.value,
"time.begin.seconds": bt.s,
Expand Down
4 changes: 2 additions & 2 deletions assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ const core = {
else
r = await this.onUnCheckHandler();

if (r !== false)
if (r !== "cancel")
cookie.set(cookieKey, e.target.checked);
else
e.target.checked = !e.target.checked;
Expand Down Expand Up @@ -1731,7 +1731,7 @@ const core = {
})

if (response !== "turnOff")
return false;
return "cancel";
}

if (!this.rankingUpdateToggler.checked)
Expand Down
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<li><b>%name%</b>: Tên dự án</li>
<li><b>%version%</b>: Phiên bản</li>
<li><b>%author%</b>: Tên tác giả</li>
<li><b>%contestName%</b>: Tên kì thi</li>
<li><b>%appTitle%</b>: Tên kì thi</li>
<li><b>%root%</b>: Thư mục gốc của hệ thống</li>
<li><b>%currentDate%</b>: Ngày hiện tại</li>
<li><b>%currentTime%</b>: Thời gian hiện tại</li>
Expand Down
6 changes: 3 additions & 3 deletions data/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contest": {
"name": "\u00d4n T\u1eadp",
"app": {
"title": "\u00d4n T\u1eadp",
"description": "B\u00e0i l\u00e0m n\u1ed9p l\u00ean \u0111\u01b0\u1ee3c ch\u1ea5m b\u1eb1ng ph\u1ea7n m\u1ec1m <a href='http:\/\/dsapblog.wordpress.com\/' target=\"_blank\" rel=\"noopener\">Themis (L\u00ea Minh Ho\u00e0ng & \u0110\u1ed7 \u0110\u1ee9c \u0110\u00f4ng)<\/a>"
},
"uploadDir": "D:\\Themis\\data\\uploadDir",
Expand Down Expand Up @@ -35,7 +35,7 @@
"time": 10,
"banTime": 30
},
"pageTitle": "%contestName%",
"pageTitle": "%appTitle%",
"allowRegister": true,
"clientConfig": {
"sounds": false,
Expand Down
6 changes: 3 additions & 3 deletions data/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"name" => APPNAME,
"version" => VERSION,
"author" => AUTHOR,
"contestName" => $config["contest"]["name"],
"appTitle" => $config["app"]["title"],
"root" => $_SERVER["DOCUMENT_ROOT"],
"currentDate" => date("d/m/Y"),
"currentTime" => date("H:i:s")
Expand All @@ -48,8 +48,8 @@ function applyCustomVar(&$string) {
$string = $s;
}

applyCustomVar($config["contest"]["name"]);
applyCustomVar($config["contest"]["description"]);
applyCustomVar($config["app"]["title"]);
applyCustomVar($config["app"]["description"]);
applyCustomVar($config["uploadDir"]);
applyCustomVar($config["pageTitle"]);

Expand Down
3 changes: 2 additions & 1 deletion data/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
define("APPNAME", "Themis Web Interface");
define("AUTHOR", "Belikhun");
define("VERSION", "0.6.0");
define("VERSION_TAG", "release");
define("VERSION_TAG", "rev1");
define("REPO_ADDRESS", "https://github.com/belivipro9x99/themis-web-interface");
define("REPORT_ERROR", REPO_ADDRESS . "/issues");
define("CONTACT_LINK", "http://m.me/belivipro9x99");
define("TRACK_ID", "UA-124598427-1");

// Size Limit
Expand Down
14 changes: 7 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$id = $userdata["id"];
}

$stripedContestDescription = strip_tags($config["contest"]["description"]);
$stripedContestDescription = strip_tags($config["app"]["description"]);
?>

<!DOCTYPE html>
Expand All @@ -45,17 +45,17 @@
<title><?php print $config["pageTitle"]; ?> | <?php print APPNAME ." v". VERSION; ?></title>

<!-- Primary Meta Tags -->
<meta name="title" content="<?php print $config["contest"]["name"]; ?>">
<meta name="title" content="<?php print $config["app"]["title"]; ?>">
<meta name="description" content="<?php print $stripedContestDescription; ?>">

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="<?php print $config["contest"]["name"]; ?>">
<meta property="og:title" content="<?php print $config["app"]["title"]; ?>">
<meta property="og:description" content="<?php print $stripedContestDescription; ?>">

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="<?php print $config["contest"]["name"]; ?>">
<meta property="twitter:title" content="<?php print $config["app"]["title"]; ?>">
<meta property="twitter:description" content="<?php print $stripedContestDescription; ?>">

<!-- Load Library First -->
Expand Down Expand Up @@ -93,7 +93,7 @@
<script src="/assets/js/errorHandler.js?v=<?php print VERSION; ?>" type="text/javascript"></script>
<script type="text/javascript" src="/assets/js/splash.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript">
var mainSplash = new splash(document.body, `<?php print $config["contest"]["name"]; ?>`, `<?php print $stripedContestDescription; ?>`, "/api/images/icon");
var mainSplash = new splash(document.body, `<?php print $config["app"]["title"]; ?>`, `<?php print $stripedContestDescription; ?>`, "/api/images/icon");

mainSplash.init = async set => {
set(0, "Initializing core.js?v=<?php print VERSION; ?>");
Expand Down Expand Up @@ -183,10 +183,10 @@
<img class="icon" src="/api/images/icon" />
<ul class="title">
<li class="main text-overflow">
<?php print $config["contest"]["name"]; ?>
<?php print $config["app"]["title"]; ?>
</li>
<li class="sub text-overflow">
<?php print $config["contest"]["description"]; ?>
<?php print $config["app"]["description"]; ?>
</li>
</ul>
</span>
Expand Down
4 changes: 2 additions & 2 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
</div>
<ul class="info">
<li class="name text-overflow">
<?php print $config["contest"]["name"]; ?>
<?php print $config["app"]["title"]; ?>
</li>
<li class="description text-overflow">
<?php print $config["contest"]["description"]; ?>
<?php print $config["app"]["description"]; ?>
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions tests/.config/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contest": {
"name": "logParser",
"app": {
"title": "logParser",
"description": "Config for logParser test"
},
"uploadDir": "/home/travis/build/belivipro9x99/themis-web-interface/tests/logParser",
Expand Down Expand Up @@ -35,7 +35,7 @@
"time": 10,
"banTime": 30
},
"pageTitle": "%contestName%",
"pageTitle": "%appTitle%",
"allowRegister": true,
"clientConfig": {
"sounds": false,
Expand Down

0 comments on commit b6b2f44

Please sign in to comment.