Improve label of page object id when setting up internal link
authorMatthias Schmidt <gravatronics@live.com>
Tue, 20 Sep 2016 16:47:42 +0000 (18:47 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 20 Sep 2016 18:11:04 +0000 (20:11 +0200)
… by using a(n optional) custom label based on the linked object

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/lang/de.xml
wcfsetup/install/lang/en.xml

index 23f80b95bb111ff198d75b95715d2787e2e8e0ea..337c156fbcd5f5fd106c65f873d6ae6fea422298 100644 (file)
                
                require(['Dictionary', 'Language', 'WoltLabSuite/Core/Acp/Ui/Box/Handler', 'WoltLabSuite/Core/Media/Manager/Select'], function(Dictionary, Language, AcpUiBoxHandler, MediaManagerSelect) {
                        Language.addObject({
+                               'wcf.acp.page.objectID': '{lang}wcf.acp.page.objectID{/lang}',
+                               {foreach from=$pageNodeList item=pageNode}
+                                       {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.objectID.{@$pageNode->identifier}{/lang}{/capture}
+                                       {if $pageObjectIDLanguageItem}
+                                               'wcf.page.objectID.{@$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}',
                                                        <option value="0">{lang}wcf.global.noSelection{/lang}</option>
                                                        
                                                        {foreach from=$pageNodeList item=pageNode}
-                                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
+                                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected{/if} data-identifier="{@$pageNode->identifier}">{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                                        {/foreach}
                                                </select>
                                                {if $errorField == 'linkPageID'}
index 0c5221ecce28345e31d5028cc6cca3a6dd5e14d8..bcf6e8c20e23aeb9715834eb1c7d5d19f59f5da7 100644 (file)
@@ -3,6 +3,13 @@
 <script data-relocate="true">
        require(['Dictionary', 'Language', 'WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler'], function(Dictionary, Language, AcpUiMenuItemHandler) {
                Language.addObject({
+                       'wcf.acp.page.objectID': '{lang}wcf.acp.page.objectID{/lang}',
+                       {foreach from=$pageNodeList item=pageNode}
+                               {capture assign='pageObjectIDLanguageItem'}{lang __optional=true}wcf.page.objectID.{@$pageNode->identifier}{/lang}{/capture}
+                               {if $pageObjectIDLanguageItem}
+                                       'wcf.page.objectID.{@$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}',
                                        <option value="0">{lang}wcf.global.noSelection{/lang}</option>
                                        
                                        {foreach from=$pageNodeList item=pageNode}
-                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $pageID} selected{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
+                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $pageID} selected{/if} data-identifier="{@$pageNode->identifier}">{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                        {/foreach}
                                </select>
                                {if $errorField == 'pageID'}
index 360d2c13cb08ce68e7fcb4b77aaaedccb423a350..d30da3b7a1561422e9f18a3c5405f10ba57ecc3b 100644 (file)
@@ -6,7 +6,7 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLabSuite/Core/Acp/Ui/Box/Handler
  */
-define(['Dictionary', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dictionary, UiPageSearchHandler) {
+define(['Dictionary', 'Language', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dictionary, Language, UiPageSearchHandler) {
        "use strict";
        
        var _activePageId = 0;
@@ -119,10 +119,18 @@ define(['Dictionary', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dict
                                
                                return;
                        }
-                               
+                       
                        var newValue = ~~_cache.get(_activePageId);
                        _pageObjectId.value = (newValue) ? newValue : '';
                        
+                       var pageIdentifier = elData(_pageId.options[_pageId.selectedIndex], 'identifier');
+                       var languageItem = 'wcf.page.objectID.' + pageIdentifier;
+                       if (Language.get(languageItem) === languageItem) {
+                               languageItem = 'wcf.acp.page.objectID';
+                       }
+                       
+                       elByTag('label', _containerPageObjectId)[0].textContent = Language.get(languageItem);
+                       
                        elShow(_containerPageObjectId);
                },
                
index 76e9051e4218e6a62d15d1d91b8c045d8c28c294..c15ce7183c452db54defc67539977d0cdf1a225d 100644 (file)
@@ -6,7 +6,7 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler
  */
-define(['Dictionary', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dictionary, UiPageSearchHandler) {
+define(['Dictionary', 'Language', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dictionary, Language, UiPageSearchHandler) {
        "use strict";
        
        var _activePageId = 0;
@@ -102,10 +102,18 @@ define(['Dictionary', 'WoltLabSuite/Core/Ui/Page/Search/Handler'], function(Dict
                                
                                return;
                        }
-                               
+                       
                        var newValue = ~~_cache.get(_activePageId);
                        _pageObjectId.value = (newValue) ? newValue : '';
                        
+                       var pageIdentifier = elData(_pageId.options[_pageId.selectedIndex], 'identifier');
+                       var languageItem = 'wcf.page.objectID.' + pageIdentifier;
+                       if (Language.get(languageItem) === languageItem) {
+                               languageItem = 'wcf.acp.page.objectID';
+                       }
+                       
+                       elByTag('label', _containerPageObjectId)[0].textContent = Language.get(languageItem);
+                       
                        elShow(_containerPageObjectId);
                },
                
index 8903bca0539abf420b9e2e317658c1442f73a134..2d2b00f6b6255c8a38cb88d6cb1154243f9c2f6b 100644 (file)
@@ -1379,6 +1379,8 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
                <item name="wcf.acp.page.metaDescription"><![CDATA[Meta Description]]></item>
                <item name="wcf.acp.page.metaKeywords"><![CDATA[Meta Keywords]]></item>
                <item name="wcf.acp.page.name.error.notUnique"><![CDATA[Dieser Name wird bereits von einer anderen Seite verwendet.]]></item>
+               <item name="wcf.acp.page.objectID"><![CDATA[Objekt-ID]]></item>
+               <item name="wcf.acp.page.objectID.search"><![CDATA[ID suchen]]></item>
                <item name="wcf.acp.page.page"><![CDATA[Seite]]></item>
                <item name="wcf.acp.page.parentPage"><![CDATA[Übergeordnete Seite]]></item>
                <item name="wcf.acp.page.parentPage.none"><![CDATA[Keine]]></item>
@@ -2832,6 +2834,9 @@ Fehler sind beispielsweise:
                <item name="wcf.page.jumpTo.description"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Gib{else}Geben Sie{/if} einen Wert zwischen „1“ und „#pages#“ ein.]]></item>
                <item name="wcf.page.redirect.title"><![CDATA[Weiterleitung]]></item>
                <item name="wcf.page.redirect.url"><![CDATA[Falls die automatische Weiterleitung nicht funktioniert, {if LANGUAGE_USE_INFORMAL_VARIANT}klicke{else}klicken Sie{/if} bitte hier!]]></item>
+               <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>
        </category>
        
        <category name="wcf.paidSubscription">
index 5a335c270702bc1dd35703363ab57b22f79ac31d..1d202dc19eb0dac108eaff5270b0a5f93b1765c8 100644 (file)
@@ -2793,6 +2793,9 @@ Errors are:
                <item name="wcf.page.jumpTo.description"><![CDATA[Enter a value between “1” and “#pages#”.]]></item>
                <item name="wcf.page.redirect.title"><![CDATA[Redirection]]></item>
                <item name="wcf.page.redirect.url"><![CDATA[Please click here if the automatic redirection does not work!]]></item>
+               <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>
        </category>
        
        <category name="wcf.acp.page">
@@ -2819,6 +2822,8 @@ Errors are:
                <item name="wcf.acp.page.metaDescription"><![CDATA[Meta Description]]></item>
                <item name="wcf.acp.page.metaKeywords"><![CDATA[Meta Keywords]]></item>
                <item name="wcf.acp.page.name.error.notUnique"><![CDATA[Name is already in use.]]></item>
+               <item name="wcf.acp.page.objectID"><![CDATA[Object ID]]></item>
+               <item name="wcf.acp.page.objectID.search"><![CDATA[Search ID]]></item>
                <item name="wcf.acp.page.page"><![CDATA[Page]]></item>
                <item name="wcf.acp.page.parentPage"><![CDATA[Parent Page]]></item>
                <item name="wcf.acp.page.parentPage.none"><![CDATA[None]]></item>