Archived
1
0
Fork 0

Add move client

This commit is contained in:
Varakh 2018-04-06 15:12:52 +02:00
parent ccc686ae28
commit 513bc9b811
7 changed files with 63 additions and 8 deletions

View file

@ -2,15 +2,13 @@
**ts3web** is a webinterface for any TeamSpeak 3 Server used with serverQuery login.
This webinterface aims to be as simple as possible. It does not provide complex features. Instead, it only supports features considered useful for a TeamSpeak 3 web interface. **The minimalistic approach is intentional!**
This webinterface aims to be as simple as possible. The minimalistic approach is intentional.
If you like to help (to translate or implement missing features), open an issue first. You should use existing code to implement new features. PRs will be merged after a code review.
If you like to help (to translate or implement features), open an issue first. If possible, you should use existing code to implement new features. PRs will be merged after a code review.
Things you **cannot** do:
- Permissions Management (add, edit, delete for servergroups, channelgroups, clients)
- File Management (except viewing)
- Temporary passwords
- Move online clients
Features which are currently not supported:
- Permissions Management (except for viewing)
- File Management (except for viewing)
## Install ##

View file

@ -56,6 +56,7 @@ class ACL extends \Zend\Permissions\Acl\Acl
'/online/kick/{sid}/{clid}',
'/online/ban/{sid}/{clid}',
'/online/send/{sid}/{clid}',
'/online/move/{sid}/{clid}',
'/clients/{sid}',
'/clients/{sid}/{cldbid}',

View file

@ -175,9 +175,13 @@ $app->post('/online/ban/{sid}/{clid}', OnlineBanAction::class);
$container[OnlineSendAction::class] = function ($container) {
return new OnlineSendAction($container);
};
$app->post('/online/send/{sid}/{clid}', OnlineSendAction::class);
$container[OnlineMoveAction::class] = function ($container) {
return new OnlineMoveAction($container);
};
$app->post('/online/move/{sid}/{clid}', OnlineMoveAction::class);
// group
$container[GroupsAction::class] = function ($container) {
return new GroupsAction($container);

View file

@ -213,6 +213,10 @@ bans.delete: "Delete"
complains.delete: "Delete"
# online
online.move: "Move"
online.move.channel: "Channel"
online.move.channel_password: "Channel password"
online.moved.success: "Moved client %clid%."
online.kick: "Kick"
online.kick.reason: "Reason"
online.poke: "Poke"

View file

@ -15,10 +15,19 @@ final class OnlineInfoAction extends AbstractAction
$dataResult = $this->ts->getInstance()->clientInfo($clid);
$channelsResult = $this->ts->getInstance()->channelList();
$channelsResult = $this->ts->getInstance()->getElement('data', $channelsResult);
$channels = [];
foreach ($channelsResult as $channel) {
$channels[$channel['channel_name']] = $channel['cid'];
}
// render GET
$this->view->render($response, 'online_info.twig', [
'title' => $this->translator->trans('online_info.title') . ' ' . $clid,
'data' => $this->ts->getInstance()->getElement('data', $dataResult),
'channels' => $channels,
'sid' => $sid,
'clid' => $clid,
]);

View file

@ -0,0 +1,29 @@
<?php
use Slim\Http\Request;
use Slim\Http\Response;
final class OnlineMoveAction extends AbstractAction
{
public function __invoke(Request $request, Response $response, $args)
{
$sid = $args['sid'];
$clid = $args['clid'];
$body = $request->getParsedBody();
$channel = $body['channel'];
$channelPassword = null;
if (array_key_exists('channel_password', $body)) $channelPassword = $body['channel_password'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
if (empty($channelPassword)) $dataResult = $this->ts->getInstance()->clientMove($clid, $channel);
else $dataResult = $this->ts->getInstance()->clientMove($clid, $channel, $channelPassword);
$this->flash->addMessage('success', $this->translator->trans('online.moved.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid . '/' . $clid);
}
}

View file

@ -34,6 +34,16 @@
{'type': 'number', 'key': 'time', 'label': 'online.ban.time'|trans}
]
},
{
'header_label': 'online.move'|trans,
'label': '<i class="material-icons">check_circle</i>',
'uri': '/online/move/' ~ sid ~ '/' ~ clid,
'uri_method': 'post',
'fields': [
{'type': 'select', 'key': 'channel', 'options': channels,'label': 'online.move.channel'|trans},
{'type': 'text', 'key': 'channel_password', 'label': 'online.move.channel_password'|trans}
]
},
{
'header_label': 'online.send'|trans,
'label': '<i class="material-icons">check_circle</i>',