Front end template overhaul; new template events added
authorMarcel Werk <burntime@woltlab.com>
Fri, 23 Sep 2011 18:51:15 +0000 (20:51 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 23 Sep 2011 18:51:15 +0000 (20:51 +0200)
com.woltlab.wcf/template/footer.tpl
com.woltlab.wcf/template/headInclude.tpl
com.woltlab.wcf/template/header.tpl
com.woltlab.wcf/template/headerMenu.tpl [deleted file]
com.woltlab.wcf/template/mainMenu.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/template/plugin/EventPrefilterTemplatePlugin.class.php

index 88357a63ece57d9a11f6ece4f93da05b5da0ce2d..e1eb0af66d98400166f2d421aa7edb9412fbea33 100644 (file)
@@ -9,7 +9,7 @@
                <div>
                        {include file=footerMenu}
                </div>
-               <small class="copyright"><a href="http://www.woltlab.com" title="Go to the WoltLab website">Copyright &copy; 2001-2011 WoltLab&reg; GmbH</a></small>
+               {event name='copyright'}
        </footer>
        <!-- /FOOTER -->
        <a id="bottom"></a>
index 2b7746d8ad039ae85eaf081953fddf50d5a13f30..957130304bb0f823a3482c2ab87950c90b0f3fea 100644 (file)
        WCF.User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}');
        //]]>
 </script>
-
-{*
-{if $specialStyles|isset}
-       <!-- special styles -->
-       {@$specialStyles}
-{/if}
-*}
+{event name='javascriptInclude'}
 
 <!-- Stylesheets -->
 <style type="text/css">
        @import url("{@RELATIVE_WCF_DIR}acp/style/style.css") screen;
-       {*
        
+       {*
        @import url("{@RELATIVE_WCF_DIR}acp/style/style-{@$__wcf->getLanguage()->getPageDirection()}.css") screen;
 
        @import url("{@RELATIVE_WCF_DIR}acp/style/print.css") print;
        *}
+       
+       {event name='stylesheetImport'}
 </style>
+
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               WCF.Language.addObject({
+                       'wcf.global.button.next': '{lang}wcf.global.button.next{/lang}',
+                       'wcf.global.loading': '{lang}wcf.global.loading{/lang}',
+                       'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}',
+                       'wcf.date.relative.hours': '{capture assign=relativeHours}{lang}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}',
+                       'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}',
+                       'wcf.date.dateTimeFormat': '{lang}wcf.date.dateTimeFormat{/lang}',
+                       '__days': [ '{lang}wcf.date.day.sunday{/lang}', '{lang}wcf.date.day.monday{/lang}', '{lang}wcf.date.day.tuesday{/lang}', '{lang}wcf.date.day.wednesday{/lang}', '{lang}wcf.date.day.thursday{/lang}', '{lang}wcf.date.day.friday{/lang}', '{lang}wcf.date.day.saturday{/lang}' ],
+                       'wcf.global.thousandsSeparator': '{capture assign=thousandsSeparator}{lang}wcf.global.thousandsSeparator{/lang}{/capture}{@$thousandsSeparator|encodeJS}',
+                       'wcf.global.decimalPoint': '{capture assign=decimalPoint}{lang}wcf.global.decimalPoint{/lang}{/capture}{$decimalPoint|encodeJS}',
+                       'wcf.global.page.next': '{capture assign=pageNext}{lang}wcf.global.page.next{/lang}{/capture}{@$pageNext|encodeJS}',
+                       'wcf.global.page.previous': '{capture assign=pagePrevious}{lang}wcf.global.page.previous{/lang}{/capture}{@$pagePrevious|encodeJS}'
+                       {event name='javascriptLanguageImport'}
+               });
+               new WCF.Date.Time();
+               new WCF.Effect.SmoothScroll();
+               new WCF.Effect.BalloonTooltip();
+
+               {event name='javascriptInit'}
+       });
+       //]]>
+</script>
\ No newline at end of file
index 3a8a3d923172a9a1318d045a0e0d877068e38ce0..dd1b18e3499490391d84773c2775e8f698a232d5 100644 (file)
@@ -1,11 +1,48 @@
 <a id="top"></a>
 <!-- HEADER -->
 <header class="pageHeader">
-       {event name='pageHeaderStart'}
-       
-       {include file=headerMenu}
-       
-       {event name='pageHeaderEnd'}
+       <div>
+               {hascontent}
+                       <!-- top menu -->
+                       <nav id="topMenu" class="topMenu">
+                               <div>
+                                       <ul>
+                                               {content}{event name='topMenu'}{/content}
+                                       </ul>
+                               </div>
+                       </nav>
+                       <!-- /top menu -->
+               {/hascontent}
+               
+               <!-- logo -->
+               <div id="logo" class="logo">
+                       <!-- clickable area -->
+                       <a href="{link}index.php{/link}">
+                               <!-- *** insert header logo here -->
+                       </a>
+                       <!-- /clickable area -->
+                       
+                       <!-- search area -->
+                       {event name='searchArea'}
+                       <!-- /search area -->
+               </div>
+               <!-- /logo -->
+               
+               <!-- main menu -->
+               {include file='mainMenu'}
+               <!-- /main menu -->
+               
+               <!-- header navigation -->
+               <nav class="headerNavigation">
+                       <div>
+                               <ul>
+                                       {event name='headerNavigation'}
+                                       <li id="toBottomLink" class="toBottomLink"><a href="#bottom" title="{lang}wcf.global.scrollDown{/lang}" class="balloonTooltip"><img src="{@RELATIVE_WCF_DIR}icon/toBottom.svg" alt="" /> <span class="invisible">{lang}wcf.global.scrollDown{/lang}</span></a></li>
+                               </ul>
+                       </div>
+               </nav>
+               <!-- /header navigation -->
+       </div>
 </header>
 <!-- /HEADER -->
 
