Example #1
0
        public List <TableStyleInfo> GetTableStyleInfoWithItemsList(string tableName, string attributeName)
        {
            var arraylist = new List <TableStyleInfo>();

            var parms = new IDataParameter[]
            {
                GetParameter(ParmTableName, EDataType.VarChar, 50, tableName),
                GetParameter(ParmAttributeName, EDataType.VarChar, 50, attributeName)
            };

            using (var rdr = ExecuteReader(SqlSelectTableStyles, parms))
            {
                while (rdr.Read())
                {
                    var styleInfo = GetTableStyleInfoByReader(rdr);
                    if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.CheckBox) || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Radio) || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.SelectMultiple) || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.SelectOne))
                    {
                        var styleItems = GetStyleItemInfoList(styleInfo.TableStyleId);
                        if (styleItems != null && styleItems.Count > 0)
                        {
                            styleInfo.StyleItems = styleItems;
                        }
                    }
                    arraylist.Add(styleInfo);
                }
                rdr.Close();
            }

            return(arraylist);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = Body.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = Body.GetQueryString("TableName");
            _attributeName = Body.GetQueryString("AttributeName");
            _tableStyle    = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl   = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            if (_tableStyleId != 0)
            {
                _styleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId);
            }
            else
            {
                _styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities);
            }

            if (!IsPostBack)
            {
                IsValidate.Items[0].Value = true.ToString();
                IsValidate.Items[1].Value = false.ToString();

                ControlUtils.SelectListItems(IsValidate, _styleInfo.Additional.IsValidate.ToString());

                IsRequired.Items[0].Value = true.ToString();
                IsRequired.Items[1].Value = false.ToString();

                ControlUtils.SelectListItems(IsRequired, _styleInfo.Additional.IsRequired.ToString());

                if (EInputTypeUtils.EqualsAny(_styleInfo.InputType, EInputType.Text, EInputType.TextArea))
                {
                    phNum.Visible = true;
                }
                else
                {
                    phNum.Visible = false;
                }

                MinNum.Text = _styleInfo.Additional.MinNum.ToString();
                MaxNum.Text = _styleInfo.Additional.MaxNum.ToString();

                EInputValidateTypeUtils.AddListItems(ValidateType);
                ControlUtils.SelectListItems(ValidateType, EInputValidateTypeUtils.GetValue(_styleInfo.Additional.ValidateType));

                RegExp.Text       = _styleInfo.Additional.RegExp;
                ErrorMessage.Text = _styleInfo.Additional.ErrorMessage;

                Validate_SelectedIndexChanged(null, EventArgs.Empty);
            }
        }
Example #3
0
        public static Dictionary <string, object> ContentToDictionary(ContentInfo contentInfo, ETableStyle tableStyle, string tableName, List <int> relatedIdentities)
        {
            var dict = TranslateUtils.ObjectToDictionary(contentInfo);

            dict.Remove("Attributes");

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);

            foreach (var styleInfo in styleInfoList)
            {
                if (!styleInfo.IsVisible)
                {
                    continue;
                }
                if (!dict.ContainsKey(styleInfo.AttributeName))
                {
                    dict[styleInfo.AttributeName] = contentInfo.GetExtendedAttribute(styleInfo.AttributeName);
                }
                if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Image))
                {
                    var extendName  = ContentAttribute.GetExtendAttributeName(styleInfo.AttributeName);
                    var extendValue = contentInfo.GetExtendedAttribute(extendName);
                    if (!string.IsNullOrEmpty(extendValue))
                    {
                        dict[extendName] = extendValue;
                    }
                }
            }

            return(dict);
        }
Example #4
0
        public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, Control containerControl, NameValueCollection attributes)
        {
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible == false)
                {
                    continue;
                }
                var theValue = GetValueByControl(styleInfo, publishmentSystemInfo, containerControl);

                if (!EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.TextEditor, EInputType.Image, EInputType.File, EInputType.Video) && styleInfo.AttributeName != BackgroundContentAttribute.LinkUrl)
                {
                    theValue = PageUtils.FilterSqlAndXss(theValue);
                }

                ExtendedAttributes.SetExtendedAttribute(attributes, styleInfo.AttributeName, theValue);
            }

            //ArrayList metadataInfoArrayList = TableManager.GetTableMetadataInfoArrayList(tableName);
            //foreach (TableMetadataInfo metadataInfo in metadataInfoArrayList)
            //{
            //    if (!isSystemContained && metadataInfo.IsSystem == EBoolean.True) continue;

            //    TableStyleInfo styleInfo = TableStyleManager.GetTableStyleInfo(tableType, metadataInfo, relatedIdentities);
            //    if (styleInfo.IsVisible == EBoolean.False) continue;

            //    string theValue = InputTypeParser.GetValueByControl(metadataInfo, styleInfo, publishmentSystemInfo, containerControl);
            //    ExtendedAttributes.SetExtendedAttribute(attributes, metadataInfo.AttributeName, theValue);
            //}
        }
