コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: ModalGatherTest.cs プロジェクト: skotbenben/cms
        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();
        }
コード例 #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.Site, PublishmentSystemId, PublishmentSystemId);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, "站点属性设置", AppManager.Cms.Permission.WebSite.Configration);

                TbPublishmentSystemName.Text = PublishmentSystemInfo.PublishmentSystemName;

                LtlSettings.Text =
                    $@"<a class=""btn btn-success"" href=""{PageTableStyle.GetRedirectUrl(PublishmentSystemId,
                        ETableStyle.Site, DataProvider.PublishmentSystemDao.TableName, PublishmentSystemId)}"">设置站点属性</a>";

                AcAttributes.SetParameters(PublishmentSystemInfo.Additional.Attributes, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.Site, DataProvider.PublishmentSystemDao.TableName, true, IsPostBack);

                BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm"));
            }
            else
            {
                AcAttributes.SetParameters(Request.Form, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.Site, DataProvider.PublishmentSystemDao.TableName, true, IsPostBack);
            }
        }
コード例 #4
0
ファイル: TableStyleIe.cs プロジェクト: stonezhu870/cms-1
        public static void SingleExportTableStyles(ETableStyle tableStyle, string tableName, int publishmentSystemId, int relatedIdentity, string styleDirectoryPath)
        {
            var relatedIdentities = RelatedIdentities.GetRelatedIdentities(tableStyle, publishmentSystemId, relatedIdentity);

            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);
            }
        }
コード例 #5
0
ファイル: InputContentDao.cs プロジェクト: stonezhu870/cms-1
        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));
        }
コード例 #6
0
ファイル: StlInput.cs プロジェクト: skotbenben/cms
        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>");
        }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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("程序错误")));
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: InputTemplate.cs プロジェクト: stonezhu870/cms-1
        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;
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
            }
        }
コード例 #14
0
        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);
            }
        }
コード例 #15
0
ファイル: ModalInputAdd.cs プロジェクト: skotbenben/cms
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _isPreview = Body.GetQueryBool("IsPreview");

            if (IsPostBack)
            {
                return;
            }

            var inputId   = Body.GetQueryInt("InputID");
            var inputInfo = DataProvider.InputDao.GetInputInfo(inputId);

            if (inputInfo != null)
            {
                PhAdministratorSmsNotify.Visible = true;

                TbInputName.Text = inputInfo.InputName;
                ControlUtils.SelectListItems(RblIsChecked, inputInfo.IsChecked.ToString());
                ControlUtils.SelectListItems(RblIsReply, inputInfo.IsReply.ToString());
                ControlUtils.SelectListItems(RblIsAnomynous, inputInfo.Additional.IsAnomynous.ToString());

                ControlUtils.SelectListItems(RblIsAdministratorSmsNotify,
                                             inputInfo.Additional.IsAdministratorSmsNotify.ToString());
                TbAdministratorSmsNotifyTplId.Text = inputInfo.Additional.AdministratorSmsNotifyTplId;

                var keys = TranslateUtils.StringCollectionToStringList(inputInfo.Additional.AdministratorSmsNotifyKeys);
                CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(InputContentAttribute.Id, InputContentAttribute.Id));
                CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(InputContentAttribute.AddDate,
                                                                     InputContentAttribute.AddDate));
                var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent,
                                                                               PublishmentSystemId, inputInfo.InputId);
                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent,
                                                                            DataProvider.InputContentDao.TableName, relatedIdentities);
                foreach (var styleInfo in styleInfoList)
                {
                    CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(styleInfo.AttributeName,
                                                                         styleInfo.AttributeName));
                }
                ControlUtils.SelectListItems(CblAdministratorSmsNotifyKeys, keys);

                TbAdministratorSmsNotifyMobile.Text = inputInfo.Additional.AdministratorSmsNotifyMobile;
            }
            else
            {
                PhAdministratorSmsNotify.Visible = false;
            }

            RblIsAdministratorSmsNotify_SelectedIndexChanged(null, EventArgs.Empty);
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        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("程序错误")));
            }
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var inputId = int.Parse(Body.GetQueryString("InputID"));

            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));
            _inputInfo = DataProvider.InputDao.GetInputInfo(inputId);

            if (Body.IsQueryExists("ContentID"))
            {
                _contentId = int.Parse(Body.GetQueryString("ContentID"));
            }
            else
            {
                _contentId = 0;
            }

            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, PublishmentSystemId, inputId);

            if (!IsPostBack)
            {
                if (_contentId != 0)
                {
                    var contentInfo = DataProvider.InputContentDao.GetContentInfo(_contentId);
                    if (contentInfo != null)
                    {
                        ContentControl.SetParameters(contentInfo.Attributes, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.InputContent, DataProvider.InputContentDao.TableName, true, IsPostBack);
                    }
                }
                else
                {
                    ContentControl.SetParameters(null, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.InputContent, DataProvider.InputContentDao.TableName, false, IsPostBack);
                }
            }
            else
            {
                if (_contentId != 0)
                {
                    ContentControl.SetParameters(Request.Form, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.InputContent, DataProvider.InputContentDao.TableName, true, IsPostBack);
                }
                else
                {
                    ContentControl.SetParameters(Request.Form, PublishmentSystemInfo, 0, _relatedIdentities, ETableStyle.InputContent, DataProvider.InputContentDao.TableName, false, IsPostBack);
                }
            }
        }
