1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Load tag map only when required using Ajax

This commit is contained in:
Afterster 2014-04-05 10:59:30 +02:00
parent 4e9faa31d3
commit 8f24e505f9
9 changed files with 21 additions and 29 deletions

View file

@ -142,11 +142,7 @@ function handleBroadcastAction(url, id) {
/* Edit modal dialog for artists, albums and songs */
/***************************************************/
var tag_choices;
function setTagsChoices(choices) {
tag_choices = choices;
}
var tag_choices = undefined;
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_row_prefix, refresh_action) {
var parent = this;
@ -160,12 +156,20 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
// Convert choices string ("tag0,tag1,tag2,...") to choices array
parent.editTagChoices = new Array();
if (tag_choices != null && tag_choices != '') {
var splitted = tag_choices.split(',');
var i;
for (i = 0; i < splitted.length; ++i) {
parent.editTagChoices.push($.trim(splitted[i]));
}
if (tag_choices == undefined && tag_choices != '') {
// Load tag map
$.ajax(jsAjaxServer + '/ajax.server.php?page=tag&action=get_tag_map', { success: function(data) {
tag_choices = $(data).find('content').text();
if (tag_choices != '') {
showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_row_prefix, refresh_action);
}
}, type: 'post', dataType: 'xml' });
return;
}
var splitted = tag_choices.split(',');
var i;
for (i = 0; i < splitted.length; ++i) {
parent.editTagChoices.push($.trim(splitted[i]));
}
parent.dialog_buttons = {};