コード例 #1
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;
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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>");
        }
コード例 #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
        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);
            }
        }
コード例 #7
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;
        }
コード例 #8
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);
        }
コード例 #9
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);
                }
            }
        }
コード例 #10
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();
        }
コード例 #11
0
        internal static string Parse(string stlEntity, PageInfo pageInfo, ContextInfo contextInfo)
        {
            var parsedContent = string.Empty;

            try
            {
                var entityName    = StlParserUtility.GetNameFromEntity(stlEntity);
                var attributeName = entityName.Substring(5, entityName.Length - 6);

                if (StringUtils.EqualsIgnoreCase(PoweredBy, attributeName))//支持信息
                {
                    parsedContent = @"Powered by <a href=""http://www.siteserver.cn"" target=""_blank"">SiteServer CMS</a>";
                }
                else if (StringUtils.EqualsIgnoreCase(RootUrl, attributeName))//系统根目录地址
                {
                    parsedContent = PageUtils.ParseConfigRootUrl("~");
                    if (!string.IsNullOrEmpty(parsedContent))
                    {
                        parsedContent = parsedContent.TrimEnd('/');
                    }
                }
                else if (StringUtils.EqualsIgnoreCase(ApiUrl, attributeName))//API地址
                {
                    parsedContent = pageInfo.ApiUrl.TrimEnd('/');
                }
                else if (StringUtils.EqualsIgnoreCase(SiteId, attributeName))//ID
                {
                    parsedContent = pageInfo.SiteId.ToString();
                }
                else if (StringUtils.EqualsIgnoreCase(SiteName, attributeName))//名称
                {
                    parsedContent = pageInfo.SiteInfo.SiteName;
                }
                else if (StringUtils.EqualsIgnoreCase(SiteUrl, attributeName))//域名地址
                {
                    parsedContent = PageUtility.GetSiteUrl(pageInfo.SiteInfo, pageInfo.IsLocal).TrimEnd('/');
                }
                else if (StringUtils.EqualsIgnoreCase(SiteDir, attributeName))//文件夹
                {
                    parsedContent = pageInfo.SiteInfo.SiteDir;
                }
                else if (StringUtils.EqualsIgnoreCase(CurrentUrl, attributeName))//当前页地址
                {
                    parsedContent = StlParserUtility.GetStlCurrentUrl(pageInfo.SiteInfo, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ContentInfo, pageInfo.TemplateInfo.TemplateType, pageInfo.TemplateInfo.Id, pageInfo.IsLocal);
                }
                else if (StringUtils.EqualsIgnoreCase(ChannelUrl, attributeName))//栏目页地址
                {
                    parsedContent = PageUtility.GetChannelUrl(pageInfo.SiteInfo, ChannelManager.GetChannelInfo(pageInfo.SiteId, contextInfo.ChannelId), pageInfo.IsLocal);
                }
                //else if (StringUtils.EqualsIgnoreCase(HomeUrl, attributeName))//用户中心地址
                //{
                //    parsedContent = pageInfo.HomeUrl.TrimEnd('/');
                //}
                //else if (StringUtils.EqualsIgnoreCase(attributeName, LoginUrl))
                //{
                //    var returnUrl = StlUtility.GetStlCurrentUrl(pageInfo.SiteInfo, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ContentInfo, pageInfo.TemplateInfo.TemplateType, pageInfo.TemplateInfo.TemplateId);
                //    parsedContent = HomeUtils.GetLoginUrl(pageInfo.HomeUrl, returnUrl);
                //}
                //else if (StringUtils.EqualsIgnoreCase(attributeName, LogoutUrl))
                //{
                //    var returnUrl = StlUtility.GetStlCurrentUrl(pageInfo.SiteInfo, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ContentInfo, pageInfo.TemplateInfo.TemplateType, pageInfo.TemplateInfo.TemplateId);
                //    parsedContent = HomeUtils.GetLogoutUrl(pageInfo.HomeUrl, returnUrl);
                //}
                //else if (StringUtils.EqualsIgnoreCase(attributeName, RegisterUrl))
                //{
                //    var returnUrl = StlUtility.GetStlCurrentUrl(pageInfo.SiteInfo, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ContentInfo, pageInfo.TemplateInfo.TemplateType, pageInfo.TemplateInfo.TemplateId);
                //    parsedContent = HomeUtils.GetRegisterUrl(pageInfo.HomeUrl, returnUrl);
                //}
                else if (StringUtils.StartsWithIgnoreCase(attributeName, "TableFor"))//
                {
                    if (StringUtils.EqualsIgnoreCase(attributeName, "TableForContent"))
                    {
                        parsedContent = pageInfo.SiteInfo.TableName;
                    }
                }
                else if (StringUtils.StartsWithIgnoreCase(attributeName, "Site"))//
                {
                    parsedContent = pageInfo.SiteInfo.Additional.GetString(attributeName.Substring(4));
                }
                else
                {
                    if (pageInfo.SiteInfo.Additional.ContainsKey(attributeName))
                    {
                        parsedContent = pageInfo.SiteInfo.Additional.GetString(attributeName);

                        if (!string.IsNullOrEmpty(parsedContent))
                        {
                            var styleInfo = TableStyleManager.GetTableStyleInfo(DataProvider.SiteDao.TableName, attributeName, RelatedIdentities.GetRelatedIdentities(pageInfo.SiteId, pageInfo.SiteId));

                            // 如果 styleInfo.TableStyleId <= 0,表示此字段已经被删除了,不需要再显示值了 ekun008
                            if (styleInfo.Id > 0)
                            {
                                parsedContent = InputTypeUtils.EqualsAny(styleInfo.InputType, InputType.Image,
                                                                         InputType.File)
                                    ? PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, parsedContent,
                                                                     pageInfo.IsLocal)
                                    : InputParserUtility.GetContentByTableStyle(parsedContent, string.Empty,
                                                                                pageInfo.SiteInfo, styleInfo, string.Empty, null, string.Empty,
                                                                                true);
                            }
                            else
                            { // 如果字段已经被删除或不再显示了,则此字段的值为空。有时虚拟字段值不会清空
                                parsedContent = string.Empty;
                            }
                        }
                    }
                }
            }
            catch
            {
                // ignored
            }

            return(parsedContent);
        }
コード例 #12
0
        public static void CreateExcelFileForInputContents(string filePath, PublishmentSystemInfo publishmentSystemInfo,
                                                           InputInfo inputInfo)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var head = new List <string>();
            var rows = new List <List <string> >();

            var relatedidentityes = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent,
                                                                           publishmentSystemInfo.PublishmentSystemId, inputInfo.InputID);
            var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent,
                                                                             DataProvider.InputContentDao.TableName, relatedidentityes);

            if (tableStyleInfoList.Count == 0)
            {
                throw new Exception("表单无字段,无法导出");
            }

            foreach (var tableStyleInfo in tableStyleInfoList)
            {
                head.Add(tableStyleInfo.DisplayName);
            }

            if (inputInfo.IsReply)
            {
                head.Add("回复");
            }
            head.Add("添加时间");

            var contentIdList = DataProvider.InputContentDao.GetContentIdListWithChecked(inputInfo.InputID);

            foreach (var contentId in contentIdList)
            {
                var contentInfo = DataProvider.InputContentDao.GetContentInfo(contentId);
                if (contentInfo != null)
                {
                    var row = new List <string>();

                    foreach (var tableStyleInfo in tableStyleInfoList)
                    {
                        var value = contentInfo.Attributes.Get(tableStyleInfo.AttributeName);

                        if (!string.IsNullOrEmpty(value))
                        {
                            value = InputParserUtility.GetContentByTableStyle(value, publishmentSystemInfo,
                                                                              ETableStyle.InputContent, tableStyleInfo);
                        }

                        row.Add(StringUtils.StripTags(value));
                    }

                    if (inputInfo.IsReply)
                    {
                        row.Add(StringUtils.StripTags(contentInfo.Reply));
                    }
                    row.Add(DateUtils.GetDateAndTimeString(contentInfo.AddDate));

                    rows.Add(row);
                }
            }

            CsvUtils.Export(filePath, head, rows);
        }
