fix: use constrained foreign key for files track_type
This commit is contained in:
parent
bcaea16c19
commit
db976881f0
26 changed files with 1233 additions and 113 deletions
|
@ -55,7 +55,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
"info_url": "s",
|
||||
"replay_gain": "n",
|
||||
"artwork": "s",
|
||||
"track_type": "tt"
|
||||
"track_type_id": "tt"
|
||||
};
|
||||
|
||||
if (AIRTIME.library === undefined) {
|
||||
|
@ -591,7 +591,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
/* Cue Out */ { "sTitle": $.i18n._("Cue Out"), "mDataProp": "cueout", "bVisible": false, "sClass": "library_length", "sWidth": "80px" },
|
||||
/* Description */ { "sTitle": $.i18n._("Description"), "mDataProp": "description", "bVisible": false, "sClass": "library_description", "sWidth": "150px" },
|
||||
/* Encoded */ { "sTitle": $.i18n._("Encoded By"), "mDataProp": "encoded_by", "bVisible": false, "sClass": "library_encoded", "sWidth": "150px" },
|
||||
/* Track Type */ { "sTitle": $.i18n._("Type"), "mDataProp": "track_type", "sClass": "library_track_type", "sWidth": "60px" },
|
||||
/* Track Type */ { "sTitle": $.i18n._("Type"), "mDataProp": "track_type_id", "sClass": "library_track_type", "sWidth": "60px" },
|
||||
/* Genre */ { "sTitle": $.i18n._("Genre"), "mDataProp": "genre", "sClass": "library_genre", "sWidth": "100px" },
|
||||
/* ISRC Number */ { "sTitle": $.i18n._("ISRC"), "mDataProp": "isrc_number", "bVisible": false, "sClass": "library_isrc", "sWidth": "150px" },
|
||||
/* Label */ { "sTitle": $.i18n._("Label"), "mDataProp": "label", "bVisible": false, "sClass": "library_label", "sWidth": "125px" },
|
||||
|
@ -766,12 +766,12 @@ var AIRTIME = (function (AIRTIME) {
|
|||
$(this).contextMenu({ x: $(e.target).offset().left, y: $(e.target).offset().top })
|
||||
}).html("<div class='library_actions_btn'>...</div>");
|
||||
|
||||
if (aData.track_type == null || aData.track_type == undefined || aData.track_type == 0) {
|
||||
if (aData.track_type_id == null || aData.track_type_id == undefined || aData.track_type_id == 0) {
|
||||
var has_type = false;
|
||||
var type_button = "";
|
||||
} else {
|
||||
var has_type = true;
|
||||
var type_button = "<div class='library_track_type_btn'>" + aData.track_type + "</div>";
|
||||
var type_button = "<div class='library_track_type_btn'>" + TRACKTYPES[aData.track_type_id].code + "</div>";
|
||||
}
|
||||
|
||||
$(nRow).find('td.library_track_type')
|
||||
|
@ -782,8 +782,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
function (json) {
|
||||
var type_enabled = false;
|
||||
$.each(json, function (key, value) {
|
||||
|
||||
if (value['code'] == aData.track_type) {
|
||||
if (value['id'] == aData.track_type_id) {
|
||||
$("#au_" + aData.id + " td.library_track_type div.library_track_type_btn").qtip({
|
||||
overwrite: false,
|
||||
content: {
|
||||
|
@ -1645,7 +1644,7 @@ var validationTypes = {
|
|||
"track_number": "i",
|
||||
"info_url": "s",
|
||||
"artwork": "s",
|
||||
"track_type": "s",
|
||||
"track_type_id": "s",
|
||||
"year": "i"
|
||||
};
|
||||
|
||||
|
@ -1657,10 +1656,10 @@ function tracktypesJson() {
|
|||
jQuery.getJSON(
|
||||
baseUrl + "api/track-types",
|
||||
function (json) {
|
||||
var ttSelect = $('#track_type .filter_select .select_filter');
|
||||
var ttSelect = $('#track_type_id .filter_select .select_filter');
|
||||
$.each(json, function (key, value) {
|
||||
var option = $("<option/>", {
|
||||
value: value['code'],
|
||||
value: value['id'],
|
||||
text: value['type_name']
|
||||
});
|
||||
ttSelect.append(option);
|
||||
|
|
|
@ -340,7 +340,7 @@ function setSmartBlockEvents() {
|
|||
disableAndHideDateTimeDropdown($(this), index);
|
||||
disableAndHideExtraDateTimeDropdown($(this), index);
|
||||
|
||||
if ($("#sp_criteria_field_" + index + " option:selected").val() === 'track_type') {
|
||||
if ($("#sp_criteria_field_" + index + " option:selected").val() === 'track_type_id') {
|
||||
populateTracktypeSelect(this, false);
|
||||
} else {
|
||||
disableAndHideTracktypeDropdown($(this), index);
|
||||
|
@ -380,7 +380,7 @@ function setSmartBlockEvents() {
|
|||
|
||||
var get_crit_field = $(this).siblings(':first-child');
|
||||
var crit_field = get_crit_field[0]["id"];
|
||||
if ($("#" + crit_field + " option:selected").val() === 'track_type') {
|
||||
if ($("#" + crit_field + " option:selected").val() === 'track_type_id') {
|
||||
if ($(this).val() == "is" || $(this).val() == "is not") {
|
||||
enableAndShowTracktypeDropdown(criteria_value, index_num);
|
||||
} else {
|
||||
|
@ -941,7 +941,7 @@ var criteriaTypes = {
|
|||
"track_number": "n",
|
||||
"info_url": "s",
|
||||
"year": "n",
|
||||
"track_type": "tt"
|
||||
"track_type_id": "tt"
|
||||
};
|
||||
|
||||
var stringCriteriaOptions = {
|
||||
|
@ -981,5 +981,12 @@ var stringIsNotOptions = {
|
|||
"is not": $.i18n._("is not")
|
||||
};
|
||||
|
||||
let tracktypes = TRACKTYPES;
|
||||
var stringTracktypeOptions = Object.assign({ "": "Select Track Type" }, tracktypes);
|
||||
let tracktypes = {}
|
||||
|
||||
for (var key in TRACKTYPES) {
|
||||
if (TRACKTYPES.hasOwnProperty(key)) {
|
||||
tracktypes[key] = TRACKTYPES[key].name;;
|
||||
}
|
||||
}
|
||||
|
||||
var stringTracktypeOptions = Object.assign({ 0: "Select Track Type" }, tracktypes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue