From 9ce3baaca5c8651c36bd287b17ce2688c77ae50b Mon Sep 17 00:00:00 2001 From: Jeff Lamb Date: Mon, 6 Mar 2017 23:28:53 -0500 Subject: [PATCH] Now you can navigate the schedule by selecting a date or by clicking the left/right arrows on the guide. I don't like the jqueryui theme, but it's good enough for now --- .../com/moparisthebest/rcrdit/RcrdIt.java | 4 + .../requestbeans/GetScheduleRequest.java | 37 +++++++- .../responsebeans/GetScheduleResponse.java | 2 +- src/main/webapp/css/rcrdit.css | 35 +++++++- src/main/webapp/images/left.png | Bin 0 -> 3043 bytes src/main/webapp/images/right.png | Bin 0 -> 3024 bytes src/main/webapp/index.html | 2 + src/main/webapp/js/rcrdit.js | 79 ++++++++++++++++-- 8 files changed, 144 insertions(+), 15 deletions(-) create mode 100644 src/main/webapp/images/left.png create mode 100644 src/main/webapp/images/right.png 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 0000000000000000000000000000000000000000..2da3a283bd479212e16c55a4de4e83fe46fc8de5 GIT binary patch literal 3043 zcmV<93mo)`P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#e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E@*b(Q2Cn;C?W^eTHL%d%ls5LRMv7o_@s1QX*=r2e8x1@ zl^~sqC)wM44GbYPw3~&oX5T5cTU*xsURcrdit + + 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"));