Example #5
0
        public static Dictionary <string, List <TableStyleInfo> > GetTableStyleInfoWithItemsDictinary(string tableName, List <int> allRelatedIdentities)
        {
            var dict = new Dictionary <string, List <TableStyleInfo> >();

            var entries = GetAllTableStyleInfoPairs();

            foreach (var key in entries.Keys)
            {
                var identityFromKey  = TranslateUtils.ToInt(key.Split('$')[0]);
                var tableNameFromKey = key.Split('$')[1];
                if (!StringUtils.EqualsIgnoreCase(tableNameFromKey, tableName) ||
                    !allRelatedIdentities.Contains(identityFromKey))
                {
                    continue;
                }

                var styleInfo = (TableStyleInfo)entries.GetValue(key);
                if (EInputTypeUtils.IsWithStyleItems(EInputTypeUtils.GetEnumType(styleInfo.InputType)))
                {
                    styleInfo.StyleItems = BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(styleInfo.TableStyleId);
                }
                var tableStyleInfoWithItemList = dict.ContainsKey(styleInfo.AttributeName) ? dict[styleInfo.AttributeName] : new List <TableStyleInfo>();
                tableStyleInfoWithItemList.Add(styleInfo);
                dict[styleInfo.AttributeName] = tableStyleInfoWithItemList;
            }

            return(dict);
        }
Example #6
0
        public static TableStyleInfo GetUserDefinedTableStyleInfo(string tableName, string attributeName)
        {
            var lowerAttributeName = attributeName.ToLower();

            if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName))
            {
                return(GetContentHiddenTableStyleInfo(tableName, attributeName));
            }
            var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty);

            if (lowerAttributeName == ContentAttribute.Title.ToLower())
            {
                styleInfo.DisplayName = "标题";
                styleInfo.HelpText    = "标题的名称";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.Text);
                styleInfo.Additional.IsFormatString = true;
                styleInfo.Additional.IsValidate     = true;
                styleInfo.Additional.IsRequired     = true;
            }
            else if (lowerAttributeName == ContentAttribute.IsTop.ToLower())
            {
                styleInfo.DisplayName = "置顶";
                styleInfo.HelpText    = "是否为置顶内容";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.CheckBox);
            }
            else if (lowerAttributeName == ContentAttribute.AddDate.ToLower())
            {
                styleInfo.DisplayName  = "添加日期";
                styleInfo.HelpText     = "内容的添加日期";
                styleInfo.InputType    = EInputTypeUtils.GetValue(EInputType.DateTime);
                styleInfo.DefaultValue = Current;
            }

            return(styleInfo);
        }
Example #7
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            bool isChanged;

            var inputType = EInputTypeUtils.GetEnumType(ddlInputType.SelectedValue);

            if (inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)
            {
                var isRapid = TranslateUtils.ToBool(ddlItemType.SelectedValue);
                if (!isRapid)
                {
                    var itemCount = TranslateUtils.ToInt(tbItemCount.Text);
                    if (itemCount == 0)
                    {
                        FailMessage("操作失败,选项数目不能为0!");
                        return;
                    }
                }
            }

            if (_styleInfo.TableStyleId == 0 && _styleInfo.RelatedIdentity == 0)//数据库中没有此项及父项的表样式
            {
                isChanged = InsertTableStyleInfo(inputType);
            }
            else//数据库中有此项的表样式
            {
                isChanged = UpdateTableStyleInfo(inputType);
            }

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, _redirectUrl);
            }
        }
Example #8
0
            public static IDictionary GetDictionary(PublishmentSystemInfo publishmentSystemInfo, int nodeId)
            {
                var dictionary = new ListDictionary
                {
                    { ChannelId, "栏目ID" },
                    { ChannelIndex, "栏目索引" },
                    { Year, "年份" },
                    { Month, "月份" },
                    { Day, "日期" },
                    { Hour, "小时" },
                    { Minute, "分钟" },
                    { Second, "秒钟" },
                    { Sequence, "顺序数" },
                    { ParentRule, "父级命名规则" },
                    { ChannelName, "栏目名称" }
                };

                //继承父级设置 20151113 sessionliang

                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, DataProvider.NodeDao.TableName, relatedIdentities);

                foreach (var styleInfo in styleInfoList)
                {
                    if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Text))
                    {
                        dictionary.Add($@"{{@{styleInfo.AttributeName}}}", styleInfo.DisplayName);
                    }
                }

                return(dictionary);
            }
