]> matita.cs.unibo.it Git - helm.git/commitdiff
metadataLib2.xsl renamed makeGraphLinks.xsl and committed.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 24 Oct 2001 15:59:16 +0000 (15:59 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 24 Oct 2001 15:59:16 +0000 (15:59 +0000)
helm/on-line/xslt/makeGraphLinks.xsl [new file with mode: 0644]
helm/on-line/xslt/metadataLib.xsl

diff --git a/helm/on-line/xslt/makeGraphLinks.xsl b/helm/on-line/xslt/makeGraphLinks.xsl
new file mode 100644 (file)
index 0000000..96fd316
--- /dev/null
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0"
+ 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:output method="html" encoding="iso-8859-1"/>
+
+<xsl:template match="/|*">
+  <xsl:copy>
+   <xsl:copy-of select="@*"/>
+   <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="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"/>
+   <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];
+]]>
+   </script>
+   <script>
+<![CDATA[
+function mkRDFURI(uri)
+{
+   var prefix = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//";
+   var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
+   var re2 = /#xpointer\(1\/(\d+)\)/;
+   // Just one of the following replace will do something
+   uri = uri.replace(re1,",$1,$2");
+   uri = uri.replace(re2,",$1");
+
+   return (prefix + uri);
+}
+
+function removeXPointer(uri)
+{
+   //var re = /#xpointer(\.*)/;
+   // CSC: Why the r.e.s below work and the one above does not?
+   var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
+   var re2 = /#xpointer\(1\/(\d+)\)/;
+   var res = uri.replace(re1,"");
+   res = res.replace(re2,"");
+
+   return res;
+}
+
+
+// (use_rdf_uri==true) if the stylesheet must be applied to the
+// metadata; (use_rdf_uri==false) otherwise
+function mkGraphURL(uri,keys,use_rdf_uri)
+{
+   var getterURL = unescape(getParam("param.getterURL"));
+   var draw_graphURL = unescape(getParam("param.draw_graphURL"));
+   var url= setParam(location.href,"keys",keys);
+   var rdfuri = mkRDFURI(uri);
+   url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' +
+    (use_rdf_uri ? rdfuri : removeXPointer(uri)));
+   url = setParam(url,"param.CICURI",escape(uri));
+   var uri_set_size = document.uri_set_size.elements[0].value;
+   url = setParam(url,"param.uri_set_size",uri_set_size);
+   url = draw_graphURL + 'draw?url=' + escape(url);
+   var url2 = setParam(location.href,"keys","MGL,RT");
+   url2 = setParam(url2,"xmluri",escape(url));
+   url2 = setParam(url2,"param.uri_set_size",uri_set_size);
+   return url2;
+}
+
+function mkDepURL(uri)
+{
+   return mkGraphURL(uri,"MDG",0);
+}
+
+
+function mkMetaURL(uri)
+{
+   return mkGraphURL(uri,"MMG",1);
+}
+
+function mkCICURL(uri)
+{
+   var rawuri = removeXPointer(uri);
+   var getterURL = getParam("param.getterURL");
+   var interfaceURL = unescape(getParam("param.interfaceURL"));
+   var url= setParam(location.href,"keys",getParam("param.keys"));
+   url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + rawuri);
+   url = setParam(url,"param.CICURI",rawuri);
+   url = interfaceURL + "?url=" + escape(url);
+   return url;
+}
+]]>
+   </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:copy>
+   <xsl:copy-of select="@*"/>
+   <xsl:apply-templates/>
+   <script>
+HM_Array1 = [
+<![CDATA[
+[,,,
+,,,,,,,,,,,,,,,,
+1,true],
+["Objects this one depends on.","javascript:window.open(mkDepURL(selectedURI),'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),'graph')",1,0,0]
+];
+]]>
+   </script>
+   <subst:script Language="JavaScript1.2" src="/javascript/jsmenu/HM_Loader_prova.js"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match = "area">
+ <xsl:variable name="uri" select="@href"/>
+ <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:if>
+  <xsl:apply-templates/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
index 202a3d4838abc0cc13493ef445b27fd28134a378..b1434add6ae812eac4e5ebb8b135f70d251d6eac 100644 (file)
@@ -71,7 +71,7 @@
    url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
    url = setParam(url,"param.CICURI",escape(CICURI));
    url = draw_graphURL + 'draw?url=' + escape(url);
-   var url2 = setParam(location.href,"keys","ML2,RT");
+   var url2 = setParam(location.href,"keys","MGL,RT");
    url2 = setParam(url2,"xmluri",escape(url));
    document.write('<a target="graph" href="' + url2 + '">View the graph of all the objects depending on this one.</a>');
 ]]>
@@ -87,6 +87,7 @@
  <xsl:param name="CICURI" select="''"/>
  <xsl:param name="RDFURI" select="''"/>
  <p>
+  <!-- CSC: Cut & Paster from above ==> create a single javascript function -->
   <script>
    var CICURI = "<xsl:value-of select="$CICURI"/>";
    var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/forward//<xsl:value-of select="$RDFURI"/>";
@@ -97,7 +98,7 @@
    url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
    url = setParam(url,"param.CICURI",escape(CICURI));
    url = draw_graphURL + 'draw?url=' + escape(url);
-   var url2 = setParam(location.href,"keys","ML2,RT");
+   var url2 = setParam(location.href,"keys","MGL,RT");
    url2 = setParam(url2,"xmluri",escape(url));
    document.write('<a target="graph" href="' + url2 + '">View the graph of all the dependencies of this object.</a>');
 ]]>