Skip to content

Commit

Permalink
tables
Browse files Browse the repository at this point in the history
  • Loading branch information
starlying committed Sep 10, 2018
1 parent 43370f9 commit 6ba682f
Show file tree
Hide file tree
Showing 90 changed files with 2,660 additions and 5,499 deletions.
16 changes: 7 additions & 9 deletions SiteServer.BackgroundPages/Ajax/AjaxCreateService.cs
Expand Up @@ -34,7 +34,7 @@ public static string GetCreateSiteUrl()
});
}

public static string GetCreateSiteParameters(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, string onlineTemplateName, bool isUseTables, string userKeyPrefix)
public static string GetCreateSiteParameters(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, string onlineTemplateName, string userKeyPrefix)
{
return TranslateUtils.NameValueCollectionToString(new NameValueCollection
{
Expand All @@ -43,7 +43,6 @@ public static string GetCreateSiteParameters(int siteId, bool isImportContents,
{"isImportTableStyles", isImportTableStyles.ToString()},
{"siteTemplateDir", siteTemplateDir},
{"onlineTemplateName", onlineTemplateName},
{"isUseTables", isUseTables.ToString()},
{"userKeyPrefix", userKeyPrefix}
});
}
Expand All @@ -67,15 +66,14 @@ public void Page_Load(object sender, EventArgs e)
var isImportTableStyles = TranslateUtils.ToBool(Request.Form["isImportTableStyles"]);
var siteTemplateDir = Request.Form["siteTemplateDir"];
var onlineTemplateName = Request.Form["onlineTemplateName"];
var isUseTables = TranslateUtils.ToBool(Request.Form["isUseTables"]);

if (!string.IsNullOrEmpty(siteTemplateDir))
{
retval = CreateSiteBySiteTemplateDir(siteId, isImportContents, isImportTableStyles, siteTemplateDir, isUseTables, userKeyPrefix, request.AdminName);
retval = CreateSiteBySiteTemplateDir(siteId, isImportContents, isImportTableStyles, siteTemplateDir, userKeyPrefix, request.AdminName);
}
else if (!string.IsNullOrEmpty(onlineTemplateName))
{
retval = CreateSiteByOnlineTemplateName(siteId, isImportContents, isImportTableStyles, onlineTemplateName, isUseTables, userKeyPrefix, request.AdminName);
retval = CreateSiteByOnlineTemplateName(siteId, isImportContents, isImportTableStyles, onlineTemplateName, userKeyPrefix, request.AdminName);
}
else
{
Expand All @@ -102,7 +100,7 @@ public void Page_Load(object sender, EventArgs e)
return retval;
}

public NameValueCollection CreateSiteBySiteTemplateDir(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, bool isUseTables, string userKeyPrefix, string administratorName)
public NameValueCollection CreateSiteBySiteTemplateDir(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, string userKeyPrefix, string administratorName)
{
var cacheTotalCountKey = userKeyPrefix + CacheTotalCount;
var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount;
Expand All @@ -123,7 +121,7 @@ public NameValueCollection CreateSiteBySiteTemplateDir(int siteId, bool isImport

CacheUtils.Insert(cacheCurrentCountKey, "2");//存储当前的页面总数
CacheUtils.Insert(cacheMessageKey, "正在导入数据...");//存储消息
SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isUseTables, isImportContents, isImportTableStyles, administratorName);
SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isImportContents, isImportTableStyles, administratorName);
CreateManager.CreateByAll(siteId);

CacheUtils.Insert(cacheCurrentCountKey, "3");//存储当前的页面总数
Expand All @@ -146,7 +144,7 @@ public NameValueCollection CreateSiteBySiteTemplateDir(int siteId, bool isImport
return retval;
}

public NameValueCollection CreateSiteByOnlineTemplateName(int siteId, bool isImportContents, bool isImportTableStyles, string onlineTemplateName, bool isUseTables, string userKeyPrefix, string administratorName)
public NameValueCollection CreateSiteByOnlineTemplateName(int siteId, bool isImportContents, bool isImportTableStyles, string onlineTemplateName, string userKeyPrefix, string administratorName)
{
var cacheTotalCountKey = userKeyPrefix + CacheTotalCount;
var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount;
Expand Down Expand Up @@ -180,7 +178,7 @@ public NameValueCollection CreateSiteByOnlineTemplateName(int siteId, bool isImp
CacheUtils.Insert(cacheCurrentCountKey, "3");//存储当前的页面总数
CacheUtils.Insert(cacheMessageKey, "站点模板下载成功,正在导入数据...");//存储消息

SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isUseTables, isImportContents, isImportTableStyles, administratorName);
SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isImportContents, isImportTableStyles, administratorName);
CreateManager.CreateByAll(siteId);

CacheUtils.Insert(cacheCurrentCountKey, "4");//存储当前的页面总数
Expand Down
14 changes: 2 additions & 12 deletions SiteServer.BackgroundPages/BasePage.cs
Expand Up @@ -217,19 +217,9 @@ public virtual void Submit_OnClick(object sender, EventArgs e)
LayerUtils.Close(Page);
}

