[FEATURE] Backend ViewHelpers for edit creation and editing 34/56934/23
authorAnja <aleichsenring@ab-softlab.de>
Fri, 11 May 2018 14:37:30 +0000 (16:37 +0200)
committerMathias Brodala <mbrodala@pagemachine.de>
Thu, 17 May 2018 07:51:12 +0000 (09:51 +0200)
Provides Edit- and NewRecord[Link|Uri]ViewHelpers to be used
in all places of the backend, also for extensions.

Remove four dedicated classes from system extensions, that got
replaced with the new implementations.

Also: composer update typo3/testing-framework

Resolves: #84983
Releases: master
Change-Id: I7fc03db101d2f73b63b24e4175d2e02aafa06e95
Reviewed-on: https://review.typo3.org/56934
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
59 files changed:
composer.lock
typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php [new file with mode: 0644]
typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php [new file with mode: 0644]
typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php [new file with mode: 0644]
typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/InlineWithUidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithNegativeUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidTableAndReturnUrl.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/InlineWithPidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithNegativeUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidTableAndReturnUrl.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPositiveUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithUidAndPid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithNegativeUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPositiveUid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithUidAndPid.html [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php [new file with mode: 0644]
typo3/sysext/beuser/Classes/Controller/BackendUserActionController.php
typo3/sysext/beuser/Classes/Controller/BackendUserController.php
typo3/sysext/beuser/Classes/Controller/BackendUserGroupController.php
typo3/sysext/beuser/Classes/ViewHelpers/EditRecordViewHelper.php [deleted file]
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html
typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
typo3/sysext/core/Documentation/Changelog/master/Feature-84983-BEViewHelperForEditDocumentController.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/CompareUserCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/ListGroupCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/ListUserCest.php
typo3/sysext/core/Tests/Acceptance/Backend/FileList/FileMetaDataCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/RecordList/SysNoteCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Redirect/RedirectModuleCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php
typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditSysFileMetadataRecordViewHelper.php [deleted file]
typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html
typo3/sysext/redirects/Classes/ViewHelpers/EditRecordViewHelper.php
typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php [deleted file]
typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/EditTask.html
typo3/sysext/sys_note/Classes/Controller/NoteController.php
typo3/sysext/sys_note/Classes/ViewHelpers/EditLinkViewHelper.php [deleted file]
typo3/sysext/sys_note/Resources/Private/Layouts/Default.html [new file with mode: 0644]
typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html

index 62ac7c7..d8eaf7a 100644 (file)
         },
         {
             "name": "typo3/testing-framework",
-            "version": "3.5.1",
+            "version": "3.5.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "cebc38fa13859e8fc2b52795a138e605cb0ff0f3"
+                "reference": "53723f9b88385ef2b43fe920cadf7acb77d3fa62"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/cebc38fa13859e8fc2b52795a138e605cb0ff0f3",
-                "reference": "cebc38fa13859e8fc2b52795a138e605cb0ff0f3",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/53723f9b88385ef2b43fe920cadf7acb77d3fa62",
+                "reference": "53723f9b88385ef2b43fe920cadf7acb77d3fa62",
                 "shasum": ""
             },
             "require": {
                 "tests",
                 "typo3"
             ],
