summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/index.html18
-rw-r--r--www/js/jingles.js40
2 files changed, 39 insertions, 19 deletions
diff --git a/www/index.html b/www/index.html
index 344c48e..2d4b2c8 100644
--- a/www/index.html
+++ b/www/index.html
@@ -149,15 +149,13 @@
<div class="alertbox"></div>
<div class="row-fluid">
<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">
+ <div class="span12" id="jingles-jingAllgem">
+ <h2></h2>
+ <table class="table table-striped">
<thead>
<tr>
- <th>Cart #</th>
+ <th>Cut #</th>
<th>Titel</th>
<th>Länge</th>
<th>importiert</th>
@@ -173,13 +171,13 @@
</div>
</div>
<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">
+ <div class="span12" id="jingles-jingAnlass">
+ <h2></h2>
+ <table class="table table-striped">
<thead>
<tr>
- <th>Cart #</th>
+ <th>Cut #</th>
<th>Titel</th>
<th>Länge</th>
<th>importiert</th>
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 5037382..9284fd6 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -22,10 +22,10 @@
var jingles_group_list = [];
var jingles_group_carts = {};
-function jingles_newCartEntry(cart) {
+function jingles_newCartEntry(cut) {
- return $('<tr>').append($('<td>').text(cart.number))
- .append($('<td>').text(cart.title))
+ return $('<tr>').append($('<td>').text(cut.name))
+ .append($('<td>').text(cut.title))
.append($('<td>'))//.text(msToTimeString(cart.length)))
.append($('<td>'))//.text(cart.imported))
.append($('<td>'))//.text(cart.playcnt))
@@ -35,9 +35,19 @@ function jingles_newCartEntry(cart) {
}
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));
+ $('#jingles-jingAllgem table tbody').find('tr').remove();
+ $('#jingles-jingAnlass table tbody').find('tr').remove();
+ $.each(jingles_group_carts, function(key, cart) {
+ console.log(cart);
+ if (cart.group.name === 'jingAllgem') {
+ $.each(cart.cutList, function(key, cut) {
+ $('#jingles-jingAllgem table > tbody:last').append(jingles_newCartEntry(cut));
+ });
+ } else if (cart.group.name === 'jingAnlass') {
+ $.each(cart.cutList, function(key, cut) {
+ $('#jingles-jingAnlass table > tbody:last').append(jingles_newCartEntry(cut));
+ });
+ }
});
}
@@ -45,20 +55,32 @@ 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(),
+ group: {
+ name: $(this).find('groupName').text(),
+ },
+ cutList: [],
//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()),
};
+ var cutList = $(this).find("cutList");
+ cutList.each(function() {
+ cart.cutList.push({
+ name: $(this).find('cutName').text(),
+ title: $(this).find('description').text(),
+ });
+ });
+
//cart.imported = isNaN(cart.imported) ? '-' : cart.imported;
//cart.lastplayed = isNaN(cart.lastplayed) ? '-' : cart.lastplayed;
jingles_group_carts[number] = cart;
}
);
+ console.log(jingles_group_carts);
jingles_updateCartListing();
}
@@ -71,7 +93,7 @@ function jingles_show() {
})[0];
if(jingAllgem) {
- $('#jingle-title-left').text(jingAllgem.title);
+ $('#jingles-jingAllgem h2').text(jingAllgem.title);
jingles_group_carts = {};
data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAllgem.group.lowcart, INCLUDE_CUTS: 1 };
@@ -79,7 +101,7 @@ function jingles_show() {
}
if(jingAnlass) {
- $('#jingle-title-right').text(jingAnlass.title);
+ $('#jingles-jingAnlass h2').text(jingAnlass.title);
jingles_group_carts = {};
data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAnlass.group.lowcart, INCLUDE_CUTS: 1 };