mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-17 20:58:43 +00:00
fix pagination and some media bugs
This commit is contained in:
parent
cf676b9fed
commit
5c2a348d5e
|
|
@ -660,7 +660,7 @@ final class ApiController extends Controller
|
||||||
$collection = new Collection();
|
$collection = new Collection();
|
||||||
$collection->setName((string) $account->getId());
|
$collection->setName((string) $account->getId());
|
||||||
$collection->setVirtualPath('/Accounts');
|
$collection->setVirtualPath('/Accounts');
|
||||||
$collection->setPath('/Accounts');
|
$collection->setPath('/Modules/Media/Files/Accounts/' . ((string) $account->getId()));
|
||||||
$collection->setCreatedBy(new NullAccount($request->getHeader()->getAccount()));
|
$collection->setCreatedBy(new NullAccount($request->getHeader()->getAccount()));
|
||||||
|
|
||||||
CollectionMapper::create($collection);
|
CollectionMapper::create($collection);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ use Modules\Admin\Models\GroupPermissionMapper;
|
||||||
use Modules\Admin\Models\LocalizationMapper;
|
use Modules\Admin\Models\LocalizationMapper;
|
||||||
use Modules\Admin\Models\NullAccountPermission;
|
use Modules\Admin\Models\NullAccountPermission;
|
||||||
use Modules\Admin\Models\NullGroupPermission;
|
use Modules\Admin\Models\NullGroupPermission;
|
||||||
|
use Modules\Auditor\Models\Audit;
|
||||||
|
use Modules\Auditor\Models\AuditMapper;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
|
@ -112,9 +113,9 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-list');
|
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-list');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
|
||||||
|
|
||||||
if ($request->getData('ptype') === '-') {
|
if ($request->getData('ptype') === 'p') {
|
||||||
$view->setData('accounts', AccountMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
$view->setData('accounts', AccountMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||||
} elseif ($request->getData('ptype') === '+') {
|
} elseif ($request->getData('ptype') === 'n') {
|
||||||
$view->setData('accounts', AccountMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
$view->setData('accounts', AccountMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||||
} else {
|
} else {
|
||||||
$view->setData('accounts', AccountMapper::getAfterPivot(0, null, 25));
|
$view->setData('accounts', AccountMapper::getAfterPivot(0, null, 25));
|
||||||
|
|
@ -154,6 +155,15 @@ final class BackendController extends Controller
|
||||||
$accGrpSelector = new \Modules\Admin\Theme\Backend\Components\GroupTagSelector\GroupTagSelectorView($this->app->l11nManager, $request, $response);
|
$accGrpSelector = new \Modules\Admin\Theme\Backend\Components\GroupTagSelector\GroupTagSelectorView($this->app->l11nManager, $request, $response);
|
||||||
$view->addData('grpSelector', $accGrpSelector);
|
$view->addData('grpSelector', $accGrpSelector);
|
||||||
|
|
||||||
|
// audit log
|
||||||
|
if ($request->getData('ptype') === 'p') {
|
||||||
|
$view->setData('auditlogs', AuditMapper::withConditional('createdBy', (int) $request->getData('id'), [Audit::class])::getBeforePivot((int) $request->getData('audit'), null, 25));
|
||||||
|
} elseif ($request->getData('ptype') === 'n') {
|
||||||
|
$view->setData('auditlogs', AuditMapper::withConditional('createdBy', (int) $request->getData('id'), [Audit::class])::getAfterPivot((int) $request->getData('audit'), null, 25));
|
||||||
|
} else {
|
||||||
|
$view->setData('auditlogs', AuditMapper::withConditional('createdBy', (int) $request->getData('id'), [Audit::class])::getAfterPivot(0, null, 25));
|
||||||
|
}
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,9 +204,9 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-list');
|
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-list');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
|
||||||
|
|
||||||
if ($request->getData('ptype') === '-') {
|
if ($request->getData('ptype') === 'p') {
|
||||||
$view->setData('groups', GroupMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
$view->setData('groups', GroupMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||||
} elseif ($request->getData('ptype') === '+') {
|
} elseif ($request->getData('ptype') === 'n') {
|
||||||
$view->setData('groups', GroupMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
$view->setData('groups', GroupMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||||
} else {
|
} else {
|
||||||
$view->setData('groups', GroupMapper::getAfterPivot(0, null, 25));
|
$view->setData('groups', GroupMapper::getAfterPivot(0, null, 25));
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use \phpOMS\Account\AccountStatus;
|
use phpOMS\Account\AccountStatus;
|
||||||
use phpOMS\Uri\UriFactory;
|
use phpOMS\Uri\UriFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -21,8 +21,8 @@ use phpOMS\Uri\UriFactory;
|
||||||
*/
|
*/
|
||||||
$accounts = $this->getData('accounts') ?? [];
|
$accounts = $this->getData('accounts') ?? [];
|
||||||
|
|
||||||
$previous = empty($accounts) ? '{/prefix}admin/account/list' : '{/prefix}admin/account/list?{?}&id=' . \reset($accounts)->getId() . '&ptype=-';
|
$previous = empty($accounts) ? '{/prefix}admin/account/list' : '{/prefix}admin/account/list?{?}&id=' . \reset($accounts)->getId() . '&ptype=p';
|
||||||
$next = empty($accounts) ? '{/prefix}admin/account/list' : '{/prefix}admin/account/list?{?}&id=' . \end($accounts)->getId() . '&ptype=+';
|
$next = empty($accounts) ? '{/prefix}admin/account/list' : '{/prefix}admin/account/list?{?}&id=' . \end($accounts)->getId() . '&ptype=n';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ use phpOMS\Account\AccountStatus;
|
||||||
use phpOMS\Account\AccountType;
|
use phpOMS\Account\AccountType;
|
||||||
use phpOMS\Account\PermissionOwner;
|
use phpOMS\Account\PermissionOwner;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
|
use phpOMS\Message\Http\HttpHeader;
|
||||||
use phpOMS\Uri\UriFactory;
|
use phpOMS\Uri\UriFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -38,9 +39,23 @@ use phpOMS\Uri\UriFactory;
|
||||||
*/
|
*/
|
||||||
$account = $this->getData('account');
|
$account = $this->getData('account');
|
||||||
$permissions = $this->getData('permissions');
|
$permissions = $this->getData('permissions');
|
||||||
|
$audits = $this->getData('auditlogs');
|
||||||
|
|
||||||
|
$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/account/settings?id={?id}#{\#}' : '{/prefix}admin/account/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
|
||||||
|
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/account/settings?id={?id}#{\#}' : '{/prefix}admin/account/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
|
<div class="tabview tab-2">
|
||||||
|
<div class="box wf-100 col-xs-12">
|
||||||
|
<ul class="tab-links">
|
||||||
|
<li><label for="c-tab-1"><?= $this->getHtml('General'); ?></label></li>
|
||||||
|
<li><label for="c-tab-2"><?= $this->getHtml('AuditLog'); ?></label></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tab-content">
|
||||||
|
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : '' ?>>
|
||||||
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-6">
|
||||||
<div class="portlet">
|
<div class="portlet">
|
||||||
|
|
@ -258,3 +273,62 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : '' ?>>
|
||||||
|
<div class="tab">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="portlet">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Audits', 'Auditor') ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||||
|
<table class="default fixed">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 100px">
|
||||||
|
<col style="width: 150px">
|
||||||
|
<col style="width: 75px">
|
||||||
|
<col style="width: 75px">
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
<col style="width: 125px">
|
||||||
|
<col style="width: 150px">
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||||
|
<td ><?= $this->getHtml('Module', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('Type', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('Subtype', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('Old', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('New', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('Content', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('By', 'Auditor') ?>
|
||||||
|
<td ><?= $this->getHtml('Date', 'Auditor') ?>
|
||||||
|
<tbody>
|
||||||
|
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
|
||||||
|
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
|
||||||
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
|
<td><?= $audit->getId(); ?>
|
||||||
|
<td><?= $this->printHtml($audit->getModule()); ?>
|
||||||
|
<td><?= $audit->getType(); ?>
|
||||||
|
<td><?= $audit->getSubtype(); ?>
|
||||||
|
<td><?= $this->printHtml($audit->getOld()); ?>
|
||||||
|
<td><?= $this->printHtml($audit->getNew()); ?>
|
||||||
|
<td><?= $this->printHtml($audit->getContent()); ?>
|
||||||
|
<td><?= $this->printHtml($audit->getCreatedBy()->getName()); ?>
|
||||||
|
<td><?= $audit->getCreatedAt()->format('Y-m-d H:i'); ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if ($count === 0) : ?>
|
||||||
|
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</table>
|
||||||
|
<div class="portlet-foot">
|
||||||
|
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||||
|
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
||||||
*/
|
*/
|
||||||
$groups = $this->getData('groups') ?? [];
|
$groups = $this->getData('groups') ?? [];
|
||||||
|
|
||||||
$previous = empty($groups) ? '{/prefix}admin/group/list' : '{/prefix}admin/group/list?{?}&id=' . \reset($groups)->getId() . '&ptype=-';
|
$previous = empty($groups) ? '{/prefix}admin/group/list' : '{/prefix}admin/group/list?{?}&id=' . \reset($groups)->getId() . '&ptype=p';
|
||||||
$next = empty($groups) ? '{/prefix}admin/group/list' : '{/prefix}admin/group/list?{?}&id=' . \end($groups)->getId() . '&ptype=+';
|
$next = empty($groups) ? '{/prefix}admin/group/list' : '{/prefix}admin/group/list?{?}&id=' . \end($groups)->getId() . '&ptype=n';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<input type="radio" id="c-tab-1" name="tabular-2" checked>
|
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : '' ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-6">
|
||||||
|
|
@ -246,7 +246,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="radio" id="c-tab-2" name="tabular-2">
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : '' ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<input type="radio" id="c-tab-1" name="tabular-2" checked>
|
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : '' ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-6">
|
||||||
|
|
@ -127,7 +127,7 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="radio" id="c-tab-2" name="tabular-2">
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : '' ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-4">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user