From: Matthias Schmidt Date: Tue, 20 Sep 2016 17:35:18 +0000 (+0200) Subject: Customize search label in page object id dialog X-Git-Tag: 3.0.0_Beta_1~56 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=88cf0d990dbe32521e13b68fd40b2f231c97ef0b;p=GitHub%2FWoltLab%2FWCF.git Customize search label in page object id dialog --- diff --git a/wcfsetup/install/files/acp/templates/boxAdd.tpl b/wcfsetup/install/files/acp/templates/boxAdd.tpl index 337c156fbc..f0b9060bfb 100644 --- a/wcfsetup/install/files/acp/templates/boxAdd.tpl +++ b/wcfsetup/install/files/acp/templates/boxAdd.tpl @@ -18,12 +18,15 @@ {if $pageObjectIDLanguageItem} 'wcf.page.objectID.{@$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.results.description': '{lang}wcf.page.pageObjectID.search.results.description{/lang}', - 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}', - 'wcf.page.pageObjectID.search.terms.description': '{lang}wcf.page.pageObjectID.search.terms.description{/lang}' + 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}' }); var handlers = new Dictionary(); diff --git a/wcfsetup/install/files/acp/templates/menuItemAdd.tpl b/wcfsetup/install/files/acp/templates/menuItemAdd.tpl index bcf6e8c20e..080371af76 100644 --- a/wcfsetup/install/files/acp/templates/menuItemAdd.tpl +++ b/wcfsetup/install/files/acp/templates/menuItemAdd.tpl @@ -9,12 +9,15 @@ {if $pageObjectIDLanguageItem} 'wcf.page.objectID.{@$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.results.description': '{lang}wcf.page.pageObjectID.search.results.description{/lang}', - 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}', - 'wcf.page.pageObjectID.search.terms.description': '{lang}wcf.page.pageObjectID.search.terms.description{/lang}' + 'wcf.page.pageObjectID.search.terms': '{lang}wcf.page.pageObjectID.search.terms{/lang}' }); var handlers = new Dictionary(); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js index d30da3b7a1..95f1f70b89 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js @@ -143,10 +143,17 @@ define(['Dictionary', 'Language', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], f _openSearch: function(event) { event.preventDefault(); + var labelLanguageItem; + var pageIdentifier = elData(_pageId.options[_pageId.selectedIndex], 'identifier'); + var languageItem = 'wcf.page.pageObjectID.search.' + pageIdentifier; + if (Language.get(languageItem) !== languageItem) { + labelLanguageItem = languageItem; + } + UiPageSearchHandler.open(_activePageId, _pageId.options[_pageId.selectedIndex].textContent.trim(), function(objectId) { _pageObjectId.value = objectId; _cache.set(_activePageId, objectId); - }); + }, labelLanguageItem); }, /** diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js index c15ce7183c..b3cf779d6e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js @@ -126,10 +126,17 @@ define(['Dictionary', 'Language', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], f _openSearch: function(event) { event.preventDefault(); + var labelLanguageItem; + var pageIdentifier = elData(_pageId.options[_pageId.selectedIndex], 'identifier'); + var languageItem = 'wcf.page.pageObjectID.search.' + pageIdentifier; + if (Language.get(languageItem) !== languageItem) { + labelLanguageItem = languageItem; + } + UiPageSearchHandler.open(_activePageId, _pageId.options[_pageId.selectedIndex].textContent.trim(), function(objectId) { _pageObjectId.value = objectId; _cache.set(_activePageId, objectId); - }); + }, labelLanguageItem); } }; }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search/Handler.js index 22231e3b1b..042d00d82a 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search/Handler.js @@ -12,6 +12,7 @@ define(['Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './Input'], function( var _callback = null; var _searchInput = null; + var _searchInputLabel = null; var _searchInputHandler = null; var _resultList = null; var _resultListContainer = null; @@ -23,16 +24,24 @@ define(['Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './Input'], function( /** * Opens the lookup overlay for provided page id. * - * @param {int} pageId page id - * @param {string} title dialog title - * @param {function} callback callback function provided with the user-selected object id + * @param {int} pageId page id + * @param {string} title dialog title + * @param {function} callback callback function provided with the user-selected object id + * @param {string?} labelLanguageItem optional language item name for the search input label */ - open: function (pageId, title, callback) { + open: function (pageId, title, callback, labelLanguageItem) { _callback = callback; UiDialog.open(this); UiDialog.setTitle(this, title); + if (labelLanguageItem) { + _searchInputLabel.textContent = Language.get(labelLanguageItem); + } + else { + _searchInputLabel.textContent = Language.get('wcf.page.pageObjectID.search.terms'); + } + this._getSearchInputHandler().setPageId(pageId); }, @@ -139,6 +148,7 @@ define(['Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './Input'], function( onShow: function() { if (_searchInput === null) { _searchInput = elById('wcfUiPageSearchInput'); + _searchInputLabel = _searchInput.parentNode.previousSibling.childNodes[0]; _resultList = elById('wcfUiPageSearchResultList'); _resultListContainer = elById('wcfUiPageSearchResultListContainer'); } @@ -159,7 +169,6 @@ define(['Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './Input'], function( + '
' + '
' + '' - + '' + Language.get('wcf.page.pageObjectID.search.terms.description') + '' + '
' + '' + '' diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 2d2b00f6b6..6867b4774b 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2837,6 +2837,9 @@ Fehler sind beispielsweise: + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 1d202dc19e..5d563de049 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2796,6 +2796,9 @@ Errors are: + + +