Commit 7cfc9d7a authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent c5c0b75f
0.0.6
19-06-24
Feature
* #t3812: New table ticket: GUI
New files:
* /opt/typo3/extensions/tile/Classes/ViewHelpers/Get/TicketFieldViewHelper.php
* /opt/typo3/extensions/tile/Resources/Private/Templates/Cell/CreateTicket.html
Affected files:
* /opt/typo3/extensions/tile/Classes/Controller/CellController.php
* /opt/typo3/extensions/tile/Classes/Utility/Module/SessionModuleUtility.php
* /opt/typo3/extensions/tile/Classes/Controller/AbstractController.php
* #t3811: New table ticket
New files:
* Classes
......
......@@ -7,6 +7,7 @@ use \Netzmacher\Tile\Domain\Repository\CategoryRepository;
use \Netzmacher\Tile\Domain\Repository\CellRepository;
use \Netzmacher\Tile\Domain\Repository\CssRepository;
use \Netzmacher\Tile\Domain\Repository\GroupRepository;
use \Netzmacher\Tile\Domain\Repository\TicketRepository;
/* * *
*
......@@ -65,6 +66,14 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
*/
protected $groupRepository = null;
/**
* ticketRepository
*
* @var \Netzmacher\Tile\Domain\Repository\TicketRepository
* @inject
*/
protected $ticketRepository = null;
/**
* @param AreaRepository $areaRepository
* @return void
......@@ -110,4 +119,13 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
$this->groupRepository = $groupRepository;
}
/**
* @param TicketRepository $ticketRepository
* @return void
*/
public function injectTicketRepository( TicketRepository $ticketRepository )
{
$this->ticketRepository = $ticketRepository;
}
}
......@@ -18,7 +18,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
/**
* CellController
*
* @version 0.0.3
* @version 0.0.6
* @since 0.0.1
* @internal #t3728
*/
......@@ -84,7 +84,32 @@ class CellController extends AbstractController
}
/**
* _getCategories()
* _getTickets()
*
* @return \Netzmacher\Tile\Domain\Model\Category
* @version 0.0.6
* @since 0.0.6
* @internal #t3812
*/
private function _getTickets()
{
$returnArray = [];
$defaultOrderings = [
'title' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
];
$this->ticketRepository->setDefaultOrderings( $defaultOrderings );
$tickets = $this->ticketRepository->findAll();
foreach( $tickets as $ticket )
{
$returnArray[ $ticket->getUid() ] = $ticket->getTitle();
}
return $returnArray;
}
/**
* _getCategoryTitle()
*
* @param integer $uid
*
......@@ -104,6 +129,27 @@ class CellController extends AbstractController
return $category->getTitle();
}
/**
* _getTicketTitle()
*
* @param integer $uid
*
* @return \Netzmacher\Tile\Domain\Model\Ticket
* @version 0.0.6
* @since 0.0.6
* @internal #t3812
*/
private function _getTicketTitle( $uid )
{
$ticket = $this->ticketRepository->findByUid( $uid );
if( !is_object( $ticket ) )
{
return;
}
return $ticket->getTitle();
}
/**
* _getCategories()
*
......@@ -280,6 +326,50 @@ class CellController extends AbstractController
$this->view->assign( 'size', '15' );
}
/**
* action createTicketAction
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return void
* @version 0.0.6
* @since 0.0.6
* @internal #t3812
*/
public function createTicketAction( \Netzmacher\Tile\Domain\Model\Area $area )
{
$ticketTitle = $this->_getTicketTitle( SessionModuleUtility::getFormCellTicket() );
if( empty( $ticketTitle ) )
{
$ticketTitle = 'Zurücksetzen';
}
$formCellTicketOptions = [ 0 => 'Zurücksetzen' ] + ( array ) $this->_getTickets();
$formCellTicketSelected = SessionModuleUtility::getFormCellTicket();
$formCellModeSelected = SessionModuleUtility::getFormCellMode();
if( empty( $formCellModeSelected ) )
{
$formCellModeSelected = 'cell';
}
$formCellModeOptions = [
'cell' => 'Kachel',
'group' => 'Gruppe'
];
$currentModeLabel = $formCellModeOptions[ SessionModuleUtility::getFormCellMode() ];
if( empty( $currentModeLabel ) )
{
$currentModeLabel = 'Kachel';
}
$this->view->assign( 'area', $area );
$this->view->assign( 'ticketTitle', $ticketTitle );
$this->view->assign( 'cells', $this->_getAreaCells( $area ) );
$this->view->assign( 'currentModeLabel', $currentModeLabel );
$this->view->assign( 'formCellTicketOptions', $formCellTicketOptions );
$this->view->assign( 'formCellTicketSelected', $formCellTicketSelected );
$this->view->assign( 'formCellModeOptions', $formCellModeOptions );
$this->view->assign( 'formCellModeSelected', $formCellModeSelected );
$this->view->assign( 'grid-template-columns', $this->_getAutoElementsForGridCSS( $area ) );
$this->view->assign( 'size', '15' );
}
/**
* action delete
*
......@@ -386,14 +476,14 @@ class CellController extends AbstractController
}
/**
* action update
* action updateCategory
*
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @return void
* @version 0.0.1
* @version 0.0.6
* @since 0.0.1
*/
public function updateAction( \Netzmacher\Tile\Domain\Model\Cell $cell )
public function updateCategoryAction( \Netzmacher\Tile\Domain\Model\Cell $cell )
{
//$this->addFlashMessage( 'The object was updated. Please be aware that this action is publicly accessible unless you implement an access check. See https://docs.typo3.org/typo3cms/extensions/extension_builder/User/Index.html', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
$this->_setCategoryForCellRange( $cell );
......@@ -406,4 +496,25 @@ class CellController extends AbstractController
$this->redirect( 'createCategory', NULL, NULL, $arguments );
}
/**
* action updateTicket
*
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @return void
* @version 0.0.6
* @since 0.0.1
*/
public function updateTicketAction( \Netzmacher\Tile\Domain\Model\Cell $cell )
{
//$this->addFlashMessage( 'The object was updated. Please be aware that this action is publicly accessible unless you implement an access check. See https://docs.typo3.org/typo3cms/extensions/extension_builder/User/Index.html', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
$this->_setTicketForCellRange( $cell );
$cell->setTxTileTicket( SessionModuleUtility::getFormCellTicket() );
$this->cellRepository->update( $cell );
$area = $this->request->getArgument( 'area' );
$arguments = [
'area' => $area
];
$this->redirect( 'createTicket', NULL, NULL, $arguments );
}
}
......@@ -21,13 +21,21 @@ class Prompt extends AbstractFormElement
$prompt = $parameters[ 'prompt' ];
switch( $prompt )
$prompt = $GLOBALS[ 'LANG' ]->sL( 'LLL:EXT:tile/Resources/Private/Language/TCA/prompt.xlf:' . $prompt . '.prompt' );
if( !empty( $prompt ) )
{
case('readonly'):
return $this->_readonly();
default:
return $this->_errorSwitch( __LINE__, $prompt );
return $this->_calloutWrap( $prompt, 'warning' );
}
return $this->_errorSwitch( __LINE__, $prompt );
// switch( $prompt )
// {
// case('dontEditRemove'):
// case('readonly'):
// $prompt = $GLOBALS[ 'LANG' ]->sL( 'LLL:EXT:tile/Resources/Private/Language/TCA/prompt.xlf:' . $prompt . '.prompt' );
// default:
// return $this->_errorSwitch( __LINE__, $prompt );
// }
}
/**
......@@ -45,17 +53,6 @@ class Prompt extends AbstractFormElement
return $result;
}
/**
* _readonly
*
* @return string HTML prompt
*/
private function _readonly()
{
$prompt = $GLOBALS[ 'LANG' ]->sL( 'LLL:EXT:tile/Resources/Private/Language/TCA/prompt.xlf:readonly.prompt' );
return $this->_calloutWrap( $prompt, 'warning' );
}
/**
* _calloutWrap
*
......
......@@ -16,7 +16,7 @@ namespace Netzmacher\Tile\Utility\Module;
/**
* SessionModuleUtility
*
* @version 0.0.3
* @version 0.0.6
* @since 0.0.3
* @internal #t3728
*/
......@@ -92,6 +92,20 @@ class SessionModuleUtility
return $value;
}
/**
* getFormCellTicket: get tx_tile_ticket from the session data
*
* @return string
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellTicket()
{
$value = self::_getSessionElement( 'formCellTicket' );
return $value;
}
/**
* getFormCellMode: get moede from the session data
*
......
<?php
//declare(strict_types=1);
namespace Netzmacher\Tile\ViewHelpers\Get;
use Netzmacher\Tile\Domain\Repository\TicketRepository;
use Netzmacher\Tile\Utility\ObjectUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class TicketFieldViewHelper
*
* @version 0.0.6
* @since 0.0.6
* @internal #t3812
*/
class TicketFieldViewHelper extends AbstractViewHelper
{
/**
* @return void
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument( 'default', 'string', 'default', false, '' );
$this->registerArgument( 'field', 'string', 'field', false, 0 );
$this->registerArgument( 'prefix', 'string', 'prefix', false, '' );
$this->registerArgument( 'uid', 'int', 'uid', false, 0 );
}
/**
* @return string
*/
public function render(): string
{
$default = $this->arguments[ 'default' ];
$field = $this->arguments[ 'field' ];
$prefix = $this->arguments[ 'prefix' ];
$uid = $this->arguments[ 'uid' ];
if( empty( $uid ) )
{
return $default;
}
$ticketRepository = ObjectUtility::getObjectManager()->get( TicketRepository::class );
$ticket = $ticketRepository->findByUid( $uid );
if( empty( $ticket ) )
{
return $default;
}
switch( $field )
{
case('title'):
return $prefix . $ticket->getTitle();
default:
var_dump( __METHOD__, __LINE__, 'Error in switch! Undefined field "' . $field . '"' );
die();
}
}
}
\ No newline at end of file
......@@ -122,7 +122,7 @@ return [
'type' => 'user',
'renderType' => 'Prompt',
'parameters' => [
'prompt' => 'readonly',
'prompt' => 'editImage',
],
],
],
......
......@@ -35,7 +35,7 @@ return [
. 'hidden, '
. 'title, colordisabled, coloravailable, colorselled,'
. 'tx_tile_css, '
. 'tx_tile_group, '
// . 'tx_tile_group, '
// . '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, '
// . 'starttime, endtime'
],
......@@ -190,30 +190,30 @@ return [
],
],
],
'tx_tile_group' => [
'exclude' => true,
'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_category.tx_tile_group',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_tile_domain_model_group',
'MM' => 'tx_tile_category_group_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'fieldControl' => [
'editPopup' => [
'disabled' => false,
],
'addRecord' => [
'disabled' => false,
],
'listModule' => [
'disabled' => true,
],
],
],
],
// 'tx_tile_group' => [
// 'exclude' => true,
// 'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_category.tx_tile_group',
// 'config' => [
// 'type' => 'select',
// 'renderType' => 'selectMultipleSideBySide',
// 'foreign_table' => 'tx_tile_domain_model_group',
// 'MM' => 'tx_tile_category_group_mm',
// 'size' => 10,
// 'autoSizeMax' => 30,
// 'maxitems' => 9999,
// 'multiple' => 0,
// 'fieldControl' => [
// 'editPopup' => [
// 'disabled' => false,
// ],
// 'addRecord' => [
// 'disabled' => false,
// ],
// 'listModule' => [
// 'disabled' => true,
// ],
// ],
// ],
// ],
],
];
......@@ -119,7 +119,7 @@ return [
'type' => 'user',
'renderType' => 'Prompt',
'parameters' => [
'prompt' => 'readonly',
'prompt' => 'dontEditRemove',
],
],
],
......@@ -192,6 +192,7 @@ return [
'items' => [
[ '', 0 ],
],
'readOnly' => 1,
],
],
'tx_tile_area' => [
......@@ -201,6 +202,9 @@ return [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_tile_domain_model_area',
'items' => [
[ '', 0 ],
],
'minitems' => 0,
'maxitems' => 1,
'readOnly' => 1,
......@@ -213,14 +217,18 @@ return [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_tile_domain_model_group',
'items' => [
[ '', 0 ],
],
'minitems' => 0,
'maxitems' => 1,
'readOnly' => 1,
],
],
'area' => [
'config' => [
'type' => 'passthrough',
],
],
// 'area' => [
// 'config' => [
// 'type' => 'passthrough',
// ],
// ],
],
];
......@@ -28,14 +28,15 @@ return [
'showRecordFieldList' => ''
. 'sys_language_uid, l10n_parent, l10n_diffsource,'
// . 'hidden,'
. 'title, tx_tile_cell, tx_tile_category',
. 'title, tx_tile_cell, tx_tile_ticket',
],
'types' => [
'1' => [
'showitem' => ''
. ' promptReadonly, sys_language_uid, l10n_parent, l10n_diffsource, '
. ' promptReadonly,'
// . ' sys_language_uid, l10n_parent, l10n_diffsource, '
// . ' hidden, '
. ' title, tx_tile_cell, tx_tile_category, '
. ' title, tx_tile_cell, tx_tile_ticket'
// . '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,'
// . ' starttime, endtime'
],
......@@ -146,7 +147,8 @@ return [
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required'
'eval' => 'trim,required',
// 'readOnly' => 1,
],
],
'tx_tile_cell' => [
......@@ -172,17 +174,19 @@ return [
'disabled' => true,
],
],
// 'readOnly' => 1,
],
],
'tx_tile_category' => [
'tx_tile_ticket' => [
'exclude' => true,
'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_group.tx_tile_category',
'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_group.tx_tile_ticket',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_tile_domain_model_category',
'foreign_table' => 'tx_tile_domain_model_ticket',
'minitems' => 0,
'maxitems' => 1,
// 'readOnly' => 1,
],
],
],
......
......@@ -26,14 +26,15 @@ return [
],
'interface' => [
'showRecordFieldList' => ''
. 'sys_language_uid, l10n_parent, l10n_diffsource,'
// . 'sys_language_uid, l10n_parent, l10n_diffsource,'
// . 'hidden,'
. 'title, tx_tile_group',
. 'title,'
. 'tx_tile_group',
],
'types' => [
'1' => [
'showitem' => ''
. ' promptReadonly, sys_language_uid, l10n_parent, l10n_diffsource, '
// . ' promptReadonly, sys_language_uid, l10n_parent, l10n_diffsource, '
// . ' hidden, '
. ' title, tx_tile_group, '
// . '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,'
......@@ -153,11 +154,17 @@ return [
'exclude' => true,
'label' => 'LLL:EXT:tile/Resources/Private/Language/locallang_db.xlf:tx_tile_domain_model_ticket.tx_tile_group',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'type' => 'inline',
'foreign_table' => 'tx_tile_domain_model_group',
'minitems' => 0,
'maxitems' => 1,
'foreign_field' => 'tx_tile_ticket',
'maxitems' => 9999,
'appearance' => [
'collapseAll' => 1,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
],
],
],
],
......
......@@ -3,6 +3,28 @@
<file source-language="de" datatype="plaintext" original="messages" date="2019-05-13T21:10:20Z" product-name="tile">
<header/>
<body>
<trans-unit id="dontEditRemove.prompt">
<source><![CDATA[
Please don't edit or remove this record directly.
Please work with the module "Book a Tile!" left in the module bar.
]]></source>
<target><![CDATA[
Bitte bearbeite diesen Datensatz weder direkt, noch lösche ihn.
Arbeite bitte mit dem Modul "Book a Tile!" links in der Modul-Leiste.
]]></target>
</trans-unit>
<trans-unit id="editImage.prompt">
<source><![CDATA[
You can upload, update or delete a picture here.
But do not remove this record or edit tiles directly.
Please work with the module "Book a Tile!" left in the module bar.
]]></source>
<target><![CDATA[
Hier kannst Du ein Bild hochladen, aktualisieren oder löschen.
Entferne diese Datensatz jedoch niemals direkt und bearbeite auch keine Kacheln.
Bitte arbeite mit dem Modul "Book a Tile!" links in der Modulleiste.
]]></target>
</trans-unit>
<trans-unit id="readonly.label">
<source>Record information</source>
<target>Datensatzinformation</target>
......
......@@ -3,18 +3,38 @@
<file source-language="en" datatype="plaintext" original="messages" date="2019-05-13T21:10:20Z" product-name="tile">
<header/>
<body>
<trans-unit id="dontEditRemove.prompt">
<source><![CDATA[
Please don't edit or remove this record directly.
Please work with the module "Book a Tile!" left in the module bar.
]]></source>
<target><![CDATA[
Bitte bearbeite diesen Datensatz weder direkt, noch lösche ihn.
Arbeite bitte mit dem Modul "Book a Tile!" links in der Modul-Leiste.
]]></target>
</trans-unit>
<trans-unit id="editImage.prompt">
<source><![CDATA[
You can upload, update or delete a picture here.
But do not remove this record or edit tiles directly.
Please work with the module "Book a Tile!" left in the module bar.
]]></source>
<target><![CDATA[
Hier kannst Du ein Bild hochladen, aktualisieren oder löschen.
Entferne diese Datensatz jedoch niemals direkt und bearbeite auch keine Kacheln.
Bitte arbeite mit dem Modul "Book a Tile!" links in der Modulleiste.
]]></target>
</trans-unit>
<trans-unit id="readonly.label">
<source>Record information</source>
<target>Datensatzinformation</target>
</trans-unit>
<trans-unit id="readonly.prompt">
<source><![CDATA[
You can not change this record here.
Please work with the module "Book a Tile!" left in the module bar.
Never change this record directly. Always use the module "Book a Tile!" left in the module bar.
]]></source>
<target><![CDATA[
Hier kannst Du diesen Datensatz nicht ändern.
Arbeite bitte mit dem Modul "Book a Tile!" links in der Modul-Leiste.
Ändere diesen Datensatz nie direkt. Benutze immer das Modul "Book a Tile!" links in der Modul-Leiste.
]]></target>
</trans-unit>
</body>
......
......@@ -19,8 +19,8 @@
</f:if>
</f:if>
<f:if condition="{vh:Condition.GP( param: 'controller', value: 'Cell')}">
<f:be.menus.actionMenuItem label="Gruppen zuweisen: Plan {area.title} ({area.lenx}x{area.leny})" arguments="{area : area}" controller="Cell" action="createGroup" />
<f:be.menus.actionMenuItem label="Objekte zuweisen: Plan {area.title} ({area.lenx}x{area.leny})" arguments="{area : area}" controller="Cell" action="createCategory" />
<f:be.menus.actionMenuItem label="Tickets zuweisen: Plan {area.title} ({area.lenx}x{area.leny})" arguments="{area : area}" controller="Cell" action="createTicket" />
</f:if>
</f:be.menus.actionMenu>
</div>
......
......@@ -43,7 +43,7 @@
<div class="grid-container">
<f:for each="{cells}" as="cell">
<div class="{vh:Get.CssField(uid: cell.txTileCategory, field: 'class', default: 'undefined')}">
<f:link.action action="update" arguments="{cell : cell, area : area}" title="{cell.title}{vh:Get.CategoryField(uid: cell.txTileCategory, field: 'title', default: '', prefix: ', ')}">&nbsp;</f:link.action>
<f:link.action action="updateCategory" arguments="{cell : cell, area : area}" title="{cell.title}{vh:Get.CategoryField(uid: cell.txTileCategory, field: 'title', default: '', prefix: ', ')}">&nbsp;</f:link.action>
<a href="#" title = "{cell.title}">&nbsp;</a>
</div>
</f:for>
......@@ -78,7 +78,7 @@
<h3>Objekt</h3>
<ol>
<li>
Wähle in der Auswahlbox ein Objekt aus und klicke den Button [Objekt aktivieren]
Wähle in der Auswahlbox ein Objekt aus und klicke den Button [Aktivieren]
</li>
<li>
Klicke die Kachel, der Du das aktivierte Objekt zuweisen möchtest.
......
{namespace vh=Netzmacher\Tile\ViewHelpers}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="content">
<f:flashMessages />
<style>
.grid-container {
background-image: url("/{area.image.originalResource.publicUrl}");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
display: inline-grid;
grid-template-columns: {grid-template-columns};
grid-gap: 2px;
background-color: #FF5E00;
background-color: #FDFDFD;
padding: 0.4rem;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 1);
text-align: center;
font-size: {size}px;
width: {size}px;
height: {size}px;
overflow: hidden;
}
.grid-container > div.undefined {
background-color: rgba(0, 0, 0, 0.1);
}
.grid-container > div.disabled {
background-color: rgba(255, 255, 255, 0.2);
}
<f:format.raw><vh:Get.CssClasses prefix=".grid-container > div" /></f:format.raw>
.grid-container > div a {
display: block;
}
</style>
<h1><f:translate key="tx_tile_domain_model_area.title" />: {area.title} ({area.lenx}x{area.leny})</h1>
<h2>Ticket zuweisen: {ticketTitle}, Modus: {currentModeLabel}</h2>
<div class="grid-container">
<f:for each="{cells}" as="cell">
<div class="{vh:Get.CssField(uid: cell.txTileTicket, field: 'class', default: 'undefined')}">
<f:link.action action="updateTicket" arguments="{cell : cell, area : area}" title="{cell.title}{vh:Get.TicketField(uid: cell.txTileTicket, field: 'title', default: '', prefix: ', ')}">&nbsp;</f:link.action>
<a href="#" title = "{cell.title}">&nbsp;</a>