+ This will add a coin-DOI event to the event queue (i.e. Will not happen immediately)
+ Coin DOI
+ This item will have a DOI coined when the indexer gets around to it.
+ .Embargoed until:
+
+
+
+
+
+
+
+ Creative Commons: Attribution-NonCommercial-No Derivative Works 3.0
+ Creative Commons: Attribution 3.0
+ Creative Commons: Attribution-NonCommercial-Share Alike 3.0
+ Creative Commons: Attribution-NonCommercial 3.0
+ Creative Commons: Attribution-No Derivative Works 3.0
+ Creative Commons: Attribution-Share Alike 3.0
+
+ Creative Commons: Attribution-NonCommercial-No Derivative Works 4.0
+ Creative Commons: Attribution 4.0
+ Creative Commons: Attribution-NonCommercial-Share Alike 4.0
+ Creative Commons: Attribution-NonCommercial 4.0
+ Creative Commons: Attribution-No Derivative Works 4.0
+ Creative Commons: Attribution-Share Alike 4.0
+
+ Creative Commons: Public Domain Dedication
+ Software: GNU GPL 3.0
+ Software: GNU LGPL 3.0
+ Software: MIT
+ Software: Apache License 2.0
+
+ Data: Open Database License (ODbL) (Attribution-Share Alike)
+ Data: Open Data Commons Attribution License (Attribution)
+
+ University of Reading Licence
+
+ GNU General Public License (Software)
+ GNU Lesser General Public License (Software)
+ MIT License (MIT)
+ Apache License, Version 2.0
+ University of Reading Licence
+ Licence document attached
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Licence document attached to this item
+
+
+ Licence document attached
+
+ licenses_typename_cc_zero
+
+ Material Transfer Agreement
+
+ Data Sharing Agreement
+
+
+ License unspecified
+
+
+
+
+
+ http://creativecommons.org/licenses/by-nc-nd/3.0/
+ http://creativecommons.org/licenses/by/3.0/
+ http://creativecommons.org/licenses/by-nc-sa/3.0/
+ http://creativecommons.org/licenses/by-nc/3.0/
+ http://creativecommons.org/licenses/by-nd/3.0/
+ http://creativecommons.org/licenses/by-sa/3.0/
+
+ http://creativecommons.org/licenses/by-nc-nd/4.0/
+ http://creativecommons.org/licenses/by/4.0/
+ http://creativecommons.org/licenses/by-nc-sa/4.0/
+ http://creativecommons.org/licenses/by-nc/4.0/
+ http://creativecommons.org/licenses/by-nd/4.0/
+ http://creativecommons.org/licenses/by-sa/4.0/
+ Licence document attached
+
+ http://creativecommons.org/licenses/publicdomain/
+ attached
+ http://opensource.org/licenses/MIT
+ http://www.gnu.org/licenses/gpl.html
+ http://www.gnu.org/licenses/lgpl.html
+ http://www.apache.org/licenses/LICENSE-2.0
+ http://researchdata.reading.ac.uk/licence_restricted_data.html
+
+
+ There are no suitable values for the mandatory field datacite:Creator. Please supply creators or corp_creators before coining a DOI.
+ There are no suitable values for the mandatory field datacite:Title. Please supply a title before coining a DOI.
+
+ There are no suitable values for the mandatory field datacite:Publisher. Please supply publisher before coining a DOI.
+
+ There are no suitable values for the mandatory field datacite:PublicationYear. Please supply a publication date before coining a DOI.
+
+ Your server hostname matches the preprod regex but is not using the test DOI prefix - current prefix is .
+
+
+ Your eprint is either missing its type or the type has no match in the plugin typemap.
+
+
+
diff --git a/lib/plugins/EPrints/Plugin/Event/DataCiteEvent.pm b/lib/plugins/EPrints/Plugin/Event/DataCiteEvent.pm
index 270151c..45206b2 100644
--- a/lib/plugins/EPrints/Plugin/Event/DataCiteEvent.pm
+++ b/lib/plugins/EPrints/Plugin/Event/DataCiteEvent.pm
@@ -5,54 +5,92 @@ EPrints::Plugin::Event::DataCiteEvent
=cut
package EPrints::Plugin::Event::DataCiteEvent;
-
+
use EPrints::Plugin::Event;
-use LWP;
-use Crypt::SSLeay;
+
+eval "use LWP; use HTTP::Headers::Util";
+eval "use WWW::Curl::Easy";
@ISA = qw( EPrints::Plugin::Event );
-
+
sub datacite_doi
{
- my( $self, $eprint) = @_;
+ my( $self, $dataobj) = @_;
my $repository = $self->repository();
-
- my $thisdoi = $repository->get_conf( "datacitedoi", "prefix")."/". $repository->get_conf( "datacitedoi", "repoid")."/".$eprint->id;
-
- my $eprintdoifield = $repository->get_conf( "datacitedoi", "eprintdoifield");
-
- my $task;
-
- my $shoulddoi = $repository->get_conf( "datacitedoi", "eprintstatus", $eprint->value( "eprint_status" ));
-
+
+ if (defined $repository->get_conf( "datacitedoi", "get_curl")) {
+ # Try and import Curl.
+ if ( eval "use WWW::Curl::Easy" ) { print STDERR "Unable to import WWW::Curl::Easy.\n"; }
+ } else {
+ # Fall back to LWP and rely in its library detection.
+ if ( eval "use LWP" ) { print STDERR "Unable to import LWP.\n"; }
+ if ( eval "use HTTP::Headers::Util" ) { print STDERR "Unable to import HTTP::Headers::Util.\n"; }
+ }
+
+ # Check object status first.... TODO: Make work for dataobj == document (just in case)
+ my $shoulddoi = $repository->get_conf( "datacitedoi", "eprintstatus", $dataobj->value( "eprint_status" ));
#Check Doi Status
- if(!$shoulddoi){ return; }
-
- #check if doi has been set;
- if( $eprint->exists_and_set( $eprintdoifield )) {
- if( $eprint->value( $eprintdoifield ) ne $thisdoi ){
- #Skipping because its has a diff doi;
- return;
- }
- }else{
- $eprint->set_value($eprintdoifield, $thisdoi);
- $eprint->commit();
+ if(!$shoulddoi){
+ $repository->log("Attempt to coin DOI for item that is not in the required area (see \$c->{datacitedoi}->{eprintstatus})");
+ return EPrints::Const::HTTP_INTERNAL_SERVER_ERROR;
}
-
-
- my $xml = $eprint->export( "DataCiteXML" );
+
+ my $thisdoi = $self->coin_doi($repository,$dataobj);
+ #coin_doi may return an event error code if no prefix present assume this is the case
+ my $prefix = $repository->get_conf( "datacitedoi", "prefix");
+ return $thisdoi if($thisdoi !~ /^$prefix/);
+
+ #Pass doi into Export::DataCiteXML...
+ my $xml = $dataobj->export( "DataCiteXML", doi=>$thisdoi );
+ return $xml if($xml =~ /^\d+$/); #just a number? coin_doi has passed back an error code pass it on...
+
+ #print STDERR "XML: $xml\n";
my $url = $repository->get_conf( "datacitedoi", "apiurl");
+ $url.="/" if($url !~ /\/$/); #attach slash if config has forgotten
my $user_name = $repository->get_conf( "datacitedoi", "user");
my $user_pw = $repository->get_conf( "datacitedoi", "pass");
-
+
#register metadata;
- $response_code = datacite_request("POST", $url."metadata", $user_name, $user_pw, $xml, "application/xml;charset=UTF-8");
-
+ my $response_content;
+ my $response_code;
+ # Test if we want to be using curl; if we don't run the 'old' LWP code
+ if (defined $repository->get_conf( "datacitedoi", "get_curl")) {
+ ($response_content, $response_code) = datacite_request_curl($url."metadata", $user_name, $user_pw, $xml, "application/xml;charset=UTF-8");
+ } else {
+ ($response_content, $response_code) = datacite_request("POST", $url."metadata", $user_name, $user_pw, $xml, "application/xml;charset=UTF-8");
+ }
+
+ if($response_code !~ /20(1|0)/){
+ $repository->log("Metadata response from datacite api when submitting EPrint $dataobj->id: $response_code: $response_content");
+ $repository->log("XML submitted was:\n$xml");
+ return EPrints::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
#register doi
- my $doi_reg = "doi=$thisdoi\nurl=".$eprint->uri();
- $response_code = datacite_request("POST", $url."doi", $user_name, $user_pw, $doi_reg, "text/plain;charset=UTF-8");
+ my $repo_url =$dataobj->uri();
+ #RM special override to allow testing from "wrong" domain
+ if(defined $repository->get_conf( "datacitedoi", "override_url")){
+ $repo_url = $repository->get_conf( "datacitedoi", "override_url");
+ $repo_url.= $dataobj->internal_uri;
+ }
+ my $doi_reg = "doi=$thisdoi\nurl=".$repo_url;
+ # Test if we want to be using curl; if we don't run the 'old' LWP code
+ if (defined $repository->get_conf( "datacitedoi", "get_curl")) {
+ ($response_content, $response_code)= datacite_request_curl($url."doi", $user_name, $user_pw, $doi_reg, "text/plain; charset=utf8");
+ } else {
+ ($response_content, $response_code)= datacite_request("POST", $url."doi", $user_name, $user_pw, $doi_reg, "text/plain; charset=utf8");
+ }
+ if($response_code !~ /20(1|0)/){
+ $repository->log("Registration response from datacite api: $response_code: $response_content");
+ $repository->log("XML submitted was:\n$xml");
+ return EPrints::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
+ #now it is safe to set DOI value.
+ my $eprintdoifield = $repository->get_conf( "datacitedoi", "eprintdoifield");
+ $dataobj->set_value($eprintdoifield, $thisdoi);
+ $dataobj->commit();
+ #success
return undef;
}
@@ -65,9 +103,10 @@ sub datacite_request {
'Accept' => 'application/xml',
'Content-Type' => $content_type
);
+
my $req = HTTP::Request->new(
$method => $url,
- $headers, $content
+ $headers, Encode::encode_utf8( $content )
);
$req->authorization_basic($user_name, $user_pw);
@@ -75,10 +114,95 @@ sub datacite_request {
my $ua = LWP::UserAgent->new;
my $res = $ua->request($req);
- return $res->content();
+ return ($res->content(),$res->code());
}
+sub datacite_request_curl {
+ my ($url, $user_name, $user_pw, $content, $content_type) = @_;
-1;
\ No newline at end of file
+ # build request
+ my @myheaders = (
+ "Accept: application/xml",
+ "Content-Type: $content_type"
+ );
+ my $curl = new WWW::Curl::Easy;
+
+ $curl->setopt(CURLOPT_FAILONERROR,1);
+ # $curl->setopt(CURLOPT_HEADER,1);
+ # $curl->setopt(CURLOPT_VERBOSE, 1);
+ $curl->setopt(CURLOPT_POST, 1);
+ $curl->setopt(CURLOPT_URL, $url);
+ $curl->setopt(CURLOPT_USERNAME, $user_name);
+ $curl->setopt(CURLOPT_PASSWORD, $user_pw);
+ $curl->setopt(CURLOPT_POSTFIELDS, $content);
+ $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders);
+
+ my $response_body;
+ open (my $fileb, ">", \$response_body);
+ $curl->setopt(CURLOPT_WRITEDATA,$fileb);
+
+
+ # pass request and get a response back
+ my $retcode = $curl->perform;
+
+ # Use response to determine HTTP status code
+ $http_retcode = $curl->getinfo(CURLINFO_HTTP_CODE);
+
+# # Ensure we return a useful (well, usable) message and error response
+# if ($retcode == 0) {
+# $content = "Received response: $response_body\n";
+# } else {
+# $http_prose = $curl->strerror($retcode);
+# $content = "An error happened: $http_prose $http_retcode (Curl error code $retcode)\n";
+# }
+
+ return ($content, $http_retcode);
+}
+
+
+#RM lets do the DOI coining somewhere (reasonably) accessible
+sub coin_doi {
+
+ my( $self, $repository, $dataobj) = @_;
+
+ #RM zero padds eprintid as per config
+ my $z_pad = $repository->get_conf( "datacitedoi", "zero_padding") || 0;
+ my $id = sprintf("%0".$z_pad."d", $dataobj->id);
+ #Check for custom delimiters
+ my ($delim1, $delim2) = @{$repository->get_conf( "datacitedoi", "delimiters")};
+ #default to slash
+ $delim1 = "/" if(!defined $delim1);
+ #second defaults to first
+ $delim2 = $delim1 if(!defined $delim2);
+ #construct the DOI string
+ my $prefix = $repository->get_conf( "datacitedoi", "prefix");
+ my $thisdoi = $prefix.$delim1.$repository->get_conf( "datacitedoi", "repoid").$delim2.$id;
+
+ my $eprintdoifield = $repository->get_conf( "datacitedoi", "eprintdoifield");
+
+ #Custom DOIS
+ #if DOI field is set attempt to use that if config allows
+ if($dataobj->exists_and_set( $eprintdoifield) ){
+
+ #if config does not allow ... bail
+ if( !$repository->get_conf( "datacitedoi", "allow_custom_doi" ) ){
+ $repository->log("DOI is already set and custom overrides are disaallowed by config");
+ return EPrints::Const::HTTP_INTERNAL_SERVER_ERROR;
+ }
+ #we are allowed (check prefix just in case)
+ $thisdoi = $dataobj->get_value( $eprintdoifield );
+ # AH commented out because when there is an existing DOI (e.g. one issued by the publisher)
+ # the condition is always true and therefore, existing DOI becomes an empty string
+ # if($thisdoi !~ /^$prefix/){
+ # $repository->log("Prefix does not match ($prefix) for custom DOI: $thisdoi");
+ # $dataobj->set_value($eprintdoifield, ""); #unset the bad DOI!!
+ # $dataobj->commit();
+ # return EPrints::Const::HTTP_INTERNAL_SERVER_ERROR;
+ # }#We'll leave Datacite to do any further syntax checking etc...
+ }
+
+ return $thisdoi;
+}
+1;
diff --git a/lib/plugins/EPrints/Plugin/Export/DataCiteXML.pm b/lib/plugins/EPrints/Plugin/Export/DataCiteXML.pm
index 5d0ca0c..2ee6778 100644
--- a/lib/plugins/EPrints/Plugin/Export/DataCiteXML.pm
+++ b/lib/plugins/EPrints/Plugin/Export/DataCiteXML.pm
@@ -1,17 +1,15 @@
=head1 NAME
-
EPrints::Plugin::Export::DataCiteXML
-
=cut
package EPrints::Plugin::Export::DataCiteXML;
-
use EPrints::Plugin::Export::Feed;
@ISA = ('EPrints::Plugin::Export::Feed');
use strict;
+use Data::Dumper;
sub new
{
my ($class, %opts) = @_;
@@ -23,89 +21,61 @@ sub new
$self->{visible} = 'all';
$self->{suffix} = '.xml';
$self->{mimetype} = 'application/xml; charset=utf-8';
-
+ $self->{arguments}->{doi} = undef;
+
return $self;
}
sub output_dataobj
{
- my ($self, $dataobj, %opts) = @_;
-
- my $repo = $self->{repository};
- my $xml = $repo->xml;
-
-
- my $thisdoi = $repo->get_conf( "datacitedoi", "prefix")."/". $repo->get_conf( "datacitedoi", "repoid")."/".$dataobj->id;
-
- my $entry = $xml->create_element( "resource", xmlns=>"http://datacite.org/schema/kernel-2.2", "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation"=>"http://datacite.org/schema/kernel-2.2 http://schema.datacite.org/meta/kernel-2.2/metadata.xsd" );
-
- $entry->appendChild( $xml->create_data_element( "identifier", $dataobj->get_value( $repo->get_conf( "datacitedoi", "eprintdoifield") ) , identifierType=>"DOI" ) );
-
-
- my $creators = $xml->create_element( "creators" );
- if( $dataobj->exists_and_set( "creators" ) )
- {
-
- my $names = $dataobj->get_value( "creators" );
- foreach my $name ( @$names )
- {
- my $author = $xml->create_element( "creator" );
-
- my $name_str = EPrints::Utils::make_name_string( $name->{name});
- $author->appendChild( $xml->create_data_element(
- "creatorName",
- $name_str ) );
+ my ($self, $dataobj, %opts) = @_;
+
+ my $repo = $self->{repository};
+ my $xml = $repo->xml;
+
+ #reference the datacite schema from config
+ our $entry = $xml->create_element( "resource",
+ xmlns=> $repo->get_conf( "datacitedoi", "xmlns"),
+ "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
+ "xsi:schemaLocation" => $repo->get_conf( "datacitedoi", "schemaLocation"));
+
+ #RM We pass in the DOI from Event::DataCite... or from --args on the cmd line
+
+ # AH my $thisdoi = $opts{doi}; always returns undefined, even when DOI exists
+ # Ideally coining should NOT happen in this script but opts{doi} should have it
+ # but is always blank
+ my $thisdoi = $dataobj->get_value("id_number");
+ #RM coin a DOI if either
+ # - not come via event or
+ # - no doi arg passed in via cmd_line
+ # ie when someone exports DataCiteXML from the Action tab
+ if(!defined $thisdoi){
+ #nick the coining sub from event plugin
+ my $event = $repo->plugin("Event::DataCiteEvent");
+ $thisdoi = $event->coin_doi($repo, $dataobj);
+ #coin_doi may return an event error code if no prefix present assume this is the case
+ my $prefix = $repo->get_conf( "datacitedoi", "prefix");
+ return $thisdoi if($thisdoi !~ /^$prefix/);
+ }
+ $entry->appendChild( $xml->create_data_element( "identifier", $thisdoi , identifierType=>"DOI" ) );
+
+ my $conf_hash_reference = $repo->{config};
+ foreach my $mapping_fn (keys %$conf_hash_reference){
+ # If this is a datacite_mapping configuration item (aka one of our subroutines)
+ if (index($mapping_fn, 'datacite_mapping_') == 0) {
+ # Value of $mapping_fn matches datacite_mapping_, so is probably a helper method
+ if($repo->can_call($mapping_fn)){
+ my $mapped_element = $repo->call( $mapping_fn, $xml, $dataobj, $repo );
+ $entry->appendChild( $mapped_element ) if(defined $mapped_element);
+ }
+ }
+ }
+
+####### From here on in you can redefine datacite_mapping_[fieldname] sub routines in lib/cfg.d/zzz_datacite_mapping.pl #######################
- #$author->appendChild( $xml->create_data_element(
- # "email",
- # $name->{id} ) );
- $creators->appendChild( $author );
- }
- }
- $entry->appendChild( $creators );
-
- if ($dataobj->exists_and_set( "title" )) {
- my $titles = $xml->create_element( "titles" );
- $titles->appendChild( $xml->create_data_element( "title", $dataobj->render_value( "title" ) ) );
- $entry->appendChild( $titles );
- }
-
- $entry->appendChild( $xml->create_data_element( "publisher", $repo->get_conf( "datacitedoi", "repoid") ) );
-
- if ($dataobj->exists_and_set( "datestamp" )) {
- $dataobj->get_value( "datestamp" ) =~ /^([0-9]{4})/;
- $entry->appendChild( $xml->create_data_element( "publicationYear", $1 ) ) if $1;
-
- }
-
-
- if ($dataobj->exists_and_set( "subjects" )) {
- my $subjects = $dataobj->get_value("subjects");
- if( EPrints::Utils::is_set( $subjects ) ){
- my $subjects_tag = $xml->create_element( "subjects" );
- foreach my $val (@$subjects){
- my $subject = EPrints::DataObj::Subject->new( $repo, $val );
- next unless defined $subject;
- $subjects_tag->appendChild( $xml->create_data_element( "subject", $subject->render_description ) );
-
- }
- $entry->appendChild( $subjects_tag );
- }
- }
-
-
- my $thisresourceType = $repo->get_conf( "datacitedoi", "typemap", $dataobj->get_value("type") );
- if($thisresourceType!= undef ){
- $entry->appendChild( $xml->create_data_element( "resourceType", $thisresourceType->{'v'}, resourceTypeGeneral=>$thisresourceType->{'a'}) );
- }
-
-
- my $alternateIdentifiers = $xml->create_element( "alternateIdentifiers" );
- $alternateIdentifiers->appendChild( $xml->create_data_element( "alternateIdentifier", $dataobj->get_url() , alternateIdentifierType=>"URL" ) );
- $entry->appendChild( $alternateIdentifiers );
-
- return ''."\n".$xml->to_string($entry);
+ return ''."\n".$xml->to_string($entry);
}
-1;
\ No newline at end of file
+
+1;
diff --git a/lib/plugins/EPrints/Plugin/Screen/EPrint/Staff/CoinDOI.pm b/lib/plugins/EPrints/Plugin/Screen/EPrint/Staff/CoinDOI.pm
new file mode 100644
index 0000000..b25012c
--- /dev/null
+++ b/lib/plugins/EPrints/Plugin/Screen/EPrint/Staff/CoinDOI.pm
@@ -0,0 +1,146 @@
+package EPrints::Plugin::Screen::EPrint::Staff::CoinDOI;
+
+#use EPrints::Plugin::Screen::EPrint;
+
+@ISA = ( 'EPrints::Plugin::Screen::EPrint' );
+
+use strict;
+
+sub new
+{
+ my( $class, %params ) = @_;
+
+ my $self = $class->SUPER::new(%params);
+
+ # $self->{priv} = # no specific priv - one per action
+
+ $self->{actions} = [qw/ coindoi /];
+
+ $self->{appears} = [ {
+ place => "eprint_editor_actions",
+ action => "coindoi",
+ position => 1977,
+ }, ];
+
+ return $self;
+}
+
+sub obtain_lock
+{
+ my( $self ) = @_;
+
+ return $self->could_obtain_eprint_lock;
+}
+
+sub about_to_render
+{
+ my( $self ) = @_;
+
+ $self->EPrints::Plugin::Screen::EPrint::View::about_to_render;
+}
+
+sub allow_coindoi
+{
+ my( $self ) = @_;
+
+ return 0 unless $self->could_obtain_eprint_lock;
+
+ my $repository = $self->{repository};
+ #TODO a version that works for documents too
+ my $dataobj = $self->{processor}->{eprint};
+ if (defined $repository->get_conf( "datacitedoi", "typesallowed")) {
+ # Is this type of eprint allowed/denied coining?
+ return 0 unless $repository->get_conf( "datacitedoi", "typesallowed", $dataobj->get_type);
+ }
+ return 0 unless $repository->get_conf( "datacitedoi", "eprintstatus", $dataobj->value( "eprint_status" ));
+ # Don't show coinDOI button if a DOI is already set AND coining of custom doi is disallowed
+ return 0 if($dataobj->is_set($repository->get_conf( "datacitedoi", "eprintdoifield")) &&
+ !$repository->get_conf("datacitedoi","allow_custom_doi"));
+ #TODO don't allow the coinDOI button if a DOI is already registered (may require a db flag for successful reg)
+ # Or maybe check with datacite api to see if a doi is registered
+ return $self->allow( $repository->get_conf( "datacitedoi", "minters") );
+}
+
+sub action_coindoi
+{
+ my( $self ) = @_;
+
+ my $repository = $self->{repository};
+
+ return undef if (!defined $repository);
+
+ $self->{processor}->{redirect} = $self->redirect_to_me_url()."&_current=2";
+
+ my $eprint = $self->{processor}->{eprint};
+
+ if (defined $eprint) {
+
+
+ my $problems = $self->validate($eprint);
+
+ if( scalar @{$problems} > 0 )
+ {
+ my $dom_problems = $self->{session}->make_element("ul");
+ foreach my $problem_xhtml ( @{$problems} )
+ {
+ $dom_problems->appendChild( my $li = $self->{session}->make_element("li"));
+ $li->appendChild( $problem_xhtml );
+ }
+ $self->workflow->link_problem_xhtml( $dom_problems, "EPrint::Edit" );
+ $self->{processor}->add_message( "warning", $dom_problems );
+
+
+ }else{
+
+ my $eprint_id = $eprint->id;
+
+ $repository->dataset( "event_queue" )->create_dataobj({
+ pluginid => "Event::DataCiteEvent",
+ action => "datacite_doi",
+ params => [$eprint->internal_uri],
+ });
+
+ $self->add_result_message( 1 );
+ }
+ }
+}
+
+sub add_result_message
+{
+ my( $self, $ok ) = @_;
+
+ if( $ok )
+ {
+ $self->{processor}->add_message( "message",
+ $self->html_phrase( "coiningdoi" ) );
+ }
+ else
+ {
+ # Error?
+ $self->{processor}->add_message( "error" );
+ }
+
+ $self->{processor}->{screenid} = "EPrint::View";
+}
+
+# Validate this datacite submission - this will call validate_datacite in lib/cfg.d/z_datacite_mapping.pl
+sub validate
+{
+ my( $self, $eprint ) = @_;
+
+ my @problems;
+
+ my $validate_fn = "validate_datacite";
+ if( $self->{session}->can_call( $validate_fn ) )
+ {
+ push @problems, $self->{session}->call(
+ $validate_fn,
+ $eprint,
+ $self->{session} );
+ }
+
+ return \@problems;
+}
+
+
+1;
diff --git a/lib/static/images/epm/datacitedoi.png b/lib/static/images/epm/datacitedoi.png
index a803d26..581e848 100644
Binary files a/lib/static/images/epm/datacitedoi.png and b/lib/static/images/epm/datacitedoi.png differ