Changeset 29172

Show
Ignore:
Timestamp:
07.08.2014 12:47:31 (5 years ago)
Author:
kjdon
Message:

some mods to do with getting the editing controls to stay on the page when scrolling. moved soem javascript to a separate template so that it can easily be added to by another interface. Moved around inclusion of scripts a bit so that can override the javascript in javascriptForDocumentEditing template

Files:
1 modified

Legend:

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

    r29166 r29172  
    230230    </xsl:template> 
    231231 
    232     <!-- the page content --> 
    233     <xsl:template match="/page/pageResponse/document"> 
    234       <xsl:variable name="canDoEditing"> 
    235         <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' 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))">true</xsl:if> 
    236       </xsl:variable> 
    237       <xsl:if test="$canDoEditing = 'true'"> 
     232    <xsl:template name="javascriptForDocumentEditing"> 
    238233            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script> 
    239234            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts_util.js"><xsl:text> </xsl:text></script> 
     
    249244                </xsl:text> 
    250245            </script> 
    251             <gsf:metadata name="all"/> 
    252             <gslib:langfrag name="dse"/> 
    253         </xsl:if> 
     246       
     247    </xsl:template> 
     248 
     249    <!-- the page content --> 
     250    <xsl:template match="/page/pageResponse/document"> 
     251      <xsl:if test="$bookswitch = 'off'"> 
     252        <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script> 
     253             
     254        <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'"> 
     255          <script type="text/javascript"> 
     256        <xsl:text disable-output-escaping="yes"> 
     257          if(document.URL.indexOf("book=on") != -1) 
     258          { 
     259          loadBook(); 
     260          } 
     261        </xsl:text> 
     262          </script> 
     263        </xsl:if> 
     264      </xsl:if> 
     265      <xsl:variable name="canDoEditing"> 
     266        <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' 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))">true</xsl:if> 
     267      </xsl:variable> 
     268      <xsl:if test="$canDoEditing = 'true'"> 
     269        <xsl:call-template name="javascriptForDocumentEditing"/> 
     270        <gsf:metadata name="all"/> 
     271        <gslib:langfrag name="dse"/> 
     272      </xsl:if> 
    254273 
    255274        <xsl:if test="$bookswitch = 'off'"> 
    256275            <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div> 
    257276         
    258             <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script> 
    259              
    260             <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'"> 
    261                 <script type="text/javascript"> 
    262                     <xsl:text disable-output-escaping="yes"> 
    263                         if(document.URL.indexOf("book=on") != -1) 
    264                         { 
    265                             loadBook(); 
    266                         } 
    267                     </xsl:text> 
    268                 </script> 
    269             </xsl:if> 
    270                      
     277            <div id="float-anchor" style="width: 30%; min-width:180px; float:right; margin: 0 0 10px 20px;">         
    271278            <xsl:if test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' 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))"> 
    272279                <xsl:call-template name="editBar"/> 
    273280            </xsl:if> 
    274  
    275281            <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'"> 
    276282                <xsl:call-template name="rightSidebar"/> 
    277283            </xsl:if> 
     284            </div> 
     285            <script type="text/javascript">  
     286              if (keep_editing_controls_visible) { 
     287              $(function() { 
     288              moveScroller(); 
     289              }); 
     290              } 
     291            </script>    
    278292        </xsl:if> 
    279293         
     
    315329                <xsl:call-template name="documentHeading"/><br/> 
    316330                <xsl:call-template name="documentContent"/> 
    317             </xsl:when>          
     331            </xsl:when>  
    318332            <xsl:otherwise> <!-- display the standard greenstone document --> 
    319333                <xsl:call-template name="wrappedDocument"/> 
     
    402416     
    403417    <xsl:template name="editBar"> 
    404         <table style="width:100%"><tr> 
     418        <table style="width:100%; border:none;" id="editBar" class="ui-widget-content"><tr> 
    405419            <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td> 
    406420            <td id="editBarRight">