From 635330cfb237193db22cae510cae1ab5f0c5f6d9 Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Mon, 18 Jun 2007 19:15:59 +0000 Subject: - Don't throw error when channel has no epg information. Just display a message. Fixes #363 - Some indentation reordering in the whole file. --- i18n.cpp | 37 ++++++++++--- pages/schedule.ecpp | 152 ++++++++++++++++++++++++++++------------------------ 2 files changed, 112 insertions(+), 77 deletions(-) diff --git a/i18n.cpp b/i18n.cpp index fdaf299..64f77e6 100644 --- a/i18n.cpp +++ b/i18n.cpp @@ -1,21 +1,22 @@ /* These are translations of strings used in live. If you provide us with translations for one of the missing languages or stings, - please keep the following line in your file and submit your extended - version of i18n.cpp. (If you would like to submit a patch read below) + please keep the following line in your file and submit your + extended version of i18n.cpp. (If you would like to submit a patch + add more context like described below) - $Id: i18n.cpp,v 1.92 2007/06/17 22:04:58 tadi Exp $ + $Id: i18n.cpp,v 1.93 2007/06/18 19:15:59 tadi Exp $ Note to developers: How to safely integrate translations from third parties: - move your current verion to a safe name. i.E. i18n.cpp.current >$ mv i18n.cpp i18n.cpp.current - - checkout the revision of the submitted translations (see header line) + - checkout the revision of the submitted translations (see Id line) >$ cvs update -r i18n.cpp - create a patch with more than normal context (because of the quite reqular structure of this file). 20 lines of context are safe. >$ diff -Nur -U 20 i18n.cpp i18n.cpp.translated > i18n.diff - - IMPORTANT: reset your verion of the file: (clears the sticky tag created - on checkout above) + - IMPORTANT: reset your version of the file: (clears the sticky + tag created on checkout above) >$ cvs update -A i18n.cpp - restore your current version: >$ mv i18n.cpp.current i18n.cpp @@ -1329,7 +1330,7 @@ const tI18nPhrase Phrases[] = { "", // Czech }, { "Show dynamic VDR information box", // English - "Zeige eine dynamische VDR Status Box", // Deutsch + "Zeige dynamische VDR Status Box", // Deutsch "", // Slovenski "", // Italiano "", // Nederlands @@ -1372,6 +1373,28 @@ const tI18nPhrase Phrases[] = { "", // Dansk "", // Czech }, + { "No schedules available for this channel", // English + "Für diesen Kanal liegen keine EPG-Informationen vor", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, { "Search term", // English "Suchbegriff", // Deutsch "", // Slovenski diff --git a/pages/schedule.ecpp b/pages/schedule.ecpp index ef03fdf..e27ef4b 100644 --- a/pages/schedule.ecpp +++ b/pages/schedule.ecpp @@ -24,9 +24,9 @@ bool logged_in(false); cChannel* Channel; <%include>page_init.eh -<{ +<%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); -}> + <%cpp> pageTitle = tr("Schedule"); @@ -53,8 +53,6 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); cSchedule const* Schedule = schedules->GetSchedule( Channel ); - if ( Schedule == 0 ) - throw HtmlError( tr("No schedules available for this channel.") ); <& pageelems.doc_type &> @@ -68,82 +66,96 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <& pageelems.logo &> <& menu active=("schedule") component=("schedule.channel_selection")>
+<%cpp> + if ( Schedule == 0 ) { + + <$ tr("No schedules available for this channel") $>. +<%cpp> + } + else { + -<{ - EpgEvents epgEvents; +<%cpp> + EpgEvents epgEvents; - string current_day = ""; - const cEvent* PresentEvent = Schedule->GetPresentEvent(); - time_t now = time(NULL) - ::Setup.EPGLinger * 60; - tChannelID channel_id(Channel->GetChannelID()); - int evntNr = 0; - for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { - if (Event->EndTime() <= now && Event != PresentEvent) - continue; + string current_day = ""; + const cEvent* PresentEvent = Schedule->GetPresentEvent(); + time_t now = time(NULL) - ::Setup.EPGLinger * 60; + tChannelID channel_id(Channel->GetChannelID()); + int evntNr = 0; + for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { + if (Event->EndTime() <= now && Event != PresentEvent) + continue; - string evntId("eventId_"); - evntId += lexical_cast(++evntNr); - EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name())); - epgEvents.push_back(epgEvent); + string evntId("eventId_"); + evntId += lexical_cast(++evntNr); + EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name())); + epgEvents.push_back(epgEvent); - string title(Event->Title() ? Event->Title() : ""); - string short_description(Event->ShortText() ? Event->ShortText() : ""); - string description(Event->Description() ? Event->Description() : ""); - string start(Event->StartTime() ? FormatDateTime(tr("%I:%M %p"), Event->StartTime()) : ""); - string end(Event->EndTime() ? FormatDateTime(tr("%I:%M %p"), Event->EndTime()) : ""); - string day(Event->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), Event->StartTime()) : ""); - tEventID event = Event->EventID(); - ostringstream os; - os << Event->EventID(); - string strEventID = os.str(); - bool truncated = false; - bool lastEventCurrentDay = false; - { - cEvent* NextEvent = Schedule->Events()->Next(Event); - if (!NextEvent) { - lastEventCurrentDay = true; - } - else { - string nday(NextEvent->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), NextEvent->StartTime()) : ""); - lastEventCurrentDay = (day != nday); - } - } + string title(Event->Title() ? Event->Title() : ""); + string short_description(Event->ShortText() ? Event->ShortText() : ""); + string description(Event->Description() ? Event->Description() : ""); + string start(Event->StartTime() ? FormatDateTime(tr("%I:%M %p"), Event->StartTime()) : ""); + string end(Event->EndTime() ? FormatDateTime(tr("%I:%M %p"), Event->EndTime()) : ""); + string day(Event->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), Event->StartTime()) : ""); + tEventID event = Event->EventID(); + ostringstream os; + os << Event->EventID(); + string strEventID = os.str(); + bool truncated = false; + bool lastEventCurrentDay = false; + { + cEvent* NextEvent = Schedule->Events()->Next(Event); + if (!NextEvent) { + lastEventCurrentDay = true; + } + else { + string nday(NextEvent->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), NextEvent->StartTime()) : ""); + lastEventCurrentDay = (day != nday); + } + } - if (current_day != day) { - if (current_day != "") { -}> - - -<{ - } -}> - - - -% current_day = day; -% } - - - - - - - -% } + if (current_day != day) { + if (current_day != "") { + + + +<%cpp> + } + + + + +<%cpp> + current_day = day; + } + + + + + + + + +<%cpp> + } +
-
<$ day $>
"><& pageelems.event_timer channelid=(channel_id) eventid=(event) &>"><%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.")) &>>">
<$ start $> - <$ end $>
topaligned rightcol ">
" + tr("Click to view details.")) &><& tooltip.display domId=(epgEvent->Id()) &>><$ title $>
<%cpp>if (short_description.empty()) {  <%cpp> } <$ short_description $>
+
<$ day $>
"><& pageelems.event_timer channelid=(channel_id) eventid=(event) &>"><%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.")) &>>">
<$ start $> - <$ end $>
topaligned rightcol ">
" + tr("Click to view details.")) &><& tooltip.display domId=(epgEvent->Id()) &>><$ title $>
<%cpp>if (short_description.empty()) {  <%cpp> } <$ short_description $>
+ + + <%include>page_exit.eh -- cgit v1.2.3