User Tools

Site Tools


en:user:gs3_list_of_format_options

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:user:gs3_list_of_format_options [2019/09/24 01:25] – [Options] kjdonen:user:gs3_list_of_format_options [2024/03/11 20:16] (current) – [Collection/Interface Text Strings] kjdon
Line 1: Line 1:
 +
 +
 +
 ====== List of Greenstone3 Format Items ====== ====== List of Greenstone3 Format Items ======
  
-This page describes all the things that can go into the <format> element in the collectionConfig.xml file - or can be added in the Format->FormatFeatures pane in GLI. There are three main types of format itemsoptions, parameter defaults, and templates. Options give you switch to turn something on/off or change the look, parameter defaults let you change the default value of eg search parameters (stemming, casefolding etc) while templates let you describe what output you want.+This page describes all the things that can go into the <format> element in the collectionConfig.xml file - or can be added in the Format->FormatFeatures pane in GLI.  
 + 
 +Format items include options, parameter defaults, and templates. Templates can include standard XSL, but we have defined set of gsf elements which are shortcuts to XSL. 
 + 
 +''<gsf:xxx/>'' formatting items are converted to XSLT by the ''web/interfaces/default/transform/config_format.xsl'' file. 
 + 
 + 
    
 See also the description of [[en:user:gs3_format_statements|format statements]], and some [[en:user:gs3_sample_format_statements | sample format statements]] for miscellaneous tasks. See also the description of [[en:user:gs3_format_statements|format statements]], and some [[en:user:gs3_sample_format_statements | sample format statements]] for miscellaneous tasks.
  
-''<gsf:xxx/>'' formatting items are converted to XSLT by the ''web/interfaces/default/transform/config_format.xsl'' file. 
  
-===== Options =====+===== Top Level Elements ===== 
 + 
 +There are three main types of format items: options, parameter defaults, and templates. Options give you a switch to turn something on/off or change the look, parameter defaults let you change the default value of eg search parameters (stemming, casefolding etc) while templates let you describe what output you want. 
 + 
 +==== Options ====
  
-There are a few options available. They are specified by adding <gsf:option name="xxx" value="yyy"/> to the appropriate format element in GLI, or in the collectionConfig.xml file.+There are a few options available. They are specified by adding **<gsf:option name="xxx" value="yyy"/>** to the appropriate format element in GLI, or in the collectionConfig.xml file.
  
 ^Option name^Values^Format^Description^ ^Option name^Values^Format^Description^
Line 29: Line 42:
 |viewSelection|false|display|If false, will not show the text/image/default view selector for paged image documents. | |viewSelection|false|display|If false, will not show the text/image/default view selector for paged image documents. |
 |slideShow|false|display|If false, will not display the slideshow option for paged image documents | |slideShow|false|display|If false, will not display the slideshow option for paged image documents |
-|[[user_comments|allowUserComments]]|true|display|If set to true, will allow users to add comments to public collections. Users need not have editing permissions for a collection they wish to add comments to. They just need to have an account on that Greenstone Digital Library.| +|[[user_comments|allowUserComments]]|true|display|If set to true, will allow users to add comments to public collections. Users need not have editing permissions for a collection they wish to add comments to. They just need to have an account on that Greenstone Digital Library. (was AllowUserComments prior to 3.10)
-|[[en:user_advanced:web_editor|allowDocumentEditing]]|true|display|If set to true (or is absent), will allow authenticated users (that have been assigned the correct group) the ability to edit document text and metadata through the web site. Set this to false to disable document editing. (since 3.09)|+|[[en:user_advanced:web_editor|allowDocumentEditing]]|true|display|If set to true (or is absent), will allow authenticated users (that have been assigned the correct group) the ability to edit document text and metadata through the web site. Set this to false to disable document editing. (since 3.09, was AllowDocumentEditing for 3.09)| 
 +|[[en:user_advanced:web_editor|allowMapGPSEditing]]|true|display|If set to true (or is absent), will allow authenticated users (that have been assigned the correct group) the ability to add and edit GPS data through the web site. Set this to false to disable the Map GPS editing controls. (since 3.10)|
  
-===== Parameter Defaults =====+==== Parameter Defaults ====
  
 Inside a format element you can set default values for parameters, using the following syntax Inside a format element you can set default values for parameters, using the following syntax
Line 45: Line 59:
 To see what parameters you have that you can change, you can look at the page source for a query page and see what names and values the form elements have. To see what parameters you have that you can change, you can look at the page source for a query page and see what names and values the form elements have.
  
-These can be added inside the <search> and <display> format statements inside GLI (or directly added to the collectionConfig.xml file). +These can be added inside the <search> and <display> format statements using GLI or directly editing  the collectionConfig.xml file).
-===== Templates =====+
  
-^Format Element^Greenstone2 equivalent^Description^ +==== Templates ==== 
-|     ||| + 
-|''<gsf:template match="documentNode"></gsf:template>'' |Templates are the containers that hold all format statements. The value of ''match'' determines which part of the page content the template applies to.+Templates are the containers that hold all format statements. The value of ''match'' determines which part of the page content the template applies to. For example,  
 +''<gsf:template match="documentNode">template definition </gsf:template>''  matches a documentNode element.
  
