Skip to content
Snippets Groups Projects
Commit 2ab06451 authored by damjan's avatar damjan
Browse files

[FEATURE] TypoScriptGroup as main menu items

- adding typoScript group to routs
- adding typoScript group as argument to each tsref controller action
- adding typoScript groups to main menu and removing select box from side menu
- adapting backend calls to changed backend rest api routes
- removing section "Install SGalinski.TypoScriptReferenceFrontend to new project" from readme
parent 0b16260b
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,6 @@ namespace SGalinski\TypoScriptReferenceFrontend\Controller; ...@@ -7,7 +7,6 @@ namespace SGalinski\TypoScriptReferenceFrontend\Controller;
* * * *
* */ * */
use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Attribute;
use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Property; use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Property;
use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Type; use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Type;
use SGalinski\TypoScriptReferenceFrontend\Service\TsrefRestService; use SGalinski\TypoScriptReferenceFrontend\Service\TsrefRestService;
...@@ -46,7 +45,6 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -46,7 +45,6 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->session = $session; $this->session = $session;
if (!$session->isStarted()) { if (!$session->isStarted()) {
$session->start(); $session->start();
$session->putData('typoScriptGroup', Attribute::NORMAL_GROUP);
$session->putData('typo3Version', TsrefRestService::TYPO3_CURRENT_VERSION_LABEL); $session->putData('typo3Version', TsrefRestService::TYPO3_CURRENT_VERSION_LABEL);
} }
} }
...@@ -54,27 +52,27 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -54,27 +52,27 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
/** /**
* The action which fetches the data for typoScript reference page, and displays the page. * The action which fetches the data for typoScript reference page, and displays the page.
* *
* @param string $typoScriptGroup
* @param string $typeUrlName - typeUrlName * @param string $typeUrlName - typeUrlName
* @param string $typo3Version * @param string $typo3Version
* @return void
*/ */
public function indexAction( public function indexAction(
$typeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL $typoScriptGroup, $typeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL
) { ) {
try { try {
if ($typeUrlName !== NULL) { if ($typeUrlName !== NULL) {
$selectedType = $this->tsrefRestService->getTypeByUrlName($typeUrlName); $selectedType = $this->tsrefRestService->getTypeByUrlName($typeUrlName, $typoScriptGroup);
$this->session->putData('typoScriptGroup', $selectedType->typo3Group);
$properties = $this->tsrefRestService->getPropertiesByParentTypeId( $properties = $this->tsrefRestService->getPropertiesByParentTypeId(
$selectedType->id, $this->decodeTypo3Version($typo3Version), $selectedType->typo3Group $selectedType->id, $this->decodeTypo3Version($typo3Version), $typoScriptGroup
); );
$this->view->assign('properties', $properties); $this->view->assign('properties', $properties);
$this->view->assign('selectedType', $selectedType); $this->view->assign('selectedType', $selectedType);
$this->view->assign('typo3Groups', $this->tsrefRestService->getAllTypo3Groups());
// If the type extends a type (superType), the superType name is being fetched among other fields // If the type extends a type (superType), the superType name is being fetched among other fields
if (isset($selectedType->parent_id)) { if (isset($selectedType->parent_id)) {
$superType = $this->tsrefRestService->getTypeById($selectedType->parent_id); $superType = $this->tsrefRestService->getTypeById($selectedType->parent_id, $typoScriptGroup);
$this->view->assign('superType', $superType); $this->view->assign('superType', $superType);
} }
} }
...@@ -83,7 +81,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -83,7 +81,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
} }
$urlName = isset($selectedType) ? (isset($selectedType->urlName) ? $selectedType->urlName : NULL) : NULL; $urlName = isset($selectedType) ? (isset($selectedType->urlName) ? $selectedType->urlName : NULL) : NULL;
$this->prepareTypeMenu($urlName, $typo3Version); $this->prepareTypeMenu($urlName, $typo3Version, $typoScriptGroup);
} }
/** /**
...@@ -92,22 +90,22 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -92,22 +90,22 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* @param Type $theType * @param Type $theType
* @param boolean $editForm * @param boolean $editForm
* @param string $typo3Version * @param string $typo3Version
* @throws \TYPO3\Flow\Mvc\Exception\ForwardException * @param string $typoScriptGroup
* @return void * @return void
*/ */
public function submitTypeAction( //TODO: Use session for typo3Version public function submitTypeAction( //TODO: Use session for typo3Version
Type $theType, $editForm = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL Type $theType, $editForm = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $typoScriptGroup
) { ) {
try { try {
$this->checkEditPermission($typo3Version); $this->checkEditPermission($typoScriptGroup, $typo3Version);
if ($theType->getExtends() === -1) { if ($theType->getExtends() === -1) {
$theType->setExtends(NULL); $theType->setExtends(NULL);
} }
if ($editForm) { if ($editForm) {
$result = $this->tsrefRestService->editType($theType); $result = $this->tsrefRestService->editType($theType, $typoScriptGroup);
} else { } else {
$result = $this->tsrefRestService->addNewType($theType); $result = $this->tsrefRestService->addNewType($theType, $typoScriptGroup);
} }
$this->addFlashMessage('The type is successfully submitted.', 'Success', Message::SEVERITY_OK); $this->addFlashMessage('The type is successfully submitted.', 'Success', Message::SEVERITY_OK);
...@@ -118,13 +116,21 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -118,13 +116,21 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->redirect( $this->redirect(
'editType', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'editType', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeId' => $theType->getId(), 'typo3Version' => $typo3Version] [
'typeId' => $theType->getId(),
'typo3Version' => $typo3Version,
'typoScriptGroup' => $typoScriptGroup
]
); );
} }
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeUrlName' => $theType->getUrlName(), 'typo3Version' => $typo3Version] [
'typeUrlName' => $theType->getUrlName(),
'typo3Version' => $typo3Version,
'typoScriptGroup' => $typoScriptGroup
]
); );
} }
...@@ -133,22 +139,24 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -133,22 +139,24 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* *
* @param int $typeId * @param int $typeId
* @param string $typo3Version * @param string $typo3Version
* @param string $typoScriptGroup
* @return void * @return void
*/ */
public function editTypeAction($typeId = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL public function editTypeAction(
$typeId = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL,
$typoScriptGroup
) { //TODO: Use session for typo3Version ) { //TODO: Use session for typo3Version
$theType = new Type(); $theType = new Type();
try { try {
$this->checkEditPermission($typo3Version); $this->checkEditPermission($typoScriptGroup, $typo3Version);
$typoScriptGroup = (int) $this->session->getData('typoScriptGroup');
if ($typeId !== NULL) { if ($typeId !== NULL) {
// Edit type // Edit type
$selectedTypeAsStdClass = $this->tsrefRestService->getTypeById($typeId); $selectedTypeAsStdClass = $this->tsrefRestService->getTypeById($typeId, $typoScriptGroup);
$theType->initialise($selectedTypeAsStdClass); $theType->initialise($selectedTypeAsStdClass);
} else { } else {
$theType->setTypo3Group($typoScriptGroup); $typoScriptGroupId = $this->tsrefRestService->getTypoScriptGroupId($typoScriptGroup);
$theType->setTypo3Group($typoScriptGroupId);
} }
$selectMenuTypes = $this->tsrefRestService->getTypesWithNull( $selectMenuTypes = $this->tsrefRestService->getTypesWithNull(
...@@ -159,7 +167,6 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -159,7 +167,6 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$selectBoxCategories = Conversion::categoriesToAssociativeNameArray($categories); $selectBoxCategories = Conversion::categoriesToAssociativeNameArray($categories);
asort($selectBoxCategories); asort($selectBoxCategories);
$this->view->assign('typo3Groups', $this->tsrefRestService->getAllTypo3Groups());
$this->view->assign('theType', $theType); $this->view->assign('theType', $theType);
$this->view->assign('editForm', ($typeId !== NULL)); $this->view->assign('editForm', ($typeId !== NULL));
$this->view->assign('selectMenuTypes', $selectMenuTypes); $this->view->assign('selectMenuTypes', $selectMenuTypes);
...@@ -168,7 +175,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -168,7 +175,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR); $this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR);
} }
$this->prepareTypeMenu($theType->getUrlName(), $typo3Version); $this->prepareTypeMenu($theType->getUrlName(), $typo3Version, $typoScriptGroup);
} }
/** /**
...@@ -177,39 +184,48 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -177,39 +184,48 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* @param Property $theProperty * @param Property $theProperty
* @param boolean $editForm * @param boolean $editForm
* @param string $typo3Version * @param string $typo3Version
* @throws \TYPO3\Flow\Mvc\Exception\ForwardException * @param string $typoScriptGroup
* @return void * @return void
*/ */
public function submitPropertyAction( //TODO: Use session for typo3Version public function submitPropertyAction( //TODO: Use session for typo3Version
Property $theProperty, $editForm, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL Property $theProperty, $editForm, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL,
$typoScriptGroup
) { ) {
$parentType = NULL; $parentType = NULL;
try { try {
$this->checkEditPermission($typo3Version); $this->checkEditPermission($typoScriptGroup, $typo3Version);
if ($editForm) { if ($editForm) {
$result = $this->tsrefRestService->editProperty($theProperty); $result = $this->tsrefRestService->editProperty($theProperty, $typoScriptGroup);
} else { } else {
$result = $this->tsrefRestService->addNewProperty($theProperty); $result = $this->tsrefRestService->addNewProperty($theProperty, $typoScriptGroup);
} }
$this->addFlashMessage('The property is successfully submitted.', 'Success', Message::SEVERITY_OK); $this->addFlashMessage('The property is successfully submitted.', 'Success', Message::SEVERITY_OK);
$parentType = $this->tsrefRestService->getTypeById($theProperty->getParentType()); $parentType = $this->tsrefRestService->getTypeById($theProperty->getParentType(), $typoScriptGroup);
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR); $this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR);
$this->redirect( $this->redirect(
'editProperty', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'editProperty', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['parentTypeId' => $theProperty->getParentType(), 'thePropertyId' => $theProperty->getId(), [
'typo3Version' => $typo3Version] 'parentTypeId' => $theProperty->getParentType(),
'thePropertyId' => $theProperty->getId(),
'typo3Version' => $typo3Version,
'typoScriptGroup' => $typoScriptGroup
]
); );
} }
$urlName = (isset($parentType) ? (isset($parentType->urlName) ? $parentType->urlName : NULL) : NULL); $urlName = (isset($parentType) ? (isset($parentType->urlName) ? $parentType->urlName : NULL) : NULL);
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeUrlName' => $urlName, 'typo3Version' => $typo3Version] [
'typeUrlName' => $urlName,
'typo3Version' => $typo3Version,
'typoScriptGroup' => $typoScriptGroup
]
); );
} }
...@@ -219,34 +235,36 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -219,34 +235,36 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* @param int $parentTypeId * @param int $parentTypeId
* @param int $thePropertyId * @param int $thePropertyId
* @param string $typo3Version * @param string $typo3Version
* @param string $typoScriptGroup
* @return void * @return void
*/ */
public function editPropertyAction( //TODO: Use session for typo3Version public function editPropertyAction( //TODO: Use session for typo3Version
$parentTypeId, $thePropertyId = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL $parentTypeId, $thePropertyId = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL,
$typoScriptGroup
) { ) {
$parentType = NULL; $parentType = NULL;
try { try {
$this->checkEditPermission($typo3Version); $this->checkEditPermission($typoScriptGroup, $typo3Version);
$theProperty = new Property(); $theProperty = new Property();
$typoScriptGroup = (int) $this->session->getData('typoScriptGroup');
if ($thePropertyId !== NULL) { if ($thePropertyId !== NULL) {
// Edit type // Edit type
$selectedPropertyAsStdClass = $this->tsrefRestService->getPropertyById($thePropertyId); $selectedPropertyAsStdClass = $this->tsrefRestService->getPropertyById(
$thePropertyId, $typoScriptGroup
);
$theProperty->initialise($selectedPropertyAsStdClass); $theProperty->initialise($selectedPropertyAsStdClass);
} else { } else {
$theProperty->setTypo3Group($typoScriptGroup); $typoScriptGroupId = $this->tsrefRestService->getTypoScriptGroupId($typoScriptGroup);
$theProperty->setTypo3Group($typoScriptGroupId);
} }
$theProperty->setParentType($parentTypeId); $theProperty->setParentType($parentTypeId);
$parentType = $this->tsrefRestService->getTypeById($parentTypeId); $parentType = $this->tsrefRestService->getTypeById($parentTypeId, $typoScriptGroup);
$selectMenuTypes = Conversion::typesToAssociativeIdArray( $selectMenuTypes = Conversion::typesToAssociativeIdArray(
$this->tsrefRestService->getTypes(TRUE, $this->decodeTypo3Version($typo3Version), NULL) $this->tsrefRestService->getTypes(TRUE, $this->decodeTypo3Version($typo3Version), $typoScriptGroup)
); );
$this->view->assign('typo3Groups', $this->tsrefRestService->getAllTypo3Groups());
$this->view->assign('theProperty', $theProperty); $this->view->assign('theProperty', $theProperty);
$this->view->assign('editForm', ($thePropertyId !== NULL)); $this->view->assign('editForm', ($thePropertyId !== NULL));
$this->view->assign('selectMenuTypes', $selectMenuTypes); $this->view->assign('selectMenuTypes', $selectMenuTypes);
...@@ -255,7 +273,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -255,7 +273,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
} }
$urlName = isset($parentType) ? (isset($parentType->urlName) ? $parentType->urlName : NULL) : NULL; $urlName = isset($parentType) ? (isset($parentType->urlName) ? $parentType->urlName : NULL) : NULL;
$this->prepareTypeMenu($urlName, $typo3Version); $this->prepareTypeMenu($urlName, $typo3Version, $typoScriptGroup);
} }
/** /**
...@@ -263,14 +281,15 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -263,14 +281,15 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* *
* @param int $attributeId * @param int $attributeId
* @param string $typo3Version * @param string $typo3Version
* @param string $typoScriptGroup
* @return void * @return void
*/ */
public function deleteTypeAction( //TODO: Use session for typo3Version public function deleteTypeAction( //TODO: Use session for typo3Version
$attributeId, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL $attributeId, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $typoScriptGroup
) { ) {
try { try {
$this->checkEditPermission($typo3Version); $this->checkEditPermission($typoScriptGroup, $typo3Version);
$result = $this->tsrefRestService->patchType($attributeId, ['deleted' => TRUE]); $result = $this->tsrefRestService->patchType($attributeId, ['deleted' => TRUE], $typoScriptGroup);
$this->addFlashMessage('Successfully deleted.', 'Success', Message::SEVERITY_OK); $this->addFlashMessage('Successfully deleted.', 'Success', Message::SEVERITY_OK);
} catch (\Exception $exception) { } catch (\Exception $exception) {
...@@ -279,7 +298,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -279,7 +298,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeUrlName' => NULL, 'typo3Version' => $typo3Version] ['typeUrlName' => NULL, 'typo3Version' => $typo3Version, 'typoScriptGroup' => $typoScriptGroup]
); );
} }
...@@ -291,14 +310,16 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -291,14 +310,16 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* @param int $attributeId * @param int $attributeId
* @param string $parentTypeUrlName * @param string $parentTypeUrlName
* @param string $typo3Version * @param string $typo3Version
* @param string $typoScriptGroup
* @return void * @return void
*/ */
public function deletePropertyAction( //TODO: Use session for typo3Version public function deletePropertyAction( //TODO: Use session for typo3Version
$attributeId, $parentTypeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL $attributeId, $parentTypeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL,
$typoScriptGroup
) { ) {
try { try {
$this->checkEditPermission($typo3Version, $parentTypeUrlName); $this->checkEditPermission($typoScriptGroup, $typo3Version, $parentTypeUrlName);
$result = $this->tsrefRestService->patchProperty($attributeId, ['deleted' => TRUE]); $result = $this->tsrefRestService->patchProperty($attributeId, ['deleted' => TRUE], $typoScriptGroup);
$this->addFlashMessage('Successfully deleted.', 'Success', Message::SEVERITY_OK); $this->addFlashMessage('Successfully deleted.', 'Success', Message::SEVERITY_OK);
} catch (\Exception $exception) { } catch (\Exception $exception) {
...@@ -307,7 +328,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -307,7 +328,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeUrlName' => $parentTypeUrlName, 'typo3Version' => $typo3Version] ['typeUrlName' => $parentTypeUrlName, 'typo3Version' => $typo3Version, 'typoScriptGroup' => $typoScriptGroup]
); );
} }
...@@ -315,14 +336,14 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -315,14 +336,14 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* Submits typo3 version to be used in filtering. * Submits typo3 version to be used in filtering.
* *
* @param string $submittedTypo3Version * @param string $submittedTypo3Version
* @param int $submittedTypoScriptGroup * @param string $typoScriptGroup
* @throws \TYPO3\Flow\Mvc\Exception\ForwardException
* @return void * @return void
*/ */
public function submitTypo3VersionAndGroupAction($submittedTypo3Version, $submittedTypoScriptGroup) { public function submitTypo3Version($submittedTypo3Version, $typoScriptGroup) {
$this->storeToSession($submittedTypo3Version, $submittedTypoScriptGroup); $this->session->putData('typo3Version', $submittedTypo3Version);
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', ['typo3Version' => $submittedTypo3Version] 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typo3Version' => $submittedTypo3Version, 'typoScriptGroup' => $typoScriptGroup]
); );
} }
...@@ -330,11 +351,11 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -330,11 +351,11 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* Download action for tsref.xml * Download action for tsref.xml
* *
* @param string $typo3Version * @param string $typo3Version
* @param int $typoScriptGroup * @param string $typoScriptGroup
* @return void * @return void
*/ */
public function downloadTsrefAction( public function downloadTsrefAction(
$typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $typoScriptGroup = Attribute::NORMAL_GROUP $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $typoScriptGroup
) { ) {
try { try {
$typo3DecodedVersion = $this->decodeTypo3Version($typo3Version); $typo3DecodedVersion = $this->decodeTypo3Version($typo3Version);
...@@ -347,7 +368,8 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -347,7 +368,8 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR); $this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR);
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', ['typo3Version' => $typo3Version] 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typo3Version' => $typo3Version, 'typoScriptGroup' => $typoScriptGroup]
); );
} }
} }
...@@ -357,26 +379,26 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -357,26 +379,26 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
* *
* @param int $selectedTypeUrlName * @param int $selectedTypeUrlName
* @param string $selectedTypo3Version * @param string $selectedTypo3Version
* @param string $typoScriptGroup
* @return void * @return void
*/ */
protected function prepareTypeMenu($selectedTypeUrlName, $selectedTypo3Version) { protected function prepareTypeMenu($selectedTypeUrlName, $selectedTypo3Version, $typoScriptGroup) {
try { try {
$typo3VersionFilter = $this->decodeTypo3Version($selectedTypo3Version); $typo3VersionFilter = $this->decodeTypo3Version($selectedTypo3Version);
$types = $this->tsrefRestService->getTypes( $types = $this->tsrefRestService->getTypes(
TRUE, $typo3VersionFilter, $this->session->getData('typoScriptGroup') TRUE, $typo3VersionFilter, $typoScriptGroup
); );
$typo3Versions = $this->tsrefRestService->getTypo3Versions(); $typo3Versions = $this->tsrefRestService->getTypo3Versions();
$categories = $this->tsrefRestService->getCategories(); $categories = $this->tsrefRestService->getCategories();
$categories = Conversion::categoriesToAssociativeNameArray($categories); $categories = Conversion::categoriesToAssociativeNameArray($categories);
$groupedTypes = Conversion::groupTypesForSidebar($types, $categories); $groupedTypes = Conversion::groupTypesForSidebar($types, $categories);
$this->view->assign('menuTypes', $groupedTypes); $this->view->assign('menuTypes', $groupedTypes);
$this->view->assign('selectedTypeUrlName', $selectedTypeUrlName); $this->view->assign('selectedTypeUrlName', $selectedTypeUrlName);
$this->view->assign('typo3Versions', $typo3Versions); $this->view->assign('typo3Versions', $typo3Versions);
$this->view->assign('selectedTypo3Version', $selectedTypo3Version); $this->view->assign('selectedTypo3Version', $selectedTypo3Version);
$this->view->assign('typoScriptGroups', $this->tsrefRestService->getAllTypo3Groups()); $this->view->assign('selectedTypoScriptGroup', $typoScriptGroup);
$this->view->assign('selectedTypoScriptGroup', $this->session->getData('typoScriptGroup'));
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR); $this->addFlashMessage($exception->getMessage(), 'Error', Message::SEVERITY_ERROR);
} }
...@@ -399,34 +421,27 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { ...@@ -399,34 +421,27 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
return $selectedTypo3Version; return $selectedTypo3Version;
} }
/**
* Stores to session $submittedTypo3Version and $submittedTypoScriptGroup.
*
* @param $submittedTypo3Version
* @param $submittedTypoScriptGroup
* @return void
*/
protected function storeToSession($submittedTypo3Version, $submittedTypoScriptGroup) {
$this->session->putData('typo3Version', $submittedTypo3Version);
$this->session->putData('typoScriptGroup', $submittedTypoScriptGroup);
}
/** /**
* Checks if client is authenticated and if he has privileges to edit the data. * Checks if client is authenticated and if he has privileges to edit the data.
* Sets error message if client can't edit the data, and redirects to index action. * Sets error message if client can't edit the data, and redirects to index action.
* *
* @param $typo3Version * @param string $typoScriptGroup
* @param $parentTypeUrlName * @param string $typo3Version
* @param string $typeUrlName
* @return void * @return void
*/ */
protected function checkEditPermission( protected function checkEditPermission(
$typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $parentTypeUrlName = NULL $typoScriptGroup, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL, $typeUrlName = NULL
) { ) {
if (!$this->securityContext->hasRole('SGalinski.TypoScriptReferenceFrontend:Admin')) { if (!$this->securityContext->hasRole('SGalinski.TypoScriptReferenceFrontend:Admin')) {
$this->addFlashMessage('You don\'t have permission to edit the data.', 'Error', Message::SEVERITY_ERROR); $this->addFlashMessage('You don\'t have permission to edit the data.', 'Error', Message::SEVERITY_ERROR);
$this->redirect( $this->redirect(
'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend', 'index', 'tsref', 'SGalinski.TypoScriptReferenceFrontend',
['typeUrlName' => $parentTypeUrlName, 'typo3Version' => $typo3Version] [
'typeUrlName' => $typeUrlName,
'typo3Version' => $typo3Version,
'typoScriptGroup' => $typoScriptGroup
]
); );
} }
} }
......
...@@ -84,25 +84,24 @@ class TsrefRestService { ...@@ -84,25 +84,24 @@ class TsrefRestService {
* @param boolean|null $isType - filters by isType * @param boolean|null $isType - filters by isType
* @param bool $namesOnly - get urlNames and names only of types. * @param bool $namesOnly - get urlNames and names only of types.
* @param string $typo3Version - filters by typo3Version * @param string $typo3Version - filters by typo3Version
* @param int $typo3Group - filters by typo3Group * @param string $typoScriptGroup - filters by typo3Group
* @return mixed * @return mixed
*/ */
public function getAttributesJson( public function getAttributesJson(
$isType = NULL, $namesOnly = TRUE, $typo3Version = self::TYPO3_DEFAULT_VERSION, $isType = NULL, $namesOnly = TRUE, $typo3Version = self::TYPO3_DEFAULT_VERSION,
$typo3Group = Attribute::NORMAL_GROUP $typoScriptGroup
) { ) {
$resourceName = 'properties'; $resourceName = 'properties';
$headerProperties = [ $headerProperties = [
'namesonly: ' . ($namesOnly ? '1' : '0'), 'namesonly: ' . ($namesOnly ? '1' : '0'),
'version: ' . $typo3Version, 'version: ' . $typo3Version,
'typo3group: ' . $typo3Group
]; ];
if ($isType !== NULL) { if ($isType !== NULL) {
$resourceName = 'types'; $resourceName = 'types';
} }
$curlHandle = $this->initialiseCurl('/' . $resourceName); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/' . $resourceName);
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties); curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties);
...@@ -122,10 +121,11 @@ class TsrefRestService { ...@@ -122,10 +121,11 @@ class TsrefRestService {
* *
* @param string $resourceName ('properties' or 'types') * @param string $resourceName ('properties' or 'types')
* @param int $attributeId * @param int $attributeId
* @param string $typoScriptGroup
* @return mixed JSON * @return mixed JSON
*/ */
public function getAttributeByIdJson($resourceName, $attributeId) { public function getAttributeByIdJson($resourceName, $attributeId, $typoScriptGroup) {
$curlHandle = $this->initialiseCurl('/' . $resourceName . '/' . $attributeId); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/' . $resourceName . '/' . $attributeId);
// Download the given URL, and return output // Download the given URL, and return output
$output = curl_exec($curlHandle); $output = curl_exec($curlHandle);
...@@ -142,10 +142,11 @@ class TsrefRestService { ...@@ -142,10 +142,11 @@ class TsrefRestService {
* Returns a type by its name from RESOURCE_URL. * Returns a type by its name from RESOURCE_URL.
* *
* @param string $typeUrlName * @param string $typeUrlName
* @param string $typoScriptGroup
* @return mixed JSON * @return mixed JSON
*/ */
public function getTypeByUrlNameJson($typeUrlName) { public function getTypeByUrlNameJson($typeUrlName, $typoScriptGroup) {
$curlHandle = $this->initialiseCurl('/types/' . $typeUrlName . '/byurlname'); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/types/' . $typeUrlName . '/byurlname');
// Download the given URL, and return output // Download the given URL, and return output
$output = curl_exec($curlHandle); $output = curl_exec($curlHandle);
...@@ -162,10 +163,11 @@ class TsrefRestService { ...@@ -162,10 +163,11 @@ class TsrefRestService {
* Gets type by name. * Gets type by name.
* *
* @param string $typeUrlName * @param string $typeUrlName
* @param string $typoScriptGroup
* @return \stdClass * @return \stdClass
*/ */
public function getTypeByUrlName($typeUrlName) { public function getTypeByUrlName($typeUrlName, $typoScriptGroup) {
$typeJson = $this->getTypeByUrlNameJson($typeUrlName); $typeJson = $this->getTypeByUrlNameJson($typeUrlName, $typoScriptGroup);
$typePhp = json_decode($typeJson); $typePhp = json_decode($typeJson);
return $typePhp; return $typePhp;
} }
...@@ -175,17 +177,16 @@ class TsrefRestService { ...@@ -175,17 +177,16 @@ class TsrefRestService {
* *
* @param int $typeId * @param int $typeId
* @param string $typo3Version * @param string $typo3Version
* @param int $typo3Group * @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function getPropertiesByParentTypeIdJson( public function getPropertiesByParentTypeIdJson(
$typeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP $typeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typoScriptGroup
) { ) {
$curlHandle = $this->initialiseCurl('/properties/' . $typeId . '/byparenttype'); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/properties/' . $typeId . '/byparenttype');
$headerProperties = [ $headerProperties = [
'version: ' . $typo3Version, 'version: ' . $typo3Version,
'typo3group: ' . $typo3Group
]; ];
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties); curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties);
...@@ -205,10 +206,11 @@ class TsrefRestService { ...@@ -205,10 +206,11 @@ class TsrefRestService {
* Gets a type by id. * Gets a type by id.
* *
* @param int $typeId * @param int $typeId
* @param string $typoScriptGroup
* @return \stdClass * @return \stdClass
*/ */
public function getTypeById($typeId) { public function getTypeById($typeId, $typoScriptGroup) {
$typeJson = $this->getAttributeByIdJson('types', $typeId); $typeJson = $this->getAttributeByIdJson('types', $typeId, $typoScriptGroup);
$typePhp = json_decode($typeJson); $typePhp = json_decode($typeJson);
return $typePhp; return $typePhp;
} }
...@@ -217,42 +219,43 @@ class TsrefRestService { ...@@ -217,42 +219,43 @@ class TsrefRestService {
* Gets a property by id. * Gets a property by id.
* *
* @param int $propertyId * @param int $propertyId
* @param string $typoScriptGroup
* @return \stdClass * @return \stdClass
*/ */
public function getPropertyById($propertyId) { public function getPropertyById($propertyId, $typoScriptGroup) {
$propertyJson = $this->getAttributeByIdJson('properties', $propertyId); $propertyJson = $this->getAttributeByIdJson('properties', $propertyId, $typoScriptGroup);
$propertyPhp = json_decode($propertyJson); $propertyPhp = json_decode($propertyJson);
return $propertyPhp; return $propertyPhp;
} }
/** /**
* Gets all properties by parent type id, $typo3Version and $typo3Group from RESOURCE_URL * Gets all properties by parent type id, $typo3Version and $typoScriptGroup from RESOURCE_URL
* *
* @param int $parentTypeId * @param int $parentTypeId
* @param string $typo3Version * @param string $typo3Version
* @param int $typo3Group * @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function getPropertiesByParentTypeId( public function getPropertiesByParentTypeId(
$parentTypeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP $parentTypeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typoScriptGroup
) { ) {
$propertiesJson = $this->getPropertiesByParentTypeIdJson($parentTypeId, $typo3Version, $typo3Group); $propertiesJson = $this->getPropertiesByParentTypeIdJson($parentTypeId, $typo3Version, $typoScriptGroup);
$propertiesPhp = json_decode($propertiesJson); $propertiesPhp = json_decode($propertiesJson);
return $propertiesPhp; return $propertiesPhp;
} }
/** /**
* Gets all types by $typo3Version and $typo3Group from RESOURCE_URL * Gets all types by $typo3Version and $typoScriptGroup from RESOURCE_URL
* *
* @param bool $namesOnly * @param bool $namesOnly
* @param string $typo3Version * @param string $typo3Version
* @param int $typo3Group * @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function getTypes( public function getTypes(
$namesOnly = TRUE, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP $namesOnly = TRUE, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typoScriptGroup
) { ) {
$typesJson = $this->getAttributesJson(TRUE, $namesOnly, $typo3Version, $typo3Group); $typesJson = $this->getAttributesJson(TRUE, $namesOnly, $typo3Version, $typoScriptGroup);
$typesPhp = json_decode($typesJson); $typesPhp = json_decode($typesJson);
return $typesPhp; return $typesPhp;
} }
...@@ -261,11 +264,12 @@ class TsrefRestService { ...@@ -261,11 +264,12 @@ class TsrefRestService {
* Adds new type to REST API resource by use of POST method. * Adds new type to REST API resource by use of POST method.
* *
* @param Type $type * @param Type $type
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function addNewType(Type $type) { public function addNewType(Type $type, $typoScriptGroup) {
$typeJson = json_encode($type->toArray()); $typeJson = json_encode($type->toArray());
$curlHandle = $this->initialiseCurl('/types'); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/types');
curl_setopt($curlHandle, CURLOPT_POST, 1); curl_setopt($curlHandle, CURLOPT_POST, 1);
$outputJson = $this->submit($curlHandle, $typeJson); $outputJson = $this->submit($curlHandle, $typeJson);
...@@ -277,11 +281,12 @@ class TsrefRestService { ...@@ -277,11 +281,12 @@ class TsrefRestService {
* Adds new property to REST API resource by use of POST method. * Adds new property to REST API resource by use of POST method.
* *
* @param Property $property * @param Property $property
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function addNewProperty(Property $property) { public function addNewProperty(Property $property, $typoScriptGroup) {
$propertyJson = json_encode($property->toArray()); $propertyJson = json_encode($property->toArray());
$curlHandle = $this->initialiseCurl('/properties'); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/properties');
curl_setopt($curlHandle, CURLOPT_POST, 1); curl_setopt($curlHandle, CURLOPT_POST, 1);
$outputJson = $this->submit($curlHandle, $propertyJson); $outputJson = $this->submit($curlHandle, $propertyJson);
...@@ -293,16 +298,17 @@ class TsrefRestService { ...@@ -293,16 +298,17 @@ class TsrefRestService {
* Sends edited type to REST API resource by use of PUT method. * Sends edited type to REST API resource by use of PUT method.
* *
* @param Type $type * @param Type $type
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function editType(Type $type) { public function editType(Type $type, $typoScriptGroup) {
if ($type->getId() === NULL) { if ($type->getId() === NULL) {
throw new \RuntimeException( throw new \RuntimeException(
'Edited type: ' . ($type->getName() ? $type->getName() : '...') . ' doesnt have ID.' 'Edited type: ' . ($type->getName() ? $type->getName() : '...') . ' doesnt have ID.'
); );
} }
$typeJson = json_encode($type->toArray(TRUE)); $typeJson = json_encode($type->toArray(TRUE));
$curlHandle = $this->initialiseCurl('/types/' . $type->getId()); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/types/' . $type->getId());
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PUT');
$outputJson = $this->submit($curlHandle, $typeJson); $outputJson = $this->submit($curlHandle, $typeJson);
...@@ -314,16 +320,17 @@ class TsrefRestService { ...@@ -314,16 +320,17 @@ class TsrefRestService {
* Sends edited property to REST API resource by use of PUT method. * Sends edited property to REST API resource by use of PUT method.
* *
* @param Property $property * @param Property $property
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function editProperty(Property $property) { public function editProperty(Property $property, $typoScriptGroup) {
if ($property->getId() === NULL) { if ($property->getId() === NULL) {
throw new \RuntimeException( throw new \RuntimeException(
'Edited property: ' . ($property->getName() ? $property->getName() : '...') . ' doesnt have ID.' 'Edited property: ' . ($property->getName() ? $property->getName() : '...') . ' doesnt have ID.'
); );
} }
$dataJson = json_encode($property->toArray(TRUE)); $dataJson = json_encode($property->toArray(TRUE));
$curlHandle = $this->initialiseCurl('/properties/' . $property->getId()); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/properties/' . $property->getId());
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PUT');
$outputJson = $this->submit($curlHandle, $dataJson); $outputJson = $this->submit($curlHandle, $dataJson);
...@@ -336,16 +343,17 @@ class TsrefRestService { ...@@ -336,16 +343,17 @@ class TsrefRestService {
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function patchType($id, array $data) { public function patchType($id, array $data, $typoScriptGroup) {
if ($id === NULL) { if ($id === NULL) {
throw new \RuntimeException( throw new \RuntimeException(
'$id must not be NULL.' '$id must not be NULL.'
); );
} }
$dataJson = json_encode($data); $dataJson = json_encode($data);
$curlHandle = $this->initialiseCurl('/types/' . $id); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/types/' . $id);
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PATCH');
$outputJson = $this->submit($curlHandle, $dataJson); $outputJson = $this->submit($curlHandle, $dataJson);
...@@ -358,16 +366,17 @@ class TsrefRestService { ...@@ -358,16 +366,17 @@ class TsrefRestService {
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function patchProperty($id, array $data) { public function patchProperty($id, array $data, $typoScriptGroup) {
if ($id === NULL) { if ($id === NULL) {
throw new \RuntimeException( throw new \RuntimeException(
'$id must not be NULL.' '$id must not be NULL.'
); );
} }
$dataJson = json_encode($data); $dataJson = json_encode($data);
$curlHandle = $this->initialiseCurl('/properties/' . $id); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/properties/' . $id);
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PATCH');
$outputJson = $this->submit($curlHandle, $dataJson); $outputJson = $this->submit($curlHandle, $dataJson);
...@@ -379,15 +388,14 @@ class TsrefRestService { ...@@ -379,15 +388,14 @@ class TsrefRestService {
* Downloads typo script reference xml from web resource. * Downloads typo script reference xml from web resource.
* *
* @param string $typo3Version * @param string $typo3Version
* @param int $typo3Group * @param string $typoScriptGroup
* @return mixed * @return mixed
*/ */
public function getTsrefXml($typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP) { public function getTsrefXml($typo3Version = self::TYPO3_DEFAULT_VERSION, $typoScriptGroup) {
$curlHandle = $this->initialiseCurl('/tsref'); $curlHandle = $this->initialiseCurl('/' . $typoScriptGroup . '/tsref');
$headerProperties = [ $headerProperties = [
'version: ' . $typo3Version, 'version: ' . $typo3Version,
'typo3group: ' . $typo3Group
]; ];
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties); curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties);
...@@ -468,10 +476,10 @@ class TsrefRestService { ...@@ -468,10 +476,10 @@ class TsrefRestService {
* Gets en array of types for given TYPO3 version. The types are fetched with name and id only. * Gets en array of types for given TYPO3 version. The types are fetched with name and id only.
* *
* @param string $typo3Version * @param string $typo3Version
* @param int $typoScriptGroup * @param string $typoScriptGroup
* @return array * @return array
*/ */
public function getTypesWithNull($typo3Version, $typoScriptGroup = Attribute::NORMAL_GROUP) { public function getTypesWithNull($typo3Version, $typoScriptGroup) {
$typesAssociative = Conversion::typesToAssociativeIdArray( $typesAssociative = Conversion::typesToAssociativeIdArray(
$this->getTypes(TRUE, $typo3Version, $typoScriptGroup) $this->getTypes(TRUE, $typo3Version, $typoScriptGroup)
); );
......
- -
name: 'Used for viewing the data' name: 'Used for viewing the data'
uriPattern: '{@controller}/{typeUrlName}/{typo3Version}' uriPattern: '{@controller}/{typoScriptGroup}/{typeUrlName}/{typo3Version}'
defaults: defaults:
'typo3Version': 'current' 'typo3Version': 'current'
'@action': 'index' '@action': 'index'
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- -
name: 'Dashboard with version (used after version change or deletion of a type)' name: 'Dashboard with version (used after version change or deletion of a type)'
uriPattern: '{@controller}/{typo3Version}' uriPattern: '{@controller}/{typoScriptGroup}/{typo3Version}'
defaults: defaults:
'typo3Version': 'current' 'typo3Version': 'current'
'@action': 'index' '@action': 'index'
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- -
name: 'Dashboard (used when opening the application from main menu)' name: 'Dashboard (used when opening the application from main menu)'
uriPattern: '{@controller}' uriPattern: '{@controller}/{typoScriptGroup}'
defaults: defaults:
'typo3Version': 'current' 'typo3Version': 'current'
'typeUrlName': NULL 'typeUrlName': NULL
......
...@@ -128,7 +128,9 @@ This is access address: ...@@ -128,7 +128,9 @@ This is access address:
This code: This code:
<li><f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"><i class="fa fa-fw fa-file-text-o"></i> TypoScript reference</f:link.action></li> <li><f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" arguments="{typoScriptGroup: 'typoscript'}"><i class="fa fa-fw fa-file-text-o"></i> TypoScript reference</f:link.action></li>
<li><f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" arguments="{typoScriptGroup: 'user-tsconfig'}"><i class="fa fa-fw fa-file-text-o"></i> User-tsconfig reference</f:link.action></li>
<li><f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" arguments="{typoScriptGroup: 'page-tsconfig'}"><i class="fa fa-fw fa-file-text-o"></i> Page-tsconfig reference</f:link.action></li>
Needs to be added to the Forger file: Needs to be added to the Forger file:
...@@ -176,90 +178,3 @@ Add these routes just before Flow sub routes. ...@@ -176,90 +178,3 @@ Add these routes just before Flow sub routes.
#### Add edit-data privilege to en existing account #### Add edit-data privilege to en existing account
./flow account:addrole --identifier userName --role SGalinski.TypoScriptReferenceFrontend:Admin ./flow account:addrole --identifier userName --role SGalinski.TypoScriptReferenceFrontend:Admin
================================================================
## Install SGalinski.TypoScriptReferenceFrontend to new project
### Prerequisite
SGalinski.TypoScriptReferenceFrontend is Flow package, so you need first a flow project.
composer create-project --dev --keep-vcs typo3/flow-base-distribution ProjectName
You can use any project name you wish. If you already have Flow project, you can skip this step.
### Install
cd Packages/Application
git clone git@gitlab.sgalinski.de:typo3/TypoScript-Forger.git SGalinski.TypoScriptReferenceFrontend
cd SGalinski.TypoScriptReferenceFrontend
### Supply the necessary routes
Edit Routes.yaml of your project (`ProjectName/Configuration/Routes.yaml`)
-
name: 'TypoScriptReferenceFrontend'
uriPattern: '<SGalinski.TypoScriptReferenceFrontend>'
subRoutes:
SGalinski.TypoScriptReferenceFrontend:
package: SGalinski.TypoScriptReferenceFrontend
##
# Flow subroutes
#
-
name: 'Flow'
uriPattern: '<FlowSubroutes>'
defaults:
'@format': 'html'
subRoutes:
FlowSubroutes:
package: TYPO3.Flow
Uri prefix can be added if needed, e.g.: `uriPattern: 'ts/<SGalinski.TypoScriptReferenceFrontend>'`.
### Configure view
To be able to integrate `SGalinski.TypoScriptReferenceFrontend` package with other packages
(for example to use existing layout with menu from other package), view configuration in main project is needed.
Here is example of view configuration for integration with `WMDB.Forger` package.
`ProjectName/Configuration/Views.yaml`:
-
options:
layoutRootPaths:
'WMDB.Forger/Layouts': 'resource://WMDB.Forger/Private/Layouts'
partialRootPaths:
'WMDB.Forger/Partials': 'resource://WMDB.Forger/Private/Partials'
'SGalinski.TypoScriptReferenceFrontend/Partials': 'resource://SGalinski.TypoScriptReferenceFrontend/Private/Partials'
# templateRootPaths:
# 'WMDB.Forger/Templates': 'resource://WMDB.Forger/Private/Templates'
# 'SGalinski.TypoScriptReferenceFrontend/Templates': 'resource://SGalinski.TypoScriptReferenceFrontend/Private/Templates'
### Install backend
This project is front end part of grater entity.
All the data which is used by this package is provided by RESTful web service:
https://gitlab.sgalinski.de/typo3/TypoScript-Backend
If the web service is not installed, follow it's readme to do so.
### Access the package via browser
This is access address:
your.domain/tsref
### Fluid link to access the package
Put this link in a menu:
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"><i class="fa fa-fw fa-file-text-o"></i> TypoScript reference</f:link.action>
...@@ -22,10 +22,4 @@ ...@@ -22,10 +22,4 @@
</div> </div>
</div> </div>
<div class="form-group"> <f:form.hidden property="typo3Group" />
<label for="typoScriptGroup" class="col-sm-2 control-label">TypoScript Group</label>
<div class="col-sm-10">
<f:form.select property="typo3Group" options="{typo3Groups}" id="typoScriptGroup" class="form-control" />
</div>
</div>
\ No newline at end of file
<div class="col-sm-3 col-md-2 sidebar"> <div class="col-sm-3 col-md-2 sidebar">
<f:form id="submitTypo3VersionAndGroup" package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="submitTypo3VersionAndGroup"> <f:form id="submitTypo3Version" package="SGalinski.TypoScriptReferenceFrontend" controller="tsref"
action="submitTypo3Version" arguments="{typoScriptGroup: selectedTypoScriptGroup}">
<div class="typoscript-group-caption">
{selectedTypoScriptGroup}
</div>
<div class="form-group"> <div class="form-group">
<label for="submittedTypo3Version" class="control-label">TYPO3 version</label> <label for="submittedTypo3Version" class="control-label">TYPO3 version</label>
<div> <div>
<f:form.select name="submittedTypo3Version" value="{selectedTypo3Version}" options="{typo3Versions}" <f:form.select name="submittedTypo3Version" value="{selectedTypo3Version}" options="{typo3Versions}"
id="submittedTypo3Version" class="form-control" id="submittedTypo3Version" class="form-control"
additionalAttributes="{onchange: 'submitForm(\'submitTypo3VersionAndGroup\')'}" /> additionalAttributes="{onchange: 'submitForm(\'submitTypo3Version\')'}" />
</div> </div>
</div> </div>
<div class="form-group">
<label for="submittedTypoScriptGroup" class="control-label">TypoScript group</label>
<div>
<f:form.select name="submittedTypoScriptGroup" value="{selectedTypoScriptGroup}"
options="{typoScriptGroups}" id="submittedTypoScriptGroup" class="form-control"
additionalAttributes="{onchange: 'submitForm(\'submitTypo3VersionAndGroup\')'}" />
</div>
</div>
</f:form> </f:form>
<f:security.ifHasRole role="SGalinski.TypoScriptReferenceFrontend:Admin"> <f:security.ifHasRole role="SGalinski.TypoScriptReferenceFrontend:Admin">
<div class="add-type-link"> <div class="add-type-link">
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editType" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editType"
arguments="{typeId: NULL, typo3Version: selectedTypo3Version}"> arguments="{typeId: NULL, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
[add type] [add type]
</f:link.action> </f:link.action>
</div> </div>
...@@ -38,7 +32,7 @@ ...@@ -38,7 +32,7 @@
<f:for each="{types}" as="type"> <f:for each="{types}" as="type">
<li class="{f:if(condition: '{selectedTypeUrlName} == {type.urlName}', then: 'active')}"> <li class="{f:if(condition: '{selectedTypeUrlName} == {type.urlName}', then: 'active')}">
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"
arguments="{typeUrlName: type.urlName, typo3Version: selectedTypo3Version}"> arguments="{typeUrlName: type.urlName, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
{type.name} {type.name}
<f:if condition="{selectedTypeUrlName} == {type.urlName}"> <f:if condition="{selectedTypeUrlName} == {type.urlName}">
<span class="sr-only">(current)</span> <span class="sr-only">(current)</span>
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
</h1> </h1>
<f:form package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="submitProperty" <f:form package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="submitProperty"
object="{theProperty}" objectName="theProperty" arguments="{editForm: '{editForm}', typo3Version: selectedTypo3Version}" class="form-horizontal"> object="{theProperty}" objectName="theProperty" class="form-horizontal"
arguments="{editForm: '{editForm}', typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
<f:form.hidden property="id" /> <f:form.hidden property="id" />
<f:form.hidden property="parentType" /> <f:form.hidden property="parentType" />
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
</h1> </h1>
<f:form package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="submitType" <f:form package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="submitType"
object="{theType}" objectName="theType" arguments="{editForm: '{editForm}', typo3Version: selectedTypo3Version}" class="form-horizontal"> object="{theType}" objectName="theType" class="form-horizontal"
arguments="{editForm: '{editForm}', typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
<f:form.hidden property="id" /> <f:form.hidden property="id" />
<f:render partial="CommonAttributeFields" arguments="{_all}" /> <f:render partial="CommonAttributeFields" arguments="{_all}" />
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
<div class="right-side-link"> <div class="right-side-link">
[ [
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editType" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editType"
arguments="{typeId: selectedType.id, typo3Version: selectedTypo3Version}"> arguments="{typeId: selectedType.id, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
edit type edit type
</f:link.action> </f:link.action>
| |
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref"
action="deleteType" onclick="return confirmDeleteType()" action="deleteType" onclick="return confirmDeleteType()"
arguments="{attributeId: selectedType.id, typo3Version: selectedTypo3Version}"> arguments="{attributeId: selectedType.id, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
delete type delete type
</f:link.action> </f:link.action>
] ]
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</f:then> </f:then>
<f:else> <f:else>
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"
arguments="{typeUrlName: superType.urlName, typo3Version: selectedTypo3Version}"> arguments="{typeUrlName: superType.urlName, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
{superType.name} {superType.name}
</f:link.action> </f:link.action>
</f:else> </f:else>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<td class="table-right-col"> <td class="table-right-col">
<f:security.ifHasRole role="SGalinski.TypoScriptReferenceFrontend:Admin"> <f:security.ifHasRole role="SGalinski.TypoScriptReferenceFrontend:Admin">
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editProperty" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editProperty"
arguments="{parentTypeId: selectedType.id, thePropertyId: NULL, typo3Version: selectedTypo3Version}" class="right-side-link"> arguments="{parentTypeId: selectedType.id, thePropertyId: NULL, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}" class="right-side-link">
[add property] [add property]
</f:link.action> </f:link.action>
</f:security.ifHasRole> </f:security.ifHasRole>
...@@ -94,13 +94,13 @@ ...@@ -94,13 +94,13 @@
<div class="right-side-link"> <div class="right-side-link">
[ [
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editProperty" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="editProperty"
arguments="{parentTypeId: selectedType.id, thePropertyId: propertyIterator.0.id, typo3Version: selectedTypo3Version}"> arguments="{parentTypeId: selectedType.id, thePropertyId: propertyIterator.0.id, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
edit property edit property
</f:link.action> </f:link.action>
| |
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref"
action="deleteProperty" onclick="return confirmDeleteProperty()" action="deleteProperty" onclick="return confirmDeleteProperty()"
arguments="{ attributeId: propertyIterator.0.id, parentTypeUrlName: selectedType.urlName, typo3Version: selectedTypo3Version}"> arguments="{ attributeId: propertyIterator.0.id, parentTypeUrlName: selectedType.urlName, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
delete property delete property
</f:link.action> </f:link.action>
] ]
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</f:then> </f:then>
<f:else> <f:else>
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index" <f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"
arguments="{typeUrlName: propertyIterator.type_url_name, typo3Version: selectedTypo3Version}"> arguments="{typeUrlName: propertyIterator.type_url_name, typo3Version: selectedTypo3Version, typoScriptGroup: selectedTypoScriptGroup}">
{propertyIterator.type_name} {propertyIterator.type_name}
</f:link.action> </f:link.action>
</f:else> </f:else>
......
...@@ -35,3 +35,12 @@ textarea#description.min-height200 { ...@@ -35,3 +35,12 @@ textarea#description.min-height200 {
padding-bottom: 15px; padding-bottom: 15px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.typoscript-group-caption {
font-weight: bold;
text-align: center;
display: block;
border-bottom: 1px solid #EEE;
padding-bottom: 15px;
margin-bottom: 10px;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment