Skip to content

Commit

Permalink
Core: Fixes for new MetaContent features
Browse files Browse the repository at this point in the history
PageSettings didn't implement new meta fields "NameProperty" and "ContentProperty"
mysql, sqlite and pgsql database layers didn't have proper value mapping
  • Loading branch information
JosephMDavis committed Sep 29, 2017
1 parent 3bd94e7 commit 677bd30
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -413,3 +413,5 @@ Web/Data/HelpFiles/en-US-webstore-IndexOffersSetting-help\.config
Web/Setup/ProviderConfig/contentdeletehandlers/webstoredeletehandler\.config

Web/Setup/ProviderConfig/worldpayresponsehandlers/webstoreworldpayresponsehandler\.config

Web/Data/sqlitedb/mojo\.db\.config-journal
17 changes: 16 additions & 1 deletion Web/Admin/PageSettings.aspx
Expand Up @@ -492,19 +492,34 @@
<%# Eval("Name") %>
</ItemTemplate>
<EditItemTemplate>
<div class="settingrow">
<mp:SiteLabel ID="lblNameProperty" runat="server" ForControl="txtNameProperty" CssClass="settinglabel"
ConfigKey="MetaNameProperty" ResourceFile="Resource" />
<asp:TextBox ID="txtNameProperty" CssClass="widetextbox forminput" runat="server" Text='<%# Eval("NameProperty") %>' />
<asp:RequiredFieldValidator ID="reqMetaNameProperty" runat="server" ControlToValidate="txtNameProperty"
ErrorMessage='<%# Resources.Resource.MetaNamePropertyRequired %>' ValidationGroup="meta" />
</div>
<div class="settingrow">
<mp:SiteLabel ID="lblName" runat="server" ForControl="txtName" CssClass="settinglabel"
ConfigKey="ContentMetaNameLabel" ResourceFile="Resource" />
<asp:TextBox ID="txtName" CssClass="widetextbox forminput" runat="server" Text='<%# Eval("Name") %>' />
<asp:RequiredFieldValidator ID="reqMetaName" runat="server" ControlToValidate="txtName"
ErrorMessage='<%# Resources.Resource.ContentMetaNameRequired %>' ValidationGroup="meta" />
</div>
<div class="settingrow">
<mp:SiteLabel ID="lblContentProperty" runat="server" ForControl="txtContentProperty" CssClass="settinglabel"
ConfigKey="MetaContentProperty" ResourceFile="Resource" />
<asp:TextBox ID="txtContentProperty" CssClass="verywidetextbox forminput" runat="server"
Text='<%# Eval("ContentProperty") %>' />
<asp:RequiredFieldValidator ID="reqMetaContentProperty" runat="server" ControlToValidate="txtContentProperty"
ErrorMessage='<%# Resources.Resource.MetaContentPropertyRequired %>' ValidationGroup="meta" />
</div>
<div class="settingrow">
<mp:SiteLabel ID="lblMetaContent" runat="server" ForControl="txtMetaContent" CssClass="settinglabel"
ConfigKey="ContentMetaMetaContentLabel" ResourceFile="Resource" />
<asp:TextBox ID="txtMetaContent" CssClass="verywidetextbox forminput" runat="server"
Text='<%# Eval("MetaContent") %>' />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName"
<asp:RequiredFieldValidator ID="reqMetaContent" runat="server" ControlToValidate="txtMetaContent"
ErrorMessage='<%# Resources.Resource.ContentMetaContentRequired %>' ValidationGroup="meta" />
</div>
<div class="settingrow">
Expand Down
24 changes: 16 additions & 8 deletions Web/Admin/PageSettings.aspx.cs
Expand Up @@ -1390,12 +1390,14 @@ void grdContentMeta_RowUpdating(object sender, GridViewUpdateEventArgs e)

Guid guid = new Guid(grid.DataKeys[e.RowIndex].Value.ToString());
TextBox txtName = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtName");
TextBox txtScheme = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtScheme");
TextBox txtNameProperty = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtNameProperty");
TextBox txtScheme = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtScheme");
TextBox txtLangCode = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtLangCode");
DropDownList ddDirection = (DropDownList)grid.Rows[e.RowIndex].Cells[1].FindControl("ddDirection");
TextBox txtMetaContent = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtMetaContent");
TextBox txtContentProperty = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtContentProperty");

