mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
custom fields add priority + display
This commit is contained in:
+1
-1
@@ -278,7 +278,7 @@ JS;
|
||||
do_action('torrent_detail_before_desc', $row['id'], $CURUSER['id']);
|
||||
|
||||
/**************start custom fields****************/
|
||||
echo $customField->renderOnTorrentDetailsPage($id);
|
||||
echo $customField->renderOnTorrentDetailsPage($id, $row['search_box_id']);
|
||||
|
||||
/**************end custom fields****************/
|
||||
|
||||
|
||||
+28
-4
@@ -67,8 +67,6 @@ else {
|
||||
echo $ptGen->renderUploadPageFormInput($row['pt_gen']);
|
||||
}
|
||||
|
||||
$customField->renderOnUploadPage($id);
|
||||
|
||||
if ($enablenfo_main=='yes')
|
||||
tr($lang_edit['row_nfo_file'], "<font class=\"medium\"><input type=\"radio\" name=\"nfoaction\" value=\"keep\" checked=\"checked\" />".$lang_edit['radio_keep_current'].
|
||||
"<input type=\"radio\" name=\"nfoaction\" value=\"remove\" />".$lang_edit['radio_remove'].
|
||||
@@ -81,7 +79,7 @@ else {
|
||||
tr($lang_functions['text_technical_info'], '<textarea name="technical_info" rows="8" style="width: 99%;">' . $row['technical_info'] . '</textarea><br/>' . $lang_functions['text_technical_info_help_text'], 1);
|
||||
}
|
||||
|
||||
$s = "<select name=\"type\" id=\"oricat\">";
|
||||
$s = "<select name=\"type\" id=\"oricat\" data-mode='$sectionmode'>";
|
||||
|
||||
$cats = genrelist($sectionmode);
|
||||
foreach ($cats as $subrow) {
|
||||
@@ -93,7 +91,7 @@ else {
|
||||
|
||||
$s .= "</select>\n";
|
||||
if ($allowmove){
|
||||
$s2 = "<select name=\"type\" id=newcat disabled>\n";
|
||||
$s2 = "<select name=\"type\" id=newcat disabled data-mode='$othermode'>\n";
|
||||
$cats2 = genrelist($othermode);
|
||||
foreach ($cats2 as $subrow) {
|
||||
$s2 .= "<option value=\"" . $subrow["id"] . "\"";
|
||||
@@ -147,6 +145,12 @@ else {
|
||||
|
||||
tr($lang_edit['row_content'],$team_select,1);
|
||||
}
|
||||
|
||||
echo $customField->renderOnUploadPage($id, $browsecatmode);
|
||||
if ($enablespecial) {
|
||||
$customField->renderOnUploadPage($id, $specialcatmode);
|
||||
}
|
||||
|
||||
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1);
|
||||
|
||||
$rowChecks = [];
|
||||
@@ -282,6 +286,26 @@ EOT;
|
||||
}
|
||||
\Nexus\Nexus::js('vendor/jquery-loading/jquery.loading.min.js', 'footer', true);
|
||||
\Nexus\Nexus::js('js/ptgen.js', 'footer', true);
|
||||
$customFieldJs = <<<JS
|
||||
jQuery("#movecheck").on("change", function () {
|
||||
let _this = jQuery(this);
|
||||
let checked = _this.prop("checked");
|
||||
let activeSelect
|
||||
if (checked) {
|
||||
activeSelect = jQuery("#newcat");
|
||||
} else {
|
||||
activeSelect = jQuery("#oricat");
|
||||
}
|
||||
let mode = activeSelect.attr("data-mode");
|
||||
console.log(mode)
|
||||
jQuery("tr[relation]").hide();
|
||||
jQuery("tr[relation=mode_" + mode +"]").show();
|
||||
})
|
||||
jQuery("tr[relation]").hide();
|
||||
jQuery("tr[relation=mode_{$sectionmode}]").show();
|
||||
|
||||
JS;
|
||||
\Nexus\Nexus::js($customFieldJs, 'footer', false);
|
||||
stdfoot();
|
||||
function getAddedTimeOption($timeStamp, $addSeconds) {
|
||||
$timeStamp += $addSeconds;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
require "../include/bittorrent.php";
|
||||
dbconn();
|
||||
require_once(get_langfile_path());
|
||||
require_once(get_langfile_path('catmanage.php'));
|
||||
loggedinorreturn();
|
||||
if (get_user_class() < UC_ADMINISTRATOR) {
|
||||
permissiondenied();
|
||||
|
||||
+3
-14
@@ -224,20 +224,9 @@ $dateTimeStringNow = date("Y-m-d H:i:s");
|
||||
* add custom fields
|
||||
* @since v1.6
|
||||
*/
|
||||
if (!empty($_POST['custom_fields'])) {
|
||||
\Nexus\Database\NexusDB::delete('torrents_custom_field_values', "torrent_id = $id");
|
||||
foreach ($_POST['custom_fields'] as $customField => $customValue) {
|
||||
foreach ((array)$customValue as $value) {
|
||||
$customData = [
|
||||
'torrent_id' => $id,
|
||||
'custom_field_id' => $customField,
|
||||
'custom_field_value' => $value,
|
||||
'created_at' => $dateTimeStringNow,
|
||||
'updated_at' => $dateTimeStringNow,
|
||||
];
|
||||
\Nexus\Database\NexusDB::insert('torrents_custom_field_values', $customData);
|
||||
}
|
||||
}
|
||||
if (!empty($_POST['custom_fields'][$newcatmode])) {
|
||||
$customField = new \Nexus\Field\Field();
|
||||
$customField->saveFieldValues($newcatmode, $id, $_POST['custom_fields'][$newcatmode]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-14
@@ -390,20 +390,9 @@ if ($saveResult === false) {
|
||||
* add custom fields
|
||||
* @since v1.6
|
||||
*/
|
||||
if (!empty($_POST['custom_fields'])) {
|
||||
$now = date('Y-m-d H:i:s');
|
||||
foreach ($_POST['custom_fields'] as $customField => $customValue) {
|
||||
foreach ((array)$customValue as $value) {
|
||||
$customData = [
|
||||
'torrent_id' => $id,
|
||||
'custom_field_id' => $customField,
|
||||
'custom_field_value' => $value,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
\Nexus\Database\NexusDB::insert('torrents_custom_field_values', $customData);
|
||||
}
|
||||
}
|
||||
if (!empty($_POST['custom_fields'][$catmod])) {
|
||||
$customField = new \Nexus\Field\Field();
|
||||
$customField->saveFieldValues($catmod, $id, $_POST['custom_fields'][$catmod]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+21
-4
@@ -70,8 +70,6 @@ stdhead($lang_upload['head_upload']);
|
||||
$ptGen = new \Nexus\PTGen\PTGen();
|
||||
echo $ptGen->renderUploadPageFormInput("");
|
||||
}
|
||||
$field = new \Nexus\Field\Field();
|
||||
$field->renderOnUploadPage();
|
||||
if ($enablenfo_main=='yes') {
|
||||
tr($lang_upload['row_nfo_file'], "<input type=\"file\" class=\"file\" name=\"nfo\" /><br /><font class=\"medium\">".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."</font>", 1);
|
||||
}
|
||||
@@ -85,7 +83,7 @@ stdhead($lang_upload['head_upload']);
|
||||
|
||||
if ($allowtorrents){
|
||||
$disablespecial = " onchange=\"disableother('browsecat','specialcat')\"";
|
||||
$s = "<select name=\"type\" id=\"browsecat\" ".($allowtwosec ? $disablespecial : "").">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
|
||||
$s = "<select name=\"type\" id=\"browsecat\" data-mode='$browsecatmode' ".($allowtwosec ? $disablespecial : "").">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
|
||||
$cats = genrelist($browsecatmode);
|
||||
foreach ($cats as $row)
|
||||
$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
|
||||
@@ -94,7 +92,7 @@ stdhead($lang_upload['head_upload']);
|
||||
else $s = "";
|
||||
if ($allowspecial){
|
||||
$disablebrowse = " onchange=\"disableother('specialcat','browsecat')\"";
|
||||
$s2 = "<select name=\"type\" id=\"specialcat\" ".$disablebrowse.">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
|
||||
$s2 = "<select name=\"type\" id=\"specialcat\" data-mode='$specialcatmode' ".$disablebrowse.">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
|
||||
$cats2 = genrelist($specialcatmode);
|
||||
foreach ($cats2 as $row)
|
||||
$s2 .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
|
||||
@@ -145,6 +143,11 @@ stdhead($lang_upload['head_upload']);
|
||||
|
||||
tr($lang_upload['row_content'],$team_select,1);
|
||||
}
|
||||
$customField = new \Nexus\Field\Field();
|
||||
echo $customField->renderOnUploadPage(0, $browsecatmode);
|
||||
if ($enablespecial) {
|
||||
echo $customField->renderOnUploadPage(0, $specialcatmode);
|
||||
}
|
||||
|
||||
//==== offer dropdown for offer mod from code by S4NE
|
||||
$offerres = sql_query("SELECT id, name FROM offers WHERE userid = ".sqlesc($CURUSER['id'])." AND allowed = 'allowed' ORDER BY name ASC") or sqlerr(__FILE__, __LINE__);
|
||||
@@ -222,4 +225,18 @@ JS;
|
||||
<?php
|
||||
\Nexus\Nexus::js('vendor/jquery-loading/jquery.loading.min.js', 'footer', true);
|
||||
\Nexus\Nexus::js('js/ptgen.js', 'footer', true);
|
||||
$customFieldJs = <<<JS
|
||||
jQuery("#compose").on("change", "select[name=type]", function () {
|
||||
let _this = jQuery(this);
|
||||
let mode = _this.attr("data-mode");
|
||||
let value = _this.val();
|
||||
console.log(mode)
|
||||
jQuery("tr[relation]").hide();
|
||||
if (value > 0) {
|
||||
jQuery("tr[relation=mode_" + mode +"]").show();
|
||||
}
|
||||
})
|
||||
jQuery("tr[relation]").hide();
|
||||
JS;
|
||||
\Nexus\Nexus::js($customFieldJs, 'footer', false);
|
||||
stdfoot();
|
||||
|
||||
Reference in New Issue
Block a user