-            "time": "2018-05-09T15:22:35+00:00"
+            "time": "2018-05-13T12:28:19+00:00"
         },
         {
             "name": "webmozart/assert",
diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php
new file mode 100644 (file)
index 0000000..b9068ce
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\ViewHelpers\Link;
+
+use TYPO3\CMS\Backend\Routing\UriBuilder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
+
+/**
+ * Use this ViewHelper to provide edit links to records. The ViewHelper will
+ * pass the uid and table to FormEngine.
+ *
+ * The uid must be given as a positive integer.
+ * For new records, use the newRecordViewHelper
+ *
+ * = Examples =
+ *
+ * <code title="Link to the record-edit action passed to FormEngine">
+ * <be:link.editRecord uid="42" table="a_table" returnUrl="foo/bar" />
+ * </code>
+ * <output>
+ * <a href="/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar">
+ *   Edit record
+ * </a>
+ * </output>
+ */
+class EditRecordViewHelper extends AbstractTagBasedViewHelper
+{
+    /**
+     * @var string
+     */
+    protected $tagName = 'a';
+
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerUniversalTagAttributes();
+        $this->registerArgument('uid', 'int', 'uid of record to be edited', true);
+        $this->registerArgument('table', 'string', 'target database table', true);
+        $this->registerArgument('returnUrl', 'string', '', false, '');
+    }
+
+    /**
+     * @return string
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
+     */
+    public function render(): string
+    {
+        if ($this->arguments['uid'] < 1) {
+            throw new \InvalidArgumentException('Uid must be a positive integer, ' . $this->arguments['uid'] . ' given.', 1526127158);
+        }
+        if (empty($this->arguments['returnUrl'])) {
+            $this->arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
+        }
+
+        $params = [
+            'edit' => [$this->arguments['table'] => [$this->arguments['uid'] => 'edit']],
+            'returnUrl' => $this->arguments['returnUrl']
+        ];
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+        $uri = (string)$uriBuilder->buildUriFromRoute('record_edit', $params);
+        $this->tag->addAttribute('href', $uri);
+        $this->tag->setContent($this->renderChildren());
+        $this->tag->forceClosingTag(true);
+        return $this->tag->render();
+    }
+}
diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php
new file mode 100644 (file)
index 0000000..16b2d4c
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\ViewHelpers\Link;
+
+use TYPO3\CMS\Backend\Routing\UriBuilder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
+
+/**
+ * Use this ViewHelper to provide 'create new record' links.
+ * The ViewHelper will pass the command to FormEngine.
+ *
+ * The table argument is mandatory, it decides what record is to be created.
+ *
+ * The pid argument will put the new record on this page, if 0 given it will
+ * be placed to the root page.
+ *
+ * The uid argument accepts only negative values. If this is given, the new
+ * record will be placed (by sorting field) behind the record with the uid.
+ * It will end up on the same pid as this given record, so the pid must not
+ * be given explicitly by pid argument.
+ *
+ * An exception will be thrown, if both uid and pid are given.
+ * An exception will be thrown, if the uid argument is not a negative integer.
+ *
+ * To edit records, use the editRecordViewHelper
+ *
+ * = Examples =
+ *
+ * <code title="Link to create a new record of a_table after record 17 on the same pid">
+ * <be:link.newRecord table="a_table" returnUrl="foo/bar" uid="-17"/>
+ * </code>
+ * <output>
+ * <a href="/typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar">
+ *   Edit record
+ * </a>
+ * </output>
+ *
+ * <code title="Link to create a new record of a_table on root page">
+ * <be:link.newRecord table="a_table" returnUrl="foo/bar""/>
+ * </code>
+ * <output>
+ * <a href="/typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar">
+ *   Edit record
+ * </a>
+ * </output>
+ *
+ * <code title="Link to create a new record of a_table on page 17">
+ * <be:link.newRecord table="a_table" returnUrl="foo/bar" pid="17"/>
+ * </code>
+ * <output>
+ * <a href="/typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar">
+ *   Edit record
+ * </a>
+ * </output>
+ */
+class NewRecordViewHelper extends AbstractTagBasedViewHelper
+{
+    /**
+     * @var string
+     */
+    protected $tagName = 'a';
+
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerUniversalTagAttributes();
+        $this->registerArgument('uid', 'int', 'uid < 0 will insert the record after the given uid', false);
+        $this->registerArgument('pid', 'int', 'the page id where the record will be created', false);
+        $this->registerArgument('table', 'string', 'target database table', true);
+        $this->registerArgument('returnUrl', 'string', '', false, '');
+    }
+
+    /**
+     * @return string
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
+     */
+    public function render(): string
+    {
+        if ($this->arguments['uid'] && $this->arguments['pid']) {
+            throw new \InvalidArgumentException('Can\'t handle both uid and pid for new records', 1526129969);
+        }
+        if (isset($this->arguments['uid']) && $this->arguments['uid'] >= 0) {
+            throw new \InvalidArgumentException('Uid must be negative integer, ' . $this->arguments['uid'] . ' given', 1526134901);
+        }
+
+        if (empty($this->arguments['returnUrl'])) {
+            $this->arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
+        }
+
+        $params = [
+            'edit' => [$this->arguments['table'] => [$this->arguments['uid'] ?? $this->arguments['pid'] ?? 0 => 'new']],
+            'returnUrl' => $this->arguments['returnUrl']
+        ];
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+        $uri = (string)$uriBuilder->buildUriFromRoute('record_edit', $params);
+        $this->tag->addAttribute('href', $uri);
+        $this->tag->setContent($this->renderChildren());
+        $this->tag->forceClosingTag(true);
+        return $this->tag->render();
+    }
+}
diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php
new file mode 100644 (file)
index 0000000..68e9dba
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\ViewHelpers\Uri;
+
+use TYPO3\CMS\Backend\Routing\UriBuilder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
+use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
+
+/**
+ * Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will
+ * pass the uid and table to FormEngine.
+ *
+ * The uid must be given as a positive integer.
+ * For new records, use the newRecordViewHelper
+ *
+ * = Examples =
+ *
+ * <code title="URI to the record-edit action passed to FormEngine">
+ * <be:uri.editRecord uid="42" table="a_table" returnUrl="foo/bar" />
+ * </code>
+ * <output>
+ * /typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar
+ * </output>
+ */
+class EditRecordViewHelper extends AbstractViewHelper
+{
+    use CompileWithRenderStatic;
+
+    public function initializeArguments()
+    {
+        $this->registerArgument('uid', 'int', 'uid of record to be edited, 0 for creation', true);
+        $this->registerArgument('table', 'string', 'target database table', true);
+        $this->registerArgument('returnUrl', 'string', '', false, '');
+    }
+
+    /**
+     * @param array $arguments
+     * @param \Closure $renderChildrenClosure
+     * @param RenderingContextInterface $renderingContext
+     *
+     * @return string
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
+     */
+    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
+    {
+        if ($arguments['uid'] < 1) {
+            throw new \InvalidArgumentException('Uid must be a positive integer, ' . $arguments['uid'] . ' given.', 1526128259);
+        }
+        if (empty($arguments['returnUrl'])) {
+            $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
+        }
+
+        $params = [
+            'edit' => [$arguments['table'] => [$arguments['uid'] => 'edit']],
+            'returnUrl' => $arguments['returnUrl']
+        ];
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+        return (string)$uriBuilder->buildUriFromRoute('record_edit', $params);
+    }
+}
diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php
new file mode 100644 (file)
index 0000000..231ce17
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\ViewHelpers\Uri;
+
+use TYPO3\CMS\Backend\Routing\UriBuilder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
+use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
+
+/**
+ * Use this ViewHelper to provide 'create new record' links.
+ * The ViewHelper will pass the command to FormEngine.
+ *
+ * The table argument is mandatory, it decides what record is to be created.
+ *
+ * The pid argument will put the new record on this page, if 0 given it will
+ * be placed to the root page.
+ *
+ * The uid argument accepts only negative values. If this is given, the new
+ * record will be placed (by sorting field) behind the record with the uid.
+ * It will end up on the same pid as this given record, so the pid must not
+ * be given explicitly by pid argument.
+ *
+ * An exception will be thrown, if both uid and pid are given.
+ * An exception will be thrown, if the uid argument is not a negative integer.
+ *
+ * To edit records, use the editRecordViewHelper
+ *
+ * = Examples =
+ *
+ * <code title="Uri to create a new record of a_table after record 17 on the same pid">
+ * <be:uri.newRecord table="a_table" returnUrl="foo/bar" uid="-17"/>
+ * </code>
+ * <output>
+ *  /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar
+ * </output>
+ *
+ * <code title="Uri to create a new record of a_table on root page">
+ * <be:uri.newRecord table="a_table" returnUrl="foo/bar""/>
+ * </code>
+ * <output>
+ *  /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar
+ * </output>
+ *
+ * <code title="Uri to create a new record of a_table on page 17">
+ * <be:uri.newRecord table="a_table" returnUrl="foo/bar" pid="17"/>
+ * </code>
+ * <output>
+ *  /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar
+ * </output>
+ */
+class NewRecordViewHelper extends AbstractTagBasedViewHelper
+{
+    use CompileWithRenderStatic;
+
+    public function initializeArguments()
+    {
+        $this->registerArgument('uid', 'int', 'uid < 0 will insert the record after the given uid', false);
+        $this->registerArgument('pid', 'int', 'the page id where the record will be created', false);
+        $this->registerArgument('table', 'string', 'target database table', true);
+        $this->registerArgument('returnUrl', 'string', '', false, '');
+    }
+
+    /**
+     * @param array $arguments
+     * @param \Closure $renderChildrenClosure
+     * @param RenderingContextInterface $renderingContext
+     *
+     * @return string
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
+     */
+    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
+    {
+        if ($arguments['uid'] && $arguments['pid']) {
+            throw new \InvalidArgumentException('Can\'t handle both uid and pid for new records', 1526136338);
+        }
+        if (isset($arguments['uid']) && $arguments['uid'] >= 0) {
+            throw new \InvalidArgumentException('Uid must be negative integer, ' . $arguments['uid'] . ' given', 1526136362);
+        }
+
+        if (empty($arguments['returnUrl'])) {
+            $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
+        }
+
+        $params = [
+            'edit' => [$arguments['table'] => [$arguments['uid'] ?? $arguments['pid'] ?? 0 => 'new']],
+            'returnUrl' => $arguments['returnUrl']
+        ];
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+        return (string)$uriBuilder->buildUriFromRoute('record_edit', $params);
+    }
+}
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/InlineWithUidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/InlineWithUidAndTable.html
new file mode 100644 (file)
index 0000000..fff0326
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    {be:link.editRecord(uid: 21, table: 'b_table')}
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithNegativeUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithNegativeUid.html
new file mode 100644 (file)
index 0000000..c5c3262
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.editRecord uid="-42" table="c_table">edit record c_table:-42</be:link.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidAndTable.html
new file mode 100644 (file)
index 0000000..eb4e421
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.editRecord uid="42" table="a_table">edit record a_table:42</be:link.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidTableAndReturnUrl.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidTableAndReturnUrl.html
new file mode 100644 (file)
index 0000000..00d4083
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.editRecord uid="43" table="c_table" returnUrl="foo/bar">edit record c_table:43</be:link.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/InlineWithPidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/InlineWithPidAndTable.html
new file mode 100644 (file)
index 0000000..65726f3
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    {be:link.newRecord(table: 'b_table', pid:17)}
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithNegativeUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithNegativeUid.html
new file mode 100644 (file)
index 0000000..bbc45d9
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord uid="-11" table="c_table">new record at c_table after record with uid 11</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidAndTable.html
new file mode 100644 (file)
index 0000000..66ea038
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord table="a_table" pid="17">new record at a_table on page 17</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidTableAndReturnUrl.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidTableAndReturnUrl.html
new file mode 100644 (file)
index 0000000..b7bfb0a
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord table="c_table" returnUrl="foo/bar" pid="17">new record at c_table</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPositiveUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPositiveUid.html
new file mode 100644 (file)
index 0000000..712c253
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord uid="42" table="c_table">if uid given, it must be negative</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithTable.html
new file mode 100644 (file)
index 0000000..d2a29a1
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord table="a_table">new record at a_table on root</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithUidAndPid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithUidAndPid.html
new file mode 100644 (file)
index 0000000..c706dcd
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:link.newRecord uid="-42" pid="18" table="c_table">can't handle uid and pid together</be:link.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html
new file mode 100644 (file)
index 0000000..556371a
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    {be:uri.editRecord(uid: 21, table: 'b_table')}
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithNegativeUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithNegativeUid.html
new file mode 100644 (file)
index 0000000..faa0785
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.editRecord uid="-42" table="c_table">edit record c_table:-42</be:uri.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html
new file mode 100644 (file)
index 0000000..4d75bd6
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.editRecord uid="42" table="a_table">edit record a_table:42</be:uri.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html
new file mode 100644 (file)
index 0000000..51ff1af
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.editRecord uid="43" table="c_table" returnUrl="foo/bar">edit record c_table:43</be:uri.editRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html
new file mode 100644 (file)
index 0000000..cdb59fc
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    {be:uri.newRecord(table: 'b_table', pid:17)}
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html
new file mode 100644 (file)
index 0000000..40ebe44
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord uid="-11" table="c_table">new record at c_table after record with uid 11</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html
new file mode 100644 (file)
index 0000000..3b12425
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord table="a_table" pid="17">new record at a_table on page 17</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html
new file mode 100644 (file)
index 0000000..794734b
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord table="c_table" returnUrl="foo/bar" pid="17">new record at c_table</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPositiveUid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPositiveUid.html
new file mode 100644 (file)
index 0000000..128455a
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord uid="42" table="c_table">if uid given, it must be negative</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html
new file mode 100644 (file)
index 0000000..a543f7a
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord table="a_table">new record at a_table on root</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithUidAndPid.html b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithUidAndPid.html
new file mode 100644 (file)
index 0000000..5bef876
--- /dev/null
@@ -0,0 +1,3 @@
+<html xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers">
+    <be:uri.newRecord uid="-42" pid="18" table="c_table">can't handle uid and pid together</be:uri.newRecord>
+</html>
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php
new file mode 100644 (file)
index 0000000..aeea623
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Link;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Test case for \TYPO3\CMS\Backend\ViewHelpers\Link\EditRecordViewHelper
+ */
+class EditRecordViewHelperTest extends FunctionalTestCase
+{
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInExplicitFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][42]=edit', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInInlineFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/InlineWithUidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[b_table][21]=edit', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWithReturnUrl()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithUidTableAndReturnUrl.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][43]=edit', $result);
+        $this->assertContains('returnUrl=foo/bar', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForInvalidUidArgument()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526127158);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/EditRecordViewHelper/WithNegativeUid.html');
+        $view->render();
+    }
+}
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php
new file mode 100644 (file)
index 0000000..1c4bfa1
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Link;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Test case for \TYPO3\CMS\Backend\ViewHelpers\Link\NewRecordViewHelper
+ */
+class NewRecordViewHelperTest extends FunctionalTestCase
+{
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInExplicitFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][17]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkForRoot()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][0]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInInlineFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/InlineWithPidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[b_table][17]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWithReturnUrl()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPidTableAndReturnUrl.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][17]=new', $result);
+        $this->assertContains('returnUrl=foo/bar', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWithPosition()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithNegativeUid.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][-11]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForUidAndPid()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526129969);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithUidAndPid.html');
+        $view->render();
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForInvalidUidArgument()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526134901);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Link/NewRecordViewHelper/WithPositiveUid.html');
+        $view->render();
+    }
+}
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php
new file mode 100644 (file)
index 0000000..bfcf0bd
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Test case for \TYPO3\CMS\Backend\ViewHelpers\Uri\EditRecordViewHelper
+ */
+class EditRecordViewHelperTest extends FunctionalTestCase
+{
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInExplicitFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][42]=edit', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInInlineFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[b_table][21]=edit', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWithReturnUrl()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][43]=edit', $result);
+        $this->assertContains('returnUrl=foo/bar', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForInvalidUidArgument()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526128259);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithNegativeUid.html');
+        $view->render();
+    }
+}
diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php
new file mode 100644 (file)
index 0000000..82f5915
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Test case for \TYPO3\CMS\Backend\ViewHelpers\Uri\NewRecordViewHelper
+ */
+class NewRecordViewHelperTest extends FunctionalTestCase
+{
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInExplicitFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][17]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkForRoot()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[a_table][0]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkInInlineFormat()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[b_table][17]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWithReturnUrl()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][17]=new', $result);
+        $this->assertContains('returnUrl=foo/bar', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderReturnsValidLinkWitPosition()
+    {
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html');
+        $result = urldecode($view->render());
+
+        $this->assertContains('route=/record/edit', $result);
+        $this->assertContains('edit[c_table][-11]=new', $result);
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForUidAndPid()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526136338);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithUidAndPid.html');
+        $view->render();
+    }
+
+    /**
+     * @test
+     */
+    public function renderThrowsExceptionForInvalidUidArgument()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1526136362);
+
+        $view = GeneralUtility::makeInstance(StandaloneView::class);
+        $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPositiveUid.html');
+        $view->render();
+    }
+}
index 55818d9..8fbec2c 100644 (file)
@@ -132,7 +132,7 @@ class BackendUserActionController extends ActionController
         $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUsers');
         if ($this->request->getControllerName() === 'BackendUser') {
             if ($this->request->getControllerActionName() === 'index') {
-                $returnUrl = rawurlencode((string)$uriBuilder->buildUriFromRoute('system_BeuserTxBeuser'));
+                $returnUrl = (string)$uriBuilder->buildUriFromRoute('system_BeuserTxBeuser');
                 $parameters = GeneralUtility::explodeUrl2Array('edit[be_users][0]=new&returnUrl=' . $returnUrl);
                 $addUserLink = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
                 $title = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral');
index b3e3425..b932f51 100644 (file)
@@ -158,7 +158,7 @@ class BackendUserController extends BackendUserActionController
         $this->view->assign('demand', $demand);
         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
-        $this->view->assign('returnUrl', rawurlencode((string)$uriBuilder->buildUriFromRoute('system_BeuserTxBeuser')));
+        $this->view->assign('returnUrl', (string)$uriBuilder->buildUriFromRoute('system_BeuserTxBeuser'));
         $this->view->assign('dateFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
         $this->view->assign('timeFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']);
         $this->view->assign('backendUsers', $this->backendUserRepository->findDemanded($demand));
@@ -206,7 +206,7 @@ class BackendUserController extends BackendUserActionController
                 'tx_beuser_system_beusertxbeuser[controller]' => 'BackendUser'
             ]
         );
