Skip to content

Commit

Permalink
title formatting tweaks and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ninianne98 committed Nov 13, 2021
1 parent 8a854c2 commit 6c449a8
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 95 deletions.
16 changes: 8 additions & 8 deletions CMSAdmin/Assets/Admin/CMS.asmx.cs
Expand Up @@ -86,7 +86,7 @@ public class CMS : System.Web.Services.WebService {
if (value == null) {
ClearSerialized(CMSConfigHelper.keyAdminContent);
} else {
string sXML = String.Empty;
string sXML = string.Empty;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ContentPage));
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, value);
Expand All @@ -101,7 +101,7 @@ public class CMS : System.Web.Services.WebService {
get {
List<Widget> c = null;
string sXML = GetSerialized(CMSConfigHelper.keyAdminWidget);
//since a page may not have any widgets, initalize it and skip deserializing
//since a page may not have any widgets, initialize it and skip deserializing
if (!String.IsNullOrEmpty(sXML)) {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Widget>));
Object genpref = null;
Expand All @@ -118,7 +118,7 @@ public class CMS : System.Web.Services.WebService {
if (value == null) {
ClearSerialized(CMSConfigHelper.keyAdminWidget);
} else {
string sXML = String.Empty;
string sXML = string.Empty;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Widget>));
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, value);
Expand All @@ -136,7 +136,7 @@ public class CMS : System.Web.Services.WebService {
}

