From cd15540f94bdb78556a5bd8e47df1f2919b97ac7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 21 Jun 2015 00:27:47 +0200 Subject: import errors are printed inside cart row now diff --git a/www/js/shows.js b/www/js/shows.js index 077cf42..a08ac94 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -30,8 +30,9 @@ function shows_importCartCancel(cart, dz) { } function shows_importFileUploadError(cart, dz, file, msg, xhr) { - alertbox.error('app-shows', "Import Fehler", $('
').append($('
').text(msg)).html());
-  shows_deleteCart(cart);
+  var error_row = shows_newImportErrorEntry(cart, msg);
+  error_row.find('button').unbind('click').click(function() { shows_deleteCart(cart); });
+  $('#show-cart-' + cart).replaceWith(error_row);
   dz.disable();
 }
 
@@ -145,7 +146,8 @@ function shows_newCartEntry(elem) {
                   .append($('').text(cart.imported))
                   .append($('').text(cart.playcnt))
                   .append($('').text(cart.lastplayed))
-                  .append($('').append(buttons)).attr("id", "show-cart-" + elem);
+                  .append($('').append(buttons))
+                  .attr("id", "show-cart-" + elem);
 }
 
 function shows_newImportingEntry(cart) {
@@ -161,6 +163,24 @@ function shows_newImportingEntry(cart) {
                   .attr("id", "show-cart-" + cart);
 }
 
+function shows_newImportErrorEntry(cart, msg) {
+  var dismiss_button = '';
+
+  var xmlDoc = $.parseXML(msg);
+  msg = $(xmlDoc);
+  var resp_code = msg.find('ResponseCode').text();
+  var err_string = msg.find('ErrorString').text();
+  var reason = $('').addClass('badge').addClass('badge-error').text(resp_code).after($('').html(' ' + err_string))
+
+  return $('').append($('').text(cart))
+                  .append($('').addClass('file-name').text('-'))
+                  .append($('').append($('').text('Import Fehler')))
+                  .append($('').append(reason))
+                  .append($('').append(dismiss_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")
-- 
cgit v0.10.2