Skip to content

Commit

Permalink
Merge pull request #45 from SCullman/dnn651
Browse files Browse the repository at this point in the history
Fnl651, fixes #40, #44 and #46
  • Loading branch information
SCullman authored Oct 3, 2018
2 parents 2458f25 + 71721c3 commit c254a70
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 248 deletions.
12 changes: 6 additions & 6 deletions App_LocalResources/form.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
<value>Edit Record</value>
</data>
<data name="ModuleHelp.Text" xml:space="preserve">
<value>&lt;h1&gt;About Form and List Module - Edit Records&lt;/h1&gt;
&lt;p&gt;The Form and List module allows you to define an individual table of data. On this page you can add or edit&amp;#160;records&amp;#160;that contain columns that have been previously defined by a site or page&amp;#160;Administrator in &lt;strong&gt;Form and List Configuration&lt;/strong&gt;.&amp;#160;&lt;/p&gt;
&lt;p&gt;Depending on the&amp;#160;column type definition, you can enter a value&amp;#160;in a field or&amp;#160;select a value from a dropdown list. Some&amp;#160;columns&amp;#160;have special&amp;#160;entry functions, for example, with &lt;strong&gt;Date&lt;/strong&gt; columns,&amp;#160;you can select a date from a&amp;#160;popup calendar. To enter a&amp;#160;&lt;strong&gt;Link &lt;/strong&gt;you can choose between an external URL, a link to a page or&amp;#160;a link to a file stored on this site. When you choose &lt;strong&gt;File&lt;/strong&gt;&amp;#160;to&amp;#160;link to a local file, you may choose to upload a file to the site.&lt;/p&gt;
<value>&lt;h1&gt;About Form and List Module - Edit Records&lt;/h1&gt;
&lt;p&gt;The Form and List module allows you to define an individual table of data. On this page you can add or edit&amp;#160;records&amp;#160;that contain columns that have been previously defined by a site or page&amp;#160;Administrator in &lt;strong&gt;Form and List Configuration&lt;/strong&gt;.&amp;#160;&lt;/p&gt;
&lt;p&gt;Depending on the&amp;#160;column type definition, you can enter a value&amp;#160;in a field or&amp;#160;select a value from a dropdown list. Some&amp;#160;columns&amp;#160;have special&amp;#160;entry functions, for example, with &lt;strong&gt;Date&lt;/strong&gt; columns,&amp;#160;you can select a date from a&amp;#160;popup calendar. To enter a&amp;#160;&lt;strong&gt;Link &lt;/strong&gt;you can choose between an external URL, a link to a page or&amp;#160;a link to a file stored on this site. When you choose &lt;strong&gt;File&lt;/strong&gt;&amp;#160;to&amp;#160;link to a local file, you may choose to upload a file to the site.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Update&lt;/strong&gt; to save your changes, or click&amp;#160;&lt;strong&gt;Cancel&lt;/strong&gt; to undo the changes you have made. If the site Administrator has granted permissions, you may&amp;#160;&lt;strong&gt;D&lt;/strong&gt;&lt;strong&gt;elete&lt;/strong&gt;&amp;#160;the current record. If you are adding or editing&amp;#160;records and&amp;#160;you are not&amp;#160;logged into the site, you might need to verify your changes by entering a CAPTCHA&amp;#160;security code.&lt;/p&gt;</value>
</data>
<data name="ContentOptions.Action" xml:space="preserve">
Expand All @@ -148,13 +148,13 @@
<value>Cancel</value>
</data>
<data name="DayNames.Text" xml:space="preserve">
<value>'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'</value>
<value>'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'</value>
</data>
<data name="DayNamesMin.Text" xml:space="preserve">
<value>'Mo','Tu','We','Th','Fr','Sa','Su'</value>
<value>'Su',''Mo','Tu','We','Th','Fr','Sa'</value>
</data>
<data name="FirstDay.Text" xml:space="preserve">
<value>6</value>
<value>0</value>
</data>
<data name="MonthNames.Text" xml:space="preserve">
<value>'January','Februrary','March','April','May','June','July','August','September','October','November','December'</value>
Expand Down
4 changes: 2 additions & 2 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: ComVisible(false)]


[assembly: AssemblyVersion("06.05.00.00")]
[assembly: AssemblyVersion("06.05.01.00")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyFileVersion("06.05.00.00")]
[assembly: AssemblyFileVersion("06.05.01.00")]

