TemplateList()
+ {
+ return Templates.Values;
+ }
+
+ public static void LoadTemplate(string name, int portalId, int tabid)
+ {
+ var doc = new XmlDocument();
+ doc.LoadXml((Templates[name].ExportContent));
+ ModuleSerializationController.DeserializeModule(doc.DocumentElement, doc.DocumentElement, portalId, tabid,
+ PortalTemplateModuleAction.Ignore, new Hashtable());
+ }
+
+ public static void LoadTemplate(XmlDocument content, int portalId, int tabid)
+ {
+ ModuleSerializationController.DeserializeModule(content.DocumentElement, content.DocumentElement, portalId,
+ tabid, PortalTemplateModuleAction.Ignore, new Hashtable());
+ }
+
+ public static void ClearCache()
+ {
+ DataCache.RemoveCache(CacheKey);
+ }
+
+ public static bool SaveTemplate(string name, string description, ModuleInstanceContext context,
+ bool forceOverwrite, int maxNumberOfRecords)
+ {
+ var doc = new XmlDocument();
+ var moduleInfo = new ModuleController().GetModule(context.Configuration.ModuleID, context.Configuration.TabID);
+ var node = ModuleSerializationController.SerializeModule(doc, moduleInfo, true, maxNumberOfRecords);
+ // add PaneName as element "name"
+ var paneNode = doc.CreateElement("name");
+ paneNode.InnerXml = context.Configuration.PaneName;
+ node.AppendChild(paneNode);
+ var template = new TemplateInfo
+ {
+ Name = name,
+ Description = description,
+ ExportContent = XslTemplatingUtilities.PrettyPrint(node.OuterXml)
+ };
+
+ var fileName = string.Format("{0}.{1}.module.template", Globals.CleanFileName(name),
+ moduleInfo.DesktopModule.ModuleName.ToLowerInvariant());
+
+ var portalSettings = context.PortalSettings;
+ var folder = Utilities.GetFolder(portalSettings, Definition.TemplateFolderName);
+
+ if (Utilities.SaveScript( template.GetXml(), fileName, folder, forceOverwrite))
+ {
+ ClearCache();
+ return true;
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Templates/TemplateInfo.cs b/Templates/TemplateInfo.cs
new file mode 100644
index 0000000..b7aaace
--- /dev/null
+++ b/Templates/TemplateInfo.cs
@@ -0,0 +1,64 @@
+using System;
+using System.IO;
+using System.Xml;
+
+namespace DotNetNuke.Modules.UserDefinedTable.Templates
+{
+ /// -----------------------------------------------------------------------------
+ ///
+ ///
+ /// -----------------------------------------------------------------------------
+ [Serializable]
+ public class TemplateInfo
+ {
+ string _Name;
+ string _Description;
+ string _Export;
+ XmlNode _AdditionalData;
+
+ public string Name
+ {
+ get { return _Name; }
+ set { _Name = value; }
+ }
+
+ public string Description
+ {
+ get { return _Description; }
+ set { _Description = value; }
+ }
+
+ public string ExportContent
+ {
+ get { return _Export; }
+ set { _Export = value; }
+ }
+
+ public XmlNode AdditionalData
+ {
+ get { return _AdditionalData; }
+ set { _AdditionalData = value; }
+ }
+
+
+ public string GetXml()
+ {
+ using (var strXML = new StringWriter())
+ {
+ using (var xmlWriter = new XmlTextWriter(strXML))
+ {
+ xmlWriter.Formatting = Formatting.Indented;
+ xmlWriter.WriteStartElement("moduletemplate");
+ xmlWriter.WriteAttributeString("title", Name);
+ xmlWriter.WriteAttributeString("description", Description);
+ xmlWriter.WriteAttributeString("xmlns", "ask", null, "DotNetNuke/ModuleTemplate");
+ xmlWriter.WriteRaw(ExportContent);
+ xmlWriter.WriteEndElement();
+ xmlWriter.Close();
+ }
+
+ return strXML.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Templates/TemplateValueInfo.cs b/Templates/TemplateValueInfo.cs
new file mode 100644
index 0000000..9e30c54
--- /dev/null
+++ b/Templates/TemplateValueInfo.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Xml;
+
+namespace DotNetNuke.Modules.UserDefinedTable.Templates
+{
+ [Serializable]
+ public class TemplateValueInfo
+ {
+ #region Private Fields
+
+ int _EditorId;
+ string _ValueSource;
+ string _Value;
+ string _Caption;
+ XmlNode _Node;
+ int _length;
+
+ #endregion
+
+ #region Public Properties
+
+ public int Editor
+ {
+ get { return _EditorId; }
+ set { _EditorId = value; }
+ }
+
+ public string ValueSource
+ {
+ get { return _ValueSource; }
+ set { _ValueSource = value; }
+ }
+
+ public string Value
+ {
+ get { return _Value; }
+ set { _Value = value; }
+ }
+
+ public string Caption
+ {
+ get { return _Caption; }
+ set { _Caption = value; }
+ }
+
+ public XmlNode Node
+ {
+ get { return _Node; }
+ set { _Node = value; }
+ }
+
+ public bool TrueColumn
+ {
+ get { return true; }
+ }
+
+ public bool FalseColumn
+ {
+ get { return false; }
+ }
+
+ public int Length
+ {
+ get { return _length; }
+ set { _length = value; }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Token2Xsl.ascx.cs b/Token2Xsl.ascx.cs
new file mode 100644
index 0000000..b8b71d6
--- /dev/null
+++ b/Token2Xsl.ascx.cs
@@ -0,0 +1,907 @@
+using System;
+using System.Collections;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Xml;
+using DotNetNuke.Common;
+using DotNetNuke.Entities.Modules;
+using DotNetNuke.Modules.UserDefinedTable.Components;
+using DotNetNuke.Services.FileSystem;
+using DotNetNuke.Services.Localization;
+using DotNetNuke.UI.Modules;
+
+
+namespace DotNetNuke.Modules.UserDefinedTable
+{
+ /// -----------------------------------------------------------------------------
+ ///
+ /// The Token2Xsl Class provides an option to create a XSL rendering file derived
+ /// from a html template for the UserDefinedTable
+ ///
+ /// -----------------------------------------------------------------------------
+ public partial class Token2Xsl : ModuleUserControlBase
+ {
+ #region Controls & Constants & Properties
+
+ DataSet _schemaDataSet;
+
+ public enum ErrorOutput
+ {
+ TokenTemplate,
+ XslTranformation,
+ Save
+ }
+
+ UserDefinedTableController _udtController;
+
+ UserDefinedTableController UdtController
+ {
+ get { return _udtController ?? (_udtController = new UserDefinedTableController(ModuleContext)); }
+ }
+
+ string CurrentListType
+ {
+ get { return ViewState["CurrentListType"].AsString(ddlListTemplateType.SelectedValue); }
+ set { ViewState["CurrentListType"] = value; }
+ }
+
+ string ReturnUrl
+ {
+ get { return ViewState["ReturnUrl"].AsString(ModuleContext.EditUrl("Manage")); }
+ set { ViewState["ReturnUrl"] = value; }
+ }
+
+ bool IsTrackingEmailMode
+ {
+ get
+ {
+ return ViewState["tracking"].AsBoolean(Convert.ToBoolean(Request.QueryString["tracking"].AsString().Length > 0));
+ }
+ set { ViewState["tracking"] = value; }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ void TemplatesPopulateColumnDropDownLists()
+ {
+ ddlColumnsForListView.Items.Clear();
+ ddlColumnsForDetailView.Items.Clear();
+ ddlColumnsForTrackingEmail.Items.Clear();
+
+
+ ddlColumnsForListView.Items.Add(new ListItem("UDT:EditLink", "[UDT:EditLink]"));
+ ddlColumnsForTrackingEmail.Items.Add(new ListItem("UDT:EditLink", "[UDT:EditLink]"));
+ if (chkShowDetailView.Checked)
+ {
+ ddlColumnsForListView.Items.Add(new ListItem("UDT:DetailView", "[UDT:DetailView]"));
+ }
+
+ ddlColumnsForDetailView.Items.Add(new ListItem("UDT:EditLink", "[UDT:EditLink]"));
+ ddlColumnsForDetailView.Items.Add(new ListItem("UDT:ListView", "[UDT:ListView]"));
+ foreach (DataColumn col in _schemaDataSet.Tables[DataSetTableName.Data].Columns)
+ {
+ var colName = col.ColumnName;
+ if (colName != "EditLink")
+ {
+ ddlColumnsForListView.Items.Add(new ListItem(colName, string.Format("[{0}]", colName)));
+ ddlColumnsForDetailView.Items.Add(new ListItem(colName, string.Format("[{0}]", colName)));
+ ddlColumnsForTrackingEmail.Items.Add(new ListItem(colName, string.Format("[{0}]", colName)));
+ }
+ }
+ ddlColumnsForListView.Items.Add(new ListItem("[ ] Hard Space", "[ ]"));
+ ddlColumnsForDetailView.Items.Add(new ListItem("[ ] Hard Space", "[ ]"));
+ ddlColumnsForTrackingEmail.Items.Add(new ListItem("[ ] Hard Space", "[ ]"));
+ foreach (var contextString in Enum.GetNames(typeof (XslTemplatingUtilities.ContextValues)))
+ {
+ ddlColumnsForListView.Items.Add(new ListItem(string.Format("Context:{0}", contextString),
+ string.Format("[Context:{0}]", contextString)));
+ ddlColumnsForDetailView.Items.Add(new ListItem(string.Format("Context:{0}", contextString),
+ string.Format("[Context:{0}]", contextString)));
+ ddlColumnsForTrackingEmail.Items.Add(new ListItem(string.Format("Context:{0}", contextString),
+ string.Format("[Context:{0}]", contextString)));
+ }
+
+ ddlHeaders.Items.Clear();
+ foreach (DataRow row in _schemaDataSet.Tables[DataSetTableName.Fields].Rows)
+ {
+ var title = row[FieldsTableColumn.Title].ToString();
+ ddlHeaders.Items.Add(new ListItem(title, string.Format("[{0}]", title)));
+ }
+ }
+
+ void TemplatesSetVisibility(bool isViewMode)
+ {
+ if (isViewMode)
+ {
+ dshListView.Visible = true;
+ dshOptions.Visible = true;
+ dshTrackingEmail.Visible = false;
+ dvListview.Visible = true;
+ dvOptions.Visible = true;
+ dvTrackingEmail.Visible = false;
+
+ var showDetails = chkShowDetailView.Checked;
+ dshDetailView.Visible = showDetails;
+ dvDetailView.Visible = showDetails;
+ if (showDetails && txtListTemplate.Text.IndexOf("UDT:DetailView") < 0)
+ {
+ txtListTemplate.Text = txtListTemplate.Text.Replace("UDT:EditLink", "UDT:DetailView");
+ }
+ if (! showDetails)
+ {
+ txtListTemplate.Text = txtListTemplate.Text.Replace("UDT:DetailView", txtListTemplate.Text.IndexOf("UDT:EditLink") > 0
+ ? "" :
+ "UDT:EditLink");
+ }
+ }
+ else
+ {
+ dshListView.Visible = false;
+ dshOptions.Visible = false;
+ dshDetailView.Visible = false;
+ dshTrackingEmail.Visible = true;
+
+ dvListview.Visible = false;
+ dvOptions.Visible = false;
+ dvDetailView.Visible = false;
+ dvTrackingEmail.Visible = true;
+ }
+ }
+
+
+ IList GetBasicElements()
+ {
+ var elements = new ArrayList {"[UDT:EditLink]"};
+ foreach (DataRow row in _schemaDataSet.Tables[DataSetTableName.Fields].Rows)
+ {
+ if (Convert.ToBoolean(row[FieldsTableColumn.Visible]))
+ {
+ elements.Add(string.Format("[{0}]",
+ XmlConvert.DecodeName(row[FieldsTableColumn.ValueColumn].ToString())));
+ }
+ }
+ return elements;
+ }
+
+ IList GetCurrentElements()
+ {
+ var txt = txtListTemplate.Text;
+ try
+ {
+ switch (CurrentListType)
+ {
+ case "table":
+ var doc1 = new XmlDocument();
+ doc1.LoadXml(txt);
+ var elements = new ArrayList();
+ var cells = doc1.SelectNodes("/tr/td");
+ if (cells != null)
+ foreach (XmlElement node in cells)
+ {
+ elements.Add(node.InnerXml);
+ }
+ return elements;
+ default:
+
+ if (CurrentListType != "nothing")
+ {
+ var doc = new XmlDocument();
+ doc.LoadXml(txt);
+ var node = doc.SelectSingleNode(string.Format("/{0}", GetOuterTag(CurrentListType)));
+ if (node != null)
+ {
+ txt = node.InnerXml;
+ }
+ }
+ return Regex.Split(txt, GetDelimiter(false));
+ }
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ string BuildContent(IList elements)
+ {
+ var listType = ddlListTemplateType.SelectedValue;
+ if (elements != null)
+ {
+ CurrentListType = listType;
+ using (var sw = new StringWriter())
+ {
+ var delimiter = GetDelimiter();
+ using (var xw = new XmlTextWriter(sw))
+ {
+ var notFirst = false;
+ xw.Formatting = Formatting.Indented;
+ var outerTag = GetOuterTag(ddlListTemplateType.SelectedValue);
+ if (outerTag != string.Empty)
+ {
+ xw.WriteStartElement(outerTag);
+ xw.WriteAttributeString("class", "dnnGridItem");
+ }
+ foreach (string element in elements)
+ {
+ if (GetInnerTag() != string.Empty)
+ {
+ xw.WriteStartElement(GetInnerTag());
+ }
+ if (notFirst)
+ {
+ xw.WriteRaw(delimiter);
+ }
+ else
+ {
+ notFirst = true;
+ }
+ xw.WriteRaw(element);
+ if (GetInnerTag() != string.Empty)
+ {
+ xw.WriteEndElement();
+ }
+ }
+ if (outerTag != string.Empty)
+ {
+ xw.WriteEndElement();
+ }
+ xw.Flush();
+ }
+
+ return sw.ToString();
+ }
+ }
+ return string.Empty;
+ }
+
+ string GetDelimiter(bool notCurrent = true)
+ {
+ if (notCurrent && ddlListTemplateType.SelectedValue == "table")
+ {
+ return ("");
+ }
+ var delimiter = "";
+ if (txtListTemplateDelimiter.Text != "")
+ {
+ delimiter = txtListTemplateDelimiter.Text;
+ }
+ delimiter += "\r\n";
+ return delimiter;
+ }
+
+ string GetOuterTag(string listType)
+ {
+ switch (listType)
+ {
+ case "table":
+ return "tr";
+ case "nothing":
+ return "";
+ case "ol":
+ case "ul":
+ return "li";
+ default:
+ return listType;
+ }
+ }
+
+ string GetInnerTag()
+ {
+ switch (ddlListTemplateType.SelectedValue)
+ {
+ case "table":
+ return "td";
+ default:
+ return "";
+ }
+ }
+
+ void ListTemplateSetHeaderAndFooter()
+ {
+ switch (ddlListTemplateType.SelectedValue)
+ {
+ case "table":
+ lblListTemplateHead.Text = @"<table class=""dnnFormItem"">";
+ lblListTemplateFooter.Text = @"...
</table>";
+ break;
+ case "div":
+ lblListTemplateHead.Text = "";
+ lblListTemplateFooter.Text = @"...";
+ break;
+ case "ol":
+ lblListTemplateHead.Text = @"<ol>";
+ lblListTemplateFooter.Text = @"...
</ol>";
+ break;
+ case "ul":
+ lblListTemplateHead.Text = @"<ul>";
+ lblListTemplateFooter.Text = @"...
</ul>";
+ break;
+ case "p":
+ lblListTemplateHead.Text = "";
+ lblListTemplateFooter.Text = @"...";
+ break;
+ case "nothing":
+ lblListTemplateHead.Text = @"...";
+ lblListTemplateFooter.Text = "";
+ break;
+ }
+ }
+
+ bool isValid(string x, ErrorOutput pos, bool addRoot)
+ {
+ if (addRoot)
+ {
+ x = string.Format("{0}", x);
+ }
+ using (var rdr = new XmlTextReader(new StringReader(x)))
+ {
+ try
+ {
+ while (rdr.Read())
+ {
+ }
+ return true;
+ }
+ catch (Exception ex)
+ {
+ switch (pos)
+ {
+ case ErrorOutput.TokenTemplate:
+ lblTemplateError.Text = (Localization.GetString("error.Text", LocalResourceFile) +
+ ex.Message);
+ lblTemplateError.Visible = true;
+ break;
+ case ErrorOutput.XslTranformation:
+ lblXslScriptError.Text = (Localization.GetString("error.Text", LocalResourceFile) +
+ ex.Message);
+ lblXslScriptError.Visible = true;
+ break;
+ case ErrorOutput.Save:
+ lblSaveXslError.Text = (Localization.GetString("error.Text", LocalResourceFile) + ex.Message);
+ lblSaveXslError.Visible = true;
+ break;
+ }
+ return false;
+ }
+ }
+ }
+
+ void setupDelimiter()
+ {
+ if (ddlListTemplateType.SelectedValue == "table")
+ {
+ txtListTemplateDelimiter.Enabled = false;
+ txtListTemplateDelimiter.BackColor = Color.LightGray;
+ addColumnWithTagsToListTemplate.Enabled = true;
+ }
+ else
+ {
+ txtListTemplateDelimiter.Enabled = true;
+ txtListTemplateDelimiter.BackColor = Color.White;
+ addColumnWithTagsToListTemplate.Enabled = false;
+ }
+ }
+
+ void LockControls(bool isLockRequested)
+ {
+ if (isLockRequested)
+ {
+ cmdRebuildContent.Enabled = false;
+ cmdSaveFile.Enabled = false;
+ cmdGenerateXslt.Enabled = false;
+ addColumnToListTemplate.Enabled = false;
+ addColumnWithTagsToListTemplate.Enabled = false;
+ ddlListTemplateType.Enabled = false;
+ ddlColumnsForListView.Enabled = false;
+ txtListTemplate.Enabled = false;
+ txtFileName.Enabled = false;
+ txtXslScript.Enabled = false;
+ }
+ else
+ {
+ cmdRebuildContent.Enabled = true;
+ cmdSaveFile.Enabled = true;
+ cmdGenerateXslt.Enabled = true;
+ addColumnToListTemplate.Enabled = true;
+ addColumnWithTagsToListTemplate.Enabled = true;
+ ddlListTemplateType.Enabled = true;
+ ddlColumnsForListView.Enabled = true;
+ txtListTemplate.Enabled = true;
+ txtFileName.Enabled = true;
+ txtXslScript.Enabled = true;
+ }
+ }
+
+ void ShowXslEditor()
+ {
+ txtFileName.BackColor = Color.White;
+ txtFileName.Enabled = true;
+ cmdSaveFile.Enabled = true;
+ dshHtml.IsExpanded = false;
+ dshXslt.IsExpanded = true;
+ dshSave.IsExpanded = true;
+ dshDetailView.IsExpanded = false;
+ dshOptions.IsExpanded = false;
+ dshListView.IsExpanded = false;
+ }
+
+
+ void SetupClientScripts()
+ {
+ cmdRebuildContent.Attributes.Add("onclick",
+ string.Format("return confirm(\'{0}\')",
+ Localization.GetString("confirmOnRebuild.Text",
+ LocalResourceFile)));
+ addColumnToListTemplate.Attributes.Add("onclick",
+ string.Format(
+ "AddCurrentItemIntoTextBox(event, \'{0}\', \'{1}\', \'{2}\', \'False\')",
+ txtListTemplate.ClientID, ddlColumnsForListView.ClientID,
+ txtXslScript.ClientID));
+ addColumnWithTagsToListTemplate.Attributes.Add("onclick",
+ string.Format(
+ "AddCurrentItemIntoTextBox(event, \'{0}\', \'{1}\', \'{2}\', \'True\')",
+ txtListTemplate.ClientID, ddlColumnsForListView.ClientID,
+ txtXslScript.ClientID));
+ addColumnToDetailTemplate.Attributes.Add("onclick",
+ string.Format(
+ "AddCurrentItemIntoTextBox(event, \'{0}\', \'{1}\', \'{2}\', \'False\')",
+ txtDetailTemplate.ClientID, ddlColumnsForDetailView.ClientID,
+ txtXslScript.ClientID));
+ addColumnToTrackingEmail.Attributes.Add("onclick",
+ string.Format(
+ "AddCurrentItemIntoTextBox(event, \'{0}\', \'{1}\', \'{2}\', \'False\')",
+ txtTrackingEmailTemplate.ClientID,
+ ddlColumnsForTrackingEmail.ClientID, txtXslScript.ClientID));
+ addHeader.Attributes.Add("onclick",
+ string.Format(
+ "AddCurrentItemIntoTextBox(event, \'{0}\', \'{1}\', \'{2}\', \'False\')",
+ txtHeaderTemplate.ClientID, ddlHeaders.ClientID, txtXslScript.ClientID));
+ var url = ResolveUrl("HelpPopup.aspx?resourcekey=Help_HiddenColumns");
+ hlpColumns.NavigateUrl = string.Format("javascript:OpenHelpWindow(\'{0}\');", url);
+ }
+
+ string TokenTemplateSettingsAsXml()
+ {
+ using (var strXml = new StringWriter())
+ {
+ using (var writer = new XmlTextWriter(strXml))
+ {
+ writer.WriteStartElement("udt:template");
+ writer.WriteAttributeString("listType", ddlListTemplateType.SelectedValue);
+ writer.WriteAttributeString("delimiter", txtListTemplateDelimiter.Text);
+ writer.WriteAttributeString("listView", txtListTemplate.Text);
+ writer.WriteAttributeString("headerView", txtHeaderTemplate.Text);
+ writer.WriteAttributeString("detailView", txtDetailTemplate.Text);
+ writer.WriteAttributeString("trackingEmail", txtTrackingEmailTemplate.Text);
+ if (chkEnablePaging.Checked)
+ {
+ writer.WriteAttributeString("paging", "true");
+ }
+ if (chkEnableSearch.Checked)
+ {
+ writer.WriteAttributeString("searching", "true");
+ }
+ if (chkEnableSorting.Checked)
+ {
+ writer.WriteAttributeString("sorting", "true");
+ }
+ if (chkShowDetailView.Checked)
+ {
+ writer.WriteAttributeString("showDetailView", "true");
+ }
+ if (IsTrackingEmailMode)
+ {
+ writer.WriteAttributeString("isTrackingMode", "true");
+ }
+ writer.WriteEndElement();
+ }
+
+ return strXml.ToString();
+ }
+ }
+
+
+ void EditExistingScriptAndTemplates(IFileInfo file)
+ {
+ ViewState[Definition.XSLFolderName] = file.Folder;
+ txtFolderName.Text = file.Folder;
+ txtFileName.Text = file.FileName;
+ txtFileName.MaxLength =
+ Convert.ToInt32(200 -
+ (ModuleContext.PortalSettings.HomeDirectoryMapPath + "/" + file.Folder).Length);
+ string fileContent;
+ using (var stream = FileManager.Instance.GetFileContent(file))
+ {
+ using (var x = new StreamReader(stream))
+ {
+ fileContent = x.ReadToEnd();
+ }
+ }
+
+ fileContent = fileContent.Replace(XslTemplatingUtilities.HardSpace,
+ XslTemplatingUtilities.SpacePlaceholder);
+ var doc = new XmlDocument();
+ doc.LoadXml(fileContent);
+ var nameSpaceManager = new XmlNamespaceManager(doc.NameTable);
+ nameSpaceManager.AddNamespace("udt", "DotNetNuke/UserDefinedTable");
+ nameSpaceManager.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");
+ var scriptRoot = doc.SelectSingleNode("/xsl:stylesheet", nameSpaceManager);
+ var templateDefinition =
+ // ReSharper disable PossibleNullReferenceException
+ (XmlElement) (scriptRoot.SelectSingleNode("udt:template", nameSpaceManager));
+
+ if (templateDefinition != null)
+ {
+ if (templateDefinition.HasAttribute("headerView"))
+ {
+ txtHeaderTemplate.Text =
+ (HttpUtility.HtmlDecode(templateDefinition.Attributes["headerView"].Value).Replace(
+ XslTemplatingUtilities.SpacePlaceholder, XslTemplatingUtilities.HardSpace));
+ }
+
+ if (templateDefinition.HasAttribute("listView"))
+ {
+ txtListTemplate.Text =
+ (HttpUtility.HtmlDecode(templateDefinition.Attributes["listView"].Value).Replace(
+ XslTemplatingUtilities.SpacePlaceholder, XslTemplatingUtilities.HardSpace));
+ }
+ if (templateDefinition.HasAttribute("detailView"))
+ {
+ txtDetailTemplate.Text =
+ (HttpUtility.HtmlDecode(templateDefinition.Attributes["detailView"].Value).Replace(
+ XslTemplatingUtilities.SpacePlaceholder, XslTemplatingUtilities.HardSpace));
+ }
+ chkEnablePaging.Checked = templateDefinition.HasAttribute("paging");
+ chkEnableSorting.Checked = templateDefinition.HasAttribute("sorting");
+ chkEnableSearch.Checked = templateDefinition.HasAttribute("searching");
+ chkShowDetailView.Checked = templateDefinition.HasAttribute("showDetailView");
+ if (templateDefinition.HasAttribute("isTrackingMode"))
+ {
+ IsTrackingEmailMode = true;
+ txtTrackingEmailTemplate.Text =
+ (HttpUtility.HtmlDecode(templateDefinition.Attributes["trackingEmail"].Value).Replace(
+ XslTemplatingUtilities.SpacePlaceholder, XslTemplatingUtilities.HardSpace));
+ }
+
+ if (templateDefinition.HasAttribute("listType"))
+ {
+ ddlListTemplateType.SelectedValue = templateDefinition.Attributes["listType"].Value;
+ setupDelimiter();
+ }
+ if (templateDefinition.HasAttribute("delimiter"))
+ {
+ txtListTemplateDelimiter.Text =
+ HttpUtility.HtmlDecode(templateDefinition.Attributes["delimiter"].Value);
+ }
+ scriptRoot.RemoveChild(templateDefinition);
+ }
+ txtXslScript.Text =
+ (XslTemplatingUtilities.PrettyPrint(doc).Replace(XslTemplatingUtilities.SpacePlaceholder,
+ XslTemplatingUtilities.HardSpace));
+ ShowXslEditor();
+ // ReSharper restore PossibleNullReferenceException
+ }
+
+ #endregion
+
+ #region Event Handlers
+ protected override void OnInit(EventArgs e)
+ {
+ Load += Page_Load;
+ cmdRebuildContent.Click += cmdRebuildContent_Click;
+ cmdGenerateXslt.Click += cmdGenerateXslt_Click;
+ cmdBack.Click += cmdBack_Click;
+ cmdSaveFile.Click += cmdSaveFile_Click;
+ cmdConfirmOverwriteFile.Click += cmdConfirmOverwriteFile_Click;
+ cmdDenyOverwriteFile.Click += cmdDenyOverwriteFile_Click;
+ chkShowDetailView.CheckedChanged += chkShowDetailView_CheckedChanged;
+ cmdRebuildDetail.Click += cmdRebuildDetail_Click;
+ cmdRebuildContent.Click += cmdRebuildContent_Click;
+ cmdRebuildTrackingEmail.Click += cmdRebuildTrackingEmail_Click;
+ //hlpColumns.
+
+ ddlListTemplateType.SelectedIndexChanged += ddlListType_SelectedIndexChanged;
+ }
+ void Page_Load(object sender, EventArgs e)
+ {
+ _schemaDataSet = UdtController.GetSchemaDataset();
+ SetupClientScripts();
+
+ if (! IsPostBack)
+ {
+ if (Request.QueryString["fileid"].AsString().Length > 0 ||
+ Request.QueryString["Edit"].AsString().ToLowerInvariant() == "current")
+ {
+ IFileInfo file=null;
+ if (Request.QueryString["Edit"].AsString().ToLowerInvariant() == "current")
+ {
+ var script = ModuleContext.Settings[SettingName.XslUserDefinedStyleSheet].ToString();
+ if (!string.IsNullOrEmpty( script))
+ file = FileManager.Instance.GetFile(ModuleContext.PortalId,script);
+ ReturnUrl = Globals.NavigateURL();
+ }
+ else
+ {
+ var fileId = int.Parse(Request.QueryString["fileid"]);
+ file = FileManager.Instance.GetFile(fileId);
+ ReturnUrl = ModuleContext.EditUrl("Manage");
+ }
+ if (file != null
+ && file.Extension.ToLowerInvariant().StartsWith("xsl")
+ && Utilities.HasWritePermission(file.Folder, ModuleContext.PortalId))
+ {
+ EditExistingScriptAndTemplates(file);
+ }
+ else
+ InitializeNewScript();
+ }
+ else
+ {
+ InitializeNewScript();
+ }
+ ListTemplateSetHeaderAndFooter();
+ TemplatesPopulateColumnDropDownLists();
+ TemplatesSetVisibility( ! IsTrackingEmailMode);
+ }
+ }
+
+ void InitializeNewScript()
+ {
+ ViewState[Definition.XSLFolderName] = Definition.XSLFolderName;
+ if (IsTrackingEmailMode)
+ {
+ txtTrackingEmailTemplate.Text = string.Concat("", "\r\n",
+ XslTemplatingUtilities.GenerateDetailViewTokenText
+ (UdtController.GetSchemaDataset().Tables[
+ DataSetTableName.Fields],
+ includeEditLink: false));
+ }
+ else
+ {
+ txtListTemplate.Text = BuildContent(GetBasicElements());
+ txtListTemplateDelimiter.Enabled = false;
+ txtListTemplateDelimiter.BackColor = Color.LightGray;
+ txtDetailTemplate.Text =
+ XslTemplatingUtilities.GenerateDetailViewTokenText(
+ _schemaDataSet.Tables[DataSetTableName.Fields]);
+ }
+ txtFolderName.Text = Definition.XSLFolderName;
+ txtFileName.MaxLength =
+ Convert.ToInt32(200 -
+ (ModuleContext.PortalSettings.HomeDirectoryMapPath + "/" +
+ Definition.XSLFolderName + "/").Length);
+ }
+
+ void cmdRebuildContent_Click(object sender, EventArgs e)
+ {
+ ddlListTemplateType.Enabled = true;
+ lblTemplateError.Visible = false;
+ lblXslScriptError.Visible = false;
+ lblSaveXslError.Visible = false;
+
+ txtListTemplate.Text = BuildContent(GetBasicElements());
+ if (chkShowDetailView.Checked && txtListTemplate.Text.IndexOf("UDT:DetailView") < 0)
+ {
+ txtListTemplate.Text = txtListTemplate.Text.Replace("UDT:EditLink", "UDT:DetailView");
+ }
+ txtXslScript.Text = "";
+ txtFileName.BackColor = Color.LightGray;
+ txtFileName.Enabled = false;
+ cmdSaveFile.Enabled = false;
+ }
+
+ void cmdGenerateXslt_Click(object sender, EventArgs e)
+ {
+ lblTemplateError.Visible = false;
+ lblXslScriptError.Visible = false;
+ lblSaveXslError.Visible = false;
+
+ var listTemplate = txtListTemplate.Text;
+ var detailTemplate = txtDetailTemplate.Text;
+ var headerTemplate = txtHeaderTemplate.Text;
+ if (IsTrackingEmailMode)
+ {
+ if (isValid(txtTrackingEmailTemplate.Text, ErrorOutput.XslTranformation, addRoot: true))
+ {
+ txtXslScript.Text =
+ XslTemplatingUtilities.TransformTokenTextToXslScript(UdtController.GetSchemaDataset(),
+ txtTrackingEmailTemplate.Text);
+ txtXslScript.Enabled = true;
+ ShowXslEditor();
+ }
+ }
+ else
+ {
+ if (isValid(listTemplate, ErrorOutput.XslTranformation, addRoot: true) &&
+ (! chkShowDetailView.Checked || isValid(detailTemplate, ErrorOutput.XslTranformation, addRoot: true)))
+ {
+ txtXslScript.Text = XslTemplatingUtilities.TransformTokenTextToXslScript(_schemaDataSet, listTemplate,
+ detailTemplate,
+ headerTemplate,
+ chkEnablePaging.Checked,
+ chkEnableSorting.Checked,
+ chkEnableSearch.Checked,
+ chkShowDetailView.Checked,
+ CurrentListType);
+ txtXslScript.Enabled = true;
+ ShowXslEditor();
+ }
+ }
+ }
+
+ void cmdBack_Click(object sender, EventArgs e)
+ {
+ Response.Redirect(ReturnUrl, true);
+ }
+
+ void ddlListType_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ lblTemplateError.Visible = false;
+ lblXslScriptError.Visible = false;
+ lblSaveXslError.Visible = false;
+ //content must always be valid XML
+ if (isValid(txtListTemplate.Text, ErrorOutput.TokenTemplate, true))
+ {
+ var elements = GetCurrentElements();
+ if (elements != null)
+ {
+ txtListTemplate.Text = BuildContent(GetCurrentElements());
+ setupDelimiter();
+ }
+ else
+ {
+ ddlListTemplateType.SelectedValue = CurrentListType;
+ lblTemplateError.Text = Localization.GetString("noTransformButValid", LocalResourceFile);
+ lblTemplateError.Visible = true;
+ }
+ }
+ else
+ {
+ ddlListTemplateType.SelectedValue = CurrentListType;
+ }
+ ListTemplateSetHeaderAndFooter();
+ txtXslScript.Text = "";
+ txtFileName.BackColor = Color.LightGray;
+ txtFileName.Enabled = false;
+ cmdSaveFile.Enabled = false;
+ }
+
+ string GetFileName()
+ {
+ var fileName = txtFileName.Text.Trim();
+ fileName = Globals.CleanFileName(fileName);
+ if (! fileName.ToLowerInvariant().EndsWith(".xsl"))
+ {
+ fileName += ".xsl";
+ }
+ txtFileName.Text = fileName;
+ return fileName;
+ }
+
+ string GetFileContent()
+ {
+ var fileContent = txtXslScript.Text;
+ fileContent = fileContent.Replace("",
+ (TokenTemplateSettingsAsXml() + "\r\n" + ""));
+ return fileContent;
+ }
+
+
+ IFolderInfo GetFolder()
+ {
+ return Utilities.GetFolder(ModuleContext.PortalSettings,
+ ViewState[Definition.XSLFolderName].AsString(), Definition.XSLFolderName);
+ }
+
+
+ static bool SaveScript(string fileContent, string fileName, IFolderInfo folder, bool forceOverWrite)
+ {
+ return Utilities.SaveScript( fileContent, fileName, folder, forceOverWrite);
+ }
+
+ void cmdSaveFile_Click(object sender, EventArgs e)
+ {
+ if (isValid(txtXslScript.Text, ErrorOutput.Save, false)) //XSLTstylesheet must be at least valid XML!
+ {
+ //get content
+ var fileContent = GetFileContent();
+ var fileName = GetFileName();
+
+ if (fileName.Length > 4)
+ {
+ var folder = GetFolder();
+
+ if (SaveScript(fileContent, fileName, folder, forceOverWrite: false))
+ {
+ //update setting:
+ UpdateSettings(folder.FolderPath + fileName);
+ Response.Redirect(ReturnUrl, true);
+ }
+ else
+ {
+ LockControls(true);
+ panConfirm.Visible = true;
+ }
+ }
+ }
+ }
+
+ void cmdConfirmOverwriteFile_Click(object sender, EventArgs e)
+ {
+ var fileContent = GetFileContent();
+ var fileName = GetFileName();
+ var folder = GetFolder();
+ SaveScript(fileContent, fileName, folder, forceOverWrite: true);
+ UpdateSettings(folder.FolderPath + fileName);
+ Response.Redirect(ReturnUrl, true);
+ }
+
+ void UpdateSettings(string fileWithPath)
+ {
+ var moduleController = new ModuleController();
+ if (IsTrackingEmailMode)
+ {
+ moduleController.UpdateTabModuleSetting(ModuleContext.TabModuleId, SettingName.TrackingScript, fileWithPath);
+ }
+ else
+ {
+ moduleController.UpdateTabModuleSetting(ModuleContext.TabModuleId, SettingName.RenderingMethod,
+ RenderingMethod.UserdefinedXSL);
+ moduleController.UpdateTabModuleSetting(ModuleContext.TabModuleId, SettingName.XslUserDefinedStyleSheet,
+ fileWithPath);
+ }
+ }
+
+ void cmdDenyOverwriteFile_Click(object sender, EventArgs e)
+ {
+ txtFileName.Text = "";
+ LockControls(false);
+ panConfirm.Visible = false;
+ }
+
+ //void cmdColumnsHelp_Click(object sender, EventArgs e)
+ //{
+ // var url = ResolveUrl("HelpPopup.aspx?resourcekey=Help_HiddenColumns");
+
+ // var columnsHelpPopup = "";
+ // Page.ClientScript.RegisterStartupScript(GetType(), "columnsHelpPopup", columnsHelpPopup);
+ //}
+
+ void chkShowDetailView_CheckedChanged(object sender, EventArgs e)
+ {
+ TemplatesSetVisibility(isViewMode: true);
+ TemplatesPopulateColumnDropDownLists();
+ dshDetailView.IsExpanded = chkShowDetailView.Checked;
+ }
+
+ void cmdRebuildDetail_Click(object sender, EventArgs e)
+ {
+ txtDetailTemplate.Text =
+ XslTemplatingUtilities.GenerateDetailViewTokenText(_schemaDataSet.Tables[DataSetTableName.Fields]);
+ }
+
+ protected void cmdRebuildTrackingEmail_Click(object sender, EventArgs e)
+ {
+ txtTrackingEmailTemplate.Text = string.Concat("",
+ "\r\n",
+ XslTemplatingUtilities.GenerateDetailViewTokenText(
+ UdtController.GetSchemaDataset().Tables[
+ DataSetTableName.Fields], includeEditLink: false));
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Token2Xsl.ascx.designer.cs b/Token2Xsl.ascx.designer.cs
new file mode 100644
index 0000000..d311da0
--- /dev/null
+++ b/Token2Xsl.ascx.designer.cs
@@ -0,0 +1,600 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace DotNetNuke.Modules.UserDefinedTable {
+
+
+ public partial class Token2Xsl {
+
+ ///
+ /// hlpColumns control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink hlpColumns;
+
+ ///
+ /// dshHtml control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshHtml;
+
+ ///
+ /// tblHtml control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl tblHtml;
+
+ ///
+ /// dshListView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshListView;
+
+ ///
+ /// dvListview control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvListview;
+
+ ///
+ /// plListType control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plListType;
+
+ ///
+ /// ddlListTemplateType control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.DropDownList ddlListTemplateType;
+
+ ///
+ /// cmdRebuildContent control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdRebuildContent;
+
+ ///
+ /// plDelimiter control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plDelimiter;
+
+ ///
+ /// txtListTemplateDelimiter control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtListTemplateDelimiter;
+
+ ///
+ /// lblTemplateError control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblTemplateError;
+
+ ///
+ /// lblListTemplateHead control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblListTemplateHead;
+
+ ///
+ /// plHeaderList control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plHeaderList;
+
+ ///
+ /// ddlHeaders control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.DropDownList ddlHeaders;
+
+ ///
+ /// addHeader control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink addHeader;
+
+ ///
+ /// txtHeaderTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtHeaderTemplate;
+
+ ///
+ /// plColumns control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plColumns;
+
+ ///
+ /// ddlColumnsForListView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.DropDownList ddlColumnsForListView;
+
+ ///
+ /// addColumnToListTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink addColumnToListTemplate;
+
+ ///
+ /// addColumnWithTagsToListTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink addColumnWithTagsToListTemplate;
+
+ ///
+ /// txtListTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtListTemplate;
+
+ ///
+ /// lblListTemplateFooter control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblListTemplateFooter;
+
+ ///
+ /// dshDetailView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshDetailView;
+
+ ///
+ /// dvDetailView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvDetailView;
+
+ ///
+ /// plColumns2 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plColumns2;
+
+ ///
+ /// ddlColumnsForDetailView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.DropDownList ddlColumnsForDetailView;
+
+ ///
+ /// addColumnToDetailTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink addColumnToDetailTemplate;
+
+ ///
+ /// cmdRebuildDetail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdRebuildDetail;
+
+ ///
+ /// txtDetailTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtDetailTemplate;
+
+ ///
+ /// dshTrackingEmail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshTrackingEmail;
+
+ ///
+ /// dvTrackingEmail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvTrackingEmail;
+
+ ///
+ /// plColumns3 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plColumns3;
+
+ ///
+ /// ddlColumnsForTrackingEmail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.DropDownList ddlColumnsForTrackingEmail;
+
+ ///
+ /// addColumnToTrackingEmail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink addColumnToTrackingEmail;
+
+ ///
+ /// cmdRebuildTrackingEmail control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdRebuildTrackingEmail;
+
+ ///
+ /// txtTrackingEmailTemplate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtTrackingEmailTemplate;
+
+ ///
+ /// dshOptions control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshOptions;
+
+ ///
+ /// dvOptions control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvOptions;
+
+ ///
+ /// lblEnableSorting control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblEnableSorting;
+
+ ///
+ /// chkEnableSorting control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkEnableSorting;
+
+ ///
+ /// lblEnablePaging control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblEnablePaging;
+
+ ///
+ /// chkEnablePaging control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkEnablePaging;
+
+ ///
+ /// lblEnableSearch control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblEnableSearch;
+
+ ///
+ /// chkEnableSearch control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkEnableSearch;
+
+ ///
+ /// lblSearchIsObsolete control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblSearchIsObsolete;
+
+ ///
+ /// lblShowDetailView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblShowDetailView;
+
+ ///
+ /// chkShowDetailView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkShowDetailView;
+
+ ///
+ /// lblXslScriptError control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblXslScriptError;
+
+ ///
+ /// cmdGenerateXslt control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button cmdGenerateXslt;
+
+ ///
+ /// dshXslt control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshXslt;
+
+ ///
+ /// tblXslt control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl tblXslt;
+
+ ///
+ /// txtXslScript control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtXslScript;
+
+ ///
+ /// dshSave control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.SectionHeadControl dshSave;
+
+ ///
+ /// tblSave control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlTable tblSave;
+
+ ///
+ /// lblSaveXslError control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblSaveXslError;
+
+ ///
+ /// plFolderName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plFolderName;
+
+ ///
+ /// txtFolderName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtFolderName;
+
+ ///
+ /// plFileName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl plFileName;
+
+ ///
+ /// txtFileName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtFileName;
+
+ ///
+ /// cmdSaveFile control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdSaveFile;
+
+ ///
+ /// panConfirm control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel panConfirm;
+
+ ///
+ /// lblConfirm control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Label lblConfirm;
+
+ ///
+ /// cmdConfirmOverwriteFile control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdConfirmOverwriteFile;
+
+ ///
+ /// cmdDenyOverwriteFile control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdDenyOverwriteFile;
+
+ ///
+ /// cmdBack control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton cmdBack;
+ }
+}
diff --git a/UserDefinedTable.sln b/UserDefinedTable.sln
new file mode 100644
index 0000000..7f07af3
--- /dev/null
+++ b/UserDefinedTable.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormAndList", "FormAndList.csproj", "{DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormAndList.Tests", "Tests\FormAndList.Tests.csproj", "{769BDA20-06BB-4640-A27A-EE1257E161B6}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Release|Any CPU.Build.0 = Release|Any CPU
+ {769BDA20-06BB-4640-A27A-EE1257E161B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {769BDA20-06BB-4640-A27A-EE1257E161B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {769BDA20-06BB-4640-A27A-EE1257E161B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {769BDA20-06BB-4640-A27A-EE1257E161B6}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/UserDefinedTable.vs2013.sln b/UserDefinedTable.vs2013.sln
new file mode 100644
index 0000000..0117526
--- /dev/null
+++ b/UserDefinedTable.vs2013.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormAndList", "FormAndList.csproj", "{DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DDE04CE2-57E6-4B1C-BF12-C36FCC7B7333}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/configuration.ascx b/configuration.ascx
new file mode 100644
index 0000000..6892450
--- /dev/null
+++ b/configuration.ascx
@@ -0,0 +1,256 @@
+<%@ Control Language="C#" Explicit="True" Inherits="DotNetNuke.Modules.UserDefinedTable.Configuration"
+ TargetSchema="http://schemas.microsoft.com/intellisense/ie5" CodeBehind="Configuration.ascx.cs" AutoEventWireup="false"%>
+<%@ Register TagPrefix="Portal" TagName="URL" Src="~/controls/URLControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx" %>
+<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls" %>
+<%@ Register src="Controls/Fields.ascx" tagname="Fields" tagprefix="fnl" %>
+
+
+
+
diff --git a/datatypes.config b/datatypes.config
new file mode 100644
index 0000000..c3b082c
--- /dev/null
+++ b/datatypes.config
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/default.ascx b/default.ascx
new file mode 100644
index 0000000..72af8c1
--- /dev/null
+++ b/default.ascx
@@ -0,0 +1,2 @@
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.Default" Codebehind="Default.ascx.cs" AutoEventWireup="false" %>
+
diff --git a/form.ascx b/form.ascx
new file mode 100644
index 0000000..f7f80ae
--- /dev/null
+++ b/form.ascx
@@ -0,0 +1,44 @@
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.EditForm" CodeBehind="Form.ascx.cs" AutoEventWireup="false" %>
+
+
+
\ No newline at end of file
diff --git a/helppopup.aspx b/helppopup.aspx
new file mode 100644
index 0000000..4a16f34
--- /dev/null
+++ b/helppopup.aspx
@@ -0,0 +1,18 @@
+<%@ Page Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.HelpPopup" Codebehind="HelpPopup.aspx.cs" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/icon_fnl_32px.gif b/icon_fnl_32px.gif
new file mode 100644
index 0000000..1b64466
Binary files /dev/null and b/icon_fnl_32px.gif differ
diff --git a/list.ascx b/list.ascx
new file mode 100644
index 0000000..c6b896f
--- /dev/null
+++ b/list.ascx
@@ -0,0 +1,39 @@
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.List" AutoEventWireup="false" CodeBehind="List.ascx.cs" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Import Namespace="DotNetNuke.Entities.Icons" %>
+<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls" %>
+
\ No newline at end of file
diff --git a/makethumbnail.ashx b/makethumbnail.ashx
new file mode 100644
index 0000000..7eb4fd2
--- /dev/null
+++ b/makethumbnail.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="MakeThumbnail.ashx.cs" Class="DotNetNuke.Modules.UserDefinedTable.MakeThumbnail" %>
diff --git a/module.css b/module.css
new file mode 100644
index 0000000..84a71f1
--- /dev/null
+++ b/module.css
@@ -0,0 +1,71 @@
+/* ================================
+ CSS STYLES FOR Module DNN.UserDefinedTable
+ ================================
+*/
+
+
+
+.UDT_UponSubmit
+{
+ margin-top :1em;
+}
+.UDT_Caption
+{
+ display:block;
+}
+
+.fnlSettingsWarning {
+ margin: 4% 0 0 32%;
+ padding: 0;
+}
+
+.dnnFormItem span.CommandButton {
+ clear: both;
+ display: block;
+ margin-left: 32%;
+ overflow: hidden;
+}
+.dnnForm .dnnFormItem .dnnFormLabelWithoutHelp label span {
+ line-height: 1.4;
+ padding-right: 1.8em;
+ display: block;
+ position: relative;
+}
+.dnnForm .dnnFormItem .dnnFormLabelWithoutHelp
+{
+ width: 100%;
+ padding: 0px;
+ margin: 0px;
+}
+#dnnFormAndListConfig .Sortable .Draggable
+{
+ cursor: move;
+}
+
+
+.dnnFormAndList .dnnGridHeader th{
+ font-size: 100%;
+ white-space: nowrap;
+}
+
+
+.fnlForm
+{
+margin: 1em auto 1em;
+}
+/*
+#ssPageSettings .dnnTextEditor
+{
+ margin-left: 32%;
+}*/
+
+.pushRight {
+ margin-left: 32%;
+}
+.dnnForm input.dnnFormRequired{
+ border-left: 5px red solid!important;
+ padding-right: -5px!important;
+}
+.dnnFormItem textarea.dnn2rows {
+ min-height: 1em;
+}
\ No newline at end of file
diff --git a/releasenotes.htm b/releasenotes.htm
new file mode 100644
index 0000000..09b99ae
--- /dev/null
+++ b/releasenotes.htm
@@ -0,0 +1,74 @@
+
+ Release Notes
+
+DotNetNuke Form and List 06.01.00
+Changes to 6.1.0
+
+ - Fix for DNN 7.2.2.
+ - Allowed for custom datatypes.config (to be placed in Portals/_default/UserDefinedTable).
+
datatypes.config in the DesktopModules/UserDefinedTable will remain to be overwriten on installation of a new version. However, if you copy it to the folder mentioned above, your cusotmizations will not be overwriten on installation anymore.
+
+
+Changes to 6.0.7
+
+ - Corrected an error in datatypes.config.
+
+Changes to 6.0.6
+
+ - Add in Sql to remove 'text on row' setting for UserDefinedTable to make SQL Azure compatible.
+ - Add new azureCompatible element to manifest.
+ - Added a fix for importing templates.
+
+Changes to 6.0.2
+
+ - Fix: MakeThumbnail was broken if the application pool was configured to .Net 4
+ - Change: Data is now stored in nvarchar(max) instead of ntext
+
+Changes to 6.0.1
+
+ - Scripts now compatible with SQL Azure.
+
+Changes to 6.0.0
+
+ - Icons are shown in module action buttons (workaraound to core issue eith IconAPI)
+ - Fix to Token2XSL Editor, changing List type raised exception
+ - MakeTumbnail and ShowXml handlers had been missing in install package
+ - Updated help texts for better understanding of filter statement, token support in email subject and css style
+
+
+ Major changes (for 6.0.x):
+
+ - DNN 6 Form Patterns including modal PopUps and Tabs
+ - DST Support for following data types: Time, DateTime, CreatedAt, ChangedAt
+ - New FileManager API for XSLT scripts and following data types: Url, Download,
+ Image
+ - Usage of Telerik Controls
+ - Some JQuery candy: changing of field order with drag'n'drop, new editor for
+ multiple field values
+ - New field settings (similiar to module settings) facilitates more special
+ settings by type.
+ - Form is now WAI compliant
+ - Multi value option for data type 'Text'
+ - Support of Icon API
+ - Moved module wide data type settings (e.g. thumbnail height/width) directly to
+ data type
+ - Rendering methods are now reduced to DataGrid and XSLT. The option for predefined XSLT scripts was removed.
+ The old scripts are no longer delivered with the module. If an existing instance still uses an old script,
+ the script will be copied into the portal (folder XslStylesheet/UDT Legacy).
+
+ - Removed few settings/ features in exchange of a better UI and a lighter code
+ base.
+ - It is now converted to C#
+ - Important for updates
+ The switch to Form Pattern has an effect on how the form is rendered. CSS tweaks for the old form will certainly fail.
+ Please test the new UI before upgrading.
+
+
+
+ This release is compiled against the .Net 3.5 Framework using VS2010.
+ Minimum DotNetNuke core version is 6.1.0
+
+
+
+
+
\ No newline at end of file
diff --git a/settings.ascx b/settings.ascx
new file mode 100644
index 0000000..661a2e6
--- /dev/null
+++ b/settings.ascx
@@ -0,0 +1,35 @@
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.Settings" AutoEventWireup="false" CodeBehind="Settings.ascx.cs" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/showxml.ashx b/showxml.ashx
new file mode 100644
index 0000000..8a95ef6
--- /dev/null
+++ b/showxml.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="ShowXml.ashx.cs" Class="DotNetNuke.Modules.UserDefinedTable.ShowXml" %>
diff --git a/template.ascx b/template.ascx
new file mode 100644
index 0000000..1b94a22
--- /dev/null
+++ b/template.ascx
@@ -0,0 +1,42 @@
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.Template"
+ CodeBehind="Template.ascx.cs" AutoEventWireup="false" %>
+
+
+
+
+
diff --git a/templatelist.ascx b/templatelist.ascx
new file mode 100644
index 0000000..b77bd71
--- /dev/null
+++ b/templatelist.ascx
@@ -0,0 +1,42 @@
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.TemplateList"
+ CodeBehind="TemplateList.ascx.cs" AutoEventWireup="false" %>
+<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls" %>
+
+
Start with a new
+
+ Configuration
+
+
or choose a template:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/token2xsl.ascx b/token2xsl.ascx
new file mode 100644
index 0000000..b45ca5e
--- /dev/null
+++ b/token2xsl.ascx
@@ -0,0 +1,294 @@
+<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Control Language="C#" Inherits="DotNetNuke.Modules.UserDefinedTable.Token2Xsl"
+ TargetSchema="http://schemas.microsoft.com/intellisense/ie5" Codebehind="Token2Xsl.ascx.cs" AutoEventWireup="false" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+ ;
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/xslstylesheets/tracking/auto.xsl b/xslstylesheets/tracking/auto.xsl
new file mode 100644
index 0000000..ef5a176
--- /dev/null
+++ b/xslstylesheets/tracking/auto.xsl
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ number
+ text
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xslstylesheets/xslscripts.xml b/xslstylesheets/xslscripts.xml
new file mode 100644
index 0000000..e1b782d
--- /dev/null
+++ b/xslstylesheets/xslscripts.xml
@@ -0,0 +1,345 @@
+
+
+
+ <?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:udt="DotNetNuke/UserDefinedTable" exclude-result-prefixes ="udt">
+ <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
+ <!--
+ This prefix is used to generate module specific query strings
+ Each querystring or form value that starts with udt_{ModuleId}_param
+ will be added as parameter starting with param
+ -->
+ <xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId"/>_param</xsl:variable>
+{SEARCHING0}
+{PAGING0}
+{SORTING0}
+{DETAIL0}
+ <xsl:template match="udt:Data" mode="list">
+ {PAGING5}
+ [LISTVIEW]
+ {PAGING6}
+ </xsl:template>
+ <xsl:template match="/udt:UserDefinedTable">
+{DETAIL1}
+{SEARCHING1}
+<xsl:variable name="currentData" select="udt:Data{SEARCHING2}" />
+{PAGING1}
+<xsl:if test="$currentData">
+ [OPENTAG]
+ {SORTING1}
+ [HEADERVIEW]
+ <xsl:apply-templates select="$currentData" mode="list">
+ {SORTING2}
+ {PAGING2}
+ </xsl:apply-templates>
+ [/OPENTAG]
+</xsl:if>
+{PAGING3}
+{DETAIL2}
+ </xsl:template>
+{SEARCHING3}
+{SORTING3}
+{PAGING4}
+ <xsl:template name="EditLink">
+ <xsl:if test="udt:EditLink">
+ <a href="{udt:EditLink}"><img border="0" alt="edit" src="{//udt:Context/udt:ApplicationPath}/images/edit.gif" /></a>
+ </xsl:if>
+ </xsl:template>
+{DETAIL3}
+</xsl:stylesheet>
+
+
+ <xsl:param name="param_detail" />
+ <xsl:template match="udt:Data" mode="detail">
+ [DETAILVIEW]
+ </xsl:template>
+
+
+ <xsl:choose>
+ <xsl:when test="$param_detail">
+ <!--master-detail view-->
+ <xsl:apply-templates select="udt:Data[udt:UserDefinedRowId=$param_detail]" mode="detail" />
+ </xsl:when>
+ <xsl:otherwise>
+
+
+ </xsl:otherwise>
+</xsl:choose>
+
+
+ <xsl:template name="ListView">
+<a href="{//udt:Context/udt:ApplicationPath}/tabid/{//udt:Context/udt:TabId}/Default.aspx"><img border="0" alt="Back" src="{//udt:Context/udt:ApplicationPath}/images/lt.gif" /></a>
+</xsl:template>
+
+<xsl:template name="DetailView">
+<a href="?{$prefix_param}_detail={udt:UserDefinedRowId}"><img border="0" alt="detail" src="{//udt:Context/udt:ApplicationPath}/images/view.gif" /></a>
+</xsl:template>
+
+
+
+<xsl:param name="param_orderby" select="//udt:Fields[udt:UserDefinedFieldId=//udt:Context/udt:OrderBy]/udt:SortColumn"/>
+<xsl:param name="param_direction" select="//udt:Context/udt:OrderDirection"/>
+<!--wrong string would break stylesheet, so fallback to ascending if userinput is wrong-->
+<xsl:variable name="orderDirection">
+ <xsl:choose>
+ <xsl:when test="$param_direction='descending'">
+ <xsl:text>descending</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>ascending</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+<xsl:variable name="orderType">
+<xsl:variable name="DataType" select="//udt:Fields[udt:SortColumn=$param_orderby]/udt:FieldType" />
+ <xsl:choose>
+ <xsl:when test="$DataType='Int32' or $DataType='Decimal' or $DataType='Currency'">number</xsl:when>
+ <xsl:otherwise>text</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+
+
+ <!-- DEFINE ANY HEADERS HERE, EXAMPLE IS FOR TABLE TYPE LISTING -->
+ <!-- Parameter header is optional! -->
+ <!--
+ <tr class="dnnGridHeader">
+ <td/>
+ <td>
+ <xsl:apply-templates select ="udt:Fields[udt:FieldTitle='NameOfColumn']">
+ <xsl:with-param name ="header" select ="NewHeaderName"/>
+ </xsl:apply-templates>
+ </td>...
+ </tr>
+ -->
+
+
+ <xsl:sort select="*[name()=$param_orderby]" order="{$orderDirection}" data-type="{$orderType}" />
+
+
+ <xsl:template match="udt:Fields" name ="SortingHeader">
+ <xsl:param name ="header" select ="udt:FieldTitle"/>
+ <xsl:if test="udt:Visible='true' or udt:Visible='True'">
+ <a>
+ <xsl:attribute name ="href">
+ <xsl:choose >
+ <xsl:when test="udt:ValueColumn=$param_orderby">
+ <xsl:variable name="flippedDirection">
+ <xsl:choose>
+ <xsl:when test="$orderDirection='ascending'">
+ <xsl:text>descending</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>ascending</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ ?<xsl:value-of select="$prefix_param"/>_orderby=<xsl:value-of select="udt:ValueColumn"/>&amp;<xsl:value-of select="$prefix_param"/>_direction=<xsl:value-of select="$flippedDirection"/>{SEARCHING4}
+ </xsl:when>
+ <xsl:otherwise>
+ ?<xsl:value-of select="$prefix_param"/>_orderby=<xsl:value-of select="udt:ValueColumn"/>&amp;<xsl:value-of select="$prefix_param"/>_direction=<xsl:value-of select="$orderDirection"/>{SEARCHING4}
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <!--flipped order direction-->
+ <xsl:value-of select ="$header"/>
+ <xsl:if test="udt:ValueColumn=$param_orderby">
+ <img src="{//udt:Context/udt:ApplicationPath}/images/sort{$orderDirection}.gif" border="0" />
+ </xsl:if>
+ </a>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:param name="param_page" select="1" />
+<xsl:variable name="paging" select="//udt:Context/udt:Paging" />
+
+
+
+ <xsl:variable name="from">
+ <xsl:choose>
+ <xsl:when test="$paging">
+ <xsl:value-of select="$paging * number($param_page) - $paging" />
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+<xsl:variable name="to">
+ <xsl:choose>
+ <xsl:when test="$paging">
+ <xsl:value-of select="$paging * number($param_page) +1" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count($currentData)+1" />
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+
+
+ <xsl:with-param name ="from" select ="$from"/>
+<xsl:with-param name ="to" select ="$to"/>
+
+
+
+ <xsl:if test="$paging">
+<xsl:call-template name="renderPaging">
+<xsl:with-param name="maxPages" select="ceiling(count($currentData) div $paging)" />
+</xsl:call-template>
+</xsl:if>
+
+
+ <xsl:template name="pagingSinglePages">
+<!--renders paging links-->
+ <xsl:param name="pageNumber" select="1" />
+ <xsl:param name="maxPages" select="ceiling(count(//udt:Data) div $paging)" />
+ <xsl:choose>
+ <xsl:when test="number($param_page)=$pageNumber">
+ <span class="NormalDisabled">[<xsl:value-of select="$pageNumber" />]</span>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="?{$prefix_param}_page={$pageNumber}{SEARCHING4}" class="CommandButton"><xsl:value-of select="$pageNumber" /></a>
+ </xsl:otherwise>
+ </xsl:choose> 
+ <xsl:if test="$pageNumber &lt; $maxPages">
+ <xsl:call-template name="pagingSinglePages">
+ <xsl:with-param name="pageNumber" select="$pageNumber +1" />
+ <xsl:with-param name="maxPages" select="$maxPages"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="renderPaging">
+ <xsl:param name="maxPages" select="ceiling(count(//udt:Data) div $paging)" />
+ <xsl:variable name="previous" select="number($param_page) - 1" />
+ <xsl:variable name="next" select="number($param_page) + 1" />
+ <table class="dnnFormItem" bordercolor="Gray" border="0" style="border-color:Gray;border-width:1px;border-style:Solid;width:100%;">
+ <tr>
+ <td class="Normal" align="Left">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Page"/>&#160;<xsl:value-of select="number($param_page)"/>&#160;<xsl:value-of select ="//udt:Context/udt:LocalizedString_Of"/>&#160;<xsl:value-of select="$maxPages"/>
+ </td>
+ <td class="Normal" align="Right" >
+ <xsl:choose>
+ <xsl:when test="number($param_page)>1">
+ <a href="?{SEARCHING4}" class="CommandButton">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_First"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="NormalDisabled">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_First"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>  
+ <xsl:choose>
+ <xsl:when test="number($param_page)>1">
+ <a href="?{$prefix_param}_page={$previous}{SEARCHING4}" class="CommandButton">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Previous"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="NormalDisabled">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Previous"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>  
+ <xsl:variable name ="startpage">
+ <xsl:choose>
+ <xsl:when test ="number($param_page)&gt;5">
+ <xsl:value-of select="number($param_page) -4"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name ="endpage">
+ <xsl:choose>
+ <xsl:when test="$startpage+9&gt;$maxPages">
+ <xsl:value-of select ="$maxPages"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select ="$startpage +9"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="pagingSinglePages">
+ <xsl:with-param name="pageNumber" select="$startpage"/>
+ <xsl:with-param name="maxPages" select="$endpage"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="number($param_page)&lt;$maxPages">
+ <a href="?{$prefix_param}_page={$next}{SEARCHING4}" class="CommandButton">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Next"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="NormalDisabled">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Next"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>  
+ <xsl:choose>
+ <xsl:when test="number($param_page)&lt;$maxPages">
+ <a href="?{$prefix_param}_page={$maxPages}{SEARCHING4}" class="CommandButton">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Last"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="NormalDisabled">
+ <xsl:value-of select ="//udt:Context/udt:LocalizedString_Last"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>  
+ </td>
+ </tr>
+ </table>
+</xsl:template>
+
+
+
+ <xsl:param name="from" select="1"/>
+ <xsl:param name="to" select="count(*)"/>
+ <xsl:if test="position() &gt; $from and position() &lt; $to">
+
+
+
+ </xsl:if>
+
+
+
+
+ <xsl:param name="param_search" />
+<xsl:param name="param_searchpostback" />
+<xsl:param name="param_ispostback" />
+<xsl:variable name="search">
+<xsl:choose>
+ <xsl:when test="$param_ispostback">
+ <xsl:value-of select="$param_searchpostback" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$param_search" />
+ </xsl:otherwise>
+</xsl:choose>
+</xsl:variable>
+
+
+
+ <xsl:variable name="searchColumns" select="//udt:Fields[udt:Searchable='true']/udt:ValueColumn" />
+<xsl:if test="//udt:Fields[udt:Searchable='true']">
+<xsl:call-template name="SearchForm" />
+</xsl:if>
+
+
+
+ [contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]
+
+
+ <xsl:template name="SearchForm">
+<input type="text" name="{$prefix_param}_searchPostback" value="{$search}" />
+<input type="submit" name="go" value="{//udt:Context/udt:LocalizedString_Search}" />
+<input type="hidden" name="{$prefix_param}_ispostback" value="true" />
+</xsl:template>
+
+
+
+ &amp;{$prefix_param}_search={$search}
+
+
\ No newline at end of file