Example #9
0
        public static string Parse(PublishmentSystemInfo publishmentSystemInfo, TableStyleInfo styleInfo, string attributeName, NameValueCollection pageScripts)
        {
            var retval = string.Empty;

            if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Text))
            {
                retval = ParseText(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.TextArea))
            {
                retval = ParseTextArea(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.TextEditor))
            {
                retval = ParseTextEditor(publishmentSystemInfo, attributeName, pageScripts, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.SelectOne))
            {
                retval = ParseSelectOne(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.SelectMultiple))
            {
                retval = ParseSelectMultiple(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.CheckBox))
            {
                retval = ParseCheckBox(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Radio))
            {
                retval = ParseRadio(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Date))
            {
                retval = ParseDate(publishmentSystemInfo, attributeName, pageScripts, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.DateTime))
            {
                retval = ParseDateTime(publishmentSystemInfo, attributeName, pageScripts, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Image))
            {
                retval = ParseImageUpload(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Video))
            {
                retval = ParseVideoUpload(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.File))
            {
                retval = ParseFileUpload(attributeName, styleInfo);
            }
            else if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.RelatedField))
            {
                retval = ParseRelatedField(publishmentSystemInfo, attributeName, styleInfo);
            }

            return(retval);
        }
Example #10
0
 public static string ParseString(EInputType inputType, string content, string replace, string to, int startIndex, int length, int wordNum, string ellipsis, bool isClearTags, bool isReturnToBr, bool isLower, bool isUpper, string formatString)
 {
     if (EInputTypeUtils.IsPureString(inputType))
     {
         return(ParseString(content, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString));
     }
     else
     {
         return(content);
     }
 }
Example #11
0
        public void ReFresh(object sender, EventArgs e)
        {
            TrRelatedField.Visible = TrHeightAndWidth.Visible = SpanDateTip.Visible = TrItemsType.Visible = TrItemsRapid.Visible = TrItems.Visible = TrRepeat.Visible = PhItemCount.Visible = PhIsFormatString.Visible = false;

            if (!string.IsNullOrEmpty(_attributeName))
            {
                TbAttributeName.Enabled = false;
            }

            var inputType = EInputTypeUtils.GetEnumType(DdlInputType.SelectedValue);

            if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)
            {
                TrItemsType.Visible = true;
                var isRapid = TranslateUtils.ToBool(DdlItemType.SelectedValue);
                if (isRapid)
                {
                    TrItemsRapid.Visible = true;
                    PhItemCount.Visible  = false;
                    TrItems.Visible      = false;
                }
                else
                {
                    TrItemsRapid.Visible = false;
                    PhItemCount.Visible  = true;
                    TrItems.Visible      = true;
                }
                if (inputType == EInputType.CheckBox || inputType == EInputType.Radio)
                {
                    TrRepeat.Visible = true;
                }
            }
            else if (inputType == EInputType.TextEditor)
            {
                TrHeightAndWidth.Visible = true;
            }
            else if (inputType == EInputType.TextArea)
            {
                TrHeightAndWidth.Visible = true;
            }
            else if (inputType == EInputType.Text)
            {
                PhIsFormatString.Visible = true;
                TrHeightAndWidth.Visible = true;
            }
            else if (inputType == EInputType.Date || inputType == EInputType.DateTime)
            {
                SpanDateTip.Visible = true;
            }
            else if (inputType == EInputType.RelatedField)
            {
                TrRelatedField.Visible = true;
            }
        }
Example #12
0
        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);
        }
Example #13
0
        private static string GetValueByControl(TableStyleInfo styleInfo, PublishmentSystemInfo publishmentSystemInfo, Control containerControl)
        {
            var theValue = ControlUtils.GetInputValue(containerControl, styleInfo.AttributeName) ?? string.Empty;

            var inputType = EInputTypeUtils.GetEnumType(styleInfo.InputType);

            if (inputType == EInputType.TextEditor)
            {
                theValue = StringUtility.TextEditorContentEncode(theValue, publishmentSystemInfo);
            }

            return(theValue);
        }
Example #14
0
        private static string GetValueByForm(TableStyleInfo styleInfo, PublishmentSystemInfo publishmentSystemInfo, NameValueCollection formCollection, bool isSaveImage)
        {
            var theValue = formCollection[styleInfo.AttributeName] ?? string.Empty;

            var inputType = EInputTypeUtils.GetEnumType(styleInfo.InputType);

            if (inputType == EInputType.TextEditor)
            {
                theValue = StringUtility.TextEditorContentEncode(theValue, publishmentSystemInfo, isSaveImage && publishmentSystemInfo.Additional.IsSaveImageInTextEditor);
                theValue = ETextEditorTypeUtils.TranslateToStlElement(theValue);
            }

            return(theValue);
        }
Example #15
0
        public static void SingleImportTableStyle(ETableStyle tableStyle, string tableName, string styleDirectoryPath, int relatedIdentity)
        {
            if (!DirectoryUtils.IsDirectoryExists(styleDirectoryPath))
            {
                return;
            }

            var filePaths = DirectoryUtils.GetFilePaths(styleDirectoryPath);

            foreach (var filePath in filePaths)
            {
                var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath));

                var attributeName   = AtomUtility.GetDcElementContent(feed.AdditionalElements, "AttributeName");
                var taxis           = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(feed.AdditionalElements, "Taxis"), 0);
                var displayName     = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DisplayName");
                var helpText        = AtomUtility.GetDcElementContent(feed.AdditionalElements, "HelpText");
                var isVisible       = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisible"));
                var isVisibleInList = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisibleInList"));
                var isSingleLine    = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsSingleLine"));
                var inputType       = EInputTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(feed.AdditionalElements, "InputType"));
                var defaultValue    = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DefaultValue");
                var isHorizontal    = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsHorizontal"));
                //SettingsXML
                var extendValues = AtomUtility.GetDcElementContent(feed.AdditionalElements, "ExtendValues");

                var styleInfo = new TableStyleInfo(0, relatedIdentity, tableName, attributeName, taxis, displayName, helpText, isVisible, isVisibleInList, isSingleLine, EInputTypeUtils.GetValue(inputType), defaultValue, isHorizontal, extendValues);

                var styleItems = new List <TableStyleItemInfo>();
                foreach (AtomEntry entry in feed.Entries)
                {
                    var itemTitle  = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemTitle");
                    var itemValue  = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemValue");
                    var isSelected = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(entry.AdditionalElements, "IsSelected"));

                    styleItems.Add(new TableStyleItemInfo(0, 0, itemTitle, itemValue, isSelected));
                }

                if (styleItems.Count > 0)
                {
                    styleInfo.StyleItems = styleItems;
                }

                if (TableStyleManager.IsExists(relatedIdentity, tableName, attributeName))
                {
                    TableStyleManager.Delete(relatedIdentity, tableName, attributeName);
                }
                TableStyleManager.InsertWithTaxis(styleInfo, tableStyle);
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName   = Body.GetQueryString("TableName");
            _tableStyle  = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            if (!IsPostBack)
            {
                IsVisible.Items[0].Value = true.ToString();
                IsVisible.Items[1].Value = false.ToString();

                IsSingleLine.Items[0].Value = true.ToString();
                IsSingleLine.Items[1].Value = false.ToString();

                IsHorizontal.Items[0].Value = true.ToString();
                IsHorizontal.Items[1].Value = false.ToString();

                EInputTypeUtils.AddListItems(InputType);

                var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, string.Empty, _relatedIdentities);

                ControlUtils.SelectListItems(InputType, EInputTypeUtils.GetValue(EInputTypeUtils.GetEnumType(styleInfo.InputType)));
                ControlUtils.SelectListItems(IsVisible, styleInfo.IsVisible.ToString());
                ControlUtils.SelectListItems(IsSingleLine, styleInfo.IsSingleLine.ToString());
                DefaultValue.Text          = styleInfo.DefaultValue;
                IsHorizontal.SelectedValue = styleInfo.IsHorizontal.ToString();
                Columns.Text = styleInfo.Additional.Columns.ToString();

                Height.Text = styleInfo.Additional.Height.ToString();
                Width.Text  = styleInfo.Additional.Width.ToString();

                ItemCount.Text = "0";
            }

            ReFresh(null, EventArgs.Empty);
        }
Example #17
0
 public TableStyleInfo()
 {
     _tableStyleId    = 0;
     _relatedIdentity = 0;
     _tableName       = string.Empty;
     _attributeName   = string.Empty;
     _taxis           = 0;
     _displayName     = string.Empty;
     _helpText        = string.Empty;
     _isVisible       = true;
     _isVisibleInList = false;
     _isSingleLine    = true;
     _inputType       = EInputTypeUtils.GetValue(EInputType.Text);
     _defaultValue    = string.Empty;
     _isHorizontal    = true;
     _extendValues    = string.Empty;
 }
Example #18
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]);
                }
            }
        }
