Skip to content

Commit

Permalink
update TZ calc
Browse files Browse the repository at this point in the history
update to blank out blog/index page if it is not for the current site or wrong page type
make image relative path
  • Loading branch information
ninianne98 committed Jun 4, 2023
1 parent a68cd2d commit ee033b8
Show file tree
Hide file tree
Showing 44 changed files with 142 additions and 56 deletions.
2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.amethystorchid.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.blueizis.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.classic.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.frenchblue.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.mauve.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.mosaicblue.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.plum.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.quetzalgreen.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.rust.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.sandstone.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSAdmin/c3-admin/editor/advedit.sugaralmond.min.css

Large diffs are not rendered by default.

Binary file removed CMSAdmin/c3-admin/iCheck/customized/grey-alt2@2x.pdn
Binary file not shown.
Binary file removed CMSAdmin/c3-admin/iCheck/customized/grey-alt3@2x.pdn
Binary file not shown.
Binary file removed CMSAdmin/c3-admin/iCheck/customized/grey-alt4@2x.pdn
Binary file not shown.
8 changes: 6 additions & 2 deletions CMSAdmin/c3-admin/ucSiteMap.ascx.cs
Expand Up @@ -87,7 +87,7 @@ orderby c.TemplateFile
}

protected void btnSave_Click(object sender, EventArgs e) {
using (SiteMapOrderHelper orderHelper = new SiteMapOrderHelper()) {
using (var orderHelper = new SiteMapOrderHelper()) {
var lst = orderHelper.CreateSiteMapList(txtMap.Text);
orderHelper.UpdateSiteMap(SiteID, lst);
}
Expand All @@ -96,7 +96,7 @@ orderby c.TemplateFile
}

protected void btnFixOrphan_Click(object sender, EventArgs e) {
using (SiteMapOrderHelper orderHelper = new SiteMapOrderHelper()) {
using (var orderHelper = new SiteMapOrderHelper()) {
orderHelper.FixOrphanPages(SiteID);
}

Expand All @@ -106,6 +106,10 @@ orderby c.TemplateFile
protected void btnFixBlog_Click(object sender, EventArgs e) {
pageHelper.FixBlogNavOrder(SiteID);

using (var orderHelper = new SiteMapOrderHelper()) {
orderHelper.FixOrphanPages(SiteID);
}

Response.Redirect(SiteData.CurrentScriptName);
}
}
Expand Down
4 changes: 3 additions & 1 deletion CMSControls/BaseNavSel.cs
Expand Up @@ -145,7 +145,9 @@ public abstract class BaseNavSel : BaseNavCommon, IWidgetLimitedProperties {
SiteNav parentPageNav = GetParentPage();
List<SiteNav> lstNavTree = GetPageNavTree().OrderByDescending(x => x.NavOrder).ToList();

this.ParentFileName = parentPageNav.FileName.ToLowerInvariant();
if (parentPageNav != null && parentPageNav.FileName != null) {
this.ParentFileName = parentPageNav.FileName.ToLowerInvariant();
}

if (lstNav != null && lstNav.Any()) {
output.WriteLine();
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/_advancededitor.less
Expand Up @@ -214,7 +214,7 @@
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}

.cmsToolbox2 {
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.amethystorchid.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.amethystorchid.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.blueizis.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.blueizis.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.classic.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.classic.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.frenchblue.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.frenchblue.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.mauve.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.mauve.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.mosaicblue.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.mosaicblue.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.plum.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.plum.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.quetzalgreen.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.quetzalgreen.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.rust.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.rust.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.sandstone.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.sandstone.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.sugaralmond.css
Expand Up @@ -3460,7 +3460,7 @@ a#cms-seagreen-id .ui-button:active,
padding: 5px !important;
background-color: #FFFFAA !important;
border: 2px dotted #676767 !important;
background-image: url('/c3-admin/images/dragbg.png') !important;
background-image: url('../images/dragbg.png') !important;
}
.cmsToolbox2 {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion CMSControls/editor/advedit.sugaralmond.min.css

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions CMSCore/CannedQueries.cs
@@ -1,8 +1,12 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System;
using Carrotware.CMS.Data;

using System;
using System.Collections.Generic;
using System.Linq;

/*
* CarrotCake CMS
* http://www.carrotware.com/
Expand Down Expand Up @@ -95,6 +99,12 @@ orderby ct.ContentSnippetName
select r);
}

internal static IQueryable<vw_carrot_Content> GetContentByRoot(CarrotCMSDataContext ctx, Guid rootContentID) {
return (from r in ctx.vw_carrot_Contents
where r.Root_ContentID == rootContentID
select r);
}

internal static IQueryable<vw_carrot_Content> GetContentByStatusAndDateRange(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType,
DateTime dateBegin, DateTime dateEnd, bool? bActive, bool? bSiteMap, bool? bSiteNav, bool? bBlock) {
Guid gContent = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry);
Expand Down
45 changes: 44 additions & 1 deletion CMSCore/SiteContent/SiteData.cs
Expand Up @@ -313,7 +313,47 @@ public partial class SiteData {
}

public DateTime ConvertSiteTimeToUTC(DateTime dateSite) {
DateTime dateSiteSrc = DateTime.SpecifyKind(dateSite, DateTimeKind.Unspecified);
DateTime dateSiteSrc = new DateTime(dateSite.Year, dateSite.Month, dateSite.Day, 12, 1, 0);
var dstCorrected = false;
var springForwardTime = DateTime.MinValue;

// check daylight savings time state in case it flipped from one day to the next
var testDate = TimeZoneInfo.ConvertTime(DateTime.SpecifyKind(new DateTime(dateSite.Year, dateSite.Month, dateSite.Day, 12, 10, 30), DateTimeKind.Unspecified), SiteTimeZoneInfo);
var testDateBefore = testDate.AddDays(-1);
var testDateAfter = testDate.AddDays(1);

// check the days flanking the date/time in question
if (testDateBefore.IsDaylightSavingTime() != testDateAfter.IsDaylightSavingTime()) {
// when moving forward, we skip an hour, which can't be converted
if (testDateAfter.IsDaylightSavingTime()) {
var rules = SiteTimeZoneInfo.GetAdjustmentRules();
//find the rule in effect for the date
var rule = rules.Where(x => x.DateStart <= dateSiteSrc.Date && x.DateEnd > dateSiteSrc.Date).FirstOrDefault();
// check the rule for applicability
if (rule != null) {
var m = rule.DaylightTransitionStart.Month;
var dow = rule.DaylightTransitionStart.DayOfWeek;
var h = rule.DaylightTransitionStart.TimeOfDay.Hour;
var w = rule.DaylightTransitionStart.Week;
var delta = rule.DaylightDelta.TotalHours;

// if it meets the rule, shift forward the interval
if (dateSite.DayOfWeek == dow && dateSite.Month == m
&& dateSite.Day >= ((w - 1) * 7) && dateSite.Day <= ((w + 1) * 7)
&& dateSite.Hour >= h && dateSite.Hour < (h + delta)) {
dstCorrected = true;
// we just skipped an hour, time currently set can't be converted
dateSiteSrc = DateTime.SpecifyKind(dateSite.AddHours(delta), DateTimeKind.Unspecified);
}
}
}
}

if (!dstCorrected) {
// no DST change
dateSiteSrc = DateTime.SpecifyKind(dateSite, DateTimeKind.Unspecified);
}

return TimeZoneInfo.ConvertTimeToUtc(dateSiteSrc, SiteTimeZoneInfo);
}

Expand Down Expand Up @@ -505,10 +545,13 @@ public partial class SiteData {

public enum RSSFeedInclude {
Unknown,

[Description("Blogs and Pages")]
BlogAndPages,

[Description("Blog Only")]
BlogOnly,

[Description("Page Only")]
PageOnly
}
Expand Down
27 changes: 25 additions & 2 deletions CMSCore/SiteContent/SiteMapOrderHelper.cs
@@ -1,8 +1,12 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System;
using Carrotware.CMS.Data;

using System;
using System.Collections.Generic;
using System.Linq;

/*
* CarrotCake CMS
* http://www.carrotware.com/
Expand Down Expand Up @@ -81,7 +85,26 @@ public class SiteMapOrderHelper : IDisposable {
return lstContent;
}

public void FixBlogIndex(Guid siteID) {
SiteData site = SiteData.GetSiteFromCache(siteID);

if (site.Blog_Root_ContentID.HasValue) {
// because sometimes the db is manually manipulated, provides way of re-setting blog/index page by validating page is part of the site
var blogIndexPage = CannedQueries.GetContentByRoot(db, site.Blog_Root_ContentID.Value).FirstOrDefault();
Guid contentTypeID = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry);
if (blogIndexPage != null) {
// found blog, but not in this site or is not a page
if (blogIndexPage.SiteID != site.SiteID || blogIndexPage.ContentTypeID != contentTypeID) {
site.Blog_Root_ContentID = null;
site.Save();
}
}
}
}

public void FixOrphanPages(Guid siteID) {
FixBlogIndex(siteID);

List<SiteMapOrder> lstContent = CannedQueries.GetAllContentList(db, siteID).Select(ct => new SiteMapOrder(ct)).ToList();
List<Guid> lstIDs = lstContent.Select(x => x.Root_ContentID).ToList();

Expand Down
8 changes: 5 additions & 3 deletions CMSCore/SiteContent/SiteNavHelperReal.cs
Expand Up @@ -144,10 +144,12 @@ public class SiteNavHelperReal : IDisposable, ISiteNavHelper {
}

SiteNav home = FindHome(siteID, false);
home.NavOrder = 0;
if (home != null) {
home.NavOrder = 0;

if (lstContent.Where(x => x.Root_ContentID == home.Root_ContentID).Count() < 1) {
lstContent.Add(home);
if (lstContent.Where(x => x.Root_ContentID == home.Root_ContentID).Count() < 1) {
lstContent.Add(home);
}
}

return lstContent.OrderBy(x => x.NavOrder).Where(x => x.PageActive == true && x.IsRetired == false && x.IsUnReleased == false || bActiveOnly == false).ToList();
Expand Down
24 changes: 13 additions & 11 deletions README.md
Expand Up @@ -8,35 +8,36 @@ Source code for CarrotCakeCMS
[DOC_PDF]: http://www.carrotware.com/fileassets/CarrotCakeCMSDevNotes.pdf?from=github
[DOC]: http://www.carrotware.com/carrotcake-download?from=github "CarrotCakeCMS User Documentation"
[TMPLT]: http://www.carrotware.com/carrotcake-templates?from=github
[IDE2013]: https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
[IDE]: https://visualstudio.microsoft.com/
[VWDISO2013]: https://go.microsoft.com/fwlink/?LinkId=532501&type=ISO&clcid=0x409
[CEISO2013]: https://go.microsoft.com/fwlink/?LinkId=532496&type=ISO&clcid=0x409
[IDEALT]: https://www.visualstudio.com/downloads/download-visual-studio-vs
[SQL]: https://www.microsoft.com/en-us/download/details.aspx?id=22973
[SQL]: https://www.microsoft.com/en-us/sql-server/sql-server-downloads
[SSMS]: https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

Welcome to the GitHub project for CarrotCake CMS, an open source c# project. CarrotCake is a [template-based][TMPLT] ASP.Net CMS (content management system) built with C#, SQL server, jQueryUI, and TinyMCE. This content management system supports multi-tenant webroots with shared databases and works well in medium trust.

## If you have found this tool useful please [contact us][SITE_CT].

Source code and [documentation][DOC_PDF] is available on [GitHub][REPO_GH] and [SourceForge][REPO_SF].
Source code and [documentation][DOC_PDF] is available on [GitHub][REPO_GH] and [SourceForge][REPO_SF]. Documentation and assemblies can be found [here][DOC].

Some features include: blogging engine, configurable date based blog post URLs, blog post content association with categories and tags, assignment/customization of category and tag URL patterns, simple content feedback collection and review, blog post pagination/indexes (with templating support), designation of default listing blog page (required to make search, category links, or tag links function), URL date formatting patterns, RSS feed support for posts and pages, import and export of site content, and import of content from WordPress XML export files.

Other features also include date based release and retirement of content - allowing you to queue up content to appear or disappear from your site on a pre-arranged schedule, site timezone designation, ability to rename the administration folder, and site search. Supports the use of master pages to provide re-use when designing site templates.
Other features also include date based release and retirement of content - allowing you to queue up content to appear or disappear from your site on a pre-arranged schedule, site time-zone designation, ability to rename the administration folder, and site search. Supports the use of master pages to provide re-use when designing site templates.

---

## CarrotCakeCMS Developer Quick Start Guide

Copyright (c) 2011 Samantha Copeland
Copyright (c) 2011, 2023 Samantha Copeland
Licensed under the MIT or GPL v3 License

CarrotCakeCMS is maintained by Samantha Copeland

### Install Development Tools

1. **[Visual Studio Express 2013][IDE2013]** Professional (or higher) editions OK. [Later][IDEALT] versions mostly OK (make sure to target the 3.5 framework). The database project may not load with other than the expected version, but that's OK because it's just there to maintain a schema history, it is not part of any build event.
1. **[SQL Server Express 2008 (or higher/later)][SQL]**
1. **[Visual Studio Community/Express/Pro/Enterprise][IDE]** ([ISO VWD 2013][VWDISO2013] and [ISO CE 2013][CEISO2013]) Professional (or higher) editions OK (make sure to target the 3.5 framework). Typically being developed on VS 2015 Enterprise or VS 2019 Express. Even VS 2012 is OK, the database project won't load, but that's OK because it's just there to maintain a schema history, it is a required of part of the build
1. **[SQL Server Express 2008 (or higher/later)][SQL]** - currently vetted on 2008, 2012R2, and 2016 Express.
1. **[SQL Server Management Studio (SSMS)][SSMS]** - required for managing the database

### Get the Source Code

Expand All @@ -46,13 +47,14 @@ CarrotCakeCMS is maintained by Samantha Copeland

### Open the Project

1. Start **Visual Studio 2013**
1. Start **Visual Studio**

1. Open **CarrotwareCMS.sln** solution in the root of the repository

Note: If your file extensions are hidden, you will not see the ".sln"
Other SLN files are demo widgets for how to wire in custom code/extensions

1. Edit **Web.config** under **CMSAdmin** root directory (this coresponds to the **CMSAdmin** project)
1. Edit **Web.config** under **CMSAdmin** root directory (this corresponds to the **CMSAdmin** project)

- In the connectionStrings section, configure the CarrotwareCMSConnectionString value to point to your server and the name of your database.
Note: the credentials require database owner/dbo level as it will create the database artifacts for you.
Expand All @@ -64,7 +66,7 @@ CarrotCakeCMS is maintained by Samantha Copeland

There may be some warnings, you can ignore them

1. The SQL Server database should be running and an empty database matching the one specified in the connection string. If you are running the code a second or later time, it will auto update if there are schema changes.
1. The SQL Server database should be running and an empty database matching the one specified in the connection string. If you are running the code a second or later time, it will auto update if there are schema changes (see dbo note above).

1. if the database is empty or has pending database changes, you will be greeted with a maintenance screen, follow the link provided.

Expand Down

0 comments on commit ee033b8

Please sign in to comment.