Ignore:
Timestamp:
2012-03-02T12:54:33+13:00 (12 years ago)
Author:
sjm84
Message:

Some major upgrades to the document view

File:
1 edited

Legend:

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

    r25144 r25177  
    100100           
    101101            <div id="doc{@nodeID}" class="sectionContainer"><!-- *** -->
    102                 <xsl:if test="/page/pageRequest/paramList/param[@name = 'documentbasket']/@value = 'on' and /page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
     102                <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
    103103                    <table id="meta{@nodeID}">
    104104                        <xsl:attribute name="style">
     
    124124                    </table>
    125125                </xsl:if>
     126
     127                <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
     128                <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
     129                <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
     130                <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
     131
     132                <xsl:choose>
     133                    <xsl:when test="metadataList/metadata[@name = 'Screen'] and metadataList/metadata[@name = 'Source'] and /page/pageRequest/paramList/param[@name = 'zoom']/@value = 'true'">
     134                        <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
     135                            <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
     136                                <gsf:image type="screen"/>
     137                            </div>
     138                            <div id="mover{util:replace(@nodeID, '.', '_')}" style="border: 1px solid green; position: absolute; top: 0; left: 0; width: 198px; height: 198px; overflow: hidden; z-index: 100; background: white; display: none;">
     139                                <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 200px; height: 200px; position: absolute; top: 0; left: 0; z-index: 200;">
     140                                    <xsl:text> </xsl:text>
     141                                </div>
     142                                <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative;">
     143                                    <gsf:image type="source"/>
     144                                </div>
     145                            </div>
     146                        </div>
     147                        <script type="text/javascript">
     148                            <xsl:text disable-output-escaping="yes">
     149                                $(window).load(function()
     150                                {
     151                                    var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
     152                                    var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
     153                                    var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">
     154                                   
     155                                    nodeID = nodeID.replace(/\./g, "_");
     156                                    var multiplier = bigHeight / smallHeight;
     157
     158                                    $("#wrap" + nodeID).anythingZoomer({
     159                                        smallArea: "#small" + nodeID,
     160                                        largeArea: "#large" + nodeID,
     161                                        zoomPort: "#overlay" + nodeID,
     162                                        mover: "#mover" + nodeID,
     163                                        expansionSize:50, 
     164                                        speedMultiplier:multiplier   
     165                                    });
     166                                });
     167                            </xsl:text>
     168                        </script>
     169                    </xsl:when>
     170                    <xsl:when test="metadataList/metadata[@name = 'Screen']">
     171                        <div id="image{@nodeID}">
     172                            <xsl:attribute name="style">
     173                                <xsl:choose>
     174                                    <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
     175                                        <xsl:text>display:none;</xsl:text>
     176                                    </xsl:when>
     177                                    <xsl:otherwise>
     178                                        <xsl:text>display:block;</xsl:text>
     179                                    </xsl:otherwise>
     180                                </xsl:choose>
     181                            </xsl:attribute>
     182                            <gsf:image type="screen"/>
     183                        </div>
     184                    </xsl:when>
     185                </xsl:choose>
    126186                <div id="text{@nodeID}" class="sectionText"><!-- *** -->
     187                    <xsl:attribute name="style">
     188                        <xsl:choose>
     189                            <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
     190                                <xsl:text>display:none;</xsl:text>
     191                            </xsl:when>
     192                            <xsl:otherwise>
     193                                <xsl:text>display:block;</xsl:text>
     194                            </xsl:otherwise>
     195                        </xsl:choose>
     196                    </xsl:attribute>
    127197                    <!-- Get the section content from the document template -->
    128198                    <xsl:apply-templates select="." mode="document"/>
     
    137207    <!-- the page content -->
    138208    <xsl:template match="/page/pageResponse/document">
    139         <xsl:if test="/page/pageRequest/paramList/param[@name = 'documentbasket']/@value = 'on' and /page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
     209        <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
    140210            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script>
    141211            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts_util.js"><xsl:text> </xsl:text></script>
     
    162232            <xsl:call-template name="documentBerryForDocumentPage"/>
    163233           
    164             <xsl:if test="/page/pageRequest/paramList/param[@name = 'documentbasket']/@value = 'on' and /page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
     234            <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
    165235                <table style="width:100%"><tr>
    166236                    <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
     
    205275                                    <script type="text/javascript">
    206276                                        <xsl:text disable-output-escaping="yes">
    207                                             retrieveTableOfContents();
     277                                            $(window).load(function()
     278                                            {
     279                                                retrieveTableOfContents();
     280                                            });
    208281                                        </xsl:text>
    209282                                    </script>
     283                                    <div id="tocLoadingImage" style="text-align:center;">
     284                                        <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:text> loading...</xsl:text>
     285                                    </div>
    210286                                </xsl:when>
    211287                                <xsl:otherwise>
     
    260336            <xsl:otherwise>
    261337                <div id="gs-document">
    262                     <div id="gs-document-image">
    263                         <xsl:attribute name="class">
    264                             <xsl:text>sectionImage</xsl:text>
    265                             <xsl:if test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'"><xsl:text> hidden</xsl:text></xsl:if>
    266                         </xsl:attribute>
    267                         <!-- Get the section content from the document template -->
    268                         <xsl:call-template name="documentImage"/>
    269                         <xsl:text> </xsl:text>
    270                     </div>
    271                     <div id="gs-document-text" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
    272                         <xsl:attribute name="class">
    273                             <xsl:text>documenttext</xsl:text>
    274                             <xsl:if test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'"><xsl:text> hidden</xsl:text></xsl:if>
    275                         </xsl:attribute>
     338                    <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
    276339                        <xsl:call-template name="wrapDocumentNodes"/>
    277340                    </div>
     
    337400        <xsl:variable name="imageTest"><gsf:metadata name="ScreenWidth"/></xsl:variable>
    338401        <xsl:if test="$imageTest != ''">
    339             <h3>   
     402            <h3>
    340403                <gsf:choose-metadata>
    341404                    <gsf:metadata name="dc.Title"/>
     
    474537       
    475538            <!-- Paged-image options -->
    476             <xsl:if test="/page/pageResponse/document/@docType = 'paged'">
    477                 <td>
    478                     <select id="viewSelection" onchange="changeView();">
    479                         <xsl:choose>
    480                             <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
    481                                 <option>Default view</option>
    482                                 <option selected="true">Image view</option>
    483                                 <option>Text view</option>
    484                             </xsl:when>
    485                             <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
    486                                 <option>Default view</option>
    487                                 <option>Image view</option>
    488                                 <option selected="true">Text view</option>
    489                             </xsl:when>
    490                             <xsl:otherwise>
    491                                 <option selected="true">Default view</option>
    492                                 <option>Image view</option>
    493                                 <option>Text view</option>
    494                             </xsl:otherwise>
    495                         </xsl:choose>
    496                     </select>
    497                 </td>
    498             </xsl:if>
     539            <td>
     540                <select id="viewSelection" onchange="changeView();">
     541                    <xsl:choose>
     542                        <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
     543                            <option>Default view</option>
     544                            <option selected="true">Image view</option>
     545                            <option>Text view</option>
     546                        </xsl:when>
     547                        <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
     548                            <option>Default view</option>
     549                            <option>Image view</option>
     550                            <option selected="true">Text view</option>
     551                        </xsl:when>
     552                        <xsl:otherwise>
     553                            <option selected="true">Default view</option>
     554                            <option>Image view</option>
     555                            <option>Text view</option>
     556                        </xsl:otherwise>
     557                    </xsl:choose>
     558                </select>
     559            </td>
    499560       
    500561            <!-- Realistic books link -->
Note: See TracChangeset for help on using the changeset viewer.