summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-09-20 04:04:00 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-09-20 04:04:00 (GMT)
commitc807e3f3618861c06aa7f5c43b595e0881775a26 (patch)
treefb97b0f46251d5bd0862df3c24f14b92c2cd62d1
parent5991153a593bb2244fc69b314f27d45588eb8848 (diff)
refactoring
-rw-r--r--index.html81
1 files changed, 42 insertions, 39 deletions
diff --git a/index.html b/index.html
index 8e75c5a..4f86282 100644
--- a/index.html
+++ b/index.html
@@ -53,24 +53,25 @@
+
var shows_currentid;
var shows_list = [];
- var current_show;
- var group_carts = [];
- var log_carts = [];
+ var shows_current;
+ var shows_group_carts = [];
+ var shows_log_carts = [];
- function updateShowListing() {
+ function shows_udpateCartListing() {
$('#show-carts tbody').find('tr').remove();
$('#show-info-dumper').text(
- 'Current Show:\n' + JSON.stringify(current_show, null, ' ') +
- '\n\nGroup Carts:\n' + JSON.stringify(group_carts, null, ' ') +
- '\n\nLog Carts:\n' + JSON.stringify(log_carts, null, ' ')
+ 'Current Show:\n' + JSON.stringify(shows_current, null, ' ') +
+ '\n\nGroup Carts:\n' + JSON.stringify(shows_group_carts, null, ' ') +
+ '\n\nLog Carts:\n' + JSON.stringify(shows_log_carts, null, ' ')
);
}
- function updateGroupCartList(data, status, req) {
- group_carts = [];
+ function shows_updateGroupCartList(data, status, req) {
+ shows_group_carts = [];
$('#show-carts').find('tr:gt(0)').remove();
var cartlist = $(data).find("cartList");
var carts = cartlist.children();
@@ -84,53 +85,53 @@
playcnt: new Date($(cut).find('playCounter').text()),
lastplayed: new Date($(cut).find('lastPlayDatetime').text()),
};
- group_carts.push(cart);
+ shows_group_carts.push(cart);
}
);
}
- function updateLogCartList(data, status, req) {
- log_carts = [];
+ function shows_updateLogCartList(data, status, req) {
+ shows_log_carts = [];
var loglist = $(data).find("logList");
var loglines = loglist.children();
loglines.each(function() {
var number = $(this).find('cartNumber').text();
- if(number >= current_show.group.lowcart && number <= current_show.group.highcart) {
- log_carts.push(number);
+ if(number >= shows_current.group.lowcart && number <= shows_current.group.highcart) {
+ shows_log_carts.push(number);
}
}
);
}
- function showSelectedShow() {
+ function shows_showSelected() {
shows_currentid = $('#show-selector option:selected').attr('value');
sessionStorage.setItem("shows_currentid", shows_currentid);
- current_show = $.grep(shows_list, function(elem) { return elem.id == shows_currentid; })[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.');
+ shows_current = $.grep(shows_list, function(elem) { return elem.id == shows_currentid; })[0];
+
+ $('#show-title').text(shows_current.title);
+ $('#show-dow').text(weekday[shows_current.dow]);
+ $('#show-rhythm').text(shows_current.rhythm);
+ $('#show-starttime').text(shows_current.starttime);
+ $('#show-length').text(shows_current.length + ' Min.');
- log_carts = [];
- data = { COMMAND: 22, LOGIN_NAME: username, PASSWORD: token, NAME: current_show.log };
- lcd = $.post("/rd-bin/rdxport.cgi", data, updateLogCartList, "xml");
+ shows_log_carts = [];
+ data = { COMMAND: 22, LOGIN_NAME: username, PASSWORD: token, NAME: shows_current.log };
+ lcd = $.post("/rd-bin/rdxport.cgi", data, shows_updateLogCartList, "xml");
- group_carts = [];
- data = { COMMAND: 6, LOGIN_NAME: username, PASSWORD: token, GROUP_NAME: current_show.group.name, INCLUDE_CUTS: 1 };
- gcd = $.post("/rd-bin/rdxport.cgi", data, updateGroupCartList, "xml");
+ shows_group_carts = [];
+ data = { COMMAND: 6, LOGIN_NAME: username, PASSWORD: token, GROUP_NAME: shows_current.group.name, INCLUDE_CUTS: 1 };
+ gcd = $.post("/rd-bin/rdxport.cgi", data, shows_updateGroupCartList, "xml");
$.when(lcd, gcd).done(
function(lcres, gcres) {
if(lcres[1] == 'success' && gcres[1] == 'success') {
- updateShowListing();
+ shows_udpateCartListing();
}
}
);
}
-
- function updateShowsList(data, status, req) {
+ function shows_updateList(data, status, req) {
shows_list = [];
$('#show-selector').find('option').remove();
var dblist = $(data).find("dropboxList");
@@ -163,14 +164,14 @@
}
);
$('#show-selector').val(shows_currentid);
- showSelectedShow();
+ shows_showSelected();
}
function shows_init() {
shows_currentid = sessionStorage.getItem("shows_currentid");
shows_list = [];
data = { LOGIN_NAME: username, PASSWORD: token };
- $.post("/listdropboxes.cgi", data, updateShowsList, "xml")
+ $.post("/listdropboxes.cgi", data, shows_updateList, "xml")
}
function shows_cleanup() {
@@ -179,8 +180,7 @@
}
-
- function selectApp(app) {
+ function apps_select(app) {
switch(app) {
case "musicpools":
$('#app-shows').hide();
@@ -199,6 +199,9 @@
sessionStorage.setItem("app", app);
}
+
+
+
function authSuccess(data) {
if (data.status == 'OK') {
username = data.username;
@@ -207,7 +210,7 @@
token = data.token;
sessionStorage.setItem("token", token);
- selectApp('shows');
+ apps_select('shows');
$('#username-field').html(username);
$('#loginbox').slideUp();
@@ -300,8 +303,8 @@
<span class="brand">Radio Helsinki - Import</span>
<div class="nav-collapse">
<ul class="nav">
- <li id="nav-btn-shows"><a href="#" onclick="selectApp('shows')">Sendungen</a></li>
- <li id="nav-btn-musicpools"><a href="#" onclick="selectApp('musicpools')">Musikpools</a></li>
+ <li id="nav-btn-shows"><a href="#" onclick="apps_select('shows')">Sendungen</a></li>
+ <li id="nav-btn-musicpools"><a href="#" onclick="apps_select('musicpools')">Musikpools</a></li>
</ul>
<form id="logoutform" class="navbar-form pull-right">
<span class="navbar-text">angmeldet als <strong id="username-field">UNKNOWN</strong></span>&nbsp;&nbsp;
@@ -319,7 +322,7 @@
<div class="span10">
<form class="well form-inline">
<label class="control-label" for="select-dropbox"><h3>Sendung auswählen</h3></label>&nbsp;&nbsp;
- <select id="show-selector" onchange="showSelectedShow()">
+ <select id="show-selector" onchange="shows_showSelected()">
</select>
</form>
</div>
@@ -415,7 +418,7 @@
<script type="text/javascript">
$("#loginform").submit(function(event) { login(); event.preventDefault(); });
$('#username-field').html(username);
- selectApp(app);
+ apps_select(app);
if(token && username) {
$("#loginbox").hide();
} else {