diff --git a/Classes/Domain/Model/Message.php b/Classes/Domain/Model/Message.php index 9e1509b..1af8024 100644 --- a/Classes/Domain/Model/Message.php +++ b/Classes/Domain/Model/Message.php @@ -44,6 +44,13 @@ class Message extends AbstractEntity */ protected $seenBy = null; + /** + * priority + * + * @var int $priority + */ + protected $priority = 0; + /** */ public function __construct() @@ -167,4 +174,21 @@ public function removeSeenBy(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $front { $this->seenBy->detach($frontendUser); } + + /** + * @return int + */ + public function getPriority(): int + { + return $this->priority; + } + + /** + * @param int $priority + */ + public function setPriority(int $priority): void + { + $this->priority = $priority; + } + } diff --git a/Classes/Domain/Repository/MessageRepository.php b/Classes/Domain/Repository/MessageRepository.php index 6e468cf..3813ca8 100644 --- a/Classes/Domain/Repository/MessageRepository.php +++ b/Classes/Domain/Repository/MessageRepository.php @@ -36,9 +36,11 @@ public function findByNotSeen(int $userId): QueryResultInterface { $query = $this->createQuery(); - $query->matching($query->logicalNot( + $query->getQuerySettings()->setRespectStoragePage(false); + + /* $query->matching($query->logicalNot( $query->contains('seenBy', $userId) - )); + ));*/ return $query->execute(); } diff --git a/Configuration/TCA/tx_pxamessagebox_domain_model_message.php b/Configuration/TCA/tx_pxamessagebox_domain_model_message.php index b01362b..0aa2301 100644 --- a/Configuration/TCA/tx_pxamessagebox_domain_model_message.php +++ b/Configuration/TCA/tx_pxamessagebox_domain_model_message.php @@ -19,10 +19,10 @@ 'iconfile' => 'EXT:pxa_message_box/Resources/Public/Icons/message.svg' ], 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date, author, headline, text, seen_by', + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, priority, date, author, headline, text, seen_by', ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date, author, headline, text, + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, priority, date, author, headline, text, --div--;LLL:EXT:pxa_message_box/Resources/Private/Language/locallang_db.xlf:tx_pxamessagebox_domain_model_message.seen_by, seen_by, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime' ], @@ -156,5 +156,20 @@ 'MM' => 'tx_pxamessagebox_message_feuser_mm', ] ], + 'priority' => [ + 'exclude' => false, + 'label' => 'Availability', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['Viktigt', 0], + ['Notera' , 1] + ], + 'showIconTable' => true, + 'size' => 1, + 'maxitems' => 1, + ] + ], ], ]; diff --git a/Resources/Private/Templates/Message/List.html b/Resources/Private/Templates/Message/List.html index eccd85a..759f75c 100644 --- a/Resources/Private/Templates/Message/List.html +++ b/Resources/Private/Templates/Message/List.html @@ -4,29 +4,34 @@ -
+
+ pageType="2378954" + data="{close-message: '1'}" + id="message-box-{message.uid}" + arguments="{message: message}">
-
- {f:format.date(date: message.date, format: 'Y-m-d')} - {message.author} -
+ +
+ {f:format.date(date: message.date, format: 'Y-m-d')} + {message.author} +
+
- +

{message.headline}

- - {message.text} + +
+ {message.text} +
- \ No newline at end of file + + diff --git a/Resources/Public/Js/messageBox.js b/Resources/Public/Js/messageBox.js index 7e033be..ff31b57 100644 --- a/Resources/Public/Js/messageBox.js +++ b/Resources/Public/Js/messageBox.js @@ -8,6 +8,7 @@ $(function () { var ajaxUrl = $(this).attr('href'); var currentElement = $(this); + currentElement.parent().toggleClass('message-box__collapsed'); $.ajax({ url: ajaxUrl, @@ -15,7 +16,7 @@ $(function () { success: function (data) { if (data.success) { - currentElement.parent().hide(); + console.log('1') } }, }); diff --git a/ext_tables.sql b/ext_tables.sql index bfb5ab7..ae7c322 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -8,7 +8,7 @@ CREATE TABLE tx_pxamessagebox_domain_model_message ( headline varchar(255) DEFAULT '' NOT NULL, text text, seen_by int(11) DEFAULT '0' NOT NULL, - + priority tinyint(4) DEFAULT '0' NOT NULL ); CREATE TABLE tx_pxamessagebox_message_feuser_mm (