fix searchbox check

This commit is contained in:
xiaomlove
2022-11-26 13:24:30 +08:00
parent 536f0dcb6e
commit 65819d6c5d
6 changed files with 29 additions and 9 deletions

View File

@@ -79,6 +79,7 @@ class SectionResource extends Resource
Forms\Components\CheckboxList::make('custom_fields')
->options(TorrentCustomField::getCheckboxOptions())
->label(__('label.search_box.custom_fields'))
->columns(4)
,
Forms\Components\TextInput::make('custom_fields_display_name')
->label(__('label.search_box.custom_fields_display_name'))

View File

@@ -87,7 +87,7 @@ class SearchBox extends NexusModel
$other = $data['other'] ?? [];
$data["extra->" . self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST] = in_array(self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST, $other) ? 1 : 0;
$data["extra->" . self::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST] = in_array(self::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST, $other) ? 1 : 0;
$data['custom_fields'] = array_filter($data['custom_fields']);
return $data;
}

View File

@@ -8,6 +8,8 @@ class TorrentCustomField extends NexusModel
{
protected $table = 'torrents_custom_fields';
public $timestamps = true;
protected $fillable = [
'name', 'label', 'type', 'required', 'is_single_row', 'options', 'help', 'display', 'priority'
];
@@ -21,7 +23,5 @@ class TorrentCustomField extends NexusModel
}
return $result;
}
public $timestamps = true;
}

View File

@@ -6063,8 +6063,19 @@ function build_search_box_category_table($mode, $checkboxValue, $categoryHrefPre
foreach ($chunk as $item) {
if ($item->mode != -1) {
$checked = '';
if (str_contains($checkedValues, "[cat{$item->id}]") || str_contains($checkedValues, "cat{$item->id}=1")) {
$checked = " checked";
if ($checkedValues) {
if (
str_contains($checkedValues, "[cat{$item->id}]")
|| str_contains($checkedValues, "cat{$item->id}=1")
|| str_contains($checkedValues, "cat={$item->id}")
) {
$checked = " checked";
}
} elseif (!empty($options['user_notifs'])) {
$userNotifsKey = sprintf('[%s%s]', 'cat', $item->id);
if (str_contains($options['user_notifs'], $userNotifsKey)) {
$checked = ' checked';
}
}
$icon = $item->icon;
$iconFolder = trim($icon->folder, '/');
@@ -6126,8 +6137,14 @@ TD;
$afterInput = $item->name;
}
$checked = '';
if (str_contains($checkedValues, "[{$namePrefix}{$item->id}]") || str_contains($checkedValues, "{$namePrefix}{$item->id}=1")) {
$checked = ' checked';
if ($checkedValues) {
if (
str_contains($checkedValues, "[{$namePrefix}{$item->id}]")
|| str_contains($checkedValues, "{$namePrefix}{$item->id}=1")
|| str_contains($checkedValues, "{$namePrefix}={$item->id}")
) {
$checked = ' checked';
}
} elseif (!empty($options['user_notifs'])) {
$userNotifsKey = sprintf('[%s%s]', substr($torrentField, 0, 3), $item->id);
if (str_contains($options['user_notifs'], $userNotifsKey)) {

View File

@@ -110,9 +110,11 @@ if($_SERVER['REQUEST_METHOD'] === 'POST'){
begin_frame($lang_complains['text_new_body']);
printf('%s%s<br />%s %s', $lang_complains['text_added'], gettime($complain['added']), $lang_complains['text_new_email'], htmlspecialchars($complain['email']));
if($isAdmin) {
printf(' [<a href="usersearch.php?em=%s" class="faqlink" target="_blank">%s</a>]', urlencode($complain['email']), $lang_complains['text_search_account']);
if ($user) {
printf(' [<a href="userdetails.php?id=%s" class="faqlink" target="_blank">%s</a>]', $user->id, $user->username);
printf(' [<a href="user-ban-log.php?q=%s" class="faqlink" target="_blank">%s</a>]', urlencode($user->username), $lang_complains['text_view_band_log']);
} else {
printf(' [<a href="usersearch.php?em=%s" class="faqlink" target="_blank">%s</a>]', urlencode($complain['email']), $lang_complains['text_search_account']);
}
printf('<br />IP: ' . htmlspecialchars($complain['ip']));
}

2
public/js/common.js vendored
View File

@@ -308,7 +308,7 @@ function SetChecked(chkName,ctrlName,checkall_name,uncheckall_name,start,count)
}
for( i=begin ; i<end ; i++) {
if (dml.elements[i].name.indexOf(chkName) != -1) {
if (dml.elements[i].name.indexOf(chkName) == 0) {
dml.elements[i].checked=check_state;
}
}