Skip to content

Commit

Permalink
add functionality to allow the user's created date to be exported to CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
markmcavoy committed Oct 6, 2021
1 parent 36cc1dc commit 10bc50f
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 52 deletions.
6 changes: 6 additions & 0 deletions App_LocalResources/MainControl.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,10 @@
<data name="ExportByRole.Text" xml:space="preserve">
<value>Export By Role</value>
</data>
<data name="ExportCreatedDate.Help" xml:space="preserve">
<value>Export the date when the user account was created</value>
</data>
<data name="ExportCreatedDate.Text" xml:space="preserve">
<value>Export Created Date</value>
</data>
</root>
8 changes: 8 additions & 0 deletions Components/ExportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,21 @@ FOR XML PATH('')) Roles
.Replace("{0}", objExportInfo.ExportByRole.ToString()));
}

if (objExportInfo.ExportCreatedDate)
{
sbSelect.Append(", u.CreatedOnDate");
htFieldNames["CreatedOnDate"] = 1;
}

idr = DotNetNuke.Data.DataProvider.Instance().ExecuteSQL(sbSelect.ToString() + sbFrom.ToString() + sbWhere.ToString());
DataTable dt = DotNetNuke.Common.Globals.ConvertDataReaderToDataTable(idr);
if (objExportInfo.ExportPasswords)
{
dt = AddPasswordsColumn(PortalId, dt);
}



string strResult = "";

switch (objExportInfo.ExportFileType)
Expand Down
7 changes: 6 additions & 1 deletion MainControl.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
<dnn:Label runat="server" id="lblIncludeNonAuthorised" resourcekey="IncludeNonAuthorised" AssociatedControlID="cbIncludeNonAuthorised"></dnn:Label>
<asp:CheckBox runat="server" ID="cbIncludeNonAuthorised" CssClass="normalCheckBox" />
</div>
<div class="dnnFormItem">
<dnn:Label runat="server" id="lblExportCreatedDate" resourcekey="ExportCreatedDate" AssociatedControlID="cbExportCreatedDate"></dnn:Label>
<asp:CheckBox runat="server" ID="cbExportCreatedDate" CssClass="normalCheckBox" />
</div>
<div class="dnnFormItem">
<dnn:Label runat="server" id="lblExportRoles" resourcekey="ExportRoles" AssociatedControlID="cbExportRoles"></dnn:Label>
<asp:CheckBox runat="server" ID="cbExportRoles" CssClass="normalCheckBox" />
Expand Down Expand Up @@ -172,7 +176,8 @@
objValues.IncludeDeleted = $("#<%=cbIncludeDeleted.ClientID%>").prop("checked");
objValues.IncludeNonAuthorised = $("#<%=cbIncludeNonAuthorised.ClientID%>").prop("checked");
objValues.ExportRoles = $("#<%=cbExportRoles.ClientID%>").prop("checked");
objValues.ExportPasswords = $("#<%=cbExportPasswords.ClientID%>").prop("checked");
objValues.ExportPasswords = $("#<%=cbExportPasswords.ClientID%>").prop("checked");
objValues.ExportCreatedDate = $("#<%=cbExportCreatedDate.ClientID%>").prop("checked");
objValues.PropertiesToExport = "";
$("#<%=cblPropertiesToExport.ClientID%> input[type='checkbox']:checked").each(
function (ind, val)
Expand Down
Loading

0 comments on commit 10bc50f

Please sign in to comment.