diff --git a/src/main/java/com/moparisthebest/rcrdit/RcrdIt.java b/src/main/java/com/moparisthebest/rcrdit/RcrdIt.java index 575b19a..84cd3e6 100644 --- a/src/main/java/com/moparisthebest/rcrdit/RcrdIt.java +++ b/src/main/java/com/moparisthebest/rcrdit/RcrdIt.java @@ -443,6 +443,10 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable { public GetScheduleResponse getSchedule(GetScheduleRequest scheduleRequest) { List channelList = new ArrayList<>(); try{ + if(scheduleRequest.getEndTime().isAfter(GetScheduleRequest.getLastPossibleDateToDisplayOnSchedule(schedule.getLastEndTime()))){ + //not going to work, need to set things back a bit + scheduleRequest.setStartAndEndTimeBasedOnLastDataAvailable(schedule.getLastEndTime()); + } int firstItemToLoad = ((scheduleRequest.getPageNum()-1) * scheduleRequest.getChannelsPerPage()); if(schedule.getChannels().size() > firstItemToLoad){ for(int i=firstItemToLoad; i schedule; - + public GetScheduleResponse(GetScheduleRequest requestObject, List schedule) { this.requestObject = requestObject; this.schedule = schedule; diff --git a/src/main/webapp/css/rcrdit.css b/src/main/webapp/css/rcrdit.css index a44a52c..4d428e5 100644 --- a/src/main/webapp/css/rcrdit.css +++ b/src/main/webapp/css/rcrdit.css @@ -76,8 +76,9 @@ ul#channelGroups li ul li ul li.channel { border-bottom: 1px solid #dbdbdc; border-right: 1px solid #dbdbdc; border-top: 0; - height: 40px; + height: 60px; padding: 0; + padding-top: 20px; position: relative; text-align: center; } @@ -87,7 +88,7 @@ ul#channelGroups li ul li ul li:first-child { } ul#channelGroups li ul>li { - height: 40px; + height: 60px; margin: 0; overflow: hidden; padding: 0; @@ -98,10 +99,38 @@ ul#channelGroups li ul>li { ul#channelGroups li ul li ul li.programs>div { display: block; - height: 40px; + height: 60px; position: absolute; } +.frame { + height: 36px; /* equals max image height */ + width: 50px; + white-space: nowrap; + + text-align: center; margin: 1em 0; +} + +.helper { + display: inline-block; + height: 100%; + vertical-align: middle; +} + +.frame img { + vertical-align: middle; + max-height: 36px; + max-width: 50px; +} + +.datePickerTextBox{ + border-radius: 4px; + height: 30px; + font-size: 16pt; +} + + + ul#channelGroups li ul li ul li.programs>div { diff --git a/src/main/webapp/images/left.png b/src/main/webapp/images/left.png new file mode 100644 index 0000000..2da3a28 Binary files /dev/null and b/src/main/webapp/images/left.png differ diff --git a/src/main/webapp/images/right.png b/src/main/webapp/images/right.png new file mode 100644 index 0000000..518710f Binary files /dev/null and b/src/main/webapp/images/right.png differ diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index f7707a2..e2ca6c3 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -23,6 +23,8 @@ Rcrdit + + diff --git a/src/main/webapp/js/rcrdit.js b/src/main/webapp/js/rcrdit.js index 70d54b5..9d2435d 100644 --- a/src/main/webapp/js/rcrdit.js +++ b/src/main/webapp/js/rcrdit.js @@ -47,9 +47,6 @@ function getSchedule2(requestObject){ var channelList = data.schedule; var requestObject = data.requestObject; var requestStartTimeEpochSeconds = requestObject.startTime.epochSecond; - var requestEndTimeEpochSeconds = requestObject.endTime.epochSecond; - - $("#guideGoesHere").html(""); $("#guideGoesHere").append(getProgramsHeader(requestObject)); var channelUl = $("
    ").addClass("roundedBottom"); @@ -61,6 +58,7 @@ function getSchedule2(requestObject){ var channelProgramUl = $("
      ").attr("channelNum",channel.displayName); individualChannelLi.append(channelProgramUl); var channelNameLi = $("
    • "); + channelNameLi.data("channelObj",channel); channelNameLi.append("").addClass("channelNumLabel").append(channel.displayName); channelProgramUl.append(channelNameLi); @@ -74,6 +72,7 @@ function getSchedule2(requestObject){ channelUl.append(individualChannelLi); } $("#guideGoesHere").append(channelGroupsUl); + $("#guideGoesHere").data("lastSearchObject",requestObject); }, error: function ( jqXHR, textStatus, errorThrown ){ alert(errorThrown); @@ -133,10 +132,54 @@ function formatTime(dateObj){ function getProgramsHeader(requestObject){ var d = new Date(); - var heading = $("

      ").append("    TV Schedule: "); - var dateDiv = $().append("THE DATE GOES HERE"); + var heading = $("

      TV Schedule:

      "); + var datePickerTextBox = $("").datepicker({ + onSelect: function(){ + var lastRequestObject = $("#guideGoesHere").data("lastSearchObject"); + var startDate = new Date(lastRequestObject.startTime.epochSecond*1000); + var endDate = new Date(lastRequestObject.endTime.epochSecond*1000); + var selectedDate = $(this).datepicker( "getDate" ) + startDate.setDate(selectedDate.getDate()); + startDate.setMonth(selectedDate.getMonth()); + startDate.setFullYear(selectedDate.getFullYear()); + endDate.setDate(selectedDate.getDate()); + endDate.setMonth(selectedDate.getMonth()); + endDate.setFullYear(selectedDate.getFullYear()); + if(endDate.getTime() < startDate.getTime()){ + endDate.setDate(endDate.getDate()+1); + } + delete lastRequestObject.startTime; + delete lastRequestObject.endTime; + lastRequestObject.startTimeString = startDate.toISOString(); + lastRequestObject.endTimeString = endDate.toISOString(); + getSchedule2(lastRequestObject); + } + }).datepicker("setDate",new Date(requestObject.startTime.epochSecond*1000)); + + var dateDiv = $($("
      ")).append(datePickerTextBox); + + heading.append(dateDiv); + + //heading.add(dateDiv); + + + + var leftArrowLink = $(""); + var goLeftDiv = $("
      ").append(leftArrowLink); + leftArrowLink.click(function(){ + var lastRequestObject = $("#guideGoesHere").data("lastSearchObject"); + var startDate = new Date(lastRequestObject.startTime.epochSecond*1000); + var endDate = new Date(lastRequestObject.endTime.epochSecond*1000); + startDate.setHours(startDate.getHours()-2); + endDate.setHours(endDate.getHours()-2); + delete lastRequestObject.startTime; + delete lastRequestObject.endTime; + lastRequestObject.startTimeString = startDate.toISOString(); + lastRequestObject.endTimeString = endDate.toISOString(); + getSchedule2(lastRequestObject); + }); + var emptrySpacerLi = $("
    • ").addClass("navlspacer").append(goLeftDiv); - var emptrySpacerLi = $("
    • ").addClass("navlspacer"); var numHoursDisplayed = Math.ceil((requestObject.endTime.epochSecond-requestObject.startTime.epochSecond)/60/60); var hourBlockWidth = (100.0/numHoursDisplayed)+"%"; @@ -150,6 +193,25 @@ function getProgramsHeader(requestObject){ listOfHoursDisplayed.append(hour); firstHourDate.setHours(firstHourDate.getHours()+1); } + + var rightArrowLink = $(""); + var goRightDiv = $("
      ").append(rightArrowLink); + rightArrowLink.click(function(){ + var lastRequestObject = $("#guideGoesHere").data("lastSearchObject"); + var startDate = new Date(lastRequestObject.startTime.epochSecond*1000); + var endDate = new Date(lastRequestObject.endTime.epochSecond*1000); + startDate.setHours(startDate.getHours()+2); + endDate.setHours(endDate.getHours()+2); + delete lastRequestObject.startTime; + delete lastRequestObject.endTime; + lastRequestObject.startTimeString = startDate.toISOString(); + lastRequestObject.endTimeString = endDate.toISOString(); + getSchedule2(lastRequestObject); + + }); + + listOfHoursDisplayed.append(goRightDiv); + var timeUl = $("
        ").addClass("hours").append(emptrySpacerLi).append(listOfHoursDisplayed); var innerLi = $("
      • ").addClass("nav").addClass("first").append(timeUl); @@ -157,8 +219,8 @@ function getProgramsHeader(requestObject){ var timeDisplayDiv = $("
        ").attr("id","timeDisplayDiv").append(innerLi); - var guideHeader = $("
        ").addClass("guide-header").append(heading).append(dateDiv).append(timeDisplayDiv); - var guideHeaderContainer = $("
        ").attr("style","height: 77px;").append(guideHeader); + var guideHeader = $("
        ").addClass("guide-header").append(heading).append(timeDisplayDiv); + var guideHeaderContainer = $("
        ").attr("style","height: 96px;").append(guideHeader); return guideHeaderContainer; } @@ -166,6 +228,7 @@ function getProgramDiv(program, requestObject, startAtPercent){ var programDiv = $("
        ").addClass("channelProgram"); var titleInfoDiv = $("
        ").addClass("titleInfo"); var otherStuffDiv = $("
        ").addClass("otherProgramStuff"); + programDiv.data("programObj",program); titleInfoDiv.append(program.title); if(!isNull(program.subTitle)){ titleInfoDiv.append($("

        "+program.subTitle+"

        ").addClass("programSubtitle"));