public static DataSet GetContentsDataSource(SiteInfo siteInfo, int channelId, int contentId, string groupContent, string groupContentNot, string tags, bool isImageExists, bool isImage, bool isVideoExists, bool isVideo, bool isFileExists, bool isFile, bool isRelatedContents, int startNum, int totalNum, string orderByString, bool isTopExists, bool isTop, bool isRecommendExists, bool isRecommend, bool isHotExists, bool isHot, bool isColorExists, bool isColor, string where, EScopeType scopeType, string groupChannel, string groupChannelNot, LowerNameValueCollection others) { if (!ChannelManager.IsExists(siteInfo.Id, channelId)) { return(null); } var nodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, channelId); var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); if (isRelatedContents && contentId > 0) { var isTags = false; var tagCollection = Content.GetValue(tableName, contentId, ContentAttribute.Tags); if (!string.IsNullOrEmpty(tagCollection)) { var contentIdList = Tag.GetContentIdListByTagCollection(TranslateUtils.StringCollectionToStringCollection(tagCollection), siteInfo.Id); if (contentIdList.Count > 0) { contentIdList.Remove(contentId); isTags = true; if (string.IsNullOrEmpty(where)) { where = $"ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdList)})"; } else { where += $" AND (ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdList)}))"; } } } if (!isTags) { if (string.IsNullOrEmpty(where)) { where = $"ID <> {contentId}"; } else { where += $" AND (ID <> {contentId})"; } } } var sqlWhereString = PluginManager.IsExists(nodeInfo.ContentModelPluginId) ? Content.GetStlWhereString(siteInfo.Id, groupContent, groupContentNot, tags, isTopExists, isTop, where) : Content.GetStlWhereString(siteInfo.Id, groupContent, groupContentNot, tags, isImageExists, isImage, isVideoExists, isVideo, isFileExists, isFile, isTopExists, isTop, isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where); var channelIdList = ChannelManager.GetChannelIdList(nodeInfo, scopeType, groupChannel, groupChannelNot, string.Empty); return(Content.GetStlDataSourceChecked(channelIdList, tableName, startNum, totalNum, orderByString, sqlWhereString, others)); }
public static string GetAttributeValue(string attributeValue, int index) { var collection = TranslateUtils.StringCollectionToStringCollection(attributeValue, '&'); if (index <= collection.Count) { return(collection[index - 1]); } return(string.Empty); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _relatedIdentity = AuthRequest.GetQueryInt("RelatedIdentity"); _isList = AuthRequest.GetQueryBool("IsList"); var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity); var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay); if (IsPostBack) { return; } var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities)); foreach (var styleInfo in styleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem($"{styleInfo.DisplayName}({styleInfo.AttributeName})", styleInfo.AttributeName); if (styleInfo.AttributeName == ContentAttribute.Title) { listitem.Selected = true; } else { if (_isList) { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } else { listitem.Selected = true; } } CblDisplayAttributes.Items.Add(listitem); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (IsPostBack) { return; } if (Body.IsQueryExists("RelatedFieldID")) { var relatedFieldId = Body.GetQueryInt("RelatedFieldID"); var relatedFieldInfo = DataProvider.RelatedFieldDao.GetRelatedFieldInfo(relatedFieldId); if (relatedFieldInfo != null) { TbRelatedFieldName.Text = relatedFieldInfo.Title; ControlUtils.SelectSingleItemIgnoreCase(DdlTotalLevel, relatedFieldInfo.TotalLevel.ToString()); if (!string.IsNullOrEmpty(relatedFieldInfo.Prefixes)) { var collection = TranslateUtils.StringCollectionToStringCollection(relatedFieldInfo.Prefixes); TbPrefix1.Text = collection[0]; TbPrefix2.Text = collection[1]; TbPrefix3.Text = collection[2]; TbPrefix4.Text = collection[3]; TbPrefix5.Text = collection[4]; } if (!string.IsNullOrEmpty(relatedFieldInfo.Suffixes)) { var collection = TranslateUtils.StringCollectionToStringCollection(relatedFieldInfo.Suffixes); TbSuffix1.Text = collection[0]; TbSuffix2.Text = collection[1]; TbSuffix3.Text = collection[2]; TbSuffix4.Text = collection[3]; TbSuffix5.Text = collection[4]; } } } DdlTotalLevel_SelectedIndexChanged(null, EventArgs.Empty); }
public ConfigInfo GetConfigInfo() { var info = new ConfigInfo { IsInitialized = false }; using (var rdr = ExecuteReader(SqlSelectConfig)) { if (rdr.Read()) { var i = 0; info = new ConfigInfo(GetBool(rdr, i++), GetString(rdr, i++), TranslateUtils.StringCollectionToStringCollection(GetString(rdr, i++)), TranslateUtils.StringCollectionToStringCollection(GetString(rdr, i++)), GetDateTime(rdr, i++), GetString(rdr, i++), GetString(rdr, i)); } rdr.Close(); } return(info); }
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); tableStyleInfoArrayList = TableStyleManager.GetTableStyleInfoArrayList(tableStyle, tableName, relatedIdentities); spContents.ControlToPaginate = rptContents; spContents.ConnectionString = BaiRongDataProvider.ConnectionString; if (string.IsNullOrEmpty(Request.QueryString["NodeID"])) { var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIDList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false); } else { var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]); spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.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 += new RepeaterItemEventHandler(rptContents_ItemDataBound); if (!IsPostBack) { BreadCrumb(AppManager.CMS.LeftMenu.ID_Content, "内容搜索", string.Empty); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true); if (tableStyleInfoArrayList != null) { foreach (TableStyleInfo styleInfo in tableStyleInfoArrayList) { 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; } PageUtils.CheckRequestParameter("siteId"); _channelId = AuthRequest.GetQueryInt("channelId"); var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(channelInfo.Additional.ContentAttributesOfDisplay); _pluginColumns = PluginContentManager.GetContentColumns(channelInfo); if (IsPostBack) { return; } var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities)); foreach (var styleInfo in styleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem($"{styleInfo.DisplayName}({styleInfo.AttributeName})", styleInfo.AttributeName); if (styleInfo.AttributeName == ContentAttribute.Title) { listitem.Selected = true; } else { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } CblDisplayAttributes.Items.Add(listitem); } if (_pluginColumns != null) { foreach (var pluginId in _pluginColumns.Keys) { var contentColumns = _pluginColumns[pluginId]; if (contentColumns == null || contentColumns.Count == 0) { continue; } foreach (var columnName in contentColumns.Keys) { var attributeName = $"{pluginId}:{columnName}"; var listitem = new ListItem($"{columnName}({pluginId})", attributeName); if (attributesOfDisplay.Contains(attributeName)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); } } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId; var permissions = PermissionsManager.GetPermissions(Body.AdminName); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo); _styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName); if (IsPostBack) { return; } var checkedLevel = 5; var isChecked = true; foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList) { int checkedLevelByChannelId; var isCheckedByChannelId = CheckManager.GetUserCheckLevel(Body.AdminName, SiteInfo, owningChannelId, out checkedLevelByChannelId); if (checkedLevel > checkedLevelByChannelId) { checkedLevel = checkedLevelByChannelId; } if (!isCheckedByChannelId) { isChecked = false; } } ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName); CheckManager.LoadContentLevelToList(DdlState, SiteInfo, SiteId, isChecked, checkedLevel); var checkLevelList = new List <int>(); if (!string.IsNullOrEmpty(Body.GetQueryString("channelId"))) { ControlUtils.SelectSingleItem(DdlChannelId, Body.GetQueryString("channelId")); } if (!string.IsNullOrEmpty(Body.GetQueryString("state"))) { ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("state")); checkLevelList.Add(Body.GetQueryInt("state")); } else { checkLevelList = CheckManager.LevelInt.GetCheckLevelList(SiteInfo, isChecked, checkedLevel); } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = SiteInfo.Additional.PageSize; var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo); var channelIdList = DataProvider.ChannelDao.GetIdListByScopeType(nodeInfo.Id, nodeInfo.ChildrenCount, EScopeType.All, string.Empty, string.Empty, nodeInfo.ContentModelPluginId); var list = new List <int>(); if (permissions.IsSystemAdministrator) { list = channelIdList; } else { var owningChannelIdList = new List <int>(); foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList) { if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, owningChannelId, ConfigManager.Permissions.Channel.ContentCheck)) { owningChannelIdList.Add(owningChannelId); } } foreach (var theChannelId in channelIdList) { if (owningChannelIdList.Contains(theChannelId)) { list.Add(theChannelId); } } } SpContents.SelectCommand = DataProvider.ContentDao.GetSelectedCommendByCheck(tableName, SiteId, list, checkLevelList); SpContents.SortField = ContentAttribute.LastEditDate; SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += RptContents_ItemDataBound; SpContents.DataBind(); var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); if (!HasChannelPermissions(SiteId, ConfigManager.Permissions.Channel.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId"); var channelId = AuthRequest.GetQueryInt("channelId"); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId); _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, channelId)); _attributesOfDisplayStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo); _isEdit = TextUtility.IsEdit(SiteInfo, channelId, AuthRequest.AdminPermissions); if (_channelInfo.Additional.IsPreviewContents) { new Action(() => { DataProvider.ContentDao.DeletePreviewContents(SiteId, _tableName, _channelInfo); }).BeginInvoke(null, null); } if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ContentView, ConfigManager.ChannelPermissions.ContentAdd, ConfigManager.ChannelPermissions.ContentEdit, ConfigManager.ChannelPermissions.ContentDelete, ConfigManager.ChannelPermissions.ContentTranslate)) { if (!AuthRequest.IsAdminLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的操作权限!"); return; } SpContents.ControlToPaginate = RptContents; RptContents.ItemDataBound += RptContents_ItemDataBound; SpContents.ItemsPerPage = SiteInfo.Additional.PageSize; var administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, channelId) ? AuthRequest.AdminName : string.Empty; if (AuthRequest.IsQueryExists("searchType")) { var owningChannelIdList = new List <int> { channelId }; SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(_tableName, SiteId, channelId, AuthRequest.AdminPermissions.IsSystemAdministrator, owningChannelIdList, AuthRequest.GetQueryString("searchType"), AuthRequest.GetQueryString("keyword"), AuthRequest.GetQueryString("dateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName); } else { SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(_tableName, channelId, ETriState.All, administratorName); } //spContents.SortField = DataProvider.ContentDao.GetSortFieldName(); //spContents.SortMode = SortMode.DESC; //spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc); SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(_channelInfo.Additional.DefaultTaxisType)); SpContents.TotalCount = _channelInfo.ContentNum; if (IsPostBack) { return; } LtlButtons.Text = WebUtils.GetContentCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); LtlMoreButtons.Text = WebUtils.GetContentMoreCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); SpContents.DataBind(); if (_styleInfoList != null) { foreach (var styleInfo in _styleInfoList) { 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)); DdlSearchType.Items.Add(new ListItem("内容组", ContentAttribute.GroupNameCollection)); if (AuthRequest.IsQueryExists("searchType")) { TbDateFrom.Text = AuthRequest.GetQueryString("dateFrom"); ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("searchType")); TbKeyword.Text = AuthRequest.GetQueryString("keyword"); if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("searchType")) || !string.IsNullOrEmpty(TbDateFrom.Text) || !string.IsNullOrEmpty(TbKeyword.Text)) { LtlButtons.Text += @" <script> $(document).ready(function() { $('#contentSearch').show(); }); </script> "; } } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("NodeID")) { _nodeId = Body.GetQueryInt("NodeID"); } else { _nodeId = PublishmentSystemId; } _isWritingOnly = Body.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = Body.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty; } _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(Body.GetQueryString("NodeID"))) { var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName); } else { var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State")); 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, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName); } 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) { var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索"; if (_isWritingOnly) { pageTitle = "投稿内容"; } BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate) { 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 (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(State, Body.GetQueryString("State")); 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"); } else { DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1)); DateTo.Text = DateUtils.GetDateString(DateTime.Now); } spContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId); AddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true); SelectButton.Attributes.Add("onclick", showPopWinString); if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl); Check.Attributes.Add("onclick", showPopWinString); } else { CheckPlaceHolder.Visible = false; } ltlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo); ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo); } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd)) { AddContent.Visible = false; } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate)) { Translate.Visible = false; } else { Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl)); } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { Delete.Visible = false; } else { Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl)); } }
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.AdministratorName); var mainPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(1); PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID"); var nodeID = Body.GetQueryInt("NodeID"); var childNodeId = Body.GetQueryInt("ChildNodeId"); relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeID); nodeInfo = NodeManager.GetNodeInfo(1, nodeID); tableName = NodeManager.GetTableName(mainPublishmentSystemInfo, nodeInfo); tableStyle = NodeManager.GetTableStyle(mainPublishmentSystemInfo, nodeInfo); styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); var styleInfoList2 = TableStyleManager.GetTableStyleInfoList(tableStyle, "siteserver_Node", relatedIdentities); Dictionary <string, string> category = DataProvider.NodeDao.GetNodeIdListLevel(2, nodeID); int contentNum = 0; 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") && Body.IsQueryExists("ChildNodeId")) { List <int> owningNodeIdList = new List <int> { nodeID, 3, 4, 6, 9 }; 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 { var test = tableName; List <int> nodeList = new List <int>(); nodeList.Add(nodeID); var firstChildList = DataProvider.NodeDao.GetNodeIdListByParentId(1, nodeID); if (firstChildList != null && firstChildList.Count > 0) { nodeList.AddRange(firstChildList); foreach (var firstchild in firstChildList) { var secondList = DataProvider.NodeDao.GetNodeIdListByParentId(1, firstchild); if (secondList != null && secondList.Count > 0) { nodeList.AddRange(secondList); } } } var nodeCollectionIdStr = string.Empty; foreach (int nodeId in nodeList) { nodeCollectionIdStr = nodeCollectionIdStr + nodeId + ','; contentNum = contentNum + DataProvider.NodeDao.GetNodeInfo(nodeId).ContentNum; } nodeCollectionIdStr = nodeCollectionIdStr.TrimEnd(','); spContents.SelectCommand = "select * from model_voluntaryservice where NodeId>0"; } spContents.SortField = BaiRongDataProvider.ContentDao.GetSortFieldName(); spContents.SortMode = SortMode.DESC; spContents.OrderByString = "ORDER BY Taxis Desc"; //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum spContents.IsQueryTotalCount = false; spContents.TotalCount = contentNum;//nodeInfo.ContentNum; if (!IsPostBack) { var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID); //BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty); ltlContentButtons.Text = WebUtils.GetContentCommandsStandard(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrlReturn, GetRedirectUrl(base.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); } } } var listitemAll = new ListItem("全部", nodeID.ToString()); ChannelCategory.Items.Add(listitemAll); if (category != null) { foreach (var chanelCategory in category) { var listitem = new ListItem(chanelCategory.Key, chanelCategory.Value); ChannelCategory.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; } 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; } var permissions = PermissionsManager.GetPermissions(Body.AdminName); PageUtils.CheckRequestParameter("SiteId"); _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId; _isWritingOnly = Body.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = Body.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, _channelId) ? Body.AdminName : string.Empty; } _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName); var stateType = Body.IsQueryExists("state") ? ETriStateUtils.GetEnumType(Body.GetQueryString("state")) : ETriState.All; var searchType = Body.IsQueryExists("searchType") ? Body.GetQueryString("searchType") : ContentAttribute.Title; var dateFrom = Body.IsQueryExists("dateFrom") ? Body.GetQueryString("dateFrom") : string.Empty; var dateTo = Body.IsQueryExists("dateTo") ? Body.GetQueryString("dateTo") : string.Empty; var isDuplicate = Body.IsQueryExists("isDuplicate") && Body.GetQueryBool("isDuplicate"); var keyword = Body.IsQueryExists("keyword") ? Body.GetQueryString("keyword") : string.Empty; SpContents.ControlToPaginate = RptContents; SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, !isDuplicate, false, _isWritingOnly, administratorName); SpContents.ItemsPerPage = SiteInfo.Additional.PageSize; SpContents.SortField = ContentAttribute.Id; SpContents.SortMode = SortMode.DESC; SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += RptContents_ItemDataBound; if (!IsPostBack) { ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName); DdlSearchType.Items.Add(new ListItem("标题", ContentAttribute.Title)); if (_styleInfoList != null) { foreach (var styleInfo in _styleInfoList) { if (styleInfo.AttributeName != ContentAttribute.AddDate) { 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)); ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核"); if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("State")); CbIsDuplicate.Checked = isDuplicate; ControlUtils.SelectSingleItem(DdlSearchType, searchType); TbKeyword.Text = keyword; TbDateFrom.Text = dateFrom; TbDateTo.Text = dateTo; SpContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId); BtnAddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true); BtnSelect.Attributes.Add("onclick", showPopWinString); if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, SiteId, ConfigManager.Permissions.Channel.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); } else { PhCheck.Visible = false; } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentAdd)) { BtnAddContent.Visible = false; } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentTranslate)) { BtnTranslate.Visible = false; } else { BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl)); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (AuthRequest.IsQueryExists("CreateChannelsOneByOne") && AuthRequest.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(SiteId, channelId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateContentsOneByOne") && AuthRequest.IsQueryExists("channelId") && AuthRequest.IsQueryExists("contentIdCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"))) { CreateManager.CreateContent(SiteId, AuthRequest.GetQueryInt("channelId"), contentId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByTemplate") && AuthRequest.IsQueryExists("templateID")) { CreateManager.CreateFile(SiteId, AuthRequest.GetQueryInt("templateID")); LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByIDsCollection") && AuthRequest.IsQueryExists("IDsCollection")) { foreach (var channelIdContentId in TranslateUtils.StringCollectionToStringCollection(AuthRequest.GetQueryString("IDsCollection"))) { var pair = channelIdContentId.Split('_'); CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var downloadUrl = TranslateUtils.DecryptStringBySecretKey(AuthRequest.GetQueryString("DownloadUrl")); var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(AuthRequest.GetQueryString("DirectoryName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateUnZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(AuthRequest.GetQueryString("FileName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("PluginDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetPluginDownloadParameters(AuthRequest.GetQueryString("DownloadUrl"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }
public void Page_Load(object sender, EventArgs e) { var permissioins = PermissionsManager.GetPermissions(Body.AdministratorName); _departmentId = TranslateUtils.ToInt(Request.QueryString["DepartmentID"]); _classCode = Request.QueryString["ClassCode"]; _categoryId = TranslateUtils.ToInt(Request.QueryString["CategoryID"]); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovPublicContent, PublishmentSystemInfo.AuxiliaryTableForGovPublic, relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId)); spContents.ControlToPaginate = rptContents; rptContents.ItemDataBound += rptContents_ItemDataBound; spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; if (Body.IsQueryExists("SearchType")) { var owningNodeIdList = new List <int> { PublishmentSystemInfo.Additional.GovPublicNodeId }; spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(ETableStyle.GovPublicContent, PublishmentSystemInfo.AuxiliaryTableForGovPublic, PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId, permissioins.IsSystemAdministrator, owningNodeIdList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], string.Empty, false, ETriState.All, false, false); } else { if (_departmentId > 0) { spContents.SelectCommand = DataProvider.GovPublicContentDao.GetSelectCommendByDepartmentId(PublishmentSystemInfo, _departmentId); } else if (!string.IsNullOrEmpty(_classCode) && _categoryId > 0) { spContents.SelectCommand = DataProvider.GovPublicContentDao.GetSelectCommendByCategoryId(PublishmentSystemInfo, _classCode, _categoryId); } } spContents.SortField = ContentAttribute.Id; spContents.SortMode = SortMode.DESC; if (!IsPostBack) { var nodeName = string.Empty; if (_departmentId > 0) { nodeName = DepartmentManager.GetDepartmentName(_departmentId); } else if (!string.IsNullOrEmpty(_classCode) && _categoryId > 0) { nodeName = DataProvider.GovPublicCategoryDao.GetCategoryName(_categoryId); } BreadCrumbWithItemTitle(AppManager.Wcm.LeftMenu.IdGovPublic, AppManager.Wcm.LeftMenu.GovPublic.IdGovPublicContent, "信息管理", nodeName, AppManager.Wcm.Permission.WebSite.GovPublicContent); 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 = Request.QueryString["DateFrom"]; ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]); Keyword.Text = Request.QueryString["Keyword"]; ltlContentButtons.Text += @" <script> $(document).ready(function() { $('#contentSearch').show(); }); </script> "; } ltlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(_styleInfoList, _attributesOfDisplay, ETableStyle.GovPublicContent, PublishmentSystemInfo); } }
public IHttpActionResult Main() { try { var body = new RequestBody(); var form = HttpContext.Current.Request.Form; var publishmentSystemId = body.GetPostInt("publishmentSystemId"); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var ajaxDivId = PageUtils.FilterSqlAndXss(body.GetPostString("ajaxDivId")); var pageNum = body.GetPostInt("pageNum"); var isHighlight = body.GetPostBool("isHighlight"); var isRedirectSingle = body.GetPostBool("isRedirectSingle"); var isDefaultDisplay = body.GetPostBool("isDefaultDisplay"); var dateAttribute = PageUtils.FilterSqlAndXss(body.GetPostString("dateAttribute")); if (string.IsNullOrEmpty(dateAttribute)) { dateAttribute = ContentAttribute.AddDate; } var pageIndex = body.GetPostInt("page", 1) - 1; var template = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("template")); template = StlRequestEntities.ParseRequestEntities(form, template); var word = PageUtils.FilterSql(body.GetPostString("word")); var channelId = body.GetPostString("channelID"); var dateFrom = PageUtils.FilterSqlAndXss(body.GetPostString("dateFrom")); var dateTo = PageUtils.FilterSqlAndXss(body.GetPostString("dateTo")); var date = PageUtils.FilterSqlAndXss(body.GetPostString("date")); var typeCollection = TranslateUtils.StringCollectionToStringCollection(PageUtils.UrlDecode(PageUtils.FilterSqlAndXss(body.GetPostString("type")))); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, TranslateUtils.ToInt(channelId, publishmentSystemId)); if (nodeInfo == null) { nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, publishmentSystemId); } var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var excludeAttributes = "ajaxdivid,pagenum,pageindex,iscrosssite,ishighlight,isredirectsingle,isdefaultdisplay,charset,template,word,click,channelid,datefrom,dateto,date,type,dateattribute"; var templateInfo = new TemplateInfo(0, publishmentSystemId, string.Empty, ETemplateType.FileTemplate, string.Empty, string.Empty, string.Empty, ECharsetUtils.GetEnumType(publishmentSystemInfo.Additional.Charset), false); var pageInfo = new PageInfo(nodeInfo.NodeId, 0, publishmentSystemInfo, templateInfo, body.UserInfo); var contextInfo = new ContextInfo(pageInfo); var contentBuilder = new StringBuilder(template); var stlLabelList = StlParserUtility.GetStlLabelList(contentBuilder.ToString()); if (StlParserUtility.IsStlElementExists(StlPageContents.ElementName, stlLabelList)) { var stlElement = StlParserUtility.GetStlElement(StlPageContents.ElementName, stlLabelList); var stlPageContentsElement = stlElement; var stlPageContentsElementReplaceString = stlElement; var whereString = DataProvider.ContentDao.GetWhereStringBySearchOutput(publishmentSystemInfo, nodeInfo.NodeId, tableStyle, word, typeCollection, channelId, dateFrom, dateTo, date, dateAttribute, excludeAttributes, form); //没搜索条件时不显示搜索结果 if (string.IsNullOrEmpty(whereString) && !isDefaultDisplay) { return(Ok(string.Empty)); } var stlPageContents = new StlPageContents(stlPageContentsElement, pageInfo, contextInfo, pageNum, whereString); int totalNum; var pageCount = stlPageContents.GetPageCount(out totalNum); if (totalNum == 0) { return(NotFound()); } var isRedirect = false; if (isRedirectSingle && totalNum == 1) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, stlPageContents.SqlString); if (contentInfo != null) { isRedirect = true; contentBuilder = new StringBuilder($@" <script> location.href = '{PageUtility.GetContentUrl(publishmentSystemInfo, contentInfo)}'; </script> "); } } if (!isRedirect) { for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++) { if (currentPageIndex == pageIndex) { var pageHtml = stlPageContents.Parse(totalNum, currentPageIndex, pageCount, false); var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlPageContentsElementReplaceString, pageHtml)); StlParserManager.ReplacePageElementsInSearchPage(pagedBuilder, pageInfo, stlLabelList, ajaxDivId, pageInfo.PageNodeId, currentPageIndex, pageCount, totalNum); if (isHighlight && !string.IsNullOrEmpty(word)) { var pagedContents = pagedBuilder.ToString(); pagedBuilder = new StringBuilder(); pagedBuilder.Append(RegexUtils.Replace( $"({word.Replace(" ", "\\s")})(?!</a>)(?![^><]*>)", pagedContents, $"<span style='color:#cc0000'>{word}</span>")); } StlUtility.ParseStl(publishmentSystemInfo, pageInfo, contextInfo, pagedBuilder, string.Empty, false); return(Ok(pagedBuilder.ToString())); } } } } else if (StlParserUtility.IsStlElementExists(StlPageSqlContents.ElementName, stlLabelList)) { var siteId = TranslateUtils.ToInt(body.GetPostString("siteID"), 0); var stlElement = StlParserUtility.GetStlElement(StlPageSqlContents.ElementName, stlLabelList); var stlPageSqlContentsElement = stlElement; var stlPageSqlContentsElementReplaceString = stlElement; var whereBuilder = new StringBuilder(); if (!string.IsNullOrEmpty(word)) { whereBuilder.Append("("); foreach (var type in typeCollection) { whereBuilder.Append($"[{type}] like '%{word}%' OR "); } whereBuilder.Length = whereBuilder.Length - 3; whereBuilder.Append(")"); } if (!string.IsNullOrEmpty(dateFrom)) { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append($" AddDate >= '{dateFrom}' "); } if (!string.IsNullOrEmpty(dateTo)) { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append($" AddDate <= '{dateTo}' "); } if (!string.IsNullOrEmpty(date)) { var days = TranslateUtils.ToInt(date); if (days > 0) { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append(SqlUtils.GetDateDiffLessThanDays("AddDate", days.ToString())); } } if (siteId > 0) { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append($"(PublishmentSystemID = {siteId})"); } if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append("(NodeID > 0) "); var tableName = BaiRongDataProvider.TableCollectionDao.GetFirstTableNameByTableType(EAuxiliaryTableType.BackgroundContent); var arraylist = TranslateUtils.StringCollectionToStringList("ajaxdivid,pagenum,pageindex,iscrosssite,ishighlight,isredirectsingle,isdefaultdisplay,charset,successtemplatestring,failuretemplatestring,word,click,channelid,datefrom,dateto,date,type,siteid"); foreach (string key in form.Keys) { if (arraylist.Contains(key.ToLower())) { continue; } if (!string.IsNullOrEmpty(form[key])) { var value = StringUtils.Trim(form[key]); if (!string.IsNullOrEmpty(value)) { if (TableManager.IsAttributeNameExists(tableStyle, tableName, key)) { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append($"([{key}] like '%{value}%')"); } else { if (whereBuilder.Length > 0) { whereBuilder.Append(" AND "); } whereBuilder.Append($"({ContentAttribute.SettingsXml} like '%{key}={value}%')"); } } } } //没搜索条件时不显示搜索结果 if (whereBuilder.Length == 0 && isDefaultDisplay == false) { return(Ok(string.Empty)); } var stlPageSqlContents = new StlPageSqlContents(stlPageSqlContentsElement, pageInfo, contextInfo, false, false); if (string.IsNullOrEmpty(stlPageSqlContents.DisplayInfo.QueryString)) { stlPageSqlContents.DisplayInfo.QueryString = $"SELECT * FROM {tableName} WHERE {whereBuilder}"; } stlPageSqlContents.LoadData(); int totalNum; var pageCount = stlPageSqlContents.GetPageCount(out totalNum); if (totalNum == 0) { return(NotFound()); } for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++) { if (currentPageIndex == pageIndex) { var pageHtml = stlPageSqlContents.Parse(currentPageIndex, pageCount); var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlPageSqlContentsElementReplaceString, pageHtml)); StlParserManager.ReplacePageElementsInSearchPage(pagedBuilder, pageInfo, stlLabelList, ajaxDivId, pageInfo.PageNodeId, currentPageIndex, pageCount, totalNum); if (isHighlight && !string.IsNullOrEmpty(word)) { var pagedContents = pagedBuilder.ToString(); pagedBuilder = new StringBuilder(); pagedBuilder.Append(RegexUtils.Replace( $"({word.Replace(" ", "\\s")})(?!</a>)(?![^><]*>)", pagedContents, $"<span style='color:#cc0000'>{word}</span>")); } StlUtility.ParseStl(publishmentSystemInfo, pageInfo, contextInfo, pagedBuilder, string.Empty, false); return(Ok(pagedBuilder.ToString())); } } } StlUtility.ParseStl(publishmentSystemInfo, pageInfo, contextInfo, contentBuilder, string.Empty, false); return(Ok(contentBuilder.ToString())); } catch (Exception ex) { return(InternalServerError(ex)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); _relatedIdentity = Body.GetQueryInt("RelatedIdentity"); _isList = Body.GetQueryBool("IsList"); if (Body.GetQueryBool("IsContent")) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); } else { _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); } if (_tableStyle == ETableStyle.Channel) { var displayAttributes = PublishmentSystemInfo.Additional.ChannelDisplayAttributes; if (!_isList) { displayAttributes = PublishmentSystemInfo.Additional.ChannelEditAttributes; } if (!IsPostBack) { //添加默认属性 var listitem = new ListItem("栏目名称", NodeAttribute.ChannelName); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目索引", NodeAttribute.ChannelIndex); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("生成页面路径", NodeAttribute.FilePath); if (CompareUtils.Contains(displayAttributes, NodeAttribute.FilePath)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); if (!_isList) { listitem = new ListItem("栏目图片地址", NodeAttribute.ImageUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ImageUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目正文", NodeAttribute.Content); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Content)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("外部链接", NodeAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("链接类型", NodeAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目模版", NodeAttribute.ChannelTemplateId); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelTemplateId)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("内容模版", NodeAttribute.ContentTemplateId); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ContentTemplateId)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("关键字列表", NodeAttribute.Keywords); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Keywords)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("页面描述", NodeAttribute.Description); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Description)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); } listitem = new ListItem("栏目组", NodeAttribute.ChannelGroupNameCollection); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelGroupNameCollection)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.NodeDao.TableName, _relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); } if (string.IsNullOrEmpty(displayAttributes)) { if (!_isList) { foreach (ListItem item in DisplayAttributeCheckBoxList.Items) { item.Selected = true; } } else { ControlUtils.SelectListItems(DisplayAttributeCheckBoxList, NodeAttribute.ChannelName, NodeAttribute.ChannelIndex); } } } } else if (ETableStyleUtils.IsContent(_tableStyle)) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _relatedIdentity); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay); if (!IsPostBack) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(PublishmentSystemInfo, _tableStyle, styleInfoList); foreach (var styleInfo in columnTableStyleInfoList) { if (styleInfo.AttributeName == ContentAttribute.Title) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (_isList) { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } else { if (styleInfo.IsVisible) { listitem.Selected = true; } } DisplayAttributeCheckBoxList.Items.Add(listitem); } } } else if (_tableStyle == ETableStyle.InputContent) { var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity); _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity); if (!IsPostBack) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities); foreach (var styleInfo in styleInfoList) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (_isList) { if (styleInfo.IsVisibleInList) { listitem.Selected = true; } } else { if (styleInfo.IsVisible) { listitem.Selected = true; } } DisplayAttributeCheckBoxList.Items.Add(listitem); } } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); var nodeId = Body.IsQueryExists("NodeID") ? Body.GetQueryInt("NodeID", PublishmentSystemId) : PublishmentSystemId; _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId)); if (_nodeInfo.Additional.IsPreviewContents) { new Action(() => { DataProvider.ContentDao.DeletePreviewContents(PublishmentSystemId, _tableName, _nodeInfo); }).BeginInvoke(null, null); } if (Body.IsQueryExists("TheNodeID") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add"))) { var theNodeId = Body.GetQueryInt("TheNodeID"); if (PublishmentSystemId != theNodeId) { var isSubtract = Body.IsQueryExists("Subtract"); DataProvider.NodeDao.UpdateTaxis(PublishmentSystemId, theNodeId, isSubtract); Body.AddSiteLog(PublishmentSystemId, theNodeId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"), $"栏目:{NodeManager.GetNodeName(PublishmentSystemId, theNodeId)}"); } } 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; if (Body.IsQueryExists("strDirection")) { SpContents.SortField = "AddDate"; SpContents.SortMode = Body.GetQueryString("strDirection").Equals("0") ? SortMode.ASC : SortMode.DESC; } //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum SpContents.IsQueryTotalCount = false; SpContents.TotalCount = _nodeInfo.ContentNum; RptChannels.DataSource = DataProvider.NodeDao.GetNodeIdListByScopeType(_nodeInfo, EScopeType.Children, string.Empty, string.Empty); RptChannels.ItemDataBound += rptChannels_ItemDataBound; if (!IsPostBack) { var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeId).Replace(">", "/"); BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "栏目及内容", nodeName, string.Empty); var url = PageUtils.GetCmsUrl(nameof(PageContentChannel), null); LtlContentButtons.Text = WebUtils.GetContentCommands(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo, PageUrl, url, false); LtlChannelButtons.Text = WebUtils.GetChannelCommands(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo, PageUrl, url); SpContents.DataBind(); RptChannels.DataBind(); 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)); 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(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo); LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo); } }
public static List <ContentColumn> GetContentColumns(SiteInfo siteInfo, ChannelInfo channelInfo, bool includeAll) { var columns = new List <ContentColumn>(); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(channelInfo.Additional.ContentAttributesOfDisplay); var pluginIds = PluginContentManager.GetContentPluginIds(channelInfo); var pluginColumns = PluginContentManager.GetContentColumns(pluginIds); var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetContentStyleInfoList(siteInfo, channelInfo)); styleInfoList.Insert(0, new TableStyleInfo { AttributeName = ContentAttribute.Sequence, DisplayName = "序号" }); foreach (var styleInfo in styleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var column = new ContentColumn { AttributeName = styleInfo.AttributeName, DisplayName = styleInfo.DisplayName, InputType = styleInfo.InputType }; if (styleInfo.AttributeName == ContentAttribute.Title) { column.IsList = true; } else { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { column.IsList = true; } } if (StringUtils.ContainsIgnoreCase(ContentAttribute.CalculateAttributes.Value, styleInfo.AttributeName)) { column.IsCalculate = true; } if (includeAll || column.IsList) { columns.Add(column); } } if (pluginColumns != null) { foreach (var pluginId in pluginColumns.Keys) { var contentColumns = pluginColumns[pluginId]; if (contentColumns == null || contentColumns.Count == 0) { continue; } foreach (var columnName in contentColumns.Keys) { var attributeName = $"{pluginId}:{columnName}"; var column = new ContentColumn { AttributeName = attributeName, DisplayName = $"{columnName}({pluginId})", InputType = InputType.Text, IsCalculate = true }; if (attributesOfDisplay.Contains(attributeName)) { column.IsList = true; } if (includeAll || column.IsList) { columns.Add(column); } } } } return(columns); }
public static IEnumerable GetContentsDataSource(PublishmentSystemInfo publishmentSystemInfo, int channelId, int contentId, string groupContent, string groupContentNot, string tags, bool isImageExists, bool isImage, bool isVideoExists, bool isVideo, bool isFileExists, bool isFile, bool isNoDup, bool isRelatedContents, int startNum, int totalNum, string orderByString, bool isTopExists, bool isTop, bool isRecommendExists, bool isRecommend, bool isHotExists, bool isHot, bool isColorExists, bool isColor, string where, EScopeType scopeType, string groupChannel, string groupChannelNot, NameValueCollection otherAttributes) { IEnumerable ie = null; if (DataProvider.NodeDao.IsExists(channelId)) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, channelId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); if (isRelatedContents && contentId > 0) { var isTags = false; var tagCollection = BaiRongDataProvider.ContentDao.GetValue(tableName, contentId, ContentAttribute.Tags); if (!string.IsNullOrEmpty(tagCollection)) { var contentIdArrayList = BaiRongDataProvider.TagDao.GetContentIdListByTagCollection(TranslateUtils.StringCollectionToStringCollection(tagCollection), publishmentSystemInfo.PublishmentSystemId); contentIdArrayList.Remove(contentId); if (contentIdArrayList.Count > 0) { isTags = true; if (string.IsNullOrEmpty(where)) { where = $"ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdArrayList)})"; } else { where += $" AND (ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdArrayList)}))"; } } } if (!isTags) { if (string.IsNullOrEmpty(where)) { where = $"ID <> {contentId}"; } else { where += $" AND (ID <> {contentId})"; } } } string sqlWhereString; if (tableStyle == ETableStyle.BackgroundContent || tableStyle == ETableStyle.GovPublicContent) { sqlWhereString = DataProvider.BackgroundContentDao.GetStlWhereString(publishmentSystemInfo, tableName, groupContent, groupContentNot, tags, isImageExists, isImage, isVideoExists, isVideo, isFileExists, isFile, isTopExists, isTop, isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where); } else { sqlWhereString = BaiRongDataProvider.ContentDao.GetStlWhereString(publishmentSystemInfo.PublishmentSystemId, groupContent, groupContentNot, tags, isTopExists, isTop, where); } ie = DataProvider.ContentDao.GetStlDataSourceChecked(tableName, channelId, startNum, totalNum, orderByString, sqlWhereString, scopeType, groupChannel, groupChannelNot, isNoDup, otherAttributes); } return(ie); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); var nodeId = PublishmentSystemId; _isGovPublic = Body.GetQueryBool("IsGovPublic"); if (_isGovPublic) { nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId; if (nodeId == 0) { nodeId = PublishmentSystemId; } } _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId)); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容审核", string.Empty); var checkedLevel = 5; var isChecked = true; foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList) { int checkedLevelByNodeId; var isCheckedByNodeId = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, owningNodeId, out checkedLevelByNodeId); if (checkedLevel > checkedLevelByNodeId) { checkedLevel = checkedLevelByNodeId; } if (!isCheckedByNodeId) { isChecked = false; } } LevelManager.LoadContentLevelToList(State, PublishmentSystemInfo, PublishmentSystemId, isChecked, checkedLevel); if (_isGovPublic) { PhContentModel.Visible = false; } else { PhContentModel.Visible = true; var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var modelInfo in contentModelInfoList) { DdlContentModelId.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId)); } ControlUtils.SelectListItems(DdlContentModelId, _nodeInfo.ContentModelId); //EContentModelTypeUtils.AddListItemsForContentCheck(this.ContentModelID); } if (!string.IsNullOrEmpty(Body.GetQueryString("State"))) { ControlUtils.SelectListItems(State, Body.GetQueryString("State")); } if (!string.IsNullOrEmpty(Body.GetQueryString("ModelID"))) { ControlUtils.SelectListItems(DdlContentModelId, Body.GetQueryString("ModelID")); } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; var checkLevelArrayList = new ArrayList(); if (!string.IsNullOrEmpty(Body.GetQueryString("State"))) { checkLevelArrayList.Add(Body.GetQueryString("State")); } else { checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayList(PublishmentSystemInfo, isChecked, checkedLevel); } var tableName = NodeManager.GetTableName(PublishmentSystemInfo, DdlContentModelId.SelectedValue); if (_isGovPublic) { tableName = PublishmentSystemInfo.AuxiliaryTableForGovPublic; } var owningNodeIdList = new List <int>(); if (!permissions.IsSystemAdministrator) { foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList) { if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, owningNodeId, AppManager.Cms.Permission.Channel.ContentCheck)) { owningNodeIdList.Add(owningNodeId); } } } SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectedCommendByCheck(tableName, PublishmentSystemId, permissions.IsSystemAdministrator, owningNodeIdList, checkLevelArrayList); SpContents.SortField = ContentAttribute.LastEditDate; SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += rptContents_ItemDataBound; SpContents.DataBind(); var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); LtlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo); LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo); } if (!HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (Body.IsQueryExists("Gather") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("GatherDatabase") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherDatabaseParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherDatabaseUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("GatherFile") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherFileParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherFileUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } //----------------------------------------------------------------------------------------// else if (Body.IsQueryExists("CreateChannelsOneByOne") && Body.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(PublishmentSystemId, channelId); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将栏目放入生成队列")); } else if (Body.IsQueryExists("CreateContentsOneByOne") && Body.IsQueryExists("NodeID") && Body.IsQueryExists("ContentIDCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"))) { CreateManager.CreateContent(PublishmentSystemId, Body.GetQueryInt("NodeID"), contentId); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将内容放入生成队列")); } else if (Body.IsQueryExists("CreateByTemplate") && Body.IsQueryExists("templateID")) { CreateManager.CreateFile(PublishmentSystemId, Body.GetQueryInt("templateID")); PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将文件放入生成队列")); } else if (Body.IsQueryExists("CreateByIDsCollection") && Body.IsQueryExists("IDsCollection")) { foreach (var nodeIdContentId in TranslateUtils.StringCollectionToStringCollection(Body.GetQueryString("IDsCollection"))) { var pair = nodeIdContentId.Split('_'); CreateManager.CreateContent(PublishmentSystemId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (Body.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(Body.GetQueryString("DownloadUrl"), Body.GetQueryString("DirectoryName"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(Body.GetQueryString("DirectoryName"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("SiteId"); _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId; _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = AuthRequest.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, _channelId) ? AuthRequest.AdminName : string.Empty; } _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _allStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions); var stateType = AuthRequest.IsQueryExists("state") ? ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("state")) : ETriState.All; var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title; var dateFrom = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty; var dateTo = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty; var keyword = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty; RptContents.ItemDataBound += RptContents_ItemDataBound; var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName); var pagerParam = new PagerParam { ControlToPaginate = RptContents, TableName = tableName, PageSize = SiteInfo.Additional.PageSize, Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1), OrderSqlString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc), ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList) }; var channelIdList = ChannelManager.GetChannelIdList(_channelInfo, EScopeType.All, string.Empty, string.Empty, _channelInfo.ContentModelPluginId); var searchChannelIdList = new List <int>(); if (AuthRequest.AdminPermissions.IsSystemAdministrator) { searchChannelIdList = channelIdList; } else { foreach (var theChannelId in channelIdList) { if (AuthRequest.AdminPermissions.OwningChannelIdList.Contains(theChannelId)) { searchChannelIdList.Add(theChannelId); } } } pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList, SiteId, _channelInfo, AuthRequest.AdminPermissions.IsSystemAdministrator, searchChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, false, _isWritingOnly, administratorName); pagerParam.TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(tableName, pagerParam.WhereSqlString); PgContents.Param = pagerParam; if (!IsPostBack) { ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions); foreach (var styleInfo in _allStyleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核"); if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State")); ControlUtils.SelectSingleItem(DdlSearchType, searchType); TbKeyword.Text = keyword; TbDateFrom.Text = dateFrom; TbDateTo.Text = dateTo; PgContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId); BtnAddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true); BtnSelect.Attributes.Add("onclick", showPopWinString); if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); } else { PhCheck.Visible = false; } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentAdd)) { BtnAddContent.Visible = false; } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate)) { BtnTranslate.Visible = false; } else { BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl)); } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId"); var channelId = AuthRequest.GetQueryInt("channelId"); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId); _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, channelId)); _allStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo); _isEdit = TextUtility.IsEdit(SiteInfo, channelId, AuthRequest.AdminPermissions); if (_channelInfo.Additional.IsPreviewContents) { new Action(() => { DataProvider.ContentDao.DeletePreviewContents(SiteId, _tableName, _channelInfo); }).BeginInvoke(null, null); } if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ContentView, ConfigManager.ChannelPermissions.ContentAdd, ConfigManager.ChannelPermissions.ContentEdit, ConfigManager.ChannelPermissions.ContentDelete, ConfigManager.ChannelPermissions.ContentTranslate)) { if (!AuthRequest.IsAdminLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的操作权限!"); return; } RptContents.ItemDataBound += RptContents_ItemDataBound; var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(_tableName); 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) }; var administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, channelId) ? AuthRequest.AdminName : string.Empty; if (AuthRequest.IsQueryExists("searchType")) { pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList, SiteId, channelId, AuthRequest.AdminPermissions.IsSystemAdministrator, new List <int> { channelId }, AuthRequest.GetQueryString("searchType"), AuthRequest.GetQueryString("keyword"), AuthRequest.GetQueryString("dateFrom"), string.Empty, false, ETriState.All, false, false, administratorName); pagerParam.TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(_tableName, pagerParam.WhereSqlString); } else { pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(channelId, ETriState.All, administratorName); pagerParam.TotalCount = _channelInfo.ContentNum; } PgContents.Param = pagerParam; if (IsPostBack) { return; } LtlButtons.Text = WebUtils.GetContentCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); LtlMoreButtons.Text = WebUtils.GetContentMoreCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); PgContents.DataBind(); foreach (var styleInfo in _allStyleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } if (AuthRequest.IsQueryExists("searchType")) { TbDateFrom.Text = AuthRequest.GetQueryString("dateFrom"); ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("searchType")); TbKeyword.Text = AuthRequest.GetQueryString("keyword"); if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("searchType")) || !string.IsNullOrEmpty(TbDateFrom.Text) || !string.IsNullOrEmpty(TbKeyword.Text)) { LtlButtons.Text += @" <script> $(document).ready(function() { $('#contentSearch').show(); }); </script> "; } } else { ControlUtils.SelectSingleItem(DdlSearchType, ContentAttribute.Title); } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _relatedIdentity = Body.GetQueryInt("RelatedIdentity"); _isList = Body.GetQueryBool("IsList"); _isContent = Body.GetQueryBool("IsContent"); if (!_isContent) { var displayAttributes = SiteInfo.Additional.ChannelDisplayAttributes; if (!_isList) { displayAttributes = SiteInfo.Additional.ChannelEditAttributes; } if (IsPostBack) { return; } //添加默认属性 var listitem = new ListItem("栏目名称", ChannelAttribute.ChannelName); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("栏目索引", ChannelAttribute.ChannelIndex); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("生成页面路径", ChannelAttribute.FilePath); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.FilePath)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); if (!_isList) { listitem = new ListItem("栏目图片地址", ChannelAttribute.ImageUrl); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ImageUrl)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("栏目正文", ChannelAttribute.Content); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Content)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("外部链接", ChannelAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("链接类型", ChannelAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("内容默认排序规则", nameof(ChannelInfoExtend.DefaultTaxisType)); if (CompareUtils.Contains(displayAttributes, nameof(ChannelInfoExtend.DefaultTaxisType))) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("栏目模版", ChannelAttribute.ChannelTemplateId); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelTemplateId)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("内容模版", ChannelAttribute.ContentTemplateId); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ContentTemplateId)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("关键字列表", ChannelAttribute.Keywords); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Keywords)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); listitem = new ListItem("页面描述", ChannelAttribute.Description); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Description)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); } listitem = new ListItem("栏目组", ChannelAttribute.ChannelGroupNameCollection); if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelGroupNameCollection)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, _relatedIdentities); foreach (var styleInfo in styleInfoList) { listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName)) { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); } if (string.IsNullOrEmpty(displayAttributes)) { if (!_isList) { foreach (ListItem item in CblDisplayAttributes.Items) { item.Selected = true; } } else { ControlUtils.SelectMultiItems(CblDisplayAttributes, ChannelAttribute.ChannelName, ChannelAttribute.ChannelIndex); } } } else { var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity); var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay); if (IsPostBack) { return; } var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, styleInfoList); foreach (var styleInfo in columnTableStyleInfoList) { if (styleInfo.AttributeName == ContentAttribute.Title) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (_isList) { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } else { listitem.Selected = true; } CblDisplayAttributes.Items.Add(listitem); } } }
private static string ParseSelectCascading(IAttributes attributes, SiteInfo siteInfo, TableStyleInfo styleInfo, StringBuilder extraBuilder) { var attributeName = styleInfo.AttributeName; var fieldInfo = DataProvider.RelatedFieldDao.GetRelatedFieldInfo(styleInfo.Additional.RelatedFieldId); if (fieldInfo == null) { return(string.Empty); } var list = DataProvider.RelatedFieldItemDao.GetRelatedFieldItemInfoList(styleInfo.Additional.RelatedFieldId, 0); var prefixes = TranslateUtils.StringCollectionToStringCollection(fieldInfo.Prefixes); var suffixes = TranslateUtils.StringCollectionToStringCollection(fieldInfo.Suffixes); var style = ERelatedFieldStyleUtils.GetEnumType(styleInfo.Additional.RelatedFieldStyle); var builder = new StringBuilder(); builder.Append($@" <span id=""c_{attributeName}_1""> {prefixes[0]} <select name=""{attributeName}"" id=""{attributeName}_1"" class=""select"" onchange=""getRelatedField_{fieldInfo.Id}(2);""> <option value="""">请选择</option>"); var values = attributes.GetString(attributeName); var value = string.Empty; if (!string.IsNullOrEmpty(values)) { value = values.Split(',')[0]; } var isLoad = false; foreach (var itemInfo in list) { var selected = !string.IsNullOrEmpty(itemInfo.ItemValue) && value == itemInfo.ItemValue ? @" selected=""selected""" : string.Empty; if (!string.IsNullOrEmpty(selected)) { isLoad = true; } builder.Append($@" <option value=""{itemInfo.ItemValue}"" itemID=""{itemInfo.Id}""{selected}>{itemInfo.ItemName}</option>" ); } builder.Append($@" </select>{suffixes[0]}</span>"); if (fieldInfo.TotalLevel > 1) { for (var i = 2; i <= fieldInfo.TotalLevel; i++) { builder.Append($@"<span id=""c_{attributeName}_{i}"" style=""display:none"">"); builder.Append(style == ERelatedFieldStyle.Virtical ? @"<br />" : " "); builder.Append($@" {prefixes[i - 1]} <select name=""{attributeName}"" id=""{attributeName}_{i}"" class=""select"" onchange=""getRelatedField_{fieldInfo.Id}({i} + 1);""></select> {suffixes[i - 1]} </span> "); } } extraBuilder.Append($@" <script> function getRelatedField_{fieldInfo.Id}(level){{ var attributeName = '{styleInfo.AttributeName}'; var totalLevel = {fieldInfo.TotalLevel}; for(i=level;i<=totalLevel;i++){{ $('#c_' + attributeName + '_' + i).hide(); }} var obj = $('#c_' + attributeName + '_' + (level - 1)); var itemID = $('option:selected', obj).attr('itemID'); if (itemID){{ var url = '{ApiRouteActionsRelatedField.GetUrl(ApiManager.InnerApiUrl, siteInfo.Id, styleInfo.Additional.RelatedFieldId, 0)}' + itemID; var values = '{values}'; var value = (values) ? values.split(',')[level - 1] : ''; $.post(url + '&callback=?', '', function(data, textStatus){{ var $sel = $('#' + attributeName + '_' + level); $('option', $sel).each(function(){{ $(this).remove(); }}) $sel.append('<option value="""">请选择</option>'); var show = false; var isLoad = false; $.each(data, function(i, item){{ show = true; var selected = ''; if (value == item.value){{ isLoad = true; selected = ' selected=""selected""' }} $opt = $('<option value=""' + item.value + '"" itemID=""' + item.id + '""' + selected + '>' + item.name + '</option>'); $opt.appendTo($sel); }}); if (show) $('#c_' + attributeName + '_' + level).show(); if (isLoad && level <= totalLevel){{ getRelatedField_{fieldInfo.Id}(level + 1); }} }}, 'jsonp'); }} }} "); if (isLoad) { extraBuilder.Append($@" $(document).ready(function(){{ getRelatedField_{fieldInfo.Id}(2); }}); "); } extraBuilder.Append("</script>"); return(builder.ToString()); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _channelId = AuthRequest.IsQueryExists("channelId") ? AuthRequest.GetQueryInt("channelId") : SiteId; _isCheckOnly = AuthRequest.GetQueryBool("isCheckOnly"); _isTrashOnly = AuthRequest.GetQueryBool("isTrashOnly"); _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly"); _isAdminOnly = AuthRequest.GetQueryBool("isAdminOnly"); _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _styleInfoList = TableStyleManager.GetContentStyleInfoList(SiteInfo, _channelInfo); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _allStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginIds = PluginContentManager.GetContentPluginIds(_channelInfo); _pluginColumns = PluginContentManager.GetContentColumns(_pluginIds); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissionsImpl); var state = AuthRequest.IsQueryExists("state") ? AuthRequest.GetQueryInt("state") : CheckManager.LevelInt.All; var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title; var dateFrom = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty; var dateTo = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty; var keyword = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty; var checkedLevel = 5; var isChecked = true; foreach (var owningChannelId in AuthRequest.AdminPermissionsImpl.ChannelIdList) { int checkedLevelByChannelId; var isCheckedByChannelId = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, owningChannelId, out checkedLevelByChannelId); if (checkedLevel > checkedLevelByChannelId) { checkedLevel = checkedLevelByChannelId; } if (!isCheckedByChannelId) { isChecked = false; } } RptContents.ItemDataBound += RptContents_ItemDataBound; var allAttributeNameList = TableColumnManager.GetTableColumnNameList(tableName, DataType.Text); var adminId = _isAdminOnly ? AuthRequest.AdminId : AuthRequest.AdminPermissionsImpl.GetAdminId(SiteInfo.Id, _channelInfo.Id); var whereString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo, searchType, keyword, dateFrom, dateTo, state, _isCheckOnly, false, _isTrashOnly, _isWritingOnly, adminId, AuthRequest.AdminPermissionsImpl, allAttributeNameList); PgContents.Param = new PagerParam { 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; } if (_isTrashOnly) { if (AuthRequest.IsQueryExists("IsDeleteAll")) { //DataProvider.ContentDao.DeleteContentsByTrash(SiteId, _channelId, tableName); var list = DataProvider.ContentDao.GetContentIdListByTrash(SiteId, tableName); foreach (var(contentChannelId, contentId) in list) { ContentUtility.Delete(tableName, SiteInfo, contentChannelId, contentId); } AuthRequest.AddSiteLog(SiteId, "清空回收站"); SuccessMessage("成功清空回收站!"); } else if (AuthRequest.IsQueryExists("IsRestore")) { var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); foreach (var channelId in idsDictionary.Keys) { var contentIdList = idsDictionary[channelId]; DataProvider.ContentDao.UpdateTrashContents(SiteId, channelId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdList); } AuthRequest.AddSiteLog(SiteId, "从回收站还原内容"); SuccessMessage("成功还原内容!"); } else if (AuthRequest.IsQueryExists("IsRestoreAll")) { DataProvider.ContentDao.UpdateRestoreContentsByTrash(SiteId, _channelId, tableName); AuthRequest.AddSiteLog(SiteId, "从回收站还原所有内容"); SuccessMessage("成功还原所有内容!"); } } ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissionsImpl); if (_isCheckOnly) { CheckManager.LoadContentLevelToCheck(DdlState, SiteInfo, isChecked, checkedLevel); } else { CheckManager.LoadContentLevelToList(DdlState, SiteInfo, _isCheckOnly, isChecked, checkedLevel); } ControlUtils.SelectSingleItem(DdlState, state.ToString()); foreach (var styleInfo in _allStyleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } //ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核"); if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } //ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State")); ControlUtils.SelectSingleItem(DdlSearchType, searchType); TbKeyword.Text = keyword; TbDateFrom.Text = dateFrom; TbDateTo.Text = dateTo; PgContents.DataBind(); LtlColumnsHead.Text += TextUtility.GetColumnsHeadHtml(_styleInfoList, _pluginColumns, _attributesOfDisplay); BtnSelect.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowString(SiteId, _channelId)); if (_isTrashOnly) { LtlColumnsHead.Text += @"<th class=""text-center text-nowrap"" width=""150"">删除时间</th>"; BtnAddToGroup.Visible = BtnTranslate.Visible = BtnCheck.Visible = false; PhTrash.Visible = true; if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.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"), "确实要还原所有内容吗?")); } else { LtlColumnsHead.Text += @"<th class=""text-center text-nowrap"" width=""100"">操作</th>"; BtnAddToGroup.Attributes.Add("onclick", ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId)); if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck)) { BtnCheck.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl)); if (_isCheckOnly) { BtnCheck.CssClass = "btn m-r-5 btn-success"; } } else { PhCheck.Visible = false; } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate)) { BtnTranslate.Visible = false; } else { BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl)); } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } } }
public static List <InputListItem> GetContentsColumns(SiteInfo siteInfo, ChannelInfo channelInfo, bool includeAll) { var items = new List <InputListItem>(); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(channelInfo.Additional.ContentAttributesOfDisplay); var pluginIds = PluginContentManager.GetContentPluginIds(channelInfo); var pluginColumns = PluginContentManager.GetContentColumns(pluginIds); var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetContentStyleInfoList(siteInfo, channelInfo)); styleInfoList.Insert(0, new TableStyleInfo { AttributeName = ContentAttribute.Sequence, DisplayName = "序号" }); foreach (var styleInfo in styleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new InputListItem { Text = styleInfo.DisplayName, Value = styleInfo.AttributeName }; if (styleInfo.AttributeName == ContentAttribute.Title) { listitem.Selected = true; } else { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } if (includeAll || listitem.Selected) { items.Add(listitem); } } if (pluginColumns != null) { foreach (var pluginId in pluginColumns.Keys) { var contentColumns = pluginColumns[pluginId]; if (contentColumns == null || contentColumns.Count == 0) { continue; } foreach (var columnName in contentColumns.Keys) { var attributeName = $"{pluginId}:{columnName}"; var listitem = new InputListItem { Text = $"{columnName}({pluginId})", Value = attributeName }; if (attributesOfDisplay.Contains(attributeName)) { listitem.Selected = true; } if (includeAll || listitem.Selected) { items.Add(listitem); } } } } return(items); }
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(1, nodeID); tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); Dictionary <string, string> category = DataProvider.NodeDao.GetNodeIdListLevel(2, nodeID); int contentNum = 0; 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")) { string nodeListString = Body.GetQueryString("ChildNodeId"); string[] nodeArray = nodeListString.Split(new char[] { ',' }); List <int> owningNodeIdList = new List <int>(); foreach (string node in nodeArray) { if (!string.IsNullOrEmpty(node)) { int nodeId = Convert.ToInt32(node); owningNodeIdList.Add(nodeId); contentNum = contentNum + DataProvider.NodeDao.GetNodeInfo(nodeId).ContentNum; } } nodeListString = nodeListString.TrimEnd(','); spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommendForLower(nodeListString, 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.GetSelectCommendForLowerLevel(tableName, nodeCollectionIdStr, ETriState.All, administratorName, base.PublishmentSystemId); spContents.SelectCommand = $@"select * from siteserver_examination where ExaminationPaperId={PageUtils.FilterSqlAndXss(Body.GetQueryString( "ArticleId"))} and NodeId={PageUtils.FilterSqlAndXss(Body.GetQueryString("NodeId"))}"; } spContents.SortField = BaiRongDataProvider.ContentDao.GetSortFieldName(); spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc); //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum spContents.IsQueryTotalCount = false; spContents.TotalCount = nodeInfo.ContentNum;//nodeInfo.ContentNum; if (!IsPostBack) { var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID); //BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty); ltlContentButtons.Text = WebUtils.GetContentCommandsStandardForExamination(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrlReturn, GetRedirectUrl(base.PublishmentSystemId, nodeInfo.NodeId), false, Body.GetQueryInt("ArticleId")); 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); } } } string NodeIdAll = nodeID + ","; if (category != null) { foreach (var chanelCategory in category) { NodeIdAll = NodeIdAll + chanelCategory.Value + ","; var nodechildId = DataProvider.NodeDao.GetNodeInfoListByParentId(1, Convert.ToInt32(chanelCategory.Value)); if (nodechildId != null && nodechildId.Count > 0) { string chidNodeList = string.Empty; foreach (var child in nodechildId) { NodeIdAll = NodeIdAll + child.NodeId + ","; chidNodeList = chidNodeList + child.NodeId + ","; } var listitem = new ListItem(chanelCategory.Key, chidNodeList); ChannelCategory.Items.Add(listitem); } else { var listitem = new ListItem(chanelCategory.Key, chanelCategory.Value); NodeIdAll = NodeIdAll + chanelCategory.Value + ","; ChannelCategory.Items.Add(listitem); } } } var listitemAll = new ListItem("全部", NodeIdAll); ChannelCategory.Items.Add(listitemAll); ListItem listItemSelect = null; foreach (ListItem listItem in ChannelCategory.Items) { if (listItem.Value.Equals(Body.GetQueryString("ChildNodeId"))) { listItemSelect = listItem; } } if (listItemSelect != null) { listItemSelect.Selected = true; } else { listitemAll.Selected = true; } //添加隐藏属性 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); } }