From 4a7724fb059e41e997958ff32a033b2741fbb304 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Thu, 31 May 2007 19:24:57 +0000 Subject: - configurable start page --- i18n.cpp | 22 ++++++++++++++++++++++ pages/login.ecpp | 2 +- pages/setup.ecpp | 17 +++++++++++++++++ setup.cpp | 16 ++++++++++++++++ setup.h | 4 ++++ 5 files changed, 60 insertions(+), 1 deletion(-) diff --git a/i18n.cpp b/i18n.cpp index 3cb2f99..1b71623 100644 --- a/i18n.cpp +++ b/i18n.cpp @@ -4033,6 +4033,28 @@ const tI18nPhrase Phrases[] = { "", // Dansk "", // Czech }, + { "Start page", // English + "Startseite", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, /* { "", // English "", // Deutsch diff --git a/pages/login.ecpp b/pages/login.ecpp index 7462a59..20624a8 100644 --- a/pages/login.ecpp +++ b/pages/login.ecpp @@ -28,7 +28,7 @@ if (action == "login") { logged_in = false; } -if (logged_in || !LiveSetup().UseAuth()) return reply.redirect("whats_on.html"); +if (logged_in || !LiveSetup().UseAuth()) return reply.redirect(LiveSetup().GetStartScreenLink()); }> <& pageelems.doc_type &> diff --git a/pages/setup.ecpp b/pages/setup.ecpp index a95f55d..1650211 100644 --- a/pages/setup.ecpp +++ b/pages/setup.ecpp @@ -12,6 +12,7 @@ using namespace std; string login; string pass; string times; + string startscreen; <%session scope="global"> bool logged_in(false); @@ -21,6 +22,8 @@ bool logged_in(false); if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); }> <%cpp> +#define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" ); + if ( request.getMethod() == "POST") { LiveSetup().SetLastChannel(lastchannel != "" ? lexical_cast< int >(lastchannel):0); LiveSetup().SetUseAuth(useauth); @@ -30,6 +33,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); LiveSetup().SetAdminPassword(pass); } LiveSetup().SetTimes(times); + LiveSetup().SetStartScreen(startscreen); LiveSetup().SaveSetup(); } pageTitle = tr("Setup"); @@ -42,6 +46,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); login = LiveSetup().GetAdminLogin(); useauth = LiveSetup().UseAuth(); times = LiveSetup().GetTimes(); + startscreen = LiveSetup().GetStartScreen(); <& pageelems.doc_type &> @@ -104,6 +109,18 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <& tooltip.help text=(tr("Format is HH:MM. Separate multiple times with a colon")) &> + + + <$ tr("Start page") $>: + + + diff --git a/setup.cpp b/setup.cpp index 0b5a5c8..402bc6a 100644 --- a/setup.cpp +++ b/setup.cpp @@ -74,6 +74,7 @@ bool Setup::ParseSetupEntry( char const* name, char const* value ) else if ( strcmp( name, "AdminLogin" ) == 0 ) m_adminLogin = value; else if ( strcmp( name, "AdminPasswordMD5" ) == 0 ) m_adminPasswordMD5 = value; else if ( strcmp( name, "UserdefTimes" ) == 0 ) m_times = value; + else if ( strcmp( name, "StartPage" ) == 0 ) m_startscreen = value; else return false; return true; } @@ -132,6 +133,20 @@ std::string Setup::SetAdminPassword(std::string password) return m_adminPasswordMD5; } +std::string Setup::GetStartScreenLink() const +{ + if (m_startscreen == "whatsonnext") + return "whats_on.html?type=next"; + else if (m_startscreen == "schedule") + return "schedule.html"; + else if (m_startscreen == "timers") + return "timers.html"; + else if (m_startscreen == "recordings") + return "recordings.html"; + else + return "whats_on.html?type=now"; +} + bool Setup::SaveSetup() { if (!liveplugin) return false; @@ -143,6 +158,7 @@ bool Setup::SaveSetup() liveplugin->SetupStore("AdminPasswordMD5", m_adminPasswordMD5.c_str()); } liveplugin->SetupStore("UserdefTimes", m_times.c_str()); + liveplugin->SetupStore("StartPage", m_startscreen.c_str()); return true; } diff --git a/setup.h b/setup.h index 32512e4..3a78df1 100644 --- a/setup.h +++ b/setup.h @@ -36,6 +36,8 @@ public: int GetAdminPasswordLength() const; bool UseAuth() const { return m_useAuth; } std::string GetTimes() const { return m_times; } + std::string GetStartScreen() const { return m_startscreen; } + std::string GetStartScreenLink() const; void SetLastChannel(int lastChannel) { m_lastChannel = lastChannel; } void SetAdminLogin(std::string login) { m_adminLogin = login; } @@ -43,6 +45,7 @@ public: void SetUseAuth(int auth) { m_useAuth = auth; } void SetScrenshotInterval(int interval) { m_screenshotInterval = interval; } void SetTimes(std::string times) { m_times = times; } + void SetStartScreen(std::string startscreen) { m_startscreen = startscreen; } bool SaveSetup(); @@ -70,6 +73,7 @@ private: std::string m_adminLogin; std::string m_adminPasswordMD5; std::string m_times; + std::string m_startscreen; bool CheckServerPort(); bool CheckServerIps(); -- cgit v1.2.3