-        $this->view->assign('returnUrl', rawurlencode($returnUrl));
+        $this->view->assign('returnUrl', $returnUrl);
         $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '');
     }
 
index e6cd687..4f1dc19 100644 (file)
@@ -59,7 +59,7 @@ class BackendUserGroupController extends BackendUserActionController
         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
         $this->view->assign('backendUserGroups', $this->backendUserGroupRepository->findAll());
-        $this->view->assign('returnUrl', rawurlencode((string)$uriBuilder->buildUriFromRoute(
+        $this->view->assign('returnUrl', (string)$uriBuilder->buildUriFromRoute(
             'system_BeuserTxBeuser',
             [
                 'tx_beuser_system_beusertxbeuser' => [
@@ -67,6 +67,6 @@ class BackendUserGroupController extends BackendUserActionController
                     'controller' => 'BackendUserGroup'
                 ]
             ]
-        )));
+        ));
     }
 }
diff --git a/typo3/sysext/beuser/Classes/ViewHelpers/EditRecordViewHelper.php b/typo3/sysext/beuser/Classes/ViewHelpers/EditRecordViewHelper.php
deleted file mode 100644 (file)
index 758211f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-namespace TYPO3\CMS\Beuser\ViewHelpers;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * Edit Record ViewHelper, see FormEngine logic
- *
- * @internal
- */
-class EditRecordViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('parameters', 'string', 'Is a set of GET params to send to FormEngine', true);
-    }
-
-    /**
-     * Returns a URL to link to FormEngine
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @see \TYPO3\CMS\Backend\Routing\UriBuilder::buildUriFromRoute()
-     * @return string URL to FormEngine module + parameters
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
-        return (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
-    }
-}
index 237f4ca..b2d6d20 100644 (file)
@@ -1,6 +1,9 @@
-{namespace be = TYPO3\CMS\Backend\ViewHelpers}
-{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+         xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
+         xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
+         xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
 
+<f:section name="list_row">
 <tr>
        <td>
                <a href="#" class="t3js-contextmenutrigger" data-table="be_users" data-uid="{backendUser.uid}" title="{f:if(condition: '{backendUser.description}', then: '{backendUser.description} ')}(id={backendUser.uid})">
                </a>
        </td>
        <td class="col-title">
-               <a href="{bu:editRecord(parameters: 'edit[be_users][{backendUser.uid}]=edit&returnUrl={returnUrl}')}">
+               <be:link.editRecord table="be_users" uid="{backendUser.uid}" returnUrl="{returnUrl}" title="edit">
                        <b>{backendUser.userName}</b>
-               </a>
+               </be:link.editRecord>
                <f:if condition="{bu:arrayElement(array: onlineBackendUsers, key: backendUser.uid)}">
                        <span class="label label-success"><f:translate key="online" /></span>
                </f:if>
                <br />
-               <a href="{bu:editRecord(parameters: 'edit[be_users][{backendUser.uid}]=edit&returnUrl={returnUrl}')}">{backendUser.realName}</a>
+               <f:if condition="{backendUser.realName}">
+                       <be:link.editRecord table="be_users" uid="{backendUser.uid}" returnUrl="{returnUrl}" title="edit">
+                               {backendUser.realName}
+                       </be:link.editRecord>
+               </f:if>
        </td>
        <td>
                <f:if condition="{backendUser.lastLoginDateAndTime}">
@@ -29,7 +36,9 @@
        </td>
        <td class="col-control">
                <div class="btn-group" role="group">
-                       <a class="btn btn-default" href="{bu:editRecord(parameters: 'edit[be_users][{backendUser.uid}]=edit&returnUrl={returnUrl}')}"><core:icon identifier="actions-open" /></a>
+                       <be:link.editRecord class="btn btn-default" table="be_users" uid="{backendUser.uid}" returnUrl="{returnUrl}" title="edit" >
+                               <core:icon identifier="actions-open" />
+                       </be:link.editRecord>
                        <f:if condition="{backendUser.currentlyLoggedIn} == 1">
                                <f:then>
                                        <span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
@@ -80,3 +89,5 @@
                </div>
        </td>
 </tr>
+</f:section>
+</html>
index d1d812f..15b5ac4 100644 (file)
@@ -10,7 +10,7 @@
         </thead>
         <tbody>
         <f:for each="{paginatedBackendUsers}" as="backendUser">
-            <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList, currentUserUid: currentUserUid}" />
+            <f:render partial="BackendUser/IndexListRow" section="list_row" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList, currentUserUid: currentUserUid}" />
         </f:for>
         <f:comment>
             Footer row: no officially defined style yet
index de58ead..06df8fb 100644 (file)
@@ -1,4 +1,9 @@
-{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+         xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
+         xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
+         xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
+
+<f:section name="list_row">
 <tr>
        <td class="col-icon">
                <a href="#" class="t3js-contextmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" title="{f:if(condition: '{backendUserGroup.description}', then: '{backendUserGroup.description} ')}(id={backendUserGroup.uid})">
                </a>
        </td>
        <td class="col-title">
-
-               <a href="{bu:editRecord(parameters: 'edit[be_groups][{backendUserGroup.uid}]=edit&returnUrl={returnUrl}')}">
+               <be:link.editRecord table="be_groups" uid="{backendUserGroup.uid}" returnUrl="{returnUrl}" title="edit">
                        <b>{backendUserGroup.title}</b><br />
                        {backendUser.realName}
-               </a>
+               </be:link.editRecord>
        </td>
        <td>
                <f:for each="{backendUserGroup.subgroups}" as="subgroup" iteration="subGroupIterator">
-                       <a href="{bu:editRecord(parameters: 'edit[be_groups][{backendUserGroup.uid}]=edit&returnUrl={returnUrl}')}">
+                       <be:link.editRecord table="be_groups" uid="{subgroup.uid}" returnUrl="{returnUrl}" title="edit">
                                {subgroup.title}
-                       </a>
+                       </be:link.editRecord>
                        <f:if condition="{subGroupIterator.isLast}"><f:else>, </f:else></f:if>
                </f:for>
        </td>
        <td class="col-control">
                <div class="btn-group" role="group">
-                       <a class="btn btn-default" href="{bu:editRecord(parameters: 'edit[be_groups][{backendUserGroup.uid}]=edit&returnUrl={returnUrl}')}"><core:icon identifier="actions-open" /></a>
+                       <be:link.editRecord class="btn btn-default" table="be_groups" uid="{backendUserGroup.uid}" returnUrl="{returnUrl}" title="edit">
+                               <core:icon identifier="actions-open" />
+                       </be:link.editRecord>
                        <f:if condition="{backendUserGroup.hidden}">
                                <f:then>
                                        <a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=0', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.unhide')}"><core:icon identifier="actions-edit-unhide" /></a>
@@ -33,7 +39,9 @@
                        </f:if>
                </div>
                <div class="btn-group" role="group">
-                       <a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_groups', '{backendUserGroup.uid}'); return false;"><core:icon identifier="actions-document-info" /></a
+                       <a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_groups', '{backendUserGroup.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
                </div>
        </td>
 </tr>
+</f:section>
+</html>
index 21b385a..5721b13 100644 (file)
@@ -10,7 +10,7 @@
         </thead>
         <tbody>
         <f:for each="{paginatedBackendUserGroups}" as="backendUserGroup">
-            <f:render partial="BackendUserGroup/IndexListRow" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, currentUserUid: currentUserUid}" />
+            <f:render partial="BackendUserGroup/IndexListRow" section="list_row" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, currentUserUid: currentUserUid}" />
         </f:for>
         <f:comment>
             Footer row: no officially defined style yet
index 03e3c7f..9b62e59 100644 (file)
@@ -1,5 +1,7 @@
-{namespace be = TYPO3\CMS\Backend\ViewHelpers}
-{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+         xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
+         xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
+         xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
 
 <f:layout name="Default" />
 
@@ -19,9 +21,9 @@
                                                                <be:avatar backendUser="{compareUser.uid}" showIcon="true" />
                                                        </a>
                                                        {compareUser.userName}
-                                                       <a class="btn btn-default pull-right" href="{bu:editRecord(parameters: 'edit[be_users][{compareUser.uid}]=edit&returnUrl={returnUrl}')}" title="edit">
+                                                               <be:link.editRecord class="btn btn-default pull-right" table="be_users" uid="{compareUser.uid}" returnUrl="{returnUrl}" title="edit">
                                                                <core:icon identifier="actions-open" />
-                                                       </a>
+                                                               </be:link.editRecord>
                                                </th>
                                        </f:for>
                                </tr>
                </table>
        </div>
 </f:section>
+</html>
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-84983-BEViewHelperForEditDocumentController.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-84983-BEViewHelperForEditDocumentController.rst
new file mode 100644 (file)
index 0000000..df0ce3e
--- /dev/null
@@ -0,0 +1,90 @@
+.. include:: ../../Includes.txt
+
+==========================================================
+Feature: #84983 - BE ViewHelper for EditDocumentController
+==========================================================
+
+See :issue:`84983`
+
+Description
+===========
+
+Linking to FormEngine / EditDocumentController in fluid templates of backend modules
+to edit database records and to create new records, has been simplified by introducing
+a series of new view helpers.
+
+Usage:
+======
+
+New record URI and Link view helper
+-----------------------------------
+
+Outputs the uri / the link to bring up FormEngine with the create new record form.
+
+Available view helper arguments:
+
+table
+    Mandatory. The database table the record belongs to.
+
+uid
+    Optional. Negative value of the uid of the record the new record should be placed after. Must be negative!
+
+pid
+    Optional. The pid of the page the record should be placed to. Must be zero or positive. If not given, defaults to zero (root page).
+
+returnUrl
+    Optional. If given, the form redirects to that URL after save / close.
+
+.. note::
+
+    The ViewHelper accepts either pid or uid to be set, not both. If none is set, the record will be put to pid 0,
+    if the TCA configuration of the table allows this.
+
+
+.. code-block:: html
+
+    <!-- URI to add a new news record on page 11 -->
+    <be:uri.newRecord pid="11" table="tx_news_domain_model_news" />
+
+    <!-- URI to add a new news record on root page -->
+    <be:uri.newRecord table="tx_news_domain_model_news" />
+
+    <!-- URI to add a new news record sorted after news record 17 and on the same pid as record 17 -->
+    <be:uri.newRecord uid=-17 table="tx_news_domain_model_news" />
+
+    <!-- Full link to add a new news record on page 25 -->
+    <be:link.newRecord pid="25" table="tx_news_domain_model_news">create news article</be:link.newRecord>
+
+
+Edit record URI and Link view helper
+------------------------------------
+
+Outputs the uri / the link to bring up FormEngine with the records edit form.
+
+Available view helper arguments:
+
+table
+    Mandatory. The database table the record belongs to.
+
+uid
+    Mandatory. The uid of the record to be edited.
+
+returnUrl
+    Optional. If given, the form redirects to that URL after save / close.
+
+
+.. code-block:: html
+
+    <!-- URI to edit the news record with uid 43 -->
+    <be:uri.editRecord uid="43" table="tx_news_domain_model_news" />
+
+    <!-- Link to edit the news record with uid 43 -->
+    <be:link.editRecord uid="43" table="tx_news_domain_model_news" />
+
+
+Impact
+======
+
+Extensions must no longer provide their own ViewHelpers for editing and creating records. The ones provided from ext:backend are public API.
+
+.. index:: Backend, Fluid, ext:backend
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/CompareUserCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/CompareUserCest.php
new file mode 100644 (file)
index 0000000..30dbcb8
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Tests concerning the compare view of BE user module
+ */
+class CompareUserCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+
+        $I->see('Backend users');
+        $I->click('Backend users');
+
+        // switch to content iframe
+        $I->switchToIFrame('list_frame');
+        $I->waitForElementNotVisible('div#nprogess');
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function editingBeUserRecordsFromCompareViewWorks(Admin $I)
+    {
+        // put two users into compare list
+        $I->see('Backend User Listing');
+        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(3) > a');
+        $I->waitForElementVisible('table#typo3-backend-user-list');
+        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(2) > td.col-control > div:nth-child(3) > a');
+        $I->waitForElementVisible('table#typo3-backend-user-list-compare');
+        $I->canSeeNumberOfElements('#typo3-backend-user-list-compare tbody tr', 2);
+        $I->click('body > div > div.module-body.t3js-module-body > form:nth-child(4) > input');
+        $I->waitForElementVisible('table.table-striped');
+
+        // first user can be edited
+        $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(2)');
+        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(2) > a.btn.btn-default.pull-right');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->waitForElementVisible('#EditDocumentController');
+        $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');
+
+        // back to compare view
+        $I->click('div.module-docheader .btn.t3js-editform-close');
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Compare backend users', 'h1');
+
+        // second user can be edited
+        $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(3)');
+        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(3) > a.btn.btn-default.pull-right');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->waitForElementVisible('#EditDocumentController');
+        $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/ListGroupCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/BackendUser/ListGroupCest.php
new file mode 100644 (file)
index 0000000..1fbf884
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Tests concerning the listing of BeUser groups
+ */
+class ListGroupCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+
+        $I->see('Backend users');
+        $I->click('Backend users');
+
+        // switch to content iframe
+        $I->switchToIFrame('list_frame');
+        $I->waitForElementNotVisible('div#nprogess');
+        $I->selectOption('div.module-docheader  select.t3-js-jumpMenuBox', 'Backend user groups');
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Backend User Group Listing', 'h1');
+    }
+
+    public function canEditBeGroupsFromListView(Admin $I)
+    {
+        $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a > b');
+
+        $I->amGoingTo('test edit on group name');
+        $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a');
+        $this->openAndCloseTheEditForm($I, $groupname);
+
+        $I->amGoingTo('test edit on edit button');
+        $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a:nth-child(1)');
+        $this->openAndCloseTheEditForm($I, $groupname);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function canEditSubGroupFromListView(Admin $I)
+    {
+        $I->amGoingTo('test the subgroup edit form');
+        $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
+        $I->click('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
+        $this->openAndCloseTheEditForm($I, $groupname);
+    }
+
+    /**
+     * @param Admin $I
+     * @param string $groupname
+     */
+    private function openAndCloseTheEditForm(Admin $I, string $groupname): void
+    {
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Edit Backend usergroup "' . $groupname . '" on root level');
+
+        $I->click('div.module-docheader .btn.t3js-editform-close');
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Backend User Group Listing', 'h1');
+    }
+}
index 0d0711e..3448046 100644 (file)
@@ -202,4 +202,41 @@ class ListUserCest
         $I->canSeeNumberOfElements('#typo3-backend-user-list tfoot tr', 1);
         $I->see($countOfUsers . ' Users', '#typo3-backend-user-list tfoot tr');
     }
