diff options
author | Christian Pointner <equinox@helsinki.at> | 2014-09-20 02:09:00 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2014-09-20 02:09:00 (GMT) |
commit | dc133013ae2ea18507d55dc692d089c99c3a464d (patch) | |
tree | 848486c9fc49fa91dadec38483512ac3e3c72f41 | |
parent | 8ab3a75ba857286a94175579251d2cd638cb3514 (diff) |
group and show cart lists get imported now
-rw-r--r-- | index.html | 72 |
1 files changed, 62 insertions, 10 deletions
@@ -52,14 +52,67 @@ weekday[6] = "Samstag"; + + var shows_list = []; + var current_show; + var group_carts = []; + var show_carts = []; + + function updateShowListing() { + $('#show-carts').find('tr:gt(0)').remove(); + + } + + function updateGroupCartList(data, status, req) { + show_carts = []; + $('#show-carts').find('tr:gt(0)').remove(); + var cartlist = $(data).find("cartList"); + var carts = cartlist.children(); + carts.each(function() { + var cut = $(this).find("cutList").get(0); + cart = { + number: $(this).find('number').text(), + title: $(this).find('title').text(), + length: $(cut).find('length').text(), + imported: new Date($(cut).find('originDatetime').text()), + playcnt: new Date($(cut).find('playCounter').text()), + lastplayed: new Date($(cut).find('lastPlayDatetime').text()), + }; + group_carts.push(cart); + } + ); + + updateShowListing(); + } + + function updateShowCartList(data, status, req) { + show_carts = []; + var cartlist = $(data).find("logList"); + var carts = cartlist.children(); + carts.each(function() { + if($(this).find('groupName').text() == current_show.group) { + show_carts.push($(this).find('cartNumber').text()); + } + } + ); + + group_carts = []; + data = { COMMAND: 6, LOGIN_NAME: username, PASSWORD: token, GROUP_NAME: current_show.group, INCLUDE_CUTS: 1 }; + $.post("/rd-bin/rdxport.cgi", data, updateGroupCartList, "xml"); + } + function showSelectedShow() { var id = $('#show-selector option:selected').attr('value'); - var show = $.grep(shows_list, function(elem) { return elem.id == id; })[0]; - $('#show-title').text(show.title); - $('#show-dow').text(weekday[show.dow]); - $('#show-rhythm').text(show.rhythm); - $('#show-starttime').text(show.starttime); - $('#show-length').text(show.length + ' Min.'); + current_show = $.grep(shows_list, function(elem) { return elem.id == id; })[0]; + $('#show-title').text(current_show.title); + $('#show-dow').text(weekday[current_show.dow]); + $('#show-rhythm').text(current_show.rhythm); + $('#show-starttime').text(current_show.starttime); + $('#show-length').text(current_show.length + ' Min.'); + + show_carts = []; + data = { COMMAND: 22, LOGIN_NAME: username, PASSWORD: token, NAME: current_show.log }; + $.post("/rd-bin/rdxport.cgi", data, updateShowCartList, "xml"); } function updateShowsList(data, status, req) { @@ -89,11 +142,10 @@ shows_list.push(show); } } - ) - showSelectedShow() + ); + showSelectedShow(); } - var shows_list = []; function app_shows_init() { shows_list = []; data = { LOGIN_NAME: username, PASSWORD: token }; @@ -274,7 +326,7 @@ </div> <div class="row-fluid"> <div class="span12"> - <table class="table table-striped"> + <table class="table table-striped" id="show-carts"> <thead> <tr> <th>Cart #</th> |