1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +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

@ -144,6 +144,8 @@ class AutoUpdate
return AmpConfig::get('autoupdate_lastversion_new'); return AmpConfig::get('autoupdate_lastversion_new');
} }
debug_event('autoupdate', 'Checking latest version online...', '5');
$available = false; $available = false;
$current = self::get_current_version(); $current = self::get_current_version();
$latest = self::get_latest_version(); $latest = self::get_latest_version();

View file

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

View file

@ -28,6 +28,10 @@ if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'show_add_tag': case 'show_add_tag':
break;
case 'get_tag_map':
$tags = Tag::get_display(Tag::get_tags());
$results['tags'] = $tags;
break; break;
case 'add_tag': case 'add_tag':
debug_event('tag.ajax', 'Adding new tag...', '5'); debug_event('tag.ajax', 'Adding new tag...', '5');

View file

@ -23,9 +23,6 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>

View file

@ -25,9 +25,6 @@ session_start();
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>

View file

@ -21,9 +21,6 @@
*/ */
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>

View file

@ -21,9 +21,6 @@
*/ */
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>

View file

@ -21,9 +21,6 @@
*/ */
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>

View file

@ -23,9 +23,6 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0"> <table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>