* Added support for embedded youtube playlists
* Scaled embedded youtube videos to maximum width
* `\wcf\form\AbstractCaptchaForm`: added parameter to force captcha usage for registered users.
+* Added global disable switch for languages.
#### CMS
window.location.reload();
}
});
+ new WCF.Action.Toggle('wcf\\data\\language\\LanguageAction', $('.jsLanguageRow'));
});
//]]>
</script>
<a href="{link controller='LanguageExport' id=$language->languageID}{/link}" title="{lang}wcf.acp.language.export{/lang}" class="jsTooltip"><span class="icon icon16 fa-download"></span></a>
{if !$language->isDefault}
- <span class="icon icon16 fa-check-square-o jsSetAsDefaultButton jsTooltip pointer" title="{lang}wcf.acp.language.setAsDefault{/lang}" title="{lang}wcf.acp.language.setAsDefault{/lang}" data-object-id="{@$language->languageID}"></span>
+ <span class="icon icon16 fa-{if !$language->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $language->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$language->languageID}"></span>
+ <span class="icon icon16 fa-check-circle jsSetAsDefaultButton jsTooltip pointer" title="{lang}wcf.acp.language.setAsDefault{/lang}" title="{lang}wcf.acp.language.setAsDefault{/lang}" data-object-id="{@$language->languageID}"></span>
{else}
- <span class="icon icon16 fa-check-square-o disabled" title="{lang}wcf.acp.language.setAsDefault{/lang}"></span>
+ <span class="icon icon16 fa-{if !$language->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if $language->isDisabled}enable{else}disable{/if}{/lang}"></span>
+ <span class="icon icon16 fa-check-circle disabled" title="{lang}wcf.acp.language.setAsDefault{/lang}"></span>
{/if}
<a href="{link controller='LanguageEdit' id=$language->languageID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
+
{if !$language->isDefault}
<span class="icon icon16 fa-times jsTooltip jsDeleteButton pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$language->languageID}" data-confirm-message="{lang}wcf.acp.language.delete.sure{/lang}"></span>
{else}
<?php
namespace wcf\data\language;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\IToggleAction;
use wcf\system\WCF;
/**
* @method LanguageEditor[] getObjects()
* @method LanguageEditor getSingleObject()
*/
-class LanguageAction extends AbstractDatabaseObjectAction {
+class LanguageAction extends AbstractDatabaseObjectAction implements IToggleAction {
/**
* @inheritDoc
*/
public function setAsDefault() {
$this->languageEditor->setAsDefault();
}
+
+ /**
+ * @inheritdoc
+ */
+ public function validateToggle() {
+ parent::validateUpdate();
+
+ foreach ($this->objects as $language) {
+ if ($language->isDefault) {
+ throw new UserInputException('objectIDs');
+ }
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function toggle() {
+ foreach ($this->objects as $language) {
+ $isDisabled = ($language->isDisabled) ? 0 : 1;
+ $language->update(['isDisabled' => $isDisabled]);
+ }
+ }
}
// get languages
$languageList = new LanguageList();
+ $languageList->getConditionBuilder()->add('language.isDisabled = ?', [0]);
$languageList->readObjects();
$data['languages'] = $languageList->getObjects();
foreach ($languageList->getObjects() as $language) {
countryCode VARCHAR(10) NOT NULL DEFAULT '',
isDefault TINYINT(1) NOT NULL DEFAULT 0,
hasContent TINYINT(1) NOT NULL DEFAULT 0,
+ isDisabled TINYINT(1) NOT NULL DEFAULT 0,
UNIQUE KEY languageCode (languageCode)
);