]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/xslt/makeGraphLinks.xsl
ocaml 3.09 transition
[helm.git] / helm / on-line / xslt / makeGraphLinks.xsl
index 49122be2bc702382f9262999d0269d832a63d39c..4ee9dcc24f867dfe3ba12d980682095306c89b16 100644 (file)
 <!-- http://cs.unibo.it/helm/.                                         -->
 
 <xsl:stylesheet version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml" 
+ xmlns:html="http://www.w3.org/1999/xhtml" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:subst="http://www.cs.unibo.it/helm/subst">
 
 <xsl:import href="utils.xsl"/>
+<xsl:import href="links_library.xsl"/>
 
 <!--CSC: code cut & pasted also in metadataLib.xsl -->
 <xsl:param name="uri_set_size" select="''"/>
   </xsl:copy>
 </xsl:template>
 
-<xsl:template match="head">
+<xsl:template match="html:head">
   <xsl:copy>
    <xsl:copy-of select="@*"/>
-   <subst:script language="JavaScript" src="/javascript/defaults.js"/>
-   <subst:script language="JavaScript" src="/javascript/utils.js"/>
-   <subst:script language="JavaScript" src="/javascript/control.js"/>
-   <subst:script language="JavaScript" src="/javascript/graphLinks.js"/>
    <subst:script language="JavaScript" src="/javascript/helmjsmenu.js"/>
    <script>
     var lastX, lastY;
     var selectedURI;
+    var selectedCICURL;
+    var selectedForwardURL;
+    var selectedBackwardURL;
    </script>
    <xsl:apply-templates/>
   </xsl:copy>
 </xsl:template>
 
-<xsl:template match="body">
-  <!--CSC: end of cut & paste also in metadataLib.xsl -->
-  <form name="uri_set_size">
-   Number of nodes to show when following an hyperlink:
-   <input type="text" onClick="return false" value="{$uri_set_size}" size="2"/> (30 suggested)
-  </form>
+<xsl:template match="html:body">
   <!--CSC: end of cut & paste also in metadataLib.xsl -->
   <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="onClick">hideMenu();</xsl:attribute>
+   <!--CSC: end of cut & paste also in metadataLib.xsl -->
    <xsl:apply-templates/>
    <div style="position: absolute" id="HJMmenu">
     <!-- The two nested tables are for NS 4.0 where every -->
     <table bgColor="green" id="pippo">
      <tr><td>
       <table bgColor="cyan" border="2">
-       <tr><td><a href="" onClick="this.href=mkDepURL(selectedURI);">Objects this one depends on.</a></td></tr>
-       <tr><td><a href="" onClick="this.href=mkCICURL(selectedURI);" target="cic">Render this object.</a></td></tr>
-       <tr><td><a href="" onClick="this.href=mkMetaTheoryURL(selectedURI);" target="theory">Objects depending directly on this one.</a></td></tr>
-       <tr><td><a href="" onClick="this.href=mkMetaURL(selectedURI);">Objects depending on this one.</a></td></tr>
+       <tr><td><a href="javascript: location = selectedForwardURL">Objects this one depends on.</a></td></tr>
+       <tr><td><a href="javascript: var _ = window.open(selectedCICURL,'_top')">Render this object.</a></td></tr>
+       <tr><td><a href="javascript: location = selectedBackwardURL">Objects depending on this one.</a></td></tr>
       </table>
      </td></tr>
     </table>
   </xsl:copy>
 </xsl:template>
 
-<xsl:template match = "area">
+<xsl:template match="html:area">
  <xsl:variable name="quoteduri">
   <xsl:call-template name="jsquote">
    <xsl:with-param name="s" select="@href"/>
   </xsl:call-template>
  </xsl:variable>
+ <xsl:variable name="cicurl">
+  <xsl:call-template name="makeURL">
+   <xsl:with-param name="uri" select="@href"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="quotedcicurl">
+  <xsl:call-template name="jsquote">
+   <xsl:with-param name="s" select="$cicurl"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="forwardURL">
+  <xsl:call-template name="makeGraphURL">
+   <xsl:with-param name="uri" select="@href"/>
+   <xsl:with-param name="keys" select="'MDG'"/>
+   <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="quotedForwardURL">
+  <xsl:call-template name="jsquote">
+   <xsl:with-param name="s" select="$forwardURL"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="backwardURL">
+  <xsl:call-template name="makeGraphURL">
+   <xsl:with-param name="uri" select="@href"/>
+   <xsl:with-param name="keys" select="'MMG'"/>
+   <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="quotedBackwardURL">
+  <xsl:call-template name="jsquote">
+   <xsl:with-param name="s" select="$backwardURL"/>
+  </xsl:call-template>
+ </xsl:variable>
  <xsl:copy>
   <xsl:copy-of select="@*"/> 
   <xsl:if test="starts-with(@href,&quot;cic:&quot;)">
-   <xsl:attribute name="onMouseOver">lastX = getX(event); lastY = getY(event);selectedURI='<xsl:value-of select="$quoteduri"/>';</xsl:attribute>
+   <xsl:attribute name="onMouseOver">lastX = getX(event); lastY = getY(event); selectedURI='<xsl:value-of select="$quoteduri"/>'; selectedCICURL='<xsl:value-of select="$quotedcicurl"/>'; selectedForwardURL='<xsl:value-of select="$quotedForwardURL"/>'; selectedBackwardURL='<xsl:value-of select="$quotedBackwardURL"/>';</xsl:attribute>
    <xsl:attribute name="href">javascript:moveMenu(lastX,lastY); showMenu();</xsl:attribute>
   </xsl:if>
   <xsl:apply-templates/>