コード例 #13
0
        public static List <InputContentInfo> GetInputContentsByCsvFile(string filePath, PublishmentSystemInfo publishmentSystemInfo,
                                                                        InputInfo inputInfo)
        {
            var contentInfoList = new List <InputContentInfo>();

            List <string>         head;
            List <List <string> > rows;

            CsvUtils.Import(filePath, out head, out rows);

            if (rows.Count > 0)
            {
                var relatedidentityes = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent,
                                                                               publishmentSystemInfo.PublishmentSystemId, inputInfo.InputID);
                var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent,
                                                                                 DataProvider.InputContentDao.TableName, relatedidentityes);

                var nameValueCollection = new NameValueCollection();

                foreach (var styleInfo in tableStyleInfoList)
                {
                    nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower();
                }

                nameValueCollection["回复"]   = InputContentAttribute.Reply.ToLower();
                nameValueCollection["添加时间"] = InputContentAttribute.AddDate.ToLower();

                var attributeNames = new List <string>();
                foreach (var columnName in head)
                {
                    if (!string.IsNullOrEmpty(nameValueCollection[columnName]))
                    {
                        attributeNames.Add(nameValueCollection[columnName]);
                    }
                    else
                    {
                        attributeNames.Add(columnName);
                    }
                }

                foreach (var row in rows)
                {
                    if (row.Count != attributeNames.Count)
                    {
                        continue;
                    }

                    var contentInfo = new InputContentInfo(0, inputInfo.InputID, 0, true, string.Empty, string.Empty,
                                                           DateTime.Now, string.Empty);

                    for (var i = 0; i < attributeNames.Count; i++)
                    {
                        var attributeName = attributeNames[i];
                        if (!string.IsNullOrEmpty(attributeName))
                        {
                            var value = row[i];
                            contentInfo.SetExtendedAttribute(attributeName, value);
                        }
                    }

                    contentInfoList.Add(contentInfo);
                }
            }

            return(contentInfoList);
        }
コード例 #14
0
        public void Main(int publishmentSystemId, int inputId)
        {
            var body = new RequestBody();

            var       publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
            InputInfo inputInfo             = null;

            if (inputId > 0)
            {
                inputInfo = DataProvider.InputDao.GetInputInfo(inputId);
            }
            if (inputInfo != null)
            {
                var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, publishmentSystemId, inputInfo.InputId);

                var ipAddress = PageUtils.GetIpAddress();

                var contentInfo = new InputContentInfo(0, inputInfo.InputId, 0, inputInfo.IsChecked, body.UserName, ipAddress, DateTime.Now, string.Empty);

                try
                {
                    if (!inputInfo.Additional.IsAnomynous && !body.IsUserLoggin)
                    {
                        throw new Exception("请先登录系统!");
                    }

                    InputTypeParser.AddValuesToAttributes(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, publishmentSystemInfo, relatedIdentities, HttpContext.Current.Request.Form, contentInfo.Attributes, false);

                    if (HttpContext.Current.Request.Files.Count > 0)
                    {
                        foreach (var attributeName in HttpContext.Current.Request.Files.AllKeys)
                        {
                            var myFile = HttpContext.Current.Request.Files[attributeName];
                            if (myFile == null || "" == myFile.FileName)
                            {
                                continue;
                            }

                            var fileUrl = UploadFile(publishmentSystemInfo, myFile);
                            contentInfo.SetExtendedAttribute(attributeName, fileUrl);
                        }
                    }

                    DataProvider.InputContentDao.Insert(contentInfo);

                    string message;
                    if (string.IsNullOrEmpty(HttpContext.Current.Request.Form["successTemplateString"]))
                    {
                        if (string.IsNullOrEmpty(inputInfo.Additional.MessageSuccess))
                        {
                            message = "表单提交成功,正在审核。";
                            if (contentInfo.IsChecked)
                            {
                                message = "表单提交成功。";
                            }
                        }
                        else
                        {
                            message = inputInfo.Additional.MessageSuccess;
                        }
                    }
                    else
                    {
                        message = TranslateUtils.DecryptStringBySecretKey(HttpContext.Current.Request.Form["successTemplateString"]);
                    }

                    HttpContext.Current.Response.Write(InputTemplate.GetInputCallbackScript(publishmentSystemInfo, inputId, true, message));
                    HttpContext.Current.Response.End();

                    //if (contentInfo.IsChecked == EBoolean.True)
                    //{
                    //    FileSystemObject FSO = new FileSystemObject(base.PublishmentSystemID);
                    //    FSO.CreateImmediately(EChangedType.Add, ETemplateTypeUtils.GetEnumType(templateType), channelID, contentID, fileTemplateID);
                    //}
                }
                catch (Exception ex)
                {
                    string message;
                    if (string.IsNullOrEmpty(HttpContext.Current.Request.Form["failureTemplateString"]))
                    {
                        if (string.IsNullOrEmpty(inputInfo.Additional.MessageFailure))
                        {
                            message = "表单提交失败," + ex.Message;
                        }
                        else
                        {
                            message = inputInfo.Additional.MessageFailure;
                        }
                    }
                    else
                    {
                        message = TranslateUtils.DecryptStringBySecretKey(HttpContext.Current.Request.Form["failureTemplateString"]);
                    }

                    HttpContext.Current.Response.Write(InputTemplate.GetInputCallbackScript(publishmentSystemInfo, inputId, false, message));
                    HttpContext.Current.Response.End();
                }
            }
        }
