Merge branch 'master' of dev.sourcefabric.org:campcaster

This commit is contained in:
Naomi 2011-01-26 14:18:18 -05:00
commit de3c95bd36
17 changed files with 188 additions and 91 deletions

View file

@ -11,7 +11,7 @@ function startDpSelect(dateText, inst) {
time = dateText.split("-");
date = new Date(time[0], time[1] - 1, time[2]);
$("#end_date").datepicker("option", "minDate", date);
$("#add_show_end_date").datepicker("option", "minDate", date);
}
function endDpSelect(dateText, inst) {
@ -20,7 +20,7 @@ function endDpSelect(dateText, inst) {
time = dateText.split("-");
date = new Date(time[0], time[1] - 1, time[2]);
$("#start_date").datepicker( "option", "maxDate", date);
$("#add_show_start_date").datepicker( "option", "maxDate", date);
}
function createDateInput(el, onSelect) {
@ -38,13 +38,22 @@ function createDateInput(el, onSelect) {
function autoSelect(event, ui) {
$("#hosts-"+ui.item.value).attr("checked", "checked");
$("#add_show_hosts-"+ui.item.value).attr("checked", "checked");
event.preventDefault();
}
function findHosts(request, callback) {
var search = request.term;
var search, url;
url = "/User/get-hosts";
search = request.term;
$.post(url,
{format: "json", term: search},
function(json) {
callback(json.hosts);
});
}

View file

@ -11,6 +11,12 @@ var currentElem;
var updateInterval = 5000;
var songEndFunc;
function registerSongEndListener(func){
songEndFunc = func;
}
function convertToHHMMSS(timeInMS){
var time = parseInt(timeInMS);
@ -70,7 +76,7 @@ function secondsTimer(){
updateProgressBarValue();
}
/* Called every 1 second. */
/* Called every 0.2 seconds. */
function updateProgressBarValue(){
if (estimatedSchedulePosixTime != -1){
if (currentSong.length > 0){
@ -85,6 +91,11 @@ function updateProgressBarValue(){
}
$('#progressbar').progressBar(0);
}
percentDone = (estimatedSchedulePosixTime - currentSong[0].showStartPosixTime)/currentSong[0].showLengthMs*100;
//$('#showprogressbar').text(currentSong[0].showLengthMs);
$('#showprogressbar').progressBar(percentDone);
} else {
$('#progressbar').progressBar(0);
@ -103,6 +114,8 @@ function updateProgressBarValue(){
function temp(){
currentSong[0] = nextSongs[0];
updatePlaylist();
songEndFunc();
}
function updatePlaylist(){
@ -111,40 +124,32 @@ function updatePlaylist(){
/* Column 1 update */
$('#show').empty();
$('#playlist').empty();
$('#host').empty();
for (var i=0; i<currentSong.length; i++){
//alert (currentSong[i].playlistname);
//$('#show').append(currentSong[i].show);
$('#playlist').append(currentSong[i].playlistname);
//$('#host').append(currentSong[i].creator);
//$('#show').text(currentSong[i].show);
$('#playlist').text(currentSong[i].name);
//$('#host').text(currentSong[i].creator);
}
/* Column 2 update */
$('#previous').empty();
$('#current').empty();
$('#next').empty();
for (var i=0; i<previousSongs.length; i++){
$('#previous').append(getTrackInfo(previousSongs[i]));
$('#previous').text(getTrackInfo(previousSongs[i]));
}
for (var i=0; i<currentSong.length; i++){
$('#current').append(getTrackInfo(currentSong[i]));
$('#current').text(getTrackInfo(currentSong[i]));
}
for (var i=0; i<nextSongs.length; i++){
$('#next').append(getTrackInfo(nextSongs[i]));
$('#next').text(getTrackInfo(nextSongs[i]));
}
/* Column 3 update */
$('#start').empty();
$('#end').empty();
$('#songposition').empty();
$('#songlength').empty();
for (var i=0; i<currentSong.length; i++){
$('#start').append(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
$('#end').append(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
$('#songposition').append(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].songStartPosixTime));
$('#songlength').append(currentSong[i].clip_length);
$('#start').text(currentSong[i].starts.substring(currentSong[i].starts.indexOf(" ")+1));
$('#end').text(currentSong[i].ends.substring(currentSong[i].starts.indexOf(" ")+1));
$('#songposition').text(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].songStartPosixTime));
$('#songlength').text(currentSong[i].clip_length);
$('#showposition').text(convertToHHMMSS(estimatedSchedulePosixTime - currentSong[i].showStartPosixTime));
$('#showlength').text(convertToHHMMSS(currentSong[i].showEndPosixTime - currentSong[i].showStartPosixTime));
}
}
@ -153,6 +158,10 @@ function calcAdditionalData(currentItem){
currentItem[i].songStartPosixTime = convertDateToPosixTime(currentItem[i].starts);
currentItem[i].songEndPosixTime = convertDateToPosixTime(currentItem[i].ends);
currentItem[i].songLengthMs = currentItem[i].songEndPosixTime - currentItem[i].songStartPosixTime;
currentItem[i].showStartPosixTime = convertDateToPosixTime(currentItem[i].starts.substring(0, currentItem[i].starts.indexOf(" ")) + " " + currentItem[i].start_time);
currentItem[i].showEndPosixTime = convertDateToPosixTime(currentItem[i].starts.substring(0, currentItem[i].starts.indexOf(" ")) + " " + currentItem[i].end_time);
currentItem[i].showLengthMs = currentItem[i].showEndPosixTime - currentItem[i].showStartPosixTime;
}
}
@ -185,6 +194,7 @@ function init(elemID) {
var currentElem = $("#" + elemID).attr("style", "z-index: 1; width: 100%; left: 0px; right: 0px; bottom: 0px; color: black; min-height: 100px; background-color: #FEF1B5;");
$('#progressbar').progressBar(0, {showText : false});
$('#showprogressbar').progressBar(0, {showText : false, barImage:'/js/progressbar/images/progressbg_red.gif'});
getScheduleFromServer();
updateProgressBarValue();