Add groups rename
This commit is contained in:
parent
eacd690b18
commit
4cb1aa0056
14 changed files with 224 additions and 108 deletions
|
@ -65,13 +65,16 @@ class ACL extends \Zend\Permissions\Acl\Acl
|
||||||
'/channels/send/{sid}/{cid}',
|
'/channels/send/{sid}/{cid}',
|
||||||
|
|
||||||
'/groups/{sid}',
|
'/groups/{sid}',
|
||||||
'/groups/{sid}/{sgid}',
|
|
||||||
'/groups/delete/{sid}/{sgid}',
|
'/servergroups/{sid}/{sgid}',
|
||||||
'/groups/remove/{sid}/{sgid}/{cldbid}',
|
'/servergroups/delete/{sid}/{sgid}',
|
||||||
'/groups/add/{sid}/{sgid}',
|
'/servergroups/rename/{sid}/{sgid}',
|
||||||
|
'/servergroups/remove/{sid}/{sgid}/{cldbid}',
|
||||||
|
'/servergroups/add/{sid}/{sgid}',
|
||||||
|
|
||||||
'/channelgroups/{sid}/{cgid}',
|
'/channelgroups/{sid}/{cgid}',
|
||||||
'/channelgroups/delete/{sid}/{cgid}',
|
'/channelgroups/delete/{sid}/{cgid}',
|
||||||
|
'/channelgroups/rename/{sid}/{cgid}',
|
||||||
|
|
||||||
'/bans/{sid}',
|
'/bans/{sid}',
|
||||||
'/bans/delete/{sid}/{banId}',
|
'/bans/delete/{sid}/{banId}',
|
||||||
|
|
|
@ -184,25 +184,31 @@ $container[GroupsAction::class] = function ($container) {
|
||||||
};
|
};
|
||||||
$app->get('/groups/{sid}', GroupsAction::class);
|
$app->get('/groups/{sid}', GroupsAction::class);
|
||||||
|
|
||||||
$container[GroupInfoAction::class] = function ($container) {
|
// server group
|
||||||
return new GroupInfoAction($container);
|
$container[ServerGroupInfoAction::class] = function ($container) {
|
||||||
|
return new ServerGroupInfoAction($container);
|
||||||
};
|
};
|
||||||
$app->get('/groups/{sid}/{sgid}', GroupInfoAction::class);
|
$app->get('/servergroups/{sid}/{sgid}', ServerGroupInfoAction::class);
|
||||||
|
|
||||||
$container[GroupDeleteAction::class] = function ($container) {
|
$container[ServerGroupDeleteAction::class] = function ($container) {
|
||||||
return new GroupDeleteAction($container);
|
return new ServerGroupDeleteAction($container);
|
||||||
};
|
};
|
||||||
$app->get('/groups/delete/{sid}/{sgid}', GroupDeleteAction::class);
|
$app->get('/servergroups/delete/{sid}/{sgid}', ServerGroupDeleteAction::class);
|
||||||
|
|
||||||
$container[GroupRemoveAction::class] = function ($container) {
|
$container[ServerGroupRemoveAction::class] = function ($container) {
|
||||||
return new GroupRemoveAction($container);
|
return new ServerGroupRemoveAction($container);
|
||||||
};
|
};
|
||||||
$app->get('/groups/remove/{sid}/{sgid}/{cldbid}', GroupRemoveAction::class);
|
$app->get('/servergroups/remove/{sid}/{sgid}/{cldbid}', ServerGroupRemoveAction::class);
|
||||||
|
|
||||||
$container[GroupAddAction::class] = function ($container) {
|
$container[ServerGroupAddAction::class] = function ($container) {
|
||||||
return new GroupAddAction($container);
|
return new ServerGroupAddAction($container);
|
||||||
};
|
};
|
||||||
$app->post('/groups/add/{sid}/{sgid}', GroupAddAction::class);
|
$app->post('/servergroups/add/{sid}/{sgid}', ServerGroupAddAction::class);
|
||||||
|
|
||||||
|
$container[ServerGroupRenameAction::class] = function ($container) {
|
||||||
|
return new ServerGroupRenameAction($container);
|
||||||
|
};
|
||||||
|
$app->post('/servergroups/rename/{sid}/{sgid}', ServerGroupRenameAction::class);
|
||||||
|
|
||||||
|
|
||||||
// channel group
|
// channel group
|
||||||
|
@ -216,6 +222,11 @@ $container[ChannelGroupDeleteAction::class] = function ($container) {
|
||||||
};
|
};
|
||||||
$app->get('/channelgroups/delete/{sid}/{cgid}', ChannelGroupDeleteAction::class);
|
$app->get('/channelgroups/delete/{sid}/{cgid}', ChannelGroupDeleteAction::class);
|
||||||
|
|
||||||
|
$container[ChannelGroupRenameAction::class] = function ($container) {
|
||||||
|
return new ChannelGroupRenameAction($container);
|
||||||
|
};
|
||||||
|
$app->post('/channelgroups/rename/{sid}/{cgid}', ChannelGroupRenameAction::class);
|
||||||
|
|
||||||
// ban
|
// ban
|
||||||
$container[BansAction::class] = function ($container) {
|
$container[BansAction::class] = function ($container) {
|
||||||
return new BansAction($container);
|
return new BansAction($container);
|
||||||
|
|
|
@ -80,7 +80,8 @@ clients.title: "Clients"
|
||||||
bans.title: "Bans"
|
bans.title: "Bans"
|
||||||
complains.title: "Complains"
|
complains.title: "Complains"
|
||||||
groups.title: "Groups"
|
groups.title: "Groups"
|
||||||
group_info.title: "Group Info"
|
servergroup_info.title: "Server Group Info"
|
||||||
|
channelgroup_info.title: "Channelgroup"
|
||||||
profile.title: "Profile"
|
profile.title: "Profile"
|
||||||
tokens.title: "Tokens"
|
tokens.title: "Tokens"
|
||||||
|
|
||||||
|
@ -142,27 +143,26 @@ channel_info.h.clients: "Clients"
|
||||||
channel_info.send: "Send a message"
|
channel_info.send: "Send a message"
|
||||||
channel_info.send.message: "Message"
|
channel_info.send.message: "Message"
|
||||||
|
|
||||||
# channelgroups
|
|
||||||
channelgroups.delete: "Delete"
|
|
||||||
|
|
||||||
# channelgroup info
|
|
||||||
channelgroup_info.title: "Channelgroup"
|
|
||||||
channelgroup_info.h.clients: "Clients"
|
|
||||||
channelgroup_info.h.permissions: "Permissions"
|
|
||||||
channelgroup_info.remove: "Remove"
|
|
||||||
|
|
||||||
# groups
|
# groups
|
||||||
groups.delete: "Delete"
|
groups.delete: "Delete"
|
||||||
groups.h.servergroups: "Server Groups"
|
groups.h.servergroups: "Server Groups"
|
||||||
groups.h.channelgroups: "Channel Groups"
|
groups.h.channelgroups: "Channel Groups"
|
||||||
|
|
||||||
# group info
|
# channelgroups
|
||||||
group_info.h.clients_add: "Add"
|
channelgroups.delete: "Delete"
|
||||||
group_info.h.clients: "Clients"
|
|
||||||
group_info.h.permissions: "Permissions"
|
# channelgroup info
|
||||||
group_info.remove: "Remove"
|
channelgroup_info.h.clients: "Clients"
|
||||||
group_info.add: "Add a client"
|
channelgroup_info.h.permissions: "Permissions"
|
||||||
group_info.add.cldbid: "Client Database Id"
|
channelgroup_info.remove: "Remove"
|
||||||
|
|
||||||
|
# server group info
|
||||||
|
servergroup_info.h.clients_add: "Add"
|
||||||
|
servergroup_info.h.clients: "Clients"
|
||||||
|
servergroup_info.h.permissions: "Permissions"
|
||||||
|
servergroup_info.remove: "Remove"
|
||||||
|
servergroup_info.add: "Add a client"
|
||||||
|
servergroup_info.add.cldbid: "Client Database Id"
|
||||||
|
|
||||||
# clients
|
# clients
|
||||||
clients.delete: "Delete"
|
clients.delete: "Delete"
|
||||||
|
|
25
src/Control/Actions/ChannelGroupRenameAction.php
Normal file
25
src/Control/Actions/ChannelGroupRenameAction.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Slim\Http\Request;
|
||||||
|
use Slim\Http\Response;
|
||||||
|
|
||||||
|
final class ChannelGroupRenameAction extends AbstractAction
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
|
{
|
||||||
|
$sid = $args['sid'];
|
||||||
|
$cgid = $args['cgid'];
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$name = $body['name'];
|
||||||
|
|
||||||
|
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
|
||||||
|
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
|
||||||
|
|
||||||
|
$groupRenameResult = $this->ts->getInstance()->channelGroupRename($cgid, $name);
|
||||||
|
|
||||||
|
$this->flash->addMessage('success', $this->translator->trans('done'));
|
||||||
|
|
||||||
|
return $response->withRedirect('/groups/' . $sid);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Response;
|
use Slim\Http\Response;
|
||||||
|
|
||||||
final class GroupAddAction extends AbstractAction
|
final class ServerGroupAddAction extends AbstractAction
|
||||||
{
|
{
|
||||||
public function __invoke(Request $request, Response $response, $args)
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,6 @@ final class GroupAddAction extends AbstractAction
|
||||||
|
|
||||||
$this->flash->addMessage('success', $this->translator->trans('added'));
|
$this->flash->addMessage('success', $this->translator->trans('added'));
|
||||||
|
|
||||||
return $response->withRedirect('/groups/' . $sid . '/' . $sgid);
|
return $response->withRedirect('/servergroups/' . $sid . '/' . $sgid);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Response;
|
use Slim\Http\Response;
|
||||||
|
|
||||||
final class GroupDeleteAction extends AbstractAction
|
final class ServerGroupDeleteAction extends AbstractAction
|
||||||
{
|
{
|
||||||
public function __invoke(Request $request, Response $response, $args)
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
{
|
{
|
|
@ -3,7 +3,7 @@
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Response;
|
use Slim\Http\Response;
|
||||||
|
|
||||||
final class GroupInfoAction extends AbstractAction
|
final class ServerGroupInfoAction extends AbstractAction
|
||||||
{
|
{
|
||||||
public function __invoke(Request $request, Response $response, $args)
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,8 @@ final class GroupInfoAction extends AbstractAction
|
||||||
$permissionsResult = $this->ts->getInstance()->serverGroupPermList($sgid, true);
|
$permissionsResult = $this->ts->getInstance()->serverGroupPermList($sgid, true);
|
||||||
|
|
||||||
// render GET
|
// render GET
|
||||||
$this->view->render($response, 'group_info.twig', [
|
$this->view->render($response, 'servergroup_info.twig', [
|
||||||
'title' => $this->translator->trans('group_info.title') . ' ' . $sgid,
|
'title' => $this->translator->trans('servergroup_info.title') . ' ' . $sgid,
|
||||||
'clients' => $this->ts->getInstance()->getElement('data', $clientsResult),
|
'clients' => $this->ts->getInstance()->getElement('data', $clientsResult),
|
||||||
'permissions' => $this->ts->getInstance()->getElement('data', $permissionsResult),
|
'permissions' => $this->ts->getInstance()->getElement('data', $permissionsResult),
|
||||||
'sid' => $sid,
|
'sid' => $sid,
|
|
@ -3,7 +3,7 @@
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Response;
|
use Slim\Http\Response;
|
||||||
|
|
||||||
final class GroupRemoveAction extends AbstractAction
|
final class ServerGroupRemoveAction extends AbstractAction
|
||||||
{
|
{
|
||||||
public function __invoke(Request $request, Response $response, $args)
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,6 @@ final class GroupRemoveAction extends AbstractAction
|
||||||
|
|
||||||
$this->flash->addMessage('success', $this->translator->trans('removed'));
|
$this->flash->addMessage('success', $this->translator->trans('removed'));
|
||||||
|
|
||||||
return $response->withRedirect('/groups/' . $sid . '/' . $sgid);
|
return $response->withRedirect('/servergroups/' . $sid . '/' . $sgid);
|
||||||
}
|
}
|
||||||
}
|
}
|
25
src/Control/Actions/ServerGroupRenameAction.php
Normal file
25
src/Control/Actions/ServerGroupRenameAction.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Slim\Http\Request;
|
||||||
|
use Slim\Http\Response;
|
||||||
|
|
||||||
|
final class ServerGroupRenameAction extends AbstractAction
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request, Response $response, $args)
|
||||||
|
{
|
||||||
|
$sid = $args['sid'];
|
||||||
|
$sgid = $args['sgid'];
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$name = $body['name'];
|
||||||
|
|
||||||
|
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
|
||||||
|
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
|
||||||
|
|
||||||
|
$groupRenameResult = $this->ts->getInstance()->serverGroupRename($sgid, $name);
|
||||||
|
|
||||||
|
$this->flash->addMessage('success', $this->translator->trans('done'));
|
||||||
|
|
||||||
|
return $response->withRedirect('/groups/' . $sid);
|
||||||
|
}
|
||||||
|
}
|
47
src/View/material/form_inline.twig
Normal file
47
src/View/material/form_inline.twig
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{% set uri = editable.uri %}
|
||||||
|
|
||||||
|
{% if editable.uri_param is not empty %}
|
||||||
|
{% for searchingKey, searchingValue in arr %}
|
||||||
|
{% if searchingKey == editable.uri_param %}
|
||||||
|
{% set uri = uri ~ '/' ~ searchingValue %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<form class="form-inline" method="{{ editable.uri_method }}" action="{{ uri }}">
|
||||||
|
{% if editable.type == 'checkbox' %}
|
||||||
|
|
||||||
|
{% if item %}
|
||||||
|
<input type="hidden" name="{{ editable.key }}"
|
||||||
|
id="{{ editable.key }}" value="0"/>
|
||||||
|
<input type="checkbox" name="{{ editable.key }}"
|
||||||
|
id="{{ editable.key }}" value="1" checked/>
|
||||||
|
{% else %}
|
||||||
|
<input type="hidden" name="{{ editable.key }}"
|
||||||
|
id="{{ editable.key }}" value="0" />
|
||||||
|
<input type="checkbox" name="{{ editable.key }}"
|
||||||
|
id="{{ editable.key }}" value="1" />
|
||||||
|
{% endif %}
|
||||||
|
{% elseif editable.type == 'select' %}
|
||||||
|
<select class="form-control" name="{{ editable.key }}" id="{{ editable.key }}">
|
||||||
|
|
||||||
|
{% for k,v in editable.options %}
|
||||||
|
{% if v == item %}
|
||||||
|
<option class="form-control" value="{{ v }}" selected>{{ k }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option class="form-control" value="{{ v }}">{{ k }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
{% else %}
|
||||||
|
<input class="form-control" name="{{ editable.key }}" id="{{ editable.key }}" type="{{ editable.type }}"
|
||||||
|
{% if editable.blank is defined and editable.blank == true %}
|
||||||
|
{% else %}
|
||||||
|
value="{{ item }}"
|
||||||
|
{% endif %}
|
||||||
|
/>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<button class="btn btn-primary" id="{{ 'form_' ~ editable.key }}" type="submit">{{ editable.submit_label|raw }}</button>
|
||||||
|
</form>
|
|
@ -6,14 +6,25 @@
|
||||||
<h2 class="header">{% trans %}groups.h.servergroups{% endtrans %}</h2>
|
<h2 class="header">{% trans %}groups.h.servergroups{% endtrans %}</h2>
|
||||||
{% if serverGroups|length > 0 %}
|
{% if serverGroups|length > 0 %}
|
||||||
{% include 'table.twig' with {'data': serverGroups,
|
{% include 'table.twig' with {'data': serverGroups,
|
||||||
'links': [{'key': 'sgid', 'uri': '/groups/' ~ sid}],
|
'links': [{'key': 'sgid', 'uri': '/servergroups/' ~ sid}],
|
||||||
|
'hiddenColumns': ['savedb', 'sortid', 'namemode', 'n_modifyp', 'n_member_addp', 'n_member_removep'],
|
||||||
'additional_links': [
|
'additional_links': [
|
||||||
{
|
{
|
||||||
'header_label': 'groups.delete'|trans,
|
'header_label': 'groups.delete'|trans,
|
||||||
'label': '<i class="material-icons">delete</i>',
|
'label': '<i class="material-icons">delete</i>',
|
||||||
'uri': '/groups/delete/' ~ sid,
|
'uri': '/servergroups/delete/' ~ sid,
|
||||||
'uri_param': 'sgid'
|
'uri_param': 'sgid'
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
'attributesEditable': [
|
||||||
|
{
|
||||||
|
'key': 'name',
|
||||||
|
'type': 'text',
|
||||||
|
'uri': '/servergroups/rename/' ~ sid,
|
||||||
|
'uri_param': 'sgid',
|
||||||
|
'uri_method': 'post',
|
||||||
|
'submit_label': '<i class="material-icons">check_circle</i>'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
} %}
|
} %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -25,6 +36,7 @@
|
||||||
{% if channelGroups|length > 0 %}
|
{% if channelGroups|length > 0 %}
|
||||||
{% include 'table.twig' with {'data': channelGroups,
|
{% include 'table.twig' with {'data': channelGroups,
|
||||||
'links': [{'key': 'cgid', 'uri': '/channelgroups/' ~ sid}],
|
'links': [{'key': 'cgid', 'uri': '/channelgroups/' ~ sid}],
|
||||||
|
'hiddenColumns': ['savedb', 'sortid', 'namemode', 'n_modifyp', 'n_member_addp', 'n_member_removep'],
|
||||||
'additional_links': [
|
'additional_links': [
|
||||||
{
|
{
|
||||||
'header_label': 'channelgroups.delete'|trans,
|
'header_label': 'channelgroups.delete'|trans,
|
||||||
|
@ -32,6 +44,16 @@
|
||||||
'uri': '/channelgroups/delete/' ~ sid,
|
'uri': '/channelgroups/delete/' ~ sid,
|
||||||
'uri_param': 'cgid'
|
'uri_param': 'cgid'
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
'attributesEditable': [
|
||||||
|
{
|
||||||
|
'key': 'name',
|
||||||
|
'type': 'text',
|
||||||
|
'uri': '/channelgroups/rename/' ~ sid,
|
||||||
|
'uri_param': 'cgid',
|
||||||
|
'uri_method': 'post',
|
||||||
|
'submit_label': '<i class="material-icons">check_circle</i>'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
} %}
|
} %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -13,63 +13,27 @@
|
||||||
<td>{{ key|replace({'_' : ' '})|title }}</td>
|
<td>{{ key|replace({'_' : ' '})|title }}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
|
<!-- determine if cell should -->
|
||||||
{% set editable = null %}
|
{% set editable = null %}
|
||||||
|
|
||||||
{% for attr in attributesEditable %}
|
{% for attr in attributesEditable %}
|
||||||
{% if attr.key == key %}
|
{% if attr.key == key %}
|
||||||
{% set editable = attr %}
|
{% set editable = attr %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
<!-- apply filters to item -->
|
<!-- apply filters to item -->
|
||||||
{% set item = value %}
|
{% set item = value %}
|
||||||
|
|
||||||
{% for filter in filters %}
|
{% for filter in filters %}
|
||||||
{% if filter.key == key %}
|
{% if filter.key == key %}
|
||||||
{% set item = value|apply_filter(filter.apply)|raw %}
|
{% set item = value|apply_filter(filter.apply)|raw %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- cell is editable, generate a form -->
|
||||||
{% if editable is not empty %}
|
{% if editable is not empty %}
|
||||||
|
{% include 'form_inline.twig' with {'editable': editable} %}
|
||||||
|
|
||||||
<form class="form-inline" method="{{ editable.uri_method }}" action="{{ editable.uri }}">
|
<!-- cell is static or a link-->
|
||||||
{% if editable.type == 'checkbox' %}
|
|
||||||
|
|
||||||
{% if item %}
|
|
||||||
<input type="hidden" name="{{ editable.key }}"
|
|
||||||
id="{{ editable.key }}" value="0"/>
|
|
||||||
<input type="checkbox" name="{{ editable.key }}"
|
|
||||||
id="{{ editable.key }}" value="1" checked/>
|
|
||||||
{% else %}
|
|
||||||
<input type="hidden" name="{{ editable.key }}"
|
|
||||||
id="{{ editable.key }}" value="0" />
|
|
||||||
<input type="checkbox" name="{{ editable.key }}"
|
|
||||||
id="{{ editable.key }}" value="1" />
|
|
||||||
{% endif %}
|
|
||||||
{% elseif editable.type == 'select' %}
|
|
||||||
<select class="form-control" name="{{ editable.key }}" id="{{ editable.key }}">
|
|
||||||
|
|
||||||
{% for k,v in editable.options %}
|
|
||||||
{% if v == item %}
|
|
||||||
<option class="form-control" value="{{ v }}" selected>{{ k }}</option>
|
|
||||||
{% else %}
|
|
||||||
<option class="form-control" value="{{ v }}">{{ k }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
{% else %}
|
|
||||||
<input class="form-control" name="{{ editable.key }}" id="{{ editable.key }}" type="{{ editable.type }}"
|
|
||||||
{% if editable.blank is defined and editable.blank == true %}
|
|
||||||
{% else %}
|
|
||||||
value="{{ item }}"
|
|
||||||
{% endif %}
|
|
||||||
/>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<button class="btn btn-primary" id="{{ 'form_' ~ editable.key }}" type="submit">{{ editable.submit_label|raw }}</button>
|
|
||||||
</form>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ item }}
|
{{ item }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -3,32 +3,32 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="header">{{ title }}</h1>
|
<h1 class="header">{{ title }}</h1>
|
||||||
|
|
||||||
<h2 class="header">{% trans %}group_info.h.clients_add{% endtrans %}</h2>
|
<h2 class="header">{% trans %}servergroup_info.h.clients_add{% endtrans %}</h2>
|
||||||
{% include 'form.twig' with {
|
{% include 'form.twig' with {
|
||||||
'fields': [
|
'fields': [
|
||||||
{
|
{
|
||||||
'header_label': 'group_info.add'|trans,
|
'header_label': 'servergroup_info.add'|trans,
|
||||||
'label': '<i class="material-icons">check_circle</i>',
|
'label': '<i class="material-icons">check_circle</i>',
|
||||||
'uri': '/groups/add/' ~ sid ~ '/' ~ sgid,
|
'uri': '/servergroups/add/' ~ sid ~ '/' ~ sgid,
|
||||||
'uri_method': 'post',
|
'uri_method': 'post',
|
||||||
'fields': [
|
'fields': [
|
||||||
{'type': 'text', 'key': 'cldbid', 'label': 'group_info.add.cldbid'|trans},
|
{'type': 'text', 'key': 'cldbid', 'label': 'servergroup_info.add.cldbid'|trans},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% if clients|length > 0 %}
|
{% if clients|length > 0 %}
|
||||||
<h2 class="header">{% trans %}group_info.h.clients{% endtrans %}</h2>
|
<h2 class="header">{% trans %}servergroup_info.h.clients{% endtrans %}</h2>
|
||||||
{% include 'table.twig' with {'data': clients,
|
{% include 'table.twig' with {'data': clients,
|
||||||
'links': [
|
'links': [
|
||||||
{'key': 'cldbid', 'uri': '/clients/' ~ sid, 'uri_param': 'cldbid'}
|
{'key': 'cldbid', 'uri': '/clients/' ~ sid, 'uri_param': 'cldbid'}
|
||||||
],
|
],
|
||||||
'additional_links': [
|
'additional_links': [
|
||||||
{
|
{
|
||||||
'header_label': 'group_info.remove'|trans,
|
'header_label': 'servergroup_info.remove'|trans,
|
||||||
'label': '<i class="material-icons">delete</i>',
|
'label': '<i class="material-icons">delete</i>',
|
||||||
'uri': '/groups/remove/' ~ sid ~ '/' ~ sgid,
|
'uri': '/servergroups/remove/' ~ sid ~ '/' ~ sgid,
|
||||||
'uri_param': 'cldbid'
|
'uri_param': 'cldbid'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if permissions|length > 0 %}
|
{% if permissions|length > 0 %}
|
||||||
<h2 class="header">{% trans %}group_info.h.permissions{% endtrans %}</h2>
|
<h2 class="header">{% trans %}servergroup_info.h.permissions{% endtrans %}</h2>
|
||||||
{% include 'table.twig' with {'data': permissions} %}
|
{% include 'table.twig' with {'data': permissions} %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
<table class="table small sortable-bootstrap" data-sortable>
|
<table class="table small sortable-bootstrap" data-sortable>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<!-- determine if to hide entire column header -->
|
||||||
{% set added = [] %}
|
{% set added = [] %}
|
||||||
{% for arr in data %}
|
{% for arr in data %}
|
||||||
{% set added = arr|keys %}
|
{% set added = arr|keys %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- determine if column should be hidden -->
|
||||||
{% for key in added %}
|
{% for key in added %}
|
||||||
{% if key not in hiddenColumns %}
|
{% if key not in hiddenColumns %}
|
||||||
<th>{{ key|replace({'_' : ' '})|title }}</th>
|
<th>{{ key|replace({'_' : ' '})|title }}</th>
|
||||||
|
@ -22,8 +24,8 @@
|
||||||
|
|
||||||
{% for arr in data %}
|
{% for arr in data %}
|
||||||
|
|
||||||
|
<!-- determine if row should be hidden -->
|
||||||
{% set show = true %}
|
{% set show = true %}
|
||||||
|
|
||||||
{% for hidden in hiddenDependingOnAttribute %}
|
{% for hidden in hiddenDependingOnAttribute %}
|
||||||
{% if hidden.key in arr|keys and attribute(arr, hidden.key) in hidden.values %}
|
{% if hidden.key in arr|keys and attribute(arr, hidden.key) in hidden.values %}
|
||||||
{% set show = false %}
|
{% set show = false %}
|
||||||
|
@ -35,41 +37,58 @@
|
||||||
{% for key, value in arr %}
|
{% for key, value in arr %}
|
||||||
{% set value = value %}
|
{% set value = value %}
|
||||||
|
|
||||||
|
<!-- apply filters to item -->
|
||||||
{% for filter in filters %}
|
{% for filter in filters %}
|
||||||
{% if filter.key == key %}
|
{% if filter.key == key %}
|
||||||
{% set value = value|apply_filter(filter.apply)|raw %}
|
{% set value = value|apply_filter(filter.apply)|raw %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- determine if to hide entire column cell -->
|
||||||
{% set showColumn = true %}
|
{% set showColumn = true %}
|
||||||
|
|
||||||
{% if key in hiddenColumns %}
|
{% if key in hiddenColumns %}
|
||||||
{% set showColumn = false %}
|
{% set showColumn = false %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if showColumn %}
|
{% if showColumn %}
|
||||||
{% set item = '<td>' ~ value ~ '</td>' %}
|
<td>
|
||||||
|
{% set item = value %}
|
||||||
|
|
||||||
{% for link in links %}
|
<!-- determine if cell should -->
|
||||||
{% if link.key == key %}
|
{% set editable = null %}
|
||||||
{% if link.uri_param is not empty %}
|
{% for attr in attributesEditable %}
|
||||||
{% for searchingKey, searchingValue in arr %}
|
{% if attr.key == key %}
|
||||||
{% if searchingKey == link.uri_param %}
|
{% set editable = attr %}
|
||||||
{% set item = "<td><a href=\"#{link.uri}\/#{searchingValue}\">#{value}</a></td>" %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% set item = "<td><a href=\"#{link.uri}\/#{value}\">#{value}</a></td>" %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{{ item|raw }}
|
<!-- cell is editable, generate a form -->
|
||||||
|
{% if editable is not empty %}
|
||||||
|
{% include 'form_inline.twig' with {'editable': editable} %}
|
||||||
|
<!-- cell is static or a link-->
|
||||||
|
{% else %}
|
||||||
|
{% for link in links %}
|
||||||
|
{% if link.key == key %}
|
||||||
|
{% if link.uri_param is not empty %}
|
||||||
|
{% for searchingKey, searchingValue in arr %}
|
||||||
|
{% if searchingKey == link.uri_param %}
|
||||||
|
{% set item = "<a href=\"#{link.uri}\/#{searchingValue}\">#{value}</a>" %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% set item = "<a href=\"#{link.uri}\/#{value}\">#{value}</a>" %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{{ item|raw }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- generate additional columns as links, maybe apply filters -->
|
||||||
{% for link in additional_links %}
|
{% for link in additional_links %}
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{% set item = "<a href=\"#{link.uri}\">#{link.label}" %}
|
{% set item = "<a href=\"#{link.uri}\">#{link.label}" %}
|
||||||
|
|
||||||
|
|
Reference in a new issue