コード例 #15
0
ファイル: StlInput.cs プロジェクト: skotbenben/cms
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            string parsedContent;

            try
            {
                var inputName = string.Empty;

                var ie = node.Attributes?.GetEnumerator();
                if (ie != null)
                {
                    while (ie.MoveNext())
                    {
                        var attr = (XmlAttribute)ie.Current;

                        if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeInputName))
                        {
                            inputName = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                        }
                    }
                }

                var inputId = DataProvider.InputDao.GetInputIdAsPossible(inputName, pageInfo.PublishmentSystemId);
                if (inputId <= 0)
                {
                    return(string.Empty);
                }

                var inputInfo         = DataProvider.InputDao.GetInputInfo(inputId);
                var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, pageInfo.PublishmentSystemId, inputInfo.InputId);
                var styleInfoList     = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, relatedIdentities);
                var pageScripts       = new NameValueCollection();
                var attributesHtml    = GetAttributesHtml(pageScripts, pageInfo.PublishmentSystemInfo, styleInfoList);

                string template;
                string loading;
                string yes;
                string no;
                StlInnerUtility.GetTemplateLoadingYesNo(node, pageInfo, out template, out loading, out yes, out no);

                if (string.IsNullOrEmpty(template))
                {
                    template = attributesHtml + StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.TemplatePath);
                }
                if (string.IsNullOrEmpty(loading))
                {
                    loading = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.LoadingPath);
                }
                if (string.IsNullOrEmpty(yes))
                {
                    yes = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.YesPath);
                }
                if (string.IsNullOrEmpty(no))
                {
                    no = StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.Input.NoPath);
                }

                parsedContent = ParseImpl(pageInfo, contextInfo, inputInfo, pageScripts, styleInfoList, template, loading, yes, no);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
コード例 #16
0
ファイル: PageTableStyle.cs プロジェクト: yankaics/cms-1
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentity   = string.IsNullOrEmpty(Body.GetQueryString("RelatedIdentity")) ? PublishmentSystemId : Body.GetQueryInt("RelatedIdentity");
            _tableStyle        = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _tableName         = Body.GetQueryString("TableName");
            _itemId            = Body.GetQueryInt("itemID");
            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity);
            _attributeNames    = TableManager.GetAttributeNameList(_tableStyle, _tableName);

            if (IsPostBack)
            {
                return;
            }

            if (_tableStyle == ETableStyle.InputContent)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单管理", AppManager.Cms.Permission.WebSite.Input);
            }
            else if (_tableStyle == ETableStyle.Site)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, "站点属性设置",
                           AppManager.Cms.Permission.WebSite.Configration);
            }
            else
            {
                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();
            }

            if (_tableStyle == ETableStyle.BackgroundContent)
            {
                var urlModel = PageContentModel.GetRedirectUrl(PublishmentSystemId);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlModel}';return false;");
            }
            else if (_tableStyle == ETableStyle.InputContent)
            {
                btnReturn.Attributes.Add("onclick", $"location.href='{PageInput.GetRedirectUrl(PublishmentSystemId)}';return false;");
            }
            else if (_tableStyle == ETableStyle.GovInteractContent)
            {
                var urlReturn = PageGovInteractListAll.GetRedirectUrl(PublishmentSystemId, 0);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;");
            }
            else if (_tableStyle == ETableStyle.Site)
            {
                btnReturn.Attributes.Add("onclick", $"location.href='{PageConfigurationSiteAttributes.GetRedirectUrl(PublishmentSystemId)}';return false;");
            }
            else
            {
                btnReturn.Visible = false;
            }

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);

            dgContents.DataSource     = styleInfoList;
            dgContents.ItemDataBound += dgContents_ItemDataBound;
            dgContents.DataBind();

            var redirectUrl = GetRedirectUrl(PublishmentSystemId, _tableStyle, _tableName, _relatedIdentity, _itemId);

            btnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, _tableStyle, redirectUrl));
            btnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, _tableStyle, redirectUrl));

            btnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle, PublishmentSystemId, _relatedIdentity));
            btnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName, PublishmentSystemId, _relatedIdentity));
        }
