<permissions>admin.style.canManageStyle</permissions>
<icon>fa-plus</icon>
</acpmenuitem>
+
+ <acpmenuitem name="wcf.acp.menu.link.style.globalValues">
+ <controller>wcf\acp\form\StyleGlobalValuesForm</controller>
+ <parent>wcf.acp.menu.link.style</parent>
+ <permissions>admin.style.canManageStyle</permissions>
+ </acpmenuitem>
<!-- /style -->
<!-- template -->
--- /dev/null
+{include file='header' pageTitle='wcf.acp.style.globalValues'}
+
+<header class="contentHeader">
+ <div class="contentHeaderTitle">
+ <h1 class="contentTitle">{lang}wcf.acp.style.globalValues{/lang}</h1>
+ <p class="contentHeaderDescription">{lang}wcf.acp.style.globalValues.description{/lang}</p>
+ </div>
+
+ <nav class="contentHeaderNavigation">
+ <ul>
+ <li><a href="{link controller='StyleList'}{/link}" class="button"><span class="icon icon16 fa-list"></span> <span>{lang}wcf.acp.menu.link.style.list{/lang}</span></a></li>
+
+ {event name='contentHeaderNavigation'}
+ </ul>
+ </nav>
+</header>
+
+{include file='formError'}
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.success{/lang}</p>
+{/if}
+
+<form method="post" action="{link controller='StyleGlobalValues'}{/link}">
+ <div class="section">
+ <dl>
+ <dt>{lang}wcf.acp.style.globalValues.input{/lang}</dt>
+ <dd>
+ <div dir="ltr">
+ <textarea id="styles" rows="20" cols="40" name="styles" style="visibility: hidden">{$styles}</textarea>
+ </div>
+ </dd>
+ </dl>
+ {include file='codemirror' codemirrorMode='text/x-less' codemirrorSelector='#styles'}
+ </div>
+
+ {event name='sections'}
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
+ {@SECURITY_TOKEN_INPUT_TAG}
+ </div>
+</form>
+
+{include file='footer'}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\form\AbstractForm;
+use wcf\system\style\StyleCompiler;
+use wcf\system\style\StyleHandler;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the form input for global style values.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2017 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Acp\Form
+ */
+class StyleGlobalValuesForm extends AbstractForm {
+ /**
+ * @inheritDoc
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.style.globalValues';
+
+ /**
+ * global SCSS styles
+ * @var string
+ */
+ public $styles = '';
+
+ /**
+ * @inheritDoc
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ if (isset($_POST['styles'])) {
+ $this->styles = StringUtil::unifyNewlines(StringUtil::trim($_POST['styles']));
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function readData() {
+ parent::readData();
+
+ if (file_exists(WCF_DIR . StyleCompiler::FILE_GLOBAL_VALUES)) {
+ $this->styles = file_get_contents(WCF_DIR . StyleCompiler::FILE_GLOBAL_VALUES);
+ // strip the first line which will always contain a comment
+ $this->styles = explode("\n", $this->styles, 2)[1];
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function save() {
+ parent::save();
+
+ if (empty($this->styles)) {
+ if (file_exists(WCF_DIR . StyleCompiler::FILE_GLOBAL_VALUES)) {
+ unlink(WCF_DIR . StyleCompiler::FILE_GLOBAL_VALUES);
+ }
+ }
+ else {
+ file_put_contents(WCF_DIR . StyleCompiler::FILE_GLOBAL_VALUES, "/* DO NOT EDIT THIS FILE -- Dynamic global SCSS values, generated at ".date('r', TIME_NOW)." */\n" . $this->styles);
+ }
+
+ // call saved event
+ $this->saved();
+
+ // reset stylesheets
+ StyleHandler::resetStylesheets(false);
+
+ WCF::getTPL()->assign('success', true);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign([
+ 'styles' => $this->styles
+ ]);
+ }
+}
*/
public static $supportedOptionType = ['boolean', 'integer'];
+ /**
+ * file used to store global SCSS declarations, relative to `WCF_DIR`
+ * @var string
+ */
+ const FILE_GLOBAL_VALUES = 'style/ui/zzz_wsc_style_global_values.scss';
+
/**
* @inheritDoc
*/
1
]);
while ($row = $statement->fetchArray()) {
+ // the global values will always be evaluated last
+ if ($row['filename'] === self::FILE_GLOBAL_VALUES) {
+ continue;
+ }
+
$files[] = Application::getDirectory($row['application']).$row['filename'];
}
+ // global SCSS
+ if (file_exists(WCF_DIR . self::FILE_GLOBAL_VALUES)) {
+ $files[] = WCF_DIR . self::FILE_GLOBAL_VALUES;
+ }
+
// get style variables
$variables = $style->getVariables();
$individualScss = '';
<item name="wcf.acp.menu.link.package.list"><![CDATA[Pakete]]></item>
<item name="wcf.acp.menu.link.style"><![CDATA[Stile]]></item>
<item name="wcf.acp.menu.link.style.add"><![CDATA[Stil hinzufügen]]></item>
+ <item name="wcf.acp.menu.link.style.globalValues"><![CDATA[Stilunabhängiges CSS und SCSS]]></item>
<item name="wcf.acp.menu.link.style.import"><![CDATA[Stil importieren]]></item>
<item name="wcf.acp.menu.link.style.list"><![CDATA[Stile]]></item>
<item name="wcf.acp.menu.link.configuration"><![CDATA[Konfiguration]]></item>
<item name="wcf.acp.style.globals.fontSize"><![CDATA[Schriftgröße]]></item>
<item name="wcf.acp.style.globals.layout"><![CDATA[Layout]]></item>
<item name="wcf.acp.style.globals.useFluidLayout"><![CDATA[Flexible Breite verwenden]]></item>
+ <item name="wcf.acp.style.globalValues"><![CDATA[Stilunabhängiges CSS und SCSS]]></item>
+ <item name="wcf.acp.style.globalValues.description"><![CDATA[Das unten stehende CSS und SCSS wird auf alle Stile angewandt, die individuelle Anpassungen in den Stilen sind jedoch höherwertig.]]></item>
+ <item name="wcf.acp.style.globalValues.input"><![CDATA[Individuelles CSS und SCSS]]></item>
<item name="wcf.acp.style.image"><![CDATA[Vorschaubild]]></item>
<item name="wcf.acp.style.image.description"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Lade{else}Laden Sie{/if} hier ein Vorschaubild dieses Stiles hoch, als Bildformate sind JPG und PNG zulässig. Es wird empfohlen Vorschaubilder immer mit der Größe 102px × 64px anzulegen, größere Grafiken werden automatisch skaliert.]]></item>
<item name="wcf.acp.style.image2x"><![CDATA[Vorschaubild (HD)]]></item>
<item name="wcf.acp.menu.link.package.list"><![CDATA[Packages]]></item>
<item name="wcf.acp.menu.link.style"><![CDATA[Styles]]></item>
<item name="wcf.acp.menu.link.style.add"><![CDATA[Add Style]]></item>
+ <item name="wcf.acp.menu.link.style.globalValues"><![CDATA[Global CSS and SCSS]]></item>
<item name="wcf.acp.menu.link.style.import"><![CDATA[Import Style]]></item>
<item name="wcf.acp.menu.link.style.list"><![CDATA[Styles]]></item>
<item name="wcf.acp.menu.link.configuration"><![CDATA[Configuration]]></item>
<item name="wcf.acp.style.globals.fontSize"><![CDATA[Font Size]]></item>
<item name="wcf.acp.style.globals.layout"><![CDATA[Layout]]></item>
<item name="wcf.acp.style.globals.useFluidLayout"><![CDATA[Use fluid width]]></item>
+ <item name="wcf.acp.style.globalValues"><![CDATA[Global CSS and SCSS]]></item>
+ <item name="wcf.acp.style.globalValues.description"><![CDATA[The CSS and SCSS entered below is applied to all styles, but custom values in styles take precedence.]]></item>
+ <item name="wcf.acp.style.globalValues.input"><![CDATA[Individual CSS and SCSS]]></item>
<item name="wcf.acp.style.image"><![CDATA[Preview Image]]></item>
<item name="wcf.acp.style.image.description"><![CDATA[Upload a preview image for this style, acceptable image types are JPG and PNG. Dimensions should be 102px × 64px, exceeding images will be scaled.]]></item>
<item name="wcf.acp.style.image2x"><![CDATA[Preview Image (HD)]]></item>