Skip to content

[WIP] Added Ability to Customize CSS Styles for <table> HTML Elements #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BusinessObjects/Models/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public string CommentNotifyRoles
/// <value>The comment notify users.</value>
public bool? CommentNotifyUsers { get; set; }

/// <summary>
/// Gets or sets the Table Styles.
/// </summary>
/// <value>The custom css classes to apply to any Table that is generated by the module.</value>
public string TableStyles { get; set; }

#endregion "Properties"
}
}
1 change: 1 addition & 0 deletions DotNetNuke.Wiki.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
<ItemGroup>
<None Include="packages.config" />
<Content Include="web.config" />
<Content Include="Resources\SqlDataProvider\05.00.07.SqlDataProvider" />
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
Expand Down
Binary file added Resources/SqlDataProvider/05.00.07.SqlDataProvider
Binary file not shown.
7 changes: 6 additions & 1 deletion Resources/Wiki.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DotNetNuke.Wiki" type="Module" version="05.00.01">
<package name="DotNetNuke.Wiki" type="Module" version="05.00.07">
<friendlyName>Wiki</friendlyName>
<description>The DotNetNuke Wiki module, more information available at www.dnnsoftware.com</description>
<owner>
Expand Down Expand Up @@ -68,6 +68,11 @@
<name>04.05.03.SqlDataProvider</name>
<version>04.05.03</version>
</script>
<script type="Install">
<path>Resources\SqlDataProvider</path>
<name>05.00.07.SqlDataProvider</name>
<version>05.00.07</version>
</script>
<script type="UnInstall">
<path>Resources\SqlDataProvider</path>
<name>Uninstall.SqlDataProvider</name>
Expand Down
25 changes: 23 additions & 2 deletions Utilities/WikiModuleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,18 @@ protected IEnumerable<Topic> Search(string searchString)
/// <returns>html for the topics</returns>
protected string CreateTable(List<Topic> topicCollection)
{
System.Text.StringBuilder tableHTML = new System.Text.StringBuilder("<table><tr><th>");
System.Text.StringBuilder tableHTML = new System.Text.StringBuilder();

if (string.IsNullOrEmpty(WikiSettings.TableStyles))
{
tableHTML.Append("<table>");
}
else
{
tableHTML.Append($"<table class=\"{WikiSettings.TableStyles}\">");
}

tableHTML.Append("<tr><th>");
tableHTML.Append(Localization.GetString("BaseCreateTableTopic", this.RouterResourceFile));
tableHTML.Append("</th><th>");
tableHTML.Append(Localization.GetString("BaseCreateTableModBy", this.RouterResourceFile));
Expand Down Expand Up @@ -638,7 +649,17 @@ protected string CreateSearchTable(string searchString)
protected string CreateHistoryTable()
{
System.Text.StringBuilder tableText = new System.Text.StringBuilder(1000);
tableText.Append("<table><tr><th>");

if (string.IsNullOrEmpty(WikiSettings.TableStyles))
{
tableText.Append("<table>");
}
else
{
tableText.Append($"<table class=\"{WikiSettings.TableStyles}\">");
}

tableText.Append("<tr><th>");
tableText.Append(Localization.GetString("BaseCreateTableTopic", this.RouterResourceFile));
tableText.Append("</th><th>");
tableText.Append(Localization.GetString("BaseCreateTableTitle", this.RouterResourceFile));
Expand Down
11 changes: 11 additions & 0 deletions Views/Administration.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@
<asp:CheckBox ID="DefaultRatingMode" runat="server" Enabled="false" />
</div>
</fieldset>
<h2 id="dnnSitePanel-CssSettings" class="dnnFormSectionHead">
<a href="" class="dnnSectionExpanded">
<%=LocalizeString("CssSettings")%>
</a>
</h2>
<fieldset>
<div class="dnnFormItem">
<dnn:Label ID="lblTableStyles" runat="server" />
<asp:TextBox ID="TableStyles" AutoPostBack="true" runat="server" />
</div>
</fieldset>
</div>
<br />
<asp:LinkButton ID="SaveButton" resourcekey="SaveButton" OnClick="SaveButton_Click" runat="server" CssClass="dnnPrimaryAction" />
Expand Down
2 changes: 2 additions & 0 deletions Views/Administration.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private void CtrlPage_Load(object sender, System.EventArgs e)
this.DefaultCommentsMode.Checked = this.mSettingsModel.DefaultDiscussionMode == true;
this.DefaultRatingMode.Checked = this.mSettingsModel.DefaultRatingMode == true;
this.NotifyMethodUserComments.Checked = this.mSettingsModel.CommentNotifyUsers == true;
this.TableStyles.Text = this.mSettingsModel.TableStyles;

this.NotifyMethodCustomRoles.Checked =
!(!string.IsNullOrWhiteSpace(this.mSettingsModel.CommentNotifyRoles) &&
Expand Down Expand Up @@ -512,6 +513,7 @@ private void SaveSettings()
this.mSettingsModel.DefaultDiscussionMode = this.DefaultCommentsMode.Checked;
this.mSettingsModel.DefaultRatingMode = this.DefaultRatingMode.Checked;
this.mSettingsModel.CommentNotifyUsers = this.NotifyMethodUserComments.Checked;
this.mSettingsModel.TableStyles = this.TableStyles.Text;

if (this.mSettingsModel.ModuleId == -1)
{
Expand Down
18 changes: 18 additions & 0 deletions Views/Administration.ascx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Views/App_LocalResources/Administration.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,13 @@
<data name="WikiSecurity.Text" xml:space="preserve">
<value>Wiki Editor Roles</value>
</data>
<data name="CssSettings.Text" xml:space="preserve">
<value>CSS Settings</value>
</data>
<data name="lblTableStyles.Help" xml:space="preserve">
<value>The custom CSS classes to be injected into each &amp;lt;table&amp;gt; HTML element</value>
</data>
<data name="lblTableStyles.Text" xml:space="preserve">
<value>Table Styles (CSS class)</value>
</data>
</root>