Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add theme: mdui #742

Merged
merged 5 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Star us, please!

日期 | 类型 | 更新内容
----- | :--: | :-------
01-01 | 更新 | 新的模板 [`syzoj`](https://github.com/zhblue/hustoj/pull/722) 基本可用,如需启用新模板,只需修改 `/home/judge/src/web/include/db_info.inc.php` ,设置 `$OJ_TEMPLATE="bshark";` 即可。
02-06 | 更新 | 新的模板 [`mdui`](https://github.com/zhblue/hustoj/pull/742) 基本可用,如需启用新模板,只需修改 `/home/judge/src/web/include/db_info.inc.php` ,设置 `$OJ_TEMPLATE="mdui";` 即可。*如需内网使用,请在 `/home/judge/src/web/include/db_info.inc.php` 末尾添加 `$MDUI_OFFLINE=true;` 即可。* (Author: [@renbaoshuo](https://github.com/renbaoshuo))
01-01 | 更新 | 新的模板 [`syzoj`](https://github.com/zhblue/hustoj/pull/722) 基本可用,如需启用新模板,只需修改 `/home/judge/src/web/include/db_info.inc.php` ,设置 `$OJ_TEMPLATE="syzoj";` 即可。 (Author: [@renbaoshuo](https://github.com/renbaoshuo))

</details>

Expand Down
15 changes: 8 additions & 7 deletions trunk/web/template/bs3/userinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
echo "<a href=mail.php?to_user=$user>$MSG_MAIL</a>";
?>
</caption>
<tr ><td width=15%><?php echo $MSG_Number?><td width=25% align=center><?php echo $Rank?><td width=70% align=center>Solved Problems List</tr>
<tr ><td><?php echo $MSG_SOVLED?><td align=center><a href='status.php?user_id=<?php echo $user?>&jresult=4'><?php echo $AC?></a>
<tr ><td width=15%><?php echo $MSG_Number?></td><td width=25% align=center><?php echo $Rank?></td><td width=70% align=center>Solved Problems List</td></tr>
<tr ><td><?php echo $MSG_SOVLED?><td align=center><a href='status.php?user_id=<?php echo $user?>&jresult=4'><?php echo $AC?></td></a>
<td rowspan=14 align=center>
<script language='javascript'>
function p(id,c){
Expand All @@ -53,14 +53,14 @@ function p(id,c){
<div id=submission style="width:600px;height:300px" ></div>
</td>
</tr>
<tr ><td><?php echo $MSG_SUBMIT?><td align=center><a href='status.php?user_id=<?php echo $user?>'><?php echo $Submit?></a></tr>
<tr ><td><?php echo $MSG_SUBMIT?></td><td align=center><a href='status.php?user_id=<?php echo $user?>'><?php echo $Submit?></a></td></tr>
<?php
foreach($view_userstat as $row){
//i++;
echo "<tr ><td>".$jresult[$row[0]]."<td align=center><a href=status.php?user_id=$user&jresult=".$row[0]." >".$row[1]."</a></tr>";
echo "<tr ><td>".$jresult[$row[0]]."</td><td align=center><a href=status.php?user_id=$user&jresult=".$row[0]." >".$row[1]."</a></td></tr>";
}
//}
echo "<tr id=pie ><td>Statistics<td><div id='PieDiv' style='position:relative;height:105px;width:120px;'></div></tr>";
echo "<tr id=pie ><td>Statistics</td><td><div id='PieDiv' style='position:relative;height:105px;width:120px;'></div></td></tr>";
?>
<script type="text/javascript" src="include/wz_jsgraphics.js"></script>
<script type="text/javascript" src="include/pie.js"></script>
Expand All @@ -85,11 +85,12 @@ function p(id,c){
//mypie.clearPie();
</script>
<tr ><td>School:<td align=center><?php echo $school?></tr>
<tr ><td>Email:<td align=center>***<?php// echo $email?></tr>
<tr ><td>Email:<td align=center>[email protected]<?php// echo $email?></tr>
</table>
<?php
if(isset($_SESSION[$OJ_NAME.'_'.'administrator'])){
?><table border=1><tr class=toprow><td>UserID<td>Password<td>IP<td>Time</tr>
?><table border=1>
<thead><tr class=toprow><th>UserID</th><th>Password</th><th>IP</th><th>Time</th></tr></thead>
<tbody>
<?php
$cnt=0;
Expand Down
7 changes: 7 additions & 0 deletions trunk/web/template/mdui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# HUSTOJ Theme MDUI

## Author

**HUSTOJ Theme MDUI** © [Baoshuo](https://github.com/renbaoshuo), Released under the [GPL-2.0](https://github.com/zhblue/hustoj/blob/master/trunk/web/gpl-2.0.txt) License.<br>

> [Personal Website](https://baoshuo.ren) · [Blog](https://blog.baoshuo.ren) · GitHub [@renbaoshuo](https://github.com/renbaoshuo) · Twitter [@renbaoshuo](https://twitter.com/renbaoshuo)
Empty file.
124 changes: 124 additions & 0 deletions trunk/web/template/mdui/_includes/head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Ren Baoshuo">
<meta name="generator" content="HUSTOJ">
<link rel="icon" href="/favicon.ico">

<!-- Title -->
<title><?php echo ($page_title?$page_title.' - ':'').$OJ_NAME; ?></title>

<!-- MDUI -->
<?php if($MDUI_OFFLINE) { ?>
<link rel="stylesheet" href="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/css/mdui.min.css">
<script src="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/js/mdui.min.js"></script>
<?php } else { ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.1/dist/css/mdui.min.css">
<script src="https://cdn.jsdelivr.net/npm/mdui@1.0.1/dist/js/mdui.min.js"></script>
<?php } ?>
<script>
var $ = mdui.$;
</script>
<style>
@media (min-width: 840px) {
.mdui-container {
padding-top: 80px;
}
}

@media (min-width: 480px) {
.mdui-container {
padding-top: 60px;
}
}

.mdui-container {
padding-top: 40px;
padding-bottom: 60px;
position: relative;
}

.mdui-select-menu {
min-height: 300px !important;
}
</style>

<!-- Fonts -->
<?php if(isset($MDUI_OFFLINE) && $MDUI_OFFLINE) { ?>
<link rel="stylesheet" href="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/css/fonts.css">
<?php } else { ?>
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital@0;1&family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap"
as="style" onload="this.onload=null, this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital@0;1&family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap"></noscript>
<?php } ?>

<!-- Styles -->
<style>
code {
font-family: 'Roboto Mono', 'Consolas', monospace !important;
}
body {
font-family: 'Open Sans', 'Roboto', 'Noto', 'Helvetica', 'Arial', sans-serif !important;
}
</style>

<!-- Scripts -->
<script>
console.log('\n %c HUSTOJ %c https://github.com/zhblue/hustoj %c\n', 'color: #fadfa3; background: #000000; padding:5px 0;', 'background: #fadfa3; padding:5px 0;', '');
console.log('\n %c Theme Author %c Baoshuo (@renbaoshuo) %c https://baoshuo.ren %c\n', 'color: #fadfa3; background: #000000; padding:5px 0;', 'background: #fadfa3; padding:5px 0;', 'background: #ffbf33; padding:5px 0;', '');
console.log('\n %c MDUI v1.0.1 %c https://mdui.org %c\n', 'color: #ffffff; background: #030307; padding:5px 0;', 'background: #673ab7; padding:5px 0;', '');
console.log('\n GitHub Homepage: https://github.com/zhblue/hustoj \n Document: https://zhblue.github.io/hustoj \n Bug report URL: https://github.com/zhblue/hustoj/issues \n \n%c ★ Please give us a star on GitHub! ★ %c \n', 'color: red;', '')
</script>

<?php
if(stripos($_SERVER['REQUEST_URI'],"template")!==false) exit();

$url = basename($_SERVER['REQUEST_URI']);
$dir = basename(getcwd());

if($dir == "discuss3") $path_fix="../";
else $path_fix="";

if(isset($OJ_NEED_LOGIN) && $OJ_NEED_LOGIN
&& ($url!='loginpage.php' && $url!='lostpassword.php'
&& $url!='lostpassword2.php' && $url!='registerpage.php')
&& !isset($_SESSION[$OJ_NAME.'_'.'user_id'])) {
header("location:".$path_fix."loginpage.php");
exit();
}

$_SESSION[$OJ_NAME.'_'.'profile_csrf'] = rand();

if($OJ_ONLINE){
require_once($path_fix.'include/online.php');
$on = new online();
}
?>

<!-- KaTeX -->
<script> var katex_options = { delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true} ] }; </script>
<?php if(isset($MDUI_OFFLINE) && $MDUI_OFFLINE) { ?>
<link rel="stylesheet" href="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/css/katex.min.css"
as="style" onload="this.onload=null, this.rel='stylesheet'">
<script defer src="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/js/katex.min.js"></script>
<script defer src="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/js/auto-render.min.js"
onload="renderMathInElement(document.body, katex_options);"></script>
<?php } else { ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"
as="style" onload="this.onload=null, this.rel='stylesheet'">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"
onload="renderMathInElement(document.body, katex_options);"></script>
<?php } ?>

<!-- Highlight.js -->
<?php if(isset($MDUI_OFFLINE) && $MDUI_OFFLINE) { ?>
<link rel="stylesheet" href="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/css/atom-one-light.min.css">
<script src="<?php echo $OJ_CDN_URL.$path_fix."template/$OJ_TEMPLATE"; ?>/assets/js/highlight.pack.js"
onload="hljs.initHighlightingOnLoad();"></script>
<?php } else { ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@10.5.0/styles/atom-one-light.min.css">
<script src="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@10.5.0/highlight.min.js"
onload="hljs.initHighlightingOnLoad();"></script>
<!-- Pascal --><script src="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@10.5.0/languages/delphi.min.js"></script>
<?php } ?>
42 changes: 42 additions & 0 deletions trunk/web/template/mdui/_includes/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<header class="mdui-appbar mdui-appbar-fixed" style="z-index: 999;">
<div class="mdui-toolbar mdui-color-theme">
<a href="javascript:;" class="mdui-btn mdui-btn-icon" mdui-tooltip="{content: '菜单'}" mdui-drawer="{target: '#main-drawer', swipe: true}">
<i class="mdui-icon material-icons">menu</i>
</a>
<a class="mdui-typo-title" href="<?php echo $OJ_HOME; ?>"><?php echo $OJ_NAME ?></a>
<div class="mdui-toolbar-spacer"></div>
<div class="mdui-btn" mdui-tooltip="{content: '账户'}" mdui-menu="{target: '#account-menu', position: 'bottom', fixed: true}">
<i class="mdui-icon material-icons">account_circle</i>
<?php if(isset($_SESSION[$OJ_NAME.'_'.'user_id'])) { ?>
<?php echo $_SESSION[$OJ_NAME.'_'.'user_id']; ?>
<?php } else { ?>
请登录
<?php } ?>
</div>
<ul class="mdui-menu mdui-menu-cascade" id="account-menu">
<?php
if(isset($_SESSION[$OJ_NAME.'_'.'user_id'])){
$sid = $_SESSION[$OJ_NAME.'_'.'user_id']; ?>
<li class="mdui-menu-item">
<a href="<?php echo $path_fix; ?>userinfo.php?user=<?php echo $sid; ?>"
class="mdui-ripple">我的信息</a>
</li>
<li class="mdui-menu-item">
<a href="<?php echo $path_fix; ?>modifypage.php" class="mdui-ripple">修改信息</a>
</li>
<li class="mdui-menu-item">
<a href="<?php echo $path_fix; ?>logout.php" class="mdui-ripple">退出登录</a>
</li>
<?php } else { ?>
<li class="mdui-menu-item">
<a href="<?php echo $path_fix; ?>loginpage.php" class="mdui-ripple">登录</a>
</li>
<?php if(isset($OJ_REGISTER) && $OJ_REGISTER){ ?>
<li class="mdui-menu-item">
<a href="<?php echo $path_fix; ?>registerpage.php" class="mdui-ripple">注册</a>
</li>
<?php } ?>
<?php } ?>
</ul>
</div>
</header>
78 changes: 78 additions & 0 deletions trunk/web/template/mdui/_includes/sidebar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<div class="mdui-drawer" id="main-drawer">
<div class="mdui-list mdui-m-t-1 mdui-color-white">
<!-- Menu -->
<a class="mdui-list-item mdui-ripple <?php if (!$url || strpos($url, "index.php") !== false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>index.php">
<i class="mdui-list-item-icon mdui-icon material-icons">home</i>
<div class="mdui-list-item-content">首页</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "problemset.php") !== false || strpos($url, "problem.php") !== false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>problemset.php">
<i class="mdui-list-item-icon mdui-icon material-icons">book</i>
<div class="mdui-list-item-content">题目</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "category.php") !== false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>category.php">
<i class="mdui-list-item-icon mdui-icon material-icons">apps</i>
<div class="mdui-list-item-content">分类</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "status.php") !== false && strpos($url, "status.php?user_id=$sid") === false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>status.php">
<i class="mdui-list-item-icon mdui-icon material-icons">play_circle_outline</i>
<div class="mdui-list-item-content">状态</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "contest.php") !== false && $url !== "contest.php?my") echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>contest.php">
<i class="mdui-list-item-icon mdui-icon material-icons">layers</i>
<div class="mdui-list-item-content">竞赛/作业</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "ranklist.php") !== false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>ranklist.php">
<i class="mdui-list-item-icon mdui-icon material-icons">equalizer</i>
<div class="mdui-list-item-content">排名</div>
</a>
<div class="mdui-divider"></div>

<!-- User -->
<?php
if(isset($_SESSION[$OJ_NAME.'_'.'user_id'])){
$sid = $_SESSION[$OJ_NAME.'_'.'user_id']; ?>
<a class="mdui-list-item mdui-ripple <?php if (strpos($url, "status.php?user_id=$sid") !== false) echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>status.php?user_id=<?php echo $sid; ?>">
<i class="mdui-list-item-icon mdui-icon material-icons">play_circle_outline</i>
<div class="mdui-list-item-content">我的提交</div>
</a>
<a class="mdui-list-item mdui-ripple <?php if ($url === "contest.php?my") echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>contest.php?my">
<i class="mdui-list-item-icon mdui-icon material-icons">apps</i>
<div class="mdui-list-item-content">我参加的竞赛/作业</div>
</a>
<?php if(isset($_SESSION[$OJ_NAME.'_'.'administrator'])
|| isset($_SESSION[$OJ_NAME.'_'.'contest_creator'])
|| isset($_SESSION[$OJ_NAME.'_'.'problem_editor'])
|| isset($_SESSION[$OJ_NAME.'_'.'password_setter'])) { ?>
<div class="mdui-divider"></div>

<!-- Admin -->
<a class="mdui-list-item mdui-ripple" href="<?php echo $path_fix; ?>admin/">
<i class="mdui-list-item-icon mdui-icon material-icons">settings</i>
<div class="mdui-list-item-content">后台管理</div>
</a>
<?php } ?>
<?php } else { ?>
<a class="mdui-list-item mdui-ripple <?php if ($url == "loginpage.php") echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>loginpage.php">
<i class="mdui-list-item-icon mdui-icon material-icons">assignment_ind</i>
<div class="mdui-list-item-content">登录</div>
</a>
<?php if(isset($OJ_REGISTER) && $OJ_REGISTER){ ?>
<a class="mdui-list-item mdui-ripple <?php if ($url == "registerpage.php") echo "mdui-list-item-active"; ?>"
href="<?php echo $path_fix; ?>registerpage.php">
<i class="mdui-list-item-icon mdui-icon material-icons">person_add</i>
<div class="mdui-list-item-content">注册</div>
</a>
<?php } ?>
<?php } ?>

</div>
</div>
17 changes: 17 additions & 0 deletions trunk/web/template/mdui/assets/ace/ace.js

Large diffs are not rendered by default.

Loading