Allow the logo link to optionally lead to the app main instead of the global landing...
authorAlexander Ebert <ebert@woltlab.com>
Sun, 22 Oct 2017 11:57:13 +0000 (13:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 22 Oct 2017 11:57:13 +0000 (13:57 +0200)
Closes #2450

com.woltlab.wcf/option.xml
com.woltlab.wcf/templates/pageHeaderLogo.tpl
constants.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/request/LinkHandler.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 12b35f82425abb78ebb51b2c56656a2f29650584..fee3bca1210623bdd85f33ae2923da1f9889a4cb 100644 (file)
                                <optiontype>desktopNotificationApplicationSelect</optiontype>
                                <defaultvalue>1</defaultvalue>
                        </option>
+                       <option name="page_logo_link_to_app_default">
+                               <categoryname>general.page</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                       </option>
                        <option name="head_code">
                                <categoryname>general.page</categoryname>
                                <optiontype>textarea</optiontype>
index 79d5a4f1318d8bbbd45715684103ddaded8c670f..5a210b5ff016700f784b82e93c38d0b234651971 100644 (file)
@@ -1,7 +1,7 @@
 <div id="pageHeaderLogo" class="pageHeaderLogo">
        {if MODULE_WCF_AD && $__disableAds|empty}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.logo')}{/if}
        
-       <a href="{link}{/link}">
+       <a href="{if PAGE_LOGO_LINK_TO_APP_DEFAULT}{link application=$__wcf->getActiveApplication()->getAbbreviation()}{/link}{else}{link}{/link}{/if}">
                <img src="{$__wcf->getStyleHandler()->getStyle()->getPageLogo()}" alt="" class="pageHeaderLogoLarge" style="{if $__wcf->getStyleHandler()->getStyle()->getVariable('pageLogoWidth')}width: {@$__wcf->getStyleHandler()->getStyle()->getVariable('pageLogoWidth')}px;{/if}{if $__wcf->getStyleHandler()->getStyle()->getVariable('pageLogoHeight')}height: {@$__wcf->getStyleHandler()->getStyle()->getVariable('pageLogoHeight')}px{/if}">
                <img src="{$__wcf->getStyleHandler()->getStyle()->getPageLogoMobile()}" alt="" class="pageHeaderLogoSmall">
                
index 272ac696bb6ec8797df7be059751ec043d955100..8a36ba0f8061b3a9fa18f9ad68ba6bd0c05acd0a 100644 (file)
@@ -234,3 +234,4 @@ define('MODULE_TROPHY', 1);
 define('ENABLE_DEVELOPER_TOOLS', 0);
 define('FORCE_LOGIN', 0);
 define('DESKTOP_NOTIFICATION_PACKAGE_ID', 1);
+define('PAGE_LOGO_LINK_TO_APP_DEFAULT', 1);
index 521453d2aa9b1886800e3d2bb5259275cbd7addc..4f1652e8d3de49a1b7e054fca805e10c2e313340 100644 (file)
@@ -643,6 +643,15 @@ class WCF {
                return null;
        }
        
+       /**
+        * Returns the invoked application.
+        * 
+        * @return      Application
+        */
+       public static function getActiveApplication() {
+               return ApplicationHandler::getInstance()->getActiveApplication();
+       }
+       
        /**
         * Loads an application on runtime, do not use this outside the package installation.
         * 
index cd563015444ee72ba09054dfafc62f9b80cc727a..b2c91e2e61d013f216763a90922f101e479b31a8 100644 (file)
@@ -123,6 +123,22 @@ class LinkHandler extends SingletonFactory {
                                $controller = 'Index';
                        }
                        else {
+                               if (!empty($parameters['application']) && $abbreviation !== 'wcf') {
+                                       $application = ApplicationHandler::getInstance()->getApplication($abbreviation);
+                                       if ($application === null) {
+                                               throw new \RuntimeException("Unknown abbreviation '" . $abbreviation . "'.");
+                                       }
+                                       
+                                       $landingPage = PageCache::getInstance()->getPage($application->landingPageID);
+                                       if ($landingPage === null) {
+                                               $landingPage = PageCache::getInstance()->getPageByController(WCF::getApplicationObject($application)->getPrimaryController());
+                                       }
+                                       
+                                       if ($landingPage !== null) {
+                                               return $landingPage->getLink();
+                                       }
+                               }
+                               
                                return PageCache::getInstance()->getLandingPage()->getLink();
                        }
                }
index 6cf99459c58f02225009e287a711de6cef23837f..72e2d1c4e50eb8fa30d604396d5d0cd41c932e33 100644 (file)
@@ -1424,6 +1424,8 @@ Als Benachrichtigungs-URL in der Konfiguration der sofortigen Zahlungsbestätigu
                <item name="wcf.acp.option.force_login.description"><![CDATA[Besucher werden aufgefordert sich anzumelden, um auf die Inhalte zugreifen zu können.]]></item>
                <item name="wcf.acp.option.desktop_notification_package_id"><![CDATA[Primäre Domain für Desktop-Benachrichtigungen]]></item>
                <item name="wcf.acp.option.desktop_notification_package_id.description"><![CDATA[Desktop-Benachrichtigungen werden nur für die ausgewählte App aktiviert, einschließlich aller anderen Apps die auf der identischen Domain laufen.]]></item>
+               <item name="wcf.acp.option.page_logo_link_to_app_default"><![CDATA[Seitenlogo verlinkt auf die Startseite der aktiven App]]></item>
+               <item name="wcf.acp.option.page_logo_link_to_app_default.description"><![CDATA[Deaktiviere{if !LANGUAGE_USE_INFORMAL_VARIANT}n Sie{/if} diese Option, damit das Logo stets auf die globale Startseite verlinkt. Die Deaktivierung entspricht dem Verhalten in früheren Versionen.]]></item>
        </category>
        
        <category name="wcf.acp.customOption">
index 1f538eb6c74c0f9a502a569e1ec8fa19065de9dd..367c502493635161baea6f584d3322eda4b0ad0d 100644 (file)
@@ -1417,6 +1417,8 @@ When prompted for the notification URL for the instant payment notifications, pl
                <item name="wcf.acp.option.force_login.description"><![CDATA[Visitors are required to log-in themselves to access the page.]]></item>
                <item name="wcf.acp.option.desktop_notification_package_id"><![CDATA[Primary Domain for Desktop Notifications]]></item>
                <item name="wcf.acp.option.desktop_notification_package_id.description"><![CDATA[Desktop Notifications will be enabled for the selected app only, including all other apps that use the exact same domain.]]></item>
+               <item name="wcf.acp.option.page_logo_link_to_app_default"><![CDATA[Page logo links to the start page of the active app]]></item>
+               <item name="wcf.acp.option.page_logo_link_to_app_default.description"><![CDATA[Disabling this option will cause the link to always point to the global landing page instead. This option enforces the behavior known from previous versions when disabled.]]></item>
        </category>
        
        <category name="wcf.acp.customOption">