]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/makeGraphLinks.xsl
JSMmenu links fixed.
[helm.git] / helm / on-line / xslt / makeGraphLinks.xsl
1 <?xml version="1.0"?>
2
3 <!-- Copyright (C) 2000, HELM Team                                     -->
4 <!--                                                                   -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic            -->
6 <!-- Library of Mathematics, developed at the Computer Science         -->
7 <!-- Department, University of Bologna, Italy.                         -->
8 <!--                                                                   -->
9 <!-- HELM is free software; you can redistribute it and/or             -->
10 <!-- modify it under the terms of the GNU General Public License       -->
11 <!-- as published by the Free Software Foundation; either version 2    -->
12 <!-- of the License, or (at your option) any later version.            -->
13 <!--                                                                   -->
14 <!-- HELM is distributed in the hope that it will be useful,           -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
17 <!-- GNU General Public License for more details.                      -->
18 <!--                                                                   -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software               -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
22 <!-- MA  02111-1307, USA.                                              -->
23 <!--                                                                   -->
24 <!-- For details, see the HELM World-Wide-Web page,                    -->
25 <!-- http://cs.unibo.it/helm/.                                         -->
26
27 <xsl:stylesheet version="1.0"
28  xmlns="http://www.w3.org/1999/xhtml" 
29  xmlns:html="http://www.w3.org/1999/xhtml" 
30  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31  xmlns:subst="http://www.cs.unibo.it/helm/subst">
32
33 <xsl:import href="utils.xsl"/>
34 <xsl:import href="links_library.xsl"/>
35
36 <!--CSC: code cut & pasted also in metadataLib.xsl -->
37 <xsl:param name="uri_set_size" select="''"/>
38 <!--CSC: end of cut & paste also in metadataLib.xsl -->
39
40 <xsl:output method="html" encoding="iso-8859-1"/>
41
42 <xsl:template match="/|*">
43   <xsl:copy>
44    <xsl:copy-of select="@*"/>
45    <xsl:apply-templates/>
46   </xsl:copy>
47 </xsl:template>
48
49 <xsl:template match="html:head">
50   <xsl:copy>
51    <xsl:copy-of select="@*"/>
52    <subst:script language="JavaScript" src="/javascript/helmjsmenu.js"/>
53    <script>
54     var lastX, lastY;
55     var selectedURI;
56     var selectedCICURL;
57     var selectedTheoryURL;
58     var selectedForwardURL;
59     var selectedBackwardURL;
60    </script>
61    <xsl:apply-templates/>
62   </xsl:copy>
63 </xsl:template>
64
65 <xsl:template match="html:body">
66   <!--CSC: end of cut & paste also in metadataLib.xsl -->
67   <xsl:copy>
68    <xsl:copy-of select="@*"/>
69    <xsl:attribute name="onClick">hideMenu();</xsl:attribute>
70    <!--CSC: end of cut & paste also in metadataLib.xsl -->
71    <form name="uri_set_size">
72     Number of nodes to show when following an hyperlink:
73     <input type="text" onClick="return false" value="{$uri_set_size}" size="2"/> (30 suggested)
74    </form>
75    <xsl:apply-templates/>
76    <div style="position: absolute" id="HJMmenu">
77     <!-- The two nested tables are for NS 4.0 where every -->
78     <!-- layer has a default transparent background color -->
79     <table bgColor="green" id="pippo">
80      <tr><td>
81       <table bgColor="cyan" border="2">
82        <tr><td><a href="javascript: var _ = window.open(selectedForwardURL)">Objects this one depends on.</a></td></tr>
83        <tr><td><a href="javascript: var _ = window.open(selectedCICURL,'_top')">Render this object.</a></td></tr>
84        <tr><td><a href="javascript: var _ = window.open(selectedTheoryURL)">Objects depending directly on this one.</a></td></tr>
85        <tr><td><a href="javascript: var _ = window.open(selectedBackwardURL)">Objects depending on this one.</a></td></tr>
86       </table>
87      </td></tr>
88     </table>
89    </div>
90    <script>initializeMenu()</script>
91   </xsl:copy>
92 </xsl:template>
93
94 <xsl:template match="html:area">
95  <xsl:variable name="quoteduri">
96   <xsl:call-template name="jsquote">
97    <xsl:with-param name="s" select="@href"/>
98   </xsl:call-template>
99  </xsl:variable>
100  <xsl:variable name="cicurl">
101   <xsl:call-template name="makeURL">
102    <xsl:with-param name="uri" select="@href"/>
103   </xsl:call-template>
104  </xsl:variable>
105  <xsl:variable name="quotedcicurl">
106   <xsl:call-template name="jsquote">
107    <xsl:with-param name="s" select="$cicurl"/>
108   </xsl:call-template>
109  </xsl:variable>
110  <xsl:variable name="theoryurl">
111   <xsl:call-template name="makeDirectDependenciesURL">
112    <xsl:with-param name="uri" select="@href"/>
113   </xsl:call-template>
114  </xsl:variable>
115  <xsl:variable name="quotedtheoryurl">
116   <xsl:call-template name="jsquote">
117    <xsl:with-param name="s" select="$theoryurl"/>
118   </xsl:call-template>
119  </xsl:variable>
120  <xsl:variable name="forwardURL">
121   <xsl:call-template name="makeGraphURL">
122    <xsl:with-param name="uri" select="@href"/>
123    <xsl:with-param name="keys" select="'MDG'"/>
124    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
125   </xsl:call-template>
126  </xsl:variable>
127  <xsl:variable name="quotedForwardURL">
128   <xsl:call-template name="jsquote">
129    <xsl:with-param name="s" select="$forwardURL"/>
130   </xsl:call-template>
131  </xsl:variable>
132  <xsl:variable name="backwardURL">
133   <xsl:call-template name="makeGraphURL">
134    <xsl:with-param name="uri" select="@href"/>
135    <xsl:with-param name="keys" select="'MMG'"/>
136    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
137   </xsl:call-template>
138  </xsl:variable>
139  <xsl:variable name="quotedBackwardURL">
140   <xsl:call-template name="jsquote">
141    <xsl:with-param name="s" select="$backwardURL"/>
142   </xsl:call-template>
143  </xsl:variable>
144  <xsl:copy>
145   <xsl:copy-of select="@*"/> 
146   <xsl:if test="starts-with(@href,&quot;cic:&quot;)">
147    <xsl:attribute name="onMouseOver">lastX = getX(event); lastY = getY(event); selectedURI='<xsl:value-of select="$quoteduri"/>'; selectedCICURL='<xsl:value-of select="$quotedcicurl"/>'; selectedTheoryURL='<xsl:value-of select="$quotedtheoryurl"/>'; selectedForwardURL='<xsl:value-of select="$quotedForwardURL"/>'; selectedBackwardURL='<xsl:value-of select="$quotedBackwardURL"/>';</xsl:attribute>
148    <xsl:attribute name="href">javascript:moveMenu(lastX,lastY); showMenu();</xsl:attribute>
149   </xsl:if>
150   <xsl:apply-templates/>
151  </xsl:copy>
152 </xsl:template>
153
154 </xsl:stylesheet>