Difference between revisions of "MePrintsInstall"

From EPrints Documentation
Jump to: navigation, search
(cfg/apachevhost.conf)
(cfg/apachevhost.conf)
Line 132: Line 132:
 
Two additions need to be made to this file for MePrints.
 
Two additions need to be made to this file for MePrints.
  
'''
+
'''The first allows you to have URLs of the form http://example.com/profile/username or http://example.com/profile/userid link straight to user profiles. All you need to do for this is add the following to you cfg/apachevhost.conf file:'''
The first allows you to have URLs of the form http://example.com/profile/<username> or http://example.com/profile/<userid> link straight to user profiles. All you need to do for this is add the following to you cfg/apachevhost.conf file:
+
  
 
<pre>
 
<pre>
Line 139: Line 138:
 
</pre>
 
</pre>
  
This will not override any of the other URLs in your system, although if you have another PerlTransHandler defined before this definition that uses the /profile style url then you will have problems as this handler will never be reached.
+
'''This will not override any of the other URLs in your system, although if you have another PerlTransHandler defined before this definition that uses the /profile style url then you will have problems as this handler will never be reached.'''
'''
+
  
 
The second ensures that profile pages render correctly. Add the following lines to your cfg/apachevhost.conf configuration file:
 
The second ensures that profile pages render correctly. Add the following lines to your cfg/apachevhost.conf configuration file:

Revision as of 23:04, 21 September 2009

For an overview of MePrints features, see MePrintsFeatures.

Installation (EPrints 3.1+)

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

Patches

Apply the patchfile included with MePrints: TODO

perl_lib/EPrints/DataSet.pm

MePrints introduces a new dataset containing all users with a public profile. To activate the new dataset:

Find the line:

my $INFO =

and replace with:

our $INFO =

Find the lines:

sub get_sql_dataset_ids
{
       return( qw/ import metafield cachemap message loginticket eprint user document saved_search subject history access request / );
}

and replace with:

sub get_sql_dataset_ids
{
       return( qw/ import metafield cachemap message loginticket eprint user document saved_search subject history access request public_profile_users / );
}

perl_lib/EPrints/Update/Views.pm

Add support for MePrints views:

TODO

perl_lib/EPrints/Apache/Rewrite.pm

This change will no longer be required if the new Rewrite gets used. If the new rewrite is used then a change needs to be made in cfg/apachevhost.conf.

Add support for MePrints profile URLs (eg. http://my.repository.org/profile/USERNAME):

Find the line:

$r->filename( $repository->get_conf( "htdocs_path" )."/".$lang.$localpath );

Replace it with:

        if( $uri =~ m! ^/profile\/([0-9a-z]+)(.*)$ !x )
        {
                my $session = new EPrints::Session(2);
                my $user = EPrints::DataObj::User::user_with_username( $session, $1 );
                if( defined $user )
                {
                        if( $user->get_value( 'profile_visibility' ) eq "public")
                        {
                                EPrints::Update::Profiles::update( $repository, $user );
                                $r->filename( $repository->get_conf( "archiveroot" )."/meprints/".$user->get_id."/profile/index.html" );
                        }
                        else
                        {
                                return FORBIDDEN;
                        }
                }
        }
        else
        {
                $r->filename( $repository->get_conf( "htdocs_path" )."/".$lang.$localpath );
        }

Getting Started

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

cfg/cfg.d/plugins.pl

To use the MePrints homepage instead instead of the default EPrints page, add the following lines to your cfg/cfg.d/plugins.pl configuration file:

$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

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

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

cfg/apachevhost.conf

Two additions need to be made to this file for MePrints.

The first allows you to have URLs of the form http://example.com/profile/username or http://example.com/profile/userid link straight to user profiles. All you need to do for this is add the following to you cfg/apachevhost.conf file:

PerlTransHandler EPrints::Plugin::MePrints::Apache::Rewrite

This will not override any of the other URLs in your system, although if you have another PerlTransHandler defined before this definition that uses the /profile style url then you will have problems as this handler will never be reached.

The second ensures that profile pages render correctly. Add the following lines to your cfg/apachevhost.conf configuration file:

<Directory "/opt/eprints3/archives/ARCHIVEID/meprints">
  SetHandler perl-script
  PerlResponseHandler EPrints::Apache::Template::handler
</Directory>

If you don't do this you may find that the interface is incorrect on the profile page. It will indicate that you are logged out when viewing a static page despite the fact that you are logged in.

cfg/workflows/user/default.xml

To allow users to choose whether their profile is public or private add the following lines to your cfg/workflows/user/default.xml 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

To replace the default EPrints user citation with the MePrints thumbnail citation:

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 will want to examine both files and merge the MePrints changes into default.xml

Testing

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

Homepage

Log into your repository and should see your MePrints Homepage.

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.

TODO

Change profile information, check profile page gets updated.

MePrints Views

Run:

bin/generate_views ARCHIVEID --generate menus

Check http://my.repository.org/views/ - you should see 2 extra views. You may want to link these into your template.

MePrints search

Go to:

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

TODO

MePrints for admins

Hide Profile

BUGS

  • change phrase "Homepage" to "MePrints Homepage"
  • QuickLinks widget should use render_action_list_bar to display available actions below the user details/picture (links currently have BAD URLs)
  • when an admin searches for a user account, they see their OWN homepage, not the user's (use $processor->{user} not $session->current_user
  • the widget control bar (add/remove/reset) should only be available if $processor->{user} = $session->current_user
  • add "user_section_meprints" phrase -> "MePrints" !ADDED!
  • phrase "Plugin/Screen/User/UploadPicture:upload_success missing !ADDED!
  • cgi/meprints/profile - return() line 9? !FIXED!
  • wrong URL in citations/user/default_with_thumbnail.xml !FIXED in rc1-4!
  • missing phrase "Plugin/Screen/Public/MePrintsSearch:title" !ADDED!
  • searching using cgi/meprints/search gives Internal Server Error !FIXED in rc1-4!
  • bin/generate_views ARCHIVEID - This yields an unblessed reference error after installing everything. (The message is; Can't call method "is_browsable" on unblessed reference at /usr/share/eprints3/perl_lib/EPrints/Update/Views.pm line 1041.) !FIXED in rc1-4!

Troubleshooting