コード例 #17
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentity   = string.IsNullOrEmpty(Body.GetQueryString("RelatedIdentity")) ? SiteId : Body.GetQueryInt("RelatedIdentity");
            _tableName         = DataProvider.SiteDao.TableName;
            _itemId            = Body.GetQueryInt("itemID");
            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(SiteId, _relatedIdentity);
            _attributeNames    = TableMetadataManager.GetAttributeNameList(_tableName);
            _returnUrl         = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.Permissions.WebSite.Configration);

            //删除样式
            if (Body.IsQueryExists("DeleteStyle"))
            {
                var attributeName = Body.GetQueryString("AttributeName");
                if (TableStyleManager.IsExists(_relatedIdentity, _tableName, attributeName))
                {
                    try
                    {
                        TableStyleManager.Delete(_relatedIdentity, _tableName, attributeName);
                        Body.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.GetTableStyleInfoList(_tableName, _relatedIdentities);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            var redirectUrl = GetRedirectUrl(SiteId, _relatedIdentity, _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, _relatedIdentity));
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, _relatedIdentity));
        }
コード例 #18
0
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, string type, StringDictionary attributes, string formatString, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, bool isReturnToBR, bool isLower, bool isUpper)
        {
            var parsedContent = string.Empty;

            if (type.Length > 0)
            {
                if (type.ToLower().Equals(Type_SiteName.ToLower()))
                {
                    parsedContent = pageInfo.PublishmentSystemInfo.PublishmentSystemName;
                }
                else if (type.ToLower().Equals(Type_SiteUrl.ToLower()))
                {
                    parsedContent = pageInfo.PublishmentSystemInfo.PublishmentSystemUrl;
                }
                else if (type.ToLower().Equals(Type_Date.ToLower()))
                {
                    pageInfo.AddPageScriptsIfNotExists("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(Type_DateOfTraditional.ToLower()))
                {
                    pageInfo.AddPageScriptsIfNotExists("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.PublishmentSystemInfo.Additional.Attributes.Get(type) == null)
                    {
                        var stlTagInfo = DataProvider.StlTagDao.GetStlTagInfo(pageInfo.PublishmentSystemId, type);
                        if (stlTagInfo == null)
                        {
                            stlTagInfo = DataProvider.StlTagDao.GetStlTagInfo(0, type);
                        }
                        if (stlTagInfo != null && !string.IsNullOrEmpty(stlTagInfo.TagContent))
                        {
                            var innerBuilder = new StringBuilder(stlTagInfo.TagContent);
                            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                            parsedContent = innerBuilder.ToString();
                        }
                    }
                    else
                    {
                        parsedContent = pageInfo.PublishmentSystemInfo.Additional.Attributes[type];
                        if (!string.IsNullOrEmpty(parsedContent))
                        {
                            var styleInfo = TableStyleManager.GetTableStyleInfo(ETableStyle.Site, DataProvider.PublishmentSystemDao.TableName, type, RelatedIdentities.GetRelatedIdentities(ETableStyle.Site, pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId));

                            if (isClearTags && EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.Image, EInputType.File))
                            {
                                parsedContent = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, parsedContent);
                            }
                            else
                            {
                                parsedContent = InputParserUtility.GetContentByTableStyle(parsedContent, separator, pageInfo.PublishmentSystemInfo, ETableStyle.Site, styleInfo, formatString, attributes, node.InnerXml, false);
                                parsedContent = StringUtils.ParseString(EInputTypeUtils.GetEnumType(styleInfo.InputType), parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBR, isLower, isUpper, formatString);
                            }
                        }
                    }
                }
            }

            return(parsedContent);
        }
コード例 #19
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, SiteInfo siteInfo, 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 (siteInfo == null)
            {
                return(string.Empty);
            }

            var parsedContent = string.Empty;

            if (!string.IsNullOrEmpty(contextInfo.InnerHtml))
            {
                var preSiteInfo      = pageInfo.SiteInfo;
                var prePageChannelId = pageInfo.PageChannelId;
                var prePageContentId = pageInfo.PageContentId;

                pageInfo.ChangeSite(siteInfo, siteInfo.Id, 0, contextInfo);

                var innerBuilder = new StringBuilder(contextInfo.InnerHtml);
                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                parsedContent = innerBuilder.ToString();

                pageInfo.ChangeSite(preSiteInfo, prePageChannelId, prePageContentId, contextInfo);

                return(parsedContent);
            }

            var inputType = InputType.Text;

            if (type.ToLower().Equals(TypeSiteName.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.SiteName;
            }
            else if (type.ToLower().Equals(TypeSiteUrl.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.Additional.WebUrl;
            }
            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.InnerHtml, false);

                            inputType = styleInfo.InputType;

                            //parsedContent = StringUtils.ParseString(styleInfo.InputType, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
                        }
                    }
                    else
                    { // 如果字段已经被删除或不再显示了,则此字段的值为空。有时虚拟字段值不会清空
                        parsedContent = string.Empty;
                    }
                }
            }

            if (string.IsNullOrEmpty(parsedContent))
            {
                return(string.Empty);
            }

            return(StringUtils.ParseString(inputType, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString));
        }
