Skip to content

Commit

Permalink
pkp#229 OrcidProfilePlugin-705
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed Feb 1, 2023
1 parent 6581a4e commit 5eba685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
15 changes: 7 additions & 8 deletions OrcidProfileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


use APP\core\Application;
use APP\core\Request;
use APP\facades\Repo;
use APP\handler\Handler;
use APP\template\TemplateManager;
Expand All @@ -35,10 +36,8 @@ class OrcidProfileHandler extends Handler
protected $plugin;


public function __construct(\OrcidProfilePlugin $plugin)
public function __construct()
{
$this->plugin = $plugin;

}

/**
Expand Down Expand Up @@ -189,7 +188,7 @@ public function orcidVerify($args, $request)
$context = $request->getContext();
$contextId = $context == null ? \PKP\core\PKPApplication::CONTEXT_ID_NONE : $context->getId();

$plugin = PluginRegistry::getPlugin('generic', 'orcidprofileplugin');
$plugin = $this->plugin;
$templatePath = $plugin->getTemplateResource(self::TEMPLATE);


Expand Down Expand Up @@ -361,10 +360,10 @@ public function about($args, $request)
$context = $request->getContext();
$contextId = $context == null ? \PKP\core\PKPApplication::CONTEXT_ID_NONE : $context->getId();
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('orcidIcon', $this->plugin->getIcon());
$templateMgr->assign('isMemberApi', $this->plugin->isMemberApiEnabled($contextId));
$templateMgr->display($this->plugin->getTemplateResource('orcidAbout.tpl'));
return false;
$plugin = PluginRegistry::getPlugin('generic', 'orcidprofileplugin');
$templateMgr->assign('orcidIcon', $plugin->getIcon());
$templateMgr->assign('isMemberApi', $plugin->isMemberApiEnabled($contextId));
$templateMgr->display($plugin->getTemplateResource('orcidAbout.tpl'));
}


Expand Down
19 changes: 3 additions & 16 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
use APP\plugins\generic\orcidProfile\classes\form\OrcidProfileSettingsForm;
use APP\plugins\generic\orcidProfile\classes\form\OrcidProfileStatusForm;
use APP\plugins\generic\orcidProfile\classes\OrcidValidator;
use APP\plugins\generic\orcidProfile\OrcidProfileHandler;



class OrcidProfilePlugin extends GenericPlugin
Expand Down Expand Up @@ -286,22 +286,9 @@ public function getSetting($contextId, $name)
public function setupCallbackHandler($hookName, $params)
{
$page = $params[0];
$op = $params[1];

if ($this->getEnabled() && $page == 'orcidapi') {

$request = \Application::get()->getRequest();

switch ($op) {
case 'about':
$page = 'pages';
$op = 'view';

$handler = new OrcidProfileHandler($this);


}

define('HANDLER_CLASS', 'APP\plugins\generic\orcidProfile\OrcidProfileHandler');
return true;
}
return false;
}
Expand Down

0 comments on commit 5eba685

Please sign in to comment.