diff --git a/src/modules/htmlUI/var/html/css/playlist.css b/src/modules/htmlUI/var/html/css/playlist.css index 1be2066ca..fe6db805f 100644 --- a/src/modules/htmlUI/var/html/css/playlist.css +++ b/src/modules/htmlUI/var/html/css/playlist.css @@ -48,8 +48,9 @@ .pl_head span { display:inline-block; - vertical-align: top; - padding-top: 0.5em; + vertical-align: middle; + padding-top: 0.2em; + padding-bottom: 0.2em; font-weight: bold; } @@ -66,49 +67,64 @@ .pl_row span { display:inline-block; vertical-align: middle; - padding: 0.2em 0; + padding-top: 0.2em; + padding-bottom: 0.2em; } .pl_input{ - width: 5%; + width: 25px; } .pl_title{ - width: 21%; + width: 160px; + padding-right: 10px; } .pl_artist{ - width: 20%; + width: 140px; + padding-right: 10px; } .pl_length{ - width: 11%; + width: 100px; } .pl_cue_in{ - width: 11%; + width: 100px; } .pl_cue_out{ - width: 11%; + width: 100px; } .pl_playlength{ - width: 11%; + width: 100px; } .pl_fade_in{ padding: 0.2em 2em; - border-top: thin ridge black; + border-top: thin solid #999999; background-color: #cccccc; } +.pl_fade_in span{ + display: inline-block; + width: 60px; + padding-right: 5px; +} + .pl_fade_out{ padding-left: 2em; background-color: #cccccc; padding: 0.2em 2em; } +.pl_fade_out span{ + display: inline-block; + width: 60px; + padding-right: 5px; +} + .pl_time{ cursor: pointer; } diff --git a/src/modules/htmlUI/var/html/js/playlist.js b/src/modules/htmlUI/var/html/js/playlist.js index 403880e31..c0b165382 100644 --- a/src/modules/htmlUI/var/html/js/playlist.js +++ b/src/modules/htmlUI/var/html/js/playlist.js @@ -48,18 +48,27 @@ $(document).ready(function() { ); }); - function removeTextInput(){ + function removeCueInput(){ var span = $(this).parent(); var pos = span.parent().attr('id').split("_").pop(); var cueIn, cueOut; - var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,4})?$"); + var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); var oldValue = $("#pl_tmp_time").val(); var newValue = $(this).val().trim(); + if(span.hasClass('pl_cue_in')){ + if(newValue === "") + newValue = '00:00:00'; + cueIn = newValue; + } + else if(span.hasClass('pl_cue_out')){ + cueOut = newValue; + } + //test that input is a time. - if (!regExpr.test(newValue)) { + if (newValue!=="" && !regExpr.test(newValue)) { span.empty(); span.append(oldValue); span.click(addTextInput); @@ -67,13 +76,6 @@ $(document).ready(function() { return; } - if(span.hasClass('pl_cue_in')){ - cueIn = $(this).val(); - } - else if(span.hasClass('pl_cue_out')){ - cueOut = $(this).val(); - } - $.post("ui_handler.php", { 'act': 'PL.setClipLength', 'pos': pos, 'cueIn': cueIn, 'cueOut': cueOut }, @@ -92,24 +94,99 @@ $(document).ready(function() { span.click(addTextInput); alert(data.error); } - else if(data.type==="cue"){ - span = li.find(".pl_playlength"); - span.empty(); - span.append(data.cliplength); + span = li.find(".pl_playlength"); + span.empty(); + span.append(data.cliplength); + + span = $(".pl_duration"); + span.empty(); + span.append(data.length); + + if(data.cueIn){ + span = li.find(".pl_cue_in"); + span.empty(); + span.append(data.cueIn); + span.click(addTextInput); + } + if(data.cueOut){ + span = li.find(".pl_cue_out"); + span.empty(); + span.append(data.cueOut); + span.click(addTextInput); + } + + span = li.find(".pl_fade_in").find(".pl_time"); + span.empty(); + span.append(data.fadeIn); + + span = li.find(".pl_fade_out").find(".pl_time"); + span.empty(); + span.append(data.fadeOut); + }, + + "json" + ); + } + + function removeFadeInput(){ + var span = $(this).parent(); + var pos = span.parent().parent().attr('id').split("_").pop(); + + var fadeIn, fadeOut; + + var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); + var oldValue = $("#pl_tmp_time").val(); + var newValue = $(this).val().trim(); + + if(newValue === "") + newValue = '00:00:00'; + + if(span.parent().hasClass('pl_fade_in')){ + fadeIn = newValue; + } + else if(span.parent().hasClass('pl_fade_out')){ + fadeOut = newValue; + } + + //test that input is a time. + if (!regExpr.test(newValue)) { + span.empty(); + span.append(oldValue); + span.click(addTextInput); + alert("please put in a time '00:00:00 (.0000)'"); + return; + } + + $.post("ui_handler.php", + + { 'act': 'PL.setFadeLength', 'pos': pos, 'fadeIn': fadeIn, 'fadeOut': fadeOut }, + + function(data){ + var li, span; + + li = $("#pl_"+pos); + if(data.error){ + var hidden = $("#pl_tmp_time"); + var time = hidden.val(); - if(data.cueIn){ - span = li.find(".pl_cue_in"); - span.empty(); - span.append(data.cueIn); - span.click(addTextInput); - } - if(data.cueOut){ - span = li.find(".pl_cue_out"); - span.empty(); - span.append(data.cueOut); - span.click(addTextInput); - } + span = hidden.parent(); + span.empty(); + span.append(time); + span.click(addTextInput); + alert(data.error); } + if(data.fadeIn){ + span = li.find(".pl_fade_in").find(".pl_time"); + span.empty(); + span.append(data.fadeIn); + span.click(addTextInput); + } + if(data.fadeOut){ + span = li.find(".pl_fade_out").find(".pl_time"); + span.empty(); + span.append(data.fadeOut); + span.click(addTextInput); + } }, "json" @@ -118,7 +195,7 @@ $(document).ready(function() { function addTextInput(){ var time = $(this).text().trim(); - var input = $(""); + var input = $(""); //Firefox seems to have problems losing focus otherwise, Chrome is fine. $(":input").blur(); @@ -126,7 +203,14 @@ $(document).ready(function() { $(this).append(input); input.focus(); - input.blur(removeTextInput); + + if($(this).hasClass('pl_cue_in') || $(this).hasClass('pl_cue_out')) { + input.blur(removeCueInput); + } + else if($(this).parent().hasClass('pl_fade_in') || $(this).parent().hasClass('pl_fade_out')){ + input.blur(removeFadeInput); + } + input.keypress(function(ev){ //don't want enter to submit. if (ev.keyCode == '13') { diff --git a/src/modules/htmlUI/var/html/ui_handler.php b/src/modules/htmlUI/var/html/ui_handler.php index 82cdca1c8..82d2a1837 100644 --- a/src/modules/htmlUI/var/html/ui_handler.php +++ b/src/modules/htmlUI/var/html/ui_handler.php @@ -325,6 +325,10 @@ switch ($_REQUEST['act']) { case "PL.setClipLength": $uiHandler->PLAYLIST->setClipLength($_REQUEST['pos'], $_REQUEST['cueIn'], $_REQUEST['cueOut']); break; + + case "PL.setFadeLength": + $uiHandler->PLAYLIST->setFadeLength($_REQUEST['pos'], $_REQUEST['fadeIn'], $_REQUEST['fadeOut']); + break; case "PL.removeItem": $uiHandler->PLAYLIST->removeItem($_REQUEST['id']); diff --git a/src/modules/htmlUI/var/templates/playlist/editor.tpl b/src/modules/htmlUI/var/templates/playlist/editor.tpl index a6aa4e59e..207b274b4 100644 --- a/src/modules/htmlUI/var/templates/playlist/editor.tpl +++ b/src/modules/htmlUI/var/templates/playlist/editor.tpl @@ -2,7 +2,7 @@