root/main/trunk/model-sites-dev/mozarts-laptop/collect/digital-music-stand/transform/pages/document.xsl @ 30463

Revision 30463, 14.2 KB (checked in by davidb, 4 years ago)

Changes to implement Greenstone3 version of goto form

Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4    xmlns:java="http://xml.apache.org/xslt/java"
5    xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6    xmlns:gslib="http://www.greenstone.org/skinning"
7    xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8    extension-element-prefixes="java util"
9    exclude-result-prefixes="java util gsf">
10
11 
12  <xsl:template name="wrappedDocument">
13    <div id="gs-document">
14     
15      <xsl:call-template name="documentPre"/>
16      <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
17
18    <style>
19      /* Variation on detail given in:
20          http://stackoverflow.com/questions/2279396/how-to-remove-unwanted-space-between-rows-and-columns-in-table
21      */
22     
23      fieldset, form, label, legend,
24      table, caption, tbody, tfoot, thead, tr, th, td {
25        margin: 0;
26        padding: 0;
27        border: 0;
28        font-size: 100%;
29        font: inherit;
30        vertical-align: baseline;
31      }
32      </style>
33
34    <xsl:call-template name="create-html-header"/>
35   
36    <xsl:variable name="httpCollection">
37      <xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
38    </xsl:variable>
39
40    <gsf:variable name="cgiParamSite">
41      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'site']/@value"/>
42    </gsf:variable>
43    <gsf:variable name="cgiParamD">
44      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'd']/@value"/>
45    </gsf:variable>
46    <gsf:variable name="cgiParamCL">
47      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'cl']/@value"/>
48    </gsf:variable>
49   
50    <gsf:variable name="cgiParamPageWidth">
51      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'pageWidth']/@value"/>
52    </gsf:variable>
53    <gsf:variable name="cgiParamPageHeight">
54      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'pageHeight']/@value"/>
55    </gsf:variable>
56    <gsf:variable name="cgiParamPagePrefix">
57      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'pagePrefix']/@value"/>
58    </gsf:variable>
59    <gsf:variable name="cgiParamPageSuffix">
60      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'pageSuffix']/@value"/>
61    </gsf:variable>
62    <gsf:variable name="cgiParamNumPages">
63      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'numPages']/@value"/>
64    </gsf:variable>
65    <gsf:variable name="cgiParamScaleFactor">
66      <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'scaleFactor']/@value"/>
67    </gsf:variable>
68
69   
70    <table id="gotoNavBar" align="center" width="{$cgiParamPageWidth}">
71      <tr>
72        <td align="left" width="20%">
73          <a href="javascript:musicStand.prevPageAnim(gs.cgiParams['d'],'.png')">
74        <span id="prevpagespan" style="display: inline;">
75          <img class="lessarrow" src="interfaces/{$interface_name}/images/previous-small.png"/>
76          <span id="prevpageval">
77            <script language="javascript" type="text/javascript">musicStand.docwritePrevPageNum()</script>
78          </span>
79        </span>
80          </a>
81          <script language="javascript" type="text/javascript">musicStand.activatePrevPageNum();</script>
82        </td>
83        <td align="center" width="60%">
84          <div>
85        <form name="GotoForm" method="get" action="{$library_name}">
86          <input type="hidden" name="a" value="d" />
87          <input type="hidden" name="site" value="{$cgiParamSite}" />
88          <input type="hidden" name="c" value="{$collNameChecked}" />
89          <input type="hidden" name="excerptid" value="gs-document-text" />
90          <input type="hidden" name="d" value="{$cgiParamD}" />
91          <input type="hidden" name="cl" value="{$cgiParamCL}" />
92          <input type="hidden" name="pageWidth" value="{$cgiParamPageWidth}" />
93          <input type="hidden" name="pageHeight" value="{$cgiParamPageHeight}" />
94          <input type="hidden" name="numPages" value="{$cgiParamNumPages}" />
95          <input type="hidden" name="pagePrefix" value="{$cgiParamPagePrefix}" />
96          <input type="hidden" name="pageSuffix" value="{$cgiParamPageSuffix}" />
97          <input type="hidden" name="scaleFactor" value="{$cgiParamScaleFactor}" />
98          <input type="hidden" name="view" value="simple" />
99          <input type="text" name="gp" size="3" maxlength="4" />
100          <input type="submit" value="go to page" /> <!-- make language fragment multilingual -->
101          <script language="javascript" type="text/javascript">
102            musicStand.docwriteOptOfPages();
103          </script>
104        </form>       
105          </div>         
106        </td>
107        <td align="right" width="20%">
108          <a href="javascript:musicStand.nextPageAnim(gs.cgiParams['d'],'.png')">
109        <span id="nextpagespan" style="display: inline">
110          <span id="nextpageval">
111            <script language="javascript" type="text/javascript">musicStand.docwriteNextPageNum()</script>
112          </span>
113          <img class="morearrow" src="interfaces/{$interface_name}/images/next-small.png"/>
114        </span>
115          </a>
116        </td>
117        <script language="javascript" type="text/javascript">musicStand.activateNextPageNum();</script>
118      </tr>
119    </table>
120    <table width="100%">
121      <tr>
122        <td/>
123        <td>
124          <div id="thispage" style="cursor: e-resize; background: white;        position: relative; left: 0px; top: 0px;        width: {$cgiParamPageWidth}px; height: {gs.cgiparam.PageHeight}px;">
125        <a onClick="return false;" onContextMenu="return false;" onMouseDown="return musicStand.nextOrPrevPageEvent(event,gs.cgiParams['d'],'.png')" onMouseUp="return false;">
126          <img border="0" height="{$cgiParamPageHeight}" id="thispageimg" src="{$httpCollection}/images/blank.gif" width="{$cgiParamPageWidth}"/>
127        </a>
128        <div id="nextpagediv" style="clip : rect(0px, {$cgiParamPageWidth}px, {$cgiParamPageHeight}px, {$cgiParamPageWidth}px);">
129          <img border="0" id="nextpageimg" src=""/>
130        </div>
131        <div id="prevpagediv" style="clip : rect(0px, {$cgiParamPageWidth}px, {$cgiParamPageHeight}px, {$cgiParamPageWidth}px);">
132          <img border="0" id="prevpageimg" src=""/>
133        </div>
134        <div id="animedgebleed" style="clip : rect(0px, {$cgiParamPageWidth}px, {$cgiParamPageHeight}px, {$cgiParamPageWidth}px);">                             </div>                              <div id="loading">
135        <table height="100%" width="100%">
136          <tr>
137            <td width="45%">                                            </td>                                           <td align="left">
138            <span id="loadingdots">loading</span>
139          </td>
140          </tr>
141        </table>
142          </div>
143          </div>
144          <style>
145        div.postit    {background-color: rgba(250,250,200,0.7);  color: black; }
146        a.postit:link   {background-color: rgba(250,250,200,0.7); color: black; text-decoration: none; }
147        a.postit:visited {background-color: rgba(250,250,200,0.7); color: black; text-decoration: none; }
148       
149        a.postit:hover   {color: rgba(150,110 ,0,0.7); }
150         
151        div.pagemenu    { background-color: rgba(250,250,200,0.7); color: black; }
152          </style>
153         
154         
155         
156          <div id="coord"
157           style="position: absolute; left: 0px; top: 0px; z-index: 10; visibility: hidden;">
158        <xsl:comment>Mouse coord debug div</xsl:comment>
159          </div>
160
161<!--
162<style>
163
164div.postit    {background-color: _postitbgcol_;
165        color: black; }
166a.postit:link    {background-color: _postitbgcol_;
167              color: black;
168              text-decoration: none; }
169a.postit:visited {background-color: _postitbgcol_;
170              color: black;
171              text-decoration: none; }
172
173a.postit:hover   {color: _postitselcol_; }
174
175</style>
176
177<div id="expediteee"
178     style="position: absolute; right: 4px; top: 2px; z-index: 10; visibility: visible;">
179  <a id="expediteemode" class="postit" href=""></a>
180
181  <script type="text/javascript">
182    var href=document.getElementById("expediteemode");
183    var url = document.location.toString();
184
185    var expediteeVal       = (expeditee) ? 1 : 0;
186    var toggleExpediteeVal = (expeditee) ? 0 : 1;
187
188    var replaceRE;
189    var withStr = "&expeditee="+toggleExpediteeVal;
190
191    var cutpos = url.indexOf("&expeditee=");
192
193    if (cutpos>=0) {
194      replaceRE = new RegExp("&expeditee="+expediteeVal);     
195    }
196    else {
197      replaceRE = new RegExp("$");     
198    }
199
200    url = url.replace(replaceRE,withStr);
201    href.setAttribute("href",url);
202
203    if (expeditee) {
204        // toggle
205        href.innerHTML = '<span style="font-size: 9pt;"><i>Switch to standard mode</i></span>';
206    }
207    else {
208        href.innerHTML = '<span style="font-size: 9pt;"><i>Switch to Expeditee mode</i></span>';
209    }
210
211  </script>
212
213
214</div>
215
216-->
217
218
219                           
220              <div class="editable-menu" id="pagemenu" onmouseout="javascript:return musicStand.hidePageMenu(this,event);" style="position: absolute; right: 4px; bottom: 2px;        z-index: 10; visibility: hidden;">
221        <font size="-1">
222          <div class="pagemenu" id="pagemenu1">Cancel turn</div>
223          <div class="pagemenu" id="pagemenu2">Next page</div>
224          <div class="pagemenu" id="pagemenu3">Previous page</div>
225        </font>
226          </div>
227         
228          <div id="annotateCanvas" style="position: absolute; left: 0px; top: 0px; visibility: visible; z-index: 2;" >
229        <!-- filler -->
230          </div>
231        </td>
232        <td>
233          <div id="slidercontainer" style="background: white; position: relative; left: 0px; top: 0px; width: 40px; height: {$cgiParamPageHeight}px;">
234        <div id="sliderbg">
235          <div id="slidertrackabove" style="position: absolute; left: 8px; top: 0px; width: 4px; height: 500px; z-index:4; background-color:#606060;">
236            <!-- filler -->
237          </div>
238          <div id="slidertrackbelow" style="position: absolute; left: 10px; top: 500px; width: 1px; height: 100px; z-index:4; background-color:#606060;">
239            <!-- filler -->
240          </div>
241        </div>
242       
243        <div id="sliderpos" style="width:30px; height:11px;">
244          <img height="11" src="{$httpCollection}/images/brown2-slider.png" width="30"/>
245        </div>
246        <script language="javascript" type="text/javascript">
247          <xsl:text disable-output-escaping="yes">var username = musicStand.getUsername();
248      var metaval;
249
250      if (username != null) {
251          var metaname = username + "-sliderposTop";
252          metaval = 700; // ***** major hack ****
253          //metaval  = gsapi.getLiveMetadata(gs.cgiParams["d"],metaname);
254          //if (metaval == "") {
255          //    // fallback to looking up non-user specific one
256          //    metaval  = gsapi.getLiveMetadata(gs.cgiParams["d"],"sliderposTop");
257          //}
258      }
259      else {
260          //metaval  = gsapi.getLiveMetadata(gs.cgiParams["d"],"sliderposTop");
261          metaval = 700; // ***** major hack ****
262      }
263      var sliderposTop = parseInt(metaval);
264
265      var speedBreak = musicStand.getSpeedBreak();
266
267      if (sliderposTop &gt; 0) {
268          sliderposTop *= musicStand.getScaleFactor();
269          speedBreak = sliderposTop;
270          musicStand.setSpeedBreak(speedBreak);
271      }
272
273      var sliderpos = document.getElementById('sliderpos');
274      sliderpos.style.top = speedBreak + "px";
275          sliderpos.style.left = "-8px";
276      sliderpos.onmousedown = dragSlider;
277      var sliderbg = document.getElementById('sliderbg');
278      sliderbg.onmousedown = dragSlider;
279
280
281      var trackabove = document.getElementById('slidertrackabove');
282      trackabove.style.height = speedBreak + "px";
283
284      var trackbelow = document.getElementById('slidertrackbelow');
285      trackbelow.style.top = speedBreak + "px";
286      trackbelow.style.height = (gs.cgiParams["pageHeight"] - speedBreak) + "px";
287          </xsl:text>
288        </script>
289          </div>
290        </td>
291         </tr>
292        </table>
293                     
294      </div>
295    </div>
296  </xsl:template>
297
298
299
300
301
302
303 
304  <xsl:template name="wrappedDocumentXXX">
305    <xsl:choose>
306      <!-- NOTE: alb = ajax load bypass -->
307      <!--
308       If the docType is hierarchy and we want to bypass the ajax load then do this
309       OR If the docType is hierarchy and we have asked for the expanded document OR we have asked for the top level document then do this
310      -->
311      <xsl:when test="/page/pageResponse/document/@docType = 'hierarchy' and (/page/pageRequest/paramList/param[@name = 'alb']/@value = '1' or (string-length(/page/pageRequest/paramList/param[@name = 'd']/@value) > 0 and (/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or not(util:contains(/page/pageResponse/document/@selectedNode, '.')))))">
312    <div id="gs-document">
313      <xsl:call-template name="documentPre"/>
314      <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
315        <xsl:for-each select="documentNode">
316          <xsl:call-template name="wrapDocumentNodes"/>
317        </xsl:for-each>
318      </div>
319    </div>
320      </xsl:when>
321      <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
322    <div id="gs-document">                         
323      <div id="tocLoadingImage" style="text-align:center;">
324        <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
325      </div>
326    </div>
327    <script type="text/javascript">
328      <xsl:text disable-output-escaping="yes">
329                        $(window).load(function()
330                        {
331                            var sectionID = gs.cgiParams.d;
332                            var callbackFunction = null;
333                            if(sectionID.indexOf("\\.") == -1)
334                            {
335                                callbackFunction = function()
336                                {
337                                    focusSection(sectionID);
338                                };
339                            }
340                       
341                            var docID = sectionID.replace(/([^.]*)\..*/, "$1");
342                            var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
343                            loadTopLevelPage(callbackFunction, url);
344                        });
345      </xsl:text>
346    </script>
347      </xsl:when>
348      <xsl:otherwise>
349    <div id="gs-document">                         
350      <div id="tocLoadingImage" style="text-align:center;">
351        <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
352      </div>
353    </div>
354    <script type="text/javascript">
355      <xsl:text disable-output-escaping="yes">
356                        $(window).load(function()
357                        {
358                            loadTopLevelPage(function()
359                            {
360                                //Don't focus the section until the table of contents is loaded
361                                var tocCheck = function()
362                                {
363                                    if(gs.variables.tocLoaded)
364                                    {
365                                        focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
366                                    }
367                                    else
368                                    {
369                                        setTimeout(tocCheck, 500);
370                                    }
371                                }
372                                tocCheck();
373                            });
374                        });
375      </xsl:text>
376    </script>
377      </xsl:otherwise>
378    </xsl:choose>
379       
380    <div class="clear"><xsl:text> </xsl:text></div>
381  </xsl:template>
382
383</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.