Example #19
0
        public static string GetValidateHtmlString(TableStyleInfo styleInfo, out string validateAttributes)
        {
            var builder = new StringBuilder();

            validateAttributes = string.Empty;

            if (styleInfo.Additional.IsValidate && !EInputTypeUtils.Equals(styleInfo.InputType, EInputType.TextEditor))
            {
                validateAttributes = InputParserUtils.GetValidateAttributes(styleInfo.Additional.IsValidate, styleInfo.DisplayName, styleInfo.Additional.IsRequired, styleInfo.Additional.MinNum, styleInfo.Additional.MaxNum, styleInfo.Additional.ValidateType, styleInfo.Additional.RegExp, styleInfo.Additional.ErrorMessage);

                builder.Append(
                    $@"&nbsp;<span id=""{styleInfo.AttributeName}_msg"" style=""color:red;display:none;"">*</span>");
                builder.Append($@"
<script>event_observe('{styleInfo.AttributeName}', 'blur', checkAttributeValue);</script>
");
            }
            return(builder.ToString());
        }
Example #20
0
        private static string GetValidateHtmlString(TableStyleInfo styleInfo, out string validateAttributes)
        {
            validateAttributes = string.Empty;
            if (!styleInfo.Additional.IsValidate || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.TextEditor))
            {
                return(string.Empty);
            }

            var builder = new StringBuilder();

            validateAttributes = InputParserUtils.GetValidateAttributes(styleInfo.Additional.IsValidate, styleInfo.DisplayName, styleInfo.Additional.IsRequired, styleInfo.Additional.MinNum, styleInfo.Additional.MaxNum, styleInfo.Additional.ValidateType, styleInfo.Additional.RegExp, styleInfo.Additional.ErrorMessage);

            builder.Append(
                $@"<span id=""{styleInfo.AttributeName}_msg"" style=""color:red;margin-left: 5px;display:none;"">*</span>");
            builder.Append($@"
<script>inputBlur('{styleInfo.AttributeName}');</script>
");
            return(builder.ToString());
        }
Example #21
0
        public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, NameValueCollection formCollection, NameValueCollection attributes, bool isBackground)
        {
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible == false)
                {
                    continue;
                }
                var theValue = GetValueByForm(styleInfo, publishmentSystemInfo, formCollection);

                if (!EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.TextEditor, EInputType.Image, EInputType.File, EInputType.Video) && styleInfo.AttributeName != BackgroundContentAttribute.LinkUrl)
                {
                    theValue = PageUtils.FilterSqlAndXss(theValue);
                }

                ExtendedAttributes.SetExtendedAttribute(attributes, styleInfo.AttributeName, theValue);
            }
        }
Example #22
0
        public string GetInnerAdditionalAttributes(TableStyleInfo styleInfo)
        {
            var additionalAttributes = string.Empty;

            var inputType = EInputTypeUtils.GetEnumType(styleInfo.InputType);

            if (inputType == EInputType.Text || inputType == EInputType.Date || inputType == EInputType.DateTime)
            {
                additionalAttributes = @"class=""is_text""";
            }
            else if (inputType == EInputType.Image || inputType == EInputType.Video || inputType == EInputType.File)
            {
                additionalAttributes = @"class=""is_upload""";
            }
            else if (inputType == EInputType.TextArea)
            {
                additionalAttributes = @"class=""is_textarea""";
            }

            return(additionalAttributes);
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var inputType = EInputTypeUtils.GetEnumType(InputType.SelectedValue);

            if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)
            {
                var itemCount = TranslateUtils.ToInt(ItemCount.Text);
                if (itemCount == 0)
                {
                    FailMessage("操作失败,选项数目不能为0!");
                    return;
                }
            }

            isChanged = InsertTableStyleInfo(inputType);

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, _redirectUrl);
            }
        }
Example #24
0
        public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, NameValueCollection formCollection, NameValueCollection attributes, List <string> dontAddAttributes, bool isSaveImage)
        {
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible == false || dontAddAttributes.Contains(styleInfo.AttributeName.ToLower()))
                {
                    continue;
                }
                var theValue = GetValueByForm(styleInfo, publishmentSystemInfo, formCollection, isSaveImage);

                if (!EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.TextEditor, EInputType.Image, EInputType.File, EInputType.Video) && styleInfo.AttributeName != BackgroundContentAttribute.LinkUrl)
                {
                    theValue = PageUtils.FilterSqlAndXss(theValue);
                }

                ExtendedAttributes.SetExtendedAttribute(attributes, styleInfo.AttributeName, theValue);

                if (styleInfo.Additional.IsFormatString)
                {
                    var formatString    = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatStrong"]);
                    var formatEm        = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatEM"]);
                    var formatU         = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatU"]);
                    var formatColor     = formCollection[styleInfo.AttributeName + "_formatColor"];
                    var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor);

                    ExtendedAttributes.SetExtendedAttribute(attributes, ContentAttribute.GetFormatStringAttributeName(styleInfo.AttributeName), theFormatString);
                }

                if (EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.Image, EInputType.Video, EInputType.File))
                {
                    var attributeName = ContentAttribute.GetExtendAttributeName(styleInfo.AttributeName);
                    ExtendedAttributes.SetExtendedAttribute(attributes, attributeName, formCollection[attributeName]);
                }
            }
        }
        public void ReFresh(object sender, EventArgs e)
        {
            RowDefaultValue.Visible = RowHeightAndWidth.Visible = DateTip.Visible = RowItemCount.Visible = RowSetItems.Visible = RowRepeat.Visible = false;
            Height.Enabled          = true;

            DefaultValue.TextMode = TextBoxMode.MultiLine;
            var inputType = EInputTypeUtils.GetEnumType(InputType.SelectedValue);

            if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)
            {
                RowItemCount.Visible = RowSetItems.Visible = true;
                if (inputType == EInputType.CheckBox || inputType == EInputType.Radio)
                {
                    RowRepeat.Visible = true;
                }
            }
            else if (inputType == EInputType.TextEditor)
            {
                RowDefaultValue.Visible = RowHeightAndWidth.Visible = true;
            }
            else if (inputType == EInputType.TextArea)
            {
                RowDefaultValue.Visible = RowHeightAndWidth.Visible = true;
            }
            else if (inputType == EInputType.Text)
            {
                RowDefaultValue.Visible = RowHeightAndWidth.Visible = true;
                Height.Enabled          = false;
                DefaultValue.TextMode   = TextBoxMode.SingleLine;
            }
            else if (inputType == EInputType.Date || inputType == EInputType.DateTime)
            {
                DateTip.Visible       = RowDefaultValue.Visible = true;
                DefaultValue.TextMode = TextBoxMode.SingleLine;
            }
        }
