mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 02:09:23 +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:
parent
f16e1267fe
commit
a53d308b6c
46 changed files with 9475 additions and 488 deletions
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue