]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/makeGraphLinks.xsl
Major interface improvements.
[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 selectedForwardURL;
58     var selectedBackwardURL;
59    </script>
60    <xsl:apply-templates/>
61   </xsl:copy>
62 </xsl:template>
63
64 <xsl:template match="html:body">
65   <!--CSC: end of cut & paste also in metadataLib.xsl -->
66   <xsl:copy>
67    <xsl:copy-of select="@*"/>
68    <xsl:attribute name="onClick">hideMenu();</xsl:attribute>
69    <!--CSC: end of cut & paste also in metadataLib.xsl -->
70    <form name="uri_set_size">
71     Number of nodes to show when following an hyperlink:
72     <input type="text" onClick="return false" value="{$uri_set_size}" size="2"/> (30 suggested)
73    </form>
74    <xsl:apply-templates/>
75    <div style="position: absolute" id="HJMmenu">
76     <!-- The two nested tables are for NS 4.0 where every -->
77     <!-- layer has a default transparent background color -->
78     <table bgColor="green" id="pippo">
79      <tr><td>
80       <table bgColor="cyan" border="2">
81        <tr><td><a href="javascript: var _ = window.open(selectedForwardURL)">Objects this one depends on.</a></td></tr>
82        <tr><td><a href="javascript: var _ = window.open(selectedCICURL,'_top')">Render this object.</a></td></tr>
83        <tr><td><a href="javascript: var _ = window.open(selectedBackwardURL)">Objects depending on this one.</a></td></tr>
84       </table>
85      </td></tr>
86     </table>
87    </div>
88    <script>initializeMenu()</script>
89   </xsl:copy>
90 </xsl:template>
91
92 <xsl:template match="html:area">
93  <xsl:variable name="quoteduri">
94   <xsl:call-template name="jsquote">
95    <xsl:with-param name="s" select="@href"/>
96   </xsl:call-template>
97  </xsl:variable>
98  <xsl:variable name="cicurl">
99   <xsl:call-template name="makeURL">
100    <xsl:with-param name="uri" select="@href"/>
101   </xsl:call-template>
102  </xsl:variable>
103  <xsl:variable name="quotedcicurl">
104   <xsl:call-template name="jsquote">
105    <xsl:with-param name="s" select="$cicurl"/>
106   </xsl:call-template>
107  </xsl:variable>
108  <xsl:variable name="forwardURL">
109   <xsl:call-template name="makeGraphURL">
110    <xsl:with-param name="uri" select="@href"/>
111    <xsl:with-param name="keys" select="'MDG'"/>
112    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
113   </xsl:call-template>
114  </xsl:variable>
115  <xsl:variable name="quotedForwardURL">
116   <xsl:call-template name="jsquote">
117    <xsl:with-param name="s" select="$forwardURL"/>
118   </xsl:call-template>
119  </xsl:variable>
120  <xsl:variable name="backwardURL">
121   <xsl:call-template name="makeGraphURL">
122    <xsl:with-param name="uri" select="@href"/>
123    <xsl:with-param name="keys" select="'MMG'"/>
124    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
125   </xsl:call-template>
126  </xsl:variable>
127  <xsl:variable name="quotedBackwardURL">
128   <xsl:call-template name="jsquote">
129    <xsl:with-param name="s" select="$backwardURL"/>
130   </xsl:call-template>
131  </xsl:variable>
132  <xsl:copy>
133   <xsl:copy-of select="@*"/> 
134   <xsl:if test="starts-with(@href,&quot;cic:&quot;)">
135    <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>
136    <xsl:attribute name="href">javascript:moveMenu(lastX,lastY); showMenu();</xsl:attribute>
137   </xsl:if>
138   <xsl:apply-templates/>
139  </xsl:copy>
140 </xsl:template>
141
142 </xsl:stylesheet>