EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #04599
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] IRstats2 & MePrints.
- To: "'eprints-tech@ecs.soton.ac.uk'" <eprints-tech@ecs.soton.ac.uk>
- Subject: [EP-tech] IRstats2 & MePrints.
- From: "Brian D. Gregg" <bdgregg@pitt.edu>
- Date: Mon, 31 Aug 2015 17:07:21 +0000
All, I have been working on a MePrints Widget for IRstats2 for a while now and I’m finding that the MD5 checksum that is displayed when using the /cgi/stats/report URL filtering on Author does not create the same MD5 checksum in the URL as does
when using the code below (found in the cfg/plugins/EPrints/Plugin/Stats/Sets.pm file). $userid = ‘4’; $val = Digest::MD5::md5_hex( encode_utf8($userid) ); print "$val\n"; a87ff679a2f3e71d9181a67b7542122c I’ve also just tried simply: $val = Digest::MD5::md5_hex($userid); a87ff679a2f3e71d9181a67b7542122c For example (not sure if this is accessible outside our network) the following returns properly for the author as in all of the statistics are correct: However, when I try to embed the same stats into a widget for meprints (code below) I get a different MD5 value (a87ff679a2f3e71d9181a67b7542122c) thus the MD5 values don’t match and as such the stats are incorrect (or actually missing
obviously). Otherwise the widget works as expected displaying both the downloads and top 5 eprints IRstats graphs – however the widget usually shows 0 for downloads and “No data found.” for the author. What am I missing or is there something in my settings for IRstats that needs changed? Thanks, Brian Gregg. My IRstats Author Widget Code: package EPrints::Plugin::MePrints::Widget::IRStats2Author; use EPrints::Plugin::MePrints::Widget; @ISA = ( 'EPrints::Plugin::MePrints::Widget' ); use strict; use Encode; sub new { my( $class, %params ) = @_; my $self = $class->SUPER::new( %params ); if ( !$self->{session} ) { $self->{session} = $self->{processor}->{session}; } $self->{name} = "EPrints Profile System: IRStats Author Widget"; $self->{visible} = "all"; $self->{advertise} = 1; $self->{max_display} = 10; if( defined $self->{session} && defined $self->{session}->current_user ) { unless( $self->{session}->current_user->has_role( 'deposit' ) ) { $self->{enable} = 0; } } return $self; } sub render_content { my( $self ) = @_; my $session = $self->{session}; my $user = $self->{user}; my $username = $user->get_value( 'username' ); my $orcid = $user->get_value( 'orcid' ); my $frag = $session->make_doc_fragment; my $repo_url = $session->get_repository->get_conf( "base_url" ); # just need a container, a JS callback, a way to translate the current user ID into a IRStats2 Set value (??) my $userid = $user->get_id; #my $set_value = Digest::MD5::md5_hex( $user->get_id ); my $set_value = Digest::MD5::md5_hex( encode_utf8( $user->get_id ) ); $frag->appendChild( $session->make_text( "$userid,$set_value" ) ); $frag->appendChild( $self->html_phrase( "downloads" ) ); $frag->appendChild( $session->make_element( 'div', id => 'irstats2_downloads', style => 'width: 300px; height: 100px;margin-left:auto;margin-right:auto;' ) ); $frag->appendChild( $session->make_javascript( <<GRAPH ) ); new EPJS_Stats_GoogleGraph( { 'context': { 'range': '1y', 'datatype': 'downloads', 'set_name': 'authors', 'set_value': '$set_value' }, 'options': { 'container_id': 'irstats2_downloads' } } ); GRAPH $frag->appendChild( $self->html_phrase( "top" ) ); $frag->appendChild( $session->make_element( 'div', id => 'irstats2_top' ) ); $frag->appendChild( $session->make_javascript( <<TABLE ) ); new EPJS_Stats_Table( { 'context': { 'range': '_ALL_', 'datatype': 'downloads', 'set_name': 'authors', 'set_value': '$set_value' }, 'options': { 'container_id': 'irstats2_top', 'top': 'eprint', 'limit': '5' } } ); TABLE return $frag; } 1; Brian D. Gregg Solutions Architect
| Manager Systems Development University of Pittsburgh | University Library System Address:
7500 Thomas Blvd. Room 129 Pittsburgh, PA 15208 Tel: (412) 648-3264 | Email:
bdgregg@pitt.edu | Fax: (412) 648-3585 |
- Prev by Date: [EP-tech] Advanced Search Page render of large number of choices (such as language).
- Next by Date: [EP-tech] Re: Advanced Search Page render of large number of choices (such as language).
- Previous by thread: [EP-tech] Advanced Search Page render of large number of choices (such as language).
- Next by thread: [EP-tech] EPrints User Group - Accommodation
- Index(es):