Skip to content

Commit

Permalink
First working version of the razor module
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark van de Vries committed May 15, 2018
1 parent cbf1016 commit 58da47d
Show file tree
Hide file tree
Showing 10 changed files with 415 additions and 2 deletions.
7 changes: 5 additions & 2 deletions App_LocalResources/Packages.ascx.resx
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ControlTitle_managepackages.Text" xml:space="preserve">
<value>Manage Add-Ins</value>
Expand Down Expand Up @@ -168,4 +168,7 @@
<data name="XSLT.Description" xml:space="preserve">
<value>Displays query results by running an XSLT Transform over the results</value>
</data>
<data name="Razor.Description" xml:space="preserve">
<value>This is an add-on to DNN Reports which allows you to use Razor as a visualizer-engine</value>
</data>
</root>
2 changes: 2 additions & 0 deletions Packages.ascx.cs
Expand Up @@ -88,6 +88,8 @@ public override void DataBind()
ReportsConstants.PACKAGETYPE_Visualizer, "HTML"));
allExtensions.Add(this.CreateBuiltInPackage("XSLT", BuiltInVersion,
ReportsConstants.PACKAGETYPE_Visualizer, "XSLT"));
allExtensions.Add(this.CreateBuiltInPackage("Razor", BuiltInVersion,
ReportsConstants.PACKAGETYPE_Visualizer, "Razor"));
allExtensions.Add(this.CreateBuiltInPackage("Generic ADO.Net Provider", BuiltInVersion,
ReportsConstants.PACKAGETYPE_DataSource, "ADO"));
allExtensions.Add(this.CreateBuiltInPackage("DotNetNuke", BuiltInVersion,
Expand Down
18 changes: 18 additions & 0 deletions Reports.csproj
Expand Up @@ -66,6 +66,11 @@
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Modules.RazorHost, Version=7.3.2.109, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.references\DotNetNuke.Modules.RazorHost.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Web, Version=8.0.0.809, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Dnn.Platform.8.0.0\lib\net40\DotNetNuke.Web.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -144,6 +149,8 @@
<EmbeddedResource Include="js\dnn.reports.js" />
<Content Include="Settings.ascx" />
<Content Include="ViewReports.ascx" />
<Content Include="Visualizers\Razor\App_LocalResources\Settings.ascx.resx" />
<Content Include="Visualizers\Razor\App_LocalResources\Visualizer.ascx.resx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Components\DataSources\ADODataSourceBase.cs" />
Expand Down Expand Up @@ -270,6 +277,15 @@
<DependentUpon>Visualizer.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Visualizers\Razor\RazorReportHelper.cs" />
<Compile Include="Visualizers\Razor\Settings.ascx.cs">
<DependentUpon>Settings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Visualizers\Razor\Visualizer.ascx.cs">
<DependentUpon>Visualizer.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Visualizers\XSLT\Settings.ascx.designer.cs">
<DependentUpon>Settings.ascx</DependentUpon>
</Compile>
Expand All @@ -290,6 +306,8 @@
<Content Include="Visualizers\Grid\Visualizer.ascx" />
<Content Include="Visualizers\HTML\Settings.ascx" />
<Content Include="Visualizers\HTML\Visualizer.ascx" />
<Content Include="Visualizers\Razor\Settings.ascx" />
<Content Include="Visualizers\Razor\Visualizer.ascx" />
<Content Include="Visualizers\XSLT\Settings.ascx" />
<Content Include="Visualizers\XSLT\Visualizer.ascx" />
</ItemGroup>
Expand Down
126 changes: 126 additions & 0 deletions Visualizers/Razor/App_LocalResources/Settings.ascx.resx
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="scriptListLabel.Help" xml:space="preserve">
<value>Select the Script to use for this instance of the RazorReport Vizualizer</value>
</data>
<data name="scriptListLabel.Text" xml:space="preserve">
<value>Script:</value>
</data>
</root>
135 changes: 135 additions & 0 deletions Visualizers/Razor/App_LocalResources/Visualizer.ascx.resx
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AdminNoReport.Message" xml:space="preserve">
<value>There is no query configured for this report. For security and privacy reasons, only SuperUsers (Hosts) can create Reports.</value>
</data>
<data name="EditContent.Action" xml:space="preserve">
<value>Edit Script</value>
</data>
<data name="NoReportCreated.Message" xml:space="preserve">
<value>There is no query configured for this report. Please use the Settings page for this module to configure the query to generate the report from</value>
</data>
<data name="NoResults.Message" xml:space="preserve">
<value>The report query returned no results or there was an error with your query.</value>
</data>
<data name="VisualizerName.Text" xml:space="preserve">
<value>Razor Reports</value>
</data>
</root>
18 changes: 18 additions & 0 deletions Visualizers/Razor/RazorReportHelper.cs
@@ -0,0 +1,18 @@
using System.Data;
using System.Web;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Web.Razor.Helpers;


namespace DotNetNuke.Modules.Reports.Visualizers.Razor
{
public static class RazorReportHelper
{

public static DataTable ReportResults(this DnnHelper Helper)
{
return ((DataTable) (HttpContext.Current.Items[ModuleController.CacheKey(Helper.Module.TabModuleID) + "_razor"]));
}
}
}

1 change: 1 addition & 0 deletions Visualizers/Razor/Settings.ascx
@@ -0,0 +1 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Settings.ascx.cs" Inherits="DotNetNuke.Modules.Reports.Visualizers.Razor.Settings" %>

0 comments on commit 58da47d

Please sign in to comment.