Example #26
0
        public static string GetContentByTableStyle(string content, string separator, PublishmentSystemInfo publishmentSystemInfo, ETableStyle tableStyle, TableStyleInfo styleInfo, string formatString, StringDictionary attributes, string innerXml, bool isStlEntity)
        {
            var parsedContent = content;

            var inputType = EInputTypeUtils.GetEnumType(styleInfo.InputType);

            if (inputType == EInputType.Date)
            {
                var dateTime = TranslateUtils.ToDateTime(content);
                if (dateTime != DateUtils.SqlMinValue)
                {
                    if (string.IsNullOrEmpty(formatString))
                    {
                        formatString = DateUtils.FormatStringDateOnly;
                    }
                    parsedContent = DateUtils.Format(dateTime, formatString);
                }
                else
                {
                    parsedContent = string.Empty;
                }
            }
            else if (inputType == EInputType.DateTime)
            {
                var dateTime = TranslateUtils.ToDateTime(content);
                if (dateTime != DateUtils.SqlMinValue)
                {
                    if (string.IsNullOrEmpty(formatString))
                    {
                        formatString = DateUtils.FormatStringDateTime;
                    }
                    parsedContent = DateUtils.Format(dateTime, formatString);
                }
                else
                {
                    parsedContent = string.Empty;
                }
            }
            else if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)//选择类型
            {
                var selectedTexts  = new ArrayList();
                var selectedValues = TranslateUtils.StringCollectionToStringList(content);
                var styleItems     = styleInfo.StyleItems;
                if (styleItems == null)
                {
                    styleItems = BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(styleInfo.TableStyleId);
                }
                foreach (var itemInfo in styleItems)
                {
                    if (selectedValues.Contains(itemInfo.ItemValue))
                    {
                        if (isStlEntity)
                        {
                            selectedTexts.Add(itemInfo.ItemValue);
                        }
                        else
                        {
                            selectedTexts.Add(itemInfo.ItemTitle);
                        }
                    }
                }
                if (separator == null)
                {
                    parsedContent = TranslateUtils.ObjectCollectionToString(selectedTexts);
                }
                else
                {
                    parsedContent = TranslateUtils.ObjectCollectionToString(selectedTexts, separator);
                }
            }
            //else if (styleInfo.InputType == EInputType.TextArea)
            //{
            //    parsedContent = StringUtils.ReplaceNewlineToBR(parsedContent);
            //}
            else if (inputType == EInputType.TextEditor)
            {
                /****获取编辑器中内容,解析@符号,添加了远程路径处理 20151103****/
                parsedContent = StringUtility.TextEditorContentDecode(parsedContent, publishmentSystemInfo, true);
            }
            else if (inputType == EInputType.Image)
            {
                parsedContent = InputParserUtility.GetImageOrFlashHtml(publishmentSystemInfo, parsedContent, attributes, isStlEntity);
            }
            else if (inputType == EInputType.Video)
            {
                parsedContent = InputParserUtility.GetVideoHtml(publishmentSystemInfo, parsedContent, attributes, isStlEntity);
            }
            else if (inputType == EInputType.File)
            {
                parsedContent = InputParserUtility.GetFileHtmlWithoutCount(publishmentSystemInfo, parsedContent, attributes, innerXml, isStlEntity);
            }

            return(parsedContent);
        }
Example #27
0
        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();
        }
