From e1dc9d23da796d5a83d32c94a8320167a15eb8ec Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Sun, 9 Aug 2015 18:39:55 +0200 Subject: add basic jingles listing diff --git a/www/index.html b/www/index.html index da72fd7..344c48e 100644 --- a/www/index.html +++ b/www/index.html @@ -148,18 +148,50 @@
-
-
-    - -
+
+
+

+
+
+
+ + + + + + + + + + + + + + +
Cart #TitelLängeimportiert# gespieltzuletzt gespieltAktionen
+
+
-
-
- - - +
+

+
+
+ + + + + + + + + + + + + + +
Cart #TitelLängeimportiert# gespieltzuletzt gespieltAktionen
+
diff --git a/www/js/jingles.js b/www/js/jingles.js index c936c36..5037382 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -19,10 +19,78 @@ * along with rhwebimport. If not, see . */ -jingle_groups_list = []; +var jingles_group_list = []; +var jingles_group_carts = {}; + +function jingles_newCartEntry(cart) { + + return $('').append($('').text(cart.number)) + .append($('').text(cart.title)) + .append($(''))//.text(msToTimeString(cart.length))) + .append($(''))//.text(cart.imported)) + .append($(''))//.text(cart.playcnt)) + .append($(''))//.text(cart.lastplayed)) + .append($(''));//.css('text-align', 'center').append(buttons)) + //.attr("id", "show-cart-" + elem); +} + +function jingles_updateCartListing() { + $('#jingle-carts-left tbody').find('tr').remove(); + $.each(jingles_group_carts, function(cart) { + $('#jingle-carts-left > tbody:last').append(jingles_newCartEntry(cart)); + }); +} + +function jingles_updateGroupCartList(data, status, req) { + var cartlist = $(data).find("cartList"); + var carts = cartlist.children(); + carts.each(function() { + var cut = $(this).find("cutList").get(0); + var number = $(this).find('number').text(); + var cart = { + title: $(this).find('title').text(), + //length: Number($(cut).find('length').text()), + //imported: new Date($(cut).find('originDatetime').text()), + //playcnt: $(cut).find('playCounter').text(), + //lastplayed: new Date($(cut).find('lastPlayDatetime').text()), + }; + //cart.imported = isNaN(cart.imported) ? '-' : cart.imported; + //cart.lastplayed = isNaN(cart.lastplayed) ? '-' : cart.lastplayed; + jingles_group_carts[number] = cart; + } + ); + jingles_updateCartListing(); +} + +function jingles_show() { + jingAllgem = $.grep(jingles_group_list, function(elem) { + return elem.group.name == 'jingAllgem'; + })[0]; + jingAnlass = $.grep(jingles_group_list, function(elem) { + return elem.group.name == 'jingAnlass'; + })[0]; + + if(jingAllgem) { + $('#jingle-title-left').text(jingAllgem.title); + + jingles_group_carts = {}; + data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAllgem.group.lowcart, INCLUDE_CUTS: 1 }; + gcd = $.post("/rd-bin/rdxport.cgi", data, jingles_updateGroupCartList, "xml"); + } + + if(jingAnlass) { + $('#jingle-title-right').text(jingAnlass.title); + + jingles_group_carts = {}; + data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAnlass.group.lowcart, INCLUDE_CUTS: 1 }; + gcd = $.post("/rd-bin/rdxport.cgi", data, jingles_updateGroupCartList, "xml"); + } + + +} function jingle_groups_updateList(data, status, req) { - jingle_groups_list = []; + jingles_group_list = []; $('#jingle-selector').find('option').remove(); var dblist = $(data).find("dropboxList"); var dbs = dblist.children(); @@ -44,27 +112,22 @@ function jingle_groups_updateList(data, status, req) { var name = jingle_group.title; $('#jingle-selector').append($('