public string GetSelectStringOfContentId(int inputId, string whereString) { var orderByString = ETaxisTypeUtils.GetInputContentOrderByString(ETaxisType.OrderByTaxisDesc); string where = $"WHERE (InputID = {inputId} {whereString}) {orderByString}"; return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TableName, "ID, Taxis", where)); }
public static void UpdateCache(SiteInfo siteInfo, ChannelInfo channelInfo, IContentInfo contentInfoToUpdate) { var dict = ContentCache.GetContentDict(channelInfo.Id); var contentInfo = GetContentInfo(siteInfo, channelInfo, contentInfoToUpdate.Id); if (contentInfo != null) { var isClearCache = contentInfo.IsTop != contentInfoToUpdate.IsTop; if (!isClearCache) { var orderAttributeName = ETaxisTypeUtils.GetContentOrderAttributeName( ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)); if (contentInfo.Get(orderAttributeName) != contentInfoToUpdate.Get(orderAttributeName)) { isClearCache = true; } } if (isClearCache) { ListCache.Remove(channelInfo.Id); } } dict[contentInfoToUpdate.Id] = (ContentInfo)contentInfoToUpdate; StlContentCache.ClearCache(); }
public List <int> GetContentIdListWithChecked(int inputId, List <string> searchFields, string keyword) { var contentIdList = new List <int>(); var taxisString = ETaxisTypeUtils.GetInputContentOrderByString(ETaxisType.OrderByTaxisDesc); var whereStringBuilder = new StringBuilder(); foreach (var field in searchFields) { if (!string.IsNullOrEmpty(field)) { whereStringBuilder.Append($" {field} LIKE '%{PageUtils.FilterSql(keyword)}%' OR"); } } if (whereStringBuilder.Length > 0) { whereStringBuilder.Remove(whereStringBuilder.Length - 3, 3); } string sqlString = $"SELECT ID FROM {TableName} WHERE (InputID = {inputId} AND IsChecked = '{true}' AND ({whereStringBuilder})) {taxisString}"; using (var rdr = ExecuteReader(sqlString)) { while (rdr.Read()) { contentIdList.Add(GetInt(rdr, 0)); } rdr.Close(); } return(contentIdList); }
public static string GetContentOrderByString(int siteId, string orderValue, ETaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDate.ToLower())) { taxisType = ETaxisType.OrderByLastEditDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDateBack.ToLower())) { taxisType = ETaxisType.OrderByLastEditDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByDay.ToLower())) { taxisType = ETaxisType.OrderByHitsByDay; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByWeek.ToLower())) { taxisType = ETaxisType.OrderByHitsByWeek; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByMonth.ToLower())) { taxisType = ETaxisType.OrderByHitsByMonth; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } return(ETaxisTypeUtils.GetContentOrderByString(taxisType, orderByString)); }
public string GetContentOrderByString(int siteId, string orderValue, TaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderDefault)) { taxisType = TaxisType.OrderByTaxisDesc; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderBack)) { taxisType = TaxisType.OrderByTaxis; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderAddDate)) { taxisType = TaxisType.OrderByAddDateDesc; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderAddDateBack)) { taxisType = TaxisType.OrderByAddDate; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderLastModifiedDate)) { taxisType = TaxisType.OrderByLastModifiedDateDesc; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderLastModifiedDateBack)) { taxisType = TaxisType.OrderByLastModifiedDate; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderHits)) { taxisType = TaxisType.OrderByHits; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderHitsByDay)) { taxisType = TaxisType.OrderByHitsByDay; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderHitsByWeek)) { taxisType = TaxisType.OrderByHitsByWeek; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderHitsByMonth)) { taxisType = TaxisType.OrderByHitsByMonth; } else if (StringUtils.EqualsIgnoreCase(orderValue, StlParserUtility.OrderRandom)) { taxisType = TaxisType.OrderByRandom; } else { orderByString = orderValue; } } return(ETaxisTypeUtils.GetContentOrderByString(taxisType, orderByString)); }
private static async Task CreateContentsAsync(int siteId, int channelId) { var siteInfo = SiteManager.GetSiteInfo(siteId); var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); var tableName = ChannelManager.GetTableName(siteInfo, channelInfo); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc); var contentIdList = StlContentCache.GetContentIdListChecked(tableName, channelId, orderByString); foreach (var contentId in contentIdList) { await CreateContentAsync(siteInfo, channelInfo, contentId); } }
public void CreateContents(int nodeId) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, nodeId, orderByString); foreach (var contentId in contentIdList) { CreateContent(tableStyle, tableName, nodeId, contentId); } }
public static bool IsChanged(ChannelInfo channelInfo, ContentInfo contentInfo1, ContentInfo contentInfo2) { if (contentInfo1.IsTop != contentInfo2.IsTop) { return(true); } var orderAttributeName = ETaxisTypeUtils.GetContentOrderAttributeName( ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)); return(contentInfo1.Get(orderAttributeName) != contentInfo2.Get(orderAttributeName)); }
public override void Submit_OnClick(object sender, EventArgs e) { var isUp = DdlTaxisType.SelectedValue == "Up"; var taxisNum = TranslateUtils.ToInt(TbTaxisNum.Text); var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (ETaxisTypeUtils.Equals(nodeInfo.Additional.DefaultTaxisType, ETaxisType.OrderByTaxis)) { isUp = !isUp; } if (isUp == false) { _contentIdList.Reverse(); } foreach (var contentId in _contentIdList) { var tuple = DataProvider.ContentDao.GetValue(_tableName, contentId, ContentAttribute.IsTop); if (tuple == null) { continue; } var isTop = TranslateUtils.ToBool(tuple.Item2); for (var i = 1; i <= taxisNum; i++) { if (isUp) { if (DataProvider.ContentDao.SetTaxisToUp(SiteId, _tableName, _channelId, contentId, isTop) == false) { break; } } else { if (DataProvider.ContentDao.SetTaxisToDown(SiteId, _tableName, _channelId, contentId, isTop) == false) { break; } } } } CreateManager.TriggerContentChangedEvent(SiteId, _channelId); AuthRequest.AddSiteLog(SiteId, _channelId, 0, "对内容排序", string.Empty); LayerUtils.CloseAndRedirect(Page, _returnUrl); }
public static void Add(ChannelInfo channelInfo, ContentInfo contentInfo) { if (ETaxisTypeUtils.Equals(ETaxisType.OrderByTaxisDesc, channelInfo.Additional.DefaultTaxisType)) { var contentIdList = GetContentIdList(channelInfo.Id, null); contentIdList.Insert(0, contentInfo.Id); contentIdList = GetContentIdList(channelInfo.Id, contentInfo.AdminId); contentIdList.Insert(0, contentInfo.Id); } else { Remove(channelInfo.Id); } }
public List <int> GetContentIdListWithChecked(int inputId) { var list = new List <int>(); var taxisString = ETaxisTypeUtils.GetInputContentOrderByString(ETaxisType.OrderByTaxisDesc); string sqlString = $"SELECT ID FROM {TableName} WHERE (InputID = {inputId} AND IsChecked = '{true}') {taxisString}"; using (var rdr = ExecuteReader(sqlString)) { while (rdr.Read()) { list.Add(GetInt(rdr, 0)); } rdr.Close(); } return(list); }
private void TranslateContent(int channelId, int targetSiteId, int targetChannelId) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxis); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByString); var translateType = RblIsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(RblIsDeleteAfterTranslate.SelectedValue, EBoolean.True) ? ETranslateContentType.Cut : ETranslateContentType.Copy; foreach (var contentId in contentIdList) { ContentUtility.Translate(SiteInfo, channelId, contentId, targetSiteId, targetChannelId, translateType); } }
private static async Task CreateContentsAsync(int siteId, int channelId) { var siteInfo = SiteManager.GetSiteInfo(siteId); var nodeInfo = ChannelManager.GetChannelInfo(siteId, channelId); var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc); var contentIdList = Content.GetContentIdListChecked(tableName, channelId, orderByString); foreach (var contentId in contentIdList) { try { await CreateContentAsync(siteInfo, tableName, channelId, contentId); } catch (Exception ex) { LogUtils.AddSystemErrorLog(ex, "CreateContent"); } } }
/// <summary> /// 导出栏目及栏目下内容至XML文件 /// </summary> /// <returns></returns> public void Export(int publishmentSystemId, int nodeId, bool isSaveContents) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId); if (nodeInfo == null) { return; } var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var fileName = DataProvider.NodeDao.GetOrderStringInPublishmentSystem(nodeId); var filePath = _siteContentDirectoryPath + PathUtils.SeparatorChar + fileName + ".xml"; var feed = ExportNodeInfo(nodeInfo); if (isSaveContents) { var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxis); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, nodeId, orderByString); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); //ContentUtility.PutImagePaths(publishmentSystemInfo, contentInfo as BackgroundContentInfo, collection); var entry = ExportContentInfo(contentInfo); feed.Entries.Add(entry); } } feed.Save(filePath); // foreach (string imageUrl in collection.Keys) // { // string sourceFilePath = collection[imageUrl]; // string destFilePath = PathUtility.MapPath(this.siteContentDirectoryPath, imageUrl); // DirectoryUtils.CreateDirectoryIfNotExists(destFilePath); // FileUtils.MoveFile(sourceFilePath, destFilePath, true); // } }
public void Export(int siteId, int channelId, bool isSaveContents) { var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); if (channelInfo == null) { return; } var siteInfo = SiteManager.GetSiteInfo(siteId); var tableName = ChannelManager.GetTableName(siteInfo, channelInfo); var fileName = DataProvider.ChannelDao.GetOrderStringInSite(channelId); var filePath = _siteContentDirectoryPath + PathUtils.SeparatorChar + fileName + ".xml"; var feed = _channelIe.ExportNodeInfo(channelInfo); if (isSaveContents) { var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxis); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByString); foreach (var contentId in contentIdList) { var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId); //ContentUtility.PutImagePaths(siteInfo, contentInfo as BackgroundContentInfo, collection); var entry = _contentIe.ExportContentInfo(contentInfo); feed.Entries.Add(entry); } } feed.Save(filePath); // foreach (string imageUrl in collection.Keys) // { // string sourceFilePath = collection[imageUrl]; // string destFilePath = PathUtility.MapPath(this.siteContentDirectoryPath, imageUrl); // DirectoryUtils.CreateDirectoryIfNotExists(destFilePath); // FileUtils.MoveFile(sourceFilePath, destFilePath, true); // } }
private void TranslateContent(SiteInfo targetSiteInfo, int channelId, int targetChannelId, bool isChecked, int checkedLevel) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxis); var targetTableName = ChannelManager.GetTableName(targetSiteInfo, targetChannelId); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByString); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId); FileUtility.MoveFileByContentInfo(SiteInfo, targetSiteInfo, contentInfo); contentInfo.SiteId = TranslateUtils.ToInt(DdlSiteId.SelectedValue); contentInfo.SourceId = contentInfo.ChannelId; contentInfo.ChannelId = targetChannelId; contentInfo.IsChecked = isChecked; contentInfo.CheckedLevel = checkedLevel; var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo); if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetSiteInfo.Id, contentInfo.ChannelId, theContentId); } } if (RblIsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(RblIsDeleteAfterTranslate.SelectedValue, EBoolean.True)) { try { DataProvider.ContentDao.TrashContents(SiteId, tableName, contentIdList, channelId); } catch { // ignored } } }
public static string GetChannelOrderByString(int siteId, string orderValue, ETaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } return ETaxisTypeUtils.GetChannelOrderByString(taxisType, orderByString, null); }
public void CreateContents(int nodeId) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, nodeId, orderByString); //foreach (var contentId in contentIdList) //{ // CreateContent(tableStyle, tableName, nodeId, contentId); //} if (PublishmentSystemInfo.Additional.IsCreateMultiThread) // 多线程并发生成页面 { for (int i = 0; i < contentIdList.Count; i = i + 3) { var list = new List <int>(); list.Add(contentIdList[i]); if (i < contentIdList.Count - 1) { list.Add(contentIdList[i + 1]); } if (i < contentIdList.Count - 2) { list.Add(contentIdList[i + 2]); } Parallel.ForEach(list, contentId => CreateContent(tableStyle, tableName, nodeId, contentId)); } } else // 单线程生成页面 { foreach (var contentId in contentIdList) { CreateContent(tableStyle, tableName, nodeId, contentId); } } }
public static void InsertCache(SiteInfo siteInfo, ChannelInfo channelInfo, IContentInfo contentInfo) { if (contentInfo.SourceId == SourceManager.Preview) { return; } var contentIdList = ListCache.GetContentIdList(channelInfo.Id); if (ETaxisTypeUtils.Equals(ETaxisType.OrderByTaxisDesc, channelInfo.Additional.DefaultTaxisType)) { contentIdList.Insert(0, contentInfo.Id); } else { ListCache.Remove(channelInfo.Id); } var dict = ContentCache.GetContentDict(contentInfo.ChannelId); dict[contentInfo.Id] = (ContentInfo)contentInfo; var tableName = ChannelManager.GetTableName(siteInfo, channelInfo); var countInfoList = GetContentCountInfoList(tableName); var countInfo = countInfoList.FirstOrDefault(x => x.SiteId == siteInfo.Id && x.ChannelId == channelInfo.Id && x.IsChecked == contentInfo.IsChecked.ToString() && x.CheckedLevel == contentInfo.CheckedLevel); if (countInfo != null) { countInfo.Count++; } StlContentCache.ClearCache(); CountCache.Clear(tableName); }
private void TranslateContent(PublishmentSystemInfo targetPublishmentSystemInfo, int nodeID, int targetNodeID, bool isChecked, int checkedLevel) { var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeID); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeID); var orderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxis); var targetTableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeID); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, nodeID, orderByString); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); FileUtility.MoveFileByContentInfo(PublishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = TranslateUtils.ToInt(PublishmentSystemIDDropDownList.SelectedValue); contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeID; contentInfo.IsChecked = isChecked; contentInfo.CheckedLevel = checkedLevel; var theContentID = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentID); } } if (IsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(IsDeleteAfterTranslate.SelectedValue, EBoolean.True)) { try { DataProvider.ContentDao.TrashContents(PublishmentSystemId, tableName, contentIdList, nodeID); } catch { } } }
public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo) { var parsedContent = string.Empty; try { var ie = node.Attributes.GetEnumerator(); var version = string.Empty; var title = string.Empty; var description = string.Empty; var scopeTypeString = string.Empty; var groupChannel = string.Empty; var groupChannelNot = string.Empty; var groupContent = string.Empty; var groupContentNot = string.Empty; var tags = string.Empty; var channelIndex = string.Empty; var channelName = string.Empty; var totalNum = 0; var startNum = 1; var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc); var isTop = false; var isTopExists = false; var isRecommend = false; var isRecommendExists = false; var isHot = false; var isHotExists = false; var isColor = false; var isColorExists = false; while (ie.MoveNext()) { var attr = (XmlAttribute)ie.Current; var attributeName = attr.Name.ToLower(); if (attributeName.Equals(Attribute_Version)) { version = attr.Value; } else if (attributeName.Equals(Attribute_Title)) { title = attr.Value; } else if (attributeName.Equals(Attribute_Description)) { description = attr.Value; } else if (attributeName.Equals(Attribute_Scope)) { scopeTypeString = attr.Value; } else if (attributeName.Equals(Attribute_ChannelIndex)) { channelIndex = attr.Value; } else if (attributeName.Equals(Attribute_ChannelName)) { channelName = attr.Value; } else if (attributeName.Equals(Attribute_GroupChannel)) { groupChannel = attr.Value; } else if (attributeName.Equals(Attribute_GroupChannelNot)) { groupChannelNot = attr.Value; } else if (attributeName.Equals(Attribute_GroupContent)) { groupContent = attr.Value; } else if (attributeName.Equals(Attribute_GroupContentNot)) { groupContentNot = attr.Value; } else if (attributeName.Equals(Attribute_Tags)) { tags = attr.Value; } else if (attributeName.Equals(Attribute_TotalNum)) { totalNum = TranslateUtils.ToInt(attr.Value); } else if (attributeName.Equals(Attribute_StartNum)) { startNum = TranslateUtils.ToInt(attr.Value, 1); } else if (attributeName.Equals(Attribute_Order)) { orderByString = StlDataUtility.GetOrderByString(pageInfo.PublishmentSystemId, attr.Value, ETableStyle.BackgroundContent, ETaxisType.OrderByTaxisDesc); } else if (attributeName.Equals(Attribute_IsTop)) { isTopExists = true; isTop = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsRecommend)) { isRecommendExists = true; isRecommend = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsHot)) { isHotExists = true; isHot = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsColor)) { isColorExists = true; isColor = TranslateUtils.ToBool(attr.Value); } } parsedContent = ParseImpl(pageInfo, contextInfo, version, title, description, scopeTypeString, groupChannel, groupChannelNot, groupContent, groupContentNot, tags, channelIndex, channelName, totalNum, startNum, orderByString, isTop, isTopExists, isRecommend, isRecommendExists, isHot, isHotExists, isColor, isColorExists); } catch (Exception ex) { parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex); } return(parsedContent); }
public IHttpActionResult Submit() { try { var request = new RequestImpl(); var siteId = request.GetPostInt("siteId"); var channelId = request.GetPostInt("channelId"); var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds")); var isUp = request.GetPostBool("isUp"); var taxis = request.GetPostInt("taxis"); if (!request.IsUserLoggin || !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId, ConfigManager.ChannelPermissions.ContentEdit)) { return(Unauthorized()); } var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo == null) { return(BadRequest("无法确定内容对应的站点")); } var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); if (channelInfo == null) { return(BadRequest("无法确定内容对应的栏目")); } if (ETaxisTypeUtils.Equals(channelInfo.Additional.DefaultTaxisType, ETaxisType.OrderByTaxis)) { isUp = !isUp; } if (isUp == false) { contentIdList.Reverse(); } var tableName = ChannelManager.GetTableName(siteInfo, channelInfo); foreach (var contentId in contentIdList) { var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId); if (contentInfo == null) { continue; } var isTop = contentInfo.IsTop; for (var i = 1; i <= taxis; i++) { if (isUp) { if (DataProvider.ContentDao.SetTaxisToUp(tableName, channelId, contentId, isTop) == false) { break; } } else { if (DataProvider.ContentDao.SetTaxisToDown(tableName, channelId, contentId, isTop) == false) { break; } } } } CreateManager.TriggerContentChangedEvent(siteId, channelId); request.AddSiteLog(siteId, channelId, 0, "对内容排序", string.Empty); return(Ok(new { Value = contentIdList })); } catch (Exception ex) { LogUtils.AddErrorLog(ex); return(InternalServerError(ex)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); _jsMethod = Body.GetQueryString("jsMethod"); PageUtils.CheckRequestParameter("PublishmentSystemID"); var nodeId = Body.GetQueryInt("NodeID"); if (nodeId == 0) { nodeId = PublishmentSystemId; } _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeInfo.NodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.True, !IsDuplicate.Checked, false); } else { spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.True, !Body.GetQueryBool("IsDuplicate"), true); } spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SortField = ContentAttribute.Id; spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, EContentModelType.Content, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeInfo.NodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeInfo.NodeId.ToString()); } IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate"); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } spContents.DataBind(); } }
//对“flash滚动焦点图”(stl:focusViewer)元素进行解析 public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo) { var parsedContent = string.Empty; try { var genericControl = new HtmlGenericControl("div"); var ie = node.Attributes.GetEnumerator(); var channelIndex = string.Empty; var channelName = string.Empty; var scopeType = EScopeType.Self; var groupChannel = string.Empty; var groupChannelNot = string.Empty; var groupContent = string.Empty; var groupContentNot = string.Empty; var tags = string.Empty; var orderByString = ETaxisTypeUtils.GetOrderByString(ETableStyle.BackgroundContent, ETaxisType.OrderByTaxisDesc, string.Empty, null); var startNum = 1; var totalNum = 0; var isShowText = true; var isTopText = string.Empty; var titleWordNum = 0; var where = string.Empty; var isTop = false; var isTopExists = false; var isRecommend = false; var isRecommendExists = false; var isHot = false; var isHotExists = false; var isColor = false; var isColorExists = false; var theme = string.Empty; var imageWidth = 260; var imageHeight = 182; var textHeight = 25; var bgColor = string.Empty; var isDynamic = false; while (ie.MoveNext()) { var attr = (XmlAttribute)ie.Current; var attributeName = attr.Name.ToLower(); if (attributeName.Equals(Attribute_ChannelIndex)) { channelIndex = attr.Value; } else if (attributeName.Equals(Attribute_ChannelName)) { channelName = attr.Value; } else if (attributeName.Equals(Attribute_Scope)) { scopeType = EScopeTypeUtils.GetEnumType(attr.Value); } else if (attributeName.Equals(Attribute_GroupChannel)) { groupChannel = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo); } else if (attributeName.Equals(Attribute_GroupChannelNot)) { groupChannelNot = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo); } else if (attributeName.Equals(Attribute_GroupContent)) { groupContent = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo); } else if (attributeName.Equals(Attribute_GroupContentNot)) { groupContentNot = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo); } else if (attributeName.Equals(Attribute_Tags)) { tags = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo); } else if (attributeName.Equals(Attribute_Order)) { orderByString = StlDataUtility.GetOrderByString(pageInfo.PublishmentSystemId, attr.Value, ETableStyle.BackgroundContent, ETaxisType.OrderByTaxisDesc); } else if (attributeName.Equals(Attribute_StartNum)) { startNum = TranslateUtils.ToInt(attr.Value, 1); } else if (attributeName.Equals(Attribute_TotalNum)) { totalNum = TranslateUtils.ToInt(attr.Value); } else if (attributeName.Equals(Attribute_TitleWordNum)) { titleWordNum = TranslateUtils.ToInt(attr.Value); } else if (attributeName.Equals(Attribute_Where)) { where = attr.Value; } else if (attributeName.Equals(Attribute_IsTop)) { isTopExists = true; isTop = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsRecommend)) { isRecommendExists = true; isRecommend = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsHot)) { isHotExists = true; isHot = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_IsColor)) { isColorExists = true; isColor = TranslateUtils.ToBool(attr.Value); } else if (attributeName.Equals(Attribute_Theme)) { theme = attr.Value; } else if (attributeName.Equals(Attribute_Width)) { if (StringUtils.EndsWithIgnoreCase(attr.Value, "px")) { attr.Value = attr.Value.Substring(0, attr.Value.Length - 2); } imageWidth = TranslateUtils.ToInt(attr.Value); } else if (attributeName.Equals(Attribute_Height)) { if (StringUtils.EndsWithIgnoreCase(attr.Value, "px")) { attr.Value = attr.Value.Substring(0, attr.Value.Length - 2); } imageHeight = TranslateUtils.ToInt(attr.Value); } else if (attributeName.Equals(Attribute_BgColor)) { bgColor = attr.Value; } else if (attributeName.Equals(Attribute_IsShowText)) { isShowText = TranslateUtils.ToBool(attr.Value, true); } else if (attributeName.Equals(Attribute_IsTopText)) { isTopText = attr.Value; } else if (attributeName.Equals(Attribute_IsDynamic)) { isDynamic = TranslateUtils.ToBool(attr.Value); } else { genericControl.Attributes.Remove(attributeName); genericControl.Attributes.Add(attributeName, attr.Value); } } if (isDynamic) { parsedContent = StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo); } else { parsedContent = ParseImpl(pageInfo, contextInfo, genericControl, channelIndex, channelName, scopeType, groupChannel, groupChannelNot, groupContent, groupContentNot, tags, orderByString, startNum, totalNum, isShowText, isTopText, titleWordNum, where, isTop, isTopExists, isRecommend, isRecommendExists, isHot, isHotExists, isColor, isColorExists, theme, imageWidth, imageHeight, textHeight, bgColor); } } catch (Exception ex) { parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex); } return(parsedContent); }
public static int GetValue(PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { int firstContentId; var hashtable = GetHashtable(); if (hashtable[nodeInfo.NodeId] != null) { firstContentId = (int)hashtable[nodeInfo.NodeId]; } else { var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); firstContentId = BaiRongDataProvider.ContentDao.GetContentId(tableName, nodeInfo.NodeId, ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxisDesc)); hashtable[nodeInfo.NodeId] = firstContentId; } return(firstContentId); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _isMultiple = TranslateUtils.ToBool(Request.QueryString["isMultiple"]); _jsMethod = Request.QueryString["jsMethod"]; _itemIndex = TranslateUtils.ToInt(Request.QueryString["itemIndex"]); _isKeywordAdd = TranslateUtils.ToBool(Request.QueryString["isKeywordAdd"]); _keywordId = TranslateUtils.ToInt(Request.QueryString["keywordID"]); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { _nodeId = int.Parse(Request.QueryString["NodeID"]); } else { _nodeId = PublishmentSystemId; } _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId)); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); SpContents.ControlToPaginate = RptContents; if (string.IsNullOrEmpty(Request.QueryString["NodeID"])) { var pm = PermissionsManager.GetPermissions(Body.AdministratorName); var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false); } else { var pm = PermissionsManager.GetPermissions(Body.AdministratorName); var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]); SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], Request.QueryString["DateTo"], true, stateType, !TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]), false); } SpContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; SpContents.SortField = ContentAttribute.Id; SpContents.SortMode = SortMode.DESC; SpContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { NodeManager.AddListItems(NodeIdDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核"); //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIdDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(State, Request.QueryString["State"]); IsDuplicate.Checked = TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]); ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]); Keyword.Text = Request.QueryString["Keyword"]; DateFrom.Text = Request.QueryString["DateFrom"]; DateTo.Text = Request.QueryString["DateTo"]; } SpContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdminName); PageUtils.CheckRequestParameter("siteId"); _channelId = Body.GetQueryInt("channelId"); if (_channelId == 0) { _channelId = SiteId; } var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); SpContents.ControlToPaginate = RptContents; if (string.IsNullOrEmpty(Body.GetQueryString("channelId"))) { SpContents.ItemsPerPage = TranslateUtils.ToInt(DdlPageNum.SelectedValue) == 0 ? SiteInfo.Additional.PageSize : TranslateUtils.ToInt(DdlPageNum.SelectedValue); SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, DdlSearchType.SelectedValue, TbKeyword.Text, TbDateFrom.Text, TbDateTo.Text, true, ETriState.All, false, true); } else { SpContents.ItemsPerPage = Body.GetQueryInt("PageNum") == 0 ? SiteInfo.Additional.PageSize : Body.GetQueryInt("PageNum"); SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All, false, true); } SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += RptContents_ItemDataBound; if (!IsPostBack) { VerifySitePermissions(ConfigManager.Permissions.WebSite.ContentTrash); if (Body.IsQueryExists("IsDeleteAll")) { DataProvider.ContentDao.DeleteContentsByTrash(SiteId, tableName); Body.AddSiteLog(SiteId, "清空回收站"); SuccessMessage("成功清空回收站!"); AddWaitAndRedirectScript(PageUrl); return; } if (Body.IsQueryExists("IsRestore")) { var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); foreach (var channelId in idsDictionary.Keys) { var contentIdArrayList = idsDictionary[channelId]; DataProvider.ContentDao.TrashContents(SiteId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdArrayList); } Body.AddSiteLog(SiteId, "从回收站还原内容"); SuccessMessage("成功还原内容!"); AddWaitAndRedirectScript(PageUrl); return; } if (Body.IsQueryExists("IsRestoreAll")) { DataProvider.ContentDao.RestoreContentsByTrash(SiteId, tableName); Body.AddSiteLog(SiteId, "从回收站还原所有内容"); SuccessMessage("成功还原所有内容!"); AddWaitAndRedirectScript(PageUrl); return; } ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, false, Body.AdminName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } } //添加隐藏属性 DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("channelId")) { if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlPageNum, Body.GetQueryString("PageNum")); ControlUtils.SelectSingleItem(DdlSearchType, Body.GetQueryString("SearchType")); TbKeyword.Text = Body.GetQueryString("Keyword"); TbDateFrom.Text = Body.GetQueryString("DateFrom"); TbDateTo.Text = Body.GetQueryString("DateTo"); } SpContents.DataBind(); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete)) { BtnDelete.Visible = false; BtnDeleteAll.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, true, PageUrl)); BtnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?")); } BtnRestore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!")); BtnRestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?")); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); _nodeId = Body.GetQueryInt("NodeID"); if (_nodeId == 0) { _nodeId = PublishmentSystemId; } var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, this._nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, this._nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { if (TranslateUtils.ToInt(PageNum.SelectedValue) == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.All, false, true); } else { if (Body.GetQueryInt("PageNum") == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = Body.GetQueryInt("PageNum"); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All, false, true); } spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容回收站", AppManager.Cms.Permission.WebSite.ContentTrash); if (Body.IsQueryExists("IsDeleteAll")) { BaiRongDataProvider.ContentDao.DeleteContentsByTrash(PublishmentSystemId, tableName); Body.AddSiteLog(PublishmentSystemId, "清空回收站"); SuccessMessage("成功清空回收站!"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestore")) { var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); foreach (var nodeID in idsDictionary.Keys) { var contentIDArrayList = idsDictionary[nodeID]; DataProvider.ContentDao.TrashContents(PublishmentSystemId, NodeManager.GetTableName(PublishmentSystemInfo, nodeID), contentIDArrayList); } Body.AddSiteLog(PublishmentSystemId, "从回收站还原内容"); SuccessMessage("成功还原内容!"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestoreAll")) { DataProvider.ContentDao.RestoreContentsByTrash(PublishmentSystemId, tableName); Body.AddSiteLog(PublishmentSystemId, "从回收站还原所有内容"); SuccessMessage("成功还原所有内容!"); AddWaitAndRedirectScript(PageUrl); return; } NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, false, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum")); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } spContents.DataBind(); } if (!HasChannelPermissions(this._nodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { Delete.Visible = false; DeleteAll.Visible = false; } else { Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, true, PageUrl)); DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?")); } Restore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!")); RestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?")); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID"); var nodeID = Body.GetQueryInt("NodeID"); relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeID); nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); if (nodeInfo.Additional.IsPreviewContents) { new Action(() => { DataProvider.ContentDao.DeletePreviewContents(PublishmentSystemId, tableName, nodeInfo); }).BeginInvoke(null, null); } if (!HasChannelPermissions(nodeID, AppManager.Cms.Permission.Channel.ContentView, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentEdit, AppManager.Cms.Permission.Channel.ContentDelete, AppManager.Cms.Permission.Channel.ContentTranslate)) { if (!Body.IsAdministratorLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的操作权限!"); return; } attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeID)); //this.attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(this.nodeInfo.Additional.ContentAttributesOfDisplay); spContents.ControlToPaginate = rptContents; rptContents.ItemDataBound += rptContents_ItemDataBound; spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, nodeID) ? Body.AdministratorName : string.Empty; if (Body.IsQueryExists("SearchType")) { var owningNodeIdList = new List <int> { nodeID }; spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableName, PublishmentSystemId, nodeID, permissions.IsSystemAdministrator, owningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName); } else { spContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectCommend(tableName, nodeID, ETriState.All, administratorName); } spContents.SortField = BaiRongDataProvider.ContentDao.GetSortFieldName(); spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc); //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum spContents.IsQueryTotalCount = false; spContents.TotalCount = nodeInfo.ContentNum; if (!IsPostBack) { var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID); BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty); ltlContentButtons.Text = WebUtils.GetContentCommands(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrl, GetRedirectUrl(PublishmentSystemId, nodeInfo.NodeId), false); spContents.DataBind(); if (styleInfoList != null) { foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); SearchType.Items.Add(new ListItem("内容组", ContentAttribute.ContentGroupNameCollection)); if (Body.IsQueryExists("SearchType")) { DateFrom.Text = Body.GetQueryString("DateFrom"); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); ltlContentButtons.Text += @" <script> $(document).ready(function() { $('#contentSearch').show(); }); </script> "; } ltlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(styleInfoList, attributesOfDisplay, tableStyle, PublishmentSystemInfo); ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, tableStyle, PublishmentSystemInfo, nodeInfo); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl"); _channelId = AuthRequest.GetQueryInt("channelId"); _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); CacAttributes.SiteInfo = SiteInfo; CacAttributes.ChannelId = _channelId; if (!IsPostBack) { if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ChannelEdit)) { PageUtils.RedirectToErrorPage("您没有修改栏目的权限!"); return; } var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (nodeInfo == null) { return; } if (nodeInfo.ParentId == 0) { PhLinkUrl.Visible = false; PhLinkType.Visible = false; PhChannelTemplateId.Visible = false; PhFilePath.Visible = false; } BtnSubmit.Attributes.Add("onclick", $"if (UE && UE.getEditor('Content', {ETextEditorTypeUtils.ConfigValues})){{ UE.getEditor('Content', {ETextEditorTypeUtils.ConfigValues}).sync(); }}"); CacAttributes.Attributes = nodeInfo.Additional; if (PhLinkType.Visible) { ELinkTypeUtils.AddListItems(DdlLinkType); } ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType); CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId); if (PhChannelTemplateId.Visible) { DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate); } DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate); DataBind(); if (PhChannelTemplateId.Visible) { DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString()); } DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString()); TbNodeName.Text = nodeInfo.ChannelName; TbNodeIndexName.Text = nodeInfo.IndexName; if (PhLinkUrl.Visible) { TbLinkUrl.Text = nodeInfo.LinkUrl; } foreach (ListItem item in CblNodeGroupNameCollection.Items) { item.Selected = StringUtils.In(nodeInfo.GroupNameCollection, item.Value); } if (PhFilePath.Visible) { TbFilePath.Text = nodeInfo.FilePath; } if (PhLinkType.Visible) { ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType); } ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType); TbImageUrl.Text = nodeInfo.ImageUrl; LtlImageUrlButtonGroup.Text = WebUtils.GetImageUrlButtonGroupHtml(SiteInfo, TbImageUrl.ClientID); TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content); if (TbKeywords.Visible) { TbKeywords.Text = nodeInfo.Keywords; } if (TbDescription.Visible) { TbDescription.Text = nodeInfo.Description; } } else { CacAttributes.Attributes = new ExtendedAttributes(Request.Form); } }