コード例 #20
0
        public void Main(int publishmentSystemId, int inputId)
        {
            var body = new RequestBody();

            var       publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
            InputInfo inputInfo             = null;

            if (inputId > 0)
            {
                inputInfo = DataProvider.InputDao.GetInputInfo(inputId);
            }
            if (inputInfo != null)
            {
                var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, publishmentSystemId, inputInfo.InputId);

                var ipAddress = PageUtils.GetIpAddress();

                var contentInfo = new InputContentInfo(0, inputInfo.InputId, 0, inputInfo.IsChecked, body.UserName, ipAddress, DateTime.Now, string.Empty);

                try
                {
                    if (!inputInfo.Additional.IsAnomynous && !body.IsUserLoggin)
                    {
                        throw new Exception("请先登录系统!");
                    }

                    InputTypeParser.AddValuesToAttributes(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, publishmentSystemInfo, relatedIdentities, HttpContext.Current.Request.Form, contentInfo.Attributes, false);

                    if (HttpContext.Current.Request.Files.Count > 0)
                    {
                        foreach (var attributeName in HttpContext.Current.Request.Files.AllKeys)
                        {
                            var myFile = HttpContext.Current.Request.Files[attributeName];
                            if (myFile == null || "" == myFile.FileName)
                            {
                                continue;
                            }

                            var fileUrl = UploadFile(publishmentSystemInfo, myFile);
                            contentInfo.SetExtendedAttribute(attributeName, fileUrl);
                        }
                    }

                    contentInfo.Id = DataProvider.InputContentDao.Insert(contentInfo);

                    if (inputInfo.Additional.IsAdministratorSmsNotify)
                    {
                        var keys =
                            TranslateUtils.StringCollectionToStringList(inputInfo.Additional.AdministratorSmsNotifyKeys);
                        if (keys.Count > 0)
                        {
                            var parameters = new NameValueCollection();
                            if (keys.Contains(InputContentAttribute.Id))
                            {
                                parameters.Add(InputContentAttribute.Id, contentInfo.Id.ToString());
                            }
                            if (keys.Contains(InputContentAttribute.AddDate))
                            {
                                parameters.Add(InputContentAttribute.AddDate, DateUtils.GetDateAndTimeString(contentInfo.AddDate));
                            }
                            var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, relatedIdentities);
                            foreach (var styleInfo in styleInfoList)
                            {
                                if (keys.Contains(styleInfo.AttributeName))
                                {
                                    var value = contentInfo.GetExtendedAttribute(styleInfo.AttributeName);
                                    parameters.Add(styleInfo.AttributeName, value);
                                }
                            }

                            string errorMessage;
                            SmsManager.SendNotify(inputInfo.Additional.AdministratorSmsNotifyMobile,
                                                  inputInfo.Additional.AdministratorSmsNotifyTplId, parameters, out errorMessage);
                        }
                    }

                    HttpContext.Current.Response.Write(StlInput.GetPostMessageScript(inputId, true));
                    HttpContext.Current.Response.End();
                }
                catch (Exception)
                {
                    HttpContext.Current.Response.Write(StlInput.GetPostMessageScript(inputId, false));
                    HttpContext.Current.Response.End();
                }
            }
        }
