Ignore:
Timestamp:
2011-05-17T12:19:08+12:00 (13 years ago)
Author:
sjm84
Message:

Another big set of updates to the Oran interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/transform/document-scripts.xsl

    r24009 r24018  
    169169                {
    170170                    var textDiv = document.getElementById("gs-document-text");
    171                     textDiv.style.display = "none";
     171                    textDiv.style.visibility = "hidden";
    172172                }
    173173               
     
    175175                {
    176176                    var textDiv = document.getElementById("gs-document-text");
    177                     textDiv.style.display = "block";
     177                    textDiv.style.visibility = "visible";
    178178                }
    179179               
     
    183183                    bookDiv.style.visibility = "hidden";
    184184                    bookDiv.style.height = "0px";
     185                   
     186                    var bookObject = document.getElementById("bookObject");
     187                    bookObject.style.visibility = "hidden";
     188                    bookObject.style.height = "0px";
     189                   
     190                    var bookEmbed = document.getElementById("bookEmbed");
     191                    bookEmbed.style.visibility = "hidden";
     192                    bookEmbed.style.height = "0px";
    185193                }
    186194               
     
    190198                    bookDiv.style.visibility = "visible";
    191199                    bookDiv.style.height = "600px";
     200                   
     201                    var bookObject = document.getElementById("bookObject");
     202                    bookObject.style.visibility = "visible";
     203                    bookObject.style.height = "600px";
     204                   
     205                    var bookEmbed = document.getElementById("bookEmbed");
     206                    bookEmbed.style.visibility = "visible";
     207                    bookEmbed.style.height = "600px";
     208                }
     209               
     210                function swapLinkJavascript(rbOn)
     211                {
     212                    var option = document.getElementById("rbOption");
     213                    if(rbOn)
     214                    {
     215                        option.setAttribute("onclick", "hideText(); showBook(); swapLinkJavascript(false);");
     216                    }
     217                    else
     218                    {
     219                        option.setAttribute("onclick", "hideBook(); showText(); swapLinkJavascript(true);");
     220                    }
    192221                }
    193222               
     
    201230                }
    202231               
    203                 function swapLinkJavascript(rbOn)
    204                 {
    205                     var option = document.getElementById("rbOption");
    206                     if(rbOn)
    207                     {
    208                         option.setAttribute("onclick", "hideText(); showBook(); swapLinkJavascript(false);");
    209                     }
    210                     else
    211                     {
    212                         option.setAttribute("onclick", "hideBook(); showText(); swapLinkJavascript(true);");
    213                     }
    214                 }
    215                
    216232                function loadBook()
    217233                {
    218                     //Work out the URL to the cover image and the document
    219                     var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';
    220234                    var doc_url = document.URL;
    221235                    doc_url = doc_url.replace(/(&amp;|\?)book=[a-z]+/gi,'');
    222                     doc_url += '&amp;book=flashxml';   
    223                    
    224                     //The outer OBJECT element
    225                     var objectElem = document.createElement("OBJECT");
    226                     objectElem.setAttribute("align", "middle");
    227                     objectElem.setAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
    228                     objectElem.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
    229                     objectElem.setAttribute("height", "600px");
    230                     objectElem.setAttribute("width", "70%");
    231                     objectElem.setAttribute("id", "bookObject");
    232                    
    233                     //Parameter list
    234                     var params = new Array();
    235                     params[0] = createParam("allowScriptAccess", "always");
    236                     params[1] = createParam("movie", "RealisticBook.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
    237                     params[2] = createParam("quality", "high");
    238                     params[3] = createParam("bgcolor", "#FFFFFF");
    239                    
    240                     //The embed element that goes into the object element
    241                     var embedElem = document.createElement("EMBED");
    242                     embedElem.setAttribute("allowScriptAccess", "always");
    243                     embedElem.setAttribute("swLiveConnect", "true");
    244                     embedElem.setAttribute("bgcolor", "#FFFFFF");
    245                     embedElem.setAttribute("height", "600px");
    246                     embedElem.setAttribute("name", "Book");
    247                     embedElem.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
    248                     embedElem.setAttribute("quality", "high");
    249                     embedElem.setAttribute("src", "RealisticBook.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
    250                     embedElem.setAttribute("type", "application/x-shockwave-flash");
    251                     embedElem.setAttribute("width", "70%");
    252                    
    253                     //Append the param and embed elements to the object element
    254                     for(var i = 0; i &lt; params.length; i++)
    255                     {
    256                         objectElem.appendChild(params[i]);
    257                     }
    258                     objectElem.appendChild(embedElem);
    259                    
    260                     //Append the object element to the page
    261                     var flashDiv = document.getElementById("bookdiv");
    262                     flashDiv.appendChild(objectElem);
     236                    doc_url += '&amp;book=flashxml';
     237                   
     238                    var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';
     239
     240                    var flash_plug_html = ""
     241                    flash_plug_html += '&lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
     242                    flash_plug_html += '  height="600px" id="bookObject" swLiveConnect="true" \n';
     243                    flash_plug_html += '  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
     244                    flash_plug_html += '  width="70%"&gt;\n';
     245                    flash_plug_html += '    &lt;PARAM name="allowScriptAccess" value="always" /&gt;\n';
     246                    flash_plug_html += '    &lt;PARAM name="movie" value="Book.swf';
     247                    flash_plug_html += '?src_image=' + escape(img_cover);
     248                    flash_plug_html += '&amp;doc_url=' + escape(doc_url)
     249                    flash_plug_html += '" /&gt;\n';
     250                    flash_plug_html += '    &lt;PARAM name="quality" value="high" /&gt;\n';
     251                    flash_plug_html += '    &lt;PARAM name="bgcolor" value="#FFFFFF" /&gt;\n';
     252                    flash_plug_html += '    &lt;EMBED align="middle" \n';
     253                    flash_plug_html += '      allowScriptAccess="always" swLiveConnect="true" \n';
     254                    flash_plug_html += '      bgcolor="#FFFFFF" height="600px" name="Book" \n';
     255                    flash_plug_html += '      pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
     256                    flash_plug_html += '      quality="high" id="bookEmbed"\n';
     257                    flash_plug_html += '      src="Book.swf';
     258                    flash_plug_html += '?src_image=' + escape(img_cover);
     259                    flash_plug_html += '&amp;doc_url=' + escape(doc_url);
     260                    flash_plug_html += '"\n';
     261                    flash_plug_html += '      type="application/x-shockwave-flash" width="70%" /&gt;\n';
     262                    flash_plug_html += '&lt;/OBJECT&gt;\n';
     263                    var flash_div = document.getElementById("bookdiv");
     264                    flash_div.innerHTML = flash_plug_html;
     265                }
     266               
     267                if(document.URL.indexOf("book=on") != -1)
     268                {
     269                    loadBook();
    263270                }
    264271            </xsl:text>
Note: See TracChangeset for help on using the changeset viewer.