Difference between revisions of "API:EPrints/Extras"

From EPrints Documentation
Jump to: navigation, search
(New page: <!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost. -...)
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost.
+
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{Pod2Wiki}}{{API:Source|file=EPrints/Extras.pm|package_name=EPrints::Extras}}[[Category:API|Extras]]<!-- End of Pod2Wiki -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Extras.pm|package_name=EPrints::Extras}}[[Category:API|EXTRAS]]<div><!-- Edit below this comment -->
<!-- Pod2Wiki=head_name -->=NAME=
+
 
 +
 
 +
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
 +
==NAME==
 
'''EPrints::Extras''' - Alternate versions of certain methods.
 
'''EPrints::Extras''' - Alternate versions of certain methods.
  
<!-- End of Pod2Wiki -->
+
<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_description -->=DESCRIPTION=
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_description -->
 +
==DESCRIPTION==
 
This module contains methods provided as alternates to the default render or input methods.
 
This module contains methods provided as alternates to the default render or input methods.
  
<!-- End of Pod2Wiki -->
+
<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_methods -->=METHODS=
+
<span style='display:none'>User Comments</span>
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_render_xhtml_field -->==render_xhtml_field==
 
  
  $xhtml = EPrints::Extras::render_xhtml_field( $session, $field,$value )
 
  
Return an XHTML DOM object of the contents of $value. In the case of an error parsing the XML in $value return an XHTML DOM object describing the problem.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_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%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
This is intented to be used by the render_single_value metadata  field option, as an alternative to the default text renderer.  
+
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_xhtml_field -->
 +
===render_xhtml_field===
 +
 
 +
$xhtml = EPrints::Extras::render_xhtml_field( $session, $field, $value )
 +
Returns an XHTML DOM object of the contents of <tt>$value</tt>. In the case  of an error parsing the XML in <tt>$value</tt> return an XHTML DOM object  describing the problem.
 +
 
 +
This is intented to be used by the <tt>render_single_value</tt> metadata  field option, as an alternative to the default text renderer.  
  
 
This allows through any XML element, so could cause problems if people start using SCRIPT to make pop-up windows. A later version may allow a limited set of elements only.
 
This allows through any XML element, so could cause problems if people start using SCRIPT to make pop-up windows. A later version may allow a limited set of elements only.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_render_preformatted_field -->==render_preformatted_field==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_preformatted_field -->
 +
===render_preformatted_field===
 +
 
 +
$xhtml = EPrints::Extras::render_preformatted_field( $session, $field, $value )
 +
Returns an XHTML DOM object of the contents of <tt>$value</tt>.
 +
 
 +
The contents of <tt>$value</tt> will be rendered in an HTML &lt;pre&gt; element.
 +
 
 +
<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_render_hightlighted_field -->
 +
===render_hightlighted_field===
 +
 
 +
$xhtml = EPrints::Extras::render_hightlighted_field( $session, $field, $value )
 +
Return an XHTML DOM object of the contents of <tt>$value</tt>.
 +
 
 +
The contents of <tt>$value</tt> will be rendered in an HTML &lt;div&gt; element  with class <tt>ep_highlight</tt>.
 +
 
 +
<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_render_lookup_list -->
 +
===render_lookup_list===
 +
 
 +
$xhtml = EPrints::Extras::render_lookup_list( $session, $rows )
 +
Returns an XHTML DOM object of an unordered list (&lt;ul&gt;) with list  items (&lt;li&gt;) provided by the <tt>$rows</tt> array reference.
 +
 
 +
<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 -->
  
  $xhtml = EPrints::Extras::render_preformatted_field( $session, $field, $value )
 
  
Return an XHTML DOM object of the contents of $value.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_url_truncate_end -->
 +
===render_url_truncate_end===
  
The contents of $value will be rendered in an HTML &lt;pre&gt; element.  
+
$xhtml = EPrints::Extras::render_url_truncate_end( $session, $field, $value )
 +
Returns and XHTML DOM object of a hyperlink for the URL provided by  <tt>$value</tt> but truncate the end part if it gets longer than 50  characters.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_render_hightlighted_field -->==render_hightlighted_field==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $xhtml = EPrints::Extras::render_hightlighted_field( $session, $field, $value )
 
  
Return an XHTML DOM object of the contents of $value.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_url_truncate_middle -->
 +
===render_url_truncate_middle===
  
The contents of $value will be rendered in an HTML &lt;pre&gt; element.  
+
$xhtml = EPrints::Extras::render_url_truncate_middle( $session, $field, $value )
 +
Returns and XHTML DOM object of a hyperlink for the URL provided by <tt>$value</tt> but truncate the middle part if it gets longer than 50 characters.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_render_url_truncate_end -->==render_url_truncate_end==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $xhtml = EPrints::Extras::render_url_truncate_end( $session, $field, $value )
 
  
Hyper link the URL but truncate the end part if it gets longer  than 50 characters.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_related_url -->
 +
===render_related_url===
  
<!-- End of Pod2Wiki -->
+
$xhtml = EPrints::Extras::render_related_url( $session, $field, $value )
<!-- Pod2Wiki=item_render_url_truncate_middle -->==render_url_truncate_middle==
+
Hyper link the related URL named by given type or at the end truncated  link (if it gets longer than 40 characters) otherwise.
  
  $xhtml = EPrints::Extras::render_url_truncate_middle( $session, $field, $value )
+
<tt>$value</tt> is an array reference of hash references containing rows of related URL an related URL type.
  
Hyper link the URL but truncate the middle part if it gets longer than 50 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 -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_render_related_url -->==render_related_url==
 
  
  $xhtml = EPrints::Extras::render_related_url( $session, $field, $value )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_english_title_orderkey -->
 +
===english_title_orderkey===
  
Hyper link the URL but truncate the middle part if it gets longer than 50 characters.
+
$orderkey = EPrints::Extras::english_title_orderkey( $field, $value, $dataset )
 +
Strip the leading a/an/the and any non alpha numerics from the start  of a orderkey <tt>$value</tt>. Suitable for <tt>make_single_value_orderkey</tt> on the title field.
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_english_title_orderkey -->==english_title_orderkey==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $orderkey = EPrints::Extras::english_title_orderkey( $field, $value, $dataset )
 
  
Strip the leading a/an/the and any non alpha numerics from the start of a orderkey value. Suitable for make_single_value_orderkey on the title field.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_possible_doi -->
 +
===render_possible_doi===
  
<!-- End of Pod2Wiki -->
+
$xhtml_dom = EPrints::Extras::render_possible_doi( $field, $value, $dataset )
<!-- Pod2Wiki=item_render_possible_doi -->==render_possible_doi==
+
If <tt>$value</tt> looks like it contains a DOI then returns a DOI link XHTML DOM object. Otherwise just returns an XHTML DOM object of the text in <tt>$value</tt>.
  
  $xhtml_dom = EPrints::Extras::render_possible_doi( $field, $value, $dataset )
+
<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 -->
  
If the field looks like it contains a DOI then link it.
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_undocumented_methods -->=UNDOCUMENTED METHODS=
+
</div>
{{API:Undocumented Methods}}<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=head_copyright -->
<!-- Pod2Wiki=item_render_highlighted_field -->==render_highlighted_field==
+
==COPYRIGHT==
 +
{{API:Copyright}}
 +
<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 -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_render_lookup_list -->==render_lookup_list==
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
+
</div>
 +
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Latest revision as of 01:21, 12 January 2022

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

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


NAME

EPrints::Extras - Alternate versions of certain methods.

User Comments


DESCRIPTION

This module contains methods provided as alternates to the default render or input methods.

User Comments


METHODS

User Comments


render_xhtml_field

$xhtml = EPrints::Extras::render_xhtml_field( $session, $field, $value )

Returns an XHTML DOM object of the contents of $value. In the case of an error parsing the XML in $value return an XHTML DOM object describing the problem.

This is intented to be used by the render_single_value metadata field option, as an alternative to the default text renderer.

This allows through any XML element, so could cause problems if people start using SCRIPT to make pop-up windows. A later version may allow a limited set of elements only.

User Comments


render_preformatted_field

$xhtml = EPrints::Extras::render_preformatted_field( $session, $field, $value )

Returns an XHTML DOM object of the contents of $value.

The contents of $value will be rendered in an HTML <pre> element.

User Comments


render_hightlighted_field

$xhtml = EPrints::Extras::render_hightlighted_field( $session, $field, $value )

Return an XHTML DOM object of the contents of $value.

The contents of $value will be rendered in an HTML <div> element with class ep_highlight.

User Comments


render_lookup_list

$xhtml = EPrints::Extras::render_lookup_list( $session, $rows )

Returns an XHTML DOM object of an unordered list (<ul>) with list items (<li>) provided by the $rows array reference.

User Comments


render_url_truncate_end

$xhtml = EPrints::Extras::render_url_truncate_end( $session, $field, $value )

Returns and XHTML DOM object of a hyperlink for the URL provided by $value but truncate the end part if it gets longer than 50 characters.

User Comments


render_url_truncate_middle

$xhtml = EPrints::Extras::render_url_truncate_middle( $session, $field, $value )

Returns and XHTML DOM object of a hyperlink for the URL provided by $value but truncate the middle part if it gets longer than 50 characters.

User Comments


render_related_url

$xhtml = EPrints::Extras::render_related_url( $session, $field, $value )

Hyper link the related URL named by given type or at the end truncated link (if it gets longer than 40 characters) otherwise.

$value is an array reference of hash references containing rows of related URL an related URL type.

User Comments


english_title_orderkey

$orderkey = EPrints::Extras::english_title_orderkey( $field, $value, $dataset )

Strip the leading a/an/the and any non alpha numerics from the start of a orderkey $value. Suitable for make_single_value_orderkey on the title field.

User Comments


render_possible_doi

$xhtml_dom = EPrints::Extras::render_possible_doi( $field, $value, $dataset )

If $value looks like it contains a DOI then returns a DOI link XHTML DOM object. Otherwise just returns an XHTML DOM object of the text in $value.

User Comments


COPYRIGHT

© Copyright 2022 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE

This file is part of EPrints 3.4 http://www.eprints.org/.

EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.

EPrints 3.4 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 3.4. If not, see http://www.gnu.org/licenses/.

User Comments