[TASK] Replace default value with placeholder in external url link handler 34/57734/8
authorJoerg Boesche <typo3@joergboesche.de>
Tue, 31 Jul 2018 06:48:50 +0000 (08:48 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 3 Aug 2018 14:42:49 +0000 (16:42 +0200)
Use a placeholder attribute instead of a default value.

Resolves: #85689
Releases: master, 8.7
Change-Id: I99398125e16985ba78b3887150157da2b2c01905
Reviewed-on: https://review.typo3.org/57734
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Kummer <typo3@enobe.de>
Tested-by: Joerg Kummer <typo3@enobe.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/core/Documentation/Changelog/8.7.x/Important-85689-ReplacedDefaultValueWithPlaceholderInExternalUrlLinkHandler.rst [new file with mode: 0644]
typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php
typo3/sysext/recordlist/Resources/Private/Language/locallang_browse_links.xlf
typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/Url.html
typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js

diff --git a/typo3/sysext/core/Documentation/Changelog/8.7.x/Important-85689-ReplacedDefaultValueWithPlaceholderInExternalUrlLinkHandler.rst b/typo3/sysext/core/Documentation/Changelog/8.7.x/Important-85689-ReplacedDefaultValueWithPlaceholderInExternalUrlLinkHandler.rst
new file mode 100644 (file)
index 0000000..427affa
--- /dev/null
@@ -0,0 +1,18 @@
+.. include:: ../../Includes.txt
+
+========================================================================================
+Important: #85689 - Replaced default value with placeholder in external url link handler
+========================================================================================
+
+See :issue:`85689`
+
+Description
+===========
+
+The :php:`UrlLinkHandler` in EXT:recordlist used a default input value "http://" for external links.
+This is not practical because editors often paste a link in the field. This caused broken links due
+to duplicate HTTP protocols, for example: `http://https://typo3.org/`
+
+A placeholder is now used instead of a default value. Editors can paste links directly and do not have to remove a default value first.
+
+.. index:: NotScanned
\ No newline at end of file
index 87edbcc..63c601f 100644 (file)
@@ -88,7 +88,7 @@ class UrlLinkHandler extends AbstractLinkHandler implements LinkHandlerInterface
     {
         GeneralUtility::makeInstance(PageRenderer::class)->loadRequireJsModule('TYPO3/CMS/Recordlist/UrlLinkHandler');
 
-        $this->view->assign('url', !empty($this->linkParts) ? $this->linkParts['url'] : 'http://');
+        $this->view->assign('url', !empty($this->linkParts) ? $this->linkParts['url'] : '');
         return $this->view->render('Url');
     }
 
index f7fe966..f0fc4be 100644 (file)
@@ -87,6 +87,9 @@
                        <trans-unit id="setLink">
                                <source>Set Link</source>
                        </trans-unit>
+                       <trans-unit id="urlPlaceholder">
+                               <source>https://...</source>
+                       </trans-unit>
                        <trans-unit id="clickToRedrawFullSize">
                                <source>Image is larger than shown here! Click to redraw page with full sized images.</source>
                        </trans-unit>
index 7aba045..c888da2 100644 (file)
@@ -6,7 +6,12 @@
                                        <label class="col-xs-4 control-label">URL</label>
                                        <div class="col-xs-8">
                                                <div class="input-group">
-                                                       <input type="text" name="lurl" size="30" class="form-control" value="{url}" />
+                                                       <input type="text"
+                                                                  name="lurl"
+                                                                  size="30"
+                                                                  class="form-control"
+                                                                  value="{url}"
+                                                                  placeholder="{f:translate(key: 'LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:urlPlaceholder')}" />
                                                        <div class="input-group-btn">
                                                                <input class="btn btn-sm btn-default" type="submit"
                                                                                        value="{f:translate(key: 'LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:setLink')}" />
index e82e0ac..6b5495d 100644 (file)
@@ -33,8 +33,8 @@ define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser)
     event.preventDefault();
 
     var value = $(this).find('[name="lurl"]').val();
-    if (value === "http://") {
-      return;
+    if (value === "") {
+       return;
     }
 
     LinkBrowser.finalizeFunction(value);