]> 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 f56026f40032966c888952482a9ba1bb4d29fabe..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:param name="uri_set_size" select="'30'"/>
+<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="''"/>
+<!--CSC: end of cut & paste also in metadataLib.xsl -->
 
 <xsl:output method="html" encoding="iso-8859-1"/>
 
   </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"/>
-   <script language="JavaScript" type="text/javascript">
-    <!-- topurl will be used by the code in jsmenu/* -->
-    var topurl = "<subst:topurl/>";
-   </script>
-   <script language="JavaScript" type="text/javascript">
-<![CDATA[
-if(window.event + "" == "undefined") event = null;
-function HM_f_PopUp(){return false};
-function HM_f_PopDown(){return false};
-popUp = HM_f_PopUp;
-popDown = HM_f_PopDown;
-var selectedURI;
-]]>
-   </script>
-   <script language="JavaScript1.2" type="text/javascript">
-<![CDATA[
-HM_PG_MenuWidth = 300;
-HM_PG_FontFamily = "Arial,sans-serif";
-HM_PG_FontSize = 10;
-HM_PG_FontBold = 0;
-HM_PG_FontItalic = 0;
-HM_PG_FontColor = "blue";
-HM_PG_FontColorOver = "green";
-HM_PG_BGColor = "#DDDDDD";
-HM_PG_BGColorOver = "#FFCCCC";
-HM_PG_ItemPadding = 3;
-
-HM_PG_BorderWidth = 2;
-HM_PG_BorderColor = "black";
-HM_PG_BorderStyle = "solid";
-HM_PG_SeparatorSize = 2;
-HM_PG_SeparatorColor = "#d0ff00";
-
-HM_PG_ImageSrc = ]]> topurl + <![CDATA["/javascript/jsmenu/HM_More_black_right.gif";
-HM_PG_ImageSrcLeft = ]]> topurl + <![CDATA["/javascript/jsmenu/HM_More_black_left.gif";
-HM_PG_ImageSrcOver = ]]> topurl + <![CDATA["/javascript/jsmenu/HM_More_white_right.gif";
-HM_PG_ImageSrcLeftOver = ]]> topurl + <![CDATA["/javascript/jsmenu/HM_More_white_left.gif";
-
-HM_PG_ImageSize = 5;
-HM_PG_ImageHorizSpace = 0;
-HM_PG_ImageVertSpace = 2;
-
-HM_PG_KeepHilite = true; 
-HM_PG_ClickStart = 0;
-HM_PG_ClickKill = false;
-HM_PG_ChildOverlap = 20;
-HM_PG_ChildOffset = 10;
-HM_PG_ChildPerCentOver = null;
-HM_PG_TopSecondsVisible = .5;
-HM_PG_StatusDisplayBuild =0;
-HM_PG_StatusDisplayLink = 0;
-HM_PG_UponDisplay = null;
-HM_PG_UponHide = null;
-HM_PG_RightToLeft = 0;
-
-HM_PG_CreateTopOnly = 0;
-HM_PG_ShowLinkCursor = 1;
-HM_PG_NSFontOver = true;
-
-//HM_a_TreesToBuild = [2];
-]]>
+   <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">
-  <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/>
-   <script>
-HM_Array1 = [
-<![CDATA[
-[,,,
-,,,,,,,,,,,,,,,,
-1,true],
-["Objects this one depends on.","javascript:window.open(mkDepURL(selectedURI,false),'graph')",1,0,0],
-["Render this object.","javascript:window.open(mkCICURL(selectedURI),'cic')",1,0,0],
-["Objects depending on this one.","javascript:window.open(mkMetaURL(selectedURI,false),'graph')",1,0,0]
-];
-]]>
-   </script>
-   <subst:script Language="JavaScript1.2" src="/javascript/jsmenu/HM_Loader_prova.js"/>
+   <div style="position: absolute" id="HJMmenu">
+    <!-- The two nested tables are for NS 4.0 where every -->
+    <!-- layer has a default transparent background color -->
+    <table bgColor="green" id="pippo">
+     <tr><td>
+      <table bgColor="cyan" border="2">
+       <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>
+   </div>
+   <script>initializeMenu()</script>
   </xsl:copy>
 </xsl:template>
 
-<xsl:template match = "area">
- <xsl:variable name="uri" select="@href"/>
+<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;)">
-<!-- CSC: I don't know why the following one does not work.
-     CSC: Replaced with the following line
-   <xsl:attribute name="onMouseOver">selectedURI=this.href;HM_f_PopUp('elMenu1',event)</xsl:attribute>
--->
-   <xsl:attribute name="onMouseOver">selectedURI='<xsl:value-of select="$uri"/>';HM_f_PopUp('elMenu1',event)</xsl:attribute>
-   <xsl:attribute name="onMouseOut">HM_f_PopDown('elMenu1')</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/>
  </xsl:copy>