MePrintsInstall

From EPrints Documentation
Jump to: navigation, search

WARNING: THIS PAGE IS OUT-OF-DATE. MePrints is available from the Bazaar as a one-click install

This page provides technical instructions for installing the MePrints extension. To find out what MePrints is, and for an overview of MePrints features, see MePrintsOverview.

Installation (EPrints 3.1.3+)

Download the latest release to your local repository directory (eg. /opt/eprints3/archives/ARCHIVEID/).

Extract files:

tar xzvf meprints_xx.tgz

Install bin scripts

Edit the bin/generate_meprints file and check the include path on the first line. For example if you have installed EPrints in /var/lib/eprints3 change the line from:

#!/usr/bin/perl -w -I/opt/eprints3/perl_lib

to:

#!/usr/bin/perl -w -I/var/lib/eprints3/perl_lib

Install cgi scripts

Link the MePrints cgi scripts into the EPrints cgi directory:

ln -s /opt/eprints3/archives/ARCHIVEID/cgi/meprints/ /opt/eprints3/cgi/
ln -s /opt/eprints3/archives/ARCHIVEID/cgi/users/meprints/ /opt/eprints3/cgi/users/

Update database

Add the new MePrints user fields (defined in cfg/cfg.d/z_meprints.pl) to your repository database:

cd /opt/eprints3/
bin/epadmin update_database_structure ARCHIVEID --verbose

Apply MePrints patches

Apply the MePrints patch files:

cd /opt/eprints3
patch -R -p0 < archives/ARCHIVE_ID/meprints_1.0.patch

DO NOT APPLY THIS FOLLOWING PATCH ON EPrints 3.2, it is not required;

patch -R -p0 < archives/ARCHIVE_ID/meprints_dataset.patch #YOU DONT NEED THIS ON 3.2 trying it might break your install


These patches change two core EPrints modules:

  1. Update/Views.pm - allow view pages to be generated for any dataset (MePrints adds views over the public_profile_users dataset)
  2. DataSet.pm - add a new dataset called public_profile_users which is the set of all users who have opted to make their public profile page visible.

Getting Started

To activate MePrints, you will need to make some changes to your repository setup.

cfg/cfg.d/plugins.pl

You can skip this step on MePrints 1.3 and later.

Add the following lines to your cfg/cfg.d/plugins.pl configuration file: to use the MePrints homepage instead instead of the default EPrints "Profile" page:

$c->{plugins}->{"Screen::User::View"}->{appears}->{key_tools} = undef;
$c->{plugin_alias_map}->{"Screen::User::View"} = "Screen::User::Homepage";

cfg/cfg.d/user_fields_automatic.pl

Add the following lines to your cfg/cfg.d/user_fields_automatic.pl configuration file to update the MePrints public profile page automatically when a user changes his or her profile information,

$c->{user_fields_automatic} = sub {
        

        my $user = @_;

        ...

        if( defined $user->{changed} )
        {
                $user->remove_static();
        }

};

cfg/cfg.d/eprint_fields_automatic.pl

Add the following line to your cfg/cfg.d/eprint_fields_automatic.pl configuration file so that the MePrints public profile page automatically changes when an EPrint they have deposited is updated.

$eprint->get_user->remove_static;

cfg/cfg.d/urls.pl

To activate the canonical profile URLs, add "/profile/" to the rewrite_exceptions list in your cfg/cfg.d/urls.pl configuration file:

$c->{rewrite_exceptions} = [ '/cgi/', '/archive/', '/profile/' ];

cfg/apachevhost.conf

