Difference between revisions of "EPScript/Introduction"
(Added formats template to EPScripts/Introduction) |
(Formatting) |
||
Line 13: | Line 13: | ||
== Language Synopsis == | == Language Synopsis == | ||
− | $var{xxx} - get the value of | + | * '''<code>$var{xxx}</code>''' - get the value of <tt>xxx</tt> in <tt>$var</tt>. |
− | + | * '''<code>$var{xxx}{yyy}</code>''' - get the value of <tt>yyy</tt> in <tt>xxx</tt> in <tt>$var</tt>. | |
− | $var{xxx}{yyy} - get the value of | + | * '''<code>$var.xxx(yyy)</code>''' - call method <tt>xxx</tt> on <tt>$var</tt> with argument <tt>yyy</tt>. |
− | + | * '''<code>xxx(yyy)</code>''' - call method <tt>xxx</tt> with argument <tt>yyy</tt>. | |
− | $var.xxx(yyy) - call method | + | * '''<code>xxx</code>''' - get the value of field <tt>xxx</tt>. |
− | + | * '''<code>xxx OP yyy</code>''' - test whether <tt>xxx</tt> is OP <tt>yyy</tt> (=, !=, etc.) | |
− | xxx(yyy) - call method | + | * '''<code>xxx LOGIC yyy</code>''' - test whether <tt>xxx</tt> LOGIC <tt>yyy</tt> (and, or, not etc.) |
− | |||
− | xxx - get the value of field ' | ||
− | |||
− | xxx OP yyy - test whether | ||
− | |||
− | xxx LOGIC yyy - test whether | ||
=== Examples === | === Examples === | ||
− | + | * '''<code>$config{oai}{v2}{archive_id}</code>''' - gets the current OAI repository identifier. | |
− | $config{oai}{v2}{archive_id} - gets the current OAI repository identifier | + | * '''<code>$current_user{department}.is_set()</code>''' - returns true if the user's department field is set. |
− | + | * '''<code>published.one_of('submitted','published')</code>''' - returns true if published is 'unpub' or 'published'. | |
− | $current_user{department}.is_set() - returns true if the user's department field is set | + | * '''<code>$item{type} = 'patent'</code>''' - returns true if type from item is 'patent'. |
− | + | * '''<code>join($item{userid}.as_item(){collection},',')</code>''' - useful for extracting data in 'multiple' fields. For the owner of the eprint, return all 'collection's as a comma-separated string. See [[How to control eprint workflow based on a user field]]. | |
− | published.one_of('submitted','published') - returns true if published is 'unpub' or 'published' | ||
− | |||
− | $item{type} = 'patent' - returns true if type from item is 'patent' | ||
− | |||
− | join($item{userid}.as_item(){collection},',') - useful for extracting data in 'multiple' fields. For the owner of the eprint, return all 'collection's as a comma-separated string. See [[How to control eprint workflow based on a user field]] | ||
== Global Variables == | == Global Variables == |
Revision as of 02:38, 21 February 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
XML Configuration: EPScript - Control Format (EPC) - Citation - Workflow - Phrase - Template - XPAGE (static pages)
EPScript | ||
EPScript is a bespoke EPrints mini-scripting language. It is integrated in the XML markup for the definition of the following elements of an EPrints repository:
EPScript works with EPrints Control Format to allow the above elements to be dynamically generated. It allows for markup in the XML formats for these elements to call Perl function to perform complex processes, typically for a control or a rendering purpose.
Language Synopsis
$var{xxx}
- get the value of xxx in $var.$var{xxx}{yyy}
- get the value of yyy in xxx in $var.$var.xxx(yyy)
- call method xxx on $var with argument yyy.xxx(yyy)
- call method xxx with argument yyy.xxx
- get the value of field xxx.xxx OP yyy
- test whether xxx is OP yyy (=, !=, etc.)xxx LOGIC yyy
- test whether xxx LOGIC yyy (and, or, not etc.)
Examples
$config{oai}{v2}{archive_id}
- gets the current OAI repository identifier.$current_user{department}.is_set()
- returns true if the user's department field is set.published.one_of('submitted','published')
- returns true if published is 'unpub' or 'published'.$item{type} = 'patent'
- returns true if type from item is 'patent'.join($item{userid}.as_item(){collection},',')
- useful for extracting data in 'multiple' fields. For the owner of the eprint, return all 'collection's as a comma-separated string. See How to control eprint workflow based on a user field.
Global Variables
$config{xxx} - a value from the configuration.
$current_user - the current user, e.g., $current_user{username}
$current_lang - the id of the current language (such as 'en')
$item - the current item (usually an eprint, but not always, e.g., in citations or workflows for user objects), e.g., $item{eprintid}. If you just use eprintid it is a shortcut for $item{eprintid}