composer update
This commit is contained in:
parent
0b3c362c5e
commit
a1f0701630
142 changed files with 4530 additions and 1195 deletions
|
|
@ -5,101 +5,61 @@ use Kirby\Panel\UserTotpEnableDialog;
|
|||
$dialogs = require __DIR__ . '/../users/dialogs.php';
|
||||
|
||||
return [
|
||||
// change email
|
||||
'account.changeEmail' => [
|
||||
...$dialogs['user.changeEmail'],
|
||||
'pattern' => '(account)/changeEmail',
|
||||
'load' => $dialogs['user.changeEmail']['load'],
|
||||
'submit' => $dialogs['user.changeEmail']['submit'],
|
||||
],
|
||||
|
||||
// change language
|
||||
'account.changeLanguage' => [
|
||||
...$dialogs['user.changeLanguage'],
|
||||
'pattern' => '(account)/changeLanguage',
|
||||
'load' => $dialogs['user.changeLanguage']['load'],
|
||||
'submit' => $dialogs['user.changeLanguage']['submit'],
|
||||
],
|
||||
|
||||
// change name
|
||||
'account.changeName' => [
|
||||
...$dialogs['user.changeName'],
|
||||
'pattern' => '(account)/changeName',
|
||||
'load' => $dialogs['user.changeName']['load'],
|
||||
'submit' => $dialogs['user.changeName']['submit'],
|
||||
],
|
||||
|
||||
// change password
|
||||
'account.changePassword' => [
|
||||
...$dialogs['user.changePassword'],
|
||||
'pattern' => '(account)/changePassword',
|
||||
'load' => $dialogs['user.changePassword']['load'],
|
||||
'submit' => $dialogs['user.changePassword']['submit'],
|
||||
],
|
||||
|
||||
// change role
|
||||
'account.changeRole' => [
|
||||
...$dialogs['user.changeRole'],
|
||||
'pattern' => '(account)/changeRole',
|
||||
'load' => $dialogs['user.changeRole']['load'],
|
||||
'submit' => $dialogs['user.changeRole']['submit'],
|
||||
],
|
||||
|
||||
// delete
|
||||
'account.delete' => [
|
||||
...$dialogs['user.delete'],
|
||||
'pattern' => '(account)/delete',
|
||||
'load' => $dialogs['user.delete']['load'],
|
||||
'submit' => $dialogs['user.delete']['submit'],
|
||||
],
|
||||
|
||||
// account fields dialogs
|
||||
'account.fields' => [
|
||||
'pattern' => '(account)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $dialogs['user.fields']['load'],
|
||||
'submit' => $dialogs['user.fields']['submit']
|
||||
...$dialogs['user.fields'],
|
||||
'pattern' => '(account)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// change file name
|
||||
'account.file.changeName' => [
|
||||
...$dialogs['user.file.changeName'],
|
||||
'pattern' => '(account)/files/(:any)/changeName',
|
||||
'load' => $dialogs['user.file.changeName']['load'],
|
||||
'submit' => $dialogs['user.file.changeName']['submit'],
|
||||
],
|
||||
|
||||
// change file sort
|
||||
'account.file.changeSort' => [
|
||||
...$dialogs['user.file.changeSort'],
|
||||
'pattern' => '(account)/files/(:any)/changeSort',
|
||||
'load' => $dialogs['user.file.changeSort']['load'],
|
||||
'submit' => $dialogs['user.file.changeSort']['submit'],
|
||||
],
|
||||
|
||||
// change file template
|
||||
'account.file.changeTemplate' => [
|
||||
...$dialogs['user.file.changeTemplate'],
|
||||
'pattern' => '(account)/files/(:any)/changeTemplate',
|
||||
'load' => $dialogs['user.file.changeTemplate']['load'],
|
||||
'submit' => $dialogs['user.file.changeTemplate']['submit'],
|
||||
],
|
||||
|
||||
// delete
|
||||
'account.file.delete' => [
|
||||
...$dialogs['user.file.delete'],
|
||||
'pattern' => '(account)/files/(:any)/delete',
|
||||
'load' => $dialogs['user.file.delete']['load'],
|
||||
'submit' => $dialogs['user.file.delete']['submit'],
|
||||
],
|
||||
|
||||
// account file fields dialogs
|
||||
'account.file.fields' => [
|
||||
...$dialogs['user.file.fields'],
|
||||
'pattern' => '(account)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $dialogs['user.file.fields']['load'],
|
||||
'submit' => $dialogs['user.file.fields']['submit']
|
||||
],
|
||||
|
||||
// account enable TOTP
|
||||
'account.totp.enable' => [
|
||||
'pattern' => '(account)/totp/enable',
|
||||
'load' => fn () => (new UserTotpEnableDialog())->load(),
|
||||
'submit' => fn () => (new UserTotpEnableDialog())->submit()
|
||||
],
|
||||
|
||||
// account disable TOTP
|
||||
'account.totp.disable' => [
|
||||
'pattern' => '(account)/totp/disable',
|
||||
'load' => $dialogs['user.totp.disable']['load'],
|
||||
'submit' => $dialogs['user.totp.disable']['submit']
|
||||
...$dialogs['user.totp.disable'],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,17 +3,12 @@
|
|||
$drawers = require __DIR__ . '/../users/drawers.php';
|
||||
|
||||
return [
|
||||
// account fields drawers
|
||||
'account.fields' => [
|
||||
'pattern' => '(account)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $drawers['user.fields']['load'],
|
||||
'submit' => $drawers['user.fields']['submit']
|
||||
...$drawers['user.fields'],
|
||||
'pattern' => '(account)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// account file fields drawers
|
||||
'account.file.fields' => [
|
||||
...$drawers['user.file.fields'],
|
||||
'pattern' => '(account)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $drawers['user.file.fields']['load'],
|
||||
'submit' => $drawers['user.file.fields']['submit']
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@ $dropdowns = require __DIR__ . '/../users/dropdowns.php';
|
|||
|
||||
return [
|
||||
'account' => [
|
||||
...$dropdowns['user'],
|
||||
'pattern' => '(account)',
|
||||
'options' => $dropdowns['user']['options']
|
||||
],
|
||||
'account.languages' => [
|
||||
...$dropdowns['user.languages'],
|
||||
'pattern' => '(account)/languages',
|
||||
'options' => $dropdowns['user.languages']['options']
|
||||
],
|
||||
'account.file' => [
|
||||
...$dropdowns['user.file'],
|
||||
'pattern' => '(account)/files/(:any)',
|
||||
'options' => $dropdowns['user.file']['options']
|
||||
],
|
||||
'account.file.languages' => [
|
||||
...$dropdowns['user.file.languages'],
|
||||
'pattern' => '(account)/files/(:any)/languages',
|
||||
'options' => $files['language']
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ return [
|
|||
];
|
||||
}
|
||||
|
||||
$doc = Doc::factory($component);
|
||||
|
||||
return [
|
||||
'component' => 'k-lab-docs-drawer',
|
||||
'props' => [
|
||||
'icon' => 'book',
|
||||
'title' => $component,
|
||||
'docs' => Doc::factory($component)->toArray()
|
||||
'docs' => $doc->toArray()
|
||||
]
|
||||
];
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ $fields = require __DIR__ . '/../fields/dialogs.php';
|
|||
$files = require __DIR__ . '/../files/dialogs.php';
|
||||
|
||||
return [
|
||||
|
||||
// change page position
|
||||
'page.changeSort' => [
|
||||
'pattern' => 'pages/(:any)/changeSort',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -61,7 +59,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change page status
|
||||
'page.changeStatus' => [
|
||||
'pattern' => 'pages/(:any)/changeStatus',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -140,7 +137,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change template
|
||||
'page.changeTemplate' => [
|
||||
'pattern' => 'pages/(:any)/changeTemplate',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -187,7 +183,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change title
|
||||
'page.changeTitle' => [
|
||||
'pattern' => 'pages/(:any)/changeTitle',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -282,7 +277,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// create a new page
|
||||
'page.create' => [
|
||||
'pattern' => 'pages/create',
|
||||
'load' => function () {
|
||||
|
|
@ -293,6 +287,7 @@ return [
|
|||
slug: $request->get('slug'),
|
||||
template: $request->get('template'),
|
||||
title: $request->get('title'),
|
||||
uuid: $request->get('uuid'),
|
||||
viewId: $request->get('view'),
|
||||
);
|
||||
|
||||
|
|
@ -306,6 +301,7 @@ return [
|
|||
slug: $request->get('slug'),
|
||||
template: $request->get('template'),
|
||||
title: $request->get('title'),
|
||||
uuid: $request->get('uuid'),
|
||||
viewId: $request->get('view'),
|
||||
);
|
||||
|
||||
|
|
@ -313,7 +309,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// delete page
|
||||
'page.delete' => [
|
||||
'pattern' => 'pages/(:any)/delete',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -385,7 +380,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// duplicate page
|
||||
'page.duplicate' => [
|
||||
'pattern' => 'pages/(:any)/duplicate',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -474,49 +468,31 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// page field dialogs
|
||||
'page.fields' => [
|
||||
'pattern' => '(pages/.*?)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit']
|
||||
...$fields['model'],
|
||||
'pattern' => '(pages/[^/]+)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// change filename
|
||||
'page.file.changeName' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/changeName',
|
||||
'load' => $files['changeName']['load'],
|
||||
'submit' => $files['changeName']['submit'],
|
||||
...$files['changeName'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/changeName',
|
||||
],
|
||||
|
||||
// change sort
|
||||
'page.file.changeSort' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/changeSort',
|
||||
'load' => $files['changeSort']['load'],
|
||||
'submit' => $files['changeSort']['submit'],
|
||||
...$files['changeSort'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/changeSort',
|
||||
],
|
||||
|
||||
// change template
|
||||
'page.file.changeTemplate' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/changeTemplate',
|
||||
'load' => $files['changeTemplate']['load'],
|
||||
'submit' => $files['changeTemplate']['submit'],
|
||||
...$files['changeTemplate'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/changeTemplate',
|
||||
],
|
||||
|
||||
// delete
|
||||
'page.file.delete' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/delete',
|
||||
'load' => $files['delete']['load'],
|
||||
'submit' => $files['delete']['submit'],
|
||||
...$files['delete'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/delete',
|
||||
],
|
||||
|
||||
// page file field dialogs
|
||||
'page.file.fields' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit'],
|
||||
...$fields['file'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// move page
|
||||
'page.move' => [
|
||||
'pattern' => 'pages/(:any)/move',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -553,7 +529,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change site title
|
||||
'site.changeTitle' => [
|
||||
'pattern' => 'site/changeTitle',
|
||||
'load' => function () {
|
||||
|
|
@ -583,49 +558,31 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// site field dialogs
|
||||
'site.fields' => [
|
||||
...$fields['model'],
|
||||
'pattern' => '(site)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit'],
|
||||
],
|
||||
|
||||
// change filename
|
||||
'site.file.changeName' => [
|
||||
...$files['changeName'],
|
||||
'pattern' => '(site)/files/(:any)/changeName',
|
||||
'load' => $files['changeName']['load'],
|
||||
'submit' => $files['changeName']['submit'],
|
||||
],
|
||||
|
||||
// change sort
|
||||
'site.file.changeSort' => [
|
||||
...$files['changeSort'],
|
||||
'pattern' => '(site)/files/(:any)/changeSort',
|
||||
'load' => $files['changeSort']['load'],
|
||||
'submit' => $files['changeSort']['submit'],
|
||||
],
|
||||
|
||||
// change template
|
||||
'site.file.changeTemplate' => [
|
||||
...$files['changeTemplate'],
|
||||
'pattern' => '(site)/files/(:any)/changeTemplate',
|
||||
'load' => $files['changeTemplate']['load'],
|
||||
'submit' => $files['changeTemplate']['submit'],
|
||||
],
|
||||
|
||||
// delete
|
||||
'site.file.delete' => [
|
||||
...$files['delete'],
|
||||
'pattern' => '(site)/files/(:any)/delete',
|
||||
'load' => $files['delete']['load'],
|
||||
'submit' => $files['delete']['submit'],
|
||||
],
|
||||
|
||||
// site file field dialogs
|
||||
'site.file.fields' => [
|
||||
...$fields['file'],
|
||||
'pattern' => '(site)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit'],
|
||||
],
|
||||
|
||||
// content changes
|
||||
'changes' => [
|
||||
'pattern' => 'changes',
|
||||
'load' => function () {
|
||||
|
|
|
|||
|
|
@ -3,31 +3,20 @@
|
|||
$fields = require __DIR__ . '/../fields/drawers.php';
|
||||
|
||||
return [
|
||||
// page field drawers
|
||||
'page.fields' => [
|
||||
'pattern' => '(pages/.*?)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit']
|
||||
...$fields['model'],
|
||||
'pattern' => '(pages/[^/]+)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// page file field drawers
|
||||
'page.file.fields' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit'],
|
||||
...$fields['file'],
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// site field drawers
|
||||
'site.fields' => [
|
||||
...$fields['model'],
|
||||
'pattern' => '(site)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit'],
|
||||
],
|
||||
|
||||
// site file field drawers
|
||||
'site.file.fields' => [
|
||||
...$fields['file'],
|
||||
'pattern' => '(site)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit'],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ return [
|
|||
}
|
||||
],
|
||||
'page.file' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)',
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)',
|
||||
'options' => $files['file']
|
||||
],
|
||||
'page.file.languages' => [
|
||||
'pattern' => '(pages/.*?)/files/(:any)/languages',
|
||||
'pattern' => '(pages/[^/]+)/files/(:any)/languages',
|
||||
'options' => $files['language']
|
||||
],
|
||||
'site.languages' => [
|
||||
|
|
|
|||
|
|
@ -57,6 +57,28 @@ return [
|
|||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
],
|
||||
'license/remove' => [
|
||||
'load' => function () {
|
||||
return [
|
||||
'component' => 'k-remove-dialog',
|
||||
'props' => [
|
||||
'text' => I18n::translate('license.remove.text'),
|
||||
'size' => 'medium',
|
||||
'submitButton' => [
|
||||
'icon' => 'trash',
|
||||
'text' => I18n::translate('remove'),
|
||||
'theme' => 'negative',
|
||||
],
|
||||
]
|
||||
];
|
||||
},
|
||||
'submit' => function () {
|
||||
// @codeCoverageIgnoreStart
|
||||
App::instance()->system()->license()->delete();
|
||||
return true;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
],
|
||||
// license registration
|
||||
'registration' => [
|
||||
'load' => function () {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ $fields = require __DIR__ . '/../fields/dialogs.php';
|
|||
$files = require __DIR__ . '/../files/dialogs.php';
|
||||
|
||||
return [
|
||||
|
||||
// create
|
||||
'user.create' => [
|
||||
'pattern' => 'users/create',
|
||||
'load' => function () {
|
||||
|
|
@ -79,7 +77,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change email
|
||||
'user.changeEmail' => [
|
||||
'pattern' => 'users/(:any)/changeEmail',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -114,7 +111,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change language
|
||||
'user.changeLanguage' => [
|
||||
'pattern' => 'users/(:any)/changeLanguage',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -147,7 +143,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change name
|
||||
'user.changeName' => [
|
||||
'pattern' => 'users/(:any)/changeName',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -179,7 +174,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change password
|
||||
'user.changePassword' => [
|
||||
'pattern' => 'users/(:any)/changePassword',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -245,7 +239,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// change role
|
||||
'user.changeRole' => [
|
||||
'pattern' => 'users/(:any)/changeRole',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -282,7 +275,6 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// delete
|
||||
'user.delete' => [
|
||||
'pattern' => 'users/(:any)/delete',
|
||||
'load' => function (string $id) {
|
||||
|
|
@ -324,49 +316,36 @@ return [
|
|||
}
|
||||
],
|
||||
|
||||
// user field dialogs
|
||||
'user.fields' => [
|
||||
'pattern' => '(users/.*?)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit']
|
||||
...$fields['model'],
|
||||
'pattern' => '(users/[^/]+)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// change file name
|
||||
'user.file.changeName' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/changeName',
|
||||
'load' => $files['changeName']['load'],
|
||||
'submit' => $files['changeName']['submit'],
|
||||
...$files['changeName'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/changeName',
|
||||
],
|
||||
|
||||
// change file sort
|
||||
'user.file.changeSort' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/changeSort',
|
||||
'load' => $files['changeSort']['load'],
|
||||
'submit' => $files['changeSort']['submit'],
|
||||
...$files['changeSort'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/changeSort',
|
||||
],
|
||||
|
||||
// change file template
|
||||
'user.file.changeTemplate' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/changeTemplate',
|
||||
'load' => $files['changeTemplate']['load'],
|
||||
'submit' => $files['changeTemplate']['submit'],
|
||||
...$files['changeTemplate'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/changeTemplate',
|
||||
],
|
||||
|
||||
// delete file
|
||||
'user.file.delete' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/delete',
|
||||
'load' => $files['delete']['load'],
|
||||
'submit' => $files['delete']['submit'],
|
||||
...$files['delete'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/delete',
|
||||
],
|
||||
|
||||
// user file fields dialogs
|
||||
'user.file.fields' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit']
|
||||
...$fields['file'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/fields/(:any)/(:all?)',
|
||||
],
|
||||
|
||||
// user disable TOTP
|
||||
'user.totp.disable' => [
|
||||
'pattern' => 'users/(:any)/totp/disable',
|
||||
'load' => fn (string $id) => (new UserTotpDisableDialog($id))->load(),
|
||||
|
|
|
|||
|
|
@ -3,16 +3,12 @@
|
|||
$fields = require __DIR__ . '/../fields/drawers.php';
|
||||
|
||||
return [
|
||||
// user field drawers
|
||||
'user.fields' => [
|
||||
'pattern' => '(users/.*?)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['model']['load'],
|
||||
'submit' => $fields['model']['submit']
|
||||
...$fields['model'],
|
||||
'pattern' => '(users/[^/]+)/fields/(:any)/(:all?)',
|
||||
],
|
||||
// user file fields drawers
|
||||
'user.file.fields' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/fields/(:any)/(:all?)',
|
||||
'load' => $fields['file']['load'],
|
||||
'submit' => $fields['file']['submit']
|
||||
...$fields['file'],
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/fields/(:any)/(:all?)',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ return [
|
|||
}
|
||||
],
|
||||
'user.file' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)',
|
||||
'pattern' => '(users/[^/]+)/files/(:any)',
|
||||
'options' => $files['file']
|
||||
],
|
||||
'user.file.languages' => [
|
||||
'pattern' => '(users/.*?)/files/(:any)/languages',
|
||||
'pattern' => '(users/[^/]+)/files/(:any)/languages',
|
||||
'options' => $files['language']
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Cms\Find;
|
||||
use Kirby\Panel\Collector\UsersCollector;
|
||||
use Kirby\Panel\Ui\Buttons\ViewButtons;
|
||||
use Kirby\Toolkit\Escape;
|
||||
use Kirby\Panel\Ui\Item\UserItem;
|
||||
|
||||
return [
|
||||
'users' => [
|
||||
|
|
@ -31,29 +32,17 @@ return [
|
|||
},
|
||||
'roles' => array_values($roles),
|
||||
'users' => function () use ($kirby, $role) {
|
||||
$users = $kirby->users();
|
||||
$collector = new UsersCollector(
|
||||
limit: 20,
|
||||
page: $kirby->request()->get('page', 1),
|
||||
role: $role,
|
||||
sortBy: 'username asc',
|
||||
);
|
||||
|
||||
if (empty($role) === false) {
|
||||
$users = $users->role($role);
|
||||
}
|
||||
|
||||
// sort users alphabetically
|
||||
$users = $users->sortBy('username', 'asc');
|
||||
|
||||
// paginate
|
||||
$users = $users->paginate([
|
||||
'limit' => 20,
|
||||
'page' => $kirby->request()->get('page')
|
||||
]);
|
||||
$users = $collector->models(paginated: true);
|
||||
|
||||
return [
|
||||
'data' => $users->values(fn ($user) => [
|
||||
'id' => $user->id(),
|
||||
'image' => $user->panel()->image(),
|
||||
'info' => Escape::html($user->role()->title()),
|
||||
'link' => $user->panel()->url(true),
|
||||
'text' => Escape::html($user->username())
|
||||
]),
|
||||
'data' => $users->values(fn ($user) => (new UserItem(user: $user))->props()),
|
||||
'pagination' => $users->pagination()->toArray()
|
||||
];
|
||||
},
|
||||
|
|
|
|||
|
|
@ -421,10 +421,7 @@ return [
|
|||
// support UUIDs
|
||||
if (
|
||||
$path !== null &&
|
||||
(
|
||||
Uuid::is($path, 'page') === true ||
|
||||
Uuid::is($path, 'file') === true
|
||||
)
|
||||
Uuid::is($path, ['page', 'file']) === true
|
||||
) {
|
||||
$model = Uuid::for($path)->model();
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ return [
|
|||
return [];
|
||||
}
|
||||
|
||||
return $this->form()->fields()->toArray();
|
||||
return $this->form()->fields()->toProps();
|
||||
},
|
||||
'value' => function () {
|
||||
$data = Data::decode($this->value, 'yaml');
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@ return [
|
|||
'icon' => null,
|
||||
'placeholder' => null,
|
||||
|
||||
/**
|
||||
* Whether to enable batch editing
|
||||
*/
|
||||
'batch' => function (bool $batch = false) {
|
||||
return $batch;
|
||||
},
|
||||
|
||||
/**
|
||||
* Optional columns definition to only show selected fields in the structure table.
|
||||
*/
|
||||
|
|
@ -105,7 +112,7 @@ return [
|
|||
return [];
|
||||
}
|
||||
|
||||
return $this->form()->fields()->toArray();
|
||||
return $this->form()->fields()->toProps();
|
||||
},
|
||||
'columns' => function () {
|
||||
$columns = [];
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ return [
|
|||
$users = [];
|
||||
$kirby = App::instance();
|
||||
|
||||
foreach (Data::decode($value, 'yaml') as $email) {
|
||||
if (is_array($email) === true) {
|
||||
$email = $email['email'] ?? null;
|
||||
foreach (Data::decode($value, 'yaml') as $id) {
|
||||
if (is_array($id) === true) {
|
||||
$id = $id['uuid'] ?? $id['id'] ?? $id['email'] ?? null;
|
||||
}
|
||||
|
||||
if ($email !== null && ($user = $kirby->user($email))) {
|
||||
if ($id !== null && ($user = $kirby->user($id))) {
|
||||
$users[] = $this->userResponse($user);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Cms\Files;
|
||||
use Kirby\Panel\Collector\FilesCollector;
|
||||
use Kirby\Panel\Ui\Item\FileItem;
|
||||
use Kirby\Panel\Ui\Upload;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
|
|
@ -56,86 +58,40 @@ return [
|
|||
'parent' => function () {
|
||||
return $this->parentModel();
|
||||
},
|
||||
'collector' => function () {
|
||||
return $this->collector ??= new FilesCollector(
|
||||
flip: $this->flip(),
|
||||
limit: $this->limit(),
|
||||
page: $this->page() ?? 1,
|
||||
parent: $this->parent(),
|
||||
query: $this->query(),
|
||||
search: $this->searchterm(),
|
||||
sortBy: $this->sortBy(),
|
||||
template: $this->template(),
|
||||
);
|
||||
},
|
||||
'models' => function () {
|
||||
if ($this->query !== null) {
|
||||
$files = $this->parent->query($this->query, Files::class) ?? new Files([]);
|
||||
} else {
|
||||
$files = $this->parent->files();
|
||||
}
|
||||
|
||||
// filter files by template
|
||||
$files = $files->template($this->template);
|
||||
|
||||
// filter out all protected and hidden files
|
||||
$files = $files->filter('isListable', true);
|
||||
|
||||
// search
|
||||
if ($this->search === true && empty($this->searchterm()) === false) {
|
||||
$files = $files->search($this->searchterm());
|
||||
|
||||
// disable flip and sortBy while searching
|
||||
// to show most relevant results
|
||||
$this->flip = false;
|
||||
$this->sortBy = null;
|
||||
}
|
||||
|
||||
// sort
|
||||
if ($this->sortBy) {
|
||||
$files = $files->sort(...$files::sortArgs($this->sortBy));
|
||||
} else {
|
||||
$files = $files->sorted();
|
||||
}
|
||||
|
||||
// flip
|
||||
if ($this->flip === true) {
|
||||
$files = $files->flip();
|
||||
}
|
||||
|
||||
return $files;
|
||||
return $this->collector()->models();
|
||||
},
|
||||
'modelsPaginated' => function () {
|
||||
// apply the default pagination
|
||||
return $this->models()->paginate([
|
||||
'page' => $this->page,
|
||||
'limit' => $this->limit,
|
||||
'method' => 'none' // the page is manually provided
|
||||
]);
|
||||
return $this->collector()->models(paginated: true);
|
||||
},
|
||||
'files' => function () {
|
||||
return $this->models;
|
||||
},
|
||||
'data' => function () {
|
||||
$data = [];
|
||||
$data = [];
|
||||
$dragTextIsAbsolute = $this->model->is($this->parent) === false;
|
||||
|
||||
foreach ($this->modelsPaginated() as $file) {
|
||||
$panel = $file->panel();
|
||||
$permissions = $file->permissions();
|
||||
|
||||
$item = [
|
||||
'dragText' => $panel->dragText(
|
||||
// the drag text needs to be absolute
|
||||
// when the files come from a different parent model
|
||||
absolute: $this->model->is($this->parent) === false
|
||||
),
|
||||
'extension' => $file->extension(),
|
||||
'filename' => $file->filename(),
|
||||
'id' => $file->id(),
|
||||
'image' => $panel->image(
|
||||
$this->image,
|
||||
$this->layout === 'table' ? 'list' : $this->layout
|
||||
),
|
||||
'info' => $file->toSafeString($this->info ?? false),
|
||||
'link' => $panel->url(true),
|
||||
'mime' => $file->mime(),
|
||||
'parent' => $file->parent()->panel()->path(),
|
||||
'permissions' => [
|
||||
'delete' => $permissions->can('delete'),
|
||||
'sort' => $permissions->can('sort'),
|
||||
],
|
||||
'template' => $file->template(),
|
||||
'text' => $file->toSafeString($this->text),
|
||||
'url' => $file->url(),
|
||||
];
|
||||
$item = (new FileItem(
|
||||
file: $file,
|
||||
dragTextIsAbsolute: $dragTextIsAbsolute,
|
||||
image: $this->image,
|
||||
layout: $this->layout,
|
||||
info: $this->info,
|
||||
text: $this->text,
|
||||
))->props();
|
||||
|
||||
if ($this->layout === 'table') {
|
||||
$item = $this->columnsValues($item, $file);
|
||||
|
|
@ -185,26 +141,16 @@ return [
|
|||
return false;
|
||||
}
|
||||
|
||||
// count all uploaded files
|
||||
$max = $this->max ? $this->max - $this->total : null;
|
||||
$multiple = !$max || $max > 1;
|
||||
$template = $this->template === 'default' ? null : $this->template;
|
||||
$settings = new Upload(
|
||||
api: $this->parent->apiUrl(true) . '/files',
|
||||
accept: $this->accept,
|
||||
max: $this->max ? $this->max - $this->total : null,
|
||||
preview: $this->image,
|
||||
sort: $this->sortable === true ? $this->total + 1 : null,
|
||||
template: $this->template,
|
||||
);
|
||||
|
||||
return [
|
||||
'accept' => $this->accept,
|
||||
'multiple' => $multiple,
|
||||
'max' => $max,
|
||||
'api' => $this->parent->apiUrl(true) . '/files',
|
||||
'preview' => $this->image,
|
||||
'attributes' => [
|
||||
// TODO: an edge issue that needs to be solved:
|
||||
// if multiple users load the same section
|
||||
// at the same time and upload a file,
|
||||
// uploaded files have the same sort number
|
||||
'sort' => $this->sortable === true ? $this->total + 1 : null,
|
||||
'template' => $template
|
||||
]
|
||||
];
|
||||
return $settings->props();
|
||||
}
|
||||
],
|
||||
// @codeCoverageIgnoreStart
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@ return [
|
|||
],
|
||||
'methods' => [
|
||||
'searchterm' => function (): string|null {
|
||||
return App::instance()->request()->get('searchterm');
|
||||
if ($this->search() === true) {
|
||||
return App::instance()->request()->get('searchterm') ?? null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ use Kirby\Cms\Page;
|
|||
use Kirby\Cms\Pages;
|
||||
use Kirby\Cms\Site;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Panel\Collector\PagesCollector;
|
||||
use Kirby\Panel\Ui\Item\PageItem;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
|
|
@ -85,83 +87,28 @@ return [
|
|||
|
||||
return $parent;
|
||||
},
|
||||
'collector' => function () {
|
||||
return $this->collector ??= new PagesCollector(
|
||||
limit: $this->limit(),
|
||||
page: $this->page() ?? 1,
|
||||
parent: $this->parent(),
|
||||
query: $this->query(),
|
||||
status: $this->status(),
|
||||
templates: $this->templates(),
|
||||
templatesIgnore: $this->templatesIgnore(),
|
||||
search: $this->searchterm(),
|
||||
sortBy: $this->sortBy(),
|
||||
flip: $this->flip()
|
||||
);
|
||||
},
|
||||
'models' => function () {
|
||||
if ($this->query !== null) {
|
||||
$pages = $this->parent->query($this->query, Pages::class) ?? new Pages([]);
|
||||
} else {
|
||||
$pages = match ($this->status) {
|
||||
'draft' => $this->parent->drafts(),
|
||||
'listed' => $this->parent->children()->listed(),
|
||||
'published' => $this->parent->children(),
|
||||
'unlisted' => $this->parent->children()->unlisted(),
|
||||
default => $this->parent->childrenAndDrafts()
|
||||
};
|
||||
}
|
||||
|
||||
// filters pages that are protected and not in the templates list
|
||||
// internal `filter()` method used instead of foreach loop that previously included `unset()`
|
||||
// because `unset()` is updating the original data, `filter()` is just filtering
|
||||
// also it has been tested that there is no performance difference
|
||||
// even in 0.1 seconds on 100k virtual pages
|
||||
$pages = $pages->filter(function ($page) {
|
||||
// remove all protected and hidden pages
|
||||
if ($page->isListable() === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$intendedTemplate = $page->intendedTemplate()->name();
|
||||
|
||||
// filter by all set templates
|
||||
if (
|
||||
$this->templates &&
|
||||
in_array($intendedTemplate, $this->templates, true) === false
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// exclude by all ignored templates
|
||||
if (
|
||||
$this->templatesIgnore &&
|
||||
in_array($intendedTemplate, $this->templatesIgnore, true) === true
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// search
|
||||
if ($this->search === true && empty($this->searchterm()) === false) {
|
||||
$pages = $pages->search($this->searchterm());
|
||||
|
||||
// disable flip and sortBy while searching
|
||||
// to show most relevant results
|
||||
$this->flip = false;
|
||||
$this->sortBy = null;
|
||||
}
|
||||
|
||||
// sort
|
||||
if ($this->sortBy) {
|
||||
$pages = $pages->sort(...$pages::sortArgs($this->sortBy));
|
||||
}
|
||||
|
||||
// flip
|
||||
if ($this->flip === true) {
|
||||
$pages = $pages->flip();
|
||||
}
|
||||
|
||||
return $pages;
|
||||
return $this->collector()->models();
|
||||
},
|
||||
'modelsPaginated' => function () {
|
||||
// pagination
|
||||
return $this->models()->paginate([
|
||||
'page' => $this->page,
|
||||
'limit' => $this->limit,
|
||||
'method' => 'none' // the page is manually provided
|
||||
]);
|
||||
return $this->collector()->models(paginated: true);
|
||||
},
|
||||
'pages' => function () {
|
||||
return $this->models;
|
||||
return $this->models();
|
||||
},
|
||||
'total' => function () {
|
||||
return $this->models()->count();
|
||||
|
|
@ -170,30 +117,13 @@ return [
|
|||
$data = [];
|
||||
|
||||
foreach ($this->modelsPaginated() as $page) {
|
||||
$panel = $page->panel();
|
||||
$permissions = $page->permissions();
|
||||
|
||||
$item = [
|
||||
'dragText' => $panel->dragText(),
|
||||
'id' => $page->id(),
|
||||
'image' => $panel->image(
|
||||
$this->image,
|
||||
$this->layout === 'table' ? 'list' : $this->layout
|
||||
),
|
||||
'info' => $page->toSafeString($this->info ?? false),
|
||||
'link' => $panel->url(true),
|
||||
'parent' => $page->parentId(),
|
||||
'permissions' => [
|
||||
'delete' => $permissions->can('delete'),
|
||||
'changeSlug' => $permissions->can('changeSlug'),
|
||||
'changeStatus' => $permissions->can('changeStatus'),
|
||||
'changeTitle' => $permissions->can('changeTitle'),
|
||||
'sort' => $permissions->can('sort'),
|
||||
],
|
||||
'status' => $page->status(),
|
||||
'template' => $page->intendedTemplate()->name(),
|
||||
'text' => $page->toSafeString($this->text),
|
||||
];
|
||||
$item = (new PageItem(
|
||||
page: $page,
|
||||
image: $this->image,
|
||||
layout: $this->layout,
|
||||
info: $this->info,
|
||||
text: $this->text,
|
||||
))->props();
|
||||
|
||||
if ($this->layout === 'table') {
|
||||
$item = $this->columnsValues($item, $page);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Panel\Ui\Stats;
|
||||
|
||||
return [
|
||||
'mixins' => [
|
||||
|
|
@ -10,20 +10,8 @@ return [
|
|||
/**
|
||||
* Array or query string for reports. Each report needs a `label` and `value` and can have additional `info`, `link`, `icon` and `theme` settings.
|
||||
*/
|
||||
'reports' => function ($reports = null) {
|
||||
if ($reports === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (is_string($reports) === true) {
|
||||
$reports = $this->model()->query($reports);
|
||||
}
|
||||
|
||||
if (is_array($reports) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $reports;
|
||||
'reports' => function (array|string|null $reports = null) {
|
||||
return $reports ?? [];
|
||||
},
|
||||
/**
|
||||
* The size of the report cards. Available sizes: `tiny`, `small`, `medium`, `large`
|
||||
|
|
@ -33,36 +21,18 @@ return [
|
|||
}
|
||||
],
|
||||
'computed' => [
|
||||
'reports' => function () {
|
||||
$reports = [];
|
||||
$model = $this->model();
|
||||
$toString = fn ($value) => $value === null ? null : $model->toString($value);
|
||||
|
||||
foreach ($this->reports as $report) {
|
||||
if (is_string($report) === true) {
|
||||
$report = $model->query($report);
|
||||
}
|
||||
|
||||
if (is_array($report) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$info = $report['info'] ?? null;
|
||||
$label = $report['label'] ?? null;
|
||||
$link = $report['link'] ?? null;
|
||||
$value = $report['value'] ?? null;
|
||||
|
||||
$reports[] = [
|
||||
'icon' => $toString($report['icon'] ?? null),
|
||||
'info' => $toString(I18n::translate($info, $info)),
|
||||
'label' => $toString(I18n::translate($label, $label)),
|
||||
'link' => $toString(I18n::translate($link, $link)),
|
||||
'theme' => $toString($report['theme'] ?? null),
|
||||
'value' => $toString(I18n::translate($value, $value))
|
||||
];
|
||||
}
|
||||
|
||||
return $reports;
|
||||
'stats' => function (): Stats {
|
||||
return $this->stats ??= Stats::from(
|
||||
model: $this->model(),
|
||||
reports: $this->reports(),
|
||||
size: $this->size()
|
||||
);
|
||||
},
|
||||
'reports' => function (): array {
|
||||
return $this->stats->reports();
|
||||
},
|
||||
'size' => function (): string {
|
||||
return $this->stats->size();
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -206,11 +206,8 @@ return [
|
|||
|
||||
// if value is a UUID, resolve to page/file model
|
||||
// and use the URL as value
|
||||
if (
|
||||
Uuid::is($tag->value, 'page') === true ||
|
||||
Uuid::is($tag->value, 'file') === true
|
||||
) {
|
||||
$tag->value = Uuid::for($tag->value)->model()?->url();
|
||||
if (Uuid::is($tag->value, ['page', 'file']) === true) {
|
||||
$tag->value = Uuid::for($tag->value)?->toUrl();
|
||||
}
|
||||
|
||||
// if url is empty, throw exception or link to the error page
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue