⧼vector-jumptocontent⧽

API:EPrints/Update/Views: Difference between revisions

From EPrints Documentation
No edit summary
No edit summary
 
Line 8: Line 8:
'''EPrints::Update::Views''' - Update view pages
'''EPrints::Update::Views''' - Update view pages


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_synopsis -->
<!-- Pod2Wiki=head_synopsis -->
==SYNOPSIS==
==SYNOPSIS==
  $c-&gt;{browse_views} = [
<source lang="perl">$c->{browse_views} = [
    {
{
      id =&gt; "year",
id => "year",
      order =&gt; "creators_name/title",
order => "creators_name/title",
      menus =&gt; [
menus => [
        {
{
          fields =&gt; [qw( date;res=year )],
fields => [qw( date;res=year )],
          reverse_order =&gt; 1,
reverse_order => 1,
          allow_null =&gt; 1,
allow_null => 1,
          new_column_at =&gt; [10, 10]
new_column_at => [10, 10]
        },
},
      ],
],
      variations =&gt; [qw(
variations => [qw(
        creators_name;first_letter
creators_name;first_letter
        type
type
        DEFAULT
DEFAULT
      )],
)],
    },
},
  ];
];</source>
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_description -->
<!-- Pod2Wiki=head_description -->
==DESCRIPTION==
==DESCRIPTION==
Update the browse-by X web pages on demand.
Update the browse-by X web pages on demand.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_options -->
<!-- Pod2Wiki=head_options -->
==OPTIONS==
==OPTIONS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
* id
<span style='display:none'>User Comments</span>
: Set the unique id for the view, which in the URL will be /view/[id]/...
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_id -->
===id===
 
Set the unique id for the view, which in the URL will be /view/[id]/...
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_dataset_archive -->
===dataset = "archive"===
 
Set the dataset id to retrieve records from.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_menus -->
===menus = [ ... ]===


An array of hierarchical menu choices.
* dataset = "archive"
: Set the dataset id to retrieve records from.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
* menus = [ ... ]
<span style='display:none'>User Comments</span>
: An array of hierarchical menu choices.
<!-- Edit below this comment -->


* order = ""
: Order matching records by the given field structure.


<!-- Pod2Wiki= -->
* variations = [qw( DEFAULT )]
</div>
: Add group-bys on additional pages. "DEFAULT" shows all of the records in a list.
<!-- Pod2Wiki=item_order -->
===order = ""===


Order matching records by the given field structure.
* nolink = 0
: Don't show a link to this view from the /view/ page.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_qw -->
===variations = [qw( DEFAULT )]===
Add group-bys on additional pages. "DEFAULT" shows all of the records in a list.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_nolink_0 -->
===nolink = 0===
Don't show a link to this view from the /view/ page.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_menus -->
<!-- Pod2Wiki=head_menus -->
===Menus===
===Menus===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
* allow_null = 0
<span style='display:none'>User Comments</span>
* fields = [qw( ... )]
<!-- Edit below this comment -->
* new_column_at = [x, y]
 
* reverse_order = 0
* mode = "default"
: Use "sections" to cause the menu to be broken into sections.


<!-- Pod2Wiki= -->
* open_first_section = 1
</div>
: Open the first section of the browse menu.
<!-- Pod2Wiki=item_allow_null_0 -->
====allow_null = 0====


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_qw -->
====fields = [qw( ... )]====
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_new_column_at_x_y -->
====new_column_at = [x, y]====
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_reverse_order_0 -->
====reverse_order = 0====
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_mode_default -->
====mode = "default"====
Use "sections" to cause the menu to be broken into sections.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_open_first_section_1 -->
====open_first_section = 1====
Open the first section of the browse menu.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_variations -->
<!-- Pod2Wiki=head_variations -->
===Variations===
===Variations===
Format is:
Format is:


  [fieldname];[options]
<pre>  [fieldname];[options]</pre>
 
 
Where options is:
Where options is:


  [option1],[option2],[option3]=[value]
<pre>  [option1],[option2],[option3]=[value]</pre>
 
 
If no value is given the option is implicitly 1 (enable).
If no value is given the option is implicitly 1 (enable).


  creators_name;first_letter,allow_null=1
<pre>  creators_name;first_letter,allow_null=1</pre>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_allow_null_0 -->
====allow_null = 0====
 
Show items that have no value(s) for the selected field.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_cloud -->
====cloud====
 
Render a "Tag Cloud" of links, where the individual links are scaled by their frequency of occurence.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_cloudmin_80_cloudmax_200 -->
====cloudmin = 80, cloudmax = 200====
 
Scale cloud tag links by between cloudmin and cloudmax percent from normal text size.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_first_letter -->
====first_letter====
 
Implies truncate=1 and first_value.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_first_value -->
====first_value====
 
Only group-by on the first value in a multiple field.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
* allow_null = 0
<span style='display:none'>User Comments</span>
: Show items that have no value(s) for the selected field.
<!-- Edit below this comment -->


* cloud
: Render a "Tag Cloud" of links, where the individual links are scaled by their frequency of occurence.


<!-- Pod2Wiki= -->
* cloudmin = 80, cloudmax = 200
</div>
: Scale cloud tag links by between cloudmin and cloudmax percent from normal text size.
<!-- Pod2Wiki=item_jump_none_plain_default -->
====jump = none|plain|default====


Hide the jump-to links, render just the links or render as a phrase ('Update/Views:jump_to').
* first_letter
: Implies truncate=1 and first_value.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
* first_value
<span style='display:none'>User Comments</span>
: Only group-by on the first value in a multiple field.
<!-- Edit below this comment -->


