From 2fb25a22c4acd0e2842e3c38f1b0dcb1382560d6 Mon Sep 17 00:00:00 2001 From: df Date: Sun, 7 Jun 2020 12:26:29 +0000 Subject: [PATCH] Remove untimely buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test patch to change button handling in the WebIf programme details pop-up: Remove “Record Programme” button if programme has started. Rename “Set Reminder” button to “Watch Now” if programme is showing. Remove all the above if the programme has finished. MymsMan commented 2 weeks ago Remove “Record Programme” button if programme has started. Not a good idea - since you can actually record a programme after it has started which can be usefull If you only realise it is on at last moment If the humax has just restarted after crashing ... Possibly change label to “Record active programme” A useful change in this area would be to show “Cancel recording” “Skip” “Switch to alternate” buttons from the ‘Visual Schedule” popups if a programme has been scheduled for recording df commented 2 weeks ago Yes, “Record Programme” would be a better way to recover than “Watch Now” followed by Record (or IR Record) if the box is being managed out of eyeshot. It doesn't seem to be easy to “change” the button name in jQ UI, but I am not an expert. Seems like you can either set up all possible buttons for the dialogue (an Object structure like { button1_label: action1(), button2_label: action2(), ...}) and then delete the dynamically unwanted ones, or add the dynamically wanted buttons to a base structure each time. Seems like there's an opportunity to unify the epgpopup code for Visual Schedule and EPG? Otherwise perhaps could fake into the VS pop-up from the EPG one for scheduled recordings? --- webif/html/js/epg_popup.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/webif/html/js/epg_popup.js b/webif/html/js/epg_popup.js index 53480f3..5478d09 100644 --- a/webif/html/js/epg_popup.js +++ b/webif/html/js/epg_popup.js @@ -22,13 +22,6 @@ function doschedule(type) var $buttons1 = { "Close" : function() {$(this).dialog('close');} }; -var $buttons2 = $.extend( - {"Record Programme": function() { doschedule(1) }}, - {"Set Reminder": function() { doschedule(3) }}, - $buttons1); -var $buttons3 = $.extend( - {"Record Series": function() { doschedule(2) }}, - $buttons2); var $dialog = $('#epgpopup_dialogue').dialog({ title: "Programme Details", @@ -46,17 +39,35 @@ function epgpopup(e, o) e.preventDefault(); var sch = o.attr('sch'); var rec = o.attr('rec'); - $dialog.dialog("option", "buttons", $buttons1); + var state = o.attr('st'); + + var $buttons2 = $.extend( + {"Record Series": function() { doschedule(2) }}, + {"Record Programme": function() { doschedule(1) }}, + {"Set Reminder": function() { doschedule(3) }}, + {"Watch Now": function() { doschedule(3) }}, + $buttons1); if (sch != 0) $buttons = $buttons1; - else if (rec == 2) - $buttons = $buttons3; - else if (rec == 1) + else if (rec == 2 || rec == 1) + { $buttons = $buttons2; + if (rec == 1) delete $buttons["Watch Now"]; + } else $buttons = $buttons1; + if (state >= 1) { + delete $buttons["Record Programme"]; + delete $buttons["Set Reminder"]; + } + if (state == 0 || state == 2) + delete $buttons["Watch Now"]; + } + + $dialog.dialog("option", "buttons", $buttons); + var url = '/cgi-bin/epg/info.jim?service=' + o.attr('xs') + '&event=' + o.attr('xe') + '&bare=1';