diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-08-09 16:39:55 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-08-09 16:39:55 (GMT) |
commit | e1dc9d23da796d5a83d32c94a8320167a15eb8ec (patch) | |
tree | b73a2be0e55445168ebe97415c4e8d4e9adf71b1 /www | |
parent | 8e34dfc158906ad1ddf5810b8d0a88be6b7ffb1f (diff) |
add basic jingles listing
Diffstat (limited to 'www')
-rw-r--r-- | www/index.html | 54 | ||||
-rw-r--r-- | www/js/jingles.js | 89 | ||||
-rw-r--r-- | www/js/shows.js | 8 |
3 files changed, 123 insertions, 28 deletions
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 @@ <div id="app-jingles" class="container-fluid"> <div class="alertbox"></div> <div class="row-fluid"> - <div class="span10"> - <form class="well form-inline"> - <label class="control-label" for="show-selector"><h3>Jingle Gruppe auswählen</h3></label> - <select id="jingle-selector" class="main-selector" onchange="jingle_groups_showSelected()"> - </select> - </form> + <div class="span5"> + <div class="text-center"> + <h2 id="jingle-title-left"></h2> + </div> + <div class="row-fluid"> + <div class="span12"> + <table class="table table-striped" id="jingle-carts-left"> + <thead> + <tr> + <th>Cart #</th> + <th>Titel</th> + <th>Länge</th> + <th>importiert</th> + <th># gespielt</th> + <th>zuletzt gespielt</th> + <th>Aktionen</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + </div> + </div> </div> - <div class="span2"> - <div id="clock"> - <span class="current-week"></span> - <span class="clock-date"></span> - <span class="clock-time"></span> + <div class="span5"> + <h2 id="jingle-title-right"></h2> + <div class="row-fluid"> + <div class="span12"> + <table class="table table-striped" id="jingle-carts-right"> + <thead> + <tr> + <th>Cart #</th> + <th>Titel</th> + <th>Länge</th> + <th>importiert</th> + <th># gespielt</th> + <th>zuletzt gespielt</th> + <th>Aktionen</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + </div> </div> </div> </div> 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 <http://www.gnu.org/licenses/>. */ -jingle_groups_list = []; +var jingles_group_list = []; +var jingles_group_carts = {}; + +function jingles_newCartEntry(cart) { + + return $('<tr>').append($('<td>').text(cart.number)) + .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>'));//.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($('<option>').attr('value', jingle_group.id).text(name)); - jingle_groups_list.push(jingle_group); + jingles_group_list.push(jingle_group); } }); - console.log(jingle_groups_list); - //$('#jingle-selector').val(jingles_currentid); - //shows_showSelected(); + jingles_show(); } function jingles_init() { - //jingles_currentid = sessionStorage.getItem("jingles_currentid"); - jingle_groups_list = []; + jingles_group_list = []; + jingles_group_carts = {}; data = { LOGIN_NAME: auth_username, PASSWORD: auth_token }; $.post("/rh-bin/listdropboxes.cgi", data, jingle_groups_updateList, "xml"); - drawClock('Do, 1.1.1970', '00:00:00', 0); - clock_add_callback(drawClock); } function jingles_cleanup() { sessionStorage.removeItem("jingles_currentid"); delete jingles_currentid; - jingle_groups_list = []; - //jingles_group_carts = {}; - //jingles_log_carts = []; + jingles_group_list = []; + jingles_group_carts = {}; } diff --git a/www/js/shows.js b/www/js/shows.js index 5fd306c..f3e6105 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -216,7 +216,7 @@ function shows_redrawCartEntry(cart) { $('#show-cart-' + cart).replaceWith(shows_newCartEntry(cart)); } -function shows_udpateCartListing() { +function shows_updateCartListing() { $('#show-carts tbody').find('tr').remove(); shows_log_carts.forEach(function(elem) { $('#show-carts > tbody:last').append(shows_newCartEntry(elem)); @@ -228,8 +228,8 @@ function shows_updateGroupCartList(data, status, req) { var carts = cartlist.children(); carts.each(function() { var cut = $(this).find("cutList").get(0); - number = $(this).find('number').text(), - cart = { + 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()), @@ -278,7 +278,7 @@ function shows_showSelected() { $.when(lcd, gcd).done( function(lcres, gcres) { if(lcres[1] == 'success' && gcres[1] == 'success') { - shows_udpateCartListing(); + shows_updateCartListing(); } } ); |