EPrints Technical Mailing List Archive

Message: #09157


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Problem template on views


Hi Jens,

I have just tried to recreate this on my test EPrints repository (running 3.4.4).  I was able to successfully create a type browse view to use a template and then revert back to the default template.  However, just changing the configuration and reloading the web server is insufficient, I also had to run generate_views to regenerate this view.  (I think "epadmin refresh_views ARCHIVE_ID" would have done a similar job).  However, I note two errors I encountered copying the exact configuration you used for the type browse view you provided:

1. The 'name' field does not exist for an eprint data object in my repository.  I therefore substituted this for creators_name and I was able to generate the menu page for this browse view.

2. When it came to running generate_views to update the template used, this produced the following error message:

  "Can only perform process_distinctby on multiple fields with the same field type"

I therefore removed the field "title" as it and "creators_name" are not the same type.  As I don't know what type the "name" field in your configuration is, I don't know if you will have a similar issue.

My advice would be to regenerate the view from the command line:

EPRINTS_PATH/bin/generate_views ARCHIVE_ID --view type

And see if you get any error messages.  If not, you should see the type browse view updated to use the new template.  If you do see an error, hopefully you should be able to make the appropriate changes to your browse view configuration to fix this.  Then you can try running generate_views again.

Regards

David Newman

On 09/01/2023 8:29 am, Jens Witzel via Eprints-tech wrote:
CAUTION: This e-mail originated outside the University of Southampton.

Hi list

 

Does anyone have experience with assigning templates to views? Please have a look at the following example views.pl. I am trying to set templates and it works for direct views like id=divisions, but not for id=type:

 

$c->{browse_views} = [

        {

                id => "divisions",

                allow_null => 1,

                menus => [

                        { fields => [ "divisions" ] },

                ],

                order => "-name/title",

                citation => "screen",

                variations => [

                                "type",

                ],

                template => 'views',

        },

        {       id=>"type",

                menus=>[

                        {

                                fields=>[ "type" ],

                                hideempty=>1,

                        },

                        {

                                fields=>[ "name", "title" ],

                                hideempty=>1,

                                mode => "sections",

                                open_first_section => 1,

                                group_range_function => "EPrints::Update::Views::cluster_ranges_30",

                                grouping_function => "EPrints::Update::Views::group_by_a_to_z",

                                new_column_at => [ 0 ],

                        },

                ],

                template => 'views',

        },

];

 

Thx
Jens

 

--
Jens Witzel
Zentrale Informatik
Universität Zürich
Stampfenbachstrasse 73
CH-8006 Zürich

mail:  jens.witzel@uzh.ch
phone: +41 44 63 56777
http://www.zi.uzh.ch

 


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/