コード例 #21
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "InputName");
            var theInputName = Body.GetQueryString("InputName");

            _inputInfo = DataProvider.InputDao.GetInputInfo(theInputName, PublishmentSystemId);
            if (_inputInfo == null)
            {
                return;
            }

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ContentIDCollection"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                try
                {
                    DataProvider.InputContentDao.Delete(arraylist);
                    Body.AddSiteLog(PublishmentSystemId, "删除提交表单内容", $"提交表单:{_inputInfo.InputName}");
                    SuccessMessage("删除成功!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "删除失败!");
                }
            }

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

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

            var isAnythingVisible = false;

            foreach (var styleInfo in _styleInfoList)
            {
                if (styleInfo.IsVisibleInList)
                {
                    isAnythingVisible = true;
                    break;
                }
            }
            if (!isAnythingVisible && _styleInfoList != null && _styleInfoList.Count > 0)
            {
                _styleInfoList[0].IsVisibleInList = true;
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;
            spContents.SelectCommand     = DataProvider.InputContentDao.GetSelectStringOfContentId(_inputInfo.InputId, string.Empty);
            spContents.SortField         = DataProvider.InputContentDao.GetSortFieldName();
            spContents.SortMode          = SortMode.DESC;
            rptContents.ItemDataBound   += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                spContents.DataBind();

                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单内容管理",
                                        $"{_inputInfo.InputName}({spContents.TotalCount})", AppManager.Cms.Permission.WebSite.Input);

                var showPopWinString = string.Empty;

                showPopWinString = ModalInputContentAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _inputInfo.InputId, PageUrl);
                AddButton.Attributes.Add("onclick", showPopWinString);


                //this.Delete.Attributes.Add("onclick", "return confirm(\"此操作将删除所选内容,确定吗?\");");
                Delete.Attributes.Add("onclick",
                                      PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                          PageUtils.GetCmsUrl(nameof(PageInputContent), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "InputName", _inputInfo.InputName },
                    { "Delete", true.ToString() }
                }), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的表单内容!", "此操作将删除所选内容,确定删除吗?"));

                Check.Attributes.Add("onclick", "return confirm(\"此操作将把所选内容设为审核通过,确定吗?\");");


                showPopWinString = ModalInputContentTaxis.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId, PageUrl);
                TaxisButton.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, true);
                SelectListButton.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, false);
                SelectFormButton.Attributes.Add("onclick", showPopWinString);

                ImportExcel.Attributes.Add("onclick", ModalInputContentImport.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId));

                ExportExcel.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId));

                var urlReturn = PageInput.GetRedirectUrl(PublishmentSystemId);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;");


                if (_styleInfoList != null)
                {
                    foreach (var styleInfo in _styleInfoList)
                    {
                        if (styleInfo.IsVisibleInList)
                        {
                            ltlColumnHeadRows.Text += $@"<td class=""center"">{styleInfo.DisplayName}</td>";
                        }
                    }
                }

                if (_inputInfo.IsReply)
                {
                    ltlHeadRowReply.Text = @"
<td class=""center"" style=""width:60px;"">是否回复</td>
<td class=""center"" style=""width:60px;"">&nbsp;</td>
";
                }
            }
        }