2 changes: 1 addition & 1 deletion Components/EditControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public EditControl Add(string fieldTitle, string fieldType, int fieldId, string
var editor = DataType.ByName(fieldType).EditControl;

var tr = new TokenReplace {ModuleInfo = _moduleContext.Configuration};
var strDefaultValue = tr.ReplaceEnvironmentTokens(defaultValue);
var strDefaultValue = System.Web.HttpUtility.HtmlDecode(tr.ReplaceEnvironmentTokens(defaultValue));

var listInputType = EditControl.InputType.DropdownList;
if (inputSettings.EndsWith(Definition.verticalRadioButtonEnabledToken))
Expand Down
2 changes: 1 addition & 1 deletion Components/UserDefinedTableController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public DataTable Context(ModuleInfo moduleInfo, UserInfo userInfo, string search
row["LocalizedString_Previous"] = Localization.GetString("PagingPrevious.Text", Definition.SharedRessources);
row["LocalizedString_Next"] = Localization.GetString("PagingNext.Text", Definition.SharedRessources);
row["LocalizedString_Last"] = Localization.GetString("PagingLast.Text", Definition.SharedRessources);
var d = DateUtils.GetDatabaseUtcTime();
var d = DateUtils.GetDatabaseTime();
var timeZone = userInfo.Username != null
? userInfo.Profile.PreferredTimeZone
: portalSettings.TimeZone;
Expand Down
2 changes: 1 addition & 1 deletion DataTypes/ChangedAt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class EditChangedAt : EditCreatedAt
{
public override string Value
{
get { return Common.Utilities.DateUtils.GetDatabaseUtcTime().ToString("s"); }
get { return Common.Utilities.DateUtils.GetDatabaseTime().ToString("s"); }

set { base.Value = value; }
}
Expand Down
2 changes: 1 addition & 1 deletion DataTypes/CreatedAt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override string Value
{
if (ViewState[TimeStamp] == null)
{
return Common.Utilities.DateUtils.GetDatabaseUtcTime().ToString("s");
return Common.Utilities.DateUtils.GetDatabaseTime().ToString("s");
}
return DateTime.Parse((string)ViewState[TimeStamp]).ToString("s");
}
Expand Down
252 changes: 126 additions & 126 deletions DataTypes/Date.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Collections;
using System.Data;
using System.Web.UI.WebControls;
using System.Xml;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Modules.UserDefinedTable.Components;
using Microsoft.VisualBasic;
using DotNetNuke.Web.UI.WebControls;

namespace DotNetNuke.Modules.UserDefinedTable.DataTypes
using System;
using System.Collections;
using System.Data;
using System.Web.UI.WebControls;
using System.Xml;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Modules.UserDefinedTable.Components;
using Microsoft.VisualBasic;
using DotNetNuke.Web.UI.WebControls;

namespace DotNetNuke.Modules.UserDefinedTable.DataTypes
{

#region EditControl
Expand Down Expand Up @@ -143,119 +143,119 @@ public EditDate()
}
}

#endregion

#region DataType

/// -----------------------------------------------------------------------------
/// <summary>
/// MetaData and Formating for DataType "Date"
/// </summary>
/// -----------------------------------------------------------------------------
public class DataTypeDate : DataType
{
public override void SetStylesAndFormats(BoundField column, string format)
{
column.DataFormatString = format != "" ? string.Format("{{0:{0}}}", format) : "{0:d}";
column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
}

public override string Name
{
get { return "Date"; }
}

public override string SystemTypeName
{
get { return "DateTime"; }
}

struct FieldSetting
{
public string FormatString;
public string Title;
}


public override void RenderValuesToHtmlInsideDataSet(DataSet ds, int moduleId, bool noScript)
{
var fields = new ArrayList();
//List of columns that contains URLs
foreach (DataRow row in ds.Tables[DataSetTableName.Fields].Rows)
{
if (row[FieldsTableColumn.Type].ToString() == Name)
{
var fieldTitle = row[FieldsTableColumn.Title].ToString();
var fieldSetting = new FieldSetting
{
FormatString =
row[FieldsTableColumn.OutputSettings].AsString("d"),
Title = fieldTitle
};
fields.Add(fieldSetting);
var localizedValueColumnName = fieldTitle + DataTableColumn.Appendix_LocalizedValue;
ds.Tables[DataSetTableName.Data].Columns.Add(localizedValueColumnName, typeof (string));
ds.Tables[DataSetTableName.Data].Columns.Add(fieldTitle + DataTableColumn.Appendix_Ticks,
typeof (long));
row[FieldsTableColumn.ValueColumn] = XmlConvert.EncodeName(localizedValueColumnName);
}
}
foreach (DataRow row in ds.Tables[DataSetTableName.Data].Rows)
{
foreach (FieldSetting field in fields)
{
if (Information.IsDate(row[field.Title]))
{
var d = Convert.ToDateTime(row[field.Title]);
var format = "<!--{0:000000000000}-->{1:" + field.FormatString + "}";
row[field.Title + DataTableColumn.Appendix_LocalizedValue] = string.Format(format, d.Ticks/10000000, d);
row[field.Title + DataTableColumn.Appendix_Ticks] = d.Ticks;
}
}
}
}

public override string SupportedCasts
{
get { return string.Format("{0}|Date|DateTime|Time", base.SupportedCasts); }
}

public override bool SupportsDefaultValue
{
get { return true; }
}

public override bool SupportsEditing
{
get { return true; }
}

public override bool SupportsInputSettings
{
get { return true; }
}

public override bool SupportsEditStyle
{
get { return true; }
}

public override bool SupportsOutputSettings
{
get { return true; }
}

public override bool SupportsValidation
{
get { return true; }
}

public override bool SupportsSearch
{
get { return true; }
}
}

#endregion
#endregion

#region DataType

/// -----------------------------------------------------------------------------
/// <summary>
/// MetaData and Formating for DataType "Date"
/// </summary>
/// -----------------------------------------------------------------------------
public class DataTypeDate : DataType
{
public override void SetStylesAndFormats(BoundField column, string format)
{
column.DataFormatString = format != "" ? string.Format("{{0:{0}}}", format) : "{0:d}";
column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
}

public override string Name
{
get { return "Date"; }
}

public override string SystemTypeName
{
get { return "DateTime"; }
}

struct FieldSetting
{
public string FormatString;
public string Title;
}


public override void RenderValuesToHtmlInsideDataSet(DataSet ds, int moduleId, bool noScript)
{
var fields = new ArrayList();
//List of columns that contains URLs
foreach (DataRow row in ds.Tables[DataSetTableName.Fields].Rows)
{
if (row[FieldsTableColumn.Type].ToString() == Name)
{
var fieldTitle = row[FieldsTableColumn.Title].ToString();
var fieldSetting = new FieldSetting
{
FormatString =
row[FieldsTableColumn.OutputSettings].AsString("d"),
Title = fieldTitle
};
fields.Add(fieldSetting);
var localizedValueColumnName = fieldTitle + DataTableColumn.Appendix_LocalizedValue;
ds.Tables[DataSetTableName.Data].Columns.Add(localizedValueColumnName, typeof (string));
ds.Tables[DataSetTableName.Data].Columns.Add(fieldTitle + DataTableColumn.Appendix_Ticks,
typeof (long));
row[FieldsTableColumn.ValueColumn] = XmlConvert.EncodeName(localizedValueColumnName);
}
}
foreach (DataRow row in ds.Tables[DataSetTableName.Data].Rows)
{
foreach (FieldSetting field in fields)
{
if (Information.IsDate(row[field.Title]))
{
var d = Convert.ToDateTime(row[field.Title]);
var format = "<!--{0:000000000000}-->{1:" + field.FormatString + "}";
row[field.Title + DataTableColumn.Appendix_LocalizedValue] = string.Format(format, d.Ticks/10000000, d);
row[field.Title + DataTableColumn.Appendix_Ticks] = d.Ticks;
}
}
}
}

public override string SupportedCasts
{
get { return string.Format("{0}|Date|DateTime|Time", base.SupportedCasts); }
}

public override bool SupportsDefaultValue
{
get { return true; }
}

public override bool SupportsEditing
{
get { return true; }
}

public override bool SupportsInputSettings
{
get { return true; }
}

public override bool SupportsEditStyle
{
get { return true; }
}

public override bool SupportsOutputSettings
{
get { return true; }
}

public override bool SupportsValidation
{
get { return true; }
}

public override bool SupportsSearch
{
get { return true; }
}
}

#endregion
}
Loading

0 comments on commit c254a70

Please sign in to comment.