public static string GetShowHintScript()
public static string PageLoading()
{
return GetShowHintScript("操作进行中");
}

public static string GetShowHintScript(string message)
{
return GetShowHintScript(message, 120);
}

public static string GetShowHintScript(string message, int top)
{
return $@"hideBoxAndShowHint(this, '{message}, 请稍候...', {top});";
return "pageUtils.loading(true);";
}

public void ClientScriptRegisterClientScriptBlock(string key, string script)
Expand Down
59 changes: 0 additions & 59 deletions SiteServer.BackgroundPages/Cms/ModalContentArchive.cs

This file was deleted.

2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/ModalTableStyleAdd.cs
Expand Up @@ -388,7 +388,7 @@ private bool InsertTableStyleInfo(InputType inputType)
return false;
}

_styleInfo = DataProvider.TableMetadataDao.IsExists(_tableName, TbAttributeName.Text) ? TableStyleManager.GetTableStyleInfo(_tableName, TbAttributeName.Text, _relatedIdentities) : new TableStyleInfo();
_styleInfo = TableColumnManager.IsAttributeNameExists(_tableName, TbAttributeName.Text) ? TableStyleManager.GetTableStyleInfo(_tableName, TbAttributeName.Text, _relatedIdentities) : new TableStyleInfo();

_styleInfo.RelatedIdentity = relatedIdentity;
_styleInfo.TableName = _tableName;
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/ModalUploadWord.cs
Expand Up @@ -89,7 +89,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
var contentInfo = new ContentInfo();

BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, styleInfoList, formCollection, ContentAttribute.AllAttributesLowercase);
BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, styleInfoList, formCollection, ContentAttribute.AllAttributes);

contentInfo.ChannelId = _channelInfo.Id;
contentInfo.SiteId = SiteId;
Expand Down
6 changes: 3 additions & 3 deletions SiteServer.BackgroundPages/Cms/PageContent.cs
Expand Up @@ -84,23 +84,23 @@ public void Page_Load(object sender, EventArgs e)

RptContents.ItemDataBound += RptContents_ItemDataBound;

var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(_tableName);
var allAttributeNameList = TableColumnManager.GetTableColumnNameList(_tableName, DataType.Text);
var pagerParam = new PagerParam
{
ControlToPaginate = RptContents,
TableName = _tableName,
PageSize = SiteInfo.Additional.PageSize,
Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
OrderSqlString = DataProvider.ContentDao.GetPagerOrderSqlString(_channelInfo),
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList)
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allAttributeNameList)
};

var administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, channelId) ? AuthRequest.AdminName : string.Empty;

if (AuthRequest.IsQueryExists("searchType"))
{
pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo, AuthRequest.GetQueryString("searchType"), AuthRequest.GetQueryString("keyword"),
AuthRequest.GetQueryString("dateFrom"), string.Empty, CheckManager.LevelInt.All, false, true, false, false, false, AuthRequest.AdminPermissions, allLowerAttributeNameList);
AuthRequest.GetQueryString("dateFrom"), string.Empty, CheckManager.LevelInt.All, false, true, false, false, false, AuthRequest.AdminPermissions, allAttributeNameList);
pagerParam.TotalCount =
DataProvider.DatabaseDao.GetPageTotalCount(_tableName, pagerParam.WhereSqlString);
}
Expand Down
4 changes: 2 additions & 2 deletions SiteServer.BackgroundPages/Cms/PageContentAdd.cs
Expand Up @@ -242,7 +242,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
contentInfo.LastEditUserName = contentInfo.AddUserName;
contentInfo.LastEditDate = DateTime.Now;

BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributesLowercase);
BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributes);

contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items);
var tagCollection = TagUtils.ParseTagsString(TbTags.Text);
Expand Down Expand Up @@ -330,7 +330,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
contentInfo.LastEditUserName = AuthRequest.AdminName;
contentInfo.LastEditDate = DateTime.Now;

BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributesLowercase);
BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributes);

contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items);
var tagCollection = TagUtils.ParseTagsString(TbTags.Text);
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/PageContentAddHandler.cs
Expand Up @@ -45,7 +45,7 @@ protected override object Process()

var form = AuthRequest.HttpRequest.Form;

BackgroundInputTypeParser.SaveAttributes(contentInfo, siteInfo, styleInfoList, form, ContentAttribute.AllAttributesLowercase);
BackgroundInputTypeParser.SaveAttributes(contentInfo, siteInfo, styleInfoList, form, ContentAttribute.AllAttributes);

//contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items);
var tagCollection = TagUtils.ParseTagsString(form["TbTags"]);
Expand Down
11 changes: 5 additions & 6 deletions SiteServer.BackgroundPages/Cms/PageContentDelete.cs
Expand Up @@ -7,7 +7,6 @@
using SiteServer.BackgroundPages.Core;
using SiteServer.CMS.Core;
using SiteServer.CMS.Core.Create;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Attributes;

