Skip to content
This repository was archived by the owner on Jul 5, 2022. It is now read-only.

Commit 30449f1

Browse files
authored
Actions (#101)
* Small fixes. * Reply read, forward, store, trash and partially label actions. * Style. * Style2. * Add label selects. * Bridge. * Disable all unfinished actions clean. * Style.
1 parent ec357a5 commit 30449f1

33 files changed

+682
-281
lines changed

Bridge/MessageModuleBridge.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Routing\RouterInterface;
1616
use Zikula\ExtensionsModule\Api\ApiInterface\VariableApiInterface;
1717
use Zikula\ExtensionsModule\Api\VariableApi;
18+
use Zikula\IntercomModule\Manager\Messenger;
1819
use Zikula\UsersModule\Api\CurrentUserApi;
1920
use Zikula\UsersModule\MessageModule\MessageModuleInterface;
2021

@@ -45,6 +46,11 @@ class MessageModuleBridge implements MessageModuleInterface
4546
*/
4647
private $currentUser;
4748

49+
/**
50+
* @var Messenger
51+
*/
52+
private $messenger;
53+
4854
/**
4955
* MessagesModuleBridge constructor.
5056
*
@@ -53,29 +59,34 @@ class MessageModuleBridge implements MessageModuleInterface
5359
* @param VariableApiInterface $variableApi
5460
* @param CurrentUserApi $currentUser
5561
* @param UserRepositoryInterface $userRepository
56-
* @param string $prefix
62+
* @param Messenger $messenger
5763
*/
5864
public function __construct(
5965
RouterInterface $router,
6066
RequestStack $requestStack,
6167
VariableApiInterface $variableApi,
62-
CurrentUserApi $currentUser
68+
CurrentUserApi $currentUser,
69+
Messenger $messanger
6370
) {
6471
$this->router = $router;
6572
$this->requestStack = $requestStack;
6673
$this->variableApi = $variableApi;
6774
$this->currentUser = $currentUser;
75+
$this->messenger = $messanger;
6876
}
6977

7078
public function getInboxUrl($uid = null)
7179
{
80+
return $this->router->generate('zikulaintercommodule_messages_getmessages', ['box' => 'inbox']);
7281
}
7382

7483
public function getMessageCount($uid = null, $unreadOnly = false)
7584
{
85+
return $this->messenger->getMessenger($uid)->getMessagesCount($unreadOnly);
7686
}
7787

7888
public function getSendMessageUrl($uid = null)
7989
{
90+
return $this->router->generate('zikulaintercommodule_messages_newmessage');
8091
}
8192
}

Container/LinkContainer.php

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ private function getAccount()
109109
'icon' => 'inbox',
110110
];
111111
//@todo add something more general to disable user preferences even if this and future features are enabled
112-
if ($this->variableApi->get($this->name, 'allow_emailnotification', false) && $this->variableApi->get($this->name, 'allow_autoreply', false)) {
113-
$links[] = [
114-
'url' => $this->router->generate('zikulaintercommodule_user_preferences'),
115-
'text' => $this->translator->__('Messages settings'),
116-
'title' => $this->translator->__('Private messaging settings'),
117-
'icon' => 'wrench',
118-
];
119-
}
112+
// disable till preferences are actually used
113+
// if ($this->variableApi->get($this->name, 'allow_emailnotification', false) && $this->variableApi->get($this->name, 'allow_autoreply', false)) {
114+
// $links[] = [
115+
// 'url' => $this->router->generate('zikulaintercommodule_user_preferences'),
116+
// 'text' => $this->translator->__('Messages settings'),
117+
// 'title' => $this->translator->__('Private messaging settings'),
118+
// 'icon' => 'wrench',
119+
// ];
120+
// }
120121

