Implemented application paths in template
authorAlexander Ebert <ebert@woltlab.com>
Sun, 5 Feb 2012 20:43:20 +0000 (21:43 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 5 Feb 2012 20:43:20 +0000 (21:43 +0100)
Important notice:
Do NOT use RELATIVE_WCF_DIR (or equal) in templates anymore, please use WCF::getPath('...') (use abbreviation) instead which resolves to the real domain path (e.g. WCF is on another domain/subdomain)

Removed image viewer templates, they're worthless anyway.

com.woltlab.wcf/template/headInclude.tpl
com.woltlab.wcf/template/imageViewer.tpl [deleted file]
wcfsetup/install/files/acp/templates/imageViewer.tpl [deleted file]
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index f1dd857c30dce6bc631d8a4f8930ef22d8805eed..d0a0a6bb2d047b672fdb70b51bd655cd910391aa 100644 (file)
@@ -7,14 +7,14 @@
 <script type="text/javascript">
        //<![CDATA[
        var SID_ARG_2ND = '{@SID_ARG_2ND_NOT_ENCODED}';
-       var RELATIVE_WCF_DIR = '{@RELATIVE_WCF_DIR}';
+       var RELATIVE_WCF_DIR = '{@$__wcf->getPath('wcf')}';
        var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
        //]]>
 </script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery.min.js"></script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery-ui.min.js"></script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery.tools.min.js"></script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/WCF.js"></script>
+<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/3rdParty/jquery.min.js"></script>
+<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/3rdParty/jquery-ui.min.js"></script>
+<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/3rdParty/jquery.tools.min.js"></script>
+<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/WCF.js"></script>
 <script type="text/javascript">
        //<![CDATA[
        WCF.User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}');
 
 <!-- Stylesheets -->
 <style type="text/css">
-       @import url("{@RELATIVE_WCF_DIR}acp/style/wcf.css") screen;
+       @import url("{@$__wcf->getPath('wcf')}acp/style/wcf.css") screen;
        
        {*
-       @import url("{@RELATIVE_WCF_DIR}acp/style/style-{@$__wcf->getLanguage()->getPageDirection()}.css") screen;
+       @import url("{@$__wcf->getPath('wcf')}acp/style/style-{@$__wcf->getLanguage()->getPageDirection()}.css") screen;
 
-       @import url("{@RELATIVE_WCF_DIR}acp/style/print.css") print;
+       @import url("{@$__wcf->getPath('wcf')}acp/style/print.css") print;
        *}
        
        {event name='stylesheetImport'}
