Recent Changes in the OrganicEprintsIssues group   -   WikiHelp   -   Search ecowiki.org:

« 00002 · Edit Form · 00004 »

Summary: Author name links to user record?
Type: Feature

Priority (1<5) = 3
Status: Assigned

Raised by: hal
Project:
Related to
Date opened: 2005–07–05
Assigned to Hugo Alroe
Hours used (estimates in brackets) =
Date closed:

Description:
31.8.2010: Julia Meier and Helga: Still relvant ?
4.8.2011: Ilse to discuss with Hugo


Eprints tech list 13jun2005.
Is it possible to make a link from the author name in browse views and abstract pages to the contact details in the user record (if this author is a registered user, that is)? I am thinking about the option to make users (if they wish) fill in the appropriate user ID in the author.id field, and, if the field is filled, make the link. Will this be possible?

Answer 16jun2005

yes but it’ll take a bit of fiddling…
You’ll need to create a render_value subroutine for the authors field.
Something like this…

    { name => “authors”, type => “name”, multiple => 1, hasid => 1, input_boxes => 6, render_value=>\&render_names },

just add the render_value bit, then lower in the
ArchiveMetadataFieldsConfig.pm file add the subroutine:

 sub render_names
 {
    my( $session, $field, $value, $alllangs, $nolink ) = @_;

    my $list = $session→make_doc_fragment;
    my $len = scalar @;
    for( my $i=0; $i<$len; ++$i )
    {
       my $hname = $field→render_single_value( $session, $value→[$i]→{main} );

        if( $i > 0 )
        {
            # Need joiner.
            my $join = “, “;
            if( $i == $len-1 )
            {
                $join = “ and “;
            }
            $list→appendChild( $session→make_text( $join ));
        }

       my $user = E Prints?::User::user_with_username( $value→[$i]→{id};
       if( defined $user )
       {
             my $a = $session→render_link( $user→get_url );
             $a→appendChild( $hname );
             $list→appendChild( $a );
       }
       else
       {
           $list→appendChild( $hname );
       }  
    }
    return $list;
 }

Untested code, test etc.


Links of the type

 http://orgprints.org/perl/users/staff/view_user?userid=2

can be used to see the user record.
Note that the right to see user records is restricted to registered users.

New Issue

Open Issues

(Edit SideBar)


Organic Eprints Wiki



Based on PmWiki

(Edit SideBar)

Page last modified on August 03, 2011, at 09:13 AM - Edit Page