diff --git a/composer.json b/composer.json index 8879192..58f069d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "oneplace/oneplace-core", "description": "onePlace Core Application", "type": "project", - "version": "1.0.19", + "version": "1.0.20", "license": "BSD-3-Clause", "keywords": [ "laminas", @@ -31,7 +31,7 @@ "laminas/laminas-session": "^2.9.1", "laminas/laminas-paginator": "^2.8", "laminas/laminas-mail": "^2.10", - "oneplace/oneplace-user": "^1.0.12" + "oneplace/oneplace-user": "^1.0.13" }, "autoload": { "psr-4": { diff --git a/module/Application/data/data.sql b/module/Application/data/data.sql index 0e0c473..9580413 100644 --- a/module/Application/data/data.sql +++ b/module/Application/data/data.sql @@ -11,19 +11,18 @@ INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES ('noreply-pw', 'EMAILACCOUNTPASS'), ('noreply-server', 'SMTPHOSTNAME'); -INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav_href`, `show_in_menu`) VALUES -('index', 'Application\\Controller\\IndexController', 'Home', 'Home', '/', 0), -('update', 'Application\\Controller\\IndexController', 'Updates', '', '', 0), -('addtheme', 'Application\\Controller\\UploadController', 'Upload Theme', '', '/application/addtheme', 0), -('themes', 'Application\\Controller\\IndexController', 'Theme Selection', '', '/application/themes', 0), -('filepond', 'Application\\Controller\\UploadController', 'Upload Featured Image', '', '', 0), -('uppy', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0), -('togglemediapub', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0), -('updateuppysort', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0), -('quicksearch', 'Application\\Controller\\IndexController', 'Quick Search', '', '', 0), -('updatefieldsort', 'Application\\Controller\\IndexController', 'Update Form Field Sorting', '', '', 0), -('selectbool', 'Application\\Controller\\IndexController', 'Select Yes/No', '', '', 0), -('checkforupdates', 'Application\\Controller\\IndexController', 'Check for Updates', '', '', 0); +INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav_href`, `show_in_menu`, `needs_globaladmin`) VALUES +('index', 'Application\\Controller\\IndexController', 'Home', 'Home', '/', 0, 0), +('addtheme', 'Application\\Controller\\UploadController', 'Upload Theme', '', '/application/addtheme', 0, 1), +('themes', 'Application\\Controller\\IndexController', 'Theme Selection', '', '/application/themes', 0, 0), +('filepond', 'Application\\Controller\\UploadController', 'Upload Featured Image', '', '', 0, 0), +('uppy', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0, 0), +('togglemediapub', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0, 0), +('updateuppysort', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0, 0), +('quicksearch', 'Application\\Controller\\IndexController', 'Quick Search', '', '', 0, 0), +('updatefieldsort', 'Application\\Controller\\IndexController', 'Update Form Field Sorting', '', '', 0, 0), +('selectbool', 'Application\\Controller\\IndexController', 'Select Yes/No', '', '', 0, 0), +('checkforupdates', 'Application\\Controller\\IndexController', 'Check for Updates', '', '', 0, 1); -- -- Default Widgets diff --git a/module/Application/src/Controller/CoreController.php b/module/Application/src/Controller/CoreController.php index 6149ad9..d7fa309 100644 --- a/module/Application/src/Controller/CoreController.php +++ b/module/Application/src/Controller/CoreController.php @@ -426,8 +426,17 @@ public function getFormTabs() { protected function getPermissions() { $aPermissionsByModules = []; + $aWhere = []; + $bIsGlobalAdmin = false; + if(CoreController::$oSession->oUser->hasPermission('globaladmin','OnePlace-Core')) { + $bIsGlobalAdmin = true; + } + if(! $bIsGlobalAdmin) { + $aWhere['needs_globaladmin'] = 0; + } + # Load Permissions from database - $oPermsFromDB = CoreController::$aCoreTables['permission']->select(); + $oPermsFromDB = CoreController::$aCoreTables['permission']->select($aWhere); foreach($oPermsFromDB as $oPerm) { $sModule = str_replace(['\\'],['-'],$oPerm->module); # Order by module diff --git a/module/Application/src/Controller/CoreEntityController.php b/module/Application/src/Controller/CoreEntityController.php index 2bf6f6f..35ee598 100644 --- a/module/Application/src/Controller/CoreEntityController.php +++ b/module/Application/src/Controller/CoreEntityController.php @@ -76,7 +76,9 @@ public function generateIndexView($sKey) { $iPage = ($iPage < 1) ? 1 : $iPage; if($oPaginator) { $oPaginator->setCurrentPageNumber($iPage); - $oPaginator->setItemCountPerPage(3); + $iItemsPerPage = (CoreEntityController::$oSession->oUser->getSetting($sKey.'-index-items-per-page')) + ? CoreEntityController::$oSession->oUser->getSetting($sKey.'-index-items-per-page') : 10; + $oPaginator->setItemCountPerPage($iItemsPerPage); } # Log Performance in DB diff --git a/module/Application/src/Controller/SetupController.php b/module/Application/src/Controller/SetupController.php index 4d6bafb..2ddf080 100644 --- a/module/Application/src/Controller/SetupController.php +++ b/module/Application/src/Controller/SetupController.php @@ -245,6 +245,12 @@ public function indexAction() { 'permission'=>'settheme', 'module'=>'OnePlace\User\Controller\UserController', ]); + # Globaladmin + $oUserPermTbl->insert([ + 'user_idfs'=>$iAdminUserID, + 'permission'=>'globaladmin', + 'module'=>'OnePlace\Core', + ]); /** * Add Basic Views / Columns / Fields diff --git a/module/Application/src/Model/CoreEntityTable.php b/module/Application/src/Model/CoreEntityTable.php index 1e32ef7..1a90464 100644 --- a/module/Application/src/Model/CoreEntityTable.php +++ b/module/Application/src/Model/CoreEntityTable.php @@ -15,6 +15,7 @@ namespace Application\Model; +use Application\Controller\CoreController; use Laminas\Db\Adapter\AdapterInterface; use Laminas\Db\TableGateway\TableGateway; use Laminas\Db\Sql\Select; diff --git a/module/Application/src/Module.php b/module/Application/src/Module.php index 13db302..983a5e3 100644 --- a/module/Application/src/Module.php +++ b/module/Application/src/Module.php @@ -27,7 +27,7 @@ class Module { * * @since 1.0.0 */ - const VERSION = '1.0.19'; + const VERSION = '1.0.20'; public function getConfig() : array { return include __DIR__ . '/../config/module.config.php'; @@ -72,6 +72,14 @@ public function getControllerConfig() : array $container ); }, + Controller\UploadController::class => function($container) { + $oDbAdapter = $container->get(AdapterInterface::class); + return new Controller\UploadController( + $oDbAdapter, + false, + $container + ); + }, ], ]; } diff --git a/module/Application/view/application/index/checkforupdates.phtml b/module/Application/view/application/index/checkforupdates.phtml index 44368e4..15b8077 100644 --- a/module/Application/view/application/index/checkforupdates.phtml +++ b/module/Application/view/application/index/checkforupdates.phtml @@ -43,7 +43,8 @@ $sUrl = ''; try { - $sModRoute = explode('-',$sModName)[1]; + $sModRoute = substr($sModName,strlen($sVendor.'-')); + echo 'try:'.$sModRoute.'-setup'; $sUrl = $this->url($sModRoute.'-setup'); } catch(\RuntimeException $e) { diff --git a/module/Application/view/application/upload/addtheme.phtml b/module/Application/view/application/upload/addtheme.phtml index ceedc5b..8268688 100644 --- a/module/Application/view/application/upload/addtheme.phtml +++ b/module/Application/view/application/upload/addtheme.phtml @@ -1,16 +1,27 @@
-

Upload new theme

-
-
- - -
-
- - +
+
+

+ translate('Upload new theme')?> +

+
+
+
+ + +
+
+
diff --git a/module/Application/view/partial/indexpager.phtml b/module/Application/view/partial/indexpager.phtml index 4552e5c..408325e 100644 --- a/module/Application/view/partial/indexpager.phtml +++ b/module/Application/view/partial/indexpager.phtml @@ -1,15 +1,47 @@ paginationControl( +$iItemsPerPage = (CoreEntityController::$oSession->oUser->getSetting($this->sRoute.'-index-items-per-page')) + ? CoreEntityController::$oSession->oUser->getSetting($this->sRoute.'-index-items-per-page') : 10; +?> +
+
+ +
+
+ paginationControl( // The paginator object: - $this->aItems, - // The scrolling style: - 'sliding', - // The partial to use to render the control: - 'partial/paginator', - // The route to link to when a user clicks a control link: - ['route' => $this->sRoute] -); \ No newline at end of file + $this->aItems, + // The scrolling style: + 'sliding', + // The partial to use to render the control: + 'partial/paginator', + // The route to link to when a user clicks a control link: + ['route' => $this->sRoute] + ); + + ?> +
+
+ \ No newline at end of file