Example #28
0
        private static TableStyleInfo GetContentHiddenTableStyleInfo(string tableName, string attributeName)
        {
            var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty);

            switch (attributeName)
            {
            case ContentAttribute.Id:
                styleInfo.DisplayName = "内容ID";
                styleInfo.HelpText    = "内容ID";
                break;

            case ContentAttribute.NodeId:
                styleInfo.DisplayName = "栏目ID";
                styleInfo.HelpText    = "栏目ID";
                break;

            case ContentAttribute.PublishmentSystemId:
                styleInfo.DisplayName = "站点ID";
                styleInfo.HelpText    = "站点ID";
                break;

            case ContentAttribute.AddUserName:
                styleInfo.DisplayName = "添加者";
                styleInfo.HelpText    = "添加者";
                break;

            case ContentAttribute.LastEditUserName:
                styleInfo.DisplayName = "最后修改者";
                styleInfo.HelpText    = "最后修改者";
                break;

            case ContentAttribute.LastEditDate:
                styleInfo.DisplayName = "最后修改时间";
                styleInfo.HelpText    = "最后修改时间";
                break;

            case ContentAttribute.Taxis:
                styleInfo.DisplayName = "排序";
                styleInfo.HelpText    = "排序";
                break;

            case ContentAttribute.ContentGroupNameCollection:
                styleInfo.DisplayName = "内容组";
                styleInfo.HelpText    = "内容组";
                break;

            case ContentAttribute.Tags:
                styleInfo.DisplayName = "标签";
                styleInfo.HelpText    = "标签";
                break;

            case ContentAttribute.IsChecked:
                styleInfo.DisplayName = "是否审核通过";
                styleInfo.HelpText    = "是否审核通过";
                break;

            case ContentAttribute.CheckedLevel:
                styleInfo.DisplayName = "审核级别";
                styleInfo.HelpText    = "审核级别";
                break;

            case ContentAttribute.Comments:
                styleInfo.DisplayName = "评论数";
                styleInfo.HelpText    = "评论数";
                break;

            case ContentAttribute.Photos:
                styleInfo.DisplayName = "图片数";
                styleInfo.HelpText    = "图片数";
                break;

            case ContentAttribute.Hits:
                styleInfo.DisplayName = "点击量";
                styleInfo.HelpText    = "点击量";
                break;

            case ContentAttribute.HitsByDay:
                styleInfo.DisplayName = "日点击量";
                styleInfo.HelpText    = "日点击量";
                break;

            case ContentAttribute.HitsByWeek:
                styleInfo.DisplayName = "周点击量";
                styleInfo.HelpText    = "周点击量";
                break;

            case ContentAttribute.HitsByMonth:
                styleInfo.DisplayName = "月点击量";
                styleInfo.HelpText    = "月点击量";
                break;

            case ContentAttribute.LastHitsDate:
                styleInfo.DisplayName = "最后点击时间";
                styleInfo.HelpText    = "最后点击时间";
                break;
            }
            return(styleInfo);
        }
Example #29
0
        public static TableStyleInfo GetGovInteractContentTableStyleInfo(string tableName, string attributeName)
        {
            var lowerAttributeName = attributeName.ToLower();

            if (GovInteractContentAttribute.HiddenAttributes.Contains(lowerAttributeName))
            {
                return(GetContentHiddenTableStyleInfo(tableName, attributeName));
            }
            var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty);

            if (lowerAttributeName == GovInteractContentAttribute.RealName.ToLower())
            {
                styleInfo.DisplayName           = "姓名";
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Organization.ToLower())
            {
                styleInfo.DisplayName = "工作单位";
            }
            else if (lowerAttributeName == GovInteractContentAttribute.CardType.ToLower())
            {
                styleInfo.DisplayName = "证件名称";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.SelectOne);
                styleInfo.StyleItems  = new List <TableStyleItemInfo>
                {
                    new TableStyleItemInfo(0, 0, "身份证", "身份证", false),
                    new TableStyleItemInfo(0, 0, "学生证", "学生证", false),
                    new TableStyleItemInfo(0, 0, "军官证", "军官证", false),
                    new TableStyleItemInfo(0, 0, "工作证", "工作证", false)
                };
            }
            else if (lowerAttributeName == GovInteractContentAttribute.CardNo.ToLower())
            {
                styleInfo.DisplayName           = "证件号码";
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Phone.ToLower())
            {
                styleInfo.DisplayName           = "联系电话";
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.PostCode.ToLower())
            {
                styleInfo.DisplayName             = "邮政编码";
                styleInfo.Additional.IsValidate   = true;
                styleInfo.Additional.IsRequired   = true;
                styleInfo.Additional.ValidateType = EInputValidateType.Integer;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Address.ToLower())
            {
                styleInfo.DisplayName           = "联系地址";
                styleInfo.IsSingleLine          = true;
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Email.ToLower())
            {
                styleInfo.DisplayName             = "电子邮件";
                styleInfo.Additional.IsValidate   = true;
                styleInfo.Additional.IsRequired   = true;
                styleInfo.Additional.ValidateType = EInputValidateType.Email;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Fax.ToLower())
            {
                styleInfo.DisplayName             = "传真";
                styleInfo.Additional.ValidateType = EInputValidateType.Integer;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.TypeId.ToLower())
            {
                styleInfo.DisplayName = "类型";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.SpecifiedValue);
            }
            else if (lowerAttributeName == GovInteractContentAttribute.IsPublic.ToLower())
            {
                styleInfo.DisplayName = "是否公开";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.Radio);
                styleInfo.StyleItems  = new List <TableStyleItemInfo>
                {
                    new TableStyleItemInfo(0, 0, "公开", true.ToString(), true),
                    new TableStyleItemInfo(0, 0, "不公开", false.ToString(), false)
                };
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Title.ToLower())
            {
                styleInfo.DisplayName           = "标题";
                styleInfo.IsSingleLine          = true;
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.Content.ToLower())
            {
                styleInfo.DisplayName           = "内容";
                styleInfo.IsSingleLine          = true;
                styleInfo.InputType             = EInputTypeUtils.GetValue(EInputType.TextArea);
                styleInfo.Additional.Width      = "90%";
                styleInfo.Additional.Height     = 180;
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == GovInteractContentAttribute.FileUrl.ToLower())
            {
                styleInfo.DisplayName  = "附件";
                styleInfo.IsSingleLine = true;
                styleInfo.InputType    = EInputTypeUtils.GetValue(EInputType.File);
            }
            else if (lowerAttributeName == GovInteractContentAttribute.DepartmentId.ToLower())
            {
                styleInfo.DisplayName  = "提交对象";
                styleInfo.IsSingleLine = true;
                styleInfo.InputType    = EInputTypeUtils.GetValue(EInputType.SpecifiedValue);
            }
            return(styleInfo);
        }