Add the following directives to your cfg/apachevhost.conf configuration file to enable canonical profile URLs (for example http://myrepository.com/profile/jsmith):

<Location "/profile">
  DefaultType 'text/html; charset=UTF-8'
  SetHandler perl-script
  PerlResponseHandler EPrints::Plugin::MePrints::MePrintsHandler
</Location>
  

On eprints 3.2 and later you will now need to regenerated your apache conf:

<eprints_root>/bin/generate_apacheconf --replace <archiveid>

cfg/workflows/user/default.xml

Add the following lines to your cfg/workflows/user/default.xml configuration file:

 <stage name="default">
   ...

   <component type="Field::Multi">
     <title><epc:phrase ref="user_section_personal" /></title>
     ...
   </component>

   <component type="Field::Multi">
     <title><epc:phrase ref="user_section_meprints" /></title>
     <field ref="profile_visibility" required="yes"/>
     <field ref="jobtitle"/>
     <field ref="expertise"/>
     <field ref="biography"/>
     <field ref="qualifications"/>
   </component>

cfg/citations/user/default.xml

Replace the default EPrints user citation with the MePrints citation (which includes a thumbnail of the user's profile picture) run:

cd /opt/eprints3/archives/ARCHIVEID
cp cfg/citations/user/default_with_thumbnail.xml cfg/citations/user/default.xml

Note: if you have already made changes to the default citation, you should examine both files and merge the MePrints changes into default.xml

Authorship in MePrints

Meprints 1.1 and later change the definition of ownership in the respository. This means that users who have the same email address as that listed in an items creators field belong to that user once the item enters the archive. This allows users to see statistics about papers they have authored without have to upload their own copy of the paper. You can return this to the eprints default by removing the cfg/cfg.d/authorship_meprints.pl file

Confirm Permissions

The last thing to do before using MePrints is to ensure that the permissions are correct on the meprints directory. To do this run the following commands, there probably will not be any output from running this command;

cd archives/ARCHIVEID
chmod g+wx meprints

If the permissions are not correct then you may encounter errors when using MePrints.

Testing

After applying all the changes above, restart Apache to activate MePrints.

Homepage

Log into your repository and should see your MePrints Homepage with default widget layout and profile picture.

Update profile

Click the Modify Profile button and add some information to the new MePrints fields (Job Title, Expertise, Biography, Qualifications). Set your Profile Visibility to Public. Click the Save button to return to your Homepage where the information you entered should now be displayed.

Upload photo

Click the Profile Picture button, choose a file and click Upload. You will be returned to your Homepage where your picture will now be displayed.

MePrints Widgets

By default your homepage displays several widgets (see user_homepage_defaults setting in cfg/cfg.d/z_meprints.pl). Try adding and removing widgets using the widget controls at the bottom of the screen. You can also rearrange widgets by dragging them up/down or between columns. To reset to the default widget layout click the Reset button in the widget control bar.

Public Profile

Enter the following URL to view your public profile page:

http://myrepository.com/profile/USERNAME

where USERNAME is your EPrints username. The layout of the MePrints widgets on your profile page is controlled by the user_profile_defaults setting in cfg/cfg.d/z_meprints.pl.

Go back to your MePrints homepage and click Modify Profile. Change some of your profile information (eg. Job Title, Expertise, Biography, Qualifications) and click Save. Return to your public profile page and check that your profile information has been updated.

MePrints Views

Run:

bin/generate_views ARCHIVEID --generate menus

Check http://myrepository.com/view/ - you should see 2 new views (you may want to link these into your site template).

Explore the view pages and check that you are listed. Make sure that you can click through from the browse listing to your public profile page.

MePrints search

Go to: http://myrepository.com/cgi/meprints/search

Check that you can find your profile using keywords from your user profile information (eg. expertise, qualifications).

Make sure that you can click through from the search result list to your public profile page.

MePrints Embeddable

If you want to use the default minimal style supplied for MePrints Embeddable then add the following code to the <head> section of your page:

<link rel="stylesheet" type="text/css" href="http://myrepository.com/style/meprints_embed.css"/>

MePrints Embeddable Widgets

It is possible to embed individual widgets that are viewable on your public profile on your own page. If you go to the public profile page you will see an embed links on the widgets that can be embedded. Click the link and instructions will appear telling you how to embed the widget on your page.

MePrints Embeddable Profile

Edit an HTML page and add the following code to the <head> section of the page:

<script type="text/javascript" src="http://myrepository.com/cgi/meprints/embed_js?username=USERNAME"></script>

Where USERNAME is your username on the repository.

Then inside the <body> section of the page you need to add the following code:

<div id="meprints_profile"></div>

This will be the location where your embeddable profile will go on your page.

MePrints for admins

Using an administrator account go to the Admin screen and choose Search users. Enter a username or other criteria to find at least one user account (not the account you are logged in with).

Make sure that you can click through from the results list to the user's homepage.

You should be able to modify the user's profile information by clicking Administer Account.

The widget layout should reflect the user's own preference, and you should not be able to make changes to their widget layout.

Hide Profile

Change the user's profile visibility to private.

Log out, and make sure that:

  1. the profile is no longer visible at /profile/USERNAME
  2. the profile no longer appears in search results
  3. the profile no longer appears in view pages
  4. the embeddable widget no longer displays the profile


You can also change the default visibility of MePrints profiles in cfg/cfg.d/z_meprints.pl by default profiles are public unless a user specifically makes there profile private. change

$c->{default_profile_behavior} = 1;

to

$c->{default_profile_behavior} = 0;

to make the default private profiles

Troubleshooting

Database errors

When dragging and dropping Widgets around, MePrints shows database errors in the error log:

DBD::mysql::st execute failed: Duplicate entry '1-0' for key 1 at /opt/eprints3/perl_lib/EPrints/Database.pm line 1192.
at /opt/eprints3/perl_lib/EPrints/Database.pm line 1192
EPrints::Database::insert('EPrints::Database::mysql=HASH(0x2b593e11ebd0)', 'user_items_fields', 'ARRAY(0x2b593bd00510)', ...

This is a known problem which does not seem to affect widget layout.

generate_views errors

Warnings

Use of uninitialized value $id in hash element at /usr/share/eprints3/perl_lib/EPrints/Database.pm line 2979.

See http://trac.eprints.org/trac/ticket/3537

EPrint citations

After hiding all previously public profiles, eprint citations were rendered in the view list instead of users'. (need to work out how to reproduce this)

Empty views

After hiding all previously public profiles and regenerating views, view pages still show expertise/department values.

This work is licensed under a Creative Commons Attribution 3.0 Unported License.