Changeset 8936 for trunk/greenorg
- Timestamp:
- 2005-02-01T14:26:20+13:00 (19 years ago)
- Location:
- trunk/greenorg/macros
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/greenorg/macros/english.dm
r8880 r8936 1043 1043 1044 1044 _tfaqcustomizeformattitle_ {What are the formatting options available for my collection?} 1045 1046 _tfaqcustomizemetadatalinkingtitle_ {How can I hyperlink individual metadata elements?} 1047 1045 1048 _t207_ {FAQ Main Page} 1046 1049 … … 1861 1864 <p> 1862 1865 <i><u>Extended metadata names</u></i><br> 1863 There are a few options for displaying metadata. The basic way is to specify e.g. [Title] or [dc.Title]: this displays the value of that particular metadata element for the current document/section. Metadata names can be prefixed by parent: or sibling. The following examples all use Title or Subject metadata, but any metadata could be used, including ones with namespaces (e.g. dc.Title). 1866 There are a few options for displaying metadata. The basic way is to specify e.g. [Title] or [dc.Title]: this displays the value of that particular metadata element for the current document/section. Metadata names can be prefixed by parent: or sibling. The following examples all use Title or Subject metadata, but any metadata could be used, including ones with namespaces (e.g. dc.Title). Any metadata name can also be prefixed by "cgisafe:". This results in the value being formatted so that it is safe to put in a URL. 1864 1867 <p> 1865 1868 <table class="faq-table"> … … 1870 1873 <tr><td>[sibling:Subject]</td><td>All Subjects of the current section, separated by ", ". This is used for displaying metadata where there is more than one value. [Subject] will just display the first value.</td></tr> 1871 1874 <tr><td>[sibling(All:'<br>'):Subject]</td><td>All Subjects of the current section, separated by <br>. </td></tr> 1875 <tr><td>[cgisafe:parent(Top):Title]</td><td>The Title of the topmost parent section, made safe for URLs.</td></tr> 1876 <tr><td>[cgisafe:sibling(All:'<br>'):Subject]</td><td>All Subjects of the current section, separated by <br>, made safe for URLs.</td></tr> 1872 1877 </table> 1873 1878 … … 1895 1900 } 1896 1901 1902 _tfaqcustomizemetadatalinking_ { 1903 <i>[contributed by Axel Schild]</i><br/> 1904 When 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: 1905 <br><small><tt><a href="url to link to">[dc.Subject]</a></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) 1909 <br><small><tt><pre> 1910 \{If\}\{[dc.Creator], 1911 <tr> 1912 <td align=right valign=top><b>Authors:</b></td> 1913 <td align=left valign=bottom><label name=AuthorField id=AuthorField> 1914 \_httpquery\_;[cgisafe:sibling(All:\\' ; \\'):dc.Creator];[sibling(All:\\'\_\\'):dc.Creator] 1915 </label></td> 1916 </tr>\} 1917 </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/<collnanme>/macros) and override the chosen macro with a collection specific macro. In my example this is done by the code sequence 1923 1924 <br><small><tt><pre> 1925 package document 1926 1927 ###document display 1928 1929 ###HTML-Page Header 1930 \_textheader\_ [c=exacol] \{\_cgihead\_ 1931 \_htmlhead\_(onload="ExtractSubjects();ExtractAuthors();") 1932 <center> 1933 <table width=_pagewidth_><tr><td align=right> 1934 \_icontab\_\_javalinks\_</td></tr></table> 1935 </center> 1936 \} 1937 </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 1939 <br><small><tt><pre> 1940 ### Self-made Javascript functions 1941 \_pagescriptextra\_\{ 1942 function ExtractAuthors() \\\{ 1943 var res; 1944 a = AuthorField.outerText.split(";"); 1945 resolver = a[0]+"&q="; 1946 b = a[1].split("+%3b+"); 1947 c = a[2].split("\_"); 1948 res = ""; 1949 for (i = 0; i < b.length ;i++) 1950 \\{ 1951 res = res + "<a href=" + resolver + b[i]+ "&h=dd0&t=0>" + c[i] + "</a><br/>"; 1952 \\} 1953 AuthorField.outerHTML = res; 1954 \\} 1955 \} 1956 </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/<collname>/index/build.cfg gives the names of the various indexes. 1958 1959 } 1960 1897 1961 ####################################################################### 1898 1962
Note:
See TracChangeset
for help on using the changeset viewer.