コード例 #22
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");
            if (Body.GetQueryBool("IsContent"))
            {
                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            }
            else
            {
                _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            }

            if (_tableStyle == ETableStyle.Channel)
            {
                var displayAttributes = PublishmentSystemInfo.Additional.ChannelDisplayAttributes;
                if (!_isList)
                {
                    displayAttributes = PublishmentSystemInfo.Additional.ChannelEditAttributes;
                }

                if (!IsPostBack)
                {
                    //添加默认属性
                    var listitem = new ListItem("栏目名称", NodeAttribute.ChannelName);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("栏目索引", NodeAttribute.ChannelIndex);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("生成页面路径", NodeAttribute.FilePath);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.FilePath))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    if (!_isList)
                    {
                        listitem = new ListItem("栏目图片地址", NodeAttribute.ImageUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ImageUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目正文", NodeAttribute.Content);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Content))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("外部链接", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("链接类型", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目模版", NodeAttribute.ChannelTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("内容模版", NodeAttribute.ContentTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ContentTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("关键字列表", NodeAttribute.Keywords);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Keywords))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("页面描述", NodeAttribute.Description);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Description))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    listitem = new ListItem("栏目组", NodeAttribute.ChannelGroupNameCollection);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelGroupNameCollection))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.NodeDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible == false)
                        {
                            continue;
                        }
                        listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    if (string.IsNullOrEmpty(displayAttributes))
                    {
                        if (!_isList)
                        {
                            foreach (ListItem item in DisplayAttributeCheckBoxList.Items)
                            {
                                item.Selected = true;
                            }
                        }
                        else
                        {
                            ControlUtils.SelectListItems(DisplayAttributeCheckBoxList, NodeAttribute.ChannelName, NodeAttribute.ChannelIndex);
                        }
                    }
                }
            }
            else if (ETableStyleUtils.IsContent(_tableStyle))
            {
                var nodeInfo  = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
                _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _relatedIdentity);
                var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

                if (!IsPostBack)
                {
                    var styleInfoList            = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);
                    var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(PublishmentSystemInfo, _tableStyle, styleInfoList);
                    foreach (var styleInfo in columnTableStyleInfoList)
                    {
                        if (styleInfo.AttributeName == ContentAttribute.Title)
                        {
                            continue;
                        }
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
            else if (_tableStyle == ETableStyle.InputContent)
            {
                var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity);
                _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity);

                if (!IsPostBack)
                {
                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (styleInfo.IsVisibleInList)
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
        }
コード例 #23
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);
        }
コード例 #24
0
ファイル: StlInputContent.cs プロジェクト: stonezhu870/cms-1
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, StringDictionary attributes, string leftText, string rightText, string formatString, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, bool isReturnToBr, bool isLower, bool isUpper, string type)
        {
            var parsedContent = string.Empty;

            if (InputContentAttribute.Id.ToLower().Equals(type))
            {
                parsedContent = SqlUtils.EvalString(contextInfo.ItemContainer.InputItem.DataItem, InputContentAttribute.Id);
            }
            else if (InputContentAttribute.AddDate.ToLower().Equals(type))
            {
                var addDate = SqlUtils.EvalDateTime(contextInfo.ItemContainer.InputItem.DataItem, InputContentAttribute.AddDate);
                parsedContent = DateUtils.Format(addDate, formatString);
            }
            else if (InputContentAttribute.UserName.ToLower().Equals(type))
            {
                parsedContent = SqlUtils.EvalString(contextInfo.ItemContainer.InputItem.DataItem, InputContentAttribute.UserName);
            }
            else if (InputContentAttribute.Reply.ToLower().Equals(type))
            {
                var content = SqlUtils.EvalString(contextInfo.ItemContainer.InputItem.DataItem, InputContentAttribute.Reply);
                parsedContent = content;
                parsedContent = StringUtils.ParseString(EInputType.TextEditor, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
            }
            else if (StringUtils.StartsWithIgnoreCase(type, StlParserUtility.ItemIndex))
            {
                parsedContent = StlParserUtility.ParseItemIndex(contextInfo.ItemContainer.InputItem.ItemIndex, type, contextInfo).ToString();
            }
            else
            {
                var id = SqlUtils.EvalInt(contextInfo.ItemContainer.InputItem.DataItem, InputContentAttribute.Id);
                var inputContentInfo = DataProvider.InputContentDao.GetContentInfo(id);
                if (inputContentInfo != null)
                {
                    parsedContent = inputContentInfo.GetExtendedAttribute(type);
                    if (!string.IsNullOrEmpty(parsedContent))
                    {
                        if (!InputContentAttribute.HiddenAttributes.Contains(type.ToLower()))
                        {
                            var styleInfo = TableStyleManager.GetTableStyleInfo(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, type, RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, pageInfo.PublishmentSystemId, inputContentInfo.InputId));
                            parsedContent = InputParserUtility.GetContentByTableStyle(parsedContent, separator, pageInfo.PublishmentSystemInfo, ETableStyle.InputContent, styleInfo, formatString, attributes, node.InnerXml, false);
                            parsedContent = StringUtils.ParseString(EInputTypeUtils.GetEnumType(styleInfo.InputType), parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(parsedContent))
            {
                parsedContent = leftText + parsedContent + rightText;
            }

            return(parsedContent);
        }