[TASK] Improve link validator ux 34/49334/5
authorIvaylo Ivanov <ivaylo.ivanov@dkd.de>
Tue, 2 Aug 2016 19:49:13 +0000 (21:49 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 8 Aug 2016 21:22:27 +0000 (23:22 +0200)
Add notification if actions were performed

Resolves: #77366
Releases: master
Change-Id: Id3e7cc8a541352a99c8ba639ce71ef28502114ed
Reviewed-on: https://review.typo3.org/49334
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/linkvalidator/Resources/Private/Language/Module/locallang.xlf
typo3/sysext/linkvalidator/Resources/Public/JavaScript/Linkvalidator.js

index fce3c05..0cfe74d 100644 (file)
@@ -185,9 +185,9 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         $this->getPageRenderer()->addInlineLanguageLabelFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf');
 
         if ($this->modTS['showCheckLinkTab'] == 1) {
-            $this->updateListHtml = '<input class="btn btn-default" type="submit" name="updateLinkList" id="updateLinkList" value="' . $this->getLanguageService()->getLL('label_update') . '"/>';
+            $this->updateListHtml = '<input class="btn btn-default t3js-update-button" type="submit" name="updateLinkList" id="updateLinkList" value="' . htmlspecialchars($this->getLanguageService()->getLL('label_update')) . '" data-notification-message="' . htmlspecialchars($this->getLanguageService()->getLL('label_update-link-list')) . '"/>';
         }
-        $this->refreshListHtml = '<input class="btn btn-default" type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $this->getLanguageService()->getLL('label_refresh') . '"/>';
+        $this->refreshListHtml = '<input class="btn btn-default t3js-update-button" type="submit" name="refreshLinkList" id="refreshLinkList" value="' . htmlspecialchars($this->getLanguageService()->getLL('label_refresh')) . '" data-notification-message="' . htmlspecialchars($this->getLanguageService()->getLL('label_refresh-link-list')) . '"/>';
         $this->linkAnalyzer = GeneralUtility::makeInstance(LinkAnalyzer::class);
         $this->updateBrokenLinks();
 
@@ -598,7 +598,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         } else {
             $linkMessage = '<span class="error">'
                 . nl2br(
-                    // Encode for output
+                // Encode for output
                     htmlspecialchars(
                         $hookObj->getErrorMessage($response['errorParams']),
                         ENT_QUOTES,
@@ -717,7 +717,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
             'CONTENT' => $this->content,
             'CHECKOPTIONS' => $this->checkOptionsHtml,
             'ID' => '<input type="hidden" name="id" value="' . $this->pObj->id . '" />',
-            'REFRESH' => '<input type="submit" class="btn btn-default" name="refreshLinkList" id="refreshLinkList" value="' . $this->getLanguageService()->getLL('label_refresh') . '" />',
+            'REFRESH' => '<input type="submit" class="btn btn-default t3js-update-button" name="refreshLinkList" id="refreshLinkList" value="' . htmlspecialchars($this->getLanguageService()->getLL('label_refresh')) . '" data-notification-message="' . htmlspecialchars($this->getLanguageService()->getLL('label_refresh-link-list')) . '" />',
             'UPDATE' => '',
         );
     }
@@ -737,7 +737,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
             'CHECKOPTIONS' => $this->checkOptionsHtmlCheck,
             'ID' => '<input type="hidden" name="id" value="' . $this->pObj->id . '" />',
             'REFRESH' => '',
-            'UPDATE' => '<input type="submit" class="btn btn-default" name="updateLinkList" id="updateLinkList" value="' . $this->getLanguageService()->getLL('label_update') . '"/>',
+            'UPDATE' => '<input type="submit" class="btn btn-default t3js-update-button" name="updateLinkList" id="updateLinkList" value="' . htmlspecialchars($this->getLanguageService()->getLL('label_update')) . '" data-notification-message="' . htmlspecialchars($this->getLanguageService()->getLL('label_update-link-list')) . '"/>',
         );
     }
 
index e6049dd..b449bcd 100644 (file)
                        <trans-unit id="no.access">
                                <source>You do not have access to these listings.</source>
                        </trans-unit>
+                       <trans-unit id="label_update-link-list">
+                               <source>Checking links, please stand by.</source>
+                       </trans-unit>
+                       <trans-unit id="label_refresh-link-list">
+                               <source>Refreshing link list, please stand by.</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index c285155..b4578bb 100644 (file)
@@ -54,6 +54,16 @@ define(['jquery'], function($) {
                $('.check').on('click', function() {
                        Linkvalidator.toggleActionButton('check');
                });
+
+               $('.t3js-update-button').on('click', function() {
+                       var $element = $(this);
+                       var name = $element.attr('name');
+                       var message = 'Event triggered';
+                       if (name === 'refreshLinkList' || name === 'updateLinkList') {
+                               message = $element.data('notification-message');
+                       }
+                       top.TYPO3.Notification.success(message);
+               });
        };
 
        $(Linkvalidator.initializeEvents);