[TASK] Use DocHeader buttons in PermissionController 72/47372/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 11 Mar 2016 08:45:54 +0000 (09:45 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 23 Mar 2016 18:09:18 +0000 (19:09 +0100)
The save / abort buttons in the edit view of the permission controller are
replaced by DocHeader buttons to ensure are more consistent UI.

Change-Id: Ic035f2bd1f5063a8d0b52310b1f011078f7e6c25
Resolves: #68378
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/47372
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/beuser/Classes/Controller/PermissionController.php
typo3/sysext/beuser/Resources/Private/Templates/Permission/Edit.html

index 089be95..c08a6a4 100644 (file)
@@ -155,12 +155,45 @@ class PermissionController extends ActionController
         $currentRequest = $this->request;
         $moduleName = $currentRequest->getPluginName();
         $getVars = $this->request->getArguments();
         $currentRequest = $this->request;
         $moduleName = $currentRequest->getPluginName();
         $getVars = $this->request->getArguments();
+        $lang = $this->getLanguageService();
 
         $extensionName = $currentRequest->getControllerExtensionName();
         if (empty($getVars)) {
             $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
 
         $extensionName = $currentRequest->getControllerExtensionName();
         if (empty($getVars)) {
             $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
+
+        if ($currentRequest->getControllerActionName() === 'edit') {
+            // CLOSE button:
+            $closeUrl = $this->uriBuilder->reset()->setArguments(array(
+                'action' => 'index',
+                'id' => $this->id
+            ))->buildBackendUri();
+            $closeButton = $buttonBar->makeLinkButton()
+                ->setHref($closeUrl)
+                ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc'))
+                ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
+                    'actions-document-close',
+                    Icon::SIZE_SMALL
+                ));
+            $buttonBar->addButton($closeButton);
+
+            // SAVE button:
+            $saveButton = $buttonBar->makeInputButton()
+                ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc'))
+                ->setName('tx_beuser_system_beusertxpermission[submit]')
+                ->setValue('Save')
+                ->setForm('PermissionControllerEdit')
+                ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
+                    'actions-document-save',
+                    Icon::SIZE_SMALL
+                ))
+                ->setShowLabelText(true);
+
+            $buttonBar->addButton($saveButton);
+        }
+
+        // SHORTCUT botton:
         $shortcutButton = $buttonBar->makeShortcutButton()
             ->setModuleName($moduleName)
             ->setGetVariables($getVars);
         $shortcutButton = $buttonBar->makeShortcutButton()
             ->setModuleName($moduleName)
             ->setGetVariables($getVars);
index af3d6fc..a5ac1e0 100644 (file)
@@ -11,7 +11,7 @@
 </f:section>
 
 <f:section name="content">
 </f:section>
 
 <f:section name="content">
-       <f:form action="update" name="editform">
+       <f:form action="update" name="editform" id="PermissionControllerEdit">
 
                <div class="form-group">
                        <label><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Owner" /></label>
 
                <div class="form-group">
                        <label><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Owner" /></label>
@@ -78,9 +78,6 @@
                        <f:form.select id="recursionLevel" name="mirror[pages][{id}]" options="{recursiveSelectOptions}" class="form-control" />
                </div>
 
                        <f:form.select id="recursionLevel" name="mirror[pages][{id}]" options="{recursiveSelectOptions}" class="form-control" />
                </div>
 
-               <f:form.submit class="btn btn-default" name="submit" value="{f:translate(key: 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Save')}" />
-               <f:link.action class="btn btn-default" action="index" arguments="{id: id}"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Abort" /></f:link.action>
-
                <f:form.hidden name="data[pages][{id}][perms_user]" value="{pageInfo.perms_user}" />
                <f:form.hidden name="data[pages][{id}][perms_group]" value="{pageInfo.perms_group}" />
                <f:form.hidden name="data[pages][{id}][perms_everybody]" value="{pageInfo.perms_everybody}" />
                <f:form.hidden name="data[pages][{id}][perms_user]" value="{pageInfo.perms_user}" />
                <f:form.hidden name="data[pages][{id}][perms_group]" value="{pageInfo.perms_group}" />
                <f:form.hidden name="data[pages][{id}][perms_everybody]" value="{pageInfo.perms_everybody}" />