<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
</option>
+ <option name="show_style_changer">
+ <categoryname>general.page</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ </option>
<option name="footer_code">
<categoryname>general.page</categoryname>
<optiontype>textarea</optiontype>
url: '{link controller="BackgroundQueuePerform"}{/link}',
force: {if $forceBackgroundQueuePerform|isset}true{else}false{/if}
},
- styleChanger: {if $__wcf->getStyleHandler()->countStyles() > 1}true{else}false{/if}
+ styleChanger: {if $__wcf->getStyleHandler()->showStyleChanger()}true{else}false{/if}
});
User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}');
<footer id="pageFooter" class="pageFooter">
- {hascontent}
+ {assign var=__boxesFooter value=$__wcf->getBoxHandler()->getBoxes('footer')}
+ {assign var=__showStyleChanger value=$__wcf->getStyleHandler()->showStyleChanger()}
+
+ {if $__boxesFooter|count || $__showStyleChanger}
<div class="boxesFooter">
- <div class="layoutBoundary">
- <div class="boxContainer">
- {content}
- {foreach from=$__wcf->getBoxHandler()->getBoxes('footer') item=box}
+ <div class="layoutBoundary{if $__showStyleChanger} clearfix{/if}">
+ {if $__showStyleChanger}
+ <span class="styleChanger">
+ <a href="#" class="jsButtonStyleChanger">{lang}wcf.style.changeStyle{/lang}</a>
+ </span>
+ {/if}
+ {if $__boxesFooter|count}
+ <div class="boxContainer">
+ {foreach from=$__boxesFooter item=box}
{@$box->render()}
{/foreach}
- {/content}
- </div>
+ </div>
+ {/if}
</div>
</div>
- {/hascontent}
+ {/if}
{hascontent}
<div id="pageFooterCopyright" class="pageFooterCopyright">
define('ARTICLE_RELATED_ARTICLES_MATCH_THRESHOLD', 1);
define('SHOW_UPDATE_NOTICE_FRONTEND', 1);
define('LANGUAGE_USE_INFORMAL_VARIANT', 0);
+define('SHOW_STYLE_CHANGER', 0);
Bootstrap.setup();
if (options.styleChanger) {
- //ControllerStyleChanger.setup();
+ ControllerStyleChanger.setup();
}
this._initUserPopover();
* Dialog based style changer.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLab/WCF/Controller/Style/Changer
*/
/**
* @exports WoltLab/WCF/Controller/Style/Changer
*/
- var ControllerStyleChanger = {
+ return {
/**
* Adds the style changer to the bottom navigation.
*/
setup: function() {
- var list = elBySel('#footerNavigation > ul.navigationItems');
- if (list === null) {
- return;
+ var link = elBySel('.jsButtonStyleChanger');
+ if (link) {
+ link.addEventListener(WCF_CLICK_EVENT, this.showDialog.bind(this));
}
-
- var listItem = elCreate('li');
- listItem.classList.add('styleChanger');
- listItem.addEventListener(WCF_CLICK_EVENT, this.showDialog.bind(this));
-
- var link = elCreate('a');
- elAttr(link, 'href', '#');
- link.textContent = Language.get('wcf.style.changeStyle');
- listItem.appendChild(link);
-
- list.appendChild(listItem);
},
/**
});
}
};
-
- return ControllerStyleChanger;
});
use wcf\data\AbstractDatabaseObjectAction;
use wcf\data\IToggleAction;
use wcf\data\IUploadAction;
+use wcf\data\user\UserAction;
use wcf\system\cache\builder\StyleCacheBuilder;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
StyleHandler::getInstance()->changeStyle($this->style->styleID);
if (StyleHandler::getInstance()->getStyle()->styleID == $this->style->styleID) {
WCF::getSession()->setStyleID($this->style->styleID);
+
+ if (WCF::getUser()->userID) {
+ // set this as the permanent style
+ $userAction = new UserAction([WCF::getUser()], 'update', ['data' => [
+ 'styleID' => ($this->style->isDefault ? 0 : $this->style->styleID)
+ ]]);
+ $userAction->executeAction();
+ }
}
}
return null;
}
+
+ /**
+ * Returns true if there is more than one available style and the changer is to be displayed.
+ *
+ * @return boolean true if style changer should be displayed
+ */
+ public function showStyleChanger() {
+ return ($this->countStyles() && SHOW_STYLE_CHANGER);
+ }
}
}
}
}
+
+ .styleChanger {
+ @include screen-sm-down {
+ display: none;
+ }
+
+ @include screen-md-up {
+ float: right;
+ padding-left: 20px;
+ }
+ }
}