/* * rhwebimport * * Copyright (C) 2014-2015 Christian Pointner * * This file is part of rhwebimport. * * rhwebimport is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * rhwebimport is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with rhwebimport. If not, see . */ 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) { jingles_group_list = []; $('#jingle-selector').find('option').remove(); var dblist = $(data).find("dropboxList"); var dbs = dblist.children(); dbs.each(function() { type = $(this).find('type').text(); if (type == 'jingle') { var jingle_group = { title: $(this).find('jingle-title').text(), group: { name: $(this).find('group').text(), description: $(this).find('group-description').text(), lowcart: $(this).find('group-low-cart').text(), highcart: $(this).find('group-high-cart').text(), }, normlevel: $(this).find('normalization-level').text(), trimlevel: $(this).find('autotrim-level').text(), }; var name = jingle_group.title; $('#jingle-selector').append($('