private string GetSerialized(string sKey) {
string sData = String.Empty;
string sData = string.Empty;
LoadGuids();

sData = CMSConfigHelper.GetSerialized(CurrentPageGuid, sKey);
Expand Down Expand Up @@ -176,7 +176,7 @@ public class CMS : System.Web.Services.WebService {
return SiteData.AdminFolderPath;
}

private string CurrentEditPage = String.Empty;
private string CurrentEditPage = string.Empty;

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
Expand Down Expand Up @@ -263,7 +263,7 @@ public class CMS : System.Web.Services.WebService {
}

private void GetSetUserEditStateAsEmpty() {
GetSetUserEditState(String.Empty, String.Empty, String.Empty, String.Empty, String.Empty);
GetSetUserEditState(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
}

private void GetSetUserEditState(string ToolbarState, string ToolbarMargin, string ToolbarScroll, string WidgetScroll, string SelTabID) {
Expand Down Expand Up @@ -644,7 +644,7 @@ public class CMS : System.Web.Services.WebService {
sTheFileName = ContentPageHelper.ScrubFilename(CurrentPageGuid, sTestFile);
break;
} else {
sTheFileName = String.Empty;
sTheFileName = string.Empty;
}
}
}
Expand All @@ -658,7 +658,7 @@ public class CMS : System.Web.Services.WebService {
sTheFileName = ContentPageHelper.ScrubFilename(CurrentPageGuid, sTestFile);
break;
} else {
sTheFileName = String.Empty;
sTheFileName = string.Empty;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions CMSAdmin/Global.asax
Expand Up @@ -16,6 +16,14 @@
protected void Application_Start() {
Helper.RegisterCmsComponents();
MvcHandler.DisableMvcResponseHeader = true; //this line is to hide mvc header
}
protected void Application_PreSendRequestHeaders() {
if (HttpContext.Current != null) {
HttpContext.Current.Response.Headers.Remove("Server");
}
}
/*
Expand Down
2 changes: 0 additions & 2 deletions CMSAdmin/Views/CmsAdmin/About.cshtml
Expand Up @@ -53,9 +53,7 @@
Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. <br />
Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0 <br />
https://github.com/ASP-NET-MVC/aspnetwebstack/blob/master/License.txt <br />
https://aspnetwebstack.codeplex.com/license <br />
See also framework source: <br />
https://aspnetwebstack.codeplex.com/ <br />
https://github.com/ASP-NET-MVC/aspnetwebstack <br />
</p>
<p>
Expand Down
4 changes: 2 additions & 2 deletions CMSComponents/SpecialFormModels.cs
Expand Up @@ -107,8 +107,8 @@ public ContactInfo()
emails.Add(ConfigurationManager.AppSettings[this.Settings.DirectEmailKeyName].ToString());
}

string strHTTPHost = String.Empty;
try { strHTTPHost = request.ServerVariables["HTTP_HOST"].ToString().Trim(); } catch { strHTTPHost = String.Empty; }
string strHTTPHost = string.Empty;
try { strHTTPHost = request.ServerVariables["HTTP_HOST"].ToString().Trim(); } catch { strHTTPHost = string.Empty; }

string hostName = strHTTPHost.ToLowerInvariant();

Expand Down
25 changes: 12 additions & 13 deletions CMSComponents/SpecialForms.cs
Expand Up @@ -2,7 +2,6 @@
using Carrotware.Web.UI.Components;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Reflection;
using System.Web;
Expand Down Expand Up @@ -234,7 +233,7 @@ public class AjaxContactForm : IDisposable {

protected HtmlHelper<ContactInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ContactInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -296,7 +295,7 @@ public ContactInfoConfig(string partialName, IValidateHuman validateHuman)

protected void InitStuff() {
this.NotifyEditors = false;
this.DirectEmailKeyName = String.Empty;
this.DirectEmailKeyName = string.Empty;
}

public string DirectEmailKeyName { get; set; }
Expand Down Expand Up @@ -389,7 +388,7 @@ public class AjaxLoginForm : IDisposable {

protected HtmlHelper<LoginInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(LoginInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -526,7 +525,7 @@ public class AjaxLogoutForm : IDisposable {

protected HtmlHelper<LogoutInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(LogoutInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -661,7 +660,7 @@ public class AjaxForgotPasswordForm : IDisposable {

protected HtmlHelper<ForgotPasswordInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ForgotPasswordInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -805,7 +804,7 @@ public class AjaxResetPasswordForm : IDisposable {

protected HtmlHelper<ResetPasswordInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ResetPasswordInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -851,7 +850,7 @@ public ResetPasswordInfoSettings()
public static string CodeUrl {
get {
return HttpContext.Current.Request.QueryString["code"] != null
? HttpContext.Current.Request.QueryString["code"].ToString() : String.Empty;
? HttpContext.Current.Request.QueryString["code"].ToString() : string.Empty;
}
}
}
Expand Down Expand Up @@ -955,7 +954,7 @@ public class AjaxChangePasswordForm : IDisposable {

protected HtmlHelper<ChangePasswordInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ChangePasswordInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -997,7 +996,7 @@ public class ChangePasswordInfoSettings : FormSettingBase {
public static string CodeUrl {
get {
return HttpContext.Current.Request.QueryString["code"] != null
? HttpContext.Current.Request.QueryString["code"].ToString() : String.Empty;
? HttpContext.Current.Request.QueryString["code"].ToString() : string.Empty;
}
}
}
Expand Down Expand Up @@ -1110,7 +1109,7 @@ public class AjaxChangeProfileForm : IDisposable {

protected HtmlHelper<ChangeProfileInfo> InitHelp() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ChangeProfileInfoSettings));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, _settings);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -1172,8 +1171,8 @@ public ChangeProfileInfoConfig(string partialName, IValidateHuman validateHuman)
internal class FormRouteValue {

internal FormRouteValue() {
this.controller = String.Empty;
this.action = String.Empty;
this.controller = string.Empty;
this.action = string.Empty;
this.carrotedit = null;
}

Expand Down
24 changes: 12 additions & 12 deletions CMSCore/ConfigHelper/CMSConfigHelper.cs
Expand Up @@ -107,7 +107,7 @@ private enum CMSConfigFileType {
private static Page _CachedPage;

public static string GetWebResourceUrl(Type type, string resource) {
string sPath = String.Empty;
string sPath = string.Empty;

try {
sPath = CachedPage.ClientScript.GetWebResourceUrl(type, resource);
Expand All @@ -118,7 +118,7 @@ private enum CMSConfigFileType {
}

public static string GetWebResourceUrl(Control X, Type type, string resource) {
string sPath = String.Empty;
string sPath = string.Empty;

if (X != null && X.Page != null) {
sPath = X.Page.ClientScript.GetWebResourceUrl(type, resource);
Expand Down Expand Up @@ -218,7 +218,7 @@ private enum CMSConfigFileType {
if (iExpectedTblCount > 0) {
iTblCount = ds.Tables.Count;

string table1Name = String.Empty;
string table1Name = string.Empty;

List<string> reqCols0 = new List<string>();
List<string> reqCols1 = new List<string>();
Expand Down Expand Up @@ -438,7 +438,7 @@ private enum CMSConfigFileType {

public CMSAdminModuleMenu GetCurrentAdminModuleControl() {
HttpRequest request = HttpContext.Current.Request;
string pf = String.Empty;
string pf = string.Empty;
CMSAdminModuleMenu cc = null;

if (request.QueryString["pf"] != null) {
Expand Down Expand Up @@ -470,7 +470,7 @@ private enum CMSConfigFileType {

public List<CMSAdminModuleMenu> GetCurrentAdminModuleControlList() {
HttpRequest request = HttpContext.Current.Request;
string pf = String.Empty;
string pf = string.Empty;

CMSAdminModule mod = (from m in AdminModules
where m.AreaKey == PluginAreaPath
Expand Down Expand Up @@ -602,7 +602,7 @@ private enum CMSConfigFileType {
select new CMSTextWidgetPicker {
TextWidgetPickerID = p.TextWidgetID,
AssemblyString = p.TextWidgetAssembly,
DisplayName = String.Empty,
DisplayName = string.Empty,
ProcessBody = p.ProcessBody,
ProcessPlainText = p.ProcessPlainText,
ProcessHTMLText = p.ProcessHTMLText,
Expand Down Expand Up @@ -684,7 +684,7 @@ private enum CMSConfigFileType {
var _p2 = (from d in ds.Tables[0].AsEnumerable()
select new CMSTemplate {
TemplatePath = "~/" + (sPathPrefix + d.Field<string>("templatefile").ToLowerInvariant()).ToLowerInvariant(),
EncodedPath = String.Empty,
EncodedPath = string.Empty,
Caption = d.Field<string>("filedesc")
}).ToList();

Expand Down Expand Up @@ -795,7 +795,7 @@ private enum CMSConfigFileType {

_sites = (from d in ds.Tables[0].AsEnumerable()
select new DynamicSite {
DomainName = String.IsNullOrEmpty(d.Field<string>("domname")) ? String.Empty : d.Field<string>("domname").ToLowerInvariant(),
DomainName = String.IsNullOrEmpty(d.Field<string>("domname")) ? string.Empty : d.Field<string>("domname").ToLowerInvariant(),
SiteID = new Guid(d.Field<string>("siteid"))
}).ToList();

Expand Down Expand Up @@ -1069,7 +1069,7 @@ private enum CMSConfigFileType {
ClearSerialized(keyAdminContent);
} else {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ContentPage));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, value);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -1098,7 +1098,7 @@ private enum CMSConfigFileType {
ClearSerialized(keyAdminWidget);
} else {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Widget>));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, value);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -1135,7 +1135,7 @@ private enum CMSConfigFileType {
}

public static string GetSerialized(Guid itemID, string sKey) {
string sData = String.Empty;
string sData = string.Empty;
using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
carrot_SerialCache itm = CompiledQueries.SearchSeriaCache(_db, itemID, sKey);

Expand Down Expand Up @@ -1169,7 +1169,7 @@ private enum CMSConfigFileType {
}

private string GetSerialized(string sKey) {
string sData = String.Empty;
string sData = string.Empty;
LoadGuids();

if (filePage != null) {
Expand Down
12 changes: 6 additions & 6 deletions CMSCore/ImportExport/ContentImportExportUtils.cs
Expand Up @@ -162,11 +162,11 @@ public class ContentImportExportUtils {
cont.NavMenuText = c.PostTitle;
cont.PageHead = c.PostTitle;
cont.PageText = c.PostContent;
cont.LeftPageText = String.Empty;
cont.RightPageText = String.Empty;
cont.LeftPageText = string.Empty;
cont.RightPageText = string.Empty;

cont.MetaDescription = String.Empty;
cont.MetaKeyword = String.Empty;
cont.MetaDescription = string.Empty;
cont.MetaKeyword = string.Empty;

cont.ContentCategories = new List<ContentCategory>();
cont.ContentTags = new List<ContentTag>();
Expand Down Expand Up @@ -236,7 +236,7 @@ public class ContentImportExportUtils {

public static string GetExportXML<T>(T cpe) {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, cpe);
sXML = stringWriter.ToString();
Expand Down Expand Up @@ -322,7 +322,7 @@ public class ContentImportExportUtils {
CMSConfigHelper.ClearSerialized(guidKey, keyPageImport);
} else {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
string sXML = String.Empty;
string sXML = string.Empty;
using (StringWriter stringWriter = new StringWriter()) {
xmlSerializer.Serialize(stringWriter, theData);
sXML = stringWriter.ToString();
Expand Down
22 changes: 0 additions & 22 deletions CMSCore/SiteContent/SiteData.cs
Expand Up @@ -159,28 +159,6 @@ public partial class SiteData : IValidatableObject {
return CurrentSite;
}

public static SiteData InitNewSite(Guid siteID) {
SiteData site = new SiteData();
site.SiteID = siteID;
site.BlockIndex = true;

site.MainURL = "http://" + CMSConfigHelper.DomainName;
site.SiteName = CMSConfigHelper.DomainName;

site.SiteTitlebarPattern = SiteData.DefaultPageTitlePattern;

site.Blog_FolderPath = "archive";
site.Blog_CategoryPath = "category";
site.Blog_TagPath = "tag";
site.Blog_DatePath = "date";
site.Blog_EditorPath = "author";
site.Blog_DatePattern = "yyyy/MM/dd";

site.TimeZoneIdentifier = TimeZoneInfo.Local.Id;

return site;
}

public void Save() {
using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
carrot_Site s = CompiledQueries.cqGetSiteByID(_db, this.SiteID);
Expand Down

0 comments on commit 6c449a8

Please sign in to comment.