source: main/trunk/model-sites-dev/pei-jones/collect/photos/transform/pages/document.xsl@ 28262

Last change on this file since 28262 was 28262, checked in by sjm84, 11 years ago

This xsl should only affect this one collection

File size: 11.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" xmlns:gslib="http://www.greenstone.org/skinning" xmlns:java="http://xml.apache.org/xslt/java" xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil" exclude-result-prefixes="java util gsf" extension-element-prefixes="java util" version="1.0">
2
3 <xsl:template name="customImageFileDownload">
4 <div class="ui-state-default ui-corner-all" style="margin:5px;">
5 <!-- Add image file download button -->
6 <xsl:variable name="assocfilepath">
7 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']"/>
8 </xsl:variable>
9 <xsl:variable name="image_file">
10 <xsl:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = 'Source']"/>
11 </xsl:variable>
12
13 <a id="btnDownloadImage" style="padding: 3px; text-decoration: none;">
14 <xsl:attribute name="href">
15 <xsl:text>cgi-bin/file-download.pl?filename=</xsl:text>
16 <xsl:value-of select="$image_file"/>
17 <xsl:text>&amp;site=localsite&amp;c=pjpaged&amp;assoc=</xsl:text>
18 <xsl:value-of select="$assocfilepath"/>
19 </xsl:attribute>
20 Download Image File
21 </a>
22 </div>
23 </xsl:template>
24
25 <xsl:template name="editBar">
26 <table style="width:100%"><tr>
27 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
28 <td id="editBarRight">
29 <div style="text-align:center;">
30 <div class="ui-state-default ui-corner-all" style="margin:5px;">
31 <a href="{$library_name}?a=g&amp;sa=documentbasket&amp;c=&amp;s=DisplayDocumentList&amp;rt=r&amp;p.c={/page/pageResponse/collection/@name}&amp;docToEdit={/page/pageResponse/document/documentNode/@nodeID}" style="padding: 3px; text-decoration:none;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.edit_structure')"/></a>
32 </div>
33 <div class="ui-state-default ui-corner-all" style="margin:5px;">
34 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
35 <xsl:attribute name="href">
36 <xsl:value-of select="$library_name"/>
37 <xsl:text>/collection/</xsl:text>
38 <xsl:value-of select="$collName"/>
39 <xsl:text>/document/</xsl:text>
40 <xsl:choose>
41 <xsl:when test="count(//documentNode) &gt; 0">
42 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
46 </xsl:otherwise>
47 </xsl:choose>
48 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
49 <xsl:text>?ed=1&amp;docEdit=1&amp;dt=hierarchy</xsl:text>
50 </xsl:if>
51 </xsl:attribute>
52 <xsl:choose>
53 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
54 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.hide_editor')"/>
55 </xsl:when>
56 <xsl:otherwise>
57 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.edit_content')"/>
58 </xsl:otherwise>
59 </xsl:choose>
60 </a>
61 </div>
62 <xsl:call-template name="customImageFileDownload"/>
63 </div>
64 </td>
65 </tr></table>
66 <gslib:langfrag name="dse"/>
67 </xsl:template>
68
69 <xsl:template name="wrappedSectionImage">
70 <xsl:call-template name="UserTrackerScripts"/>
71
72 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
73 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
74 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
75 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
76
77 <xsl:choose>
78 <xsl:when test="metadataList/metadata[@name = 'Screen'] and metadataList/metadata[@name = 'SourceFile'] and ($imageWidth div $screenImageWidth &gt; 1.2) and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']) or /page/pageResponse/format[@type='display']/gsf:option[@name='disableZoom']/@value='false')">
79 <div id="image{@nodeID}">
80 <div class="zoomImage" id="wrap{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
81 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
82 <!--<gsf:image type="screen"/>-->
83 <xsl:call-template name="customScreenImage"/>
84 </div>
85 <div id="mover{util:replace(@nodeID, '.', '_')}" style="border: 1px solid green; position: absolute; top: 0; left: 0; width: 598px; height: 598px; overflow: hidden; z-index: 100; background: white; display: none;">
86 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 600px; height: 600px; position: absolute; top: 0; left: 0; z-index: 200;">
87 <xsl:text> </xsl:text>
88 </div>
89 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
90 <gsf:image type="source"/>
91 </div>
92 </div>
93 </div>
94 <script type="text/javascript">
95 <xsl:text disable-output-escaping="yes">
96 {
97 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
98 nodeID = nodeID.replace(/\./g, "_");
99
100 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
101 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
102
103 var multiplier = bigHeight / smallHeight;
104
105 $("#wrap" + nodeID).anythingZoomer({
106 smallArea: "#small" + nodeID,
107 largeArea: "#large" + nodeID,
108 zoomPort: "#overlay" + nodeID,
109 mover: "#mover" + nodeID,
110 expansionSize:50,
111 speedMultiplier:multiplier
112 });
113
114 $("#zoomOptions input").attr("checked", false);
115 $("#zoomOptions").css("display", null);
116 }
117 </xsl:text>
118 </script>
119 </div>
120 </xsl:when>
121 <xsl:otherwise>
122 <!-- this is where -->
123 <div id="image{@nodeID}">
124 <xsl:attribute name="style">
125 <xsl:choose>
126 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
127 <xsl:text>display:none;</xsl:text>
128 </xsl:when>
129 <xsl:otherwise>
130 <xsl:text>display:block;</xsl:text>
131 </xsl:otherwise>
132 </xsl:choose>
133 <xsl:text>float:left;</xsl:text>
134 </xsl:attribute>
135 <xsl:call-template name="sectionImage"/>
136 <xsl:text> </xsl:text>
137 </div>
138 <div style="float:right; width:50%; margin-right:50px;">
139 <xsl:variable name="editable">
140 <xsl:choose>
141 <xsl:when test="/page/pageRequest/userInformation">
142 <xsl:text>editable</xsl:text>
143 </xsl:when>
144 <xsl:otherwise>
145 <xsl:text> </xsl:text>
146 </xsl:otherwise>
147 </xsl:choose>
148 </xsl:variable>
149 <script type="text/javascript" src="interfaces/{$interface_name}/js/direct-edit.js"><xsl:text> </xsl:text></script>
150 <xsl:call-template name="init-direct-edit"/>
151 <xsl:if test="metadataList/metadata[@name='dc.Title'] or metadataList/metadata[@name='dc.Subject'] or (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true')">
152 <table id="meta{@nodeID}" style="width:100%;">
153 <xsl:if test="metadataList/metadata[@name='dc.Title'] or (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true')">
154 <tr>
155 <xsl:choose>
156 <xsl:when test="(/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true')">
157 <td style="width:25%;" class="metaTableCellName">dc.Title</td>
158 </xsl:when>
159 <xsl:otherwise>
160 <td style="width:25%;" class="metaTableCellName">Title</td>
161 </xsl:otherwise>
162 </xsl:choose>
163 <td class="metaTableCell {$editable}">
164 <xsl:choose>
165 <xsl:when test="metadataList/metadata[@name='dc.Title']">
166 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='dc.Title']"/>
167 </xsl:when>
168 <xsl:otherwise>
169 <xsl:text>[No Title]</xsl:text>
170 </xsl:otherwise>
171 </xsl:choose>
172 </td>
173 </tr>
174 </xsl:if>
175 <xsl:if test="metadataList/metadata[@name='dc.Subject'] or (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true')">
176 <tr>
177 <xsl:choose>
178 <xsl:when test="(/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true')">
179 <td style="width:25%;" class="metaTableCellName">dc.Subject</td>
180 </xsl:when>
181 <xsl:otherwise>
182 <td style="width:25%;" class="metaTableCellName">Subject</td>
183 </xsl:otherwise>
184 </xsl:choose>
185 <td class="metaTableCell {$editable}">
186 <xsl:choose>
187 <xsl:when test="metadataList/metadata[@name='dc.Subject']">
188 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='dc.Subject']"/>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:text>[No Subject]</xsl:text>
192 </xsl:otherwise>
193 </xsl:choose>
194 </td>
195 </tr>
196 </xsl:if>
197 </table>
198 </xsl:if>
199 <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true'">
200 <button id="quickSaveButton">Save Changes</button>
201 <script type="text/javascript">
202 <xsl:text disable-output-escaping="yes">
203 $(window).load(function()
204 {
205 $("#quickSaveButton").click(save);
206 });
207 </xsl:text>
208 </script>
209 </xsl:if>
210 </div>
211 <div style="clear:both;"><xsl:text> </xsl:text></div>
212 </xsl:otherwise>
213 </xsl:choose>
214 </xsl:template>
215
216 <!-- custom screen image template so we can add "toAnnotate" class to each paged image-->
217 <xsl:template name="customScreenImage" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
218
219 <gsf:variable name="screenImageWidth" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"><gsf:metadata name="ScreenWidth"/></gsf:variable>
220 <gsf:variable name="screenImageHeight" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"><gsf:metadata name="ScreenHeight"/></gsf:variable>
221 <gsf:variable name="imageWidth" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"><gsf:metadata name="ImageWidth"/></gsf:variable>
222 <gsf:variable name="imageHeight" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"><gsf:metadata name="ImageHeight"/></gsf:variable>
223
224 <xsl:variable name="ScreenName">Screen</xsl:variable>
225
226 <gsf:link type="source">
227 <img style="border: 1px solid #000;">
228 <xsl:attribute name="src">
229 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
230 <xsl:text>/index/assoc/</xsl:text>
231 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']"/>
232 <xsl:text>/</xsl:text>
233 <xsl:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = $ScreenName]"/>
234 </xsl:attribute>
235 </img>
236 </gsf:link>
237 </xsl:template>
238
239</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.