* [MOD] Plugins module icon is now on main menu

* [MOD] Code refactoring
This commit is contained in:
nuxsmin
2018-08-31 00:11:55 +02:00
parent b106ae6892
commit 42471b4680
13 changed files with 252 additions and 302 deletions

View File

@@ -132,7 +132,7 @@ final class PluginGrid extends GridBase
$gridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$gridActionSearch->setName('frmSearchPlugin');
$gridActionSearch->setTitle(__('Buscar Plugin'));
$gridActionSearch->setOnSubmitFunction('appMgmt/search');
$gridActionSearch->setOnSubmitFunction('plugin/search');
$gridActionSearch->addData('action-route', Acl::getActionRoute(ActionsInterface::PLUGIN_SEARCH));
return $gridActionSearch;
@@ -149,7 +149,7 @@ final class PluginGrid extends GridBase
$gridAction->setName(__('Ver Plugin'));
$gridAction->setTitle(__('Ver Plugin'));
$gridAction->setIcon($this->icons->getIconView());
$gridAction->setOnClickFunction('appMgmt/show');
$gridAction->setOnClickFunction('plugin/show');
$gridAction->setFilterRowSource('available', 0);
$gridAction->addData('action-route', Acl::getActionRoute(ActionsInterface::PLUGIN_VIEW));

View File

@@ -256,6 +256,7 @@ final class LayoutHelper extends HelperBase
public function getMenu(Acl $acl)
{
$icons = $this->theme->getIcons();
$actions = [];
$actionSearch = new DataGridAction();
$actionSearch->setId(ActionsInterface::ACCOUNT);
@@ -267,7 +268,7 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::ACCOUNT)
]);
$this->view->append('actions', $actionSearch);
$actions[] = $actionSearch;
if ($acl->checkUserAccess(ActionsInterface::ACCOUNT_CREATE)) {
$actionNewAccount = new DataGridAction();
@@ -280,7 +281,7 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::ACCOUNT_CREATE)
]);
$this->view->append('actions', $actionNewAccount);
$actions[] = $actionNewAccount;
}
if ($acl->checkUserAccess(ActionsInterface::ACCESS_MANAGE)) {
@@ -294,7 +295,7 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::ACCESS_MANAGE)
]);
$this->view->append('actions', $actionAccessManager);
$actions[] = $actionAccessManager;
}
if ($acl->checkUserAccess(ActionsInterface::ITEMS_MANAGE)) {
@@ -308,7 +309,7 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::ITEMS_MANAGE)
]);
$this->view->append('actions', $actionItemManager);
$actions[] = $actionItemManager;
}
if ($acl->checkUserAccess(ActionsInterface::CONFIG)) {
@@ -322,7 +323,7 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::CONFIG)
]);
$this->view->append('actions', $actionConfigManager);
$actions[] = $actionConfigManager;
}
if ($acl->checkUserAccess(ActionsInterface::EVENTLOG) && $this->configData->isLogEnabled()) {
@@ -336,9 +337,24 @@ final class LayoutHelper extends HelperBase
'route' => Acl::getActionRoute(ActionsInterface::EVENTLOG)
]);
$this->view->append('actions', $actionEventlog);
$actions[] = $actionEventlog;
}
if ($acl->checkUserAccess(ActionsInterface::PLUGIN)) {
$actionPlugins = new DataGridAction();
$actionPlugins->setId(ActionsInterface::PLUGIN);
$actionPlugins->setTitle(__('Plugins'));
$actionPlugins->setIcon($icons->getIconByName('extension'));
$actionPlugins->setData([
'historyReset' => 1,
'view' => 'plugin',
'route' => Acl::getActionRoute(ActionsInterface::PLUGIN)
]);
$actions[] = $actionPlugins;
}
$this->view->assign('actions', $actions);
$this->view->assign('useMenu', true);
}

View File

@@ -34,7 +34,6 @@ use SP\Modules\Web\Controllers\Helpers\Grid\ClientGrid;
use SP\Modules\Web\Controllers\Helpers\Grid\CustomFieldGrid;
use SP\Modules\Web\Controllers\Helpers\Grid\FileGrid;
use SP\Modules\Web\Controllers\Helpers\Grid\ItemPresetGrid;
use SP\Modules\Web\Controllers\Helpers\Grid\PluginGrid;
use SP\Modules\Web\Controllers\Helpers\Grid\TagGrid;
use SP\Modules\Web\Controllers\Helpers\TabsGridHelper;
use SP\Services\Account\AccountFileService;
@@ -44,7 +43,6 @@ use SP\Services\Category\CategoryService;
use SP\Services\Client\ClientService;
use SP\Services\CustomField\CustomFieldDefService;
use SP\Services\ItemPreset\ItemPresetService;
use SP\Services\Plugin\PluginService;
use SP\Services\Tag\TagService;
/**
@@ -117,10 +115,6 @@ final class ItemManagerController extends ControllerBase
$this->tabsGridHelper->addTab($this->getItemPresetList());
}
if ($this->checkAccess(Acl::PLUGIN)) {
$this->tabsGridHelper->addTab($this->getPluginsList());
}
$this->eventDispatcher->notifyEvent('show.itemlist.items', new Event($this));
$this->tabsGridHelper->renderTabs(Acl::getActionRoute(Acl::ITEMS_MANAGE), $this->request->analyzeInt('tabIndex', 0));
@@ -240,20 +234,6 @@ final class ItemManagerController extends ControllerBase
->updatePager();
}
/**
* Returns plugins' data tab
*
* @return \SP\Html\DataGrid\DataGridTab
* @throws \SP\Core\Exceptions\ConstraintException
* @throws \SP\Core\Exceptions\QueryException
*/
protected function getPluginsList()
{
return $this->dic->get(PluginGrid::class)
->getGrid($this->dic->get(PluginService::class)->search($this->itemSearchData))
->updatePager();
}
/**
* @return TabsGridHelper
*/

View File

@@ -34,6 +34,7 @@ use SP\Http\JsonResponse;
use SP\Modules\Web\Controllers\Helpers\Grid\PluginGrid;
use SP\Modules\Web\Controllers\Traits\ItemTrait;
use SP\Modules\Web\Controllers\Traits\JsonTrait;
use SP\Plugin\PluginManager;
use SP\Services\Plugin\PluginService;
/**
@@ -98,7 +99,6 @@ final class PluginController extends ControllerBase
}
$this->view->addTemplate('datagrid-table', 'grid');
$this->view->assign('index', $this->request->analyzeInt('activetab', 0));
$this->view->assign('data', $this->getSearchGrid());
return $this->returnJsonResponseData(['html' => $this->render()]);
@@ -147,8 +147,10 @@ final class PluginController extends ControllerBase
$this->view->addTemplate('plugin');
$pluginData = $pluginId ? $this->pluginService->getById($pluginId) : new PluginData();
$pluginInfo = $this->dic->get(PluginManager::class)->getPluginInfo($pluginData->name);
$this->view->assign('plugin', $pluginData);
$this->view->assign('pluginInfo', $pluginInfo);
$this->view->assign('sk', $this->session->generateSecurityKey());
$this->view->assign('nextAction', Acl::getActionRoute(Acl::ITEMS_MANAGE));