121122
return $links;
122123
}
@@ -134,33 +135,33 @@ private function getAdmin()
134135
'url' => $this->router->generate('zikulaintercommodule_admin_status'),
135136
'text' => $this->translator->__('Info'),
136137
'title' => $this->translator->__('Display informations'),
137-
'icon' => 'dashboard', ];
138+
'icon' => 'bar-chart', ];
138139
$links[] = [
139140
'url' => $this->router->generate('zikulaintercommodule_admin_preferences'),
140141
'text' => $this->translator->__('Settings'),
141142
'title' => $this->translator->__('Adjust module settings'),
142143
'icon' => 'wrench', ];
143-
if ($this->variableApi->get($this->name, 'labels_enabled', false)) {
144-
$links[] = [
145-
'url' => $this->router->generate('zikulaintercommodule_labels_list'),
146-
'text' => $this->translator->__('Labels'),
147-
'title' => $this->translator->__('Here you can import messages from older versions'),
148-
'icon' => 'tags', ];
149-
}
150-
if ($this->variableApi->get($this->name, 'support_enabled', false)) {
151-
$links[] = [
152-
'url' => $this->router->generate('zikulaintercommodule_support_list'),
153-
'text' => $this->translator->__('Support messages'),
154-
'title' => $this->translator->__('Here you can import messages from older versions'),
155-
'icon' => 'life-buoy', ];
156-
}
157-
if ($this->variableApi->get($this->name, 'notifications_enabled', false)) {
158-
$links[] = [
159-
'url' => $this->router->generate('zikulaintercommodule_notifications_list'),
160-
'text' => $this->translator->__('Notifications'),
161-
'title' => $this->translator->__('Here you can import messages from older versions'),
162-
'icon' => 'bullhorn', ];
163-
}
144+
// if ($this->variableApi->get($this->name, 'labels_enabled', false)) {
145+
// $links[] = [
146+
// 'url' => $this->router->generate('zikulaintercommodule_labels_list'),
147+
// 'text' => $this->translator->__('Labels'),
148+
// 'title' => $this->translator->__('Here you can import messages from older versions'),
149+
// 'icon' => 'tags', ];
150+
// }
151+
// if ($this->variableApi->get($this->name, 'support_enabled', false)) {
152+
// $links[] = [
153+
// 'url' => $this->router->generate('zikulaintercommodule_support_list'),
154+
// 'text' => $this->translator->__('Support messages'),
155+
// 'title' => $this->translator->__('Here you can import messages from older versions'),
156+
// 'icon' => 'life-buoy', ];
157+
// }
158+
// if ($this->variableApi->get($this->name, 'notifications_enabled', false)) {
159+
// $links[] = [
160+
// 'url' => $this->router->generate('zikulaintercommodule_notifications_list'),
161+
// 'text' => $this->translator->__('Notifications'),
162+
// 'title' => $this->translator->__('Here you can import messages from older versions'),
163+
// 'icon' => 'bullhorn', ];
164+
// }
164165
$links[] = [
165166
'url' => $this->router->generate('zikulaintercommodule_import_status'),
166167
'text' => $this->translator->__('Import'),
@@ -231,14 +232,14 @@ private function getUser()
231232
'links' => $labelsLinks,
232233
];
233234
//@todo add something more general to disable user preferences even if this and future features are enabled
234-
if ($this->variableApi->get($this->name, 'allow_emailnotification', false) && $this->variableApi->get($this->name, 'allow_autoreply', false)) {
235-
$links[] = [
236-
'url' => $this->router->generate('zikulaintercommodule_user_preferences'),
237-
'text' => $this->translator->__('Settings'),
238-
'title' => $this->translator->__('Private messaging settings'),
239-
'icon' => 'wrench',
240-
];
241-
}
235+
// if ($this->variableApi->get($this->name, 'allow_emailnotification', false) && $this->variableApi->get($this->name, 'allow_autoreply', false)) {
236+
// $links[] = [
237+
// 'url' => $this->router->generate('zikulaintercommodule_user_preferences'),
238+
// 'text' => $this->translator->__('Settings'),
239+
// 'title' => $this->translator->__('Private messaging settings'),
240+
// 'icon' => 'wrench',
241+
// ];
242+
// }
242243
$links[] = [
243244
'url' => $this->router->generate('zikulaintercommodule_messages_newmessage'),
244245
'text' => $this->translator->__('New message'),

0 commit comments

Comments
 (0)