From 213b98b4f18076c8b9e42b6868beaa3a640ae4e6 Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Sun, 22 Jul 2007 02:10:11 +0000 Subject: - Tool icons in epg popup windows. --- pages/epginfo.ecpp | 55 ++++++++++++++++++++++++++++++++++++++++-------- pages/pageelems.ecpp | 50 +++++++++++++++++++++++++++++++++++++++++-- pages/searchresults.ecpp | 2 +- pages/whats_on.ecpp | 29 ++----------------------- 4 files changed, 97 insertions(+), 39 deletions(-) (limited to 'pages') diff --git a/pages/epginfo.ecpp b/pages/epginfo.ecpp index 9487040..c14d89d 100644 --- a/pages/epginfo.ecpp +++ b/pages/epginfo.ecpp @@ -1,12 +1,31 @@ <%pre> #include #include + +#include "stdext.h" #include "exception.h" #include "setup.h" #include "tools.h" #include "epg_events.h" #include "recordings.h" +namespace vdrlive { + class SchedulesLock + { + public: + SchedulesLock() : m_schedulesLock() {} + + operator cSchedulesLock& () { return m_schedulesLock; } + + private: + SchedulesLock(SchedulesLock const &schedulesLock) {} + + cSchedulesLock m_schedulesLock; + }; + + typedef std::tr1::shared_ptr SchedulesLockPtr; +} + using namespace vdrlive; using namespace std; @@ -16,24 +35,25 @@ using namespace std; string async; <%session scope="global"> -bool logged_in(false); + bool logged_in(false); +<%request scope="page"> + EpgInfoPtr epgEvent; + <%include>page_init.eh <%cpp> -if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); - -<%cpp> + if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); + pageTitle = tr("Electronic program guide information"); bool ajaxReq = !async.empty() && (lexical_cast(async) != 0); - EpgInfoPtr epgEvent; - bool aboutBox(false); + bool aboutBox = false; - // These get initialized when needed. When freed by getting out + // One of these get initialized when needed. When freed by getting // out of scope they will release (if initialized) important // Semaphores/Locks. - cSchedulesLock schedulesLock; + SchedulesLockPtr schedulesLockPtr; RecordingsManagerPtr recordings; if (!epgid.empty()) { @@ -53,7 +73,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); } // check for event: else if (epgid.compare(0, event.length(), event) == 0) { - const cSchedules* schedules = cSchedules::Schedules(schedulesLock); + schedulesLockPtr = SchedulesLockPtr(new SchedulesLock); + if (!schedulesLockPtr) { + throw HtmlError(tr("Error aquiring schedules lock")); + } + const cSchedules* schedules = cSchedules::Schedules(*schedulesLockPtr); if (!schedules) { throw HtmlError(tr("Error aquiring schedules")); } @@ -97,6 +121,9 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); if (recordings) { tools_component = epgEvent->Archived().empty() ? "recordings.rec_tools" : "recordings.archived_disc" ; } + if (schedulesLockPtr) { + tools_component = "epginfo.epgTools"; + } <& pageelems.epg_tt_box boxId=(epgEvent->Id()) caption=(epgEvent->Caption()) tools_comp=(tools_component) time=(start) title=(epgEvent->Title()) short_descr=(epgEvent->ShortDescr()) long_descr=(epgEvent->LongDescr()) archived=(epgEvent->Archived()) elapsed=(epgEvent->Elapsed()) &> <%cpp> @@ -112,3 +139,13 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <%include>page_exit.eh + +<# ---------------------------------------------------------------------- #> + +<%def epgTools> +<%args> +string id; +int detail; + +<& pageelems.epg_tool_box detail=(detail) epgid=(id) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &> + diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index 799412b..2cff427 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -190,6 +190,52 @@ int update_status(1); <# ---------------------------------------------------------------------- #> +<%def epg_tool_box> +<%args> + int detail; + string epgid; + string title; + time_t startTime; + time_t endTime; + int lastCurrentChanel = int(); + +<%cpp> + int elapsed = EpgEvents::ElapsedTime(startTime, endTime); + tEventID eventId = tEventID(); + tChannelID channelId = tChannelID(); + + EpgEvents::DecodeDomId(epgid, channelId, eventId); + if (detail) { // output for vertical toolbox + + <& pageelems.event_timer channelid=(channelId) eventid=(eventId) &> +<%cpp> + if (elapsed > 0) { + + <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channelId) image="zap.png" alt="" &> +<%cpp> + } + if (LiveFeatures().Recent()) { + + " alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>> +<%cpp> + } + + " alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>> +<%cpp> + } + else { // table output + + "><& pageelems.event_timer channelid=(channelId) eventid=(eventId) &> + "><%cpp>if (elapsed > 0) { <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channelId) image="zap.png" alt="" &><%cpp> } + "><%cpp>if (LiveFeatures().Recent()) { " alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>><%cpp> } else { <%cpp> } + ">" border="0" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>> +<%cpp> + } + + + +<# ---------------------------------------------------------------------- #> + <%def epg_tt_box> <%args> string boxId; @@ -208,9 +254,9 @@ int update_status(1);
- <& (tools_comp) id=(boxId) archived=(archived) &> + <& (tools_comp) id=(boxId) archived=(archived) detail=(1) &>
-
+
<%cpp> if (!archived.empty()) { <$ (archived + " ") $><%cpp> } <$ (time) $>
<%cpp> if (elapsed >= 0) { diff --git a/pages/searchresults.ecpp b/pages/searchresults.ecpp index 63226d5..dda0d12 100644 --- a/pages/searchresults.ecpp +++ b/pages/searchresults.ecpp @@ -69,7 +69,7 @@ bool logged_in(false); tEventID event = result->EventId(); tChannelID channel_id(result->Channel()); string description = result->Description(); - string epgDomId(EpgEvents::GetDomId(result->Channel(), event)); + string epgDomId(EpgEvents::EncodeDomId(result->Channel(), event)); bool truncated = false; diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index d149e55..dfba641 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -128,21 +128,6 @@ if (type == "now") { continue; } - tChannelID channel_id(Channel->GetChannelID()); - tEventID event = Event->EventID(); - - - // string evntId("event_"); - // - // string schanid(channel_id.ToString()); - // replace(schanid.begin(), schanid.end(), '.', 'p'); - // replace(schanid.begin(), schanid.end(), '-', 'm'); - // evntId += schanid; - // evntId += '_'; - // evntId += lexical_cast(event); - // // evntId += lexical_cast(++evntNr); - // EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name())); - // // epgEvents.push_back(epgEvent); EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event); bool truncated = false; @@ -159,14 +144,7 @@ if (type == "now") {
- <& pageelems.event_timer channelid=(channel_id) eventid=(event) &> -% if (type == "now") { - <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &> -% } -% if ( LiveFeatures< features::epgsearch >().Recent() ) { - " alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>> -% } - " alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>> + <& pageelems.epg_tool_box detail=(1) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
@@ -189,10 +167,7 @@ if (type == "now") { || (!Channels.Next(Channel))); - "><& pageelems.event_timer channelid=(channel_id) eventid=(event) &> - "><%cpp>if (type == "now") { <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &><%cpp> } - "><%cpp>if (LiveFeatures().Recent() ) { " border="0" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>><%cpp> } else { <%cpp> } - ">" border="0" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>> + <& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &> ">
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
-- cgit v1.2.3