コード例 #20
0
        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);
            }
        }
コード例 #21
0
        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));
            }
        }
コード例 #22
0
ファイル: ModalContentExport.cs プロジェクト: skotbenben/cms
        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);
            }
        }
コード例 #23
0
        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]);
                }
            }
        }
コード例 #24
0
        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));
            }
        }
コード例 #25
0
        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);
        }
コード例 #26
0
        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("程序错误")));
            }
        }
コード例 #27
0
ファイル: ChannelInfo.cs プロジェクト: zhouwybetter/cms
        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> >());
        }
コード例 #28
0
        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);

            _contentInfo = DataProvider.InputContentDao.GetContentInfo(_contentId);
            if (!string.IsNullOrEmpty(_contentInfo.UserName))
            {
                //group_todo
                var showPopWinString = ModalUserView.GetOpenWindowString(_contentInfo.UserName);
                ltlAddUserName.Text =
                    $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{_contentInfo.UserName}</a>";
            }
            else
            {
                ltlAddUserName.Text = "匿名";
            }

            ltlIPAddress.Text = _contentInfo.IpAddress;
            ltlAddDate.Text   = DateUtils.GetDateAndTimeString(_contentInfo.AddDate);
            ltlReply.Text     = _contentInfo.Reply;

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, _relatedIdentities);

            rptContents.DataSource     = styleInfoList;
            rptContents.ItemDataBound += rptContents_ItemDataBound;
            rptContents.DataBind();
        }
コード例 #29
0
        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));
        }
コード例 #30
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string type, string formatString, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, bool isReturnToBr, bool isLower, bool isUpper)
        {
            if (string.IsNullOrEmpty(type))
            {
                return(string.Empty);
            }

            var parsedContent = string.Empty;

            if (contextInfo.ContextType == EContextType.Each)
            {
                parsedContent = contextInfo.ItemContainer.EachItem.DataItem as string;
                return(parsedContent);
            }

            if (type.ToLower().Equals(TypeSiteName.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.SiteName;
            }
            else if (type.ToLower().Equals(TypeSiteUrl.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.Additional.WebUrl;
            }
            else if (type.ToLower().Equals(TypeDate.ToLower()))
            {
                if (!pageInfo.BodyCodes.ContainsKey("datestring.js"))
                {
                    pageInfo.BodyCodes.Add("datestring.js", $@"<script charset=""{SiteFilesAssets.DateString.Charset}"" src=""{SiteFilesAssets.GetUrl(
                        pageInfo.ApiUrl, SiteFilesAssets.DateString.Js)}"" type=""text/javascript""></script>");
                }

                parsedContent = @"<script language=""javascript"" type=""text/javascript"">RunGLNL(false);</script>";
            }
            else if (type.ToLower().Equals(TypeDateOfTraditional.ToLower()))
            {
                if (!pageInfo.BodyCodes.ContainsKey("datestring"))
                {
                    pageInfo.BodyCodes.Add("datestring", $@"<script charset=""{SiteFilesAssets.DateString.Charset}"" src=""{SiteFilesAssets.GetUrl(
                        pageInfo.ApiUrl, SiteFilesAssets.DateString.Js)}"" type=""text/javascript""></script>");
                }

                parsedContent = @"<script language=""javascript"" type=""text/javascript"">RunGLNL(true);</script>";
            }
            else if (pageInfo.Parameters != null && pageInfo.Parameters.ContainsKey(type))
            {
                pageInfo.Parameters.TryGetValue(type, out parsedContent);
                parsedContent = StringUtils.ParseString(InputType.Text, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
            }
            else
            {
                if (pageInfo.SiteInfo.Additional.GetString(type) != null)
                {
                    parsedContent = pageInfo.SiteInfo.Additional.GetString(type);
                    if (!string.IsNullOrEmpty(parsedContent))
                    {
                        var styleInfo = TableStyleManager.GetTableStyleInfo(DataProvider.SiteDao.TableName, type, RelatedIdentities.GetRelatedIdentities(pageInfo.SiteId, pageInfo.SiteId));

                        // 如果 styleInfo.TableStyleId <= 0,表示此字段已经被删除了,不需要再显示值了 ekun008
                        if (styleInfo.Id > 0)
                        {
                            if (isClearTags && InputTypeUtils.EqualsAny(styleInfo.InputType, InputType.Image, InputType.File))
                            {
                                parsedContent = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, parsedContent, pageInfo.IsLocal);
                            }
                            else
                            {
                                parsedContent = InputParserUtility.GetContentByTableStyle(parsedContent, separator, pageInfo.SiteInfo, styleInfo, formatString, contextInfo.Attributes, contextInfo.InnerXml, false);
                                parsedContent = StringUtils.ParseString(styleInfo.InputType, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
                            }
                        }
                        else
                        { // 如果字段已经被删除或不再显示了,则此字段的值为空。有时虚拟字段值不会清空
                            parsedContent = string.Empty;
                        }
                    }
                }
            }
            return(parsedContent);
        }