diff --git a/com.woltlab.wcf/template/headerMenu.tpl b/com.woltlab.wcf/template/headerMenu.tpl
deleted file mode 100644 (file)
index 83e3a74..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{if $__wcf->getPageMenu()->getMenuItems('header')|count > 0}
-       <nav id="mainMenu" class="mainMenu">
-               <ul>
-                       {foreach from=$__wcf->getPageMenu()->getMenuItems('header') item=menuItem}
-                               <li><a href="{$menuItem->menuItemLink}">{$menuItem->menuItem} ({#$menuItem->getProcessor()->getNotifications()})</a>
-                               
-                               {if $__wcf->getPageMenu()->getMenuItems($menuItem->menuItem)|count > 0}
-                                       <ul>
-                                               {foreach from=$__wcf->getPageMenu()->getMenuItems($menuItem->menuItem) item=subMenuItem}
-                                                       <li><a href="{$subMenuItem->menuItemLink}">{$subMenuItem->menuItem} ({#$subMenuItem->getProcessor()->getNotifications()})</a></li>
-                                               {/foreach}
-                                       </ul>
-                               {/if}
-                               
-                               </li>
-                       {/foreach}
-               </ul>
-       </nav>
-{/if}
diff --git a/com.woltlab.wcf/template/mainMenu.tpl b/com.woltlab.wcf/template/mainMenu.tpl
new file mode 100644 (file)
index 0000000..83e3a74
--- /dev/null
@@ -0,0 +1,19 @@
+{if $__wcf->getPageMenu()->getMenuItems('header')|count > 0}
+       <nav id="mainMenu" class="mainMenu">
+               <ul>
+                       {foreach from=$__wcf->getPageMenu()->getMenuItems('header') item=menuItem}
+                               <li><a href="{$menuItem->menuItemLink}">{$menuItem->menuItem} ({#$menuItem->getProcessor()->getNotifications()})</a>
+                               
+                               {if $__wcf->getPageMenu()->getMenuItems($menuItem->menuItem)|count > 0}
+                                       <ul>
+                                               {foreach from=$__wcf->getPageMenu()->getMenuItems($menuItem->menuItem) item=subMenuItem}
+                                                       <li><a href="{$subMenuItem->menuItemLink}">{$subMenuItem->menuItem} ({#$subMenuItem->getProcessor()->getNotifications()})</a></li>
+                                               {/foreach}
+                                       </ul>
+                               {/if}
+                               
+                               </li>
+                       {/foreach}
+               </ul>
+       </nav>
+{/if}
index f203d51818590f28d5875c132d7b764386592e28..b9757dbc2fa8a524236a651e148502bc836d545c 100644 (file)
@@ -732,7 +732,7 @@ class TemplateEngine extends SingletonFactory {
         */
        protected function loadTemplateListenerCode($templateName) {
                // cache was already loaded
-               if (count($this->templateListeners[$templateName])) return;
+               if (!isset($this->templateListeners[$templateName]) || count($this->templateListeners[$templateName])) return;
                
                $cacheName = PACKAGE_ID.'-'.$this->environment.'-'.$templateName;
                CacheHandler::getInstance()->addResource(
index d30a3e5559c0d7e75012cd90859c07c19b69ccae..85c4f7d69ba8e18ebf06049497fceba6dc23a0ed 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\template\plugin;
 use wcf\system\template\TemplateScriptingCompiler;
+use wcf\system\WCF;
 
 /**
  * The 'event' prefilter inserts template listener's code before compilation.
@@ -22,7 +23,9 @@ class EventPrefilterTemplatePlugin implements IPrefilterTemplatePlugin {
        public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler) {
                $ldq = preg_quote($compiler->getLeftDelimiter(), '~');
                $rdq = preg_quote($compiler->getRightDelimiter(), '~');
-               $sourceContent = preg_replace("~{$ldq}event\ name\=\'([\w]+)\'{$rdq}~e", 'wcf\system\WCF::getTPL()->getTemplateListenerCode(\''.$templateName.'\', \'$1\')', $sourceContent);
+               $sourceContent = preg_replace_callback("~{$ldq}event\ name\=\'([\w]+)\'{$rdq}~", function ($match) use ($templateName) {
+                       return WCF::getTPL()->getTemplateListenerCode($templateName, $match[1]);
+               }, $sourceContent);
                
                return $sourceContent;
        }