Changeset 25942


Ignore:
Timestamp:
2012-07-12T22:38:57+12:00 (12 years ago)
Author:
ak19
Message:

The search term highlighting in Acrobat PDFs on Windows now works and the tutorial for GS3 has been updated to reflect the format statement equivalent to the GS2 version for it. This may become simplified when further control structures are introduced into config_format.xsl. Kathy also improved this part of the tutorial for GS2, which now always makes reference to the original source file instead of hardcoding doc.pdf as one of the options.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/tutorials/xml-source/tutorial_en.xml

    r25807 r25942  
    88<TutorialList>
    99<Title>
    10 <Text id="0001">Greenstone tutorial exercises (October 2010)</Text>
     10<Text id="0001">Greenstone tutorial exercises (2012)</Text>
    1111</Title>
    1212<Version current="2.85"/>
     
    646646<MajorVersion number="2"><Text id="0359c">Leave the feature selection controls at their default values, so that <AutoText key="glidict::CDM.FormatManager.AllFeatures" type="italics"/> is selected for <AutoText key="glidict::CDM.FormatManager.Feature"/>, and <AutoText text="VList" /> is selected as the <AutoText key="glidict::CDM.FormatManager.Part"/>. In the <AutoText key="glidict::CDM.FormatManager.Editor"/>, edit the text as follows:</Text></MajorVersion>
    647647<MajorVersion number="3"><Text id="0359d">Click on the <b>browse</b> Format Feature. Find the section under <b>documentNode</b> where it says</Text>
    648 <Format>&lt;td valign=&quot;top&quot;&gt;&lt;gsf:displayText name=&quot;ImageName&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;Image&quot;&#47;&gt;&lt;br&#47;&gt;&lt;gsf:displayText name=&quot;Width&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageWidth&quot;&#47;&gt;&lt;br&#47;&gt;&lt;gsf:displayText name=&quot;Height&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageHeight&quot;&#47;&gt;&lt;br&#47;&gt;&lt;gsf:displayText name=&quot;Size&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageSize&quot;&#47;&gt;&lt;&#47;td&gt;</Format><Text id="0395d">Edit the text as follows:</Text></MajorVersion>
     648<Format>
     649  &lt;td valign=&quot;top&quot;&gt;<br/>
     650  <Tab n="1"/>&lt;gsf:displayText name=&quot;ImageName&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;Image&quot;&#47;&gt;&lt;br&#47;&gt;<br/>
     651  <Tab n="1"/>&lt;gsf:displayText name=&quot;Width&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageWidth&quot;&#47;&gt;&lt;br&#47;&gt;<br/>
     652  <Tab n="1"/>&lt;gsf:displayText name=&quot;Height&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageHeight&quot;&#47;&gt;&lt;br&#47;&gt;<br/>
     653  <Tab n="1"/>&lt;gsf:displayText name=&quot;Size&quot;&#47;&gt;:&lt;gsf:metadata name=&quot;ImageSize&quot;&#47;&gt;<br/>
     654  &lt;&#47;td&gt;</Format>
     655<Text id="0395d">Edit the text as follows:</Text></MajorVersion>
    649656<BulletList>
    650657<Bullet>
     
    10471054<Format>
    10481055&lt;gsf:metadata name=&quot;dc.Creator&quot; /&gt; <br />
    1049 &lt;gsf:metadata name=&quot;ex.Creator&quot; /&gt;<br />
     1056&lt;gsf:metadata name=&quot;Creator&quot; /&gt;<br />
    10501057</Format>
    10511058<Text id="fw-23a-3">To display dc.Creator if it is present, otherwise display ex.Creator, use</Text>
     
    10531060&lt;gsf:choose-metadata&gt;<br />
    10541061  <Tab n="1"/>&lt;gsf:metadata name=&quot;dc.Creator&quot; /&gt;<br />
    1055   <Tab n="1"/>&lt;gsf:metadata name=&quot;ex.Creator&quot; /&gt;<br /> 
     1062  <Tab n="1"/>&lt;gsf:metadata name=&quot;Creator&quot; /&gt;<br /> 
    10561063&lt;/gsf:choose-metadata&gt;<br />
    10571064</Format>
     
    12051212<Text id="fw-24">Opening PDF files with query terms highlighted</Text>
    12061213</Heading>
     1214<MajorVersion number="2">
    12071215<NumberedItem>
    12081216<Text id="fw-24a">Next we'll customize the <AutoText text="SearchVList"/> format statement to highlight the query terms in a PDF file when it is opened from the search result list. This requires Acrobat Reader 7.0 version or higher, and currently only works on a Microsoft Windows platform.</Text>
    12091217</NumberedItem>
    12101218<NumberedItem>
    1211 <Text id="fw-24c">The search terms are kept in the macro variable <AutoText text="_cgiargq_"/>, and we append <AutoText text="#search=&quot;_cgiargq_&quot;"/> to the end of a PDF file link to pass the query terms to the PDF file.</Text>
    1212 <Text id="fw-24d"><AutoText text="PDFPlugin"/> renames each PDF file as <AutoText text="doc.pdf"/> and saves it in a unique directory for that document, so we use</Text>
    1213 <Format>_httpcollection_/index/assoc/[archivedir]/doc.pdf</Format>
    1214 <Text id="fw-24e">to refer to the PDF source file. (However, if you used the <AutoText text="-keep_original_filename"/> option to <AutoText text="PDFPlugin"/> when building the collection, the original name of the PDF file is kept, and we use</Text>
    1215 <Format>_httpcollection_/index/assoc/[archivedir]/[Source]</Format>
    1216 <Text id="fw-24f">instead to locate the PDF source file.)</Text>
    1217 </NumberedItem>
    1218 <NumberedItem>
    1219 <Text id="fw-24g">Add <AutoText text="SearchVList"/> by selecting <AutoText text="Search"/> from the <AutoText key="glidict::CDM.FormatManager.Feature"/> drop down list, and <AutoText text="VList"/> from the <AutoText key="glidict::CDM.FormatManager.Part"/> list. Click <AutoText key="glidict::CDM.FormatManager.Add" type="button"/> to add the <AutoText text="SearchVList"/> format statement into the list of assigned formats. We need to test whether the file is a PDF file before linking to doc.pdf, using <Format>{If}{[ex.FileFormat] eq 'PDF',,}</Format>. For PDF files, we use the above format instead of the <Format>[ex.srclink]</Format> and <Format>[ex./srclink]</Format> variables to link to the file.</Text>
     1219<Text id="fw-24c">The search terms are kept in the macro variable <AutoText text="_queryterms_"/>, and we append <AutoText text="#search=&quot;_queryterms_&quot;"/> to the end of a PDF file link to pass the query terms to the PDF.</Text>
     1220<Text id="fw-24d"><AutoText text="PDFPlugin"/> saves each PDF file in a unique directory. You can use </Text>
     1221<Format>_httpcollection_/index/assoc/[archivedir]/[srclinkFile]</Format>
     1222<Text id="fw-24f">to refer to these files.</Text>
     1223</NumberedItem>
     1224<NumberedItem>
     1225<Text id="fw-24g">Add <AutoText text="SearchVList"/> by selecting <AutoText text="Search"/> from the <AutoText key="glidict::CDM.FormatManager.Feature"/> drop down list, and <AutoText text="VList"/> from the <AutoText key="glidict::CDM.FormatManager.Part"/> list. Click <AutoText key="glidict::CDM.FormatManager.Add" type="button"/> to add the <AutoText text="SearchVList"/> format statement into the list of assigned formats. We need to test whether the file is a PDF file before linking to it, using <Format>{If}{[ex.FileFormat] eq 'PDF',,}</Format>. For PDF files, we use the above path format instead of the <Format>[ex.srclink]</Format> and <Format>[ex./srclink]</Format> variables to link to the file.</Text>
    12201226<Text id="fw-24b">The resulting format statement is:</Text>
    12211227<Format>
    12221228&lt;td valign="top"&gt;[link][icon][/link]&lt;/td&gt;<br/>
    12231229&lt;td valign="top"&gt;<highlight>{If}{[ex.FileFormat] eq 'PDF', &lt;a
    1224 href=\"_httpcollection_/index/assoc/[archivedir]/doc.pdf#search=&amp;quot;_cgiargq_&amp;quot;\"&gt;{Or}{[ex.thumbicon],[ex.srcicon]}&lt;/a&gt;,<br/>[ex.srclink]{Or}{[ex.thumbicon],[ex.srcicon]}[ex./srclink]}</highlight>&lt;/td&gt;<br/>
     1230href=\&quot;_httpcollection_/index/assoc/[archivedir]/[srclinkFile]#search=&amp;quot;_queryterms_&amp;quot;\&quot;&gt;{Or}{[ex.thumbicon],[ex.srcicon]}&lt;/a&gt;,<br/>[ex.srclink]{Or}{[ex.thumbicon],[ex.srcicon]}[ex./srclink]}</highlight>&lt;/td&gt;<br/>
    12251231&lt;td valign="top"&gt;[highlight]<br/>
    12261232{Or}{[dc.Title],[ex.Title],Untitled}<br/>
    12271233[/highlight]{If}{[ex.Source],&lt;br&gt;&lt;i&gt;([ex.Source])&lt;/i&gt;}&lt;/td&gt;<br/>
    12281234</Format>
    1229 <Text id="fw-24i">When the PDF icons are clicked in the search results, Acrobat will open the file with the search window open, and the query terms highlighted.</Text>
    1230 </NumberedItem>
     1235</NumberedItem>
     1236</MajorVersion>
     1237<MajorVersion number="3">
     1238<NumberedItem>
     1239<Text id="fw-24a-3">Next we'll customize the <AutoText text="search"/> format statement to highlight the query terms in a PDF file when it is opened from the search result list. This requires Acrobat Reader 7.0 version or higher, and currently only works on a Microsoft Windows platform.</Text>
     1240</NumberedItem>
     1241<NumberedItem>
     1242<Text id="fw-24c-3">To highlight the query terms in a PDF document, we need to pass them into the PDF file by appending <AutoText text="#search=&quot;query&quot;"/> to the end of the document link. We need to create the link ourselves rather than using &lt;gsf:link type=&quot;source&quot;/&gt; in the format statement. </Text>
     1243<Text id="fw-24d-3"><AutoText text="PDFPlugin"/> saves each PDF file in a unique directory for that document, and we can use</Text>
     1244<Format>&lt;gsf:metadata name=&quot;httpPath&quot; type=&quot;collection&quot;/&gt;/index/assoc/&lt;gsf:metadata name=&quot;archivedir&quot;/&gt;/&lt;gsf:metadata name=&quot;srclinkFile&quot;/&gt;</Format>
     1245<Text id="fw-24e-3">to refer to the PDF source file.
     1246The search terms can be found in the &quot;q&quot; cgi parameter. You can access this using &lt;gsf:cgi-param name=&quot;q&quot;/&gt;.</Text>
     1247</NumberedItem>
     1248<NumberedItem>
     1249<Text id="fw-24g-3">Select <AutoText text="search"/> in <AutoText key="glidict::CDM.GUI.Formats"/> for editing. We need to test whether the file is a PDF file before linking to it, using a test on whether the Greenstone extracted FileFormat metadata is PDF. For PDF files, we now generate the link explicitly.</Text>
     1250<Text id="fw-24b-3">The resulting format statement is:</Text>
     1251<Format>
     1252  &lt;td valign=&quot;top&quot;&gt;<br/>
     1253    <Tab n="1"/>&lt;gsf:link type=&quot;document&quot;&gt;<br/>
     1254        <Tab n="2"/>&lt;gsf:icon type=&quot;document&quot;/&gt;<br/>
     1255    <Tab n="1"/>&lt;/gsf:link&gt;<br/>
     1256  &lt;&#47;td&gt;<br/>
     1257  <br />
     1258  &lt;td valign=&quot;top&quot;&gt;<br/>
     1259  <highlight>
     1260  &lt;gsf:switch&gt;<br/>
     1261    <Tab n="1"/>&lt;gsf:metadata name=&quot;FileFormat&quot;/&gt;<br/>
     1262    <Tab n="1"/>&lt;gsf:when test=&quot;equals&quot; test-value=&quot;PDF&quot;&gt;<br/>
     1263        <Tab n="2"/>&lt;a&gt;&lt;xsl:attribute name=&quot;href&quot;&gt;&lt;gsf:metadata name=&quot;httpPath&quot; type=&quot;collection&quot;/&gt;/index/assoc/&lt;gsf:metadata name=&quot;archivedir&quot;/&gt;/&lt;gsf:metadata name=&quot;srclinkFile&quot;/&gt;#search=&amp;amp;quot;&lt;gsf:cgi-param name=&quot;query&quot;/&gt;&amp;amp;quot;&lt;/xsl:attribute&gt;<br/>
     1264            <Tab n="3"/>&lt;gsf:choose-metadata&gt;<br/>
     1265                <Tab n="4"/>&lt;gsf:metadata name=&quot;thumbicon&quot;/&gt;<br/>
     1266                <Tab n="4"/>&lt;gsf:metadata name=&quot;srcicon&quot;/&gt;<br/>
     1267            <Tab n="3"/>&lt;/gsf:choose-metadata&gt;<br/>
     1268        <Tab n="2"/>&lt;/a&gt;<br/>
     1269    <Tab n="1"/>&lt;/gsf:when&gt;<br/>
     1270    <Tab n="1"/>&lt;gsf:otherwise&gt;<br/>
     1271        <Tab n="2"/>&lt;gsf:link type=&quot;source&quot;&gt;<br/>
     1272            <Tab n="3"/>&lt;gsf:choose-metadata&gt;<br/>
     1273                <Tab n="4"/>&lt;gsf:metadata name=&quot;thumbicon&quot;/&gt;<br/>
     1274                <Tab n="4"/>&lt;gsf:metadata name=&quot;srcicon&quot;/&gt;<br/>
     1275            <Tab n="3"/>&lt;/gsf:choose-metadata&gt;<br/>
     1276        <Tab n="2"/>&lt;/gsf:link&gt;<br/>
     1277    <Tab n="1"/>&lt;/gsf:otherwise&gt;<br/>
     1278  &lt;/gsf:switch&gt;</highlight><br/> 
     1279  &lt;&#47;td&gt;<br/>
     1280  <br />
     1281&lt;td valign=&quot;top&quot;&gt;<br/>
     1282...
     1283</Format>
     1284</NumberedItem>
     1285</MajorVersion>
     1286<Text id="fw-24i">When the PDF icons are clicked in the search results, Acrobat will open the file with the search window open with the query terms highlighted.</Text>
    12311287</Content>
    12321288</Tutorial>
     
    13541410</Content>
    13551411</Tutorial>
     1412<MajorVersion number="2">
    13561413<Tutorial id="export_to_CDROM">
    13571414<Title>
     
    13781435</Content>
    13791436</Tutorial>
     1437</MajorVersion>
    13801438<Tutorial id="large_html_collection">
    13811439<Title>
Note: See TracChangeset for help on using the changeset viewer.