<nav class="contentHeaderNavigation">
<ul>
- <li><a href="#" class="button jsButtonArticleAdd"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {if $availableLanguages|count > 1}
+ <li><a href="#" class="button jsButtonArticleAdd"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {else}
+ <li><a href="{link controller='ArticleAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {/if}
{event name='contentHeaderNavigation'}
</ul>
<nav class="contentFooterNavigation">
<ul>
- <li><a href="#" class="button jsButtonArticleAdd"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {if $availableLanguages|count > 1}
+ <li><a href="#" class="button jsButtonArticleAdd"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {else}
+ <li><a href="{link controller='ArticleAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.article.add{/lang}</span></a></li>
+ {/if}
{event name='contentFooterNavigation'}
</ul>
</dd>
</dl>
- <dl>
- <dt>{lang}wcf.acp.box.i18n{/lang}</dt>
- <dd>
- <label><input type="radio" name="isMultilingual" value="0" checked> {lang}wcf.acp.box.i18n.none{/lang}</label>
- <small>{lang}wcf.acp.box.i18n.none.description{/lang}</small>
- <label><input type="radio" name="isMultilingual" value="1"> {lang}wcf.acp.box.i18n.i18n{/lang}</label>
- <small>{lang}wcf.acp.box.i18n.i18n.description{/lang}</small>
- </dd>
- </dl>
+ {if $availableLanguages|count > 1}
+ <dl>
+ <dt>{lang}wcf.acp.box.i18n{/lang}</dt>
+ <dd>
+ <label><input type="radio" name="isMultilingual" value="0" checked> {lang}wcf.acp.box.i18n.none{/lang}</label>
+ <small>{lang}wcf.acp.box.i18n.none.description{/lang}</small>
+ <label><input type="radio" name="isMultilingual" value="1"> {lang}wcf.acp.box.i18n.i18n{/lang}</label>
+ <small>{lang}wcf.acp.box.i18n.i18n.description{/lang}</small>
+ </dd>
+ </dl>
+ {/if}
<div class="formSubmit">
<button class="buttonPrimary">{lang}wcf.global.button.next{/lang}</button>
'wcf.acp.box.add': '{lang}wcf.acp.box.add{/lang}'
});
- AcpUiBoxAdd.init('{link controller='BoxAdd' encode=false}{literal}boxType={$boxType}&isMultilingual={$isMultilingual}{/literal}{/link}');
+ AcpUiBoxAdd.init('{link controller='BoxAdd' encode=false}{literal}boxType={$boxType}&isMultilingual={$isMultilingual}{/literal}{/link}', {@$availableLanguages|count});
{if $showBoxAddDialog}
window.setTimeout(function() {
define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) {
"use strict";
- var _link;
+ var _languages, _link;
/**
* @exports WoltLabSuite/Core/Acp/Ui/Box/Add
* Initializes the box add handler.
*
* @param {string} link redirect URL
+ * @param {int} languages number of available languages
*/
- init: function(link) {
+ init: function(link, languages) {
+ _languages = languages;
_link = link;
var buttons = elBySelAll('.jsButtonBoxAdd');
var boxType = elBySel('input[name="boxType"]:checked', content).value;
var isMultilingual = 0;
- if (boxType !== 'system') isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value;
+ if (boxType !== 'system' && _languages > 1) isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value;
window.location = _link.replace(/{\$boxType}/, boxType).replace(/{\$isMultilingual}/, isMultilingual);
});
if (isset($_REQUEST['categoryID'])) $this->categoryID = intval($_REQUEST['categoryID']);
- $this->readMultilingualSetting();
-
// get available languages
$this->availableLanguages = LanguageFactory::getInstance()->getLanguages();
+
+ $this->readMultilingualSetting();
}
/**
if (!empty($_REQUEST['isMultilingual'])) $this->isMultilingual = 1;
// work-around to force adding article via dialog overlay
- if (empty($_POST) && !isset($_REQUEST['isMultilingual'])) {
+ if (count($this->availableLanguages) > 1 && empty($_POST) && !isset($_REQUEST['isMultilingual'])) {
$parameters = ['showArticleAddDialog' => 1];
if ($this->categoryID) $parameters['categoryID'] = $this->categoryID;
HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ArticleList', $parameters));
use wcf\data\category\CategoryNodeTree;
use wcf\data\user\User;
use wcf\page\SortablePage;
+use wcf\system\language\LanguageFactory;
use wcf\system\WCF;
use wcf\util\StringUtil;
'title' => $this->title,
'content' => $this->content,
'showArticleAddDialog' => $this->showArticleAddDialog,
+ 'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
'categoryNodeList' => (new CategoryNodeTree('com.woltlab.wcf.article.category'))->getIterator()
]);
}
use wcf\data\box\Box;
use wcf\data\box\BoxList;
use wcf\page\SortablePage;
+use wcf\system\language\LanguageFactory;
use wcf\system\WCF;
use wcf\util\StringUtil;
'boxType' => $this->boxType,
'position' => $this->position,
'availablePositions' => Box::$availablePositions,
+ 'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
'showBoxAddDialog' => $this->showBoxAddDialog
]);
}