From e19f2e37f14c7dc51cec7d31d022b41ba2a54466 Mon Sep 17 00:00:00 2001 From: Wayne Wei Date: Fri, 13 Sep 2024 15:12:15 +0800 Subject: [PATCH 01/28] Update Packages --- test/EasyFrameWork.Test/EasyFrameWork.Test.csproj | 4 ++-- test/ZKEACMS.Test/ZKEACMS.Test.csproj | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/EasyFrameWork.Test/EasyFrameWork.Test.csproj b/test/EasyFrameWork.Test/EasyFrameWork.Test.csproj index 0209285b..3574da31 100644 --- a/test/EasyFrameWork.Test/EasyFrameWork.Test.csproj +++ b/test/EasyFrameWork.Test/EasyFrameWork.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/test/ZKEACMS.Test/ZKEACMS.Test.csproj b/test/ZKEACMS.Test/ZKEACMS.Test.csproj index 271694cb..2b283abb 100644 --- a/test/ZKEACMS.Test/ZKEACMS.Test.csproj +++ b/test/ZKEACMS.Test/ZKEACMS.Test.csproj @@ -8,9 +8,9 @@ - - - + + + From fc17ce055b701a16f0a39250a68e216008a43bcc Mon Sep 17 00:00:00 2001 From: wayne Date: Tue, 17 Sep 2024 21:49:07 +0800 Subject: [PATCH 02/28] 4.1 scripts --- Database/Update/4.1/MsSql.sql | 99 +++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Database/Update/4.1/MsSql.sql diff --git a/Database/Update/4.1/MsSql.sql b/Database/Update/4.1/MsSql.sql new file mode 100644 index 00000000..9aa261e3 --- /dev/null +++ b/Database/Update/4.1/MsSql.sql @@ -0,0 +1,99 @@ +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'ArticleTypeRelation') +BEGIN + CREATE TABLE [dbo].[ArticleTypeRelation]( + [ArticleId] [nvarchar](100) NOT NULL, + [ArticleTypeId] [nvarchar](100) NOT NULL, + CONSTRAINT [PK_ArticleTypeRelation] PRIMARY KEY CLUSTERED + ( + [ArticleId] ASC, + [ArticleTypeId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE [dbo].[ArticleTypeRelation] +GO +INSERT INTO [dbo].[ArticleTypeRelation] (ArticleId, ArticleTypeId) +SELECT DISTINCT ContentID,ArticleTypeID FROM [Article] +GO + +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'WidgetArticleTypeRelation') +BEGIN + CREATE TABLE [dbo].[WidgetArticleTypeRelation]( + [WidgetId] [nvarchar](100) NOT NULL, + [ArticleTypeId] [int] NOT NULL, + CONSTRAINT [PK_WidgetArticleTypeRelation] PRIMARY KEY CLUSTERED + ( + [WidgetId] ASC, + [ArticleTypeId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE dbo.WidgetArticleTypeRelation +GO +INSERT INTO [dbo].[WidgetArticleTypeRelation](WidgetId,ArticleTypeId) +SELECT T0.ID, T1.ID FROM ArticleListWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ArticleTopWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ArticleTypeWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +GO + + +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'ProductCategoryRelation') +BEGIN + CREATE TABLE [dbo].[ProductCategoryRelation]( + [ProductId] [nvarchar](100) NOT NULL, + [ProductCategoryId] [nvarchar](100) NOT NULL, + CONSTRAINT [PK_ProductCategoryRelation] PRIMARY KEY CLUSTERED + ( + [ProductId] ASC, + [ProductCategoryId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE [dbo].[ProductCategoryRelation] +GO +INSERT INTO [dbo].[ProductCategoryRelation] (ProductId, ProductCategoryId) +SELECT DISTINCT ContentID, ProductCategoryID FROM dbo.[Product] +GO + +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'WidgetProductCategoryRelation') +BEGIN + CREATE TABLE [dbo].[WidgetProductCategoryRelation]( + [WidgetId] [nvarchar](100) NOT NULL, + [ProductCategoryId] [int] NOT NULL, + CONSTRAINT [PK_WidgetProductCategoryRelation] PRIMARY KEY CLUSTERED + ( + [WidgetId] ASC, + [ProductCategoryId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE dbo.[WidgetProductCategoryRelation] +GO +INSERT INTO [dbo].[WidgetProductCategoryRelation](WidgetId, ProductCategoryId) +SELECT T0.ID, T1.ID FROM ProductListWidget T0 +INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID =T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0 +INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID +GO \ No newline at end of file From 2b2e5fdbf73007380c1ca7dbab478509641a3bb0 Mon Sep 17 00:00:00 2001 From: wayne Date: Tue, 17 Sep 2024 22:01:09 +0800 Subject: [PATCH 03/28] Video Scripts --- Database/Update/4.1/MsSql.sql | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Database/Update/4.1/MsSql.sql b/Database/Update/4.1/MsSql.sql index 9aa261e3..942f0468 100644 --- a/Database/Update/4.1/MsSql.sql +++ b/Database/Update/4.1/MsSql.sql @@ -96,4 +96,55 @@ INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCateg UNION SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0 INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID +GO + +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'VideoTypeRelation') +BEGIN + CREATE TABLE [dbo].[VideoTypeRelation]( + [VideoId] [nvarchar](100) NOT NULL, + [VideoTypeId] [nvarchar](100) NOT NULL, + CONSTRAINT [PK_VideoTypeRelation] PRIMARY KEY CLUSTERED + ( + [VideoId] ASC, + [VideoTypeId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE [dbo].[VideoTypeRelation] +GO +INSERT INTO [dbo].[VideoTypeRelation] (VideoId, VideoTypeId) +SELECT DISTINCT ContentID,VideoTypeID FROM [Video] +GO + +IF NOT EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = 'WidgetVideoTypeRelation') +BEGIN + CREATE TABLE [dbo].[WidgetVideoTypeRelation]( + [WidgetId] [nvarchar](100) NOT NULL, + [VideoTypeId] [int] NOT NULL, + CONSTRAINT [PK_WidgetVideoTypeRelation] PRIMARY KEY CLUSTERED + ( + [WidgetId] ASC, + [VideoTypeId] ASC + )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] + ) ON [PRIMARY] +END +GO +TRUNCATE TABLE dbo.WidgetVideoTypeRelation +GO +INSERT INTO [dbo].[WidgetVideoTypeRelation](WidgetId,VideoTypeId) +SELECT T0.ID, T1.ID FROM VideoListWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM VideoTopWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM VideoTypeWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID GO \ No newline at end of file From 7c7434f9402bd6ff4bf2b777d81109651e9712e4 Mon Sep 17 00:00:00 2001 From: Wayne Wei Date: Wed, 18 Sep 2024 11:06:20 +0800 Subject: [PATCH 04/28] Update Scripts for mysql and sqlite --- Database/Update/4.1/MsSql.sql | 70 ++++++++++++++-------------- Database/Update/4.1/MySql.sql | 83 ++++++++++++++++++++++++++++++++++ Database/Update/4.1/Sqlite.sql | 83 ++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+), 35 deletions(-) create mode 100644 Database/Update/4.1/MySql.sql create mode 100644 Database/Update/4.1/Sqlite.sql diff --git a/Database/Update/4.1/MsSql.sql b/Database/Update/4.1/MsSql.sql index 942f0468..f14beff7 100644 --- a/Database/Update/4.1/MsSql.sql +++ b/Database/Update/4.1/MsSql.sql @@ -1,4 +1,4 @@ -IF NOT EXISTS (SELECT * +IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'ArticleTypeRelation') @@ -17,18 +17,18 @@ GO TRUNCATE TABLE [dbo].[ArticleTypeRelation] GO INSERT INTO [dbo].[ArticleTypeRelation] (ArticleId, ArticleTypeId) -SELECT DISTINCT ContentID,ArticleTypeID FROM [Article] +SELECT DISTINCT ISNULL(ContentID,ID),ArticleTypeID FROM dbo.[Article] GO IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' - AND TABLE_NAME = 'WidgetArticleTypeRelation') + AND TABLE_NAME = 'CMS_WidgetArticleTypeRelation') BEGIN - CREATE TABLE [dbo].[WidgetArticleTypeRelation]( + CREATE TABLE [dbo].[CMS_WidgetArticleTypeRelation]( [WidgetId] [nvarchar](100) NOT NULL, [ArticleTypeId] [int] NOT NULL, - CONSTRAINT [PK_WidgetArticleTypeRelation] PRIMARY KEY CLUSTERED + CONSTRAINT [PK_CMS_WidgetArticleTypeRelation] PRIMARY KEY CLUSTERED ( [WidgetId] ASC, [ArticleTypeId] ASC @@ -36,17 +36,17 @@ BEGIN ) ON [PRIMARY] END GO -TRUNCATE TABLE dbo.WidgetArticleTypeRelation +TRUNCATE TABLE dbo.CMS_WidgetArticleTypeRelation GO -INSERT INTO [dbo].[WidgetArticleTypeRelation](WidgetId,ArticleTypeId) -SELECT T0.ID, T1.ID FROM ArticleListWidget T0 -INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID +INSERT INTO [dbo].[CMS_WidgetArticleTypeRelation](WidgetId,ArticleTypeId) +SELECT T0.ID, T1.ID FROM dbo.ArticleListWidget T0 +INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID UNION -SELECT T0.ID, T1.ID FROM ArticleTopWidget T0 -INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID +SELECT T0.ID, T1.ID FROM dbo.ArticleTopWidget T0 +INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID UNION -SELECT T0.ID, T1.ID FROM ArticleTypeWidget T0 -INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +SELECT T0.ID, T1.ID FROM dbo.ArticleTypeWidget T0 +INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID GO @@ -69,18 +69,18 @@ GO TRUNCATE TABLE [dbo].[ProductCategoryRelation] GO INSERT INTO [dbo].[ProductCategoryRelation] (ProductId, ProductCategoryId) -SELECT DISTINCT ContentID, ProductCategoryID FROM dbo.[Product] +SELECT DISTINCT ISNULL(ContentID,ID), ProductCategoryID FROM dbo.[Product] GO IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' - AND TABLE_NAME = 'WidgetProductCategoryRelation') + AND TABLE_NAME = 'CMS_WidgetProductCategoryRelation') BEGIN - CREATE TABLE [dbo].[WidgetProductCategoryRelation]( + CREATE TABLE [dbo].[CMS_WidgetProductCategoryRelation]( [WidgetId] [nvarchar](100) NOT NULL, [ProductCategoryId] [int] NOT NULL, - CONSTRAINT [PK_WidgetProductCategoryRelation] PRIMARY KEY CLUSTERED + CONSTRAINT [PK_CMS_WidgetProductCategoryRelation] PRIMARY KEY CLUSTERED ( [WidgetId] ASC, [ProductCategoryId] ASC @@ -88,14 +88,14 @@ BEGIN ) ON [PRIMARY] END GO -TRUNCATE TABLE dbo.[WidgetProductCategoryRelation] +TRUNCATE TABLE dbo.[CMS_WidgetProductCategoryRelation] GO -INSERT INTO [dbo].[WidgetProductCategoryRelation](WidgetId, ProductCategoryId) -SELECT T0.ID, T1.ID FROM ProductListWidget T0 -INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID =T1.ParentID +INSERT INTO [dbo].[CMS_WidgetProductCategoryRelation](WidgetId, ProductCategoryId) +SELECT T0.ID, T1.ID FROM dbo.ProductListWidget T0 +INNER JOIN dbo.ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID =T1.ParentID UNION -SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0 -INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID +SELECT T0.ID, T1.ID FROM dbo.ProductCategoryWidget T0 +INNER JOIN dbo.ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID GO IF NOT EXISTS (SELECT * @@ -117,18 +117,18 @@ GO TRUNCATE TABLE [dbo].[VideoTypeRelation] GO INSERT INTO [dbo].[VideoTypeRelation] (VideoId, VideoTypeId) -SELECT DISTINCT ContentID,VideoTypeID FROM [Video] +SELECT DISTINCT ISNULL(ContentID,ID),VideoTypeID FROM dbo.[Video] GO IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' - AND TABLE_NAME = 'WidgetVideoTypeRelation') + AND TABLE_NAME = 'CMS_WidgetVideoTypeRelation') BEGIN - CREATE TABLE [dbo].[WidgetVideoTypeRelation]( + CREATE TABLE [dbo].[CMS_WidgetVideoTypeRelation]( [WidgetId] [nvarchar](100) NOT NULL, [VideoTypeId] [int] NOT NULL, - CONSTRAINT [PK_WidgetVideoTypeRelation] PRIMARY KEY CLUSTERED + CONSTRAINT [PK_CMS_WidgetVideoTypeRelation] PRIMARY KEY CLUSTERED ( [WidgetId] ASC, [VideoTypeId] ASC @@ -136,15 +136,15 @@ BEGIN ) ON [PRIMARY] END GO -TRUNCATE TABLE dbo.WidgetVideoTypeRelation +TRUNCATE TABLE dbo.CMS_WidgetVideoTypeRelation GO -INSERT INTO [dbo].[WidgetVideoTypeRelation](WidgetId,VideoTypeId) -SELECT T0.ID, T1.ID FROM VideoListWidget T0 -INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID +INSERT INTO [dbo].[CMS_WidgetVideoTypeRelation](WidgetId,VideoTypeId) +SELECT T0.ID, T1.ID FROM dbo.VideoListWidget T0 +INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID UNION -SELECT T0.ID, T1.ID FROM VideoTopWidget T0 -INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID +SELECT T0.ID, T1.ID FROM dbo.VideoTopWidget T0 +INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID UNION -SELECT T0.ID, T1.ID FROM VideoTypeWidget T0 -INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID +SELECT T0.ID, T1.ID FROM dbo.VideoTypeWidget T0 +INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID GO \ No newline at end of file diff --git a/Database/Update/4.1/MySql.sql b/Database/Update/4.1/MySql.sql new file mode 100644 index 00000000..cedadf8e --- /dev/null +++ b/Database/Update/4.1/MySql.sql @@ -0,0 +1,83 @@ +CREATE TABLE IF NOT EXISTS `ArticleTypeRelation` ( + `ArticleId` VARCHAR(100) NOT NULL, + `ArticleTypeId` VARCHAR(100) NOT NULL, + PRIMARY KEY (`ArticleId`, `ArticleTypeId`) +); + +TRUNCATE TABLE `ArticleTypeRelation`; + +INSERT INTO `ArticleTypeRelation` (ArticleId, ArticleTypeId) +SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM `Article`; + +CREATE TABLE IF NOT EXISTS `CMS_WidgetArticleTypeRelation` ( + `WidgetId` VARCHAR(100) NOT NULL, + `ArticleTypeId` INT NOT NULL, + PRIMARY KEY (`WidgetId`, `ArticleTypeId`) +); + +TRUNCATE TABLE `CMS_WidgetArticleTypeRelation`; + +INSERT INTO `CMS_WidgetArticleTypeRelation` (WidgetId, ArticleTypeId) +SELECT T0.ID, T1.ID FROM `ArticleListWidget` T0 +INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM `ArticleTopWidget` T0 +INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM `ArticleTypeWidget` T0 +INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID; + +CREATE TABLE IF NOT EXISTS `ProductCategoryRelation` ( + `ProductId` VARCHAR(100) NOT NULL, + `ProductCategoryId` VARCHAR(100) NOT NULL, + PRIMARY KEY (`ProductId`, `ProductCategoryId`) +); + +TRUNCATE TABLE `ProductCategoryRelation`; + +INSERT INTO `ProductCategoryRelation` (ProductId, ProductCategoryId) +SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM `Product`; + +CREATE TABLE IF NOT EXISTS `CMS_WidgetProductCategoryRelation` ( + `WidgetId` VARCHAR(100) NOT NULL, + `ProductCategoryId` INT NOT NULL, + PRIMARY KEY (`WidgetId`, `ProductCategoryId`) +); + +TRUNCATE TABLE `CMS_WidgetProductCategoryRelation`; + +INSERT INTO `CMS_WidgetProductCategoryRelation` (WidgetId, ProductCategoryId) +SELECT T0.ID, T1.ID FROM `ProductListWidget` T0 +INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM `ProductCategoryWidget` T0 +INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID; + +CREATE TABLE IF NOT EXISTS `VideoTypeRelation` ( + `VideoId` VARCHAR(100) NOT NULL, + `VideoTypeId` VARCHAR(100) NOT NULL, + PRIMARY KEY (`VideoId`, `VideoTypeId`) +); + +TRUNCATE TABLE `VideoTypeRelation`; + +INSERT INTO `VideoTypeRelation` (VideoId, VideoTypeId) +SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM `Video`; + +CREATE TABLE IF NOT EXISTS `CMS_WidgetVideoTypeRelation` ( + `WidgetId` VARCHAR(100) NOT NULL, + `VideoTypeId` INT NOT NULL, + PRIMARY KEY (`WidgetId`, `VideoTypeId`) +); + +TRUNCATE TABLE `CMS_WidgetVideoTypeRelation`; + +INSERT INTO `CMS_WidgetVideoTypeRelation` (WidgetId, VideoTypeId) +SELECT T0.ID, T1.ID FROM `VideoListWidget` T0 +INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM `VideoTopWidget` T0 +INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM `VideoTypeWidget` T0 +INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID; \ No newline at end of file diff --git a/Database/Update/4.1/Sqlite.sql b/Database/Update/4.1/Sqlite.sql new file mode 100644 index 00000000..c2c0fea0 --- /dev/null +++ b/Database/Update/4.1/Sqlite.sql @@ -0,0 +1,83 @@ +CREATE TABLE IF NOT EXISTS ArticleTypeRelation ( + ArticleId TEXT NOT NULL, + ArticleTypeId TEXT NOT NULL, + PRIMARY KEY (ArticleId, ArticleTypeId) +); + +DELETE FROM ArticleTypeRelation; + +INSERT INTO ArticleTypeRelation (ArticleId, ArticleTypeId) +SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM Article; + +CREATE TABLE IF NOT EXISTS CMS_WidgetArticleTypeRelation ( + WidgetId TEXT NOT NULL, + ArticleTypeId INTEGER NOT NULL, + PRIMARY KEY (WidgetId, ArticleTypeId) +); + +DELETE FROM CMS_WidgetArticleTypeRelation; + +INSERT INTO CMS_WidgetArticleTypeRelation (WidgetId, ArticleTypeId) +SELECT T0.ID, T1.ID FROM ArticleListWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ArticleTopWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ArticleTypeWidget T0 +INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID; + +CREATE TABLE IF NOT EXISTS ProductCategoryRelation ( + ProductId TEXT NOT NULL, + ProductCategoryId TEXT NOT NULL, + PRIMARY KEY (ProductId, ProductCategoryId) +); + +DELETE FROM ProductCategoryRelation; + +INSERT INTO ProductCategoryRelation (ProductId, ProductCategoryId) +SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM Product; + +CREATE TABLE IF NOT EXISTS CMS_WidgetProductCategoryRelation ( + WidgetId TEXT NOT NULL, + ProductCategoryId INTEGER NOT NULL, + PRIMARY KEY (WidgetId, ProductCategoryId) +); + +DELETE FROM CMS_WidgetProductCategoryRelation; + +INSERT INTO CMS_WidgetProductCategoryRelation (WidgetId, ProductCategoryId) +SELECT T0.ID, T1.ID FROM ProductListWidget T0 +INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0 +INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID; + +CREATE TABLE IF NOT EXISTS VideoTypeRelation ( + VideoId TEXT NOT NULL, + VideoTypeId TEXT NOT NULL, + PRIMARY KEY (VideoId, VideoTypeId) +); + +DELETE FROM VideoTypeRelation; + +INSERT INTO VideoTypeRelation (VideoId, VideoTypeId) +SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM Video; + +CREATE TABLE IF NOT EXISTS CMS_WidgetVideoTypeRelation ( + WidgetId TEXT NOT NULL, + VideoTypeId INTEGER NOT NULL, + PRIMARY KEY (WidgetId, VideoTypeId) +); + +DELETE FROM CMS_WidgetVideoTypeRelation; + +INSERT INTO CMS_WidgetVideoTypeRelation (WidgetId, VideoTypeId) +SELECT T0.ID, T1.ID FROM VideoListWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM VideoTopWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID +UNION +SELECT T0.ID, T1.ID FROM VideoTypeWidget T0 +INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID; \ No newline at end of file From e7269e1571b891ef7f14acbf2a5b2b40f2ee2d72 Mon Sep 17 00:00:00 2001 From: Wayne Wei Date: Wed, 18 Sep 2024 11:17:45 +0800 Subject: [PATCH 05/28] 4.1 --- Database/Update/4.1/package.zip | Bin 0 -> 2178 bytes Database/index.json | 4 ++++ src/ZKEACMS/ZKEACMS.csproj | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Database/Update/4.1/package.zip diff --git a/Database/Update/4.1/package.zip b/Database/Update/4.1/package.zip new file mode 100644 index 0000000000000000000000000000000000000000..eed4cb7ec11600dc1a2601728c582b563a2ee4f0 GIT binary patch literal 2178 zcmai#cTf}97REy$Ku8n~Es7M8Ak7dIkVsvEASHmnB2q;K4H6PSiVrCgfly)rRGPF% z39=x)1yn3_LlqDtvJ@dfg0u*z`{Enld%W4*dFRgDnS1{DX3pH-_Z>ScegSa+03Zyo zaz1*NQduMm=LZ06qyPXguZs^GfQHC@l|PzJk>?2?C72_*WF zb^2LTDt9y(e4;s${i<%cqFXIj^bgiB^^T#q8t~AcS z5^&JV3DYrSshT*$2yG0vYy+cKQTGJKVxQhPO3L{DrctC;_1O@M zt5n8JouK+qt*kzQCDN_zHofDMpLbO2-n3sC3hHN!B?g%eiz@uiKGs8&0kO%>nDe{h z#^u!_KC&9VYRT9<4J~!ll$o+U)7>u5GR_3ja}8-ZH9ibqnO@PrB3(Kp+2wW_BPr==jtM19K5s@IiBeu64vi z!nx58hbJ}t8h~*L`7S~a_%_f`5Iv09>^telMabp?H|ECsGQ(gcaP3?{-;S83&3?{h z#rcjh>TZ`?f)X0|c2c>xRbTD{FBUS(&70)q#Zfyo)C>>3?%Nmr!U6N@$|Ur0Vj!lB z-Mr39Osxl34>jAi3|#j-LVD8Mc9*~Fp5i?@4aJ1B55DR1)xFbznL6o-bjEuk>oiKo zJX#Ocn<*r*O;)Jy%{+`nkSvGE(`-DJBC=+r^I3rDElOadh;zX>*waqS-(CDafQlw< z#N4Yt>1i5FoD3pdyP#@Xct7n*6Q^E9|GHt}W$~}tZM0xkl-+;qW6rY=95Q9R$p-+C zp+D_&?WcWuolX;CP>6l`i&QsuqgVX2-osW6cd}Swa)`PLGoQh%7vJS2eAv zr$cNZg1f%d%&wI^iNrjckdot*Y!6iJkz6`RIWta{;qIl>b!*v#K;}m!mpK<- zvOzs=td^#lLC$(pOtf_bQ-z2~kkrc$TO2^sspzY3bcl}k%kjZNb>6PYHVKEPpUPGO z&chVC0Ai9uvj}cbUX?Uc-PCXe4sBFVUzXGFDp(5ZL{dUjWKTrLzb_r%W2Ob~Zdp;z ze7W&@YQ&sAX^NvRq6MT&->mwJH|J>&G(j64vYG^fTuEQcxM>!>TehW5kzXIqEkSN| zZ6L^PuF)0zfEil+-cGKPtSfs)HF75g-eS5LGAZHx0xugO5#66Kh463;p)_ zN>j4Lx{uf|NfN*}9viiQj2jhZU1oJpbyJRqEM+aqAz(|}jC^P$-+%cqfe_3RysrfI?h1heow ziaCoRN^S6qNgM2&>{&$7BN)5#G4k?n9*gp2@*mg(7*ST(OI%TSF9QoSM0f>`O5#EU z#0CLtBWZR}VYk%8n`c@H!^5|fP1G?p#I{{uqNP!|SL*lC+7udof6>%0a`v}ZQO?ke zQk1YcN)g}%gL*wGHg#koo>2)D)Hl*x;c!BhOwx?AJOkK~Ri$-1zyW!s?4423J~}?NRd3=wVpleE0K|?9Rcmo-}<%1N_@samkptLr%hiUaOF> zr`l;*VWLV~v`EX~qeo|CuZ1a(ni2J#X zvi@B$N^_kjs`Djk!ZwI%tIDUvl89Ym+Lu7K>+sOJ4f=T#X!~&!r}q8+#pOuf zT*H_%a?K-pDWS8^-?maEuCJL@I3NGCnngit CMS 深圳市纸壳软件有限公司 ZKEASOFT - 4.0.1 - 4.0.1 + 4.1 + 4.1 DEBUG;TRACE From 5cdc110db875fbf912348a5267ac657f418154cd Mon Sep 17 00:00:00 2001 From: wayne Date: Wed, 18 Sep 2024 22:19:18 +0800 Subject: [PATCH 06/28] Update mysql script --- Database/Update/4.1/MySql.sql | 12 ++++++------ Database/Update/4.1/package.zip | Bin 2178 -> 2166 bytes 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Database/Update/4.1/MySql.sql b/Database/Update/4.1/MySql.sql index cedadf8e..6ffcacb0 100644 --- a/Database/Update/4.1/MySql.sql +++ b/Database/Update/4.1/MySql.sql @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `ArticleTypeRelation` ( PRIMARY KEY (`ArticleId`, `ArticleTypeId`) ); -TRUNCATE TABLE `ArticleTypeRelation`; +DELETE FROM `ArticleTypeRelation`; INSERT INTO `ArticleTypeRelation` (ArticleId, ArticleTypeId) SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM `Article`; @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS `CMS_WidgetArticleTypeRelation` ( PRIMARY KEY (`WidgetId`, `ArticleTypeId`) ); -TRUNCATE TABLE `CMS_WidgetArticleTypeRelation`; +DELETE FROM `CMS_WidgetArticleTypeRelation`; INSERT INTO `CMS_WidgetArticleTypeRelation` (WidgetId, ArticleTypeId) SELECT T0.ID, T1.ID FROM `ArticleListWidget` T0 @@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS `ProductCategoryRelation` ( PRIMARY KEY (`ProductId`, `ProductCategoryId`) ); -TRUNCATE TABLE `ProductCategoryRelation`; +DELETE FROM `ProductCategoryRelation`; INSERT INTO `ProductCategoryRelation` (ProductId, ProductCategoryId) SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM `Product`; @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `CMS_WidgetProductCategoryRelation` ( PRIMARY KEY (`WidgetId`, `ProductCategoryId`) ); -TRUNCATE TABLE `CMS_WidgetProductCategoryRelation`; +DELETE FROM `CMS_WidgetProductCategoryRelation`; INSERT INTO `CMS_WidgetProductCategoryRelation` (WidgetId, ProductCategoryId) SELECT T0.ID, T1.ID FROM `ProductListWidget` T0 @@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS `VideoTypeRelation` ( PRIMARY KEY (`VideoId`, `VideoTypeId`) ); -TRUNCATE TABLE `VideoTypeRelation`; +DELETE FROM `VideoTypeRelation`; INSERT INTO `VideoTypeRelation` (VideoId, VideoTypeId) SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM `Video`; @@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS `CMS_WidgetVideoTypeRelation` ( PRIMARY KEY (`WidgetId`, `VideoTypeId`) ); -TRUNCATE TABLE `CMS_WidgetVideoTypeRelation`; +DELETE FROM `CMS_WidgetVideoTypeRelation`; INSERT INTO `CMS_WidgetVideoTypeRelation` (WidgetId, VideoTypeId) SELECT T0.ID, T1.ID FROM `VideoListWidget` T0 diff --git a/Database/Update/4.1/package.zip b/Database/Update/4.1/package.zip index eed4cb7ec11600dc1a2601728c582b563a2ee4f0..2fa30071b43df23f0d9042b276d7d9ad45f9517e 100644 GIT binary patch delta 607 zcmV-l0-*hZ5%v(UNdtevu`*eEI#ZPG0RRAY3;+NL0000@c~fz0E^~2g%~ru~f9)9-Wo_%J8YPCrh_UqG-**AK$^yHrX^c1H%)EK?cHXE*k;@P; z_c=g-CqP05=o3dQf~9-RlJzcTr$bER-6~7c{Stb%1pp$5H%otbcd7T{(%xt|>=yuJ z9t2J`F9*@(&M2O`bOCQ@0lljRj*QZ`t^U}yY|BRh;_N3hoHo-fvM`AdWq=6_+lCU& z9H_M7og&`DW8ia5FySBYB&Xc-(tQ^1GweHn{eHE~uQDoGsFe1m(bq?^*~Xbt^D@O$ zaz3|OX#v|&Xf=P^y5zd)%9uiXHXP(Sv(Z47Hb}m+vV6(2^1cL7cnvYBjKYH>2uTi9 zeW#~0Xh>UPv(>S9W!st)9Fh){SbBIgM!fnil(c(3JEohTb>^+Ic$*$i^$kBKXjfbU zGP^97CQcJl^U_Osigj-vQZ#lzN;0`La;aZsXmV{NsGEN;j)Y@;b-F%+o_YN_x=dTf zHSf}3uyeNR3Q2%hCX*sHqqW2h{4XKgouYOV-;+(8HviTYA?@M`0J9752kul6nwL&w zD3+{gkaH6UM9{?Lmm>d~hl#rd#Ld1I2*!@q%c|m87g#-28EMtJ!5T%L%C`dO$`0bY znh|Od1D6h#wdvtem?-`&{1cV&FSB0-S^^ax02BZK00;oWu`*eEI#ZPG0RRAYlg0c$5^jMWL-0h162DgjfII|xArP6q%0004U`6VLzv delta 619 zcmV-x0+jvs5P}h~NdtdJSTb1{3*kWd0RRAq3;+NL0000@c~fz0E^~2g%~nxwf-n$% zC*eQbqb6k0XR`-}HS31OlWm}9+i6`T~9f){`5CNoD{l9qEv;W3^)26fN} zuU4du&-oluFq&CZpqplqLU?x66ifBEUD|J$0t&<3L)13oEM7;+wM(xsX?stg%-+t3oi`^rmQ~Y#C}Bjhhq8EmH0l zZwY~`KfM|SK)E92TID!M%Z)d7?wjl%B@*uY&!G%{0kcyDS^^b602BZK00;m_STb1{ z3*kWd0RRAqlfnlo7-h9iDR&9m0RR910000000000000000Fwj=Dgj@UF9<;fS_c3C F007D!7nuM6 From a078bc4c44102c836d71d7683a389d3e4cabc21f Mon Sep 17 00:00:00 2001 From: wayne Date: Fri, 20 Sep 2024 23:17:08 +0800 Subject: [PATCH 07/28] Article type name, product category name is required --- src/ZKEACMS/Article/Models/ArticleType.cs | 2 +- src/ZKEACMS/Product/Models/ProductCategory.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZKEACMS/Article/Models/ArticleType.cs b/src/ZKEACMS/Article/Models/ArticleType.cs index dd995dab..319ef42f 100644 --- a/src/ZKEACMS/Article/Models/ArticleType.cs +++ b/src/ZKEACMS/Article/Models/ArticleType.cs @@ -31,7 +31,7 @@ protected override void ViewConfigure() ViewConfig(m => m.ID).AsHidden(); ViewConfig(m => m.ParentID).AsHidden(); ViewConfig(m => m.Title).AsTextBox().Order(1).MaxLength(200).Required(); - ViewConfig(m => m.Url).AsTextBox().Order(2).MaxLength(100).UrlPart().RandomText(); + ViewConfig(m => m.Url).AsTextBox().Order(2).MaxLength(100).UrlPart().RandomText().Required(); ViewConfig(m => m.Status).AsDropDownList().DataSource(DicKeys.RecordStatus, SourceType.Dictionary); ViewConfig(m => m.SEOTitle).AsTextBox().Order(4).MaxLength(100); ViewConfig(m => m.SEOKeyWord).AsTextBox().Order(5).MaxLength(100); diff --git a/src/ZKEACMS/Product/Models/ProductCategory.cs b/src/ZKEACMS/Product/Models/ProductCategory.cs index b66e3d5c..ba6b4783 100644 --- a/src/ZKEACMS/Product/Models/ProductCategory.cs +++ b/src/ZKEACMS/Product/Models/ProductCategory.cs @@ -30,7 +30,7 @@ protected override void ViewConfigure() ViewConfig(m => m.ID).AsHidden(); ViewConfig(m => m.ParentID).AsHidden(); ViewConfig(m => m.Title).AsTextBox().Order(1).MaxLength(200).Required(); - ViewConfig(m => m.Url).AsTextBox().Order(2).MaxLength(100).UrlPart().RandomText(); + ViewConfig(m => m.Url).AsTextBox().Order(2).MaxLength(100).UrlPart().RandomText().Required(); ViewConfig(m => m.Status).AsDropDownList().DataSource(DicKeys.RecordStatus, SourceType.Dictionary); ViewConfig(m => m.SEOTitle).AsTextBox().Order(4).MaxLength(100); ViewConfig(m => m.SEOKeyWord).AsTextBox().Order(5).MaxLength(100); From 315d1f7f4824acb97c43b96c8355c2482700f6ce Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 18:30:56 +0800 Subject: [PATCH 08/28] Do not execute Enterprise scripts --- .../4.1/{MsSql.sql => Enterprise.MsSql.sql} | 0 .../4.1/{MySql.sql => Enterprise.MySql.sql} | 0 .../4.1/{Sqlite.sql => Enterprise.Sqlite.sql} | 0 Database/Update/4.1/package.zip | Bin 2166 -> 2232 bytes src/ZKEACMS.Updater/DbScripts/package.4.1.zip | Bin 0 -> 2166 bytes .../Service/DbUpdaterService.cs | 3 ++- 6 files changed, 2 insertions(+), 1 deletion(-) rename Database/Update/4.1/{MsSql.sql => Enterprise.MsSql.sql} (100%) rename Database/Update/4.1/{MySql.sql => Enterprise.MySql.sql} (100%) rename Database/Update/4.1/{Sqlite.sql => Enterprise.Sqlite.sql} (100%) create mode 100644 src/ZKEACMS.Updater/DbScripts/package.4.1.zip diff --git a/Database/Update/4.1/MsSql.sql b/Database/Update/4.1/Enterprise.MsSql.sql similarity index 100% rename from Database/Update/4.1/MsSql.sql rename to Database/Update/4.1/Enterprise.MsSql.sql diff --git a/Database/Update/4.1/MySql.sql b/Database/Update/4.1/Enterprise.MySql.sql similarity index 100% rename from Database/Update/4.1/MySql.sql rename to Database/Update/4.1/Enterprise.MySql.sql diff --git a/Database/Update/4.1/Sqlite.sql b/Database/Update/4.1/Enterprise.Sqlite.sql similarity index 100% rename from Database/Update/4.1/Sqlite.sql rename to Database/Update/4.1/Enterprise.Sqlite.sql diff --git a/Database/Update/4.1/package.zip b/Database/Update/4.1/package.zip index 2fa30071b43df23f0d9042b276d7d9ad45f9517e..643cfa22fa891bbb582ab8dbe6d3867ce48e0943 100644 GIT binary patch delta 181 zcmew+utRWy6u$@q1A}W`Nor9+QD$+f-bOiVW^}R5vCINY{GzA|Hy5)0WRw+QPyq^q rfC89AF>7)SyC<3oFJ@E~*MTZTQOw9>MO9(MVZ~+4$iR@#4zd6MuskRN delta 115 zcmdlX_)TDf6bmN<1H(p5Yi2NGb1}036AKqmX!9i2pNvAB3@Si22q=I_28PKi*gesN f?U{kXd>o!aTqvr8S%JbO99CRHj0_BZ>>&LBsqqad diff --git a/src/ZKEACMS.Updater/DbScripts/package.4.1.zip b/src/ZKEACMS.Updater/DbScripts/package.4.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..2fa30071b43df23f0d9042b276d7d9ad45f9517e GIT binary patch literal 2166 zcmZ`)c{J2}8~@FW!B`SQM3ywNk0E3?*N70=iWDw2G8oIq7Rn`SQXzXJVMfY6mKlm9 zYt{*oL5RU6Ya6}eJ-zSiJ@?+{d(QVc-{+6dd7ktAd_Iq*8H9x&004Ht%wFZfor)qc zAqW6i2m%0%SvB{!@$*9Z`+3dU;eE1E2Y1I$f92VJb|vBQ7TZP?rv*d6%PqUmkw3rm zH^(P(wuiHaZt6o=!86bdheCXzY5xb^Pal^)IkgMPq(rR5-2-#|f%h`~0^Siz{n?hI ziJs5!V>4+XDs_u2J-Tl=tbQoq`vUiz5Z^QPXn76iU9R3ma-72>b6J9~SDbo3V@md( zQZI-n_fWswr97T*jh;G3tLfS&G>xn&v6*XH;yr=rxtL1bF4ZfVv7_HsT-R4UD>6mW z1qGvKK9a7Ey=pD@^&1j8V-!6TX9+v8{f-`>RhOd?M}MW*#5TBf%T}`jo$u*))a5*; zea2KLgD(UUb6X+Ll9Nv2s`wntZXiiQCS|k~Ctgm`d@k)*B$Z-6e=&FQDWD=-iC5pO z|5lqBBJZl)^8}eSnVeCdtTDs3MQi*HzPXNiz%m;B;t!Rm%-y&395r$;hZx((OX(@& z1#SgqX3H>v3^U8G*x1D8_9~5A)@wul{k@|J{)RLj$?3%t-M*sG#W;J6D|gJ8gnalX zM%@opQHvKrCAP|wB2>>DDk5?2|R%U7{~I^y0WuJp-1 zpp3Lu-=Rks3shu9OTGGJlW3|L+*tm*_VW$p90JV$>&r`bVIZ?FVWV7JR^(3)QG|lRJo+MD*)RC!O!eMsj6!~=09MEr&H9UTz)y%L|{d2No4SZ5?zsbtit=~%6i z0U(<^l6|Do1G3Siu{{I7gkDpW3nYT2YNg8(3q>z8~& ze#xije6x2X`e0+qDv$rrEg{`(F`3c@a$N=%zep06ifN6j*qEdTfhe6|N+~Y!%e(fEGXLDaS;Izk$4z&Z~%R){PN?M~iAx)o#2eEcA1Hn78YoeTve<4&3d2a&d? z2PWJ#mIQ$-Vk{PFN^JeJZ)I{Du7P~qL5)vYlM)ANpY4v2y}FD+(@WB-IqHLom8kfG z*a#TsSPWm!5n}c9L&=F(mnZ$rQB&fph~n|}f$&2sCziA$c5c*km#N5IAf|2=^$#0Y zj<#i5udBSaCFs>U;6P(m?rLKVGYt!!83v*1M`pCD`q63Xr<{F!!u7I9u%O zCbzz{yWJ(Q3PmCPxCPvLeZVXvA;3r6S~U=Ds#32?AUR{*33voCTPf+*<*j_AU+ZkTbUBw^p2cMPx#|cBGrDmC^&JQv<@sbk&IGC2oWCZRS zcF$9L&YAl}qWP&QtKwTknDTPw2HFKre*OC8dj?6_fGeICv(S8#K8x`c+=9SGbPrE- zFQKU6z1;a235mB)c|ci^BL{(D8A)E>HOUX6d;~oy7sALPTp$a45ZD+_wd7*Il#+1E zuE~c+OOi2Az*PITaDRyqLE&C2q-m<%A>oCKrhXH*zPpaH=gKTWu^XchfD0d&%adY5 zTe{TC0-rmmov67&T70(X?HPNCUT}MMrRrTj8_j!&1?1zEGSvy`XvCoKBLUfPvoEX| zTuDui6Y-(`!{EaCuIA*Nj=|FIRGr>Bp`DFl;wZmOZv29F6C1m;ypf|+}9)!Lw=Np~IWp3@}ab=xQg`8tlhakr~ za47cM=I7cB_!sBUk{jR8d_;(hm;~h0ogB@B-kdZz|3=um_&L%ePcPC=oHDGP95mbf zuBkvEY{RI`{^as{0;#5l=3-jjc#IZGjfD9)JGu?qeviW~kO^aLrKHgX-bg8BV>A@T2f-*)BrRRRG*KxHvEG6*)tWX%7^9<=x`=)Zc+erSE>0yqDU z^X!LKON(crF`*IUtM~S@r!+QkFYoXAuaw;nZ3Ep;;QiS3OJ}71zHKP$-XIX>;bRVE I!M6AM7njPe2><{9 literal 0 HcmV?d00001 diff --git a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs index 05e846ca..862a00d2 100644 --- a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs +++ b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs @@ -289,11 +289,12 @@ private IEnumerable ConvertToScripts(byte[] package) { using (ZipArchive archive = new ZipArchive(memoryStream, ZipArchiveMode.Read)) { + string rankScriptFileName = $"{Version.Rank}.{_scriptFileName}"; foreach (ZipArchiveEntry entry in archive.Entries) { //There three scripts in the package, MsSql.sql, MySql.sql, Sqlite.sql //Pick up matched script to execute. - if (!entry.Name.Equals(_scriptFileName, StringComparison.OrdinalIgnoreCase)) continue; + if (!entry.Name.Equals(_scriptFileName, StringComparison.OrdinalIgnoreCase) && !entry.Name.Equals(rankScriptFileName, StringComparison.OrdinalIgnoreCase)) continue; using (StreamReader reader = new StreamReader(entry.Open())) { From 642ce1909eb1676e104e2e9f01680618c656056c Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 18:32:56 +0800 Subject: [PATCH 09/28] Remove useless file --- src/ZKEACMS.Updater/DbScripts/package.4.1.zip | Bin 2166 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/ZKEACMS.Updater/DbScripts/package.4.1.zip diff --git a/src/ZKEACMS.Updater/DbScripts/package.4.1.zip b/src/ZKEACMS.Updater/DbScripts/package.4.1.zip deleted file mode 100644 index 2fa30071b43df23f0d9042b276d7d9ad45f9517e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2166 zcmZ`)c{J2}8~@FW!B`SQM3ywNk0E3?*N70=iWDw2G8oIq7Rn`SQXzXJVMfY6mKlm9 zYt{*oL5RU6Ya6}eJ-zSiJ@?+{d(QVc-{+6dd7ktAd_Iq*8H9x&004Ht%wFZfor)qc zAqW6i2m%0%SvB{!@$*9Z`+3dU;eE1E2Y1I$f92VJb|vBQ7TZP?rv*d6%PqUmkw3rm zH^(P(wuiHaZt6o=!86bdheCXzY5xb^Pal^)IkgMPq(rR5-2-#|f%h`~0^Siz{n?hI ziJs5!V>4+XDs_u2J-Tl=tbQoq`vUiz5Z^QPXn76iU9R3ma-72>b6J9~SDbo3V@md( zQZI-n_fWswr97T*jh;G3tLfS&G>xn&v6*XH;yr=rxtL1bF4ZfVv7_HsT-R4UD>6mW z1qGvKK9a7Ey=pD@^&1j8V-!6TX9+v8{f-`>RhOd?M}MW*#5TBf%T}`jo$u*))a5*; zea2KLgD(UUb6X+Ll9Nv2s`wntZXiiQCS|k~Ctgm`d@k)*B$Z-6e=&FQDWD=-iC5pO z|5lqBBJZl)^8}eSnVeCdtTDs3MQi*HzPXNiz%m;B;t!Rm%-y&395r$;hZx((OX(@& z1#SgqX3H>v3^U8G*x1D8_9~5A)@wul{k@|J{)RLj$?3%t-M*sG#W;J6D|gJ8gnalX zM%@opQHvKrCAP|wB2>>DDk5?2|R%U7{~I^y0WuJp-1 zpp3Lu-=Rks3shu9OTGGJlW3|L+*tm*_VW$p90JV$>&r`bVIZ?FVWV7JR^(3)QG|lRJo+MD*)RC!O!eMsj6!~=09MEr&H9UTz)y%L|{d2No4SZ5?zsbtit=~%6i z0U(<^l6|Do1G3Siu{{I7gkDpW3nYT2YNg8(3q>z8~& ze#xije6x2X`e0+qDv$rrEg{`(F`3c@a$N=%zep06ifN6j*qEdTfhe6|N+~Y!%e(fEGXLDaS;Izk$4z&Z~%R){PN?M~iAx)o#2eEcA1Hn78YoeTve<4&3d2a&d? z2PWJ#mIQ$-Vk{PFN^JeJZ)I{Du7P~qL5)vYlM)ANpY4v2y}FD+(@WB-IqHLom8kfG z*a#TsSPWm!5n}c9L&=F(mnZ$rQB&fph~n|}f$&2sCziA$c5c*km#N5IAf|2=^$#0Y zj<#i5udBSaCFs>U;6P(m?rLKVGYt!!83v*1M`pCD`q63Xr<{F!!u7I9u%O zCbzz{yWJ(Q3PmCPxCPvLeZVXvA;3r6S~U=Ds#32?AUR{*33voCTPf+*<*j_AU+ZkTbUBw^p2cMPx#|cBGrDmC^&JQv<@sbk&IGC2oWCZRS zcF$9L&YAl}qWP&QtKwTknDTPw2HFKre*OC8dj?6_fGeICv(S8#K8x`c+=9SGbPrE- zFQKU6z1;a235mB)c|ci^BL{(D8A)E>HOUX6d;~oy7sALPTp$a45ZD+_wd7*Il#+1E zuE~c+OOi2Az*PITaDRyqLE&C2q-m<%A>oCKrhXH*zPpaH=gKTWu^XchfD0d&%adY5 zTe{TC0-rmmov67&T70(X?HPNCUT}MMrRrTj8_j!&1?1zEGSvy`XvCoKBLUfPvoEX| zTuDui6Y-(`!{EaCuIA*Nj=|FIRGr>Bp`DFl;wZmOZv29F6C1m;ypf|+}9)!Lw=Np~IWp3@}ab=xQg`8tlhakr~ za47cM=I7cB_!sBUk{jR8d_;(hm;~h0ogB@B-kdZz|3=um_&L%ePcPC=oHDGP95mbf zuBkvEY{RI`{^as{0;#5l=3-jjc#IZGjfD9)JGu?qeviW~kO^aLrKHgX-bg8BV>A@T2f-*)BrRRRG*KxHvEG6*)tWX%7^9<=x`=)Zc+erSE>0yqDU z^X!LKON(crF`*IUtM~S@r!+QkFYoXAuaw;nZ3Ep;;QiS3OJ}71zHKP$-XIX>;bRVE I!M6AM7njPe2><{9 From aed56f42d5564df33c7c4b35373fd196e8216d24 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 18:36:05 +0800 Subject: [PATCH 10/28] return Enumerable.Empty(); --- src/ZKEACMS.Updater/Service/DbUpdaterService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs index 862a00d2..c3088509 100644 --- a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs +++ b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs @@ -303,7 +303,7 @@ private IEnumerable ConvertToScripts(byte[] package) } } } - throw new Exception($"{_scriptFileName} is not in the update package."); + return Enumerable.Empty(); } private byte[] GetUpdateScriptsFromLocalCache(string version) { From ae10770a7c0fb43e36da7779632f8fe67a7ac288 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 18:38:25 +0800 Subject: [PATCH 11/28] Do not update dbversion to file in develop environment. --- src/ZKEACMS.Updater/Service/DbUpdaterService.cs | 11 +++++++---- src/ZKEACMS.Updater/appsettings.json | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs index c3088509..780301a7 100644 --- a/src/ZKEACMS.Updater/Service/DbUpdaterService.cs +++ b/src/ZKEACMS.Updater/Service/DbUpdaterService.cs @@ -31,6 +31,7 @@ public class DbUpdaterService : IDbUpdaterService private readonly IWebClient _webClient; private readonly ILogger _logger; private readonly IDBContextProvider _dbContextProvider; + private readonly bool isDevelopment; private const int DBVersionRecord = 1; private readonly string _scriptFileName; private string availableSource; @@ -38,13 +39,15 @@ public DbUpdaterService(DatabaseOption databaseOption, IOptions dbVersionOption, IWebClient webClient, IDBContextProvider dbContextProvider, - ILogger logger) + ILogger logger, + IWebHostEnvironment hostEnvironment) { _dbVersionOption = dbVersionOption.Value; _webClient = webClient; _scriptFileName = $"{databaseOption.DbType}.sql";//MsSql.sql, MySql.sql, Sqlite.sql _logger = logger; _dbContextProvider = dbContextProvider; + isDevelopment = hostEnvironment.IsDevelopment(); } public void UpdateDatabase() @@ -141,6 +144,8 @@ private void SaveVersionToFile(Easy.Version version) { try { + if (isDevelopment) return; + var plugPath = PluginBase.GetPath(); var versionFile = Path.Combine(plugPath, "appsettings.json"); _dbVersionOption.DBVersion = version.ToString(); @@ -388,6 +393,7 @@ private bool ExecuteScripts(DbContext dbContext, IEnumerable sqlScripts) foreach (var sql in sqlScripts) { if (sql.IsNullOrWhiteSpace()) continue; + using (var command = dbConnection.CreateCommand()) { command.Transaction = dbTransaction; @@ -397,9 +403,7 @@ private bool ExecuteScripts(DbContext dbContext, IEnumerable sqlScripts) } } - dbTransaction.Commit(); - return true; } catch (Exception ex) @@ -414,7 +418,6 @@ private bool ExecuteScripts(DbContext dbContext, IEnumerable sqlScripts) dbConnection.Close(); } } - } return false; } diff --git a/src/ZKEACMS.Updater/appsettings.json b/src/ZKEACMS.Updater/appsettings.json index 7165174d..763abcab 100644 --- a/src/ZKEACMS.Updater/appsettings.json +++ b/src/ZKEACMS.Updater/appsettings.json @@ -1,6 +1,5 @@ { "DBVersionOption": { - "DBVersion": "4.0.0.0", "BaseVersion": "3.3.5", "Source": [ "https://gitee.com/seriawei/ZKEACMS.Core/raw/develop/Database", From 54a0d6ec569f5ea137c7bb57743bf66cbd159f36 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 20:15:53 +0800 Subject: [PATCH 12/28] Json clone. --- src/EasyFrameWork/Extend/ExtObject.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/EasyFrameWork/Extend/ExtObject.cs diff --git a/src/EasyFrameWork/Extend/ExtObject.cs b/src/EasyFrameWork/Extend/ExtObject.cs new file mode 100644 index 00000000..e440fe9c --- /dev/null +++ b/src/EasyFrameWork/Extend/ExtObject.cs @@ -0,0 +1,21 @@ +/* http://www.zkea.net/ + * Copyright (c) ZKEASOFT. All rights reserved. + * http://www.zkea.net/licenses */ + +using Easy.Serializer; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Easy.Extend +{ + public static class ExtObject + { + public static T Clone(this T obj) where T : class + { + return JsonConverter.Deserialize(JsonConverter.Serialize(obj)); + } + } +} From de8194582775ad5026420fa5820cdeb19a538e46 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 21:27:54 +0800 Subject: [PATCH 13/28] Stops tracking all currently tracked entities. --- src/EasyFrameWork/RepositoryPattern/ServiceBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EasyFrameWork/RepositoryPattern/ServiceBase.cs b/src/EasyFrameWork/RepositoryPattern/ServiceBase.cs index d85988c1..e00ac158 100644 --- a/src/EasyFrameWork/RepositoryPattern/ServiceBase.cs +++ b/src/EasyFrameWork/RepositoryPattern/ServiceBase.cs @@ -360,6 +360,7 @@ private void SaveChanges() if(!isInBulkSaving) { DbContext.SaveChanges(); + DbContext.ChangeTracker.Clear(); } } From 1e063f3665cf3053704fc7abe808dc1dbca87aab Mon Sep 17 00:00:00 2001 From: wayne Date: Tue, 24 Sep 2024 20:31:58 +0800 Subject: [PATCH 14/28] Key ignore case --- Database/SQLite/ZKEACMS.sqlite.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Database/SQLite/ZKEACMS.sqlite.sql b/Database/SQLite/ZKEACMS.sqlite.sql index 4708733c..87029b85 100644 --- a/Database/SQLite/ZKEACMS.sqlite.sql +++ b/Database/SQLite/ZKEACMS.sqlite.sql @@ -1177,7 +1177,7 @@ CREATE TABLE [Article] ( , FOREIGN KEY ([ArticleTypeID]) REFERENCES [ArticleType] ([ID]) ON DELETE NO ACTION ON UPDATE NO ACTION ); CREATE TABLE [ApplicationSetting] ( - [SettingKey] nvarchar(50) NOT NULL + [SettingKey] nvarchar(50) NOT NULL COLLATE NOCASE , [Value] ntext NULL , [Title] nvarchar(200) NULL , [Description] nvarchar(500) NULL From 63114c0ce46a167bcf383bd0b56867e207053d54 Mon Sep 17 00:00:00 2001 From: wayne Date: Wed, 25 Sep 2024 20:21:39 +0800 Subject: [PATCH 15/28] Use execute update --- src/ZKEACMS.Article/Service/ArticleService.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ZKEACMS.Article/Service/ArticleService.cs b/src/ZKEACMS.Article/Service/ArticleService.cs index b2778a85..f5d67836 100644 --- a/src/ZKEACMS.Article/Service/ArticleService.cs +++ b/src/ZKEACMS.Article/Service/ArticleService.cs @@ -19,10 +19,10 @@ public class ArticleService : ServiceBase, IArticle { private readonly ILocalize _localize; private readonly IEventManager _eventManager; - public ArticleService(IApplicationContext applicationContext, - ILocalize localize, + public ArticleService(IApplicationContext applicationContext, + ILocalize localize, CMSDbContext dbContext, - IEventManager eventManager) + IEventManager eventManager) : base(applicationContext, dbContext) { _localize = localize; @@ -98,10 +98,7 @@ public ArticleEntity GetPrev(ArticleEntity article) public void IncreaseCount(ArticleEntity article) { - article.Counter = (article.Counter ?? 0) + 1; - DbContext.Attach(article); - DbContext.Entry(article).Property(x => x.Counter).IsModified = true; - DbContext.SaveChanges(); + Get().Where(m => m.ID == article.ID).ExecuteUpdate(m => m.SetProperty(m => m.Counter, m => (m.Counter ?? 0) + 1)); } public void Publish(int ID) @@ -115,7 +112,7 @@ public void Publish(ArticleEntity article) if (article.PublishDate == null) { article.PublishDate = DateTime.Now; - } + } if (article.ID > 0) { Update(article); From caf1e02f2c79440621fecce54b205acf09afd120 Mon Sep 17 00:00:00 2001 From: wayne Date: Wed, 25 Sep 2024 20:29:46 +0800 Subject: [PATCH 16/28] Article type, product category dropdown tree --- src/ZKEACMS.Article/Models/ArticleListWidget.cs | 2 +- src/ZKEACMS.Article/Models/ArticleTopWidget.cs | 2 +- src/ZKEACMS.Article/Models/ArticleTypeWidget.cs | 2 +- src/ZKEACMS.Product/Models/ProductCategoryWidget.cs | 2 +- src/ZKEACMS.Product/Models/ProductListWidget.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ZKEACMS.Article/Models/ArticleListWidget.cs b/src/ZKEACMS.Article/Models/ArticleListWidget.cs index 62aea6eb..af93c5f3 100644 --- a/src/ZKEACMS.Article/Models/ArticleListWidget.cs +++ b/src/ZKEACMS.Article/Models/ArticleListWidget.cs @@ -32,7 +32,7 @@ protected override void ViewConfigure() { base.ViewConfigure(); ViewConfig(m => m.Title).AsHidden(); - ViewConfig(m => m.ArticleTypeID).AsDropDownList().Order(NextOrder()).SetTemplate("ArticleTypeTree").Required(); + ViewConfig(m => m.ArticleTypeID).AsDropDownTree("GetArticleTypeTree", "ArticleType", "admin").Order(NextOrder()).Required(); ViewConfig(m => m.DetailPageUrl).AsTextBox().Order(NextOrder()).PageSelector().InnerUrl(); diff --git a/src/ZKEACMS.Article/Models/ArticleTopWidget.cs b/src/ZKEACMS.Article/Models/ArticleTopWidget.cs index 568b7420..090f57ee 100644 --- a/src/ZKEACMS.Article/Models/ArticleTopWidget.cs +++ b/src/ZKEACMS.Article/Models/ArticleTopWidget.cs @@ -33,7 +33,7 @@ protected override void ViewConfigure() { base.ViewConfigure(); ViewConfig(m => m.SubTitle).AsTextBox().Order(NextOrder()); - ViewConfig(m => m.ArticleTypeID).AsDropDownList().Order(NextOrder()).SetTemplate("ArticleTypeTree").Required(); + ViewConfig(m => m.ArticleTypeID).AsDropDownTree("GetArticleTypeTree", "ArticleType", "admin").Order(NextOrder()).Required(); ViewConfig(m => m.Tops).AsTextBox().Order(NextOrder()).RegularExpression(RegularExpression.PositiveIntegers).Required(); ViewConfig(m => m.MoreLink).AsTextBox().Order(NextOrder()).PageSelector(); ViewConfig(m => m.DetailPageUrl).AsTextBox().Order(NextOrder()).PageSelector().InnerUrl(); diff --git a/src/ZKEACMS.Article/Models/ArticleTypeWidget.cs b/src/ZKEACMS.Article/Models/ArticleTypeWidget.cs index 978ec66b..12fee5fc 100644 --- a/src/ZKEACMS.Article/Models/ArticleTypeWidget.cs +++ b/src/ZKEACMS.Article/Models/ArticleTypeWidget.cs @@ -26,7 +26,7 @@ class ArticleTypeWidgetMetaData : WidgetMetaData protected override void ViewConfigure() { base.ViewConfigure(); - ViewConfig(m => m.ArticleTypeID).AsDropDownList().Order(NextOrder()).SetTemplate("ArticleTypeTree").Required(); + ViewConfig(m => m.ArticleTypeID).AsDropDownTree("GetArticleTypeTree", "ArticleType", "admin").Order(NextOrder()).Required(); ViewConfig(m => m.PartialView).AsDropDownList().Order(NextOrder()).DataSource(SourceType.Dictionary).AsWidgetTemplateChooser(); ViewConfig(m => m.TargetPage).AsHidden(); } diff --git a/src/ZKEACMS.Product/Models/ProductCategoryWidget.cs b/src/ZKEACMS.Product/Models/ProductCategoryWidget.cs index 76eb851b..e93d3ef1 100644 --- a/src/ZKEACMS.Product/Models/ProductCategoryWidget.cs +++ b/src/ZKEACMS.Product/Models/ProductCategoryWidget.cs @@ -29,7 +29,7 @@ class ProductCategoryWidgetMedata : WidgetMetaData protected override void ViewConfigure() { base.ViewConfigure(); - ViewConfig(m => m.ProductCategoryID).AsDropDownList().Order(NextOrder()).SetTemplate("ProductCategoryTree").Required(); + ViewConfig(m => m.ProductCategoryID).AsDropDownTree("GetProductCategoryTree", "ProductCategory", "admin").Order(NextOrder()).Required(); ViewConfig(m => m.PartialView).AsDropDownList().Order(NextOrder()).DataSource(SourceType.Dictionary).AsWidgetTemplateChooser(); ViewConfig(m => m.TargetPage).AsHidden(); } diff --git a/src/ZKEACMS.Product/Models/ProductListWidget.cs b/src/ZKEACMS.Product/Models/ProductListWidget.cs index da2e7f04..54607a4c 100644 --- a/src/ZKEACMS.Product/Models/ProductListWidget.cs +++ b/src/ZKEACMS.Product/Models/ProductListWidget.cs @@ -36,7 +36,7 @@ protected override void ViewConfigure() { base.ViewConfigure(); ViewConfig(m => m.Title).AsHidden(); - ViewConfig(m => m.ProductCategoryID).AsDropDownList().SetTemplate("ProductCategoryTree").Required().Order(NextOrder()); + ViewConfig(m => m.ProductCategoryID).AsDropDownTree("GetProductCategoryTree", "ProductCategory", "admin").Required().Order(NextOrder()); ViewConfig(m => m.DetailPageUrl).AsTextBox().Order(NextOrder()).PageSelector().InnerUrl(); ViewConfig(m => m.IsPageable).AsCheckBox().Order(NextOrder()); From e84ebbc8e4fed95bf8e92ad4900ff61b4e00e417 Mon Sep 17 00:00:00 2001 From: wayne Date: Thu, 26 Sep 2024 21:17:15 +0800 Subject: [PATCH 17/28] Reorder menu Ddashboard 0 Layout 10 Page 20 Navigation 30 Article Manager 31 Manage Product 32 Generate Content 50 Form Generator 60 Message And Comments 70 Event/Notification 80 --- src/ZKEACMS.Article/ArticlePlug.cs | 2 +- src/ZKEACMS.EventAction/EventActionPlug.cs | 2 +- src/ZKEACMS.FormGenerator/FormPlug.cs | 2 +- src/ZKEACMS.Message/MessagePlug.cs | 2 +- src/ZKEACMS.Product/ProductPlug.cs | 2 +- src/ZKEACMS.Shop/ShopPlug.cs | 2 +- src/ZKEACMS/AdminMenu.cs | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ZKEACMS.Article/ArticlePlug.cs b/src/ZKEACMS.Article/ArticlePlug.cs index d0bfdc84..7d139174 100644 --- a/src/ZKEACMS.Article/ArticlePlug.cs +++ b/src/ZKEACMS.Article/ArticlePlug.cs @@ -35,7 +35,7 @@ public override IEnumerable AdminMenu() { Title = "Article Manager", Icon = "glyphicon-font", - Order = 10, + Order = 31, Children = new List { new AdminMenu diff --git a/src/ZKEACMS.EventAction/EventActionPlug.cs b/src/ZKEACMS.EventAction/EventActionPlug.cs index 0f5ada0f..c4255020 100644 --- a/src/ZKEACMS.EventAction/EventActionPlug.cs +++ b/src/ZKEACMS.EventAction/EventActionPlug.cs @@ -32,7 +32,7 @@ public override IEnumerable AdminMenu() { Title = "Event/Notification", Icon = "glyphicon-flash", - Order = 14, + Order = 80, Children = new List { new AdminMenu diff --git a/src/ZKEACMS.FormGenerator/FormPlug.cs b/src/ZKEACMS.FormGenerator/FormPlug.cs index 8db6370f..71dd9a42 100644 --- a/src/ZKEACMS.FormGenerator/FormPlug.cs +++ b/src/ZKEACMS.FormGenerator/FormPlug.cs @@ -67,7 +67,7 @@ public override IEnumerable AdminMenu() } }, Icon = "glyphicon-list-alt", - Order = 12 + Order = 60 }; } diff --git a/src/ZKEACMS.Message/MessagePlug.cs b/src/ZKEACMS.Message/MessagePlug.cs index 234f8ae8..7439249f 100644 --- a/src/ZKEACMS.Message/MessagePlug.cs +++ b/src/ZKEACMS.Message/MessagePlug.cs @@ -34,7 +34,7 @@ public override IEnumerable AdminMenu() { Title = "Message And Comments", Icon = "glyphicon-volume-up", - Order = 7, + Order = 70, Children = new List { new AdminMenu diff --git a/src/ZKEACMS.Product/ProductPlug.cs b/src/ZKEACMS.Product/ProductPlug.cs index cf12c31d..4105c693 100644 --- a/src/ZKEACMS.Product/ProductPlug.cs +++ b/src/ZKEACMS.Product/ProductPlug.cs @@ -33,7 +33,7 @@ public override IEnumerable AdminMenu() { Title = "Manage Product", Icon = "glyphicon-list-alt", - Order = 11, + Order = 32, Children = new List { new AdminMenu diff --git a/src/ZKEACMS.Shop/ShopPlug.cs b/src/ZKEACMS.Shop/ShopPlug.cs index 64c31b3c..49feb0bd 100644 --- a/src/ZKEACMS.Shop/ShopPlug.cs +++ b/src/ZKEACMS.Shop/ShopPlug.cs @@ -54,7 +54,7 @@ public override IEnumerable AdminMenu() { Title = "E-commerce", Icon = "glyphicon-shopping-cart", - Order = 9, + Order = 40, Children = new List { new AdminMenu diff --git a/src/ZKEACMS/AdminMenu.cs b/src/ZKEACMS/AdminMenu.cs index 394b4c2b..2c4a1400 100644 --- a/src/ZKEACMS/AdminMenu.cs +++ b/src/ZKEACMS/AdminMenu.cs @@ -34,7 +34,7 @@ public static class AdminMenus { Title = "Layout", Icon = "glyphicon-th-list", - Order = 1, + Order = 10, Children = new List { new AdminMenu @@ -58,7 +58,7 @@ public static class AdminMenus Title = "Page", Icon = "glyphicon-eye-open", Url = "~/admin/page", - Order = 2, + Order = 20, PermissionKey = PermissionKeys.ViewPage }, new AdminMenu @@ -66,14 +66,14 @@ public static class AdminMenus Title = "Navigation", Icon = "glyphicon-retweet", Url = "~/admin/navigation", - Order = 3, + Order = 30, PermissionKey = PermissionKeys.ViewNavigation }, new AdminMenu { Title = "Generate Content", Icon = "glyphicon-tree-deciduous", - Order = 5, + Order = 50, Children = new List { new AdminMenu From a00f350f86c89c9f4c4dfbe092864880eb821b38 Mon Sep 17 00:00:00 2001 From: wayne Date: Thu, 26 Sep 2024 23:00:39 +0800 Subject: [PATCH 18/28] Public link --- src/ZKEACMS.Article/Views/Article/Edit.cshtml | 25 ++++++++----------- src/ZKEACMS.Product/Views/Product/Edit.cshtml | 25 ++++++++----------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/ZKEACMS.Article/Views/Article/Edit.cshtml b/src/ZKEACMS.Article/Views/Article/Edit.cshtml index fd99efc0..04dca191 100644 --- a/src/ZKEACMS.Article/Views/Article/Edit.cshtml +++ b/src/ZKEACMS.Article/Views/Article/Edit.cshtml @@ -2,26 +2,21 @@ @{ Script.Reqiured("validate").AtFoot(); Script.Reqiured("tinymce").AtFoot(); - string publicUrl = articleUrlService.GetPublicUrl(Model).FirstOrDefault(); + string publicUrl = articleUrlService.GetPublicUrl(Model)?.FirstOrDefault(); } @inject ZKEACMS.Article.Service.IArticleUrlService articleUrlService
- @L("Edit") - - @if (!Model.IsPublish) - { - - @L("Unpublished") - - } - else - { - - @L("Published") - - } + + @(Model.IsPublish ? L("Published") : L("Unpublished")) + @if (Model.IsPublish && publicUrl.IsNotNullAndWhiteSpace()) + { + + + + + }
@using (Html.BeginForm()) diff --git a/src/ZKEACMS.Product/Views/Product/Edit.cshtml b/src/ZKEACMS.Product/Views/Product/Edit.cshtml index 0daf78da..e7f39c0a 100644 --- a/src/ZKEACMS.Product/Views/Product/Edit.cshtml +++ b/src/ZKEACMS.Product/Views/Product/Edit.cshtml @@ -2,26 +2,21 @@ @{ Script.Reqiured("validate").AtFoot(); Script.Reqiured("tinymce").AtFoot(); - string publicUrl = productUrlService.GetPublicUrl(Model).FirstOrDefault(); + string publicUrl = productUrlService.GetPublicUrl(Model)?.FirstOrDefault(); } @inject ZKEACMS.Product.Service.IProductUrlService productUrlService
- @L("Edit") - - @if (!Model.IsPublish) - { - - @L("Unpublished") - - } - else - { - - @L("Published") - - } + + @(Model.IsPublish ? L("Published") : L("Unpublished")) + @if (Model.IsPublish && publicUrl.IsNotNullAndWhiteSpace()) + { + + + + + }
@using (Html.BeginForm()) From a5e2738f95a4062726e07608dff0939f2689f3ab Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 28 Sep 2024 19:41:29 +0800 Subject: [PATCH 19/28] Update packages --- src/EasyFrameWork/EasyFrameWork.csproj | 2 +- src/ZKEACMS.Swagger/ZKEACMS.Swagger.csproj | 2 +- src/ZKEACMS/ZKEACMS.csproj | 2 +- test/ZKEACMS.Test/ZKEACMS.Test.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EasyFrameWork/EasyFrameWork.csproj b/src/EasyFrameWork/EasyFrameWork.csproj index 1482e763..dfd57f77 100644 --- a/src/EasyFrameWork/EasyFrameWork.csproj +++ b/src/EasyFrameWork/EasyFrameWork.csproj @@ -27,6 +27,6 @@ - + diff --git a/src/ZKEACMS.Swagger/ZKEACMS.Swagger.csproj b/src/ZKEACMS.Swagger/ZKEACMS.Swagger.csproj index 82142fbb..a1ca7d5f 100644 --- a/src/ZKEACMS.Swagger/ZKEACMS.Swagger.csproj +++ b/src/ZKEACMS.Swagger/ZKEACMS.Swagger.csproj @@ -16,7 +16,7 @@ - + false runtime diff --git a/src/ZKEACMS/ZKEACMS.csproj b/src/ZKEACMS/ZKEACMS.csproj index 277580d9..ba92b444 100644 --- a/src/ZKEACMS/ZKEACMS.csproj +++ b/src/ZKEACMS/ZKEACMS.csproj @@ -28,7 +28,7 @@ - + diff --git a/test/ZKEACMS.Test/ZKEACMS.Test.csproj b/test/ZKEACMS.Test/ZKEACMS.Test.csproj index 2b283abb..611f015d 100644 --- a/test/ZKEACMS.Test/ZKEACMS.Test.csproj +++ b/test/ZKEACMS.Test/ZKEACMS.Test.csproj @@ -12,7 +12,7 @@ - + From 05283daf7733152c5e82113779857875bfcf2789 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 28 Sep 2024 22:10:19 +0800 Subject: [PATCH 20/28] Move page tags to PageContext --- .../Service/AnimationScriptsService.cs | 10 ++--- .../Service/ArticleDetailWidgetService.cs | 7 +++- .../Service/GlobalScriptsProviderService.cs | 8 ++-- .../Service/PinNavScriptsService.cs | 10 ++--- .../Service/ProductDetailWidgetService.cs | 9 ++++- .../Views/Shared/_DesignPageLayout.cshtml | 24 +++++++++++- .../Views/Shared/_Layout.cshtml | 28 ++++++++++++-- src/ZKEACMS/BuilderCMSBase.cs | 1 + src/ZKEACMS/CMSApplicationContext.cs | 26 +++---------- .../Common/Service/HeadWidgetService.cs | 2 +- src/ZKEACMS/Page/IPageContext.cs | 29 +++++++++++++++ src/ZKEACMS/Page/MetaTag.cs | 17 +++++++++ src/ZKEACMS/Page/PageContext.cs | 34 +++++++++++++++++ src/ZKEACMS/Page/PageTag.cs | 37 +++++++++++++++++++ src/ZKEACMS/Page/ScriptTag.cs | 30 +++++++++++++++ src/ZKEACMS/Page/StyleSheetTag.cs | 25 +++++++++++++ src/ZKEACMS/Page/StyleTag.cs | 24 ++++++++++++ 17 files changed, 274 insertions(+), 47 deletions(-) create mode 100644 src/ZKEACMS/Page/IPageContext.cs create mode 100644 src/ZKEACMS/Page/MetaTag.cs create mode 100644 src/ZKEACMS/Page/PageContext.cs create mode 100644 src/ZKEACMS/Page/PageTag.cs create mode 100644 src/ZKEACMS/Page/ScriptTag.cs create mode 100644 src/ZKEACMS/Page/StyleSheetTag.cs create mode 100644 src/ZKEACMS/Page/StyleTag.cs diff --git a/src/ZKEACMS.Animation/Service/AnimationScriptsService.cs b/src/ZKEACMS.Animation/Service/AnimationScriptsService.cs index 9b71e61f..2939f8fa 100644 --- a/src/ZKEACMS.Animation/Service/AnimationScriptsService.cs +++ b/src/ZKEACMS.Animation/Service/AnimationScriptsService.cs @@ -35,14 +35,12 @@ public void Handle(object entity, EventArg e) HtmlContentBuilder styleBuilder = new HtmlContentBuilder(); HtmlContentBuilder scriptBuilder = new HtmlContentBuilder(); #if DEBUG - styleBuilder.AppendHtml(""); - scriptBuilder.AppendHtml(""); + applicationContext.CurrentPage.StyleSheets.Add(new Page.StyleSheetTag("/Plugins/ZKEACMS.Animation/Content/animate.css")); + applicationContext.CurrentPage.FooterScripts.Add(new Page.ScriptTag("/Plugins/ZKEACMS.Animation/Scripts/animate.js")); #else - styleBuilder.AppendHtml(""); - scriptBuilder.AppendHtml(""); + applicationContext.CurrentPage.StyleSheets.Add(new Page.StyleSheetTag("/Plugins/ZKEACMS.Animation/Content/animate.min.css")); + applicationContext.CurrentPage.FooterScripts.Add(new Page.ScriptTag("/Plugins/ZKEACMS.Animation/Scripts/animate.min.js")); #endif - applicationContext.HeaderPart.Add(styleBuilder); - applicationContext.FooterPart.Add(scriptBuilder); } } } diff --git a/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs b/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs index 94f315cb..0dbfa2cd 100644 --- a/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs +++ b/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs @@ -131,8 +131,11 @@ private void AddStructuredDataToPageHeader(ArticleEntity article) DateModified = article.LastUpdateDate, Author = new Person[] { new Person { Name = article.CreatebyName } } }; - IHtmlContent jsonLinkingData = HtmlHelper.SerializeToJsonLinkingData(structuredData); - ApplicationContext.CurrentAppContext().HeaderPart.Add(jsonLinkingData); + ApplicationContext.CurrentAppContext().CurrentPage.HeaderScripts.Add(new Page.ScriptTag() + { + Type = "application/ld+json", + InnerScript = new HtmlString(JsonConverter.Serialize(structuredData)) + }); } private IEnumerable GetImages(ArticleEntity article) { diff --git a/src/ZKEACMS.GlobalScripts/Service/GlobalScriptsProviderService.cs b/src/ZKEACMS.GlobalScripts/Service/GlobalScriptsProviderService.cs index e28e094c..a01a6816 100644 --- a/src/ZKEACMS.GlobalScripts/Service/GlobalScriptsProviderService.cs +++ b/src/ZKEACMS.GlobalScripts/Service/GlobalScriptsProviderService.cs @@ -41,11 +41,11 @@ public virtual void Handle(object entity, EventArg e) htmlContentBuilder.AppendHtml(script.Script); if (script.Location == (int)ScriptLocation.Header) { - applicationContext.HeaderPart.Add(htmlContentBuilder); + applicationContext.CurrentPage.Header.Add(htmlContentBuilder); } else { - applicationContext.FooterPart.Add(htmlContentBuilder); + applicationContext.CurrentPage.BodyFooter.Add(htmlContentBuilder); } } else @@ -56,11 +56,11 @@ public virtual void Handle(object entity, EventArg e) htmlContentBuilder.AppendHtml(""); if (script.Location == (int)ScriptLocation.Header) { - applicationContext.HeaderPart.Add(htmlContentBuilder); + applicationContext.CurrentPage.Header.Add(htmlContentBuilder); } else { - applicationContext.FooterPart.Add(htmlContentBuilder); + applicationContext.CurrentPage.BodyFooter.Add(htmlContentBuilder); } } } diff --git a/src/ZKEACMS.PinNav/Service/PinNavScriptsService.cs b/src/ZKEACMS.PinNav/Service/PinNavScriptsService.cs index befd230d..7ead4481 100644 --- a/src/ZKEACMS.PinNav/Service/PinNavScriptsService.cs +++ b/src/ZKEACMS.PinNav/Service/PinNavScriptsService.cs @@ -35,14 +35,12 @@ public void Handle(object entity, EventArg e) HtmlContentBuilder styleBuilder = new HtmlContentBuilder(); HtmlContentBuilder scriptBuilder = new HtmlContentBuilder(); #if DEBUG - styleBuilder.AppendHtml(""); - scriptBuilder.AppendHtml(""); + applicationContext.CurrentPage.StyleSheets.Add(new Page.StyleSheetTag("/Plugins/ZKEACMS.PinNav/Content/pin-nav.css")); + applicationContext.CurrentPage.FooterScripts.Add(new Page.ScriptTag("/Plugins/ZKEACMS.PinNav/Scripts/pin-nav.js")); #else - styleBuilder.AppendHtml(""); - scriptBuilder.AppendHtml(""); + applicationContext.CurrentPage.StyleSheets.Add(new Page.StyleSheetTag("/Plugins/ZKEACMS.PinNav/Content/pin-nav.min.css")); + applicationContext.CurrentPage.FooterScripts.Add(new Page.ScriptTag("/Plugins/ZKEACMS.PinNav/Scripts/pin-nav.min.js")); #endif - applicationContext.HeaderPart.Add(styleBuilder); - applicationContext.FooterPart.Add(scriptBuilder); } } } diff --git a/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs b/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs index 5fd1afca..84d1ae6e 100644 --- a/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs +++ b/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs @@ -18,6 +18,8 @@ using ZKEACMS.StructuredData; using Easy.Cache; using Microsoft.Extensions.Caching.Memory; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Easy.Serializer; namespace ZKEACMS.Product.Service { @@ -113,8 +115,11 @@ private void AddStructuredDataToPageHeader(ProductEntity product) Description = product.Description, MPN = product.PartNumber }; - IHtmlContent jsonLinkingData = HtmlHelper.SerializeToJsonLinkingData(structuredData); - ApplicationContext.CurrentAppContext().HeaderPart.Add(jsonLinkingData); + ApplicationContext.CurrentAppContext().CurrentPage.HeaderScripts.Add(new Page.ScriptTag() + { + Type = "application/ld+json", + InnerScript = new HtmlString(JsonConverter.Serialize(structuredData)) + }); } private IEnumerable GetImages(ProductEntity product) { diff --git a/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml index 95528315..81fa3793 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml @@ -19,6 +19,10 @@ + @foreach (var item in appContext.CurrentPage.Meta) + { + @item.Render() + } @if (appContext.OuterChainPicture) { @@ -31,7 +35,7 @@ @StyleAtHead() @ScriptAtHead() - @foreach (var item in appContext.HeaderPart) + @foreach (var item in appContext.CurrentPage.Header) { @item } @@ -54,6 +58,18 @@ } } + @foreach (var item in appContext.CurrentPage.StyleSheets) + { + @item.Render() + } + @foreach (var item in appContext.CurrentPage.Style) + { + @item.Render() + } + @foreach (var item in appContext.CurrentPage.HeaderScripts) + { + @item.Render() + }
- @StyleAtFoot() - @ScriptAtFoot() - @if (!Model.Script.IsNullOrEmpty()) - { - - } - @foreach (var script in Model.Page.Scripts) - { - - } @await Html.PartialAsync("Partial.PageFooter") From 0152a9e07de318d4c3364dc7bca3b64d7f053647 Mon Sep 17 00:00:00 2001 From: wayne Date: Fri, 11 Oct 2024 20:59:56 +0800 Subject: [PATCH 23/28] Simplify page header --- .../Service/ArticleDetailWidgetService.cs | 8 +--- .../ArticleSpecialDetailWidgetService.cs | 6 +-- .../Service/ArticleTypeWidgetService.cs | 6 +-- .../Service/ProductCategoryWidgetService.cs | 6 +-- .../Service/ProductDetailWidgetService.cs | 9 ++--- .../SectionContentVideoController.cs | 2 + .../Views/Shared/Partial.PageHeader.cshtml | 8 ++++ .../Views/Shared/_AdminLayout.cshtml | 20 ++-------- .../Views/Shared/_CustomerCenterLayout.cshtml | 20 ++-------- .../Views/Shared/_DesignLayout.cshtml | 30 ++------------ .../Views/Shared/_DesignPageLayout.cshtml | 3 +- .../Views/Shared/_EmptyLayout.cshtml | 18 +++------ .../Views/Shared/_Layout.cshtml | 6 --- .../Views/Shared/_LayoutGeneric.cshtml | 30 ++------------ .../Views/Shared/_LayoutNormal.cshtml | 33 ++------------- .../Views/Shared/_PopUpClientLayout.cshtml | 30 ++------------ .../Views/Shared/_PopUpLayout.cshtml | 17 ++------ src/ZKEACMS/Controllers/AccountController.cs | 2 + src/ZKEACMS/Controllers/ErrorController.cs | 2 + src/ZKEACMS/Controllers/LayoutController.cs | 21 +++++++++- src/ZKEACMS/Filter/ThemedAttribute.cs | 40 +++++++++++++++++++ src/ZKEACMS/Filter/WidgetAttribute.cs | 4 +- src/ZKEACMS/Page/IPageContext.cs | 14 ++++--- src/ZKEACMS/Page/MetaTag.cs | 1 + src/ZKEACMS/Page/PageContext.cs | 19 +++++++++ src/ZKEACMS/Page/PageEntity.cs | 18 --------- 26 files changed, 139 insertions(+), 234 deletions(-) create mode 100644 src/ZKEACMS/Filter/ThemedAttribute.cs diff --git a/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs b/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs index 0dbfa2cd..39347c01 100644 --- a/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs +++ b/src/ZKEACMS.Article/Service/ArticleDetailWidgetService.cs @@ -113,12 +113,8 @@ public override object Display(WidgetDisplayContext widgetDisplayContext) return null; } - var layout = widgetDisplayContext.PageLayout; - if (layout != null && layout.Page != null) - { - layout.Page.ConfigSEO(viewModel.Current.Title, viewModel.Current.MetaKeyWords, viewModel.Current.MetaDescription); - AddStructuredDataToPageHeader(viewModel.Current); - } + ApplicationContext.As().CurrentPage.ConfigSEO(viewModel.Current.Title, viewModel.Current.MetaKeyWords, viewModel.Current.MetaDescription); + AddStructuredDataToPageHeader(viewModel.Current); return viewModel; } private void AddStructuredDataToPageHeader(ArticleEntity article) diff --git a/src/ZKEACMS.Article/Service/ArticleSpecialDetailWidgetService.cs b/src/ZKEACMS.Article/Service/ArticleSpecialDetailWidgetService.cs index dfa75ce5..c8593d0a 100644 --- a/src/ZKEACMS.Article/Service/ArticleSpecialDetailWidgetService.cs +++ b/src/ZKEACMS.Article/Service/ArticleSpecialDetailWidgetService.cs @@ -45,11 +45,7 @@ public override object Display(WidgetDisplayContext widgetDisplayContext) else { _articleService.IncreaseCount(article); - var layout = widgetDisplayContext.PageLayout; - if (layout != null && layout.Page != null) - { - layout.Page.ConfigSEO(article.Title, article.MetaKeyWords, article.MetaDescription); - } + ApplicationContext.As().CurrentPage.ConfigSEO(article.Title, article.MetaKeyWords, article.MetaDescription); } viewModel.Current = article; diff --git a/src/ZKEACMS.Article/Service/ArticleTypeWidgetService.cs b/src/ZKEACMS.Article/Service/ArticleTypeWidgetService.cs index 608a807a..e26b7062 100644 --- a/src/ZKEACMS.Article/Service/ArticleTypeWidgetService.cs +++ b/src/ZKEACMS.Article/Service/ArticleTypeWidgetService.cs @@ -72,11 +72,7 @@ public override object Display(WidgetDisplayContext widgetDisplayContext) } if (articleType != null && articleType.SEOTitle.IsNotNullAndWhiteSpace()) { - var layout = widgetDisplayContext.PageLayout; - if (layout != null && layout.Page != null) - { - layout.Page.ConfigSEO(articleType.SEOTitle, articleType.SEOKeyWord, articleType.SEODescription); - } + _articleTypeService.ApplicationContext.As().CurrentPage.ConfigSEO(articleType.SEOTitle, articleType.SEOKeyWord, articleType.SEODescription); } return new ArticleTypeWidgetViewModel { diff --git a/src/ZKEACMS.Product/Service/ProductCategoryWidgetService.cs b/src/ZKEACMS.Product/Service/ProductCategoryWidgetService.cs index 2930a53b..7716b6ba 100644 --- a/src/ZKEACMS.Product/Service/ProductCategoryWidgetService.cs +++ b/src/ZKEACMS.Product/Service/ProductCategoryWidgetService.cs @@ -71,11 +71,7 @@ public override object Display(WidgetDisplayContext widgetDisplayContext) } if (productCategory != null && productCategory.SEOTitle.IsNotNullAndWhiteSpace()) { - var layout = widgetDisplayContext.PageLayout; - if (layout != null && layout.Page != null) - { - layout.Page.ConfigSEO(productCategory.SEOTitle, productCategory.SEOKeyWord, productCategory.SEODescription); - } + ApplicationContext.As().CurrentPage.ConfigSEO(productCategory.SEOTitle, productCategory.SEOKeyWord, productCategory.SEODescription); } return new ProductCategoryWidgetViewModel { diff --git a/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs b/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs index 84d1ae6e..8deeb9ff 100644 --- a/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs +++ b/src/ZKEACMS.Product/Service/ProductDetailWidgetService.cs @@ -97,12 +97,9 @@ public override object Display(WidgetDisplayContext widgetDisplayContext) return null; } - var layout = widgetDisplayContext.PageLayout; - if (layout != null && layout.Page != null) - { - layout.Page.ConfigSEO(product.SEOTitle ?? product.Title, product.SEOKeyWord, product.SEODescription); - AddStructuredDataToPageHeader(product); - } + ApplicationContext.As().CurrentPage.ConfigSEO(product.SEOTitle ?? product.Title, product.SEOKeyWord, product.SEODescription); + AddStructuredDataToPageHeader(product); + return product; } diff --git a/src/ZKEACMS.SectionWidget/Controllers/SectionContentVideoController.cs b/src/ZKEACMS.SectionWidget/Controllers/SectionContentVideoController.cs index c1f26cb5..5e25c6d7 100644 --- a/src/ZKEACMS.SectionWidget/Controllers/SectionContentVideoController.cs +++ b/src/ZKEACMS.SectionWidget/Controllers/SectionContentVideoController.cs @@ -9,6 +9,7 @@ using Easy.Mvc.Authorize; using Easy.Extend; using System.Text.RegularExpressions; +using ZKEACMS.Filter; namespace ZKEACMS.SectionWidget.Controllers { @@ -62,6 +63,7 @@ public JsonResult Delete(string Id) return Json(true); } + [Themed] public ActionResult Play(string Id) { SectionContentVideo video = _sectionContentProviderService.GetContent(Id) as SectionContentVideo; diff --git a/src/ZKEACMS.WebHost/Views/Shared/Partial.PageHeader.cshtml b/src/ZKEACMS.WebHost/Views/Shared/Partial.PageHeader.cshtml index cc328482..5506290e 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/Partial.PageHeader.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/Partial.PageHeader.cshtml @@ -7,13 +7,21 @@ { Script.Reqiured(item).AtFoot(); } + var favicon = applicationSettingService.Get(SettingKeys.Favicon, "~/favicon.ico"); } +@inject IApplicationSettingService applicationSettingService + + @this.WorkContext().CurrentPage.Title + + + + @if (this.WorkContext().OuterChainPicture) { diff --git a/src/ZKEACMS.WebHost/Views/Shared/_AdminLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_AdminLayout.cshtml index a915b301..0824343d 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_AdminLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_AdminLayout.cshtml @@ -8,25 +8,13 @@ Style.Reqiured("admin").AtHead(); Script.Reqiured("admin").AtHead(); List menus = adminMenuProvider.GetAdminMenus().ToList(); + this.WorkContext().CurrentPage.Title = ZKEACMS.Version.CurrentVersion + " " + ZKEACMS.Version.Rank; } @inject IOptions cultureOption - - - @(ZKEACMS.Version.CurrentVersion + " " + ZKEACMS.Version.Rank) - - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@@ -143,7 +131,6 @@
-
@if (ViewContext.ModelState.GetFieldValidationState("Unknown") == ModelValidationState.Invalid) @@ -157,7 +144,6 @@
- @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") diff --git a/src/ZKEACMS.WebHost/Views/Shared/_CustomerCenterLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_CustomerCenterLayout.cshtml index 55c6e0ba..4e6892b2 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_CustomerCenterLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_CustomerCenterLayout.cshtml @@ -6,26 +6,14 @@ Style.Reqiured("Customer").AtHead(); Style.Reqiured("Easy").AtHead(); IEnumerable menu = userCenterLinkService.GetLinks(); + this.WorkContext().CurrentPage.Title = ViewBag.Title; } @inject IUserCenterLinkService userCenterLinkService @inject IOptions cultureOption - - - @ViewBag.Title - - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@@ -72,9 +60,7 @@ @RenderBody()
-
- @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") \ No newline at end of file diff --git a/src/ZKEACMS.WebHost/Views/Shared/_DesignLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_DesignLayout.cshtml index d68b2c65..9587f57b 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_DesignLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_DesignLayout.cshtml @@ -7,28 +7,14 @@ Script.Reqiured("admin").AtFoot(); Script.Reqiured("code-editor").AtFoot(); Model.ContainerClass = Model.ContainerClass ?? "container"; + this.WorkContext().CurrentPage.Title = $"[{L("Design")}]{Model.LayoutName}"; } @model LayoutEntity @inject IOptions cultureOption - - - - - - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - [@L("Design")]@Model.LayoutName - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@@ -121,11 +107,6 @@ @await Html.PartialAsync("Layout/Templates") - @if (!Model.Style.IsNullOrEmpty()) - { - - - } - @if (!Model.Script.IsNullOrEmpty()) - { - - } - @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") diff --git a/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml index 7e257cb9..356060a3 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_DesignPageLayout.cshtml @@ -8,13 +8,12 @@ { return; } + this.WorkContext().CurrentPage.Title = $"[{L("Design")}]{Model.Page.Title}"; } @inject IOptions cultureOption - [@L("Design")]@Model.Page.Title - @await Html.PartialAsync("Partial.PageHeader") diff --git a/src/ZKEACMS.WebHost/Views/Shared/_EmptyLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_EmptyLayout.cshtml index ce7092f7..07d9337d 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_EmptyLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_EmptyLayout.cshtml @@ -1,25 +1,17 @@ @using Microsoft.AspNetCore.Hosting @using Microsoft.Extensions.Hosting +@{ + this.WorkContext().CurrentPage.Title = ViewBag.Title; +} - @ViewBag.Title - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@RenderBody()
- @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") diff --git a/src/ZKEACMS.WebHost/Views/Shared/_Layout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_Layout.cshtml index ff774c62..3a8395bf 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_Layout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_Layout.cshtml @@ -14,10 +14,6 @@ - @Model.Page.Title - - - @await Html.PartialAsync("Partial.PageHeader") @@ -97,11 +93,9 @@ } } -
@RenderBody()
@await Html.PartialAsync("Partial.PageFooter") - \ No newline at end of file diff --git a/src/ZKEACMS.WebHost/Views/Shared/_LayoutGeneric.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_LayoutGeneric.cshtml index f9552986..de5d49f0 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_LayoutGeneric.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_LayoutGeneric.cshtml @@ -3,40 +3,16 @@ @using Microsoft.Extensions.Options @using Easy.Options @{ - ThemeEntity theme = themeService.GetCurrentTheme(); - if (theme == null) - { - Style.Reqiured("bootStrap").AtHead(); - } + this.WorkContext().CurrentPage.Title = ViewBag.Title; } -@inject IThemeService themeService @inject IOptions cultureOption - - - @ViewBag.Title - - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() - @if (theme != null) - { - string themeFile = ApplicationContext.HostingEnvironment.IsDevelopment() ? theme.UrlDebugger : theme.Url; - - } + @await Html.PartialAsync("Partial.PageHeader") @RenderBody() - @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") \ No newline at end of file diff --git a/src/ZKEACMS.WebHost/Views/Shared/_LayoutNormal.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_LayoutNormal.cshtml index fac867bd..b8e1f417 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_LayoutNormal.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_LayoutNormal.cshtml @@ -3,45 +3,18 @@ @using Microsoft.Extensions.Options @using Easy.Options @{ - ThemeEntity theme = themeService.GetCurrentTheme(); - if (theme == null) - { - Style.Reqiured("bootStrap").AtHead(); - } + this.WorkContext().CurrentPage.Title = ViewBag.Title; } -@inject IThemeService themeService @inject IOptions cultureOption - - - @ViewBag.Title - - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() - @if (theme != null && ApplicationContext.HostingEnvironment.IsDevelopment()) - { - - } - else - { - - } + @await Html.PartialAsync("Partial.PageHeader")
@RenderBody()
- @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") \ No newline at end of file diff --git a/src/ZKEACMS.WebHost/Views/Shared/_PopUpClientLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_PopUpClientLayout.cshtml index 98d4a9b3..9710e791 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_PopUpClientLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_PopUpClientLayout.cshtml @@ -1,41 +1,17 @@ @using Microsoft.AspNetCore.Hosting @using Microsoft.Extensions.Hosting @{ - var theme = themeService.GetCurrentTheme(); + this.WorkContext().CurrentPage.Title = ViewBag.Title; } -@inject IThemeService themeService - - @ViewBag.Title - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @if (theme != null) - { - if (ApplicationContext.HostingEnvironment.IsDevelopment()) - { - - } - else - { - - } - } - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@RenderBody()
- @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter") diff --git a/src/ZKEACMS.WebHost/Views/Shared/_PopUpLayout.cshtml b/src/ZKEACMS.WebHost/Views/Shared/_PopUpLayout.cshtml index 62fbec0b..45fd8630 100644 --- a/src/ZKEACMS.WebHost/Views/Shared/_PopUpLayout.cshtml +++ b/src/ZKEACMS.WebHost/Views/Shared/_PopUpLayout.cshtml @@ -3,23 +3,13 @@ Script.Reqiured("admin").AtHead(); Style.Reqiured("bootStrap").AtHead(); Style.Reqiured("admin").AtHead(); + this.WorkContext().CurrentPage.Title = ViewBag.Title; } - - @ViewBag.Title - @if (this.WorkContext().OuterChainPicture) - { - - } - @if (this.WorkContext().EnableResponsiveDesign) - { - - } - @StyleAtHead() - @ScriptAtHead() + @await Html.PartialAsync("Partial.PageHeader")
@@ -32,8 +22,7 @@
} - @StyleAtFoot() - @ScriptAtFoot() + @await Html.PartialAsync("Partial.PageFooter")