Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORCID plugin 2.4.8 #14

Open
wants to merge 33 commits into
base: ojs-dev-2_4
Choose a base branch
from
Open

ORCID plugin 2.4.8 #14

wants to merge 33 commits into from

Conversation

atarix83
Copy link

@atarix83 atarix83 commented Apr 7, 2017

Hi,

I proceeded to add some features to orcidProfile plugin for OJS 2.4.x and I'd like to commit to OJS codebase.

What we have changes is :

  • added search functionality for additional authors;
  • added translation file for Italian language;
  • some improvements in the graphic;
  • bug fixes in the request email.

Thanks.
Giuseppe
4Science

@asmecher
Copy link
Member

asmecher commented Apr 7, 2017

@atarix83, before I start on a code review, would you mind converting indentation to tabs instead of spaces? Thanks!

@atarix83
Copy link
Author

@asmecher
Done.

<message key="plugins.generic.orcidProfile.emailOrOrcid">Email address or ORCID iD:</message>
<message key="plugins.generic.orcidProfile.submitAction">Submit</message>
<message key="plugins.generic.orcidProfile.submitAction">Submit</message>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still some space-based indents here.

<message key="plugins.generic.orcidProfile.instructions"><![CDATA[È possibile precompilare il modulo con le informazioni da un profilo orcid. Inserire l'indirizzo email o ORCID iD associati al profilo ORCID, quindi fare clic su "Conferma".]]></message>
<message key="plugins.generic.orcidProfile.noData">Nessuna informazione trovata dal registro di ORCID.</message>
<message key="plugins.generic.orcidProfile.emailOrOrcid">Indirizzo Email o ORCID iD:</message>
<message key="plugins.generic.orcidProfile.submitAction">Conferma</message>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some space-based indents

@@ -79,7 +56,8 @@ function orcidAuthorize($args, &$request) {
// Submission process: Pre-fill the first author's ORCiD from the ORCiD data
echo '<html><body><script type="text/javascript">
opener.document.getElementById("authors-0-orcid").value = ' . json_encode('http://orcid.org/' . $response['orcid']). ';
opener.document.getElementById("connect-orcid-button").style.display = "none";
opener.document.getElementById("connect-orcid-button").style.display = "none";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space-based indents

* ORCID Profile authorization form
*
*}
<script type="text/javascript">

function openORCID() {ldelim}
var oauthWindow = window.open("{$orcidProfileOauthPath|escape}authorize?client_id={$orcidClientId|urlencode}&response_type=code&scope=/authenticate&redirect_uri={url|urlencode page="orcidapi" op="orcidAuthorize" targetOp=$targetOp params=$params escape=false}", "_blank", "toolbar=no, scrollbars=yes, width=500, height=600, top=500, left=500");
console.log(self);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a debugging leftover.

@asmecher
Copy link
Member

Sorry to be so picky about indentation -- it's my obsession :)

@atarix83
Copy link
Author

Sorry for not having carefully checked, now It'd be ok

@@ -9,17 +9,22 @@
font-weight: bold;
font-size: .8em;
line-height: 24px;
margin: .3em;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more here :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted

display: block;
margin: 0 .5em 0 0;
padding: 0;
float: left;
}

.search-content {
padding: 10px !important;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted

@asmecher
Copy link
Member

@ctgraham, have you tinkered with any of this recently?

@ctgraham
Copy link

@asmecher, I have not done any recent work on the orcidProfile plugin.

@atarix83 atarix83 changed the title Ojs dev 2 4 ORCID plugin 2.4.8 May 15, 2017
@atarix83
Copy link
Author

Hi,
any news about this PR?

Thanks.
Giuseppe
4Science

@asmecher
Copy link
Member

Sorry, @atarix83, it's been on my list to look at but I've been having trouble keeping up with other priorities. @defstat, would you be able to look at it?

Copy link

@defstat defstat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atarix83 A first review round with few suggestions.

@@ -84,10 +92,10 @@ function setupCallbackHandler($hookName, $params) {
function handleTemplateDisplay($hookName, $args) {
$templateMgr =& $args[0];
$template =& $args[1];
$request =& PKPApplication::getRequest();
$request =& PKPApplication::getRequest();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Assign our private stylesheet.
$templateMgr->addStylesheet($request->getBaseUrl() . '/' . $this->getStyleSheet());
// Assign our private stylesheet.
$templateMgr->addStylesheet($request->getBaseUrl() . '/' . $this->getStyleSheet());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -97,6 +105,7 @@ function handleTemplateDisplay($hookName, $args) {
$templateMgr->register_outputfilter(array(&$this, 'profileFilter'));
break;
case 'author/submit/step3.tpl':
case 'submission/metadata/metadataEdit.tpl':
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});</script>';
$newOutput .= substr($output, $offset + strlen($match));
$output = $newOutput;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several indentation issues at that function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to what you are referring, maybe line 231?

<message key="plugins.generic.orcidProfile.searchResultsList">Choose and select the exact match from the list below:</message>
<message key="plugins.generic.orcidProfile.searchResultsList">Choose and select the exact match from the list below:</message>
<message key="plugins.generic.orcidProfile.privateEmail">Not viewable</message>
<message key="plugins.generic.orcidProfile.noResults">No search results</message>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some indentation issues here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems ok in my branch



</body>
<description>This email template is used to collect the ORCID id's from co-authors.</description>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only for 'co-authors'?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">

<!--
* plugins/generic/orcidPlugin/locale/en_US/locale.xml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en_US -> it_IT

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orcidPlugin -> orcidProfile?

@@ -1,11 +1,13 @@
{**
* plugins/generic/orcidProfile/orcidProfile.tpl
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix path

@@ -0,0 +1,23 @@
{**
* plugins/generic/orcidProfile/orcidProfileSearch.tpl
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix path

@@ -0,0 +1,162 @@
{**
* plugins/generic/orcidProfile/orcidProfileSearchResults.tpl
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix path

</tr>
<tr class="heading" valign="top">
<td width="5%">&nbsp;</td>
<td width="25%">{translate key="plugins.generic.openAIRE.projectID"}</td>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix translation key

* Localized email templates XML file.
-->

<email_texts locale="en_US">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change locale

<h3>{translate key='plugins.generic.orcidProfile.searchPageTitle'}</h3>
<div id="content" class="search-content">
<p>{translate key='plugins.generic.orcidProfile.searchResultsList'}</p>
<form action="{plugin_url path="process"}" method="post" id="issuesForm">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest change the name of the form [id="issuesForm"]

{rdelim}
</script>

<button id="{$params.orcidButtonId}" onclick="return openSearchORCID{$params.authorIndex}();" {if !$params.orcidButtonVisible}style="display:none;" {/if}><img class="orcid-id-logo" src="http://orcid.org/sites/default/files/images/orcid_24x24.png" width="24" height="24" alt="{translate key='plugins.generic.orcidProfile.submitAction'}"/>Search the ORCID iD</button>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest change "Search the ORCID iD" to {translate key='...'}

<link rel="stylesheet" href="{$baseUrl}/styles/comments.css" type="text/css" />
<link rel="stylesheet" href="{$baseUrl}/plugins/generic/orcidProfile/css/orcidProfile.css" type="text/css" />

{foreach from=$stylesheets item=cssUrl}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is orcidProfile.css declared twice? (also elsewhere)

$("#orcidSearchResultsSubmit").click(function(event) {
event.preventDefault();
var profiles = {/literal}{$orcidSearchResults|@json_encode}{literal};
var authorIndex = {/literal}{$authorIndex}{literal};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $authorIndex seems not to be filled after the user uses the searchResults pager [go from page1 to page2 for example]. That seems to result to a javascript error which "breaks" the javascript flow.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

var profileSelectedIndex = $("input[name=orcidProfile]:checked").val();
var profileSelected = profiles.theArray[profileSelectedIndex];

opener.document.getElementById("{/literal}{$orcidButtonId}{literal}").style.display = "none";;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra ';' at the end of the line?

var profileSelected = profiles.theArray[profileSelectedIndex];

opener.document.getElementById("{/literal}{$orcidButtonId}{literal}").style.display = "none";;
opener.document.getElementById("remove-orcid-button-" + authorIndex).style.display = "inline";;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra ';' at the end of the line?

@atarix83
Copy link
Author

Hi @defstat thanks for reviewing.

I've made changes in base of your suggestions and fixed the issues.
I hope I've not forgotten anything

@asmecher
Copy link
Member

@atarix83 and @defstat, part of merging this will also involve forward-porting it to OJS 3.x so it's not lost. @atarix83, do you have plans to upgrade to OJS 3.x?

@atarix83
Copy link
Author

@asmecher yes I would to upgrade to OJS 3.x but now I can't schedule an upgrade

@defstat
Copy link

defstat commented Jul 25, 2017

@atarix83 I have done some work for OMP if that could be of help - https://github.com/defstat/orcidProfile/tree/hirmeos_orcid

@asmecher
Copy link
Member

@defstat, this is an old PR but I see a few commits sneaking into it more recently -- are you keeping an eye on it?

@defstat
Copy link

defstat commented Mar 16, 2018

@asmecher No but I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants