Changeset 8938


Ignore:
Timestamp:
2005-02-01T15:21:34+13:00 (19 years ago)
Author:
mdewsnip
Message:

Tidied up the new FAQ entry slightly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/greenorg/macros/english.dm

    r8936 r8938  
    19041904When a metadata element has only one value, it is easy to make a hyperlink out of the value. In the format statement, you just put an <a> tag around the metadata item, for example:
    19051905<br><small><tt>&lt;a href="url to link to"&gt;[dc.Subject]&lt;/a&gt;</tt></small><br>
    1906 When the metadata item has multiple values, and you want to link each one separately, it is a bit more difficult. The following is Axel's solution to his particular problem: display all the Creator elements, each one hyperlinked to a search of that Creator, in the Creators index. 
    1907 <p>
    1908 Use the format string below in the collect.cfg file (for my collection I put this string in "format DocumentText" statement)
     1906When the metadata item has multiple values, and you want to link each one separately, it is a bit more difficult. The following is Axel's solution to his particular problem: display all the Creator elements, each one hyperlinked to a search of that Creator in the Creators index. 
     1907<p>
     1908Use the format string below in the collect.cfg file (in this case, as part of the "format DocumentText" statement)
    19091909<br><small><tt><pre>
    19101910\{If\}\{[dc.Creator],
     
    19161916&lt;/tr&gt;\}
    19171917</pre></tt></small>
    1918 This statement includes a label definition with the name "AuthorField". "\_httpquery\_" is a macro which resolves into the http-address of query page of the collection. "[cgisafe:sibling(All:\\' ; \\'):dc.Creator]" displays all Creators, separated by ; with all special characters replaced with UTF-8 encoding, so that it can be used  within a web address. [sibling(All:\\'\_\\'):dc.Creator] produces a similar string without replaced special characters. Notice the different separation symbols, these are needed later on.
    1919 <p>
    1920 Additional changes have to be made in order to make this whole thing work. You further need to change the \_header\_ or \_textheader\_ macro in the package of the page the format string will be displayed in (in my case the document package). The change is that \_htmlhead has to be parametrized with
    1921 
    1922 <small><tt>\_htmlhead\_(onload="ExtractAuthors();")</tt></small>, where ExtractAuthors(); is a Javascipt function, which is called on loading the corresponding page (the document display page). Since you do not want to mess in the standard macro files, create an extra.dm file (should be placed in gsdl/collect/&lt;collnanme&gt;/macros) and override the chosen macro with a collection specific macro. In my example this is done by the code sequence
     1918This statement includes a label definition with the name "AuthorField". "\_httpquery\_" is a macro which resolves into the http-address of the query page of the collection. "[cgisafe:sibling(All:\\' ; \\'):dc.Creator]" displays all Creators, separated by ; and with any special characters escaped for use within a web address. [sibling(All:\\'\_\\'):dc.Creator] produces a similar string without escaping any special characters. Notice the different separation symbols, these are needed later on.
     1919<p>
     1920Additional changes have to be made in order to make this whole thing work. You further need to change the \_header\_ or \_textheader\_ macro in the package of the page the format string will be displayed in (in this case the document package). The change is that \_htmlhead\_ has to be parametrized with
     1921
     1922<small><tt>\_htmlhead\_(onload="ExtractAuthors();")</tt></small>, where ExtractAuthors(); is a Javascript function that is called on loading the corresponding page (the document display page). Since you do not want to mess in the standard macro files, create an extra.dm file (in gsdl/collect/&lt;collname&gt;/macros) and override the chosen macro with a collection specific macro. In this example this is done by the code sequence
    19231923
    19241924<br><small><tt><pre>
     
    19361936\}
    19371937</pre></tt></small>
    1938 Now all that is missing is the Javascript function which has to be included into the \_pagescriptextra\_ macro of the same package. Copy this macro out of the corresponding standard macro file and paste it into your extra.dm file. Make the neccessary modification which is in my case
     1938Now all that is missing is the Javascript function which has to be included into the \_pagescriptextra\_ macro of the same package. Copy this macro out of the corresponding standard macro file and paste it into your extra.dm file. Make the neccessary modification which is in this case
    19391939<br><small><tt><pre>
    19401940### Self-made Javascript functions
     
    19551955\}
    19561956</pre></tt></small>
    1957 This Javascript function evaluates the string of the defined label, splits it into several strings and composes a string out of thoses values, which is then set to the "outerHTML" element of the label. "&h=dd0" indicates which index to search in, and dd0 should be replaced with the name of the appropriate index. The file gsdl/collect/&lt;collname&gt;/index/build.cfg gives the names of the various indexes.
    1958                  
     1957This Javascript function evaluates the string of the defined label, splits it into several strings and composes a string out of those values, which is then set to the "outerHTML" element of the label. "&h=dd0" indicates which index to search in; dd0 should be replaced with the name of the appropriate index. The file gsdl/collect/&lt;collname&gt;/index/build.cfg gives the names of the various indexes.
    19591958}
    19601959
Note: See TracChangeset for help on using the changeset viewer.