ver 0.262 - pages module refactor and admin UX fixes

This commit is contained in:
2026-02-13 21:17:21 +01:00
parent a1633491d5
commit b4559a5e74
44 changed files with 2235 additions and 1803 deletions

View File

@@ -85,7 +85,7 @@ class Site
(bool)\S::get('remember')
);
header('Location: /admin/articles/view_list/');
header('Location: /admin/articles/list/');
exit;
}
}
@@ -130,7 +130,7 @@ class Site
exit;
}
// 2FA OK finalna sesja
// 2FA OK - finalna sesja
$user = $users->details($pending['login']);
self::finalize_admin_login(
@@ -140,7 +140,7 @@ class Site
$pending['remember'] ? true : false
);
header('Location: /admin/articles/view_list/');
header('Location: /admin/articles/list/');
exit;
}
break;
@@ -208,7 +208,8 @@ class Site
return new \admin\Controllers\ArticlesController(
new \Domain\Article\ArticleRepository( $mdb ),
new \Domain\Languages\LanguagesRepository( $mdb ),
new \Domain\Layouts\LayoutsRepository( $mdb )
new \Domain\Layouts\LayoutsRepository( $mdb ),
new \Domain\Pages\PagesRepository( $mdb )
);
},
'ArticlesArchive' => function() {
@@ -241,7 +242,7 @@ class Site
new \Domain\Product\ProductRepository( $mdb )
);
},
// Alias dla starego modułu /admin/archive/products_list/
// Alias dla starego modułu /admin/archive/list/
'Archive' => function() {
global $mdb;
@@ -301,6 +302,15 @@ class Site
new \Domain\Languages\LanguagesRepository( $mdb )
);
},
'Pages' => function() {
global $mdb;
return new \admin\Controllers\PagesController(
new \Domain\Pages\PagesRepository( $mdb ),
new \Domain\Languages\LanguagesRepository( $mdb ),
new \Domain\Layouts\LayoutsRepository( $mdb )
);
},
];
return self::$newControllers;
@@ -324,40 +334,7 @@ class Site
return $factory();
}
/**
* Mapowanie nazw akcji: stara_nazwa => nowa_nazwa
* Potrzebne gdy stary routing używa innej konwencji nazw
*/
private static $actionMap = [
'gallery_order_save' => 'galleryOrderSave',
'files_order_save' => 'filesOrderSave',
'view_list' => 'list',
'article_edit' => 'edit',
'article_save' => 'save',
'article_delete' => 'delete',
'article_restore' => 'restore',
'article_image_alt_change' => 'imageAltChange',
'article_file_name_change' => 'fileNameChange',
'article_image_delete' => 'imageDelete',
'article_file_delete' => 'fileDelete',
'banner_edit' => 'edit',
'banner_save' => 'save',
'banner_delete' => 'delete',
'clear_cache' => 'clearCache',
'clear_cache_ajax' => 'clearCacheAjax',
'settings_save' => 'save',
'products_list' => 'list',
'unit_edit' => 'edit',
'unit_save' => 'save',
'unit_delete' => 'delete',
'layout_edit' => 'edit',
'layout_save' => 'save',
'layout_delete' => 'delete',
'container_edit' => 'edit',
'container_save' => 'save',
'container_delete' => 'delete',
];
public static function route()
{
$_SESSION['admin'] = true;
@@ -382,12 +359,9 @@ class Site
$controller = self::createController( $moduleName );
if ( $controller )
{
// Mapuj nazwę akcji (stara → nowa) lub użyj oryginalnej
$newAction = self::$actionMap[$action] ?? $action;
if ( method_exists( $controller, $newAction ) )
if ( method_exists( $controller, $action ) )
{
return $controller->$newAction();
return $controller->$action();
}
}
@@ -422,3 +396,4 @@ class Site
}
}
}