summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-10-02 17:02:22 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-10-02 17:02:22 (GMT)
commitff872383e09d74ee5dca0bd85d8ecf285a9342e3 (patch)
tree91fc14a9682b1851f5a8c25860df7dbfa7b10e3a /js
parent8dacc4f6a60245ad2211aeb56d1dbde0e8b6575a (diff)
added status info tag for file uploads
Diffstat (limited to 'js')
-rw-r--r--js/shows.js63
1 files changed, 53 insertions, 10 deletions
diff --git a/js/shows.js b/js/shows.js
index 5f8eecc..38cf60d 100644
--- a/js/shows.js
+++ b/js/shows.js
@@ -10,9 +10,33 @@ function shows_deleteCart(cart) {
$.post("/rd-bin/rdxport.cgi", data, null, "xml").done(shows_showSelected);
}
+function shows_importCartCancel(cart) {
+ var cart_row = $('#show-cart-' + cart)
+ cart_row.next().remove();
+ cart_row.find('.btn').removeAttr('disabled');
+ cart_row.after(shows_getDzStat(true));
+
+ // TODO: cancel upload
+}
+
+function shows_importCartConfirm(cart) {
+ $('#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); });
+ cart_row.after(dz_stat);
+
+ // TODO: call dropzone.processQueue()
+}
+
function shows_importCart(cart) {
$('#shows-upload div.modal-body').text("Cart: " + cart);
+ $('#shows-upload-confirm').unbind('click').click(function() { shows_importCartConfirm(cart); });
$('#shows-upload').modal({ keyboard: true });
+
+ // TODO: add dropzone to 'div.modal-body'
}
// <td>
@@ -26,6 +50,25 @@ 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 progress-striped"><div class="bar" style="width: 60%;"></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('filename.flac'))
+ .append($('<td>').text('xx of XX Bytes'))
+ .append($('<td colspan=3>').append(progress_bar))
+ .append($('<td>').append(cancel_button));
+ }
+}
+
function shows_udpateCartListing() {
$('#show-carts tbody').find('tr').remove();
shows_log_carts.forEach(function(elem) {
@@ -44,14 +87,14 @@ function shows_udpateCartListing() {
'<i class="icon-upload icon-white"></i> Importieren</button>';
$('#show-carts > tbody:last').append(
- $('<tr>').append($('<td>').text(elem))
- .append($('<td>').text(cart.title))
- .append($('<td>').text(cart.length))
- .append($('<td>').text(cart.imported))
- .append($('<td>').text(cart.playcnt))
- .append($('<td>').text(cart.lastplayed))
- .append($('<td>').append(buttons))
- );
+ $('<tr>').append($('<td rowspan=2>').text(elem))
+ .append($('<td>').text(cart.title))
+ .append($('<td>').text(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)
+ ).append(shows_getDzStat(true));
});
}
@@ -155,7 +198,7 @@ function shows_updateList(data, status, req) {
shows_showSelected();
}
-function draw_current_week()
+function shows_drawCurrentWeek()
{
var weekspan = $('#current-week').removeClass().addClass('label');
switch(get_rd_week()) {
@@ -181,7 +224,7 @@ function shows_init() {
shows_list = [];
data = { LOGIN_NAME: auth_username, PASSWORD: auth_token };
$.post("/rh-bin/listdropboxes.cgi", data, shows_updateList, "xml")
- draw_current_week();
+ shows_drawCurrentWeek();
}
function shows_cleanup() {