ban/unban torrent send notification

This commit is contained in:
xiaomlove
2022-06-14 01:07:05 +08:00
parent 4e20c339d9
commit bcaaa020b1
18 changed files with 283 additions and 49 deletions

View File

@@ -147,9 +147,45 @@ else {
tr($lang_edit['row_content'],$team_select,1);
}
// tr($lang_functions['text_tags'], torrentTags($row['tags'], 'checkbox'), 1);
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1);
tr($lang_edit['row_check'], "<input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" /> ".$lang_edit['checkbox_visible']."&nbsp;&nbsp;&nbsp;".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."&nbsp;&nbsp;&nbsp;" : "").(get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" /> ".$lang_edit['checkbox_banned'] : ""), 1);
$rowChecks = [];
if (get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class) {
$rowChecks[] = "<label><input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."</label>";
}
if (get_user_class() >= $torrentmanage_class) {
array_unshift($rowChecks, "<label><input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_visible']."</label>");
$rowChecks[] = "<label><input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" />".$lang_edit['checkbox_banned']."</label>";
$banLog = \App\Models\TorrentOperationLog::query()->where('torrent_id', $row['id'])->where('action_type', \App\Models\TorrentOperationLog::ACTION_TYPE_BAN)->orderBy('id', 'desc')->first();
$banReasonDisplay = "none";
$banReasonReadonly = "";
if ($row['banned'] == 'yes') {
$banReasonDisplay = 'inline-block';
$banReasonReadonly = " readonly disabled";
}
$rowChecks[] = sprintf(
'<span id="ban-reason-box" style="display: %s">%s<input type="text" name="ban_reason" value="%s" style="width: 300px"%s/></span>',
$banReasonDisplay, $lang_edit['ban_reason_label'], $row['banned'] == 'yes' && $banLog ? $banLog->comment : '', $banReasonReadonly
);
$js = <<<JS
let banReasonBox = jQuery('#ban-reason-box')
jQuery('input[name=banned]').on("change", function () {
let _this = jQuery(this)
let checked = _this.prop('checked')
if (checked) {
banReasonBox.show()
} else {
banReasonBox.hide()
}
})
JS;
\Nexus\Nexus::js($js, 'footer', false);
}
if (!empty($rowChecks)) {
tr($lang_edit['row_check'], implode('&nbsp;&nbsp;', $rowChecks), 1);
}
if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){
$pickcontent = $pickcontentPrefix = "";