Skip to content

Commit

Permalink
plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
starlying committed May 13, 2020
1 parent 2b9e43b commit 187db19
Show file tree
Hide file tree
Showing 146 changed files with 1,286 additions and 2,859 deletions.
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/ModalCheckState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Page_Load(object sender, EventArgs e)
_contentId = AuthRequest.GetQueryInt("contentID");
_returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl"));

var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelId, _contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelId, _contentId);

int checkedLevel;
var isChecked = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, SiteId, out checkedLevel);
Expand Down
8 changes: 4 additions & 4 deletions SiteServer.BackgroundPages/Cms/ModalContentAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
foreach (var contentId in _idList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
if (contentInfo != null)
{
if (CbIsRecommend.Checked)
Expand Down Expand Up @@ -98,7 +98,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
foreach (var contentId in _idList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
if (contentInfo != null)
{
if (CbIsRecommend.Checked)
Expand Down Expand Up @@ -133,7 +133,7 @@ public override void Submit_OnClick(object sender, EventArgs e)

foreach (var contentId in _idList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
if (contentInfo != null)
{
contentInfo.Hits = hits;
Expand All @@ -151,7 +151,7 @@ public override void Submit_OnClick(object sender, EventArgs e)

foreach (var contentId in _idList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
if (contentInfo != null)
{
contentInfo.Downloads = downloads;
Expand Down
11 changes: 8 additions & 3 deletions SiteServer.BackgroundPages/Cms/ModalContentCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public override void Submit_OnClick(object sender, EventArgs e)

foreach (var contentId in contentIdList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, channelInfo, contentId);
if (contentInfo != null)
{
if (CheckManager.IsCheckable(contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser))
Expand Down Expand Up @@ -166,9 +166,14 @@ public override void Submit_OnClick(object sender, EventArgs e)
foreach (var channelId in idsDictionaryToCheck.Keys)
{
var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
var contentIdList = idsDictionaryToCheck[channelId];
DataProvider.ContentDao.UpdateIsChecked(tableName, SiteInfo, channelInfo, contentIdList, translateChannelId, AuthRequest.AdminName, isChecked, checkedLevel, TbCheckReasons.Text);
DataProvider.ContentDao.UpdateIsChecked(tableName, SiteId, channelId, contentIdList, translateChannelId, AuthRequest.AdminName, isChecked, checkedLevel, TbCheckReasons.Text);
}

if (translateChannelId > 0)
{
var tableName = ChannelManager.GetTableName(SiteInfo, translateChannelId);
ContentManager.RemoveCache(SiteInfo.Id, translateChannelId, tableName);
}

AuthRequest.AddSiteLog(SiteId, SiteId, 0, "设置内容状态为" + DdlCheckType.SelectedItem.Text, TbCheckReasons.Text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
var targetTableName = ChannelManager.GetTableName(targetSiteInfo, targetChannelId);
foreach (var contentId in _contentIdList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelId, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelId, contentId);
FileUtility.MoveFileByContentInfo(SiteInfo, targetSiteInfo, contentInfo);
contentInfo.SiteId = targetSiteId;
contentInfo.SourceId = contentInfo.ChannelId;
Expand Down
4 changes: 2 additions & 2 deletions SiteServer.BackgroundPages/Cms/ModalContentTaxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
if (isUp)
{
if (DataProvider.ContentDao.SetTaxisToUp(SiteInfo, _tableName, nodeInfo, contentId, isTop) == false)
if (DataProvider.ContentDao.SetTaxisToUp(SiteId, _tableName, _channelId, contentId, isTop) == false)
{
break;
}
}
else
{
if (DataProvider.ContentDao.SetTaxisToDown(SiteInfo, _tableName, nodeInfo, contentId, isTop) == false)
if (DataProvider.ContentDao.SetTaxisToDown(SiteId, _tableName, _channelId, contentId, isTop) == false)
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/ModalContentTidyUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
_tableName = ChannelManager.GetTableName(SiteInfo, channelInfo);

DataProvider.ContentDao.UpdateArrangeTaxis(SiteInfo, _tableName, channelInfo, DdlAttributeName.SelectedValue, TranslateUtils.ToBool(DdlIsDesc.SelectedValue));
DataProvider.ContentDao.UpdateArrangeTaxis(SiteId, _tableName, channelId, DdlAttributeName.SelectedValue, TranslateUtils.ToBool(DdlIsDesc.SelectedValue));

LayerUtils.CloseAndRedirect(Page, _returnUrl);
}
Expand Down
4 changes: 2 additions & 2 deletions SiteServer.BackgroundPages/Cms/ModalContentView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void Page_Load(object sender, EventArgs e)
_contentId = AuthRequest.GetQueryInt("id");
_returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl"));

_contentInfo = DataProvider.ContentDao.Get(SiteInfo, channelInfo, _contentId);
_contentInfo = ContentManager.GetContentInfo(SiteInfo, channelInfo, _contentId);

if (IsPostBack) return;

Expand Down Expand Up @@ -90,7 +90,7 @@ public void Page_Load(object sender, EventArgs e)
{
var referenceSiteId = DataProvider.ChannelDao.GetSiteId(_contentInfo.SourceId);
var referenceSiteInfo = SiteManager.GetSiteInfo(referenceSiteId);
var referenceContentInfo = DataProvider.ContentDao.Get(referenceSiteInfo, _contentInfo.SourceId, _contentInfo.ReferenceId);
var referenceContentInfo = ContentManager.GetContentInfo(referenceSiteInfo, _contentInfo.SourceId, _contentInfo.ReferenceId);

if (referenceContentInfo != null)
{
Expand Down
14 changes: 6 additions & 8 deletions SiteServer.BackgroundPages/Cms/PageChannelDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public void Page_Load(object sender, EventArgs e)
if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ChannelDelete)) continue;

var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
//var adminId = AuthRequest.AdminPermissionsImpl.GetAdminId(SiteId, channelId);
var adminId = AuthRequest.AdminPermissionsImpl.GetAdminId(SiteId, channelId);
var displayName = channelInfo.ChannelName;
var count = DataProvider.ContentDao.GetCount(SiteInfo, channelInfo);
var count = ContentManager.GetCount(SiteInfo, channelInfo, adminId);
if (count > 0)
{
displayName += $"({count})";
Expand Down Expand Up @@ -119,11 +119,10 @@ public void Delete_OnClick(object sender, EventArgs e)

foreach (var channelId in channelIdListToDelete)
{
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo);
var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
var contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelId);
DeleteManager.DeleteContents(SiteInfo, channelId, contentIdList);
DataProvider.ContentDao.UpdateTrashContents(SiteInfo, channelInfo, tableName, contentIdList);
DataProvider.ContentDao.UpdateTrashContents(SiteId, channelId, tableName, contentIdList);
}

AuthRequest.AddSiteLog(SiteId, "清空栏目下的内容", $"栏目:{builder}");
Expand All @@ -142,9 +141,8 @@ public void Delete_OnClick(object sender, EventArgs e)

foreach (var channelId in channelIdListToDelete)
{
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo);
DataProvider.ContentDao.UpdateTrashContentsByChannelId(SiteInfo, channelInfo, tableName);
var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
DataProvider.ContentDao.UpdateTrashContentsByChannelId(SiteId, channelId, tableName);
DataProvider.ChannelDao.Delete(SiteId, channelId);
}

Expand Down
4 changes: 2 additions & 2 deletions SiteServer.BackgroundPages/Cms/PageChannelTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public string GetTitle(ChannelInfo channelInfo)
}
str = string.Concat(str, channelInfo.IsLastNode ? "└" : "├");
str = string.Concat(str, channelInfo.ChannelName);
//var adminId = AuthRequest.AdminPermissionsImpl.GetAdminId(SiteId, channelInfo.Id);
var count = DataProvider.ContentDao.GetCount(SiteInfo, channelInfo);
var adminId = AuthRequest.AdminPermissionsImpl.GetAdminId(SiteId, channelInfo.Id);
var count = ContentManager.GetCount(SiteInfo, channelInfo, adminId);
if (count != 0)
{
str = $"{str} ({count})";
Expand Down
5 changes: 2 additions & 3 deletions SiteServer.BackgroundPages/Cms/PageContentAdd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void Page_Load(object sender, EventArgs e)
if (contentId > 0)
{
//contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
contentInfo = DataProvider.ContentDao.GetCacheContentInfo(_tableName, _channelInfo.Id, contentId);
}

var titleFormat = IsPostBack ? Request.Form[ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)] : contentInfo?.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title));
Expand Down Expand Up @@ -331,12 +331,11 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
LogUtils.AddErrorLog(ex);
FailMessage($"内容添加失败:{ex.Message}");
return;
}
}
else
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
try
{
contentInfo.LastEditUserName = AuthRequest.AdminName;
Expand Down
9 changes: 4 additions & 5 deletions SiteServer.BackgroundPages/Cms/PageContentDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void Page_Load(object sender, EventArgs e)
var contentIdList = _idsDictionary[channelId];
foreach (var contentId in contentIdList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, channelId, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, channelId, contentId);
if (contentInfo != null)
{
builder.Append(
Expand Down Expand Up @@ -129,8 +129,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
{
foreach (var channelId in _idsDictionary.Keys)
{
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo);
var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
var contentIdList = _idsDictionary[channelId];

if (!_isDeleteFromTrash)
Expand Down Expand Up @@ -158,7 +157,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
$"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, channelId)},内容条数:{contentIdList.Count}");
}

DataProvider.ContentDao.UpdateTrashContents(SiteInfo, channelInfo, tableName, contentIdList);
DataProvider.ContentDao.UpdateTrashContents(SiteId, channelId, tableName, contentIdList);

//引用内容,需要删除
//var siteTableNameList = SiteManager.GetTableNameList();
Expand All @@ -181,7 +180,7 @@ public override void Submit_OnClick(object sender, EventArgs e)

foreach (var contentId in contentIdList)
{
ContentUtility.Delete(tableName, SiteInfo, channelInfo, contentId);
ContentUtility.Delete(tableName, SiteInfo, channelId, contentId);
}

AuthRequest.AddSiteLog(SiteId, "从回收站清空内容", $"内容条数:{contentIdList.Count}");
Expand Down
38 changes: 14 additions & 24 deletions SiteServer.BackgroundPages/Cms/PageContentSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,17 @@ public void Page_Load(object sender, EventArgs e)
AuthRequest.AdminPermissionsImpl,
allAttributeNameList);

if (_isTrashOnly || _isWritingOnly || !string.IsNullOrEmpty(keyword))
PgContents.Param = new PagerParam
{
PgContents.Param = new PagerParam
{
ControlToPaginate = RptContents,
TableName = tableName,
//PageSize = SiteInfo.Additional.PageSize,
PageSize = 20,
Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
OrderSqlString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allAttributeNameList),
WhereSqlString = whereString,
TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(tableName, whereString)
};
}
ControlToPaginate = RptContents,
TableName = tableName,
PageSize = SiteInfo.Additional.PageSize,
Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
OrderSqlString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allAttributeNameList),
WhereSqlString = whereString,
TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(tableName, whereString)
};

if (IsPostBack) return;

Expand All @@ -145,8 +141,7 @@ public void Page_Load(object sender, EventArgs e)
var list = DataProvider.ContentDao.GetContentIdListByTrash(SiteId, tableName);
foreach (var (contentChannelId, contentId) in list)
{
var channelInfo = ChannelManager.GetChannelInfo(SiteId, contentChannelId);
ContentUtility.Delete(tableName, SiteInfo, channelInfo, contentId);
ContentUtility.Delete(tableName, SiteInfo, contentChannelId, contentId);
}

AuthRequest.AddSiteLog(SiteId, "清空回收站");
Expand All @@ -157,17 +152,15 @@ public void Page_Load(object sender, EventArgs e)
var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString);
foreach (var channelId in idsDictionary.Keys)
{
var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
var channelTableName = ChannelManager.GetTableName(SiteInfo, channelInfo);
var contentIdList = idsDictionary[channelId];
DataProvider.ContentDao.UpdateTrashContents(SiteInfo, channelInfo, channelTableName, contentIdList);
DataProvider.ContentDao.UpdateTrashContents(SiteId, channelId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdList);
}
AuthRequest.AddSiteLog(SiteId, "从回收站还原内容");
SuccessMessage("成功还原内容!");
}
else if (AuthRequest.IsQueryExists("IsRestoreAll"))
{
DataProvider.ContentDao.UpdateRestoreContentsByTrash(SiteInfo, _channelInfo, tableName);
DataProvider.ContentDao.UpdateRestoreContentsByTrash(SiteId, _channelId, tableName);
AuthRequest.AddSiteLog(SiteId, "从回收站还原所有内容");
SuccessMessage("成功还原所有内容!");
}
Expand Down Expand Up @@ -206,10 +199,7 @@ public void Page_Load(object sender, EventArgs e)
TbDateFrom.Text = dateFrom;
TbDateTo.Text = dateTo;

if (_isTrashOnly || _isWritingOnly || !string.IsNullOrEmpty(keyword))
{
PgContents.DataBind();
}
PgContents.DataBind();

LtlColumnsHead.Text += TextUtility.GetColumnsHeadHtml(_styleInfoList, _pluginColumns, _attributesOfDisplay);

Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/PageContentTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Page_Load(object sender, EventArgs e)
{
foreach (var contentId in contentIdList)
{
var contentInfo = DataProvider.ContentDao.Get(SiteInfo, channelId, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, channelId, contentId);
if (contentInfo != null)
{
builder.Append(
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/Cms/PageContentsGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Page_Load(object sender, EventArgs e)
{
var contentId = AuthRequest.GetQueryInt("contentId");

var contentInfo = DataProvider.ContentDao.Get(SiteInfo, _channelInfo, contentId);
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
var groupList = TranslateUtils.StringCollectionToStringList(contentInfo.GroupNameCollection);
if (groupList.Contains(_contentGroupName))
{
Expand Down
Loading

0 comments on commit 187db19

Please sign in to comment.