diff --git a/com.woltlab.wcf/template/imageViewer.tpl b/com.woltlab.wcf/template/imageViewer.tpl
deleted file mode 100644 (file)
index a8dccce..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/ImageViewer.class.js"></script>
-<script type="text/javascript">
-       //<![CDATA[                     
-       // when the window is fully loaded, add image viewer
-       Event.observe(window, 'load', function() {
-               new ImageViewer($$('.enlargable'), {
-                       langCaption             : '{lang}wcf.imageViewer.caption{/lang}',
-                       langPrevious            : '{lang}wcf.imageViewer.previous{/lang}',
-                       langNext                : '{lang}wcf.imageViewer.next{/lang}',
-                       langPlay                : '{lang}wcf.imageViewer.play{/lang}',
-                       langPause               : '{lang}wcf.imageViewer.pause{/lang}',
-                       langEnlarge             : '{lang}wcf.imageViewer.enlarge{/lang}',
-                       langClose               : '{lang}wcf.imageViewer.close{/lang}',
-                       imgBlankSrc             : '{@RELATIVE_WCF_DIR}images/imageViewer/blank.png',
-                       imgMenuSrc              : '{@RELATIVE_WCF_DIR}images/imageViewer/menu.png',
-                       imgPlaySrc              : '{icon}imageViewer/playM.png{/icon}',
-                       imgPreviousSrc          : '{icon}imageViewer/previousM.png{/icon}',
-                       imgNextSrc              : '{icon}imageViewer/nextM.png{/icon}',
-                       imgEnlargeSrc           : '{icon}imageViewer/enlargeM.png{/icon}',
-                       imgPauseSrc             : '{icon}imageViewer/pauseM.png{/icon}',
-                       imgCloseSrc             : '{icon}imageViewer/closeM.png{/icon}',
-                       imgPlayHoverSrc         : '{icon}imageViewer/playHoverM.png{/icon}',
-                       imgPreviousHoverSrc     : '{icon}imageViewer/previousHoverM.png{/icon}',
-                       imgNextHoverSrc         : '{icon}imageViewer/nextHoverM.png{/icon}',
-                       imgEnlargeHoverSrc      : '{icon}imageViewer/enlargeHoverM.png{/icon}',
-                       imgPauseHoverSrc        : '{icon}imageViewer/pauseHoverM.png{/icon}',
-                       imgCloseHoverSrc        : '{icon}imageViewer/closeHoverM.png{/icon}'    
-               });
-       });
-//]]>
-</script>
\ No newline at end of file
diff --git a/wcfsetup/install/files/acp/templates/imageViewer.tpl b/wcfsetup/install/files/acp/templates/imageViewer.tpl
deleted file mode 100644 (file)
index be642a9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/ImageViewer.class.js"></script>
-<script type="text/javascript">
-       //<![CDATA[                     
-       // when the dom is fully loaded, add image viewer
-       document.observe("dom:loaded", function() {
-               new ImageViewer($$('.enlargable'), {
-                       langCaption             : '{lang}wcf.imageViewer.caption{/lang}',
-                       langPrevious            : '{lang}wcf.imageViewer.previous{/lang}',
-                       langNext                : '{lang}wcf.imageViewer.next{/lang}',
-                       langPlay                : '{lang}wcf.imageViewer.play{/lang}',
-                       langPause               : '{lang}wcf.imageViewer.pause{/lang}',
-                       langEnlarge             : '{lang}wcf.imageViewer.enlarge{/lang}',
-                       langClose               : '{lang}wcf.imageViewer.close{/lang}',
-                       imgBlankSrc             : '{@RELATIVE_WCF_DIR}images/imageViewer/blank.png',
-                       imgMenuSrc              : '{@RELATIVE_WCF_DIR}images/imageViewer/menu.png',
-                       imgPlaySrc              : '{@RELATIVE_WCF_DIR}icon/imageViewer/playM.png',
-                       imgPreviousSrc          : '{@RELATIVE_WCF_DIR}icon/imageViewer/previousM.png',
-                       imgNextSrc              : '{@RELATIVE_WCF_DIR}icon/imageViewer/nextM.png',
-                       imgEnlargeSrc           : '{@RELATIVE_WCF_DIR}icon/imageViewer/enlargeM.png',
-                       imgPauseSrc             : '{@RELATIVE_WCF_DIR}icon/imageViewer/pauseM.png',
-                       imgCloseSrc             : '{@RELATIVE_WCF_DIR}icon/imageViewer/closeM.png',
-                       imgPlayHoverSrc         : '{@RELATIVE_WCF_DIR}icon/imageViewer/playHoverM.png',
-                       imgPreviousHoverSrc     : '{@RELATIVE_WCF_DIR}icon/imageViewer/previousHoverM.png',
-                       imgNextHoverSrc         : '{@RELATIVE_WCF_DIR}icon/imageViewer/nextHoverM.png',
-                       imgEnlargeHoverSrc      : '{@RELATIVE_WCF_DIR}icon/imageViewer/enlargeHoverM.png',
-                       imgPauseHoverSrc        : '{@RELATIVE_WCF_DIR}icon/imageViewer/pauseHoverM.png',
-                       imgCloseHoverSrc        : '{@RELATIVE_WCF_DIR}icon/imageViewer/closeHoverM.png' 
-               });
-       });
-//]]>
-</script>
\ No newline at end of file
index 4414239bcdd4393a176d0ecdc8e973a11341d34c..b94c769825b9719a195b23dc0b22e5527a89642e 100644 (file)
@@ -41,6 +41,12 @@ if (!defined('NO_IMPORTS')) {
  * @category   Community Framework
  */
 class WCF {
+       /**
+        * list of currently loaded applications
+        * @var array<wcf\system\application\IApplication>
+        */
+       protected $applications = array();
+       
        /**
         * list of autoload directories
         * @var array
@@ -394,6 +400,10 @@ class WCF {
                $application = ApplicationHandler::getInstance()->getActiveApplication();
                $this->loadApplication($application);
                
+               // register primary application
+               $abbreviation = ApplicationHandler::getInstance()->getAbbreviation($application->packageID);
+               $this->applications[$abbreviation] = $application;
+               
                // start dependent applications
                $applications = ApplicationHandler::getInstance()->getDependentApplications();
                foreach ($applications as $application) {
@@ -446,6 +456,9 @@ class WCF {
                        // assign base tag
                        $this->getTPL()->assign('baseHref', $application->domainName . $application->domainPath);
                }
+               
+               // register application
+               $this->applications[$abbreviation] = $application;
        }
        
        /**
@@ -589,4 +602,24 @@ class WCF {
                if (!defined('ENABLE_BENCHMARK') || ENABLE_BENCHMARK) return true;
                return false;
        }
+       
+       /**
+        * Returns domain path for given application.
+        * 
+        * @param       string          $abbreviation
+        * @return      string
+        */
+       public function getPath($abbreviation = 'wcf') {
+               if (empty($this->applications)) {
+                       $this->applications = array(
+                               'wcf' => new Application(1)
+                       );
+               }
+               
+               if (!isset($this->applications[$abbreviation])) {
+                       $abbreviation = 'wcf';
+               }
+               
+               return $this->applications[$abbreviation]->domainName . $this->applications[$abbreviation]->domainPath;
+       }
 }
index 0d0410cf6a4e3d14d61a425bab322445afb57f91..1dc8f031f9c39d2d8c15f65b8426a1ef0e1a571a 100644 (file)
@@ -26,7 +26,7 @@
                <item name="wcf.acp.cronjob.className"><![CDATA[Klassenname]]></item>
                <item name="wcf.acp.cronjob.data"><![CDATA[Allgemeine Daten]]></item>
                <item name="wcf.acp.cronjob.timing"><![CDATA[Zeitsteuerung]]></item>
-               <item name="wcf.acp.cronjob.intro"><![CDATA[Das Anlegen von Cronjobs (zeitgesteuerten Aufgaben) erfordert eine genaue Kenntnis der Crontab-Syntax auf unixähnlichen Systemen. Weiterführende Informationen dazu erhalten Sie auf dieser Website: <a href="{@RELATIVE_WCF_DIR}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron</a>]]></item>
+               <item name="wcf.acp.cronjob.intro"><![CDATA[Das Anlegen von Cronjobs (zeitgesteuerten Aufgaben) erfordert eine genaue Kenntnis der Crontab-Syntax auf unixähnlichen Systemen. Weiterführende Informationen dazu erhalten Sie auf dieser Website: <a href="{@$__wcf->getPath('wcf')}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron</a>]]></item>
                <item name="wcf.acp.cronjob.execute"><![CDATA[Cronjob jetzt ausführen]]></item>
                <item name="wcf.acp.cronjob.className.error.doesNotExist"><![CDATA[Eine Klasse mit dem angegeben Namen existiert nicht.]]></item>
                <item name="wcf.acp.cronjob.timing.error.notValid"><![CDATA[Das Zeitformat ist ungültig.]]></item>
index 20eb8928628de4ad3a9d1953bfae20291bebc287..a742d0fa84f2519e14ec2715088bf63f1c71e941 100644 (file)
@@ -26,7 +26,7 @@
                <item name="wcf.acp.cronjob.className"><![CDATA[Class name]]></item>
                <item name="wcf.acp.cronjob.data"><![CDATA[General information]]></item>
                <item name="wcf.acp.cronjob.timing"><![CDATA[Schedule]]></item>
-               <item name="wcf.acp.cronjob.intro"><![CDATA[Configuring cron jobs (automatized scheduled tasks) requires distinct knowledge of the crontab syntax on Unix based systems. More information about this topic can be obtained on the following Webpage: <a href="{@RELATIVE_WCF_DIR}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron</a>.]]></item>
+               <item name="wcf.acp.cronjob.intro"><![CDATA[Configuring cron jobs (automatized scheduled tasks) requires distinct knowledge of the crontab syntax on Unix based systems. More information about this topic can be obtained on the following Webpage: <a href="{@$__wcf->getPath('wcf')}acp/dereferrer.php?url={"http://www.unixgeeks.org/security/newbie/unix/cron-1.html"|rawurlencode}" class="externalURL">Newbie: Intro to cron</a>.]]></item>
                <item name="wcf.acp.cronjob.execute"><![CDATA[Execute cron job now]]></item>
                <item name="wcf.acp.cronjob.className.error.doesNotExist"><![CDATA[There is no class with the given name.]]></item>
                <item name="wcf.acp.cronjob.timing.error.notValid"><![CDATA[The timings you have set are invalid.]]></item>