Commit 440961b4 authored by Damjan's avatar Damjan

[TASK] Auto format

Related: forge.typo3.org/issues/31889
parent 0dd2c9b3
......@@ -26,7 +26,6 @@ namespace SGalinski\Lfeditor\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\Lfeditor\Session\PhpSession;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
......
......@@ -31,117 +31,117 @@ namespace SGalinski\Lfeditor\Controller;
*/
class MainController extends AbstractController {
/**************************************
* Actions called from general view *
**************************************/
/**
* Opens general view.
* It is called in 3 cases:
* - on extension startup,
* - on selection of general option in main menu,
* - after redirection from action which must not change the view.
*/
public function generalAction() {
//TODO: Initialise options of all select menus in general view.
$this->view->assign('mainMenuSelection', 'general');
$this->loadSelectionsFromSession();
}
/**
* This action saves in session currently selected options from selection menus in general view.
* It is called on change of selection of any select menu in general view.
*
* @param string $extensionSelection
* @param string $languageFileSelection
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function generalChangeSelectionAction($extensionSelection = NULL, $languageFileSelection = NULL) {
$this->saveSelectionsInSession($extensionSelection, $languageFileSelection);
$this->redirect('general');
}
/**
* Saves the changes made in main section of general view.
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function generalSaveAction() {
//TODO: Delete. test $this->session->destroy();
//TODO: Save the changes.
$this->session->destroy();
$this->redirect('general');
}
/***************************************
* Actions called from editFile view *
***************************************/
/**
* Opens editFile view.
* It is called in 2 cases:
* - on selection of editFile option in main menu,
* - after redirection from action which must not change the view.
*/
public function editFileAction() {
//TODO: Initialise options of all select menus in general view.
$this->view->assign('mainMenuSelection', 'editFile');
$this->loadSelectionsFromSession();
}
/**
* This action saves in session currently selected options from selection menus in editFile view.
* It is called on change of selection of any select menu in editFile view.
*
* @param string $extensionSelection
* @param string $languageFileSelection
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function editFileChangeSelectionAction($extensionSelection = NULL, $languageFileSelection = NULL) {
$this->saveSelectionsInSession($extensionSelection, $languageFileSelection);
$this->redirect('editFile');
}
/**
* Saves the changes made in main section of editFile view.
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function editFileSaveAction() {
//TODO: Save the changes.
$this->redirect('editFile');
}
/**************************
* Additional functions *
**************************/
/**
* Saves in session currently selected values of select tags.
*
* @param string $extensionSelection
* @param string $languageFileSelection
*/
private function saveSelectionsInSession($extensionSelection = NULL, $languageFileSelection = NULL){
if($extensionSelection === 'NULL') {
$extensionSelection = NULL;
}
$this->session->setDataByKey('extensionSelection', $extensionSelection);
if($languageFileSelection === 'NULL') {
$languageFileSelection = NULL;
}
$this->session->setDataByKey('languageFileSelection', $languageFileSelection);
}
/**
* Fetches from session currently selected values of select tags and puts them in view variables.
*/
private function loadSelectionsFromSession(){
$this->view->assign('extensionSelection', $this->session->getDataByKey('extensionSelection'));
$this->view->assign('languageFileSelection', $this->session->getDataByKey('languageFileSelection'));
debug($this->session->getData(), 'ses');//TODO: Delete debug.
}
/**************************************
* Actions called from general view *
**************************************/
/**
* Opens general view.
* It is called in 3 cases:
* - on extension startup,
* - on selection of general option in main menu,
* - after redirection from action which must not change the view.
*/
public function generalAction() {
//TODO: Initialise options of all select menus in general view.
$this->view->assign('mainMenuSelection', 'general');
$this->loadSelectionsFromSession();
}
/**
* This action saves in session currently selected options from selection menus in general view.
* It is called on change of selection of any select menu in general view.
*
* @param string $extensionSelection
* @param string $languageFileSelection
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function generalChangeSelectionAction($extensionSelection = NULL, $languageFileSelection = NULL) {
$this->saveSelectionsInSession($extensionSelection, $languageFileSelection);
$this->redirect('general');
}
/**
* Saves the changes made in main section of general view.
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function generalSaveAction() {
//TODO: Delete. test $this->session->destroy();
//TODO: Save the changes.
$this->session->destroy();
$this->redirect('general');
}
/***************************************
* Actions called from editFile view *
***************************************/
/**
* Opens editFile view.
* It is called in 2 cases:
* - on selection of editFile option in main menu,
* - after redirection from action which must not change the view.
*/
public function editFileAction() {
//TODO: Initialise options of all select menus in general view.
$this->view->assign('mainMenuSelection', 'editFile');
$this->loadSelectionsFromSession();
}
/**
* This action saves in session currently selected options from selection menus in editFile view.
* It is called on change of selection of any select menu in editFile view.
*
* @param string $extensionSelection
* @param string $languageFileSelection
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function editFileChangeSelectionAction($extensionSelection = NULL, $languageFileSelection = NULL) {
$this->saveSelectionsInSession($extensionSelection, $languageFileSelection);
$this->redirect('editFile');
}
/**
* Saves the changes made in main section of editFile view.
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function editFileSaveAction() {
//TODO: Save the changes.
$this->redirect('editFile');
}
/**************************
* Additional functions *
**************************/
/**
* Saves in session currently selected values of select tags.
*
* @param string $extensionSelection
* @param string $languageFileSelection
*/
private function saveSelectionsInSession($extensionSelection = NULL, $languageFileSelection = NULL) {
if ($extensionSelection === 'NULL') {
$extensionSelection = NULL;
}
$this->session->setDataByKey('extensionSelection', $extensionSelection);
if ($languageFileSelection === 'NULL') {
$languageFileSelection = NULL;
}
$this->session->setDataByKey('languageFileSelection', $languageFileSelection);
}
/**
* Fetches from session currently selected values of select tags and puts them in view variables.
*/
private function loadSelectionsFromSession() {
$this->view->assign('extensionSelection', $this->session->getDataByKey('extensionSelection'));
$this->view->assign('languageFileSelection', $this->session->getDataByKey('languageFileSelection'));
debug($this->session->getData(), 'ses');//TODO: Delete debug.
}
}
......
<?php
//TODO: Change all old Copyright notices with new ones, which refer to sgalinski.
/***************************************************************
* Copyright notice
*
......
......@@ -3,80 +3,77 @@
<f:be.container enableClickMenu="FALSE" loadPrototype="FALSE" loadExtJs="FALSE">
<div class="typo3-fullDoc">
<div id="typo3-docheader">
<f:comment>
<!--<div id="typo3-docheader-row1">-->
<!--<div class="buttonsleft">-->
<!--<f:render section="iconButtons" />-->
<!--</div>-->
<div class="typo3-fullDoc">
<div id="typo3-docheader">
<f:comment>
<!--<div id="typo3-docheader-row1">-->
<!--<div class="buttonsleft">-->
<!--<f:render section="iconButtons" />-->
<!--</div>-->
<!--<div class="buttonsright">-->
<!--<f:be.buttons.shortcut />-->
<!--</div>-->
<!--</div>-->
</f:comment>
<div id="typo3-docheader-row2">
<div class="docheader-row2-left">
<f:be.menus.actionMenu>
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:be.menus.actionMenuItem label="General (translate)"
controller="Main"
action="general" />
<!--<div class="buttonsright">-->
<!--<f:be.buttons.shortcut />-->
<!--</div>-->
<!--</div>-->
</f:comment>
<div id="typo3-docheader-row2">
<div class="docheader-row2-left">
<f:be.menus.actionMenu>
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:be.menus.actionMenuItem label="General (translate)"
controller="Main"
action="general" />
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:be.menus.actionMenuItem label="Edit file (translate)"
controller="Main"
action="editFile" />
</f:be.menus.actionMenu>
</div>
</div>
</div>
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:be.menus.actionMenuItem label="Edit file (translate)"
controller="Main"
action="editFile" />
</f:be.menus.actionMenu>
</div>
</div>
</div>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<f:form id="mainMenuForm" action="{mainMenuSelection}ChangeSelection">
<br><br><br><br><br><br><br><br><br><br><br><br>
<f:form.select name="extensionSelection"
value="{extensionSelection}"
options="{NULL: '--Select something--', extension1: 'Test extension 1', extension2: 'Test extension 2'}"
additionalAttributes="{onchange: 'document.getElementById(\'mainMenuForm\').submit();'}"
/>
<br><br>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<f:form id="mainMenuForm" action="{mainMenuSelection}ChangeSelection">
<br><br><br><br><br><br><br><br><br><br><br><br>
<f:form.select name="extensionSelection"
value="{extensionSelection}"
options="{NULL: '--Select something--', extension1: 'Test extension 1', extension2: 'Test extension 2'}"
additionalAttributes="{onchange: 'document.getElementById(\'mainMenuForm\').submit();'}"
/>
<br><br>
<br>
<f:render section="selectItems" />
</f:form>
<br><br>
<br>
<f:render section="selectItems" />
</f:form>
<br><br>
<f:render section="main" />
<f:render section="main" />
</div>
</div>
</div>
</div>
</div>
</div>
</f:be.container>
<f:comment>
<div>
This is Default layout. <br>
<f:form id="mainMenuForm" action="mainMenuSelect">
<div>
This is Default layout. <br>
<f:form id="mainMenuForm" action="mainMenuSelect">
<f:form.select name="mainMenuSelection"
value="{mainMenuSelection}"
options="{ general: 'General select item', editFile: 'Edit file select item'}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\');'}"
/>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<f:render section="selectItems" />
</f:form>
<br><br>
<!--<f:link.action action="editFile">Edit file link</f:link.action>-->
<!--<br>-->
<!--<f:link.action action="general">General link</f:link.action>-->
<!--<br><br>-->
<f:render section="main" />
</div>
<f:form.select name="mainMenuSelection"
value="{mainMenuSelection}"
options="{ general: 'General select item', editFile: 'Edit file select item'}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\');'}"
/>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<f:render section="selectItems" />
</f:form>
<br><br>
<!--<f:link.action action="editFile">Edit file link</f:link.action>-->
<!--<br>-->
<!--<f:link.action action="general">General link</f:link.action>-->
<!--<br><br>-->
<f:render section="main" />
</div>
</f:comment>
\ No newline at end of file
<f:form.select name="languageFileSelection"
value="{languageFileSelection}"
options="{NULL: '--Select something--', lf1: 'Test lf 1', lf2: 'Test lf 2'}"
additionalAttributes="{onchange: 'document.getElementById(\'mainMenuForm\').submit();'}"
/>
value="{languageFileSelection}"
options="{NULL: '--Select something--', lf1: 'Test lf 1', lf2: 'Test lf 2'}"
additionalAttributes="{onchange: 'document.getElementById(\'mainMenuForm\').submit();'}"
/>
<f:comment> <!-- todo Call JS function--> </f:comment>
<f:debug title="All available variables">{_all}</f:debug>
\ No newline at end of file
......@@ -2,19 +2,20 @@
<f:section name="selectItems">
This is EditFile page. Select items section.
<br>
<f:render partial="SelectLanguageFile" arguments="{_all}" />
This is EditFile page. Select items section.
<br>
<f:render partial="SelectLanguageFile" arguments="{_all}" />
</f:section>
<f:section name="main">
This is EditFile page. Main section.
This is EditFile page. Main section.
<f:form id="contentForm" action="editFileSave">
<f:form.submit value="Save" /> <f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:form.button value="Reset" type="reset" /> <f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
</f:form>
<f:form id="contentForm" action="editFileSave">
<f:form.submit value="Save" />
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:form.button value="Reset" type="reset" />
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
</f:form>
</f:section>
\ No newline at end of file
<f:layout name="Default" />
<f:section name="selectItems">
This is General page. Select items section.
<br>
<f:render partial="SelectLanguageFile" arguments="{_all}" />
This is General page. Select items section.
<br>
<f:render partial="SelectLanguageFile" arguments="{_all}" />
</f:section>
<f:section name="main">
This is General page. Main section.
This is General page. Main section.
<f:form id="contentForm" action="generalSave">
<f:form.submit value="Save" /> <f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:form.button value="Reset" type="reset" /> <f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
</f:form>
<f:form id="contentForm" action="generalSave">
<f:form.submit value="Save" />
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
<f:form.button value="Reset" type="reset" />
<f:comment><!-- todo translate label {f:translate(key: 'backend.overview')}--></f:comment>
</f:form>
</f:section>
\ No newline at end of file
......@@ -23,6 +23,6 @@
***************************************************************/
function submitForm(formName) {
document.getElementById(formName).submit();
document.getElementById(formName).submit();
}
......@@ -5,20 +5,20 @@ if (!defined('TYPO3_MODE')) {
}
if (TYPO3_MODE == 'BE') {
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'SGalinski.lfeditor',
'user',
'LFEditor',
'',
[
'Main' => 'general, generalChangeSelection, generalSave, editFile, editFileChangeSelection, editFileSave',
],
[
'access' => 'user,group',
'icon' => 'EXT:lfeditor/ext_icon.gif',
'labels' => 'LLL:EXT:lfeditor/Resources/Private/Language/locallang_mod.xml',
]
);
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'SGalinski.lfeditor',
'user',
'LFEditor',
'',
[
'Main' => 'general, generalChangeSelection, generalSave, editFile, editFileChangeSelection, editFileSave',
],
[
'access' => 'user,group',
'icon' => 'EXT:lfeditor/ext_icon.gif',
'labels' => 'LLL:EXT:lfeditor/Resources/Private/Language/locallang_mod.xml',
]
);
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment