Visualisierungsmodul für SuperX http://www.superx-projekt.de/doku/viz_modul/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

536 lines
15 KiB

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sx="http://memtext.de">
<xsl:template name="head_superx_viz">
<xsl:param name="css" />
<xsl:param name="title" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</meta><!-- <link rel="stylesheet" type="text/css" href="../xml/his1/css.._menue_html.css" /> -->
<link rel="stylesheet" type="text/css" href="../style/superx.css"/>
<link rel="stylesheet" type="text/css" href="../xml/menue_html.css"/>
<link rel="stylesheet" type="text/css" href="../xml/superxml_html.css"/>
<link rel="stylesheet" type="text/css" href="../xml/maske_html.css" />
<link rel="stylesheet" type="text/css" href="../xml/tabelle_html.css" />
<link rel="stylesheet" type="text/css" href="../xml/superx_standalone.css"/>
<link rel="stylesheet" type="text/css" href="../xml/css/fontello-codes.css" />
<link rel="stylesheet" type="text/css" href="../xml/css/start_portlet.css" />
<link rel="stylesheet" type="text/css" href="../style/bulma.css" />
<link rel="stylesheet" type="text/css" href="../style/bulma-tooltip.min.css" />
<link rel="stylesheet" type="text/css" href="../style/sx_viz_muster.css" />
</head>
</xsl:template>
<xsl:template name="head_hisinone_viz">
<xsl:param name="css" />
<xsl:param name="title" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</meta>
<link rel="stylesheet" type="text/css"
href="../xml/his1/css/superx_menue_html.css" />
<link rel="stylesheet" type="text/css" href="../xml/maske_html.css" />
<!--<LINK REL="stylesheet" type="text/css" href="../style/superx.css"
></LINK> <LINK REL="stylesheet" type="text/css" href="../xml/superxml_html.css"
></LINK> -->
<xsl:choose>
<xsl:when test="$title != ''">
<xsl:choose>
<xsl:when test="starts-with($title,'Mask') ">
<link rel="stylesheet" type="text/css" href="../xml/maske_html.css" />
</xsl:when>
<xsl:otherwise>
<!-- Styles für HIS1 sind in xml/his1/css/superx_menue_html.css definiert
<LINK REL="stylesheet" type="text/css" href="../xml/tabelle_html.css" ></LINK> -->
</xsl:otherwise>
</xsl:choose>
<title>
<xsl:value-of select="$title" />
</title>
</xsl:when>
<xsl:otherwise>
<title>
<xsl:text>HISinOne-BI</xsl:text>
</title>
</xsl:otherwise>
</xsl:choose>
<link rel="stylesheet" type="text/css" href="../xml/his1/css/HISinOne.css" />
<!--<script src="../xml/js/jquery/jquery.mobile-1.4.2.min.js"></script>
<link rel="stylesheet" href="../xml/js/jquery/jquery.mobile.structure-1.4.2.dw.css" />
<link rel="stylesheet" href="../xml/js/jquery/jqm-demos.dw.css" /> -->
<link rel="stylesheet" type="text/css" href="../xml/css/fontello-codes.css" />
<link rel="stylesheet" type="text/css" href="../xml/css/start_portlet.css" />
<link rel="stylesheet" type="text/css" href="../style/bulma.css" />
<link rel="stylesheet" type="text/css" href="../style/bulma-tooltip.min.css" />
<link rel="stylesheet" type="text/css" href="../style/sx_viz_muster.css" />
<xsl:if test="$css != ''">
<link rel="stylesheet" type="text/css" href="$css" />
</xsl:if>
</head>
</xsl:template>
<xsl:template name="tableJavascript_viz">
<script language="Javascript" type="text/javascript" src="../xml/js/jquery-2.1.1.min.js" />
<script language="JavaScript" type="text/javascript" src="../xml/js/memtext/sx_functions.js"></script>
<xsl:call-template name="importVizJavascriptLibs" />
<script><xsl:text><![CDATA[
//document.body.append(Plot.plot(options));
function commonChartProperty(name,
caption,
isMandatory,
inputType,
staticValues,
range_from,
range_to,
defaultValue,
propUnit,
explanation,
groupCaption,
groupUniquename,
rendererUniquename,
groupVariableName,
variableName,
propValueType,
isGeneric
)
{
this.name=name;
this.caption=caption;
this.staticValues=staticValues;
this.range_from=range_from;
this.range_to=range_from;
this.isMandatory=isMandatory;
this.inputType=inputType;
this.defaultValue=defaultValue;
this.propUnit=propUnit;
this.explanation=explanation;
this.groupCaption=groupCaption;
this.groupUniquename=groupUniquename;
this.rendererUniquename=rendererUniquename;
this.groupVariableName=groupVariableName;
this.variableName=variableName;
this.propValueType=propValueType;
this.isGeneric=isGeneric;
this.getValueResultset = function () {
var valueOptions=[];
var optionCounter=0;
var staticValueArray = staticValues.split(/\|/);
for(var j=0;j < staticValueArray.length;j++)
{
var isDefault=false;
if(staticValueArray[j])
{
if(staticValueArray[j]==this.defaultValue)
isDefault=true;
var o=new selectionPropertyValue(optionCounter,staticValueArray[j],staticValueArray[j],isDefault);
valueOptions[optionCounter]=o;
optionCounter++;
}
}
return valueOptions;
}
}
function commonChartPropertyGroup(caption,groupUniquename,groupVariableName)
{
this.caption=caption;
this.groupUniquename=groupUniquename;
this.groupVariableName=groupVariableName;
}
var commonChartProperties=[];
]]></xsl:text>
<xsl:for-each select="/ergebnisse/ergebnis[@ordnr='0']/ergebniselement/chartProperties/commonChartProperty">
<xsl:text>
var newCommonChartProperty = new commonChartProperty("</xsl:text>
<xsl:value-of select="@prop_uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@caption" />
<xsl:text>",</xsl:text><xsl:choose>
<xsl:when test="@is_mandatory=1"><xsl:text>true</xsl:text>
</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
<xsl:text>,"</xsl:text>
<xsl:value-of select="@input_type_uniquename" />
<xsl:text>"
,"</xsl:text>
<xsl:value-of select="@static_values" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@prop_range_from" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@prop_range_to" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@prop_default" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@prop_unit" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@explanation" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@group_caption" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@group_uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@renderer_uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@group_variable_name" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@variable_name" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@propValueType" />
<xsl:text>",</xsl:text>
<xsl:value-of select="@isGeneric" />
<xsl:text>);
commonChartProperties.push(newCommonChartProperty);
</xsl:text>
</xsl:for-each>
<!--<xsl:text>
var newCommonChartProperty = new commonChartProperty("caption",
"Titel des Diagramms",
false,
"TEXTAREA",
"",
"",
"",
"</xsl:text>
<xsl:value-of select="/ergebnisse/ergebnis[@ordnr='0']/maskenname" /><xsl:text>",
"wird unter dem Diagramm angezeigt",
"Diagrammkopf",
"",
"plot",
"layout",
"caption",
"string");
commonChartProperties.push(newCommonChartProperty);
</xsl:text>-->
<xsl:text>
function vizRenderer(uniquename,caption)
{
this.caption=caption;
this.uniquename=uniquename;
}
var vizRenderers=[];
</xsl:text>
<xsl:for-each select="/ergebnisse/ergebnis[@ordnr='0']/ergebniselement/vizRenderers/vizRenderer">
<xsl:text>
var newVizRenderer = new vizRenderer("</xsl:text>
<xsl:value-of select="@uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@caption" />
<xsl:text>");
vizRenderers.push(newVizRenderer);
</xsl:text>
</xsl:for-each>
<xsl:text>
function vizType(uniquename,caption,rendererUniquename,orientation)
{
this.caption=caption;
this.uniquename=uniquename;
this.rendererUniquename=rendererUniquename,
this.orientation=orientation;
}
var vizTypes=[];
</xsl:text>
<xsl:for-each select="/ergebnisse/ergebnis[@ordnr='0']/ergebniselement/vizTypes/vizType">
<xsl:text>
var newVizType = new vizType("</xsl:text>
<xsl:value-of select="@uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@caption" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@renderer_uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@orientation" />
<xsl:text>");
vizTypes.push(newVizType);
</xsl:text>
</xsl:for-each>
<xsl:text>
function vizTypeProperty(propUniquename,caption,typeUniquename,groupUniquename,isMandatory,explanation)
{
this.propUniquename=propUniquename;
this.caption=caption;
this.groupUniquename=groupUniquename;
this.typeUniquename=typeUniquename;
this.isMandatory=isMandatory;
this.explanation=explanation;
}
var vizTypeProperties=[];
</xsl:text>
<xsl:for-each select="/ergebnisse/ergebnis[@ordnr='0']/ergebniselement/viz_type_properties/viz_type_property">
<xsl:text>
var newVizTypeProperty = new vizTypeProperty("</xsl:text>
<xsl:value-of select="@uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@caption" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@viz_type_uniquename" />
<xsl:text>","</xsl:text>
<xsl:value-of select="@viz_property_group_uniquename" />
<xsl:text>",</xsl:text>
<xsl:choose>
<xsl:when test="@is_mandatory='1'">
<xsl:text>true</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>false</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>,""
);
vizTypeProperties.push(newVizTypeProperty);
</xsl:text>
</xsl:for-each>
</script>
<script language="Javascript" type="text/javascript" src="../xml/js/viz/viz_functions.js" />
<style type="text/css">
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
.node text {
pointer-events: none;
text-shadow: 0 1px 0 #fff;
}
.link {
fill: none;
stroke: #000;
stroke-opacity: .2;
}
.link:hover {
stroke-opacity: .5;
}
</style>
</xsl:template>
<xsl:template name="buildVizMetadata">
<xsl:variable name="vizInitialName">
<xsl:choose>
<xsl:when test="/ergebnisse/@isMakro='true'">
<xsl:value-of select="/ergebnisse/makro/name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/ergebnisse/ergebnis/maskenname" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--<xsl:call-template name="navigationsmenue" />-->
<script language="Javascript">
<xsl:text>
var vizInitialName='</xsl:text><xsl:value-of select="$vizInitialName"/><xsl:text>';
function dataRowMetaData(tableId,nr,colname,colcaption,coltype,colfunction)
{
this.tableId=tableId;
this.nr=nr;
this.colname=colname;
this.colcaption=colcaption;
this.coltype=coltype;
this.colfunction=colfunction;
}
function tableMetaData(nr,value,name,isDefault)
{
this.value=value;
this.nr=nr;
this.name=name
this.isDefault=isDefault;
}
var rsTableMetaData=new Array();
var rsColumnMetaData=new Array();
var rs=new Array();
</xsl:text>
</script>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement">
<xsl:call-template name="buildVizData" >
<xsl:with-param name="tableId" select="@ordnr" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="buildVizData">
<xsl:param name="tableId" />
<script language="Javascript">
<xsl:text>
rsTableMetaData.push(new tableMetaData(
</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>,'</xsl:text>
<xsl:value-of select="$tableId"/>
<xsl:text>','</xsl:text>
<xsl:value-of select="concat('Tab. ',$tableId+1)"/>
<xsl:text>',
</xsl:text>
<xsl:choose>
<xsl:when test="position()=1">
<xsl:text>true</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>false</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
));
rs[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>]=new Array();
var myChartModel=new chartModel(1,"","",rsTableMetaData);
function dataRow_</xsl:text><xsl:value-of select="$tableId"/><xsl:text>(rownr</xsl:text>
<xsl:for-each select="sqlerg/complete_headers/header">
<xsl:text>,</xsl:text>
<xsl:call-template name="getColumnNameJS">
<xsl:with-param name="columnNameFromDB" select="f_name"/>
</xsl:call-template>
</xsl:for-each>
<xsl:text>
)
{
this.rownr=rownr;
</xsl:text>
<xsl:for-each select="sqlerg/complete_headers/header">
<xsl:text>this.</xsl:text><xsl:call-template name="getColumnNameJS">
<xsl:with-param name="columnNameFromDB" select="f_name"/>
</xsl:call-template><xsl:text>=</xsl:text>
<xsl:call-template name="getColumnNameJS">
<xsl:with-param name="columnNameFromDB" select="f_name"/>
</xsl:call-template><xsl:text>;
</xsl:text>
</xsl:for-each><xsl:text>
}
rsColumnMetaData[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>]=new Array();
rsColumnMetaData[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>].push(new dataRowMetaData('</xsl:text>
<xsl:value-of select="$tableId"/><xsl:text>',</xsl:text>
<xsl:value-of select="0"/>
<xsl:text>,'rownr','Zeilennr.',0,4));
</xsl:text>
<xsl:for-each select="sqlerg/complete_headers/header">
<xsl:variable name="rownr">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:text>
rsColumnMetaData[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>].push(new dataRowMetaData('</xsl:text>
<xsl:value-of select="$tableId"/><xsl:text>',</xsl:text>
<xsl:value-of select="$rownr"/>
<xsl:text>,'</xsl:text>
<xsl:call-template name="getColumnNameJS">
<xsl:with-param name="columnNameFromDB" select="f_name"/>
</xsl:call-template>
<xsl:text>','</xsl:text>
<xsl:call-template name="remove_linebreaksAndQuot">
<xsl:with-param name="volltext" select="wert" />
</xsl:call-template>
<xsl:text>',0,null));</xsl:text> <!--coltype noch unbekannt, colfunction unnötig-->
</xsl:for-each>
<xsl:for-each select="sqlerg/row">
<xsl:variable name="rownr">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:if test="$rownr=1">
<!-- first metadata -->
<xsl:for-each select="col">
<xsl:variable name="colnr">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:text>
rsColumnMetaData[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>][</xsl:text><xsl:value-of select="number($colnr)"/><xsl:text>].coltype=</xsl:text><xsl:value-of select="@typ"/>
<xsl:text>;
</xsl:text>
</xsl:for-each>
</xsl:if>
<!--now resultset-->
<xsl:text>
//rs[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>]= new Array();
rs[</xsl:text><xsl:value-of select="$tableId"/><xsl:text>].push(new dataRow_</xsl:text><xsl:value-of select="$tableId"/><xsl:text>(</xsl:text><xsl:value-of select="$rownr"/>
<xsl:for-each select="col">
<xsl:text>,</xsl:text>
<xsl:choose>
<xsl:when test="@typ='1'"><xsl:text>'</xsl:text>
<xsl:call-template name="remove_linebreaksAndQuot">
<xsl:with-param name="volltext" select="wert" />
</xsl:call-template>
<xsl:text>'</xsl:text></xsl:when>
<!--todo:Typ Datum -->
<xsl:when test="string-length(wert)=0"><xsl:text>null</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="wert"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:text>));
</xsl:text>
</xsl:for-each>
</script>
</xsl:template>
<xsl:template name="getColumnNameJS">
<xsl:param name="columnNameFromDB" />
<xsl:choose>
<xsl:when test="contains($columnNameFromDB,'?')">
<xsl:value-of select="concat('column_',@id+1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$columnNameFromDB"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- start Javascript-->
<xsl:template name="importVizJavascriptLibs">
<script language="Javascript" type="text/javascript" src="../xml/js/viz/d3.min.js" />
<script language="Javascript" type="text/javascript" src="../xml/js/viz/plot.js" />
<script language="Javascript" type="module" src="../xml/js/viz/d3-sankey.js" />
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement/vizTypes/vizType[@srcpath !='/superx/xml/js/viz/d3.min.js'
and @srcpath != '/superx/xml/js/viz/plot.js'
and @srcpath != '/superx/xml/js/viz/d3-sankey.js'
and @srcpath != ''
and (@renderer_uniquename='plot' or @renderer_uniquename='d3js') ]">
<script language="Javascript" type="text/javascript" src="{@srcpath}" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>