Ignore:
Timestamp:
2011-09-22T09:28:27+12:00 (13 years ago)
Author:
papitha
Message:
 
Location:
main/trunk/model-cols-dev/peijones/transform/pages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-cols-dev/peijones/transform/pages/about.xsl

    r24616 r24629  
    186186                imageURL = imageURL.replace(/\\/gi, "/");
    187187                imageURL = imageURL.replace(/%5C/gi, "/");
     188               
    188189                imageURL = imageURL.substring(imageURL.indexOf("sites"));
    189190               
  • main/trunk/model-cols-dev/peijones/transform/pages/document.xsl

    r24616 r24629  
    2323        </xsl:choose>
    2424    </xsl:variable>
    25 
    26     <!-- set page title -->
    27     <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
    28 
    29     <!-- set page breadcrumbs -->
    30     <xsl:template name="breadcrumbs">
    31         <gslib:siteLink/><gslib:rightArrow/>
    32         <gslib:collectionNameLinked/><gslib:rightArrow/>
    33         <a>
    34             <xsl:attribute name="href">
    35                 <xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="$collName"/>&amp;d=<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>&amp;dt=<xsl:value-of select="/page/pageResponse/document/documentNode/@docType"/>&amp;p.a=b&amp;p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>
    36             </xsl:attribute>
    37             <xsl:variable name="documentTitleVar">
    38                 <gslib:documentTitle/>
    39             </xsl:variable>
    40             <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
    41         </a>
    42     </xsl:template>
    43    
    44     <xsl:template match="/">
    45         <xsl:choose>
    46             <!-- if this is the realistic books version of the page -->
    47             <xsl:when test="$bookswitch = 'flashxml'">
    48                 <html>
    49                     <body>
    50                         <xsl:apply-templates select="/page/pageResponse/document"/>
    51                     </body>
    52                 </html>
    53             </xsl:when>
    54             <!-- if this is the regular version of the page -->
    55             <xsl:otherwise>
    56                 <xsl:apply-imports/>
    57             </xsl:otherwise>
    58         </xsl:choose>
    59     </xsl:template>
    6025
    6126    <!-- the page content -->
     
    7439        </div>
    7540
    76         <input type="button" value="Add a Note!" style="margin-left:30px;" onclick="AddNote();" />
     41        <input type="button" value="Tag Photo!" style="margin-left:30px;" onclick="AddNote();" />
    7742        <script type="text/javascript">
    7843            <xsl:text disable-output-escaping="yes">
     
    8550                    var callback =
    8651                    {
    87                         success: function(response){},
     52                        success: function(response)
     53                        {
     54                            var updateCallback =
     55                            {
     56                                success: function(response){},
     57                                failed: function(){}
     58                            };
     59                           
     60                            var updateURL = gs.siteMetadata.siteURL.replace("8080","9090") + gs.xsltParams.library_name + "?a=s&amp;sa=c";
     61                            YAHOO.util.Connect.asyncRequest("GET", updateURL, updateCallback);
     62                        },
    8863                        failed: function(){},
    89                         timeout: 5000
    9064                    };
    9165                   
    92                     var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=remove-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metapos=" + note.id;
     66                    var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=remove-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=gsimg.photoNote";
    9367                    YAHOO.util.Connect.asyncRequest("GET", url, callback);
    9468                    return true;
     
    9973                    var callback =
    10074                    {
    101                         success: function(response){},
     75                        success: function(response)
     76                        {
     77                            var updateCallback =
     78                            {
     79                                success: function(response){},
     80                                failed: function(){}
     81                            };
     82                           
     83                            var updateURL = gs.siteMetadata.siteURL.replace("8080","9090") + gs.xsltParams.library_name + "?a=s&amp;sa=c";
     84                            YAHOO.util.Connect.asyncRequest("GET", updateURL, updateCallback);
     85                        },
    10286                        failed: function(){},
    103                         timeout: 5000
    10487                    };
    10588                   
    10689                    var jsonVal = '{"caption":"' + note.text + '", "area":{"x":' + note.rect.left + ', "y":' + note.rect.top + ', "width":' + note.rect.width + ', "height":' + note.rect.height + '}}';
    107                     var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=set-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metavalue=" + jsonVal + "&amp;metapos=" + note.id;
    108                     YAHOO.util.Connect.asyncRequest("GET", url, callback);
     90                    var saveURL = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=set-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=gsimg.photoNote&amp;metavalue=" + jsonVal + "&amp;metapos=" + ((note &amp;&amp; note.id &amp;&amp; note.id &gt; 0) ? note.id - 1 : posCount);
     91                    YAHOO.util.Connect.asyncRequest("GET", saveURL, callback);
     92                   
    10993                    return 1;
    11094                }               
    11195               
    112                 function getNotes(count)
     96                function getNotes()
    11397                {
    114                     var callback =
    115                     {
    116                         success: function(response)
    117                         {
    118                             if(response.responseText.search(/\w/) == -1)
    119                             {
    120                                 return;
    121                             }
    122                             posCount++;
    123                            
    124                             var jsonObj = eval("(" + response.responseText + ")");
    125                             var newNote = new PhotoNote(jsonObj.caption, this.count, new PhotoNoteRect(jsonObj.area.x,jsonObj.area.y,jsonObj.area.width,jsonObj.area.height));
    126                             newNote.onsave = saveFunction;
    127                             newNote.ondelete = deleteFunction;
    128                             notes.AddNote(newNote);
    129                             getNotes(this.count + 1);
    130                         },
    131                         failed: function(){},
    132                         timeout: 5000
    133                     };
    134                    
    135                     var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=get-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metapos=" + count;
    136                     //var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=get-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=[dc.Title]";
    137                     callback.count = count;
    138                     YAHOO.util.Connect.asyncRequest("GET", url, callback);
     98                    if(gs.variables.photoNotes == null || gs.variables.photoNotes == undefined)
     99                    {
     100                        console.log("No photo notes");
     101                        return;
     102                    }
     103                   
     104                    for(var i = 0; i &lt; gs.variables.photoNotes.length; i++)
     105                    {
     106                        var note = gs.variables.photoNotes[i];
     107                        if(!note)
     108                        {
     109                            continue;
     110                        }
     111                        var newNote = new PhotoNote(note.caption, i+1, new PhotoNoteRect(note.area.x,note.area.y,note.area.width,note.area.height));
     112                        newNote.onsave = saveFunction;
     113                        newNote.ondelete = deleteFunction;
     114                        notes.AddNote(newNote);
     115                    }
     116                    posCount = gs.variables.photoNotes.length - 1;
    139117                }
    140118               
     
    147125                    newNote.Select();
    148126                }
    149                 getNotes(0);
     127                window.onload = getNotes;
    150128            </xsl:text>
    151129        </script>
     
    236214    </xsl:template>
    237215   
    238     <!-- Highlight annotations if requested -->
    239     <xsl:template match="annotation">
    240         <xsl:choose>
    241             <xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']">
    242                 <span class="termHighlight"><xsl:value-of select="."/></span>
    243             </xsl:when>
    244             <xsl:otherwise>
    245                 <span class="noTermHighlight"><xsl:value-of select="."/></span>
    246             </xsl:otherwise>
    247         </xsl:choose>
    248     </xsl:template>
    249    
    250     <!-- This template is used to display the document content -->
    251     <xsl:template match="documentNode" mode="document">
    252         <a name="{@nodeID}"><xsl:text> </xsl:text></a>
    253         <!-- Section header -->
    254         <table class="sectionHeader"><tr>
    255             <!-- Expand/collapse button -->
    256             <td class="headerTD">
    257                 <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">         
    258                     <xsl:attribute name="src">
    259                         <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
    260                     </xsl:attribute>
    261                 </img>
    262             </td>
    263            
    264             <!-- Automatic section number -->
    265             <td class="headerTD">
    266                 <p>
    267                     <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
    268                    
    269                     <xsl:if test="util:hashToSectionId(@nodeID)">
    270                         <span class="sectionNumberSpan">
    271                             <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
    272                             <xsl:text> </xsl:text>
    273                         </span>
    274                     </xsl:if>
    275                     <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
    276                     <span class="sectionTitle"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/></span>
    277                 </p>
    278             </td>
    279            
    280             <!-- "back to top" link -->
    281             <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
    282                 <td class="backToTop headerTD">
    283                     <a href="#top">
    284                         <xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
    285                     </a>
    286                 </td>
    287             </xsl:if>
    288         </tr></table>
    289        
    290         <!-- Section text -->
    291         <div id="doc{@nodeID}" class="sectionContainer" style="display:block;">     
    292             <xsl:for-each select="nodeContent">
    293                 <xsl:for-each select="node()">
    294                     <xsl:choose>
    295                         <xsl:when test="not(name())">
    296                             <xsl:value-of select="." disable-output-escaping="yes"/>
    297                         </xsl:when>
    298                         <xsl:otherwise>
    299                             <xsl:apply-templates select="."/>
    300                         </xsl:otherwise>
    301                     </xsl:choose>
    302                 </xsl:for-each>
    303             </xsl:for-each>
    304             <xsl:if test="documentNode">
    305                 <xsl:apply-templates select="documentNode" mode="document"/>
    306             </xsl:if>
    307         </div> 
    308 
    309     </xsl:template>
    310 
    311     <!-- This template is used to display the table of contents -->
    312     <xsl:template match="documentNode" mode="TOC">
    313 
    314         <!-- check if this is the currently selected table of contents item -->
    315         <xsl:variable name="isCurrent" select="nodeContent"/>
    316 
    317         <!-- formulate the link -->
    318         <xsl:variable name="contentsLink">
    319             <xsl:value-of select='$library_name'/>?a=d&amp;c=<gslib:collectionNameShort/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&amp;sib=1
    320         </xsl:variable>
    321 
    322         <ul>
    323             <table><tr>
    324                 <!-- The expand/collapse button (not displayed for the top level node) -->
    325                 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
    326                     <td>
    327                         <xsl:choose>
    328                             <xsl:when test="not(nodeContent and not(documentNode))">
    329                                 <img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
    330                                     <xsl:attribute name="src">
    331                                         <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
    332                                     </xsl:attribute>
    333                                 </img>
    334                             </xsl:when>
    335                             <xsl:otherwise>
    336                                 <xsl:attribute name="class">emptyIcon</xsl:attribute>
    337                             </xsl:otherwise>
    338                         </xsl:choose>
    339                     </td>
    340                 </xsl:if>
    341                
    342                 <!-- The chapter/page icon -->
    343                 <td>
    344                     <img>
    345                         <xsl:if test="nodeContent and not(documentNode)">
    346                             <xsl:attribute name="class">leafNode</xsl:attribute>
    347                         </xsl:if>
    348                        
    349                         <xsl:attribute name="src">
    350                             <xsl:choose>
    351                                 <xsl:when test="nodeContent and not(documentNode)">
    352                                     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/>
    353                                 </xsl:when>
    354                                 <xsl:otherwise>
    355                                     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
    356                                 </xsl:otherwise>
    357                             </xsl:choose>
    358                         </xsl:attribute>
    359                     </img>
    360                 </td>
    361                
    362                 <!-- The section name, links to the section in the document -->
    363                 <td>               
    364                     <a>
    365                         <xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
    366                         <xsl:if test="util:hashToSectionId(@nodeID)">
    367                             <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
    368                             <xsl:text> </xsl:text>
    369                         </xsl:if>
    370                         <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
    371                     </a>
    372                 </td>
    373             </tr></table>
    374        
    375             <!-- display any child items -->       
    376             <xsl:if test="documentNode">
    377                 <li id="toc{@nodeID}" style="display:block;">
    378                     <xsl:apply-templates select="documentNode" mode="TOC"/>
    379                 </li>
    380             </xsl:if>
    381            
    382         </ul>
    383     </xsl:template>
    384    
    385     <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
    386     <xsl:template match="documentNode" mode="flashxml">
    387         <xsl:text disable-output-escaping="yes">
    388             &lt;Section&gt;
    389             &lt;Description&gt;
    390             &lt;Metadata name="Title"&gt;
    391         </xsl:text>
    392         <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
    393         <xsl:text disable-output-escaping="yes">
    394             &lt;/Metadata&gt;
    395             &lt;/Description&gt;
    396         </xsl:text>
    397        
    398         <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
    399                
    400         <xsl:if test="documentNode">
    401             <xsl:apply-templates select="documentNode" mode="flashxml"/>
    402         </xsl:if>
    403                
    404         <xsl:text disable-output-escaping="yes">
    405             &lt;/Section&gt;
    406         </xsl:text>
    407     </xsl:template>
    408    
    409     <xsl:template name="externalPage">
    410         <xsl:param name="external"/>
    411         <xsl:variable name="go_forward_link">
    412             <a>
    413                 <xsl:attribute name="href">
    414                     <xsl:value-of select="$external"/>
    415                 </xsl:attribute>
    416                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
    417             </a>
    418         </xsl:variable>
    419         <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
    420         <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
    421     </xsl:template>
    422 
    423     <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
    424    
    425     <xsl:template name="viewOptions">
    426         <table class="viewOptions"><tr>
    427             <!-- Realistic books link -->
    428             <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
    429                 <td>
    430                     <img>
    431                         <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
    432                     </img>
    433                     <input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
    434                 </td>
    435             </xsl:if>
    436            
    437             <!-- Highlight on/off button -->
    438             <xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q' and count(//annotation) > 0">
    439                 <td>
    440                     <img>
    441                         <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
    442                     </img>
    443                     <input id="highlightOption" type="checkbox" class="optionCheckBox">
    444                         <xsl:choose>
    445                             <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
    446                                 <xsl:attribute name="onclick">
    447                                     <xsl:text>removeHighlight();</xsl:text>
    448                                 </xsl:attribute>
    449                                 <xsl:attribute name="checked">true</xsl:attribute>
    450                             </xsl:when>
    451                             <xsl:otherwise>
    452                                 <xsl:attribute name="onclick">
    453                                     <xsl:text>addHighlight();</xsl:text>
    454                                 </xsl:attribute>
    455                             </xsl:otherwise>
    456                         </xsl:choose>
    457                     </input>
    458                 </td>
    459             </xsl:if>
    460         </tr></table>   
    461     </xsl:template>
    462216</xsl:stylesheet>
    463217
Note: See TracChangeset for help on using the changeset viewer.