-===== Links =====+===== What can go inside a template? ===== 
 +==== Links ====
  
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
Line 71: Line 86:
 |''<gsf:link type='equivdoc'/>'' |  |Link to equivalent documents| |''<gsf:link type='equivdoc'/>'' |  |Link to equivalent documents|
  
-===== Icons and Images =====+==== Icons and Images ====
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
Line 87: Line 102:
 |''<gsf:image type='cover'/>''| ''<img src='[DocImage]'/>'' | Displays the document's cover image (if there is one)| |''<gsf:image type='cover'/>''| ''<img src='[DocImage]'/>'' | Displays the document's cover image (if there is one)|
 |''<gsf:image type='cover' height='40'/>''| ''[<img src='[DocImage]' height='40'/>'' | <gsf:image> can take any html img attributes - they will be copied to the resulting <img> element.| |''<gsf:image type='cover' height='40'/>''| ''[<img src='[DocImage]' height='40'/>'' | <gsf:image> can take any html img attributes - they will be copied to the resulting <img> element.|
-===== Text and Metadata =====+ 
 +==== Text and Metadata ====
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
Line 105: Line 121:
 |''<gsf:metadata name='Language' format='format-Language'/>'' |The value of a metadata element for the current document, formatted in some way. format-Language: turns language code into language name, e.g. 'en' into 'English'.| |''<gsf:metadata name='Language' format='format-Language'/>'' |The value of a metadata element for the current document, formatted in some way. format-Language: turns language code into language name, e.g. 'en' into 'English'.|
  
-==== gsf:metadata modifiers ====+=== gsf:metadata modifiers ===
  
 By default, gsf:metadata displays all values of the specified metadata field, for the current page or section of a document. You can change which page or section's metadata is output using the **select** attribute. And you can choose just a single value using the **pos** attribute. Or you can set **type='collection'** to retrieve collection level metadata. By default, gsf:metadata displays all values of the specified metadata field, for the current page or section of a document. You can change which page or section's metadata is output using the **select** attribute. And you can choose just a single value using the **pos** attribute. Or you can set **type='collection'** to retrieve collection level metadata.
Line 145: Line 161:
  
  
-===== Miscellaneous Things =====+==== Collection/Interface Text Strings ==== 
 + 
 +These will be displayed in the current interface language (if available), otherwise in the default language. 
 + 
 +^Format Element^Greenstone2 equivalent^Description^ 
 +|     ||| 
 +|''<gsf:displayText name='xxx'/>'' |Will display the xxx displayItem from the collection's //collectionConfig.xml// file. If that is not found, will try to look for xxx from the interface's property file.| 
 +|''<gsf:displayItem name='xxx'/>'' |Display the xxx displayItem from the collection's //collectionConfig.xml// file.| 
 +|''<gsf:interfaceText name='xxx'/>'' | Display the xxx interface text string (from //interface_default.properties// in web/WEB-INF/classes)| 
 +|''<gsf:interfaceText name='xxx' propertyFile='file_name'/>'' | | Display the xxx string from the //<file_name>.properties// file (in web/WEB-INF/classes) (Greenstone version 3.10 and later)| 
 +|''<gsf:collectionText name='xxx'/>'' |Display the xxx from the current collection's //interface_custom.properties// file (found in resources folder inside the collection) | 
 +|''<gsf:collectionText name='xxx' propertyFile='file_name'/>'' |Display the xxx from the current collection's //<file_name>.properties// file (found in resources folder inside the collection) | 
 + 
 +==== Miscellaneous Things ====
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
 |''<gsf:cgi-param name='query'/>''| _cgiargq_|The value of a cgi param (in this case will get s1.query from the cgi arguments)| |''<gsf:cgi-param name='query'/>''| _cgiargq_|The value of a cgi param (in this case will get s1.query from the cgi arguments)|
-|''<gsf:displayText name='xxx'/>'' |Will display the xxx displayItem from the collection's collectionConfig.xml file. If that is not found, will try to look for xxx from the interface's property file.| 
-|''<gsf:displayItem name='xxx'/>'' |Display the xxx displayItem from the collection's collectionConfig.xml file.| 
-|''<gsf:interfaceText name='xxx'/>'' | Display the xxx interface text string (from interface_default.properties in web/WEB-INF/classes)| 
-|''<gsf:collectionText name='xxx'/>'' |Display the xxx from the current collection's colname.properties file (found in resources folder inside the collection) | 
-|''<gsf:html>&lt;li&gt;</gsf:html>''| <li>|Sometimes you want to output some HTML that is not valid XML in the config file. For example, adding <li> and </li> as prefix and suffix to a list of metadata values. In the final HTML it will be valid XML, but in the template it won't be. So use escaped < and > and enclose the text in <gsf:html> tags.| 
 |''<gsf:variable name='xxx'>value</gsf:variable>'' |Will output an <xsl:variable> into the transform result. Also, sets gs.variables.xxx = value, which is available for use in javascript code.| |''<gsf:variable name='xxx'>value</gsf:variable>'' |Will output an <xsl:variable> into the transform result. Also, sets gs.variables.xxx = value, which is available for use in javascript code.|
 +|''<gsf:html>&lt;li&gt;</gsf:html>''| <li>|Sometimes you want to output some HTML that is not valid XML in the config file. For example, adding <li> and </li> as prefix and suffix to a list of metadata values. In the final HTML it will be valid XML, but in the template it won't be. So use escaped < and > and enclose the text in <gsf:html> tags.|
 +
  
-===== Conditional =====+==== Conditional ====
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
Line 165: Line 191:
  
  
-====Preprocess Options ====+===Preprocess Options ===
 The preprocess attribute specifies something to do to the metadata value before performing the test. For example, you may want to lower case the value before comparing it to your text string. That way you don't need to worry about handling case variation in the metadata value. The preprocess attribute specifies something to do to the metadata value before performing the test. For example, you may want to lower case the value before comparing it to your text string. That way you don't need to worry about handling case variation in the metadata value.
  
Line 179: Line 205:
  
  
-==== Test options ====+=== Test options ===
 Sometimes you may want to output different things depending on the value of the metadata element. There are many tests you can make on the metadata value, listed below, which are specified using the test attribute. They all take a second parameter, specified using the test-value attribute, which is the value to compare to (with the exception of exists, which needs no test value). The preprocessing Sometimes you may want to output different things depending on the value of the metadata element. There are many tests you can make on the metadata value, listed below, which are specified using the test attribute. They all take a second parameter, specified using the test-value attribute, which is the value to compare to (with the exception of exists, which needs no test value). The preprocessing
 option, if specified, is carried out first, before performing the test. option, if specified, is carried out first, before performing the test.
Line 199: Line 225:
  
  
-===== Iteration =====+==== Iteration ====
 ^Format Element^Greenstone2 equivalent^Description^ ^Format Element^Greenstone2 equivalent^Description^
 |     ||| |     |||
Line 206: Line 232:
  
  
-==== gsf:foreach-metadata attributes ====+=== gsf:foreach-metadata attributes ===
  
 ^gsf:foreach-metadata Attribute^Possible Values^Description^ ^gsf:foreach-metadata Attribute^Possible Values^Description^
Line 220: Line 246:
 |sort|true|Sort the metadata values (alphabetically, ascending order)| |sort|true|Sort the metadata values (alphabetically, ascending order)|
  
-==== gsf:sort attributes ====+=== gsf:sort attributes ===
  
 ^gsf:sort Attribute^Possible Values^Description^ ^gsf:sort Attribute^Possible Values^Description^
Line 229: Line 255:
 |data-type|text/number/data-type name|Defines whether values are sorted alphabetically, numerically, or using a user-defined data type| |data-type|text/number/data-type name|Defines whether values are sorted alphabetically, numerically, or using a user-defined data type|
  
-===== Additional Notes =====+==== Utility Functions ==== 
 + 
 +There are many utility functions defined in src/java/org/greenstone/gsdl3/util/XSLTUtil.java. Some of these are used behind the scenes, as part of gsf elements. For example, .... 
 + 
 +They can be called explicitly using 
 +<code> 
 +<xsl:value of select="util:fname(args)"/> 
 +</code> 
 +args is a comma separated list of args. They can be XSLT variables, numbers, strings, XSLT elements/attributes. 
 + 
 +For example: 
 +<code> 
 +   <xsl:variable name="raw_date"><gslib:collectionMeta name="buildDate"/></xsl:variable> 
 +   The collection was last built on <xsl:value-of select="util:formatTimeStamp($raw_date, 0, 0, /page/@lang)"/> 
 +</code> 
 + 
 +This code is getting the buildDate timestamp from collection metadata. Then it is formatting it using the formatTimeStamp function. 
 +This function takes 4 arguments: 
 +  * the timestamp - here we use the raw_date variable we have just made 
 +  * an integer for timestamp type - 0 is seconds, 1 is milliseconds 
 +  * an integer for output format tupe - 0 is date, 1 is time, 2 is date and time, 3 is days ago 
 +  * the language code for which language you want the output in - here we use the attribute from the page element. 
 + 
 +We could change this output to days ago: 
 +The collection was last built <xsl:value-of select="util:formatTimeStamp($raw_date, 0, 3, /page/@lang)"/> days ago. 
 + 
 +==== Additional Notes ==== 
  
 Some of these options (<gsf:html>; using <gsf:metadata> inside the parameters for a search link) are not available in the 3.07 release. If you are using 3.07, you can download an updated config_format.xsl file. Rename your current greenstone3/web/interfaces/default/transform/config_format.xsl (so that you can put it back if something goes wrong), and copy this one into its place. Some of these options (<gsf:html>; using <gsf:metadata> inside the parameters for a search link) are not available in the 3.07 release. If you are using 3.07, you can download an updated config_format.xsl file. Rename your current greenstone3/web/interfaces/default/transform/config_format.xsl (so that you can put it back if something goes wrong), and copy this one into its place.
en/user/gs3_list_of_format_options.1569288316.txt.gz · Last modified: 2019/09/24 01:25 by kjdon