public string GetSelectSqlStringWithChecked(int publishmentSystemId, int inputId, bool isReplyExists, bool isReply, int startNum, int totalNum, string whereString, string orderByString, LowerNameValueCollection others) { if (!string.IsNullOrEmpty(whereString) && !StringUtils.StartsWithIgnoreCase(whereString.Trim(), "AND ")) { whereString = "AND " + whereString.Trim(); } string sqlWhereString = $"WHERE InputID = {inputId} AND IsChecked = '{true}' {whereString}"; if (isReplyExists) { if (isReply) { sqlWhereString += " AND " + SqlUtils.GetNotNullAndEmpty("Reply"); } else { sqlWhereString += " AND " + SqlUtils.GetNullOrEmpty("Reply"); } } if (others != null && others.Count > 0) { var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, publishmentSystemId, inputId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, TableName, relatedIdentities); foreach (var tableStyleInfo in styleInfoList) { if (!string.IsNullOrEmpty(others.Get(tableStyleInfo.AttributeName))) { sqlWhereString += $" AND ({InputContentAttribute.SettingsXml} LIKE '%{tableStyleInfo.AttributeName}={others.Get(tableStyleInfo.AttributeName)}%')"; } } } return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TableName, startNum, totalNum, SqlUtils.Asterisk, sqlWhereString, orderByString)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "InputID", "ContentID"); var inputId = Body.GetQueryInt("InputID"); _contentId = Body.GetQueryInt("ContentID"); _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, PublishmentSystemId, inputId); _inputInfo = DataProvider.InputDao.GetInputInfo(inputId); _contentInfo = DataProvider.InputContentDao.GetContentInfo(_contentId); if (!Page.IsPostBack) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, _relatedIdentities); rptContents.DataSource = styleInfoList; rptContents.ItemDataBound += rptContents_ItemDataBound; rptContents.DataBind(); breReply.Text = _contentInfo.Reply; } }
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 tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); var styleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, nodeInfo); styleInfoList = ContentUtility.GetAllTableStyleInfoList(styleInfoList); var accessDao = new AccessDao(filePath); var createTableSqlString = accessDao.GetCreateTableSqlString(nodeInfo.ChannelName, styleInfoList, displayAttributes); accessDao.ExecuteSqlString(createTableSqlString); bool isExport; var insertSqlList = accessDao.GetInsertSqlStringList(nodeInfo.ChannelName, siteInfo.Id, nodeInfo.Id, tableName, styleInfoList, displayAttributes, contentIdList, isPeriods, dateFrom, dateTo, checkedState, out isExport); foreach (var insertSql in insertSqlList) { accessDao.ExecuteSqlString(insertSql); } return(isExport); }
public string GetEditStyleHtml(int tableMetadataId, string attributeName) { var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(_tableType); var styleInfo = TableStyleManager.GetTableStyleInfo(tableStyle, _tableName, attributeName, null); var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(0, _tableName, attributeName, tableStyle, _redirectUrl); var editText = "设置"; if (styleInfo.TableStyleId != 0)//数据库中有样式 { editText = "修改"; } string retval = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>"; if (styleInfo.TableStyleId == 0) { return(retval); } var attributes = new NameValueCollection { { "DeleteStyle", true.ToString() }, { "TableMetadataID", tableMetadataId.ToString() }, { "AttributeName", attributeName } }; var deleteUrl = PageUtils.AddQueryString(_redirectUrl, attributes); retval += $@" <a href=""{deleteUrl}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; return(retval); }
public void DeleteAndInsertStyleItems(IDbTransaction trans, int tableStyleId, List <TableStyleItemInfo> styleItems) { var parms = new IDataParameter[] { GetParameter(ParmTableStyleId, DataType.Integer, tableStyleId) }; var sqlString = $"DELETE FROM {TableName} WHERE {nameof(TableStyleItemInfo.TableStyleId)} = @{nameof(TableStyleItemInfo.TableStyleId)}"; ExecuteNonQuery(trans, sqlString, parms); if (styleItems == null || styleItems.Count == 0) { return; } sqlString = $"INSERT INTO {TableName} ({nameof(TableStyleItemInfo.TableStyleId)}, {nameof(TableStyleItemInfo.ItemTitle)}, {nameof(TableStyleItemInfo.ItemValue)}, {nameof(TableStyleItemInfo.IsSelected)}) VALUES (@{nameof(TableStyleItemInfo.TableStyleId)}, @{nameof(TableStyleItemInfo.ItemTitle)}, @{nameof(TableStyleItemInfo.ItemValue)}, @{nameof(TableStyleItemInfo.IsSelected)})"; foreach (var itemInfo in styleItems) { var insertItemParms = new IDataParameter[] { GetParameter(ParmTableStyleId, DataType.Integer, itemInfo.TableStyleId), GetParameter(ParmItemTitle, DataType.VarChar, 255, itemInfo.ItemTitle), GetParameter(ParmItemValue, DataType.VarChar, 255, itemInfo.ItemValue), GetParameter(ParmIsSelected, DataType.VarChar, 18, itemInfo.IsSelected.ToString()) }; ExecuteNonQuery(trans, sqlString, insertItemParms); } TableStyleManager.ClearCache(); }
public static bool CreateAccessFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, List <int> contentIDArrayList, 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(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); styleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, styleInfoList); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var accessDAO = new AccessDao(filePath); var createTableSqlString = accessDAO.GetCreateTableSqlString(nodeInfo.NodeName, styleInfoList, displayAttributes); accessDAO.ExecuteSqlString(createTableSqlString); bool isExport; var insertSqlArrayList = accessDAO.GetInsertSqlStringArrayList(nodeInfo.NodeName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, tableStyle, tableName, styleInfoList, displayAttributes, contentIDArrayList, isPeriods, dateFrom, dateTo, checkedState, out isExport); foreach (string insertSql in insertSqlArrayList) { accessDAO.ExecuteSqlString(insertSql); } return(isExport); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); var relatedIdentities = RelatedIdentities.GetRelatedIdentities(SiteId, SiteId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.SiteDao.TableName, relatedIdentities); if (!IsPostBack) { VerifySitePermissions(ConfigManager.Permissions.WebSite.Configration); TbSiteName.Text = SiteInfo.SiteName; LtlAttributes.Text = GetAttributesHtml(SiteInfo.Additional.ToNameValueCollection()); BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm")); } else { LtlAttributes.Text = GetAttributesHtml(Request.Form); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _styleInfoList = TableStyleManager.GetSiteStyleInfoList(SiteId); if (!IsPostBack) { VerifySitePermissions(ConfigManager.WebSitePermissions.Configration); TbSiteName.Text = SiteInfo.SiteName; var nameValueCollection = TranslateUtils.DictionaryToNameValueCollection(SiteInfo.Additional.ToDictionary()); LtlAttributes.Text = GetAttributesHtml(nameValueCollection); BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm")); } else { LtlAttributes.Text = GetAttributesHtml(Request.Form); } }
public static void SingleExportTableStyles(ETableStyle tableStyle, string tableName, string styleDirectoryPath) { var relatedIdentities = new List <int> { 0 }; DirectoryUtils.DeleteDirectoryIfExists(styleDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(styleDirectoryPath); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var tableStyleInfo in styleInfoList) { var filePath = PathUtils.Combine(styleDirectoryPath, tableStyleInfo.AttributeName + ".xml"); var feed = ExportTableStyleInfo(tableStyleInfo); var styleItems = BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(tableStyleInfo.TableStyleId); if (styleItems != null && styleItems.Count > 0) { foreach (var styleItemInfo in styleItems) { var entry = ExportTableStyleItemInfo(styleItemInfo); feed.Entries.Add(entry); } } feed.Save(filePath); } }
public static void SingleExportTableStyles(string tableName, int siteId, int relatedIdentity, string styleDirectoryPath) { var channelInfo = ChannelManager.GetChannelInfo(siteId, relatedIdentity); var relatedIdentities = TableStyleManager.GetRelatedIdentities(channelInfo); DirectoryUtils.DeleteDirectoryIfExists(styleDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(styleDirectoryPath); var styleInfoList = TableStyleManager.GetStyleInfoList(tableName, relatedIdentities); foreach (var tableStyleInfo in styleInfoList) { var filePath = PathUtils.Combine(styleDirectoryPath, tableStyleInfo.AttributeName + ".xml"); var feed = ExportTableStyleInfo(tableStyleInfo); var styleItems = tableStyleInfo.StyleItems; if (styleItems != null && styleItems.Count > 0) { foreach (var styleItemInfo in styleItems) { var entry = ExportTableStyleItemInfo(styleItemInfo); feed.Entries.Add(entry); } } feed.Save(filePath); } }
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 void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableName = DataProvider.SiteDao.TableName; _itemId = AuthRequest.GetQueryInt("itemID"); _relatedIdentities = TableStyleManager.GetRelatedIdentities(SiteId); _attributeNames = TableColumnManager.GetTableColumnNameList(_tableName); _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Configration); //删除样式 if (AuthRequest.IsQueryExists("DeleteStyle")) { var attributeName = AuthRequest.GetQueryString("AttributeName"); if (TableStyleManager.IsExists(SiteId, _tableName, attributeName)) { try { DataProvider.TableStyleDao.Delete(SiteId, _tableName, attributeName); AuthRequest.AddSiteLog(SiteId, "删除数据表单样式", $"表单:{_tableName},字段:{attributeName}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } } if (!string.IsNullOrEmpty(_returnUrl)) { BtnReturn.Attributes.Add("onclick", $"location.href='{_returnUrl}';return false;"); } else { BtnReturn.Visible = false; } RptContents.DataSource = TableStyleManager.GetSiteStyleInfoList(SiteId); RptContents.ItemDataBound += RptContents_ItemDataBound; RptContents.DataBind(); var redirectUrl = GetRedirectUrl(SiteId, _itemId, _returnUrl); 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, SiteId)); BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, SiteId)); }
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 PairList GetAllTableStyleInfoPairs() { var pairs = new PairList(); using (var rdr = ExecuteReader(SqlSelectAllTableStyle)) { while (rdr.Read()) { var styleInfo = GetTableStyleInfoByReader(rdr); var inputType = styleInfo.InputType; if (InputTypeUtils.IsWithStyleItems(inputType)) { styleInfo.StyleItems = DataProvider.TableStyleItemDao.GetStyleItemInfoList(styleInfo.Id); } var key = TableStyleManager.GetCacheKey(styleInfo.RelatedIdentity, styleInfo.TableName, styleInfo.AttributeName); if (!pairs.ContainsKey(key)) { var pair = new Pair(key, styleInfo); pairs.Add(pair); } } rdr.Close(); } return(pairs); }
public IHttpActionResult Get() { try { var request = new AuthenticatedRequest(); if (!request.IsAdminLoggin) { return(Unauthorized()); } var tableName = request.GetQueryString("tableName"); var attributeName = request.GetQueryString("attributeName"); var relatedIdentities = TranslateUtils.StringCollectionToIntList(request.GetQueryString("relatedIdentities")); var styleInfo = TableStyleManager.GetTableStyleInfo(tableName, attributeName, relatedIdentities); var veeValidate = string.Empty; if (styleInfo != null) { veeValidate = styleInfo.Additional.VeeValidate; } return(Ok(new { Value = veeValidate })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public static string GetDefaultStlInputStlElement(PublishmentSystemInfo publishmentSystemInfo, InputInfo inputInfo) { var pageScripts = new NameValueCollection(); var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, publishmentSystemInfo.PublishmentSystemId, inputInfo.InputId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, relatedIdentities); var attributesHtml = GetAttributesHtml(pageScripts, publishmentSystemInfo, styleInfoList); var template = attributesHtml + StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.TemplatePath); var loading = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.LoadingPath); var yes = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.YesPath); var no = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.NoPath); return($@" <stl:input inputName=""{inputInfo.InputName}""> <stl:template> {template} </stl:template> <stl:loading> {loading} </stl:loading> <stl:yes> {yes} </stl:yes> <stl:no> {no} </stl:no> </stl:input>"); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = Body.GetQueryInt("TableStyleID"); _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = Body.GetQueryString("TableName"); _attributeName = Body.GetQueryString("AttributeName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); if (_tableStyleId != 0) { _styleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId); } else { _styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities); } if (!IsPostBack) { IsValidate.Items[0].Value = true.ToString(); IsValidate.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsValidate, _styleInfo.Additional.IsValidate.ToString()); IsRequired.Items[0].Value = true.ToString(); IsRequired.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsRequired, _styleInfo.Additional.IsRequired.ToString()); if (EInputTypeUtils.EqualsAny(_styleInfo.InputType, EInputType.Text, EInputType.TextArea)) { phNum.Visible = true; } else { phNum.Visible = false; } MinNum.Text = _styleInfo.Additional.MinNum.ToString(); MaxNum.Text = _styleInfo.Additional.MaxNum.ToString(); EInputValidateTypeUtils.AddListItems(ValidateType); ControlUtils.SelectListItems(ValidateType, EInputValidateTypeUtils.GetValue(_styleInfo.Additional.ValidateType)); RegExp.Text = _styleInfo.Additional.RegExp; ErrorMessage.Text = _styleInfo.Additional.ErrorMessage; Validate_SelectedIndexChanged(null, EventArgs.Empty); } }
public Dictionary <string, object> ToDictionary() { var jObject = JObject.FromObject(this); var styleInfoList = TableStyleManager.GetChannelStyleInfoList(this); 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); var dict = jObject.ToObject <Dictionary <string, object> >(); if (Children == null) { Children = ChannelManager.GetChildren(SiteId, Id); } var list = Children.Select(channelInfo => channelInfo.ToDictionary()).ToList(); dict["Children"] = list; return(dict); }
public List <KeyValuePair <string, TableStyleInfo> > GetAllTableStyles() { var pairs = new List <KeyValuePair <string, TableStyleInfo> >(); var allItemsDict = DataProvider.TableStyleItemDao.GetAllTableStyleItems(); using (var rdr = ExecuteReader(SqlSelectAllTableStyle)) { while (rdr.Read()) { var styleInfo = GetTableStyleInfoByReader(rdr); allItemsDict.TryGetValue(styleInfo.Id, out var items); styleInfo.StyleItems = items; var key = TableStyleManager.GetKey(styleInfo.RelatedIdentity, styleInfo.TableName, styleInfo.AttributeName); if (pairs.All(pair => pair.Key != key)) { var pair = new KeyValuePair <string, TableStyleInfo>(key, styleInfo); pairs.Add(pair); } } rdr.Close(); } return(pairs); }
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 InputTemplate(PublishmentSystemInfo publishmentSystemInfo, InputInfo inputInfo) { _publishmentSystemInfo = publishmentSystemInfo; var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, publishmentSystemInfo.PublishmentSystemId, inputInfo.InputId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, relatedIdentities); _inputInfo = inputInfo; }
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); }
private object GetProfile(AuthenticatedRequest request) { return(new { Value = request.UserInfo, Config = ConfigManager.Instance.SystemConfigInfo, Styles = TableStyleManager.GetUserStyleInfoList() }); }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var styleInfo = (TableStyleInfo)e.Item.DataItem; var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName"); var ltlDisplayName = (Literal)e.Item.FindControl("ltlDisplayName"); var ltlInputType = (Literal)e.Item.FindControl("ltlInputType"); var ltlFieldType = (Literal)e.Item.FindControl("ltlFieldType"); var ltlValidate = (Literal)e.Item.FindControl("ltlValidate"); var ltlTaxis = (Literal)e.Item.FindControl("ltlTaxis"); var ltlEditStyle = (Literal)e.Item.FindControl("ltlEditStyle"); var ltlEditValidate = (Literal)e.Item.FindControl("ltlEditValidate"); ltlAttributeName.Text = styleInfo.AttributeName; ltlDisplayName.Text = styleInfo.DisplayName; ltlInputType.Text = InputTypeUtils.GetText(styleInfo.InputType); var columnInfo = TableColumnManager.GetTableColumnInfo(_tableName, styleInfo.AttributeName); ltlFieldType.Text = columnInfo != null ? $"真实 {DataTypeUtils.GetText(columnInfo.DataType)}" : "虚拟字段"; ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo); if (!StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title)) { var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl); ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>"; showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl); ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>"; } ltlTaxis.Text = styleInfo.Taxis.ToString(); if (styleInfo.RelatedIdentity != _channelInfo.Id) { return; } var urlStyle = PageUtils.GetCmsUrl(SiteId, nameof(PageTableStyleContent), new NameValueCollection { { "channelId", _channelInfo.Id.ToString() }, { "DeleteStyle", true.ToString() }, { "TableName", _tableName }, { "AttributeName", styleInfo.AttributeName } }); ltlEditStyle.Text += $@" <a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; }
public object GetProfile(RequestImpl request) { return(new { Value = request.UserInfo, Config = ConfigManager.Instance.SystemConfigInfo, Styles = TableStyleManager.GetUserStyleInfoList() }); }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var styleInfo = (TableStyleInfo)e.Item.DataItem; if (_attributeNames.Contains(styleInfo.AttributeName)) { e.Item.Visible = false; return; } var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName"); var ltlDisplayName = (Literal)e.Item.FindControl("ltlDisplayName"); var ltlInputType = (Literal)e.Item.FindControl("ltlInputType"); var ltlValidate = (Literal)e.Item.FindControl("ltlValidate"); var ltlTaxis = (Literal)e.Item.FindControl("ltlTaxis"); var ltlEditStyle = (Literal)e.Item.FindControl("ltlEditStyle"); var ltlEditValidate = (Literal)e.Item.FindControl("ltlEditValidate"); ltlAttributeName.Text = styleInfo.AttributeName; ltlDisplayName.Text = styleInfo.DisplayName; ltlInputType.Text = InputTypeUtils.GetText(styleInfo.InputType); ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo); var redirectUrl = GetRedirectUrl(SiteId, _relatedIdentity, _itemId, _returnUrl); var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, redirectUrl); var editText = styleInfo.RelatedIdentity == _relatedIdentity ? "修改" : "设置"; ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{editText}</a>"; showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, redirectUrl); ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>"; ltlTaxis.Text = styleInfo.Taxis.ToString(); if (styleInfo.RelatedIdentity != _relatedIdentity) { return; } var urlStyle = PageUtils.GetCmsUrl(SiteId, nameof(PageTableStyleSite), new NameValueCollection { { "TableName", _tableName }, { "RelatedIdentity", _relatedIdentity.ToString() }, { "DeleteStyle", true.ToString() }, { "AttributeName", styleInfo.AttributeName } }); ltlEditStyle.Text += $@" <a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var styleInfo = (TableStyleInfo)e.Item.DataItem; var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName"); var ltlDisplayName = (Literal)e.Item.FindControl("ltlDisplayName"); var ltlInputType = (Literal)e.Item.FindControl("ltlInputType"); var ltlFieldType = (Literal)e.Item.FindControl("ltlFieldType"); var ltlValidate = (Literal)e.Item.FindControl("ltlValidate"); var ltlTaxis = (Literal)e.Item.FindControl("ltlTaxis"); var ltlEditStyle = (Literal)e.Item.FindControl("ltlEditStyle"); var ltlEditValidate = (Literal)e.Item.FindControl("ltlEditValidate"); ltlAttributeName.Text = styleInfo.AttributeName; ltlDisplayName.Text = styleInfo.DisplayName; ltlInputType.Text = InputTypeUtils.GetText(styleInfo.InputType); var columnInfo = TableColumnManager.GetTableColumnInfo(_tableName, styleInfo.AttributeName); ltlFieldType.Text = columnInfo != null ? $"真实 {DataTypeUtils.GetText(columnInfo.DataType)}" : "虚拟字段"; ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo); var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(0, styleInfo.Id, new List <int> { 0 }, _tableName, styleInfo.AttributeName, _redirectUrl); var editText = styleInfo.Id != 0 ? "修改" : "添加"; ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{editText}</a>"; showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(0, styleInfo.Id, new List <int> { 0 }, _tableName, styleInfo.AttributeName, _redirectUrl); ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>"; ltlTaxis.Text = styleInfo.Taxis.ToString(); if (styleInfo.Id == 0) { return; } ltlEditStyle.Text += $@" <a href=""{PageUtils.GetSettingsUrl(nameof(PageSiteTableStyle), new NameValueCollection { {"tableName", _tableName}, {"DeleteStyle", true.ToString()}, {"AttributeName", styleInfo.AttributeName} })}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; }
public object GetRegister(RequestImpl request) { return(new { Value = request.UserInfo, Config = ConfigManager.Instance.SystemConfigInfo, Styles = TableStyleManager.GetUserStyleInfoList(), Groups = UserGroupManager.GetUserGroupInfoList() }); }
public static List <ContentInfo> GetContentsByAccessFile(string filePath, SiteInfo siteInfo, ChannelInfo nodeInfo) { var contentInfoList = new List <ContentInfo>(); var accessDao = new AccessDao(filePath); var tableNames = accessDao.GetTableNames(); if (tableNames != null && tableNames.Length > 0) { foreach (var tableName in tableNames) { var sqlString = $"SELECT * FROM [{tableName}]"; var dataset = accessDao.ReturnDataSet(sqlString); var oleDt = dataset.Tables[0]; if (oleDt.Rows.Count > 0) { var tableStyleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, nodeInfo); var nameValueCollection = new NameValueCollection(); foreach (var styleInfo in tableStyleInfoList) { nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower(); } //var attributeNames = new ArrayList(); //for (var i = 0; i < oleDt.Columns.Count; i++) //{ // var columnName = oleDt.Columns[i].ColumnName; // attributeNames.Add(!string.IsNullOrEmpty(nameValueCollection[columnName]) // ? nameValueCollection[columnName] // : columnName); //} foreach (DataRow row in oleDt.Rows) { var contentInfo = new ContentInfo(row); if (!string.IsNullOrEmpty(contentInfo.Title)) { contentInfo.SiteId = siteInfo.Id; contentInfo.ChannelId = nodeInfo.Id; contentInfo.LastEditDate = DateTime.Now; contentInfoList.Add(contentInfo); } } } } } return(contentInfoList); }
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); } }