namespace SiteServer.BackgroundPages.Cms
Expand Down Expand Up @@ -160,14 +159,14 @@ public override void Submit_OnClick(object sender, EventArgs e)
DataProvider.ContentDao.TrashContents(SiteId, tableName, contentIdList);

//引用内容,需要删除
var tableList = DataProvider.TableDao.GetTableCollectionInfoListCreatedInDb();
foreach (var table in tableList)
var siteTableNameList = SiteManager.GetTableNameList();
foreach (var siteTableName in siteTableNameList)
{
var targetContentIdList = DataProvider.ContentDao.GetReferenceIdList(table.TableName, contentIdList);
var targetContentIdList = DataProvider.ContentDao.GetReferenceIdList(siteTableName, contentIdList);
if (targetContentIdList.Count > 0)
{
var targetContentInfo = DataProvider.ContentDao.GetContentInfo(table.TableName, TranslateUtils.ToInt(targetContentIdList[0].ToString()));
DataProvider.ContentDao.DeleteContents(targetContentInfo.SiteId, table.TableName, targetContentIdList, targetContentInfo.ChannelId);
var targetContentInfo = DataProvider.ContentDao.GetContentInfo(siteTableName, TranslateUtils.ToInt(targetContentIdList[0].ToString()));
DataProvider.ContentDao.DeleteContents(targetContentInfo.SiteId, siteTableName, targetContentIdList, targetContentInfo.ChannelId);
}
}

Expand Down
6 changes: 3 additions & 3 deletions SiteServer.BackgroundPages/Cms/PageContentSearch.cs
Expand Up @@ -108,12 +108,12 @@ public void Page_Load(object sender, EventArgs e)

RptContents.ItemDataBound += RptContents_ItemDataBound;

var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName);
var allAttributeNameList = TableColumnManager.GetTableColumnNameList(tableName, DataType.Text);
var whereString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo,
searchType, keyword,
dateFrom, dateTo, state, _isCheckOnly, false, _isTrashOnly, _isWritingOnly, _isAdminOnly,
AuthRequest.AdminPermissions,
allLowerAttributeNameList);
allAttributeNameList);

PgContents.Param = new PagerParam
{
Expand All @@ -122,7 +122,7 @@ public void Page_Load(object sender, EventArgs e)
PageSize = SiteInfo.Additional.PageSize,
Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
OrderSqlString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList),
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allAttributeNameList),
WhereSqlString = whereString,
TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(tableName, whereString)
};
Expand Down
1 change: 0 additions & 1 deletion SiteServer.BackgroundPages/Cms/PageContentsGroup.cs
Expand Up @@ -8,7 +8,6 @@
using SiteServer.CMS.Core;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Attributes;
using SiteServer.Plugin;

namespace SiteServer.BackgroundPages.Cms
{
Expand Down
Binary file modified SiteServer.BackgroundPages/Cms/PageProgressBar.cs
Binary file not shown.
21 changes: 14 additions & 7 deletions SiteServer.BackgroundPages/Cms/PageTableStyleContent.cs
Expand Up @@ -5,6 +5,7 @@
using SiteServer.Utils;
using SiteServer.CMS.Core;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Attributes;

namespace SiteServer.BackgroundPages.Cms
{
Expand Down Expand Up @@ -65,7 +66,7 @@ public void Page_Load(object sender, EventArgs e)
}

InfoMessage(
$"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 内容表:{DataProvider.TableDao.GetDisplayName(_tableName)}({_tableName})");
$"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 内容表:{_tableName}");
ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, false, true, AuthRequest.AdminPermissions);
ControlUtils.SelectSingleItem(DdlChannelId, channelId.ToString());

Expand Down Expand Up @@ -103,16 +104,22 @@ private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)

ltlDisplayName.Text = styleInfo.DisplayName;
ltlInputType.Text = InputTypeUtils.GetText(styleInfo.InputType);
ltlFieldType.Text = TableMetadataManager.IsAttributeNameExists(_tableName, styleInfo.AttributeName) ? $"真实 {TableMetadataManager.GetTableMetadataDataType(_tableName, styleInfo.AttributeName)}" : "虚拟字段";

var columnInfo = TableColumnManager.GetTableColumnInfo(_tableName, styleInfo.AttributeName);

ltlFieldType.Text = columnInfo != null ? $"真实 {DataTypeUtils.GetText(columnInfo.DataType)}" : "虚拟字段";

ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo);

var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);
var editText = styleInfo.RelatedIdentity == _channelInfo.Id ? "修改" : "添加";
ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{editText}</a>";
if (!StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title))
{
var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);

showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);
ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";
ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";

showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);
ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";
}

ltlTaxis.Text = styleInfo.Taxis.ToString();

Expand Down

0 comments on commit 6ba682f

Please sign in to comment.