From 4bb2cc172549bcf9f86a94e5d3d0d5ade5f91dfe Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Thu, 31 May 2007 23:44:01 +0000 Subject: - Added doc/ChangeLog - Added doc/css-themeing.txt - Implemented support for site wide style overrides. Fixes Bug #339 - Updated all pages to use the override mechanism. - Added needed files to Makefile - Introduced USRDIR configuration variable to Makefile. --- Makefile | 9 ++++---- css/siteprefs.css | 17 +++++++++++++++ doc/ChangeLog | 13 ++++++++++++ doc/css-themeing.txt | 27 ++++++++++++++++++++++++ filecache.cpp | 2 ++ pages/Makefile | 4 ++-- pages/content.ecpp | 17 +++++++++++---- pages/edit_searchtimer.ecpp | 50 ++++++++++++++++++++++----------------------- pages/edit_timer.ecpp | 2 +- pages/error.ecpp | 10 +++------ pages/login.ecpp | 2 +- pages/pageelems.ecpp | 7 +++++++ pages/recordings.ecpp | 2 +- pages/remote.ecpp | 2 +- pages/schedule.ecpp | 2 +- pages/searchepg.ecpp | 4 ++-- pages/searchresults.ecpp | 10 ++++----- pages/searchtimers.ecpp | 2 +- pages/setup.ecpp | 6 +++--- pages/timers.ecpp | 2 +- pages/whats_on.ecpp | 6 +++--- setup.cpp | 20 +++++++++--------- tntconfig.cpp | 1 + 23 files changed, 145 insertions(+), 72 deletions(-) create mode 100644 css/siteprefs.css create mode 100644 doc/ChangeLog create mode 100644 doc/css-themeing.txt diff --git a/Makefile b/Makefile index b5ceca2..861d2dc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.38 2007/05/30 17:30:00 winni Exp $ +# $Id: Makefile,v 1.39 2007/05/31 23:44:01 tadi Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -33,6 +33,7 @@ LIBS += $(shell tntnet-config --libs) VDRDIR ?= ../../.. LIBDIR ?= ../../lib TMPDIR ?= /tmp +USRDIR ?= /usr/share/vdr-plugin-$(PLUGIN) ### Allow user defined options to overwrite defaults: @@ -51,10 +52,10 @@ PACKAGE = vdr-$(ARCHIVE) INCLUDES += -I$(VDRDIR)/include -Ihttpd -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DUSRDIR='"$(USRDIR)"' export DEFINES -LIBS += httpd/libhttpd.a +LIBS += httpd/libhttpd.a SUBDIRS = httpd pages css images javascript @@ -62,7 +63,7 @@ SUBDIRS = httpd pages css images javascript PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \ tools.o recordings.o tasks.o status.o epg_events.o epgsearch.o \ - grab.o md5.o + grab.o md5.o filecache.o WEBLIBS = pages/libpages.a css/libcss.a images/libimages.a \ javascript/libjavascript.a diff --git a/css/siteprefs.css b/css/siteprefs.css new file mode 100644 index 0000000..ed92cb0 --- /dev/null +++ b/css/siteprefs.css @@ -0,0 +1,17 @@ +/* ###################### + # This file is part of vdr-live! + # It is here to give the users the possibility to change the + # default css style of vdr-live to their needs. + # + # If you don't want to change default settings, make this file + # empty, but don't delete it. + ###################### +*/ + +/* uncomment this below, to make all tables full page width. +*/ +/* +table { + width: 100%; +} +*/ diff --git a/doc/ChangeLog b/doc/ChangeLog new file mode 100644 index 0000000..e1f3988 --- /dev/null +++ b/doc/ChangeLog @@ -0,0 +1,13 @@ +2007-06-01 Dieter Hametner + + These changes fix bug entry #339 + * css-themeing.txt: describe how to do css themeing. + * content.ecpp: + - check for additional parameter and use it as mime + type. + - use compile time variable USRDIR for path to the files + loaded via content.ecpp + * pageelems.ecpp: link to css/siteprefs.css + * pages/*.ecpp: changed style link to pageelems.stylesheet + component. + * tntconfig.cpp: added MapUrl for css/cssfile. \ No newline at end of file diff --git a/doc/css-themeing.txt b/doc/css-themeing.txt new file mode 100644 index 0000000..be84e26 --- /dev/null +++ b/doc/css-themeing.txt @@ -0,0 +1,27 @@ +How to do live theming with CSS. +================================ + +Live supports CSS theming. While the structure of the html pages is +given by the plugin, there is the possibility to change the look +through CSS. + +Currently a predefined, compiled into the plugin stylesheet 'styles.css' is +delivered first. Then a stylesheet 'css/siteprefs.css' is sent to the +browser. 'css/siteprefs.css' is a normal file that is found in +USRDIR. The default of USRDIR is /usr/share/vdr-plugin-live. This +can be changed at compile time by setting the USRDIR variable +(i.E. USRDIR=/tmp/live make) + +One of the next steps will be a mechanism to select additional style +files and images through a theme setting in vdr. The different themes +will be also located in theme related subdirs beneath USRDIR. + + +User Contribution +================= + +If you created a nice new look, you can provide it to us. We will try +to include it into the live distribution. + +If you need special html support for your styling needs don't hesitate +to submit a suggestion. diff --git a/filecache.cpp b/filecache.cpp index 37a1e85..1ecb60f 100644 --- a/filecache.cpp +++ b/filecache.cpp @@ -41,9 +41,11 @@ FileCache& LiveFileCache() } // namespace vdrlive +#if 0 using namespace vdrlive; int main() { FileCache::ptr_type f = LiveFileCache().get("/tmp/live/active.png"); } +#endif diff --git a/pages/Makefile b/pages/Makefile index 55cb633..da62cb8 100644 --- a/pages/Makefile +++ b/pages/Makefile @@ -22,7 +22,7 @@ OBJS = menu.o channels.o recordings.o schedule.o \ searchtimers.o edit_searchtimer.o searchresults.o \ searchepg.o login.o ibox.o xmlresponse.o \ play_recording.o pause_recording.o stop_recording.o \ - ffw_recording.o rwd_recording.o setup.o + ffw_recording.o rwd_recording.o setup.o content.o ### Default rules: @@ -53,4 +53,4 @@ libpages.a: $(OBJS) $(AR) r $@ $^ clean: - @rm -f *~ *.o core* libpages.a $(OBJS:%.o=%.cpp) $(DEPFILE) + @rm -f *~ *.o core* libpages.a $(OBJS:%.o=%.cpp) diff --git a/pages/content.ecpp b/pages/content.ecpp index 666b5a6..1390b08 100644 --- a/pages/content.ecpp +++ b/pages/content.ecpp @@ -15,12 +15,21 @@ bool logged_in(false); <%cpp> //if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); -reply.setContentType("image/png"); +string mime("image/png"); +if (request.getArgsCount() > 0) { + mime = request.getArg(0); + dsyslog("vdrlive::content found mime arg (%s)", mime.c_str()); +} +reply.setContentType(mime); +dsyslog("vdrlive::content::mimetype(%s)", mime.c_str()); -FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + request.getPathInfo()); -if (f.get() == 0) - throw tnt::NotFoundException(request.getUrl()); +// FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + request.getPathInfo()); +string path(request.getPathInfo()); +FileCache::ptr_type f = LiveFileCache().get(USRDIR "/" + path); +if (f.get() == 0) { + throw tnt::NotFoundException(request.getUrl()); +} string ctime = tnt::HttpMessage::htdate(f->ctime()); string browserTime = request.getHeader(tnt::httpheader::ifModifiedSince); if (browserTime == ctime) diff --git a/pages/edit_searchtimer.ecpp b/pages/edit_searchtimer.ecpp index 3049e94..75d2e6a 100644 --- a/pages/edit_searchtimer.ecpp +++ b/pages/edit_searchtimer.ecpp @@ -127,7 +127,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); infos.push_back(os.str()); } searchtimer.SetExtEPGInfo(infos); - } + } searchtimer.SetUseChannel((SearchTimer::eUseChannel)usechannel); if (usechannel == SearchTimer::Interval) { @@ -136,19 +136,19 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); } if (usechannel == SearchTimer::Group) searchtimer.SetChannelText(changrpsel); - + searchtimer.SetUseTime(usetime); if (usetime) { searchtimer.SetStartTime(StringToInt(start_h) * 100 + StringToInt(start_m)); searchtimer.SetStopTime(StringToInt(stop_h) * 100 + StringToInt(stop_m)); - } + } searchtimer.SetUseDuration(useduration); if (useduration) { searchtimer.SetMinDuration(durationmin); searchtimer.SetMaxDuration(durationmax); - } + } searchtimer.SetUseDayOfWeek(useweekday); if (useweekday) { @@ -164,7 +164,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); } searchtimer.SetUseInFavorites(useinfavorites); searchtimer.SetUseAsSearchTimer(useassearchtimer); - searchtimer.SetSearchTimerAction(searchtimeraction); + searchtimer.SetSearchTimerAction(searchtimeraction); searchtimer.SetUseSeriesRecording(seriesrecording); searchtimer.SetDirectory(directory); searchtimer.SetDelRecsAfterDays(delrecafterdays); @@ -173,8 +173,8 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); searchtimer.SetBlacklistMode(blacklistmode); if (blacklistmode == 1) searchtimer.ParseBlacklist(blacklistids_internal); - - searchtimer.SetSwitchMinBefore(switchminbefore); + + searchtimer.SetSwitchMinBefore(switchminbefore); searchtimer.SetAvoidRepeats(avoidrepeats); if (avoidrepeats) { @@ -183,8 +183,8 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); searchtimer.SetCompareTitle(comparetitle); searchtimer.SetCompareSubtitle(comparesubtitle); searchtimer.SetCompareSummary(comparesummary); - } - unsigned long catsselected = 0; + } + unsigned long catsselected = 0; for (unsigned int i=0; i< avoidrepeatscatselected.size(); i++) catsselected |= (1<< (avoidrepeatscatselected[i]-1)); searchtimer.SetCompareCategories(catsselected); @@ -193,10 +193,10 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); searchtimer.SetMarginStart(marginstart); searchtimer.SetMarginStop(marginstop); searchtimer.SetUseVPS(usevps); - + if (!testmode) { - searchtimers.Save(&searchtimer); + searchtimers.Save(&searchtimer); return reply.redirect("searchtimers.html"); } else @@ -213,7 +213,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); if ( searchtimer == 0 ) throw HtmlError( tr("Couldn't find searchtimer. Maybe you mistyped your request?") ); - search = searchtimer->Search(); + search = searchtimer->Search(); mode = searchtimer->SearchMode(); tolerance = searchtimer->Tolerance(); matchcase = searchtimer->MatchCase(); @@ -262,18 +262,18 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); } else { - wday_sun = -dayofweek & 0x01; - wday_mon = -dayofweek & 0x02; - wday_tue = -dayofweek & 0x04; - wday_wed = -dayofweek & 0x08; - wday_thu = -dayofweek & 0x10; - wday_fri = -dayofweek & 0x20; - wday_sat = -dayofweek & 0x40; + wday_sun = -dayofweek & 0x01; + wday_mon = -dayofweek & 0x02; + wday_tue = -dayofweek & 0x04; + wday_wed = -dayofweek & 0x08; + wday_thu = -dayofweek & 0x10; + wday_fri = -dayofweek & 0x20; + wday_sat = -dayofweek & 0x40; } - } + } useinfavorites = searchtimer->UseInFavorites(); useassearchtimer = searchtimer->UseAsSearchTimer(); - searchtimeraction = searchtimer->SearchTimerAction(); + searchtimeraction = searchtimer->SearchTimerAction(); seriesrecording = searchtimer->UseSeriesRecording(); directory = searchtimer->Directory(); delrecafterdays = searchtimer->DelRecsAfterDays(); @@ -286,7 +286,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); for(unsigned int i=0; i parts = StringSplit( infos[i], '#' ); extepgvalues.push_back(parts.size() > 1?parts[1]:""); } @@ -324,13 +324,13 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); lifetime = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefLifetime")); marginstart = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefMarginStart")); marginstop = lexical_cast< int >(EPGSearchSetupValues::ReadValue("DefMarginStop")); - } + } <& pageelems.doc_type &> VDR Live - <$ editsearchtimer ? tr("Edit search timer") : tr("New search timer") $> - + <& pageelems.stylesheets &> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> diff --git a/pages/edit_timer.ecpp b/pages/edit_timer.ecpp index 2ed8863..8b775cb 100644 --- a/pages/edit_timer.ecpp +++ b/pages/edit_timer.ecpp @@ -116,7 +116,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); VDR Live - <$ timer ? tr("Edit timer") : tr("New timer") $> - + <& pageelems.stylesheets &> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> diff --git a/pages/error.ecpp b/pages/error.ecpp index bb82887..df24dd4 100644 --- a/pages/error.ecpp +++ b/pages/error.ecpp @@ -20,18 +20,14 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); VDR-Live - <$ pageTitle $> - + <& pageelems.stylesheets &> -
- <& pageelems.logo &> - <& menu &> -
-
+ <& pageelems.logo &> + <& menu &>
<& error.error_widget errorTitle=(errorTitle) errorMessage=(errorMessage) &>
-
<%def error_widget> diff --git a/pages/login.ecpp b/pages/login.ecpp index 20624a8..e517963 100644 --- a/pages/login.ecpp +++ b/pages/login.ecpp @@ -35,7 +35,7 @@ if (logged_in || !LiveSetup().UseAuth()) return reply.redirect(LiveSetup().GetSt VDR-Live - <$ tr("Login") $> - + <& pageelems.stylesheets &> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index c823042..99b6882 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -32,6 +32,13 @@ static bool HasEpgsearch() <# ---------------------------------------------------------------------- #> +<%def stylesheets> + + + + +<# ---------------------------------------------------------------------- #> + <%def logo>