diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-07-18 23:48:14 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-07-18 23:48:14 +0000 |
commit | f6f71da928b975fd39afee1d639b495bcdeff9b8 (patch) | |
tree | 03e3e64d26080184ab28d90445e6fa2f2d99c091 | |
parent | 440d211c5084980e959ed269d468900d69a82cc2 (diff) | |
download | vdr-plugin-live-f6f71da928b975fd39afee1d639b495bcdeff9b8.tar.gz vdr-plugin-live-f6f71da928b975fd39afee1d639b495bcdeff9b8.tar.bz2 |
- 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.
-rw-r--r-- | i18n.cpp | 46 | ||||
-rw-r--r-- | pages/pageelems.ecpp | 17 | ||||
-rw-r--r-- | pages/setup.ecpp | 34 | ||||
-rw-r--r-- | setup.cpp | 6 | ||||
-rw-r--r-- | setup.h | 197 |
5 files changed, 200 insertions, 100 deletions
@@ -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> <div class="page_header"> +<%cpp> + if (LiveSetup().GetShowLogo()) { +</%cpp> <a href="<$ LiveSetup().GetStartScreenLink()$>"> <img src="<$ LiveSetup().GetThemedLink("img", "logo.png") $>" alt="VDR Live!" class="logo"></img></a> -<%cpp>if (LiveSetup().GetShowInfoBox()) { </%cpp><& infobox &><%cpp> } </%cpp> +<%cpp> + } +</%cpp> +<%cpp>if (LiveSetup().GetUseAjax() && LiveSetup().GetShowInfoBox()) { </%cpp><& infobox &><%cpp> } </%cpp> </div> <div style="clear: both"></div> +<%cpp> + } +</%cpp> </%def> <# ---------------------------------------------------------------------- #> @@ -123,6 +136,7 @@ int update_status(1); <# ---------------------------------------------------------------------- #> <%def ajax_js> +<%cpp>if (LiveSetup().GetUseAjax()) { </%cpp> <script type="text/javascript" src="js/mootools/mootools.v1.11.js"></script> <script type="text/javascript" src="js/live/liveajax.js"></script> <script type="text/javascript" src="js/live/infowin.js"></script> @@ -139,6 +153,7 @@ int update_status(1); }); --></script> <%cpp> } </%cpp> +<%cpp> } </%cpp> </%def> <# ---------------------------------------------------------------------- #> 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; </%args> @@ -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" : ""; + </%cpp> <& pageelems.doc_type &> <html> @@ -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"); + } //--></script> </head> <body onload="initform()"> @@ -131,9 +145,23 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); </td> </tr> <tr> - <td class="label leftcol"><div class="withmargin"><$ tr("Show dynamic VDR information box") $>:</div></td> + <td class="label leftcol"><div class="withmargin"><$ tr("Show live logo image") $>:</div></td> <td class="rightcol"> - <input type="checkbox" name="showInfoBox" id="showInfoBox" value="1" <%cpp> CHECKIF(!showInfoBox.empty()); </%cpp>/> + <input type="checkbox" name="showLogo" id="showLogo" value="1" <%cpp> CHECKIF(!showLogo.empty()); </%cpp>/> + </td> + </tr> + <tr> + <td class="label leftcol"><div class="withmargin"><$ tr("Use ajax technology") $>:</div></td> + <td class="rightcol"> + <input type="checkbox" name="useAjax" id="useAjax" value="1" <%cpp> CHECKIF(!useAjax.empty()); </%cpp> onclick="changeduseajax(this)"/> + <div id="ajaxsection" style="display: none"> + <table border="0" cellpadding="0" cellspacing="0" class="dependent"> + <tr> + <td class="label"><div class="withmargin"><$ tr("Show dynamic VDR information box") $>:</div></td> + <td><input type="checkbox" name="showInfoBox" id="showInfoBox" value="1" <%cpp> CHECKIF(!showInfoBox.empty()); </%cpp>/></td> + </tr> + </table> + </div> </td> </tr> <tr> @@ -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; } @@ -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 |