+
+    /**
+     * @param Admin $I
+     */
+    public function canEditUsersFromIndexListView(Admin $I)
+    {
+        $I->canSee('Backend User Listing', 'h1');
+        $username = $I->grabTextFrom('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1) > b');
+
+        $I->amGoingTo('test the edit button');
+        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a');
+        $this->openAndCloseTheEditForm($I, $username);
+
+        $I->amGoingTo('test the edit link on username');
+        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1)');
+        $this->openAndCloseTheEditForm($I, $username);
+
+        $I->amGoingTo('test the edit link on real name');
+        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(4)');
+        $this->openAndCloseTheEditForm($I, $username);
+    }
+
+    /**
+     * @param Admin $I
+     * @param string $username
+     *
+     * @throws \Exception
+     */
+    private function openAndCloseTheEditForm(Admin $I, string $username): void
+    {
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Edit Backend user "' . $username . '" on root level');
+
+        $I->click('div.module-docheader .btn.t3js-editform-close');
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Backend User Listing', 'h1');
+    }
 }
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/FileList/FileMetaDataCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/FileList/FileMetaDataCest.php
new file mode 100644 (file)
index 0000000..543273b
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\FileList;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Cases concerning sys_file_metadata records
+ */
+class FileMetaDataCest
+{
+    /**
+     * @param Admin $I
+     *
+     * @throws \Exception
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+    }
+
+    /**
+     * @param Admin $I
+     *
+     * @throws \Exception
+     */
+    public function metaDataCanBeEdited(Admin $I)
+    {
+        $I->wantToTest('Metadata can be edited through search list results');
+        $I->click('Filelist');
+
+        $I->switchToIFrame('list_frame');
+        $I->waitForElementNotVisible('div#nprogress');
+        $I->canSee('fileadmin/ (auto-created)');
+
+        $I->fillField('tx_filelist_file_filelistlist[searchWord]', 'bus');
+        $I->click('Search');
+        $I->waitForElementVisible('table.table-striped');
+
+        $I->click('bus_lane.jpg');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->waitForElementVisible('#EditDocumentController');
+
+        $I->canSee('Edit File Metadata "bus_lane.jpg"', 'h1');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/RecordList/SysNoteCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/RecordList/SysNoteCest.php
new file mode 100644 (file)
index 0000000..17bb058
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+declare(strict_types = 1);
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\RecordList;
+
+use Facebook\WebDriver\WebDriverKeys;
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
+
+/**
+ * Cases concerning sys_note records
+ */
+class SysNoteCest
+{
+    /**
+     * @param Admin $I
+     *
+     * @throws \Exception
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+    }
+
+    /**
+     * @param Admin $I
+     * @param PageTree $pageTree
+     *
+     * @throws \Exception
+     */
+    public function notesEntryCanBeEdited(Admin $I, PageTree $pageTree)
+    {
+        $I->wantToTest('whether sysnote entries can be edited via the Internal Notes section in List View');
+
+        $I->amGoingTo('create a record');
+        $I->click('List');
+        $I->waitForElementNotVisible('div#nprogress');
+        $pageTree->openPath(['styleguide TCA demo']);
+        $I->wait(0.2);
+        $I->switchToIFrame('list_frame');
+
+        $I->click('.module-docheader .btn[title="Create new record"]');
+        $I->wait(0.2);
+        $I->canSee('New record');
+
+        $I->click('ul.list-tree');
+        // it takes two strokes to get all the way down
+        $I->pressKey('body', WebDriverKeys::PAGE_DOWN);
+        $I->pressKey('body', WebDriverKeys::PAGE_DOWN);
+        $I->click('Internal note');
+
+        $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_note]") and contains(@data-formengine-input-name, "[subject]")]', 'new sys_note');
+        $I->click('button[name="_savedok"]');
+        $I->wait(0.2);
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->click('a[title="Close"]');
+        $I->wait(1);
+        $I->canSee('styleguide TCA demo', 'h1');
+        $I->click('a.t3js-toggle-recordlist[data-table="pages"]');
+        $I->canSee('Internal notes', 'h2');
+        $I->canSee('new sys_note');
+        $I->click('div.typo3-dblist-sysnotes > div > div.panel-heading.clearfix > div > a:nth-child(1)');
+        $I->wait(0.2);
+        $I->canSee('Edit Internal note "new sys_note"');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Redirect/RedirectModuleCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Redirect/RedirectModuleCest.php
new file mode 100644 (file)
index 0000000..1b5f529
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Tests concerning Redirects Module
+ */
+class RedirectModuleCest
+{
+
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+
+        $I->click('Redirects');
+        $I->switchToIFrame('list_frame');
+        $I->waitForElementNotVisible('div#nprogress');
+        $I->canSee('Redirect Management', 'h1');
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function createNewRecordIfNoneExist(Admin $I)
+    {
+        $I->amGoingTo('create a new redirects record while none are in the system, yet');
+        $I->canSee('No redirects found!');
+        $I->click('Create new redirect');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Create new Redirect on root level');
+
+        $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[source_path]")]', '/my-path/');
+        $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[target]")]', 1);
+
+        $saveButtonLink = '//*/button[@name="_savedok"][1]';
+        $I->waitForElement($saveButtonLink, 30);
+        $I->click($saveButtonLink);
+        $I->waitForElementNotVisible('#t3js-ui-block');
+
+        $I->click('div.module-docheader .btn.t3js-editform-close');
+
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Redirect Management', 'h1');
+        $I->canSeeNumberOfElements('table.table-striped > tbody > tr', 1);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function canEditRecordFromListView(Admin $I)
+    {
+        $sourceHost = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(1)');
+        $sourcePath = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(2) > a');
+
+        $I->amGoingTo('test edit on source path');
+        $I->click('table.table-striped > tbody > tr > td:nth-child(2) > a');
+        $this->openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
+
+        $I->amGoingTo('test edit on edit button');
+        $I->click('table.table-striped > tbody > tr > td:nth-child(6) > div > a:nth-child(2)');
+        $this->openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
+    }
+
+    /**
+     * @param Admin $I
+     * @param string $name
+     */
+    private function openAndCloseTheEditForm(Admin $I, string $name): void
+    {
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Edit Redirect "' . $name . '" on root level');
+
+        $I->click('div.module-docheader .btn.t3js-editform-close');
+        $I->waitForElementVisible('table.table-striped');
+        $I->canSee('Redirect Management', 'h1');
+    }
+}
index 379d462..7370f4b 100644 (file)
@@ -149,4 +149,37 @@ class TasksCest
         $I->see('Information');
         $I->canSeeNumberOfElements('.tx_scheduler_mod1 table tbody tr', [1, 10000]);
     }
+
+    /**
+     * @param Admin $I
+     */
+    public function canCreateNewTaskGroupFromEditForm(Admin $I)
+    {
+        $I->amGoingTo('create a task when none exists yet');
+        $I->canSee('Scheduled tasks', 'h1');
+        $this->createASchedulerTask($I);
+
+        $I->amGoingTo('test the new task group button on task edit view');
+        $I->click('#DataTables_Table_0 > tbody > tr > td.nowrap > span > div:nth-child(1) > a:nth-child(1)');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Edit task', 'h2');
+        $I->click('#task_group_row > div > div > div > div > a');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->canSee('Create new Scheduler task group on root level', 'h1');
+
+        $I->fillField('//input[contains(@data-formengine-input-name, "data[tx_scheduler_task_group]") and contains(@data-formengine-input-name, "[groupName]")]', 'new task group');
+        $I->click('button[name="_savedok"]');
+        $I->wait(0.2);
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->click('a[title="Close"]');
+        $I->waitForElementVisible('#tx_scheduler_form');
+
+        $I->selectOption('select#task_class', 'new task group');
+        $I->click('button[value="save"]');
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->click('a[title="Cancel"]');
+        $I->waitForElementVisible('div.tx_scheduler_mod1');
+
+        $I->canSee('new task group', 'tr.taskGroup');
+    }
 }
diff --git a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditSysFileMetadataRecordViewHelper.php b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditSysFileMetadataRecordViewHelper.php
deleted file mode 100644 (file)
index 2a4adbf..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Backend\Routing\UriBuilder;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * Class EditSysFileMetadataRecordViewHelper
- */
-class EditSysFileMetadataRecordViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initialize arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('uid', 'int', '', true);
-        $this->registerArgument('returnUrl', 'string', '', false, '');
-    }
-
-    /**
-     * Renders a link to edit sys_file_metadata
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @return string
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        if (empty($arguments['returnUrl'])) {
-            $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
-        }
-
-        $params = [
-            'edit' => ['sys_file_metadata' => [$arguments['uid'] => 'edit']],
-            'returnUrl' => $arguments['returnUrl']
-        ];
-        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
-        return (string)$uriBuilder->buildUriFromRoute('record_edit', $params);
-    }
-}
index 6561b06..d110803 100644 (file)
@@ -1,5 +1,6 @@
 <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
        xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
+       xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
        xmlns:fl="http://typo3.org/ns/TYPO3/CMS/Filelist/ViewHelpers">
 <f:layout name="Default"/>
 
@@ -43,7 +44,7 @@
                                                                <f:then>
                                                                        <a href="#" class="filelist-file-title"
                                                                                title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
-                                                                               data-url="{fl:uri.editSysFileMetadataRecord( uid:file.metadataUid, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
+                                                                               data-url="{be:uri.editRecord( uid:file.metadataUid, table:'sys_file_metadata', returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
                                                                        >
                                                                                {file.name}
                                                                        </a>
@@ -77,7 +78,7 @@
                                                                        <f:then>
                                                                                <a href="#" class="btn btn-default filelist-file-edit"
                                                                                   title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
-                                                                                  data-url="{fl:uri.editSysFileMetadataRecord(uid:file.metadataUid, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
+                                                                                  data-url="{be:uri.editRecord(uid:file.metadataUid, table:'sys_file_metadata', returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
                                                                                >
                                                                                        <core:icon identifier="actions-open" />
                                                                                </a>
index 2f36097..baad8f8 100644 (file)
@@ -53,20 +53,6 @@ class EditRecordViewHelper extends AbstractViewHelper
         $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
 
         switch ($arguments['command']) {
-            case 'new':
-                $urlParameters = [
-                    'edit[sys_redirect][' . $arguments['uid'] . ']' => 'new',
-                    'returnUrl' => (string)$uriBuilder->buildUriFromRoute('site_redirects'),
-                ];
-                $route = 'record_edit';
-                break;
-            case 'edit':
-                $urlParameters = [
-                    'edit[sys_redirect][' . $arguments['uid'] . ']' => 'edit',
-                    'returnUrl' => (string)$uriBuilder->buildUriFromRoute('site_redirects'),
-                ];
-                $route = 'record_edit';
-                break;
             case 'delete':
                 $urlParameters = [
                     'cmd[sys_redirect][' . $arguments['uid'] . '][delete]' => 1,
index c639913..7a6277e 100644 (file)
@@ -1,4 +1,7 @@
-<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:rd="http://typo3.org/ns/TYPO3/CMS/Redirects/ViewHelpers" data-namespace-typo3-fluid="true">
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+         xmlns:rd="http://typo3.org/ns/TYPO3/CMS/Redirects/ViewHelpers"
+         xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
+         data-namespace-typo3-fluid="true">
 <f:layout name="RedirectAdministration" />
 
 <f:section name="headline">
@@ -11,7 +14,9 @@
                <f:else>
                        <f:be.infobox state="-1" title="{f:translate(key: 'LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:redirect_not_found.title')}">
                                <p><f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:redirect_not_found.message"/></p>
-                               <a class="btn btn-primary" href="{rd:editRecord(command: 'new', uid: 0)}"><f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:redirect_create"/></a>
+                               <be:link.newRecord class="btn btn-primary" table="sys_redirect">
+                                       <f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:redirect_create"/>
+                               </be:link.newRecord>
                        </f:be.infobox>
                </f:else>
        </f:if>
@@ -54,7 +59,9 @@
                                                                                </f:if>
                                                                                <core:iconForRecord table="sys_redirect" row="{redirect}" /></span>
                                                                                </f:alias>
-                                                                               <a href="{rd:editRecord(command: 'edit', uid: redirect.uid)}" title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:edit')}">{redirect.source_path}</a>
+                                                                               <be:link.editRecord table="sys_redirect" uid="{redirect.uid}" title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:edit')}">
+                                                                                       {redirect.source_path}
+                                                                               </be:link.editRecord>
                                                                        </td>
                                                                        <td><f:link.typolink parameter="{redirect.target}" target="_blank"><f:uri.typolink parameter="{redirect.target}"></f:uri.typolink></f:link.typolink> (<f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:destination_status_code"/>: {redirect.target_statuscode})</td>
                                                                        <f:if condition="{showHitCounter}">
                                                                                                        </f:link.external>
                                                                                                </f:else>
                                                                                        </f:if>
-                                                                                       <a class="btn btn-default"
-                                                                                                href="{rd:editRecord(command: 'edit', uid: redirect.uid)}"
-                                                                                                title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:edit')}">
+                                                                                       <be:link.editRecord class="btn btn-default" table="sys_redirect" uid="{redirect.uid}" title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:edit')}">
                                                                                                <core:icon identifier="actions-open" />
-                                                                                       </a>
+                                                                                       </be:link.editRecord>
                                                                                        <f:if condition="{redirect.disabled} == 1">
                                                                                                <f:then>
                                                                                                        <a class="btn btn-default" href="{rd:editRecord(command: 'unhide', uid: redirect.uid)}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:unHide')}"><core:icon identifier="actions-edit-unhide" /></a>
index f4d6d1a..ad1a0b2 100644 (file)
@@ -698,7 +698,7 @@ class SchedulerModuleController
         }
         $this->view->assign('additionalFields', $additionalFieldList);
 
-        $this->view->assign('returnUrl', rawurlencode((string)GeneralUtility::getIndpEnv('REQUEST_URI')));
+        $this->view->assign('returnUrl', (string)GeneralUtility::getIndpEnv('REQUEST_URI'));
         $this->view->assign('table', implode(LF, $table));
         $this->view->assign('now', $this->getServerTime());
 
diff --git a/typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php b/typo3/sysext/scheduler/Classes/ViewHelpers/EditRecordViewHelper.php
deleted file mode 100644 (file)
index 50f71d6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-namespace TYPO3\CMS\Scheduler\ViewHelpers;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * Edit Record ViewHelper, see FormEngine logic
- *
- * @internal
- */
-class EditRecordViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('parameters', 'string', 'Is a set of GET params to send to FormEngine', true);
-    }
-
-    /**
-     * Returns a URL to link to FormEngine
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @see \TYPO3\CMS\Backend\Routing\UriBuilder::buildUriFromRoute()
-     * @return string URL to FormEngine module + parameters
-     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
-        return (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
-    }
-}
index 119ee4a..dce8501 100644 (file)
@@ -1,4 +1,4 @@
-{namespace sched = TYPO3\CMS\Scheduler\ViewHelpers}
+{namespace be = TYPO3\CMS\Backend\ViewHelpers}
 
 <input type="hidden" name="tx_scheduler[uid]" value="{uid}" />
 <input type="hidden" name="previousCMD" value="{cmd}" />
@@ -61,7 +61,9 @@
                     </f:for>
                 </select>
                 <div class="input-group-btn" role="group">
-                    <a class="btn btn-default" href="{sched:editRecord(parameters: 'edit[tx_scheduler_task_group][0]=new&returnUrl={returnUrl}')}" ><core:icon identifier="actions-add" /></a>
+                    <be:link.newRecord class="btn btn-default" table="tx_scheduler_task_group" returnUrl="{returnUrl}">
+                        <core:icon identifier="actions-add" />
+                    </be:link.newRecord>
                 </div>
             </div>
         </div>
index ddb7292..5e3c424 100644 (file)
@@ -55,6 +55,7 @@ class NoteController
             $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
                 'EXT:sys_note/Resources/Private/Templates/Note/List.html'
             ));
+            $view->setLayoutRootPaths(['EXT:sys_note/Resources/Private/Layouts']);
             $view->getRequest()->setControllerExtensionName('SysNote');
             $view->assign('notes', $notes);
             return $view->render();
diff --git a/typo3/sysext/sys_note/Classes/ViewHelpers/EditLinkViewHelper.php b/typo3/sysext/sys_note/Classes/ViewHelpers/EditLinkViewHelper.php
deleted file mode 100644 (file)
index 1be3937..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-namespace TYPO3\CMS\SysNote\ViewHelpers;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Backend\Routing\UriBuilder;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * ViewHelper to create a link to edit a note
- * @internal
- */
-class EditLinkViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('id', 'int', '', true);
-    }
-
-    /**
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @return string
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
-        return (string)$uriBuilder->buildUriFromRoute(
-            'record_edit',
-            [
-                'edit[sys_note][' . $arguments['id'] . ']' => 'edit',
-                'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
-            ]
-        );
-    }
-}
diff --git a/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html b/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html
new file mode 100644 (file)
index 0000000..58f3d67
--- /dev/null
@@ -0,0 +1 @@
+<f:render section="main" />
index 2d73899..520a39c 100644 (file)
@@ -1,5 +1,11 @@
-{namespace notes=TYPO3\CMS\SysNote\ViewHelpers}
+<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
+         xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
+         xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
+         xmlns:notes="http://typo3.org/ns/TYPO3/CMS/SysNote/ViewHelpers"
+>
+<f:layout name="Default" />
 
+<f:section name="main">
 <f:if condition="{notes}">
        <h2><f:translate key="internal_note" /></h2>
 
@@ -29,9 +35,9 @@
                                        </f:if>
 
                                        <div class="btn-group pull-right">
-                                               <a href="{notes:editLink(id:note.uid)}" class="btn btn-default btn-sm">
+                                               <be:link.editRecord uid="{note.uid}" table="sys_note" class="btn btn-default btn-sm">
                                                        <core:icon identifier="actions-open" />
-                                               </a>
+                                               </be:link.editRecord>
                                                <a href="{notes:deleteLink(id:note.uid)}" class="btn btn-default btn-sm t3js-modal-trigger" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}" data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:deleteWarning')}" data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}">
                                                        <core:icon identifier="actions-edit-delete" />
                                                </a>
@@ -45,3 +51,5 @@
                </f:for>
        </div>
 </f:if>
+</f:section>
+</html>