Customize search label in page object id dialog
authorMatthias Schmidt <gravatronics@live.com>
Tue, 20 Sep 2016 17:35:18 +0000 (19:35 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 20 Sep 2016 18:11:04 +0000 (20:11 +0200)
wcfsetup/install/files/acp/templates/boxAdd.tpl
wcfsetup/install/files/acp/templates/menuItemAdd.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Search/Handler.js
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 337c156fbcd5f5fd106c65f873d6ae6fea422298..f0b9060bfb4f7dfaa0f25e1aefde7609875bc650 100644 (file)
                                        {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();
index bcf6e8c20e23aeb9715834eb1c7d5d19f59f5da7..080371af760a6dd420a9fb81478a231c2d43c0c1 100644 (file)
@@ -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();
index d30da3b7a1561422e9f18a3c5405f10ba57ecc3b..95f1f70b8931386fdd98305c4d60f9bad20fa2ba 100644 (file)
@@ -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);
                },
                
                /**
index c15ce7183c452db54defc67539977d0cdf1a225d..b3cf779d6e8d249664e16fa17db4593e98a2f6aa 100644 (file)
@@ -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);
                }
        };
 });
index 22231e3b1b5795f97a84db52df1d5d1085338c92..042d00d82abbe14f5a9abb855310e2efb488fea1 100644 (file)
@@ -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(
                                                        + '<dt><label for="wcfUiPageSearchInput">' + Language.get('wcf.page.pageObjectID.search.terms') + '</label></dt>'
                                                        + '<dd>'
                                                                + '<input type="text" id="wcfUiPageSearchInput" class="long">'
-                                                               + '<small>' + Language.get('wcf.page.pageObjectID.search.terms.description') + '</small>'
                                                        + '</dd>'
                                                + '</dl>'
                                        + '</div>'
index 2d2b00f6b6255c8a38cb88d6cb1154243f9c2f6b..6867b4774bab229697b8f211b896b7947b183471 100644 (file)
@@ -2837,6 +2837,9 @@ Fehler sind beispielsweise:
                <item name="wcf.page.objectID.com.woltlab.wcf.Article"><![CDATA[ID des Artikels]]></item>
                <item name="wcf.page.objectID.com.woltlab.wcf.CategoryArticleList"><![CDATA[ID der Kategorie]]></item>
                <item name="wcf.page.objectID.com.woltlab.wcf.User"><![CDATA[ID des Benutzers]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.Article"><![CDATA[Artikeltitel durchsuchen]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.CategoryArticleList"><![CDATA[Kategorietitel durchsuchen]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.User"><![CDATA[Benutzernamen durchsuchen]]></item>
        </category>
        
        <category name="wcf.paidSubscription">
index 1d202dc19eb0dac108eaff5270b0a5f93b1765c8..5d563de049ecd2c8beebadda6341b1b7455188fb 100644 (file)
@@ -2796,6 +2796,9 @@ Errors are:
                <item name="wcf.page.objectID.com.woltlab.wcf.Article"><![CDATA[ID of the Article]]></item>
                <item name="wcf.page.objectID.com.woltlab.wcf.CategoryArticleList"><![CDATA[ID of the Category]]></item>
                <item name="wcf.page.objectID.com.woltlab.wcf.User"><![CDATA[ID of the User]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.Article"><![CDATA[Search Article Titles]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.CategoryArticleList"><![CDATA[Search Category Titles]]></item>
+               <item name="wcf.page.pageObjectID.search.com.woltlab.wcf.User"><![CDATA[Search Usernames]]></item>
        </category>
        
        <category name="wcf.acp.page">