public IHttpActionResult Main() { try { var body = new RequestBody(); if (!body.IsUserLoggin) { return(Unauthorized()); } var publishmentSystemId = body.GetPostInt("publishmentSystemId"); var nodeId = body.GetPostInt("nodeId"); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId); return(Ok(TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities))); } catch (Exception ex) { //return InternalServerError(ex); return(InternalServerError(new Exception("程序错误"))); } }
public static bool CreateAccessFileForContents(string filePath, SiteInfo siteInfo, ChannelInfo nodeInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState) { DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath)); FileUtils.DeleteFileIfExists(filePath); var sourceFilePath = SiteServerAssets.GetPath(SiteServerAssets.Default.AccessMdb); FileUtils.CopyFile(sourceFilePath, filePath); var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(siteInfo.Id, nodeInfo.Id); var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, relatedidentityes); styleInfoList = ContentUtility.GetAllTableStyleInfoList(siteInfo, styleInfoList); var accessDao = new AccessDao(filePath); var createTableSqlString = accessDao.GetCreateTableSqlString(nodeInfo.ChannelName, styleInfoList, displayAttributes); accessDao.ExecuteSqlString(createTableSqlString); bool isExport; var insertSqlArrayList = accessDao.GetInsertSqlStringArrayList(nodeInfo.ChannelName, siteInfo.Id, nodeInfo.Id, tableName, styleInfoList, displayAttributes, contentIdList, isPeriods, dateFrom, dateTo, checkedState, out isExport); foreach (string insertSql in insertSqlArrayList) { accessDao.ExecuteSqlString(insertSql); } return(isExport); }
public void GetContent_Click(object sender, EventArgs e) { var getContent = (Button)sender; var contentUrl = getContent.CommandArgument; var gatherRuleInfo = DataProvider.GatherRuleDao.GetGatherRuleInfo(_gatherRuleName, PublishmentSystemId); var regexContentExclude = GatherUtility.GetRegexString(gatherRuleInfo.ContentExclude); var regexChannel = GatherUtility.GetRegexChannel(gatherRuleInfo.ContentChannelStart, gatherRuleInfo.ContentChannelEnd); var regexContent = GatherUtility.GetRegexContent(gatherRuleInfo.ContentContentStart, gatherRuleInfo.ContentContentEnd); var regexContent2 = string.Empty; if (!string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentStart2) && !string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentEnd2)) { regexContent2 = GatherUtility.GetRegexContent(gatherRuleInfo.Additional.ContentContentStart2, gatherRuleInfo.Additional.ContentContentEnd2); } var regexContent3 = string.Empty; if (!string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentStart3) && !string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentEnd3)) { regexContent3 = GatherUtility.GetRegexContent(gatherRuleInfo.Additional.ContentContentStart3, gatherRuleInfo.Additional.ContentContentEnd3); } var regexNextPage = GatherUtility.GetRegexUrl(gatherRuleInfo.ContentNextPageStart, gatherRuleInfo.ContentNextPageEnd); var regexTitle = GatherUtility.GetRegexTitle(gatherRuleInfo.ContentTitleStart, gatherRuleInfo.ContentTitleEnd); var contentAttributes = TranslateUtils.StringCollectionToStringList(gatherRuleInfo.ContentAttributes); var contentAttributesXML = TranslateUtils.ToNameValueCollection(gatherRuleInfo.ContentAttributesXml); var attributes = GatherUtility.GetContentNameValueCollection(gatherRuleInfo.Charset, contentUrl, gatherRuleInfo.CookieString, regexContentExclude, gatherRuleInfo.ContentHtmlClearCollection, gatherRuleInfo.ContentHtmlClearTagCollection, regexTitle, regexContent, regexContent2, regexContent3, regexNextPage, regexChannel, contentAttributes, contentAttributesXML); var builder = new StringBuilder(); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, PublishmentSystemId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.BackgroundContent, PublishmentSystemInfo.AuxiliaryTableForContent, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (string.IsNullOrEmpty(attributes[styleInfo.AttributeName.ToLower()])) { continue; } if (StringUtils.EqualsIgnoreCase(ContentAttribute.Title, styleInfo.AttributeName)) { builder.Append( $@"<a href=""{contentUrl}"" target=""_blank"">{styleInfo.DisplayName}: {attributes[ styleInfo.AttributeName.ToLower()]}</a><br><br>"); } else if (StringUtils.EqualsIgnoreCase(BackgroundContentAttribute.ImageUrl, styleInfo.AttributeName) || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Image)) { var imageUrl = PageUtils.GetUrlByBaseUrl(attributes[styleInfo.AttributeName.ToLower()], contentUrl); builder.Append($"{styleInfo.DisplayName}: <img src='{imageUrl}' /><br><br>"); } else { builder.Append($"{styleInfo.DisplayName}: {attributes[styleInfo.AttributeName.ToLower()]}<br><br>"); } } Content.Text = builder.ToString(); }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } var fileCount = TranslateUtils.ToInt(Request.Form["File_Count"]); if (fileCount == 1) { var fileName = Request.Form["fileName_1"]; var redirectUrl = WebUtils.GetContentAddUploadWordUrl(SiteId, _channelInfo, CbIsFirstLineTitle.Checked, CbIsFirstLineRemove.Checked, CbIsClearFormat.Checked, CbIsFirstLineIndent.Checked, CbIsClearFontSize.Checked, CbIsClearFontFamily.Checked, CbIsClearImages.Checked, TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue), fileName, _returnUrl); LayerUtils.CloseAndRedirect(Page, redirectUrl); return; } if (fileCount > 1) { var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelInfo.Id); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities); for (var index = 1; index <= fileCount; index++) { var fileName = Request.Form["fileName_" + index]; if (!string.IsNullOrEmpty(fileName)) { var formCollection = WordUtils.GetWordNameValueCollection(SiteId, CbIsFirstLineTitle.Checked, CbIsFirstLineRemove.Checked, CbIsClearFormat.Checked, CbIsFirstLineIndent.Checked, CbIsClearFontSize.Checked, CbIsClearFontFamily.Checked, CbIsClearImages.Checked, TranslateUtils.ToInt(DdlContentLevel.SelectedValue), fileName); if (!string.IsNullOrEmpty(formCollection[ContentAttribute.Title])) { var contentInfo = new ContentInfo(); BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, styleInfoList, formCollection, ContentAttribute.AllAttributesLowercase); contentInfo.ChannelId = _channelInfo.Id; contentInfo.SiteId = SiteId; contentInfo.AddUserName = Body.AdminName; contentInfo.AddDate = DateTime.Now; contentInfo.LastEditUserName = contentInfo.AddUserName; contentInfo.LastEditDate = contentInfo.AddDate; contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= SiteInfo.Additional.CheckContentLevel; contentInfo.Id = DataProvider.ContentDao.Insert(tableName, SiteInfo, contentInfo); if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(SiteId, _channelInfo.Id, contentInfo.Id); } } } } } LayerUtils.Close(Page); }
public static void CreateExcelFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string startDate, string endDate, ETriState checkedState) { DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath)); FileUtils.DeleteFileIfExists(filePath); var head = new List <string>(); var rows = new List <List <string> >(); var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); tableStyleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, tableStyleInfoList); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); foreach (var tableStyleInfo in tableStyleInfoList) { if (displayAttributes.Contains(tableStyleInfo.AttributeName)) { head.Add(tableStyleInfo.DisplayName); } } if (contentIdList == null || contentIdList.Count == 0) { contentIdList = BaiRongDataProvider.ContentDao.GetContentIdList(tableName, nodeInfo.NodeId, isPeriods, startDate, endDate, checkedState); } foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); if (contentInfo != null) { var row = new List <string>(); foreach (var tableStyleInfo in tableStyleInfoList) { if (displayAttributes.Contains(tableStyleInfo.AttributeName)) { var value = contentInfo.GetExtendedAttribute(tableStyleInfo.AttributeName); row.Add(StringUtils.StripTags(value)); } } rows.Add(row); } } CsvUtils.Export(filePath, head, rows); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var fileCount = TranslateUtils.ToInt(Request.Form["File_Count"]); if (fileCount == 1) { var fileName = Request.Form["fileName_1"]; var redirectUrl = WebUtils.GetContentAddUploadWordUrl(PublishmentSystemId, _nodeInfo, cbIsFirstLineTitle.Checked, cbIsFirstLineRemove.Checked, cbIsClearFormat.Checked, cbIsFirstLineIndent.Checked, cbIsClearFontSize.Checked, cbIsClearFontFamily.Checked, cbIsClearImages.Checked, TranslateUtils.ToIntWithNagetive(rblContentLevel.SelectedValue), fileName, _returnUrl); PageUtils.CloseModalPageAndRedirect(Page, redirectUrl); return; } if (fileCount > 1) { var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeInfo.NodeId); for (var index = 1; index <= fileCount; index++) { var fileName = Request.Form["fileName_" + index]; if (!string.IsNullOrEmpty(fileName)) { var formCollection = WordUtils.GetWordNameValueCollection(PublishmentSystemId, _nodeInfo.ContentModelId, cbIsFirstLineTitle.Checked, cbIsFirstLineRemove.Checked, cbIsClearFormat.Checked, cbIsFirstLineIndent.Checked, cbIsClearFontSize.Checked, cbIsClearFontFamily.Checked, cbIsClearImages.Checked, TranslateUtils.ToInt(rblContentLevel.SelectedValue), fileName); if (!string.IsNullOrEmpty(formCollection[ContentAttribute.Title])) { var contentInfo = ContentUtility.GetContentInfo(tableStyle); BackgroundInputTypeParser.AddValuesToAttributes(tableStyle, tableName, PublishmentSystemInfo, relatedIdentities, formCollection, contentInfo.Attributes, ContentAttribute.HiddenAttributes); contentInfo.NodeId = _nodeInfo.NodeId; contentInfo.PublishmentSystemId = PublishmentSystemId; contentInfo.AddUserName = Body.AdministratorName; contentInfo.AddDate = DateTime.Now; contentInfo.LastEditUserName = contentInfo.AddUserName; contentInfo.LastEditDate = contentInfo.AddDate; contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(rblContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= PublishmentSystemInfo.CheckContentLevel; contentInfo.Id = DataProvider.ContentDao.Insert(tableName, PublishmentSystemInfo, contentInfo); if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id); } } } } } PageUtils.CloseModalPage(Page); } }
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; } var channelId = AuthRequest.GetQueryInt("channelId", SiteId); _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _redirectUrl = GetRedirectUrl(SiteId, channelId); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Configration); //删除样式 if (AuthRequest.IsQueryExists("DeleteStyle")) { var attributeName = AuthRequest.GetQueryString("AttributeName"); if (TableStyleManager.IsExists(_channelInfo.Id, _tableName, attributeName)) { try { TableStyleManager.Delete(_channelInfo.Id, _tableName, attributeName); AuthRequest.AddSiteLog(SiteId, "删除数据表单样式", $"表单:{_tableName},字段:{attributeName}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } } InfoMessage( $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 内容表:{DataProvider.TableDao.GetDisplayName(_tableName)}({_tableName})"); ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, false, true, AuthRequest.AdminPermissions); ControlUtils.SelectSingleItem(DdlChannelId, channelId.ToString()); RptContents.DataSource = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); RptContents.ItemDataBound += RptContents_ItemDataBound; RptContents.DataBind(); BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(SiteId, 0, _relatedIdentities, _tableName, string.Empty, _redirectUrl)); BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(SiteId, _relatedIdentities, _tableName, _redirectUrl)); BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, SiteId, channelId)); BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, channelId)); }
public IHttpActionResult Main() { try { var body = new RequestBody(); if (!body.IsUserLoggin) { return(Unauthorized()); } var publishmentSystemId = body.GetPostInt("publishmentSystemId"); var nodeId = body.GetPostInt("nodeId"); var user = new User(body.UserInfo); var groupInfo = UserGroupManager.GetGroupInfo(user.GroupId); var adminUserName = groupInfo.Additional.WritingAdminUserName; var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId); var contentInfo = ContentUtility.GetContentInfo(tableStyle); var postCollection = body.GetPostCollection(); InputTypeParser.AddValuesToAttributes(tableStyle, tableName, publishmentSystemInfo, relatedIdentities, postCollection, contentInfo.Attributes, ContentAttribute.HiddenAttributes); contentInfo.IsChecked = false; contentInfo.PublishmentSystemId = publishmentSystemId; contentInfo.NodeId = nodeId; contentInfo.AddUserName = adminUserName; contentInfo.WritingUserName = user.UserName; contentInfo.LastEditUserName = adminUserName; contentInfo.AddDate = DateTime.Now; contentInfo.LastEditDate = DateTime.Now; var contentId = DataProvider.ContentDao.Insert(tableName, publishmentSystemInfo, contentInfo); LogUtils.AddUserLog(body.UserName, EUserActionType.WritingAdd, contentInfo.Title); return(Ok(new { ID = contentId })); } catch (Exception ex) { //return InternalServerError(ex); return(InternalServerError(new Exception("程序错误"))); } }
public void SetParameters(PublishmentSystemInfo publishmentSystemInfo, int nodeID, ETableStyle tableStyle, string tableName, string attributeName, NameValueCollection formCollection, bool isEdit, bool isPostBack) { this.publishmentSystemInfo = publishmentSystemInfo; this.nodeID = nodeID; this.tableStyle = tableStyle; this.tableName = tableName; this.attributeName = attributeName; this.formCollection = formCollection; this.isEdit = isEdit; this.isPostBack = isPostBack; relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeID); }
private void LoadDisplayAttributeCheckBoxList() { var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo); var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities)); foreach (var styleInfo in styleInfoList) { var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName) { Selected = true }; CblDisplayAttributes.Items.Add(listItem); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId); _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _modelInfo = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId); _tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(_modelInfo.TableType); _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "内容字段管理", AppManager.Cms.Permission.WebSite.Configration); //删除样式 if (Body.IsQueryExists("DeleteStyle")) { DeleteStyle(); } else if (Body.IsQueryExists("SetTaxis")) { SetTaxis(); } InfoMessage( $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 辅助表:{BaiRongDataProvider.TableCollectionDao.GetTableCnName(_modelInfo.TableName)}({_modelInfo.TableName}); 内容模型:{_modelInfo.ModelName}"); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName); ControlUtils.SelectListItems(NodeIDDropDownList, nodeId.ToString()); var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _modelInfo.TableName, _relatedIdentities); dgContents.DataSource = styleInfoList; dgContents.ItemDataBound += dgContents_ItemDataBound; dgContents.DataBind(); AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _modelInfo.TableName, string.Empty, _tableStyle, _redirectUrl)); AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _modelInfo.TableName, _tableStyle, _redirectUrl)); Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_modelInfo.TableName, _tableStyle, PublishmentSystemId, nodeId)); Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _modelInfo.TableName, PublishmentSystemId, nodeId)); } }
private void LoadDisplayAttributeCheckBoxList() { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); var modelInfo = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedIdentities); styleInfoList = ContentUtility.GetAllTableStyleInfoList(PublishmentSystemInfo, tableStyle, styleInfoList); foreach (var styleInfo in styleInfoList) { var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); listItem.Selected = styleInfo.IsVisible; cblDisplayAttributes.Items.Add(listItem); } }
protected override void Render(HtmlTextWriter output) { var nodeId = int.Parse(HttpContext.Current.Request.QueryString["NodeID"]); var publishmentSystemId = int.Parse(HttpContext.Current.Request.QueryString["PublishmentSystemID"]); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); if (_formCollection == null) { if (HttpContext.Current.Request.Form.Count > 0) { _formCollection = HttpContext.Current.Request.Form; } else { _formCollection = new NameValueCollection(); } } var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, DataProvider.NodeDao.TableName, relatedIdentities); if (styleInfoList != null) { var builder = new StringBuilder(); var pageScripts = new NameValueCollection(); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { var attributes = InputParserUtils.GetAdditionalAttributes(string.Empty, EInputTypeUtils.GetEnumType(styleInfo.InputType)); //string inputHtml = TableInputParser.Parse(styleInfo, styleInfo.AttributeName, this.formCollection, this.isEdit, isPostBack, attributes, pageScripts); var inputHtml = BackgroundInputTypeParser.Parse(publishmentSystemInfo, nodeId, styleInfo, ETableStyle.Channel, styleInfo.AttributeName, _formCollection, _isEdit, _isPostBack, attributes, pageScripts, true); builder.AppendFormat(GetFormatString(EInputTypeUtils.GetEnumType(styleInfo.InputType)), styleInfo.DisplayName, inputHtml, styleInfo.HelpText); } } output.Write(builder.ToString()); foreach (string key in pageScripts.Keys) { output.Write(pageScripts[key]); } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableName = DataProvider.NodeDao.TableName; var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId); _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "栏目字段管理", AppManager.Cms.Permission.WebSite.Configration); //删除样式 if (Body.IsQueryExists("DeleteStyle")) { DeleteStyle(); } else if (Body.IsQueryExists("SetTaxis")) { SetTaxis(); } NodeManager.AddListItems(DdlNodeIdDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName); ControlUtils.SelectListItems(DdlNodeIdDropDownList, nodeId.ToString()); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, _tableName, _relatedIdentities); DgContents.DataSource = styleInfoList; DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, ETableStyle.Channel, _redirectUrl)); BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, ETableStyle.Channel, _redirectUrl)); BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, ETableStyle.Channel, PublishmentSystemId, nodeId)); BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(ETableStyle.Channel, _tableName, PublishmentSystemId, nodeId)); } }
public GovInteractContentInfo GetContentInfo(PublishmentSystemInfo publishmentSystemInfo, int nodeId, NameValueCollection form) { var queryCode = GovInteractApplyManager.GetQueryCode(); var departmentId = TranslateUtils.ToInt(form[GovInteractContentAttribute.DepartmentId]); var departmentName = string.Empty; if (departmentId > 0) { departmentName = DepartmentManager.GetDepartmentName(departmentId); } var ipAddress = PageUtils.GetIpAddress(); var contentInfo = new GovInteractContentInfo(); contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId; contentInfo.NodeId = nodeId; contentInfo.DepartmentName = departmentName; contentInfo.QueryCode = queryCode; contentInfo.State = EGovInteractState.New; contentInfo.AddUserName = string.Empty; contentInfo.IpAddress = ipAddress; contentInfo.AddDate = DateTime.Now; var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId); InputTypeParser.AddValuesToAttributes(ETableStyle.GovInteractContent, publishmentSystemInfo.AuxiliaryTableForGovInteract, publishmentSystemInfo, relatedIdentities, form, contentInfo.Attributes); //foreach (string name in form.AllKeys) //{ // if (!GovInteractContentAttribute.HiddenAttributes.Contains(name.ToLower())) // { // string value = form[name]; // if (!string.IsNullOrEmpty(value)) // { // applyInfo.SetExtendedAttribute(name, value); // } // } //} return(contentInfo); }
public IHttpActionResult Main() { try { var body = new RequestBody(); if (!body.IsUserLoggin) { return(Unauthorized()); } var publishmentSystemId = body.GetPostInt("publishmentSystemId"); var nodeId = body.GetPostInt("nodeId"); var id = body.GetPostInt("id"); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, id); if (contentInfo != null && contentInfo.WritingUserName == body.UserName) { return(Ok(new { Content = ContentUtility.ContentToDictionary(contentInfo, tableStyle, tableName, relatedIdentities) })); } return(NotFound()); } catch (Exception ex) { //return InternalServerError(ex); return(InternalServerError(new Exception("程序错误"))); } }
public Dictionary <string, object> ToDictionary() { var jObject = JObject.FromObject(this); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, Id); var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { jObject[styleInfo.AttributeName] = Attributes.GetString(styleInfo.AttributeName); } var siteInfo = SiteManager.GetSiteInfo(SiteId); if (!string.IsNullOrEmpty(ImageUrl)) { jObject[nameof(ImageUrl)] = PageUtility.ParseNavigationUrl(siteInfo, ImageUrl, false); } jObject["NavigationUrl"] = PageUtility.GetChannelUrl(siteInfo, this, false); return(jObject.ToObject <Dictionary <string, object> >()); }
public string GetSelectSqlStringWithChecked(PublishmentSystemInfo publishmentSystemInfo, int nodeId, bool isReplyExists, bool isReply, int startNum, int totalNum, string whereString, string orderByString, NameValueCollection otherAttributes) { if (!string.IsNullOrEmpty(whereString) && !StringUtils.StartsWithIgnoreCase(whereString.Trim(), "AND ")) { whereString = "AND " + whereString.Trim(); } string sqlWhereString = $"WHERE NodeID = {nodeId} AND IsPublic = '{true.ToString()}' {whereString}"; if (isReplyExists) { if (isReply) { sqlWhereString += $" AND State = '{EGovInteractStateUtils.GetValue(EGovInteractState.Checked)}'"; } else { sqlWhereString += $" AND State <> '{EGovInteractStateUtils.GetValue(EGovInteractState.Checked)}' AND State <> '{EGovInteractStateUtils.GetValue(EGovInteractState.Denied)}'"; } } if (otherAttributes != null && otherAttributes.Count > 0) { var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovInteractContent, publishmentSystemInfo.AuxiliaryTableForGovInteract, relatedIdentities); foreach (var tableStyleInfo in styleInfoList) { if (!string.IsNullOrEmpty(otherAttributes[tableStyleInfo.AttributeName.ToLower()])) { sqlWhereString += $" AND ({ContentAttribute.SettingsXml} like '%{tableStyleInfo.AttributeName}={otherAttributes[tableStyleInfo.AttributeName.ToLower()]}%')"; } } } return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForGovInteract, startNum, totalNum, SqlUtils.Asterisk, sqlWhereString, orderByString)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl"); var nodeId = Body.GetQueryInt("NodeID"); _nodeInfo = NodeManager.GetNodeInfo(1, nodeId); var contentId = Body.GetQueryInt("ID"); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); ReturnUrl = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={nodeId}"; ReturnPUrl = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={ (Body.GetQueryInt("PNodeID")==0? nodeId:Body.GetQueryInt("PNodeID"))}"; //ReturnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); _isAjaxSubmit = Body.GetQueryBool("isAjaxSubmit"); _isPreview = Body.GetQueryBool("isPreview"); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); //_tableName = "model_content"; _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); ContentInfo contentInfo = null; if (_isAjaxSubmit == false) { if (contentId == 0) { if (_nodeInfo != null && _nodeInfo.Additional.IsContentAddable == false) { PageUtils.RedirectToErrorPage("此栏目不能添加内容!"); return; } if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentAdd)) { if (!Body.IsAdministratorLoggin) { PageUtils.RedirectToLoginPage(); return; } else { PageUtils.RedirectToErrorPage("您无此栏目的添加内容权限!"); return; } } } else { contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId); if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentEdit)) { if (!Body.IsAdministratorLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的修改内容权限!"); return; } } if (!IsPostBack) { var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, _nodeInfo.NodeId); var pageTitle = (contentId == 0) ? $"添加{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}" : $"编辑{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}"; BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, pageTitle, nodeNames, string.Empty); LtlPageTitle.Text = pageTitle; LtlPageTitle.Text += $@" <script language=""javascript"" type=""text/javascript""> var previewUrl = '{PagePreview.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentId, 0, 0)}'; </script> "; if (PublishmentSystemInfo.Additional.IsAutoSaveContent && PublishmentSystemInfo.Additional.AutoSaveContentInterval > 0) { LtlPageTitle.Text += $@" <input type=""hidden"" id=""savedContentID"" name=""savedContentID"" value=""{contentId}""> <script language=""javascript"" type=""text/javascript"">setInterval(""autoSave()"",{PublishmentSystemInfo.Additional.AutoSaveContentInterval*1000});</script> "; } //专题 if (contentId == 0) { var specialParentId = DataProvider.NodeDao.GetSpecialParentId(); NodeIdDic = new Dictionary <NodeInfo, List <NodeInfo> >(); if (nodeId != 0 && nodeId == specialParentId) { PhSpecial.Visible = true; PhCategory.Visible = true; var specialNodeIdList = DataProvider.NodeDao.GetNodeInfoListByParentId(1, specialParentId); List <NodeInfo> secondLevel = new List <NodeInfo>(); foreach (var nodeInfo in specialNodeIdList) { var secondChild = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeInfo.NodeId); if (secondChild != null && secondChild.Count > 0) { NodeIdDic.Add(nodeInfo, secondChild); } } if (NodeIdDic != null && NodeIdDic.Count > 0) { KeyValuePair <NodeInfo, List <NodeInfo> > kv = NodeIdDic.First(); var defaultItem = new ListItem(kv.Key.NodeName, kv.Key.NodeId.ToString()); defaultItem.Selected = true; TbSpecial.Items.Add(defaultItem); foreach (var info in kv.Value) { TbCategory.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString())); } foreach (var info in specialNodeIdList) { if (info.NodeId != kv.Key.NodeId) { TbSpecial.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString())); } } } } else { //信息类型 var childSpecial = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeId); if (childSpecial != null && childSpecial.Count > 0) { PhCategory.Visible = true; foreach (var nodeInfo in childSpecial) { var item = new ListItem(nodeInfo.NodeName, nodeInfo.NodeId.ToString()); TbCategory.Items.Add(item); } } } } else { PhSpecial.Visible = false; PhCategory.Visible = true; TbCategory.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString())); //if (_nodeInfo.ParentsCount == 1) //{ // PhSpecial.Visible = false; // PhCategory.Visible = true; // TbSpecial.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString())); //}else if(_nodeInfo.ParentsCount == 1) } //转移 if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate)) { PhTranslate.Visible = PublishmentSystemInfo.Additional.IsTranslate; DivTranslateAdd.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(PublishmentSystemId, true)); ETranslateContentTypeUtils.AddListItems(DdlTranslateType, true); ControlUtils.SelectListItems(DdlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy)); } else { PhTranslate.Visible = false; } //内容属性 var excludeAttributeNames = TableManager.GetExcludeAttributeNames(_tableStyle); AcAttributes.AddExcludeAttributeNames(excludeAttributeNames); if (excludeAttributeNames.Count == 0) { PhContentAttributes.Visible = false; } else { PhContentAttributes.Visible = true; foreach (var attributeName in excludeAttributeNames) { var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, attributeName, _relatedIdentities); if (styleInfo.IsVisible) { var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (contentId > 0) { listItem.Selected = TranslateUtils.ToBool(contentInfo?.GetExtendedAttribute(styleInfo.AttributeName)); } else { if (TranslateUtils.ToBool(styleInfo.DefaultValue)) { listItem.Selected = true; } } CblContentAttributes.Items.Add(listItem); } } } //内容组 var contentGroupNameList = DataProvider.ContentGroupDao.GetContentGroupNameList(PublishmentSystemId); if (!PublishmentSystemInfo.Additional.IsGroupContent || contentGroupNameList.Count == 0) { PhContentGroup.Visible = false; } else { foreach (var groupName in contentGroupNameList) { var item = new ListItem(groupName, groupName); if (contentId > 0) { item.Selected = StringUtils.In(contentInfo?.ContentGroupNameCollection, groupName); } CblContentGroupNameCollection.Items.Add(item); } } //标签 if (!PublishmentSystemInfo.Additional.IsRelatedByTags) { PhTags.Visible = false; } else { var tagScript = @" <script type=""text/javascript""> function getTags(tag){ $.get('[url]&tag=' + encodeURIComponent(tag) + '&r=' + Math.random(), function(data) { if(data !=''){ var arr = data.split('|'); var temp=''; for(i=0;i<arr.length;i++) { temp += '<li><a>'+arr[i].replace(tag,'<b>' + tag + '</b>') + '</a></li>'; } var myli='<ul>'+temp+'</ul>'; $('#tagTips').html(myli); $('#tagTips').show(); }else{ $('#tagTips').hide(); } $('#tagTips li').click(function () { var tag = $('#TbTags').val(); var i = tag.lastIndexOf(' '); if (i > 0) { tag = tag.substring(0, i) + ' ' + $(this).text(); }else{ tag = $(this).text(); } $('#TbTags').val(tag); $('#tagTips').hide(); }) }); } $(document).ready(function () { $('#TbTags').keyup(function (e) { if (e.keyCode != 40 && e.keyCode != 38) { var tag = $('#TbTags').val(); var i = tag.lastIndexOf(' '); if (i > 0){ tag = tag.substring(i + 1);} if (tag != '' && tag != ' '){ window.setTimeout(""getTags('"" + tag + ""');"", 200); }else{ $('#tagTips').hide(); } } }).blur(function () { window.setTimeout(""$('#tagTips').hide();"", 200); })}); </script> <div id=""tagTips"" class=""inputTips""></div> "; LtlTags.Text = tagScript.Replace("[url]", AjaxCmsService.GetTagsUrl(PublishmentSystemId)); } if (contentId == 0) { var formCollection = new NameValueCollection(); if (Body.IsQueryExists("isUploadWord")) { var isFirstLineTitle = Body.GetQueryBool("isFirstLineTitle"); var isFirstLineRemove = Body.GetQueryBool("isFirstLineRemove"); var isClearFormat = Body.GetQueryBool("isClearFormat"); var isFirstLineIndent = Body.GetQueryBool("isFirstLineIndent"); var isClearFontSize = Body.GetQueryBool("isClearFontSize"); var isClearFontFamily = Body.GetQueryBool("isClearFontFamily"); var isClearImages = Body.GetQueryBool("isClearImages"); var contentLevel = Body.GetQueryInt("contentLevel"); var fileName = Body.GetQueryString("fileName"); formCollection = WordUtils.GetWordNameValueCollection(PublishmentSystemId, _nodeInfo.ContentModelId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, contentLevel, fileName); } AcAttributes.SetParameters(formCollection, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, false, IsPostBack); } else { AcAttributes.SetParameters(contentInfo?.Attributes, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, true, IsPostBack); TbTags.Text = contentInfo?.Tags; } if (HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentCheck)) { PhStatus.Visible = true; int checkedLevel; var isChecked = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo.NodeId, out checkedLevel); if (Body.IsQueryExists("contentLevel")) { checkedLevel = TranslateUtils.ToIntWithNagetive(Body.GetQueryString("contentLevel")); if (checkedLevel != LevelManager.LevelInt.NotChange) { isChecked = checkedLevel >= PublishmentSystemInfo.CheckContentLevel; } } LevelManager.LoadContentLevelToEdit(RblContentLevel, PublishmentSystemInfo, nodeId, contentInfo, isChecked, checkedLevel); } else { PhStatus.Visible = false; } BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()")); //自动检测敏感词 ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(PublishmentSystemInfo)); } else { AcAttributes.SetParameters(Request.Form, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, contentId != 0, IsPostBack); } DataBind(); } else { var success = false; string errorMessage; var savedContentId = SaveContentInfo(true, _isPreview, out errorMessage); if (savedContentId > 0) { success = true; } string jsonString = $@"{{success:'{success.ToString().ToLower()}',savedContentID:'{savedContentId}'}}"; PageUtils.ResponseToJson(jsonString); } }
public List <TableColumn> GetTableColumns(int siteId, int channelId) { if (siteId <= 0 || channelId <= 0) { return(null); } var siteInfo = SiteManager.GetSiteInfo(siteId); var nodeInfo = ChannelManager.GetChannelInfo(siteId, channelId); var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(siteId, channelId); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities); var tableColumnList = new List <TableColumn> { new TableColumn { AttributeName = ContentAttribute.Title, DataType = DataType.VarChar, DataLength = 255, InputStyle = new InputStyle { InputType = InputType.Text, DisplayName = "标题", IsRequired = true, ValidateType = ValidateType.None } } }; foreach (var styleInfo in tableStyleInfoList) { tableColumnList.Add(new TableColumn { AttributeName = styleInfo.AttributeName, DataType = DataType.VarChar, DataLength = 50, InputStyle = new InputStyle { InputType = styleInfo.InputType, DisplayName = styleInfo.DisplayName, DefaultValue = styleInfo.DefaultValue, IsRequired = styleInfo.Additional.IsRequired, ValidateType = styleInfo.Additional.ValidateType, MinNum = styleInfo.Additional.MinNum, MaxNum = styleInfo.Additional.MaxNum, RegExp = styleInfo.Additional.RegExp, Width = styleInfo.Additional.Width, } }); } tableColumnList.Add(new TableColumn { AttributeName = ContentAttribute.IsTop, DataType = DataType.VarChar, DataLength = 18, InputStyle = new InputStyle { InputType = InputType.CheckBox, DisplayName = "置顶" } }); tableColumnList.Add(new TableColumn { AttributeName = ContentAttribute.IsRecommend, DataType = DataType.VarChar, DataLength = 18, InputStyle = new InputStyle { InputType = InputType.CheckBox, DisplayName = "推荐" } }); tableColumnList.Add(new TableColumn { AttributeName = ContentAttribute.IsHot, DataType = DataType.VarChar, DataLength = 18, InputStyle = new InputStyle { InputType = InputType.CheckBox, DisplayName = "热点" } }); tableColumnList.Add(new TableColumn { AttributeName = ContentAttribute.IsColor, DataType = DataType.VarChar, DataLength = 18, InputStyle = new InputStyle { InputType = InputType.CheckBox, DisplayName = "醒目" } }); tableColumnList.Add(new TableColumn { AttributeName = ContentAttribute.AddDate, DataType = DataType.DateTime, InputStyle = new InputStyle { InputType = InputType.DateTime, DisplayName = "添加时间" } }); return(tableColumnList); }
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; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); _jsMethod = Body.GetQueryString("jsMethod"); PageUtils.CheckRequestParameter("PublishmentSystemID"); var nodeId = Body.GetQueryInt("NodeID"); if (nodeId == 0) { nodeId = PublishmentSystemId; } _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeInfo.NodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.True, !IsDuplicate.Checked, false); } else { spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.True, !Body.GetQueryBool("IsDuplicate"), true); } spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SortField = ContentAttribute.Id; spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, EContentModelType.Content, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeInfo.NodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeInfo.NodeId.ToString()); } IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate"); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } spContents.DataBind(); } }
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(); } }
private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, string leftText, string rightText, string formatString, string no, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, string isReturnToBrStr, bool isLower, bool isUpper, bool isOriginal, string type, StringDictionary attributes, string imageType) { var parsedContent = string.Empty; var isReturnToBr = false; if (string.IsNullOrEmpty(isReturnToBrStr)) { if (BackgroundContentAttribute.Summary.ToLower().Equals(type)) { isReturnToBr = true; } } else { isReturnToBr = TranslateUtils.ToBool(isReturnToBrStr, true); } var contentId = contextInfo.ContentID; var contentInfo = contextInfo.ContentInfo; if (contentInfo == null) { return(string.Empty); } if (isOriginal) { if (contentInfo.ReferenceId > 0 && contentInfo.SourceId > 0 && contentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType) == ETranslateContentType.Reference.ToString()) { var targetNodeId = contentInfo.SourceId; var targetPublishmentSystemId = DataProvider.NodeDao.GetPublishmentSystemId(targetNodeId); var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId); var targetNodeInfo = NodeManager.GetNodeInfo(targetPublishmentSystemId, targetNodeId); var tableStyle = NodeManager.GetTableStyle(targetPublishmentSystemInfo, targetNodeInfo); var tableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeInfo); var targetContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentInfo.ReferenceId); if (targetContentInfo != null && targetContentInfo.NodeId > 0) { //标题可以使用自己的 targetContentInfo.Title = contentInfo.Title; contentInfo = targetContentInfo; } } } if (!string.IsNullOrEmpty(formatString)) { formatString = formatString.Trim(); if (!formatString.StartsWith("{0")) { formatString = "{0:" + formatString; } if (!formatString.EndsWith("}")) { formatString = formatString + "}"; } } if (contentId != 0) { if (ContentAttribute.Title.ToLower().Equals(type)) { var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(pageInfo.PublishmentSystemId, contentInfo.NodeId); var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contentInfo.NodeId); var tableStyle = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, nodeInfo); var styleInfo = TableStyleManager.GetTableStyleInfo(tableStyle, tableName, type, relatedIdentities); if (wordNum == 0) { wordNum = contextInfo.TitleWordNum; } parsedContent = InputParserUtility.GetContentByTableStyle(contentInfo.Title, separator, pageInfo.PublishmentSystemInfo, tableStyle, styleInfo, formatString, attributes, node.InnerXml, false); parsedContent = StringUtils.ParseString(EInputTypeUtils.GetEnumType(styleInfo.InputType), parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); if (!isClearTags && !string.IsNullOrEmpty(contentInfo.Attributes[BackgroundContentAttribute.TitleFormatString])) { parsedContent = ContentUtility.FormatTitle(contentInfo.Attributes[BackgroundContentAttribute.TitleFormatString], parsedContent); } if (!contextInfo.IsInnerElement) { parsedContent = parsedContent.Replace("&", "&"); } if (pageInfo.PublishmentSystemInfo.Additional.IsContentTitleBreakLine) { parsedContent = parsedContent.Replace(" ", !contextInfo.IsInnerElement ? "<br />" : string.Empty); } } else if (BackgroundContentAttribute.Summary.ToLower().Equals(type)) { parsedContent = StringUtils.ParseString(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Summary), replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); if (!contextInfo.IsInnerElement) { parsedContent = parsedContent.Replace("&", "&"); } } else if (BackgroundContentAttribute.Content.ToLower().Equals(type)) { parsedContent = StringUtility.TextEditorContentDecode(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content), pageInfo.PublishmentSystemInfo); if (pageInfo.PublishmentSystemInfo.Additional.IsInnerLink) { var innerLinkInfoList = pageInfo.CacheOfInnerLinkInfoList; if (innerLinkInfoList != null && innerLinkInfoList.Count > 0) { InnerLinkInfo newInnerLinkInfo; for (var i = 0; i < innerLinkInfoList.Count - 1; i++) { for (var j = i + 1; j < innerLinkInfoList.Count; j++) { if (innerLinkInfoList[i].InnerLinkName.Length < innerLinkInfoList[j].InnerLinkName.Length) { newInnerLinkInfo = innerLinkInfoList[i]; innerLinkInfoList[i] = innerLinkInfoList[j]; innerLinkInfoList[j] = newInnerLinkInfo; } } } var arrayLinkName = new List <string>(); var arrayInnerLink = new List <string>(); for (var i = 0; i < innerLinkInfoList.Count; i++) { newInnerLinkInfo = innerLinkInfoList[i]; arrayLinkName.Add(newInnerLinkInfo.InnerLinkName); arrayInnerLink.Add(newInnerLinkInfo.InnerString); } for (var m = 0; m < arrayLinkName.Count; m++) { var innerLinkName = arrayLinkName[m]; arrayLinkName[m] = Guid.NewGuid().ToString(); parsedContent = RegexUtils.Replace( $"({innerLinkName.Replace(" ", "\\s")})(?!</a>)(?![^><]*>)", parsedContent, arrayLinkName[m], pageInfo.PublishmentSystemInfo.Additional.InnerLinkMaxNum); } for (var n = 0; n < arrayLinkName.Count; n++) { parsedContent = RegexUtils.Replace( $"({arrayLinkName[n].Replace(" ", "\\s")})(?!</a>)(?![^><]*>)", parsedContent, arrayInnerLink[n], pageInfo.PublishmentSystemInfo.Additional.InnerLinkMaxNum); } } } if (isClearTags) { parsedContent = StringUtils.StripTags(parsedContent); } if (!string.IsNullOrEmpty(replace)) { parsedContent = StringUtils.Replace(replace, parsedContent, to); } if (wordNum > 0 && !string.IsNullOrEmpty(parsedContent)) { parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis); } if (!string.IsNullOrEmpty(formatString)) { parsedContent = string.Format(formatString, parsedContent); } if (!contextInfo.IsInnerElement) { parsedContent = parsedContent.Replace("&", "&"); } } else if (BackgroundContentAttribute.PageContent.ToLower().Equals(type)) { //if (contextInfo.IsInnerElement) // { parsedContent = StringUtility.TextEditorContentDecode(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content), pageInfo.PublishmentSystemInfo); if (pageInfo.PublishmentSystemInfo.Additional.IsInnerLink) { var innerLinkInfoList = pageInfo.CacheOfInnerLinkInfoList; if (innerLinkInfoList != null && innerLinkInfoList.Count > 0) { InnerLinkInfo newInnerLinkInfo; for (var i = 0; i < innerLinkInfoList.Count - 1; i++) { for (var j = i + 1; j < innerLinkInfoList.Count; j++) { if (innerLinkInfoList[i].InnerLinkName.Length < innerLinkInfoList[j].InnerLinkName.Length) { newInnerLinkInfo = innerLinkInfoList[i]; innerLinkInfoList[i] = innerLinkInfoList[j]; innerLinkInfoList[j] = newInnerLinkInfo; } } } for (var i = 0; i < innerLinkInfoList.Count; i++) { newInnerLinkInfo = innerLinkInfoList[i]; for (var j = i + 1; j < innerLinkInfoList.Count; j++) { var lastInnerLinkInfo = innerLinkInfoList[j]; if (newInnerLinkInfo.InnerLinkName.Contains(lastInnerLinkInfo.InnerLinkName)) { innerLinkInfoList.Remove(lastInnerLinkInfo); } } parsedContent = RegexUtils.Replace( $"({newInnerLinkInfo.InnerLinkName.Replace(" ", "\\s")})(?!</a>)(?![^><]*>)", parsedContent, newInnerLinkInfo.InnerString, pageInfo.PublishmentSystemInfo.Additional.InnerLinkMaxNum); } } } if (isClearTags) { parsedContent = StringUtils.StripTags(parsedContent); } if (!string.IsNullOrEmpty(replace)) { parsedContent = StringUtils.Replace(replace, parsedContent, to); } if (wordNum > 0 && !string.IsNullOrEmpty(parsedContent)) { parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis); } if (!string.IsNullOrEmpty(formatString)) { parsedContent = string.Format(formatString, parsedContent); } } else if (ContentAttribute.AddDate.ToLower().Equals(type)) { parsedContent = DateUtils.Format(contentInfo.AddDate, formatString); } else if (ContentAttribute.LastEditDate.ToLower().Equals(type)) { parsedContent = DateUtils.Format(contentInfo.LastEditDate, formatString); } else if (BackgroundContentAttribute.ImageUrl.ToLower().Equals(type)) { if (no == "all") { var sbParsedContent = new StringBuilder(); //第一条 if (contextInfo.IsCurlyBrace) { sbParsedContent.Append(PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, GetImageUrlByType(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl), imageType))); } else { sbParsedContent.Append(InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, GetImageUrlByType(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl), imageType), attributes, false)); } //第n条 var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { var newExtendValue = GetImageUrlByType(extendValue, imageType); if (contextInfo.IsCurlyBrace) { sbParsedContent.Append(PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, newExtendValue)); } else { sbParsedContent.Append(InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, newExtendValue, attributes, false)); } } } parsedContent = sbParsedContent.ToString(); } else { var num = TranslateUtils.ToInt(no, 0); if (num <= 1) { if (contextInfo.IsCurlyBrace) { parsedContent = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, GetImageUrlByType(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl), imageType)); } else { parsedContent = InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, GetImageUrlByType(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl), imageType), attributes, false); } } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { var newExtendValue = GetImageUrlByType(extendValue, imageType); if (index == num) { if (contextInfo.IsCurlyBrace) { parsedContent = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, newExtendValue); } else { parsedContent = InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, newExtendValue, attributes, false); } break; } index++; } } } } } else if (BackgroundContentAttribute.VideoUrl.ToLower().Equals(type)) { if (no == "all") { var sbParsedContent = new StringBuilder(); //第一条 sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), attributes, false)); //第n条 var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.VideoUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, attributes, false)); } } parsedContent = sbParsedContent.ToString(); } else { var num = TranslateUtils.ToInt(no, 0); if (num <= 1) { parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), attributes, false); } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.VideoUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (index == num) { parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, attributes, false); break; } index++; } } } } } else if (BackgroundContentAttribute.FileUrl.ToLower().Equals(type)) { if (no == "all") { var sbParsedContent = new StringBuilder(); if (contextInfo.IsCurlyBrace) { //第一条 sbParsedContent.Append(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.FileUrl)); //第n条 var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { sbParsedContent.Append(extendValue); } } } else { //第一条 sbParsedContent.Append(InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo.Id, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.FileUrl), attributes, node.InnerXml, false)); //第n条 var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { sbParsedContent.Append(InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo.Id, extendValue, attributes, node.InnerXml, false)); } } } parsedContent = sbParsedContent.ToString(); } else { var num = TranslateUtils.ToInt(no, 0); if (contextInfo.IsCurlyBrace) { if (num <= 1) { parsedContent = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.FileUrl); } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (index == num) { parsedContent = extendValue; break; } index++; } } } } else { if (num <= 1) { parsedContent = InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo.Id, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.FileUrl), attributes, node.InnerXml, false); } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (index == num) { parsedContent = InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo.Id, extendValue, attributes, node.InnerXml, false); break; } index++; } } } } } } else if (BackgroundContentAttribute.NavigationUrl.ToLower().Equals(type)) { parsedContent = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, contentInfo); } else if (ContentAttribute.Tags.ToLower().Equals(type)) { parsedContent = contentInfo.Tags; } else if (StringUtils.StartsWithIgnoreCase(type, StlParserUtility.ItemIndex) && contextInfo.ItemContainer?.ContentItem != null) { var itemIndex = StlParserUtility.ParseItemIndex(contextInfo.ItemContainer.ContentItem.ItemIndex, type, contextInfo); parsedContent = !string.IsNullOrEmpty(formatString) ? string.Format(formatString, itemIndex) : itemIndex.ToString(); } else if (ContentAttribute.AddUserName.ToLower().Equals(type)) { if (!string.IsNullOrEmpty(contentInfo.AddUserName)) { var displayName = BaiRongDataProvider.AdministratorDao.GetDisplayName(contentInfo.AddUserName); parsedContent = string.IsNullOrEmpty(displayName) ? contentInfo.AddUserName : displayName; } } else { var isSelected = false; var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contentInfo.NodeId); var tableStyle = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, nodeInfo); //WCM SPECIFIC if (tableStyle == ETableStyle.GovInteractContent) { isSelected = true; if (GovInteractContentAttribute.State.ToLower().Equals(type)) { parsedContent = EGovInteractStateUtils.GetText(EGovInteractStateUtils.GetEnumType(contentInfo.GetExtendedAttribute(GovInteractContentAttribute.State))); } else if (StringUtils.EqualsIgnoreCase(type, GovInteractContentAttribute.Reply)) { var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(pageInfo.PublishmentSystemId, contentInfo.Id); if (replyInfo != null) { parsedContent = replyInfo.Reply; if (!string.IsNullOrEmpty(parsedContent)) { parsedContent = StringUtils.ParseString(EInputType.TextEditor, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); } } } else if (StringUtils.EqualsIgnoreCase(type, GovInteractContentAttribute.ReplyDepartment)) { var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(pageInfo.PublishmentSystemId, contentInfo.Id); if (replyInfo != null) { parsedContent = DepartmentManager.GetDepartmentName(replyInfo.DepartmentID); } } else if (StringUtils.EqualsIgnoreCase(type, GovInteractContentAttribute.ReplyUserName)) { var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(pageInfo.PublishmentSystemId, contentInfo.Id); if (replyInfo != null) { parsedContent = replyInfo.UserName; } } else if (StringUtils.EqualsIgnoreCase(type, GovInteractContentAttribute.ReplyDate)) { var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(pageInfo.PublishmentSystemId, contentInfo.Id); if (replyInfo != null) { var addDate = replyInfo.AddDate; parsedContent = DateUtils.Format(addDate, formatString); } } else if (StringUtils.EqualsIgnoreCase(type, GovInteractContentAttribute.ReplyFileUrl)) { var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(pageInfo.PublishmentSystemId, contentInfo.Id); if (replyInfo != null) { parsedContent = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, replyInfo.FileUrl); } } else { isSelected = false; } } //WCM SPECIFIC if (!isSelected && contentInfo.ContainsKey(type)) { if (!ContentAttribute.HiddenAttributes.Contains(type.ToLower())) { var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(pageInfo.PublishmentSystemId, contentInfo.NodeId); var tableName = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, nodeInfo); var styleInfo = TableStyleManager.GetTableStyleInfo(tableStyle, tableName, type, relatedIdentities); var num = TranslateUtils.ToInt(no); parsedContent = InputParserUtility.GetContentByTableStyle(contentInfo, separator, pageInfo.PublishmentSystemInfo, tableStyle, styleInfo, formatString, num, attributes, node.InnerXml, false); parsedContent = StringUtils.ParseString(EInputTypeUtils.GetEnumType(styleInfo.InputType), parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); } else { parsedContent = contentInfo.GetExtendedAttribute(type); parsedContent = StringUtils.ParseString(parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); } } if (!contextInfo.IsInnerElement) { parsedContent = parsedContent.Replace("&", "&"); } } if (!string.IsNullOrEmpty(parsedContent)) { parsedContent = leftText + parsedContent + rightText; } } else { if (!string.IsNullOrEmpty(type) && contextInfo.ItemContainer != null && contextInfo.ItemContainer.ContentItem != null) { parsedContent = DataBinder.Eval(contextInfo.ItemContainer.ContentItem.DataItem, type, "{0}"); parsedContent = StringUtils.ParseString(parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString); if (!string.IsNullOrEmpty(parsedContent)) { parsedContent = leftText + parsedContent + rightText; } } } return(parsedContent); }
public static List <BackgroundContentInfo> GetContentsByCsvFile(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { var contentInfoList = new List <BackgroundContentInfo>(); List <string> head; List <List <string> > rows; CsvUtils.Import(filePath, out head, out rows); if (rows.Count > 0) { var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType); // ArrayList tableStyleInfoArrayList = TableStyleManager.GetTableStyleInfoArrayList(ETableStyle.BackgroundContent, publishmentSystemInfo.AuxiliaryTableForContent, relatedidentityes); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); tableStyleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, tableStyleInfoList); var nameValueCollection = new NameValueCollection(); foreach (var styleInfo in tableStyleInfoList) { nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower(); } var attributeNames = new List <string>(); foreach (var columnName in head) { if (!string.IsNullOrEmpty(nameValueCollection[columnName])) { attributeNames.Add(nameValueCollection[columnName]); } else { attributeNames.Add(columnName); } } foreach (var row in rows) { var contentInfo = new BackgroundContentInfo(); if (row.Count != attributeNames.Count) { continue; } for (var i = 0; i < attributeNames.Count; i++) { var attributeName = attributeNames[i]; if (!string.IsNullOrEmpty(attributeName)) { var value = row[i]; contentInfo.SetExtendedAttribute(attributeName, value); } } if (!string.IsNullOrEmpty(contentInfo.Title)) { contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId; contentInfo.NodeId = nodeInfo.NodeId; contentInfo.LastEditDate = DateTime.Now; contentInfoList.Add(contentInfo); } } } return(contentInfoList); }
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", "channelId", "ID", "ReturnUrl"); _channelId = Body.GetQueryInt("channelId"); var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); _tableName = ChannelManager.GetTableName(SiteInfo, channelInfo); _contentId = Body.GetQueryInt("ID"); _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _contentInfo = DataProvider.ContentDao.GetContentInfo(_tableName, _contentId); if (IsPostBack) { return; } var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); var myStyleInfoArrayList = new ArrayList(); if (styleInfoList != null) { foreach (var styleInfo in styleInfoList) { myStyleInfoArrayList.Add(styleInfo); } } RptContents.DataSource = myStyleInfoArrayList; RptContents.ItemDataBound += RptContents_ItemDataBound; RptContents.DataBind(); LtlNodeName.Text = ChannelManager.GetChannelName(SiteId, _channelId); LtlTags.Text = _contentInfo.Tags; if (string.IsNullOrEmpty(LtlTags.Text)) { PhTags.Visible = false; } LtlContentGroup.Text = _contentInfo.GroupNameCollection; if (string.IsNullOrEmpty(LtlContentGroup.Text)) { PhContentGroup.Visible = false; } LtlLastEditDate.Text = DateUtils.GetDateAndTimeString(_contentInfo.LastEditDate); LtlAddUserName.Text = AdminManager.GetDisplayName(_contentInfo.AddUserName, true); LtlLastEditUserName.Text = AdminManager.GetDisplayName(_contentInfo.LastEditUserName, true); LtlContentLevel.Text = CheckManager.GetCheckState(SiteInfo, _contentInfo.IsChecked, _contentInfo.CheckedLevel); if (_contentInfo.ReferenceId > 0 && _contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString()) { var referenceSiteId = DataProvider.ChannelDao.GetSiteId(_contentInfo.SourceId); var referenceSiteInfo = SiteManager.GetSiteInfo(referenceSiteId); var referenceTableName = ChannelManager.GetTableName(referenceSiteInfo, _contentInfo.SourceId); var referenceContentInfo = DataProvider.ContentDao.GetContentInfo(referenceTableName, _contentInfo.ReferenceId); if (referenceContentInfo != null) { var pageUrl = PageUtility.GetContentUrl(referenceSiteInfo, referenceContentInfo, true); var referenceNodeInfo = ChannelManager.GetChannelInfo(referenceContentInfo.SiteId, referenceContentInfo.ChannelId); var addEditUrl = WebUtils.GetContentAddEditUrl(referenceSiteInfo.Id, referenceNodeInfo, _contentInfo.ReferenceId, Body.GetQueryString("ReturnUrl")); LtlScripts.Text += $@" <div class=""tips"">此内容为对内容 (站点:{referenceSiteInfo.SiteName},栏目:{referenceNodeInfo.ChannelName})“<a href=""{pageUrl}"" target=""_blank"">{_contentInfo.Title}</a>”(<a href=""{addEditUrl}"">编辑</a>) 的引用,内容链接将和原始内容链接一致</div>"; } } BtnSubmit.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowString(SiteInfo.Id, _channelId, _contentId, _returnUrl)); HlPreview.NavigateUrl = ApiRoutePreview.GetContentUrl(SiteId, _contentInfo.ChannelId, _contentInfo.Id); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdminName); PageUtils.CheckRequestParameter("siteId"); _channelId = Body.GetQueryInt("channelId"); if (_channelId == 0) { _channelId = SiteId; } var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, channelInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); SpContents.ControlToPaginate = RptContents; if (string.IsNullOrEmpty(Body.GetQueryString("channelId"))) { SpContents.ItemsPerPage = TranslateUtils.ToInt(DdlPageNum.SelectedValue) == 0 ? SiteInfo.Additional.PageSize : TranslateUtils.ToInt(DdlPageNum.SelectedValue); SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, DdlSearchType.SelectedValue, TbKeyword.Text, TbDateFrom.Text, TbDateTo.Text, true, ETriState.All, false, true); } else { SpContents.ItemsPerPage = Body.GetQueryInt("PageNum") == 0 ? SiteInfo.Additional.PageSize : Body.GetQueryInt("PageNum"); SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All, false, true); } SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += RptContents_ItemDataBound; if (!IsPostBack) { VerifySitePermissions(ConfigManager.Permissions.WebSite.ContentTrash); if (Body.IsQueryExists("IsDeleteAll")) { DataProvider.ContentDao.DeleteContentsByTrash(SiteId, tableName); Body.AddSiteLog(SiteId, "清空回收站"); SuccessMessage("成功清空回收站!"); AddWaitAndRedirectScript(PageUrl); return; } if (Body.IsQueryExists("IsRestore")) { var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); foreach (var channelId in idsDictionary.Keys) { var contentIdArrayList = idsDictionary[channelId]; DataProvider.ContentDao.TrashContents(SiteId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdArrayList); } Body.AddSiteLog(SiteId, "从回收站还原内容"); SuccessMessage("成功还原内容!"); AddWaitAndRedirectScript(PageUrl); return; } if (Body.IsQueryExists("IsRestoreAll")) { DataProvider.ContentDao.RestoreContentsByTrash(SiteId, tableName); Body.AddSiteLog(SiteId, "从回收站还原所有内容"); SuccessMessage("成功还原所有内容!"); AddWaitAndRedirectScript(PageUrl); return; } ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, false, Body.AdminName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } } //添加隐藏属性 DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("channelId")) { if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlPageNum, Body.GetQueryString("PageNum")); ControlUtils.SelectSingleItem(DdlSearchType, Body.GetQueryString("SearchType")); TbKeyword.Text = Body.GetQueryString("Keyword"); TbDateFrom.Text = Body.GetQueryString("DateFrom"); TbDateTo.Text = Body.GetQueryString("DateTo"); } SpContents.DataBind(); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete)) { BtnDelete.Visible = false; BtnDeleteAll.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, true, PageUrl)); BtnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?")); } BtnRestore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!")); BtnRestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?")); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); _nodeId = Body.GetQueryInt("NodeID"); if (_nodeId == 0) { _nodeId = PublishmentSystemId; } var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, this._nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, this._nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { if (TranslateUtils.ToInt(PageNum.SelectedValue) == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.All, false, true); } else { if (Body.GetQueryInt("PageNum") == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = Body.GetQueryInt("PageNum"); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All, false, true); } spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容回收站", AppManager.Cms.Permission.WebSite.ContentTrash); if (Body.IsQueryExists("IsDeleteAll")) { BaiRongDataProvider.ContentDao.DeleteContentsByTrash(PublishmentSystemId, tableName); Body.AddSiteLog(PublishmentSystemId, "清空回收站"); SuccessMessage("成功清空回收站!"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestore")) { var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); foreach (var nodeID in idsDictionary.Keys) { var contentIDArrayList = idsDictionary[nodeID]; DataProvider.ContentDao.TrashContents(PublishmentSystemId, NodeManager.GetTableName(PublishmentSystemInfo, nodeID), contentIDArrayList); } Body.AddSiteLog(PublishmentSystemId, "从回收站还原内容"); SuccessMessage("成功还原内容!"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestoreAll")) { DataProvider.ContentDao.RestoreContentsByTrash(PublishmentSystemId, tableName); Body.AddSiteLog(PublishmentSystemId, "从回收站还原所有内容"); SuccessMessage("成功还原所有内容!"); AddWaitAndRedirectScript(PageUrl); return; } NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, false, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum")); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } spContents.DataBind(); } if (!HasChannelPermissions(this._nodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { Delete.Visible = false; DeleteAll.Visible = false; } else { Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, true, PageUrl)); DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?")); } Restore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!")); RestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?")); }