From f6f71da928b975fd39afee1d639b495bcdeff9b8 Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Wed, 18 Jul 2007 23:48:14 +0000 Subject: - Setup option to use Ajax technology. If turned off no javascript is loaded but almost all functionality is exposed via single html pages. This can speed up loading over slow links at the cost of a fancy interface. - Infobox is only available with Ajax features enabled but can still be switched on/off when Ajax is active. - Added posibility to turn off the logo. When also infobox is turned off the menu line appears at the top of the page. This is helpful for PDA based browsers and low resolution screens. --- i18n.cpp | 46 +++++++++++- pages/pageelems.ecpp | 17 ++++- pages/setup.ecpp | 34 ++++++++- setup.cpp | 6 ++ setup.h | 197 ++++++++++++++++++++++++++------------------------- 5 files changed, 200 insertions(+), 100 deletions(-) diff --git a/i18n.cpp b/i18n.cpp index e1716e0..0806faf 100644 --- a/i18n.cpp +++ b/i18n.cpp @@ -4,7 +4,7 @@ extended version of i18n.cpp. (If you would like to submit a patch add more context like described below) - $Id: i18n.cpp,v 1.95 2007/06/20 17:29:29 winni Exp $ + $Id: i18n.cpp,v 1.96 2007/07/18 23:48:14 tadi Exp $ Note to developers: How to safely integrate translations from third parties: @@ -1329,6 +1329,50 @@ const tI18nPhrase Phrases[] = { "", // Dansk "", // Czech }, + { "Show live logo image", // English + "Zeige das Live Logo", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, + { "Use ajax technology", // English + "Verwende AJAX Technologie", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, { "Show dynamic VDR information box", // English "Zeige dynamische VDR Status Box", // Deutsch "", // Slovenski diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index 9fee05b..6de3bfc 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -34,12 +34,25 @@ int update_status(1); <# ---------------------------------------------------------------------- #> <%def logo> +<%cpp> + if (LiveSetup().GetShowLogo() + || (LiveSetup().GetUseAjax() && LiveSetup().GetShowInfoBox())) { +
+<%cpp> + } + <# ---------------------------------------------------------------------- #> @@ -123,6 +136,7 @@ int update_status(1); <# ---------------------------------------------------------------------- #> <%def ajax_js> +<%cpp>if (LiveSetup().GetUseAjax()) { @@ -139,6 +153,7 @@ int update_status(1); }); --> <%cpp> } +<%cpp> } <# ---------------------------------------------------------------------- #> diff --git a/pages/setup.ecpp b/pages/setup.ecpp index 2ec0e28..f363368 100644 --- a/pages/setup.ecpp +++ b/pages/setup.ecpp @@ -17,6 +17,8 @@ using namespace std; string startscreen; string theme; string localnetmask; + string showLogo; + string useAjax; string showInfoBox; int authchanged = 0; @@ -50,7 +52,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); LiveSetup().SetTimes(times); LiveSetup().SetStartScreen(startscreen); LiveSetup().SetTheme(theme); - LiveSetup().SetShowInfoBox(!showInfoBox.empty()); + LiveSetup().SetShowLogo(!showLogo.empty()); + LiveSetup().SetUseAjax(!useAjax.empty()); + if (LiveSetup().GetUseAjax()) { + LiveSetup().SetShowInfoBox(!showInfoBox.empty()); + } LiveSetup().SaveSetup(); message = tr("Setup saved."); } @@ -68,7 +74,10 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); startscreen = LiveSetup().GetStartScreen(); theme = LiveSetup().GetTheme(); localnetmask = LiveSetup().GetLocalNetMask(); + showLogo = LiveSetup().GetShowLogo() ? "1" : ""; + useAjax = LiveSetup().GetUseAjax() ? "1" : ""; showInfoBox = LiveSetup().GetShowInfoBox() ? "1" : ""; + <& pageelems.doc_type &> @@ -80,6 +89,7 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); function initform() { changeduseauth(document.getElementById("useauth")); + changeduseajax(document.getElementById("useAjax")); if (document.getElementById("message").value != "") alert(document.getElementById("message").value); } @@ -91,6 +101,10 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); { document.getElementById("authchanged").value = 1; } + function changeduseajax(selection) + { + document.getElementById("ajaxsection").style.display = (selection.checked ? "block" : "none"); + } //--> @@ -131,9 +145,23 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); -
<$ tr("Show dynamic VDR information box") $>:
+
<$ tr("Show live logo image") $>:
- CHECKIF(!showInfoBox.empty()); /> + CHECKIF(!showLogo.empty()); /> + + + +
<$ tr("Use ajax technology") $>:
+ + CHECKIF(!useAjax.empty()); onclick="changeduseajax(this)"/> + diff --git a/setup.cpp b/setup.cpp index 8f97a67..930a111 100644 --- a/setup.cpp +++ b/setup.cpp @@ -30,6 +30,8 @@ Setup::Setup(): m_theme("marine"), m_lastwhatsonlistmode("detail"), m_tntnetloglevel("INFO"), + m_showLogo(1), + m_useAjax(1), m_showInfoBox(1) { m_adminPasswordMD5 = "4:" + MD5Hash("live"); @@ -86,6 +88,8 @@ bool Setup::ParseSetupEntry( char const* name, char const* value ) else if ( strcmp( name, "Theme" ) == 0 ) m_theme = value; else if ( strcmp( name, "LocalNetMask" ) == 0 ) { m_localnetmask = value; } else if ( strcmp( name, "LastWhatsOnListMode" ) == 0 ) { m_lastwhatsonlistmode = value; } + else if ( strcmp( name, "ShowLogo" ) == 0 ) { m_showLogo = atoi(value); } + else if ( strcmp( name, "UseAjax" ) == 0 ) { m_useAjax = atoi(value); } else if ( strcmp( name, "ShowInfoBox" ) == 0 ) { m_showInfoBox = atoi(value); } else return false; return true; @@ -210,6 +214,8 @@ bool Setup::SaveSetup() liveplugin->SetupStore("StartPage", m_startscreen.c_str()); liveplugin->SetupStore("Theme", m_theme.c_str()); liveplugin->SetupStore("LastWhatsOnListMode", m_lastwhatsonlistmode.c_str()); + liveplugin->SetupStore("ShowLogo", m_showLogo); + liveplugin->SetupStore("UseAjax", m_useAjax); liveplugin->SetupStore("ShowInfoBox", m_showInfoBox); return true; } diff --git a/setup.h b/setup.h index c3973cd..2ac7f06 100644 --- a/setup.h +++ b/setup.h @@ -22,107 +22,114 @@ class Setup friend class cMenuSetupLive; // friend declaration is not forward // declaration, although gcc 3.3 claims so -public: - typedef std::list< std::string > IpList; - - // commandline - int GetServerPort() const { return m_serverPort; } - IpList const& GetServerIps() const { return m_serverIps; } - // vdr-setup - int GetLastChannel() const { return m_lastChannel == 0 ? std::numeric_limits< int >::max() : m_lastChannel; } - int GetScreenshotInterval() const { return m_screenshotInterval; } - std::string GetAdminLogin() const { return m_adminLogin; } - std::string GetMD5HashAdminPassword() const; - int GetAdminPasswordLength() const; - bool GetUseAuth() const { return m_useAuth; } - bool UseAuth() const; - std::string GetTimes() const { return m_times; } - std::string GetStartScreen() const { return m_startscreen; } - std::string GetStartScreenLink() const; - std::string GetTheme() const { return m_theme; } - std::string GetThemedLink(const std::string& type, const std::string& name) const { return "themes/" + GetTheme() + "/" + type + "/" + name; } - std::string GetLocalNetMask() const { return m_localnetmask; }; - bool GetIsLocalNet() const { return m_islocalnet; }; - std::string GetLastWhatsOnListMode() const { return m_lastwhatsonlistmode; } - std::string GetTntnetLogLevel() const { return m_tntnetloglevel; } - bool GetShowInfoBox() const { return m_showInfoBox != 0; } - void SetLastChannel(int lastChannel) { m_lastChannel = lastChannel; } - void SetAdminLogin(std::string login) { m_adminLogin = login; } - std::string SetAdminPassword(std::string password); - 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; } - void SetTheme(std::string theme) { m_theme = theme; } - void SetLocalNetMask(std::string localnetmask) { m_localnetmask = localnetmask; } - void SetIsLocalNet(bool islocalnet) { m_islocalnet = islocalnet; } - void SetLastWhatsOnListMode(std::string mode) { m_lastwhatsonlistmode = mode; SaveSetup(); } - void SetShowInfoBox(bool show) { m_showInfoBox = show ? 1 : 0; } - - bool SaveSetup(); - - bool ParseCommandLine( int argc, char* argv[] ); - char const* CommandLineHelp() const; - - bool ParseSetupEntry( char const* name, char const* value ); - - bool HaveEPGSearch(void); - bool CheckLocalNet(const std::string& ip); - -private: - Setup(); - Setup( Setup const& ); - - // me - cPlugin* liveplugin; - - mutable std::string m_helpString; - // commandline options - int m_serverPort; - IpList m_serverIps; - // setup options - int m_lastChannel; - int m_screenshotInterval; - - int m_useAuth; - std::string m_adminLogin; - std::string m_adminPasswordMD5; - std::string m_times; - std::string m_startscreen; - std::string m_theme; - std::string m_localnetmask; - bool m_islocalnet; - std::string m_lastwhatsonlistmode; - std::string m_tntnetloglevel; - int m_showInfoBox; - - bool CheckServerPort(); - bool CheckServerIps(); + public: + typedef std::list< std::string > IpList; + + // commandline + int GetServerPort() const { return m_serverPort; } + IpList const& GetServerIps() const { return m_serverIps; } + // vdr-setup + int GetLastChannel() const { return m_lastChannel == 0 ? std::numeric_limits< int >::max() : m_lastChannel; } + int GetScreenshotInterval() const { return m_screenshotInterval; } + std::string GetAdminLogin() const { return m_adminLogin; } + std::string GetMD5HashAdminPassword() const; + int GetAdminPasswordLength() const; + bool GetUseAuth() const { return m_useAuth; } + bool UseAuth() const; + std::string GetTimes() const { return m_times; } + std::string GetStartScreen() const { return m_startscreen; } + std::string GetStartScreenLink() const; + std::string GetTheme() const { return m_theme; } + std::string GetThemedLink(const std::string& type, const std::string& name) const { return "themes/" + GetTheme() + "/" + type + "/" + name; } + std::string GetLocalNetMask() const { return m_localnetmask; }; + bool GetIsLocalNet() const { return m_islocalnet; }; + std::string GetLastWhatsOnListMode() const { return m_lastwhatsonlistmode; } + std::string GetTntnetLogLevel() const { return m_tntnetloglevel; } + bool GetShowLogo() const { return m_showLogo != 0; } + bool GetUseAjax() const { return m_useAjax != 0; } + bool GetShowInfoBox() const { return m_showInfoBox != 0; } + + void SetLastChannel(int lastChannel) { m_lastChannel = lastChannel; } + void SetAdminLogin(std::string login) { m_adminLogin = login; } + std::string SetAdminPassword(std::string password); + 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; } + void SetTheme(std::string theme) { m_theme = theme; } + void SetLocalNetMask(std::string localnetmask) { m_localnetmask = localnetmask; } + void SetIsLocalNet(bool islocalnet) { m_islocalnet = islocalnet; } + void SetLastWhatsOnListMode(std::string mode) { m_lastwhatsonlistmode = mode; SaveSetup(); } + void SetShowLogo(bool show) { m_showLogo = show ? 1 : 0; } + void SetUseAjax(bool use) { m_useAjax = use ? 1 : 0; } + void SetShowInfoBox(bool show) { m_showInfoBox = show ? 1 : 0; } + + bool SaveSetup(); + + bool ParseCommandLine( int argc, char* argv[] ); + char const* CommandLineHelp() const; + + bool ParseSetupEntry( char const* name, char const* value ); + + bool HaveEPGSearch(void); + bool CheckLocalNet(const std::string& ip); + + private: + Setup(); + Setup( Setup const& ); + + // me + cPlugin* liveplugin; + + mutable std::string m_helpString; + // commandline options + int m_serverPort; + IpList m_serverIps; + // setup options + int m_lastChannel; + int m_screenshotInterval; + + int m_useAuth; + std::string m_adminLogin; + std::string m_adminPasswordMD5; + std::string m_times; + std::string m_startscreen; + std::string m_theme; + std::string m_localnetmask; + bool m_islocalnet; + std::string m_lastwhatsonlistmode; + std::string m_tntnetloglevel; + int m_showLogo; + int m_useAjax; + int m_showInfoBox; + + bool CheckServerPort(); + bool CheckServerIps(); }; Setup& LiveSetup(); class cMenuSetupLive : public cMenuSetupPage { -protected: - virtual void Store(void); - virtual eOSState ProcessKey(eKeys Key); -public: - cMenuSetupLive(); - -private: - int m_lastChannel; - int m_screenshotInterval; - - int m_useAuth; - char m_adminLogin[20]; - char m_adminPassword[20]; - char m_tmpPassword[20]; - std::string m_oldpasswordMD5; - std::string m_newpasswordMD5; - - void Set(void); - bool InEditMode(const char* ItemText, const char* ItemName, const char* ItemValue); + protected: + virtual void Store(void); + virtual eOSState ProcessKey(eKeys Key); + public: + cMenuSetupLive(); + + private: + int m_lastChannel; + int m_screenshotInterval; + + int m_useAuth; + char m_adminLogin[20]; + char m_adminPassword[20]; + char m_tmpPassword[20]; + std::string m_oldpasswordMD5; + std::string m_newpasswordMD5; + + void Set(void); + bool InEditMode(const char* ItemText, const char* ItemName, const char* ItemValue); }; } // namespace vdrlive -- cgit v1.2.3