summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/shows.js88
1 files changed, 40 insertions, 48 deletions
diff --git a/www/js/shows.js b/www/js/shows.js
index b2d9d98..077cf42 100644
--- a/www/js/shows.js
+++ b/www/js/shows.js
@@ -56,17 +56,16 @@ function shows_importUpdateProgress(file, stats) {
function shows_importCartConfirm(cart, dz) {
$('#shows-upload').modal('hide');
var cart_row = $('#show-cart-' + cart)
- cart_row.next().remove();
cart_row.find('.btn').attr('disabled','disabled');
- var dz_stat = shows_getDzStat(false);
- dz_stat.find('button').unbind('click').click(function() { shows_importCartCancel(cart, dz); });
- cart_row.after(dz_stat);
+ var importing_row = shows_newImportingEntry(cart);
+ importing_row.find('button').unbind('click').click(function() { shows_importCartCancel(cart, dz); });
+ cart_row.replaceWith(importing_row);
dz.off("error");
files = dz.getAcceptedFiles();
- dz_stat.find('.file-name').text(files[0].name);
- shows_importUpdateProgress(files[0], dz_stat);
- dz.on("uploadprogress", function(file) { shows_importUpdateProgress(file, dz_stat); });
+ importing_row.find('.file-name').text(files[0].name);
+ shows_importUpdateProgress(files[0], importing_row);
+ dz.on("uploadprogress", function(file) { shows_importUpdateProgress(file, importing_row); });
dz.on("success", function(file) { shows_importFileUploadSuccess(cart, dz, file); });
dz.on("error", function(file, msg, xhr) { shows_importFileUploadError(cart, this, file, msg, xhr); });
shows_importAddCart(cart, dz, files[0]);
@@ -125,37 +124,6 @@ function shows_importCart(cart) {
// <button class="btn btn-success btn-mini"><i class="icon-upload icon-white"></i> Importieren</button>
// </td>
-function shows_getDzStat(empty) {
- if(empty) {
- return $('<tr>').append($('<td colspan=6>').css("border", 0)
- .css("height", 0)
- .css("margin", 0)
- .css("padding", 0));
- } else {
- var progress_bar = '<div class="progress"><div class="bar" style="width: 0%;"></div></div>';
- var cancel_button = '<button class="btn btn-danger btn-mini">' +
- '<i class="icon-remove icon-white"></i> Abbrechen</button>';
-
- return $('<tr>').append($('<td>').addClass('file-name').text('-'))
- .append($('<td>').addClass('file-bytes').text('??.? von ??.? MB'))
- .append($('<td colspan=3>').append(progress_bar))
- .append($('<td>').append(cancel_button));
- }
-}
-
-function shows_updateGroupCartInfo(cart) {
- data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart, INCLUDE_CUTS: 1 };
- var defer = $.post("/rd-bin/rdxport.cgi", data, shows_updateGroupCartList, "xml")
- .fail(function() { delete shows_group_carts[cart]; shows_redrawCartEntry(cart); });
-
- $.when(defer).done(function() { shows_redrawCartEntry(cart); });
-}
-
-function shows_redrawCartEntry(cart) {
- $('#show-cart-' + cart).replaceWith(shows_newCartEntry(cart));
- $('#show-cart-' + cart).next().replaceWith(shows_getDzStat(true));
-}
-
function shows_newCartEntry(elem) {
var cart_exists = shows_group_carts[elem] ? 1 : 0;
var cart = {};
@@ -171,21 +139,45 @@ function shows_newCartEntry(elem) {
'<button class="btn btn-success btn-mini" onclick="shows_importCart(' + elem + ');">' +
'<i class="icon-upload icon-white"></i> Importieren</button>';
- return $('<tr>').append($('<td rowspan=2>').text(elem))
- .append($('<td>').text(cart.title))
- .append($('<td>').text(msToTimeString(cart.length)))
- .append($('<td>').text(cart.imported))
- .append($('<td>').text(cart.playcnt))
- .append($('<td>').text(cart.lastplayed))
- .append($('<td>').append(buttons)).attr("id", "show-cart-" + elem);
+ return $('<tr>').append($('<td>').text(elem))
+ .append($('<td>').text(cart.title))
+ .append($('<td>').text(msToTimeString(cart.length)))
+ .append($('<td>').text(cart.imported))
+ .append($('<td>').text(cart.playcnt))
+ .append($('<td>').text(cart.lastplayed))
+ .append($('<td>').append(buttons)).attr("id", "show-cart-" + elem);
+}
+
+function shows_newImportingEntry(cart) {
+ var progress_bar = '<div class="progress"><div class="bar" style="width: 0%;"></div></div>';
+ var cancel_button = '<button class="btn btn-danger btn-mini">' +
+ '<i class="icon-remove icon-white"></i> Abbrechen</button>';
+
+ return $('<tr>').append($('<td>').text(cart))
+ .append($('<td>').addClass('file-name').text('-'))
+ .append($('<td>').addClass('file-bytes').text('??.? von ??.? MB'))
+ .append($('<td colspan=3>').append(progress_bar))
+ .append($('<td>').append(cancel_button))
+ .attr("id", "show-cart-" + cart);
+}
+
+function shows_updateGroupCartInfo(cart) {
+ data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart, INCLUDE_CUTS: 1 };
+ var defer = $.post("/rd-bin/rdxport.cgi", data, shows_updateGroupCartList, "xml")
+ .fail(function() { delete shows_group_carts[cart]; shows_redrawCartEntry(cart); });
+
+ $.when(defer).done(function() { shows_redrawCartEntry(cart); });
+}
+
+function shows_redrawCartEntry(cart) {
+ $('#show-cart-' + cart).replaceWith(shows_newCartEntry(cart));
}
function shows_udpateCartListing() {
$('#show-carts tbody').find('tr').remove();
shows_log_carts.forEach(function(elem) {
- $('#show-carts > tbody:last').append(shows_newCartEntry(elem))
- .append(shows_getDzStat(true));
- });
+ $('#show-carts > tbody:last').append(shows_newCartEntry(elem));
+ });
}
function shows_updateGroupCartList(data, status, req) {