From df1ec79b738c8588432925c4adf1101dc5b5d5cb Mon Sep 17 00:00:00 2001 From: Matthias Schmidt <gravatronics@live.com> Date: Tue, 20 Sep 2016 18:47:42 +0200 Subject: [PATCH] Improve label of page object id when setting up internal link MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ⦠by using a(n optional) custom label based on the linked object --- wcfsetup/install/files/acp/templates/boxAdd.tpl | 9 ++++++++- wcfsetup/install/files/acp/templates/menuItemAdd.tpl | 9 ++++++++- .../files/js/WoltLabSuite/Core/Acp/Ui/Box/Handler.js | 12 ++++++++++-- .../js/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.js | 12 ++++++++++-- wcfsetup/install/lang/de.xml | 5 +++++ wcfsetup/install/lang/en.xml | 5 +++++ 6 files changed, 46 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/boxAdd.tpl b/wcfsetup/install/files/acp/templates/boxAdd.tpl index 23f80b95bb..337c156fbc 100644 --- a/wcfsetup/install/files/acp/templates/boxAdd.tpl +++ b/wcfsetup/install/files/acp/templates/boxAdd.tpl @@ -12,6 +12,13 @@ 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}', @@ -179,7 +186,7 @@ <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}{@" "|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}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option> {/foreach} </select> {if $errorField == 'linkPageID'} diff --git a/wcfsetup/install/files/acp/templates/menuItemAdd.tpl b/wcfsetup/install/files/acp/templates/menuItemAdd.tpl index 0c5221ecce..bcf6e8c20e 100644 --- a/wcfsetup/install/files/acp/templates/menuItemAdd.tpl +++ b/wcfsetup/install/files/acp/templates/menuItemAdd.tpl @@ -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}', @@ -118,7 +125,7 @@ <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}{@" "|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}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option> {/foreach} </select> {if $errorField == 'pageID'} 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 360d2c13cb..d30da3b7a1 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 @@ -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); }, 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 76e9051e42..c15ce7183c 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 @@ -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); }, diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 8903bca053..2d2b00f6b6 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -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"> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 5a335c2707..1d202dc19e 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -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> -- 2.20.1