Example #30
0
        public static TableStyleInfo GetJobContentTableStyleInfo(string tableName, string attributeName)
        {
            var lowerAttributeName = attributeName.ToLower();

            if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName))
            {
                return(GetContentHiddenTableStyleInfo(tableName, attributeName));
            }
            var styleInfo  = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty);
            var styleItems = new List <TableStyleItemInfo>();

            if (lowerAttributeName == ContentAttribute.Title.ToLower())
            {
                styleInfo.DisplayName = "标题";
                styleInfo.HelpText    = "标题的名称";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.Text);
                styleInfo.Additional.IsFormatString = true;
                styleInfo.Additional.IsValidate     = true;
                styleInfo.Additional.IsRequired     = true;
            }
            else if (lowerAttributeName == JobContentAttribute.Department.ToLower())
            {
                styleInfo.DisplayName           = "所属部门";
                styleInfo.HelpText              = "所属部门";
                styleInfo.InputType             = EInputTypeUtils.GetValue(EInputType.Text);
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == JobContentAttribute.Location.ToLower())
            {
                styleInfo.DisplayName           = "工作地点";
                styleInfo.HelpText              = "工作地点";
                styleInfo.InputType             = EInputTypeUtils.GetValue(EInputType.Text);
                styleInfo.Additional.IsValidate = true;
                styleInfo.Additional.IsRequired = true;
            }
            else if (lowerAttributeName == JobContentAttribute.NumberOfPeople.ToLower())
            {
                styleInfo.DisplayName      = "招聘人数";
                styleInfo.HelpText         = "招聘人数";
                styleInfo.InputType        = EInputTypeUtils.GetValue(EInputType.Text);
                styleInfo.DefaultValue     = "不限";
                styleInfo.Additional.Width = "60px";
            }
            else if (lowerAttributeName == JobContentAttribute.Responsibility.ToLower())
            {
                styleInfo.DisplayName = "工作职责";
                styleInfo.HelpText    = "工作职责";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.TextEditor);
            }
            else if (lowerAttributeName == JobContentAttribute.Requirement.ToLower())
            {
                styleInfo.DisplayName = "工作要求";
                styleInfo.HelpText    = "工作要求";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.TextEditor);
            }
            else if (lowerAttributeName == JobContentAttribute.IsUrgent.ToLower())
            {
                styleInfo.DisplayName = "是否急聘";
                styleInfo.HelpText    = "是否急聘";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.CheckBox);
                var itemInfo = new TableStyleItemInfo(0, styleInfo.TableStyleId, "急聘", true.ToString(), false);
                styleItems.Add(itemInfo);
                styleInfo.StyleItems = styleItems;
            }
            else if (lowerAttributeName == ContentAttribute.IsTop.ToLower())
            {
                styleInfo.DisplayName = "置顶";
                styleInfo.HelpText    = "是否为置顶内容";
                styleInfo.InputType   = EInputTypeUtils.GetValue(EInputType.CheckBox);
            }
            else if (lowerAttributeName == ContentAttribute.AddDate.ToLower())
            {
                styleInfo.DisplayName  = "添加日期";
                styleInfo.HelpText     = "内容的添加日期";
                styleInfo.InputType    = EInputTypeUtils.GetValue(EInputType.DateTime);
                styleInfo.DefaultValue = Current;
            }
            return(styleInfo);
        }