require(['WoltLabSuite/Core/Acp/Ui/Box/Controller/Handler'], function(AcpUiBoxControllerHandler) {
AcpUiBoxControllerHandler.init({if $boxController}{@$boxController->objectTypeID}{/if});
});
- {else}
- require(['Dictionary', 'Language', 'WoltLabSuite/Core/Acp/Ui/Box/Handler'], function(Dictionary, Language, AcpUiBoxHandler) {
- Language.addObject({
- 'wcf.page.pageObjectID': '{lang}wcf.page.pageObjectID{/lang}',
- {foreach from=$pageNodeList item=pageNode}
- {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.pageObjectID.{@$pageNode->identifier}{/lang}{/capture}
- {if $pageObjectIDLanguageItem}
- 'wcf.page.pageObjectID.{@$pageNode->identifier}': '{@$pageObjectIDLanguageItem}',
- {/if}
- {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.pageObjectID.search.{@$pageNode->identifier}{/lang}{/capture}
- {if $pageObjectIDLanguageItem}
- 'wcf.page.pageObjectID.search.{@$pageNode->identifier}': '{@$pageObjectIDLanguageItem}',
- {/if}
- {/foreach}
- 'wcf.page.pageObjectID.search.noResults': '{lang}wcf.page.pageObjectID.search.noResults{/lang}',
- 'wcf.page.pageObjectID.search.results': '{lang}wcf.page.pageObjectID.search.results{/lang}',
- 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}'
- });
-
- var handlers = new Dictionary();
- {foreach from=$pageHandlers key=handlerPageID item=requireObjectID}
- handlers.set({@$handlerPageID}, {if $requireObjectID}true{else}false{/if});
+ {/if}
+
+ require(['Dictionary', 'Language', 'WoltLabSuite/Core/Acp/Ui/Box/Handler'], function(Dictionary, Language, AcpUiBoxHandler) {
+ Language.addObject({
+ 'wcf.page.pageObjectID': '{lang}wcf.page.pageObjectID{/lang}',
+ {foreach from=$pageNodeList item=pageNode}
+ {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.pageObjectID.{@$pageNode->identifier}{/lang}{/capture}
+ {if $pageObjectIDLanguageItem}
+ 'wcf.page.pageObjectID.{@$pageNode->identifier}': '{@$pageObjectIDLanguageItem}',
+ {/if}
+ {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.pageObjectID.search.{@$pageNode->identifier}{/lang}{/capture}
+ {if $pageObjectIDLanguageItem}
+ 'wcf.page.pageObjectID.search.{@$pageNode->identifier}': '{@$pageObjectIDLanguageItem}',
+ {/if}
{/foreach}
-
- AcpUiBoxHandler.init(handlers);
+ 'wcf.page.pageObjectID.search.noResults': '{lang}wcf.page.pageObjectID.search.noResults{/lang}',
+ 'wcf.page.pageObjectID.search.results': '{lang}wcf.page.pageObjectID.search.results{/lang}',
+ 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}'
});
- {/if}
+
+ var handlers = new Dictionary();
+ {foreach from=$pageHandlers key=handlerPageID item=requireObjectID}
+ handlers.set({@$handlerPageID}, {if $requireObjectID}true{else}false{/if});
+ {/foreach}
+
+ AcpUiBoxHandler.init(handlers, '{$boxType}');
+ });
{if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
require(['WoltLabSuite/Core/Media/Manager/Select'], function(MediaManagerSelect) {
* Initializes the interface logic.
*
* @param {Dictionary} handlers list of handlers by page id supporting page object ids
+ * @param {string} boxType box type
*/
- init: function(handlers) {
+ init: function(handlers, boxType) {
_handlers = handlers;
_boxController = elById('boxControllerID');
- _containerPageID = elById('linkPageIDContainer');
- _containerExternalLink = elById('externalURLContainer');
- _containerPageObjectId = elById('linkPageObjectIDContainer');
-
- if (_handlers.size) {
- _pageId = elById('linkPageID');
- _pageId.addEventListener('change', this._togglePageId.bind(this));
-
- _pageObjectId = elById('linkPageObjectID');
+ if (boxType !== 'system') {
+ _containerPageID = elById('linkPageIDContainer');
+ _containerExternalLink = elById('externalURLContainer');
+ _containerPageObjectId = elById('linkPageObjectIDContainer');
- _cache = new Dictionary();
- _activePageId = ~~_pageId.value;
- if (_activePageId && _handlers.has(_activePageId)) {
- _cache.set(_activePageId, ~~_pageObjectId.value);
+ if (_handlers.size) {
+ _pageId = elById('linkPageID');
+ _pageId.addEventListener('change', this._togglePageId.bind(this));
+
+ _pageObjectId = elById('linkPageObjectID');
+
+ _cache = new Dictionary();
+ _activePageId = ~~_pageId.value;
+ if (_activePageId && _handlers.has(_activePageId)) {
+ _cache.set(_activePageId, ~~_pageObjectId.value);
+ }
+
+ elById('searchLinkPageObjectID').addEventListener(WCF_CLICK_EVENT, this._openSearch.bind(this));
+
+ // toggle page object id container on init
+ if (_handlers.has(~~_pageId.value)) {
+ elShow(_containerPageObjectId);
+ }
}
- elById('searchLinkPageObjectID').addEventListener(WCF_CLICK_EVENT, this._openSearch.bind(this));
-
- // toggle page object id container on init
- if (_handlers.has(~~_pageId.value)) {
- elShow(_containerPageObjectId);
- }
+ elBySelAll('input[name="linkType"]', null, (function (input) {
+ input.addEventListener('change', this._toggleLinkType.bind(this, input.value));
+
+ if (input.checked) {
+ this._toggleLinkType(input.value);
+ }
+ }).bind(this));
}
- elBySelAll('input[name="linkType"]', null, (function(input) {
- input.addEventListener('change', this._toggleLinkType.bind(this, input.value));
-
- if (input.checked) {
- this._toggleLinkType(input.value);
- }
- }).bind(this));
-
if (_boxController !== null) {
_position = elById('position');
_boxController.addEventListener('change', this._setAvailableBoxPositions.bind(this));
* @protected
*/
_toggleLinkType: function(value) {
- if (value == 'none') {
- elHide(_containerPageID);
- elHide(_containerPageObjectId);
- elHide(_containerExternalLink);
- }
- if (value == 'internal') {
- elShow(_containerPageID);
- elHide(_containerExternalLink);
- if (_handlers.size) this._togglePageId();
- }
- if (value == 'external') {
- elHide(_containerPageID);
- elHide(_containerPageObjectId);
- elShow(_containerExternalLink);
+ switch (value) {
+ case 'none':
+ elHide(_containerPageID);
+ elHide(_containerPageObjectId);
+ elHide(_containerExternalLink);
+ break;
+
+ case 'internal':
+ elShow(_containerPageID);
+ elHide(_containerExternalLink);
+ if (_handlers.size) this._togglePageId();
+ break;
+
+ case 'external':
+ elHide(_containerPageID);
+ elHide(_containerPageObjectId);
+ elShow(_containerExternalLink);
+ break;
}
},