* jump = none|plain|default
: Hide the jump-to links, render just the links or render as a phrase ('Update/Views:jump_to').


<!-- Pod2Wiki= -->
* tags
</div>
: Treat the field value as a comma or semi-colon separated list of values.
<!-- Pod2Wiki=item_tags -->
====tags====


Treat the field value as a comma or semi-colon separated list of values.
* truncate = n
: Truncate the value to at most n characters.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_truncate_n -->
====truncate = n====
Truncate the value to at most n characters.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_methods -->
<!-- Pod2Wiki=head_methods -->
==METHODS==
==METHODS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=head_update_view_file -->
<span style='display:none'>User Comments</span>
===update_view_file===
<!-- Edit below this comment -->
 


<!-- Pod2Wiki= -->
<source lang="perl">$filename = update_view_file( $repo, $langid, $localpath, $uri )
</div>
<!-- Pod2Wiki=item_update_view_file -->
===update_view_file===


$filename = update_view_file( $repo, $langid, $localpath, $uri )
</source>
This is the function which decides which type of view it is:
This is the function which decides which type of view it is:


  * the main menu of views
<pre>  * the main menu of views
   * the top level menu of a view
   * the top level menu of a view
   * the sub menu of a view
   * the sub menu of a view
   * a page within a single value of a view
   * a page within a single value of a view</pre>
 
 
Does not update the file if it's not needed.
Does not update the file if it's not needed.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_pseudo_views_class -->
<!-- Pod2Wiki=head_pseudo_views_class -->
===Pseudo-Views Class===
===Pseudo-Views Class===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_name -->
<!-- Pod2Wiki=item_name -->
===name===
====name====


$desc = $view-&gt;name
<source lang="perl">$desc = $view->name
 
</source>
Returns a human-readable name of this view (for debugging).
Returns a human-readable name of this view (for debugging).


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_update_view_by_path -->
<!-- Pod2Wiki=item_update_view_by_path -->
===update_view_by_path===
====update_view_by_path====
 
<source lang="perl">$view->update_view_by_path( %opts )


$view-&gt;update_view_by_path( %opts )
</source>
Updates the view source files.
Updates the view source files.


Options:
Options:


  on_write - callback called with the filename written
<pre>  on_write - callback called with the filename written
   langid - language to write
   langid - language to write
   do_menus - suppress generation of menus
   do_menus - suppress generation of menus
   do_lists - suppress generation of lists
   do_lists - suppress generation of lists</pre>
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_copyright -->
<!-- Pod2Wiki=head_copyright -->
==COPYRIGHT==
==COPYRIGHT==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Copyright 2000-2011 University of Southampton.
<span style='display:none'>User Comments</span>
 
: This file is part of EPrints http://www.eprints.org/.
 
: EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 
: EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 
: You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.
 
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
<!-- Edit below this comment -->

Latest revision as of 09:57, 22 January 2013

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Update::Views - Update view pages


SYNOPSIS

$c->{browse_views} = [
	{
		id => "year",
		order => "creators_name/title",
		menus => [
			{
				fields => [qw( date;res=year )],
				reverse_order => 1,
				allow_null => 1,
				new_column_at => [10, 10]
			},
		],
		variations => [qw(
			creators_name;first_letter
			type
			DEFAULT
		)],
	},
];


DESCRIPTION

Update the browse-by X web pages on demand.


OPTIONS

  • id
Set the unique id for the view, which in the URL will be /view/[id]/...
  • dataset = "archive"
Set the dataset id to retrieve records from.
  • menus = [ ... ]
An array of hierarchical menu choices.
  • order = ""
Order matching records by the given field structure.
  • variations = [qw( DEFAULT )]
Add group-bys on additional pages. "DEFAULT" shows all of the records in a list.
  • nolink = 0
Don't show a link to this view from the /view/ page.


Menus

  • allow_null = 0
  • fields = [qw( ... )]
  • new_column_at = [x, y]
  • reverse_order = 0
  • mode = "default"
Use "sections" to cause the menu to be broken into sections.
  • open_first_section = 1
Open the first section of the browse menu.


Variations

Format is:

  [fieldname];[options]

Where options is:

  [option1],[option2],[option3]=[value]

If no value is given the option is implicitly 1 (enable).

  creators_name;first_letter,allow_null=1
  • allow_null = 0
Show items that have no value(s) for the selected field.
  • cloud
Render a "Tag Cloud" of links, where the individual links are scaled by their frequency of occurence.
  • cloudmin = 80, cloudmax = 200
Scale cloud tag links by between cloudmin and cloudmax percent from normal text size.
  • first_letter
Implies truncate=1 and first_value.
  • first_value
Only group-by on the first value in a multiple field.
  • jump = none|plain|default
Hide the jump-to links, render just the links or render as a phrase ('Update/Views:jump_to').
  • tags
Treat the field value as a comma or semi-colon separated list of values.
  • truncate = n
Truncate the value to at most n characters.


METHODS

update_view_file

$filename = update_view_file( $repo, $langid, $localpath, $uri )

This is the function which decides which type of view it is:

  * the main menu of views
  * the top level menu of a view
  * the sub menu of a view
  * a page within a single value of a view

Does not update the file if it's not needed.


Pseudo-Views Class

name

$desc = $view->name

Returns a human-readable name of this view (for debugging).


update_view_by_path

$view->update_view_by_path( %opts )

Updates the view source files.

Options:

  on_write - callback called with the filename written
  langid - language to write
  do_menus - suppress generation of menus
  do_lists - suppress generation of lists


COPYRIGHT

Copyright 2000-2011 University of Southampton.
This file is part of EPrints http://www.eprints.org/.
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.