</dd>
</dl>
- <dl>
- <dt>{lang}wcf.acp.page.i18n{/lang}</dt>
- <dd>
- <label><input type="radio" name="isMultilingual" value="0" checked> {lang}wcf.acp.page.i18n.none{/lang}</label>
- <small>{lang}wcf.acp.page.i18n.none.description{/lang}</small>
- <label><input type="radio" name="isMultilingual" value="1"> {lang}wcf.acp.page.i18n.i18n{/lang}</label>
- <small>{lang}wcf.acp.page.i18n.i18n.description{/lang}</small>
- </dd>
- </dl>
+ {if $availableLanguages|count > 1}
+ <dl>
+ <dt>{lang}wcf.acp.page.i18n{/lang}</dt>
+ <dd>
+ <label><input type="radio" name="isMultilingual" value="0" checked> {lang}wcf.acp.page.i18n.none{/lang}</label>
+ <small>{lang}wcf.acp.page.i18n.none.description{/lang}</small>
+ <label><input type="radio" name="isMultilingual" value="1"> {lang}wcf.acp.page.i18n.i18n{/lang}</label>
+ <small>{lang}wcf.acp.page.i18n.i18n.description{/lang}</small>
+ </dd>
+ </dl>
+ {/if}
<div class="formSubmit">
<button class="buttonPrimary">{lang}wcf.global.button.next{/lang}</button>
'wcf.acp.page.add': '{lang}wcf.acp.page.add{/lang}'
});
- AcpUiPageAdd.init('{link controller='PageAdd' encode=false}{literal}pageType={$pageType}&isMultilingual={$isMultilingual}{/literal}{/link}');
+ AcpUiPageAdd.init('{link controller='PageAdd' encode=false}{literal}pageType={$pageType}&isMultilingual={$isMultilingual}{/literal}{/link}', {@$availableLanguages|count});
{if $showPageAddDialog}
window.setTimeout(function() {
define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) {
"use strict";
- var _link;
+ var _languages, _link;
/**
* @exports WoltLab/WCF/Acp/Ui/Page/Add
/**
* Initializes the page add handler.
*
- * @param {string} link redirect URL
+ * @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('.jsButtonPageAdd');
event.preventDefault();
var pageType = elBySel('input[name="pageType"]:checked', content).value;
- var isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value;
+ var isMultilingual = (_languages > 1) ? elBySel('input[name="isMultilingual"]:checked', content).value : 0;
window.location = _link.replace(/{\$pageType}/, pageType).replace(/{\$isMultilingual}/, isMultilingual);
});
public function readParameters() {
parent::readParameters();
- $this->readPageType();
-
// get available applications
$applicationList = new ApplicationList();
$applicationList->readObjects();
$boxList->sqlOrderBy = 'box.name';
$boxList->readObjects();
$this->availableBoxes = $boxList->getObjects();
+
+ $this->readPageType();
}
/**
throw new UserInputException('pageType');
}
- if ($this->pageType == 'system') {
+ if ($this->pageType == 'system' || count($this->availableLanguages) === 1) {
$this->isMultilingual = 0;
}
}
use wcf\data\application\ApplicationList;
use wcf\data\page\PageList;
use wcf\page\SortablePage;
+use wcf\system\language\LanguageFactory;
use wcf\system\WCF;
use wcf\util\StringUtil;
'applicationPackageID' => $this->applicationPackageID,
'pageType' => $this->pageType,
'availableApplications' => $this->availableApplications,
+ 'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
'showPageAddDialog' => $this->showPageAddDialog
]);
}