Added paste management

This commit is contained in:
Leo Lu 2020-09-23 19:09:54 +08:00
parent 8cbb222d0b
commit 6db9f15977
2 changed files with 39 additions and 2 deletions

View File

@ -480,8 +480,8 @@ EOD;
<?php echoLongTable($judgerlist_cols, 'judger_info', "1=1", '', $judgerlist_header_row, $judgerlist_print_row, $judgerlist_config) ?> <?php echoLongTable($judgerlist_cols, 'judger_info', "1=1", '', $judgerlist_header_row, $judgerlist_print_row, $judgerlist_config) ?>
<?php elseif ($cur_tab === 'paste'): ?> <?php elseif ($cur_tab === 'paste'): ?>
<div> <div>
<h4>删除Paste</h4> <h4>Paste管理</h4>
<?php $paste_deleter->printHTML(); ?> <?php echoPastesList() ?>
</div> </div>
<?php endif ?> <?php endif ?>
</div> </div>

View File

@ -393,6 +393,43 @@ function echoSubmissionsList($cond, $tail, $config, $user) {
}, $table_config); }, $table_config);
} }
function echoPastesList() {
$header_row = '<tr>';
$col_names = ['`index`','creator','created_at'];
$header_row .= '<th>ID</th>';
$header_row .= '<th>'.UOJLocale::get("problems::submitter").'</th>';
$header_row .= '<th>'.UOJLocale::get('problems::submit time').'</th>';
$header_row .= '<th> 操作 </th>';
$header_row .= '</tr>';
$table_name = 'pastes';
echoLongTable($col_names, $table_name, "1", 'order by created_at desc', $header_row,
function($paste) {
$user = getUserLink($paste['creator']);
$token = HTML::hiddenToken();
echo <<<HTML
<tr>
<td>
<a href="/pastes/{$paste['index']}">{$paste['index']}</a>
</td>
<td>
{$user}
</td>
<td>
{$paste['created_at']}
</td>
<td>
<form action="/super-manage/paste" method="post" class="form-horizontal">
{$token}
<input type="text" class="form-control" name="paste_deleter_name" id="input-paste_deleter_name" value="{$paste['index']}" style="display: none;">
<button type="submit" name="submit-paste_deleter" value="paste_deleter" class="btn btn-sm btn-danger" style="margin: 0">删除</button>
</form>
</td>
</tr>
HTML;
}, []);
}
function echoPasteContent($paste) { function echoPasteContent($paste) {
$zip_file = new ZipArchive(); $zip_file = new ZipArchive();
$submission_content = json_decode($paste['content'], true); $submission_content = json_decode($paste['content'], true);