ContentMeta meta = null;
ContentMeta meta = null;
if (guid != Guid.Empty)
{
meta = metaRepository.Fetch(guid);
Expand All @@ -1414,8 +1416,10 @@ void grdContentMeta_RowUpdating(object sender, GridViewUpdateEventArgs e)
meta.Dir = ddDirection.SelectedValue;
meta.LangCode = txtLangCode.Text;
meta.MetaContent = txtMetaContent.Text;
meta.Name = txtName.Text;
meta.Scheme = txtScheme.Text;
meta.ContentProperty = txtContentProperty.Text;
meta.Name = txtName.Text;
meta.NameProperty = txtNameProperty.Text;
meta.Scheme = txtScheme.Text;
if (currentUser != null) { meta.LastModBy = currentUser.UserGuid; }
metaRepository.Save(meta);

Expand Down Expand Up @@ -1447,23 +1451,27 @@ void btnAddMeta_Click(object sender, EventArgs e)
dataTable.Columns.Add("ModuleGuid", typeof(Guid));
dataTable.Columns.Add("ContentGuid", typeof(Guid));
dataTable.Columns.Add("Name", typeof(string));
dataTable.Columns.Add("Scheme", typeof(string));
dataTable.Columns.Add("NameProperty", typeof(string));
dataTable.Columns.Add("Scheme", typeof(string));
dataTable.Columns.Add("LangCode", typeof(string));
dataTable.Columns.Add("Dir", typeof(string));
dataTable.Columns.Add("MetaContent", typeof(string));
dataTable.Columns.Add("SortRank", typeof(int));
dataTable.Columns.Add("ContentProperty", typeof(string));
dataTable.Columns.Add("SortRank", typeof(int));

DataRow row = dataTable.NewRow();
row["Guid"] = Guid.Empty;
row["SiteGuid"] = siteSettings.SiteGuid;
row["ModuleGuid"] = Guid.Empty;
row["ContentGuid"] = Guid.Empty;
row["Name"] = string.Empty;
row["Scheme"] = string.Empty;
row["NameProperty"] = string.Empty;
row["Scheme"] = string.Empty;
row["LangCode"] = string.Empty;
row["Dir"] = string.Empty;
row["MetaContent"] = string.Empty;
row["SortRank"] = 3;
row["ContentProperty"] = string.Empty;
row["SortRank"] = 3;

dataTable.Rows.Add(row);

Expand Down
36 changes: 36 additions & 0 deletions Web/App_GlobalResources/Resource.Designer.cs

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

12 changes: 12 additions & 0 deletions Web/App_GlobalResources/Resource.resx
Expand Up @@ -6222,4 +6222,16 @@
<data name="SecurityAdvisorSecurityProtocolDescription" xml:space="preserve">
<value>Information on the Security Protocol used to connect to external sites by your site.</value>
</data>
<data name="MetaContentProperty" xml:space="preserve">
<value>Content Property</value>
</data>
<data name="MetaContentPropertyRequired" xml:space="preserve">
<value>Content Property is Required</value>
</data>
<data name="MetaNameProperty" xml:space="preserve">
<value>Name Property</value>
</data>
<data name="MetaNamePropertyRequired" xml:space="preserve">
<value>Name Property is Required</value>
</data>
</root>
Binary file modified Web/Data/sqlitedb/mojo.db.config
Binary file not shown.
10 changes: 5 additions & 5 deletions mojoPortal.Data.MySql/DBContentMeta.cs
@@ -1,6 +1,6 @@
// Author:
// Created: 2009-12-02
// Last Modified: 2017-09-29
// Last Modified: 2017-09-19
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
Expand Down Expand Up @@ -140,11 +140,11 @@ public static class DBContentMeta

arParams[14] = new MySqlParameter("?NameProperty", MySqlDbType.VarChar, 255);
arParams[14].Direction = ParameterDirection.Input;
arParams[14].Value = nameProperty;
arParams[14].Value = name;

arParams[15] = new MySqlParameter("?ContentProperty", MySqlDbType.VarChar, 255);
arParams[15].Direction = ParameterDirection.Input;
arParams[15].Value = contentProperty;
arParams[15].Value = metaContent;

int rowsAffected = MySqlHelper.ExecuteNonQuery(
ConnectionString.GetWriteConnectionString(),
Expand Down Expand Up @@ -234,11 +234,11 @@ public static class DBContentMeta

arParams[9] = new MySqlParameter("?NameProperty", MySqlDbType.VarChar, 255);
arParams[9].Direction = ParameterDirection.Input;
arParams[9].Value = nameProperty;
arParams[9].Value = name;

arParams[10] = new MySqlParameter("?ContentProperty", MySqlDbType.VarChar, 255);
arParams[10].Direction = ParameterDirection.Input;
arParams[10].Value = contentProperty;
arParams[10].Value = name;

int rowsAffected = MySqlHelper.ExecuteNonQuery(
ConnectionString.GetWriteConnectionString(),
Expand Down
12 changes: 6 additions & 6 deletions mojoPortal.Data.SQLite/DBContentMeta.cs
@@ -1,6 +1,6 @@
// Author:
// Created: 2009-12-02
// Last Modified: 2017-09-29
// Last Modified: 2017-09-19
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
Expand Down Expand Up @@ -158,11 +158,11 @@ private static string GetConnectionString()

arParams[14] = new SqliteParameter(":NameProperty", DbType.String, 255);
arParams[14].Direction = ParameterDirection.Input;
arParams[14].Value = nameProperty;
arParams[14].Value = name;

arParams[15] = new SqliteParameter(":ContentProperty", DbType.String, 255);
arParams[15].Direction = ParameterDirection.Input;
arParams[15].Value = contentProperty;
arParams[15].Value = name;

int rowsAffected = SqliteHelper.ExecuteNonQuery(
GetConnectionString(),
Expand All @@ -186,7 +186,7 @@ private static string GetConnectionString()
string langCode,
string dir,
string metaContent,
string contentProperty,
string contentProerty,
int sortRank,
DateTime lastModUtc,
Guid lastModBy)
Expand Down Expand Up @@ -252,11 +252,11 @@ private static string GetConnectionString()

arParams[9] = new SqliteParameter(":NameProperty", DbType.String, 255);
arParams[9].Direction = ParameterDirection.Input;
arParams[9].Value = nameProperty;
arParams[9].Value = name;

arParams[10] = new SqliteParameter(":ContentProperty", DbType.String, 255);
arParams[10].Direction = ParameterDirection.Input;
arParams[10].Value = contentProperty;
arParams[10].Value = name;

int rowsAffected = SqliteHelper.ExecuteNonQuery(
GetConnectionString(),
Expand Down
12 changes: 6 additions & 6 deletions mojoPortal.Data.pgsql/DBContentMeta.cs
@@ -1,6 +1,6 @@
// Author:
// Created: 2009-12-02
// Last Modified: 2017-09-29
// Last Modified: 2017-09-19
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
Expand Down Expand Up @@ -72,7 +72,7 @@ public static class DBContentMeta
sqlCommand.Append(":langcode, ");
sqlCommand.Append(":dir, ");
sqlCommand.Append(":metacontent, ");
sqlCommand.Append(":contentproperty, ");
sqlCommand.Append(":metacontentproperty, ");
sqlCommand.Append(":sortrank, ");
sqlCommand.Append(":createdutc, ");
sqlCommand.Append(":createdby, ");
Expand Down Expand Up @@ -141,11 +141,11 @@ public static class DBContentMeta

arParams[14] = new NpgsqlParameter("nameproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
arParams[14].Direction = ParameterDirection.Input;
arParams[14].Value = nameProperty;
arParams[14].Value = name;

arParams[15] = new NpgsqlParameter("contentproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
arParams[15].Direction = ParameterDirection.Input;
arParams[15].Value = contentProperty;
arParams[15].Value = name;

int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
ConnectionString.GetWriteConnectionString(),
Expand Down Expand Up @@ -235,11 +235,11 @@ public static class DBContentMeta

arParams[9] = new NpgsqlParameter("nameproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
arParams[9].Direction = ParameterDirection.Input;
arParams[9].Value = nameProperty;
arParams[9].Value = name;

arParams[10] = new NpgsqlParameter("contentproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
arParams[10].Direction = ParameterDirection.Input;
arParams[10].Value = contentProperty;
arParams[10].Value = name;

int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
ConnectionString.GetWriteConnectionString(),
Expand Down

0 comments on commit 677bd30

Please sign in to comment.