Skip to content

Commit

Permalink
Merge pull request #2851 from bozana/440-usersRow
Browse files Browse the repository at this point in the history
#440 users row action in the admin contexts grid
  • Loading branch information
asmecher authored Oct 11, 2017
2 parents ac1d36e + 52cf2dd commit a6803d8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion controllers/grid/admin/context/ContextGridHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function __construct() {
parent::__construct();
$this->addRoleAssignment(array(
ROLE_ID_SITE_ADMIN),
array('fetchGrid', 'fetchRow', 'createContext', 'editContext', 'updateContext',
array('fetchGrid', 'fetchRow', 'createContext', 'editContext', 'updateContext', 'users',
'deleteContext', 'saveSequence')
);
}
Expand Down Expand Up @@ -59,6 +59,7 @@ function initialize($request, $args = null) {
AppLocale::requireComponents(
LOCALE_COMPONENT_PKP_USER,
LOCALE_COMPONENT_APP_MANAGER,
LOCALE_COMPONENT_PKP_MANAGER,
LOCALE_COMPONENT_PKP_ADMIN,
LOCALE_COMPONENT_APP_ADMIN
);
Expand Down Expand Up @@ -182,6 +183,18 @@ function createContext($args, $request) {
return $this->editContext($args, $request);
}

/**
* Display users management grid for the given context.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function users($args, $request) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('oldUserId', (int) $request->getUserVar('oldUserId')); // for merging users.
parent::setupTemplate($request);
return $templateMgr->fetchJson('core:controllers/tab/settings/users.tpl');
}

//
// Protected helper methods.
Expand Down
15 changes: 14 additions & 1 deletion controllers/grid/admin/context/ContextGridRow.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function initialize($request, $template = null) {
'delete'
)
);

import('lib.pkp.classes.linkAction.request.RedirectAction');
$dispatcher = $router->getDispatcher();
$this->addAction(
Expand All @@ -72,6 +71,20 @@ function initialize($request, $template = null) {
'wrench'
)
);
$this->addAction(
new LinkAction(
'users',
new AjaxModal(
$router->url($request, $element->getPath(), null, 'users', null),
__('manager.users'),
'modal_edit',
true
),
__('manager.users'),
'users'
)
);

}
}

Expand Down

0 comments on commit a6803d8

Please sign in to comment.