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

Can now re-order playlist and album songs #53 (new grab icon displayed on sortable list)

Updating only the modified item (not refreshing page anymore) #43
Removed last 'Flag' items found #54
Reborn theme set as default #22
Fix: filters are now working
Fix: Artist edition
This commit is contained in:
SUTJael 2013-12-03 15:50:00 +01:00
parent f16e1267fe
commit a53d308b6c
46 changed files with 9475 additions and 488 deletions

View file

@ -26,7 +26,6 @@ $(document).ajaxComplete(function () {
// ajaxPost
// Post the contents of a form.
function ajaxPost(url, input, source) {
//$('#' + input)
if ($(source)) {
$(source).off('click', function(){ ajaxPost(url, input, source); });
}
@ -45,23 +44,20 @@ function ajaxPut(url, source) {
// ajaxState
// Post the contents of a form without doing any observe() things.
function ajaxState(url, input) {
new Ajax.Request(url, {
method: 'post',
parameters: $(input).serialize(true),
onSuccess: processContents
});
$.ajax({
url : url,
type : 'POST',
data : $('#' + input).serialize(true),
success : processContents
});
} // ajaxState
// processContents
// Iterate over a response and do any updates we received.
function processContents(data, status) {
function processContents(data) {
$(data).find('content').each(function () {
$('#' + $(this).attr('div')).html($(this).text())
/*var text = $.parseHTML($(this).text(), document, true);
var dom = $(text);
dom.filter('script').each(function(){
$.globalEval(this.text || this.textContent || this.innerHtml || '');
});*/
})
$('#' + $(this).attr('div')).html($(this).text());
});
} // processContents

View file

@ -19,17 +19,6 @@
//
$(document).ready(function () {
$('.default_hidden').hide();
$('#sortableplaylist').sortable({
axis: 'y',
delay: 200,
start: function (event, ui) {
$(ui.item).data("startindex", ui.item.index());
},
stop: function (event, ui) {
playlistUpdatedIndex(ui.item);
}
});
});
$(function() {

View file

@ -22,12 +22,15 @@
/* Edit modal dialog */
/*********************/
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, edit_tag_choices) {
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, edit_tag_choices, refresh_row_prefix, refresh_action) {
var parent = this;
parent.editFormId = 'form#' + edit_form_id;
parent.contentUrl = jsAjaxShowEditUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
parent.contentUrl = jsAjaxServer + '/show_edit.server.php?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
parent.saveUrl = jsAjaxUrl + '?action=edit_object&id=' + edit_id + '&type=' + edit_type;
parent.editDialogId = '<div id="editdialog"></div>';
parent.refreshRowPrefix = refresh_row_prefix;
parent.refreshAction = refresh_action;
parent.editId = edit_id;
// Convert choices string ("tag0,tag1,tag2,...") to choices array
parent.editTagChoices = new Array();
@ -46,9 +49,20 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, edit_tag_c
type : 'POST',
data : $(parent.editFormId).serializeArray(),
success : function(resp){
var new_id = $.trim(resp.lastChild.textContent);
$("#editdialog").dialog("close");
// Need to replace current div instead of refreshing frame.
window.location.reload();
// resp should contain the new identifier, otherwise we take the same as the edited item
if (new_id == '') {
new_id = parent.editId;
}
var url = jsAjaxServer + '/refresh_updated.server.php?action=' + parent.refreshAction + '&id=' + new_id;
// Reload only table
$('#' + parent.refreshRowPrefix + parent.editId).load(url, function() {
// Update the current row identifier with new id
$('#' + parent.refreshRowPrefix + parent.editId).attr("id", parent.refreshRowPrefix + new_id);
});
},
error : function(resp){
$("#editdialog").dialog("close");
@ -112,7 +126,10 @@ $(document).ready(function () {
});
});
function submitPlaylistOrder(playlistUrl, tableid) {
function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshAction) {
var parent = this;
parent.itemId = itemId;
parent.refreshAction = refreshAction;
var table = document.getElementById(tableid);
var rowLength = table.rows.length;
@ -121,16 +138,26 @@ function submitPlaylistOrder(playlistUrl, tableid) {
for (var i = 0; i < rowLength; ++i) {
var row = table.rows[i];
if (row.id != '') {
var songid = row.id.replace('track_', '');
var songid = row.id.replace(rowPrefix, '');
finalOrder += songid + ";"
}
}
if (finalOrder != '') {
$.ajax({
url : playlistUrl,
url : updateUrl,
type : 'GET',
data : 'order=' + finalOrder
data : 'order=' + finalOrder,
success : function(resp){
var url = jsAjaxServer + '/refresh_reordered.server.php?action=' + parent.refreshAction + '&id=' + parent.itemId;
// Reload only table
$('#reordered_list').load(url, function() {
$('#sortableplaylist').sortable({
axis: 'y',
delay: 200
});
});
}
});
}
}