Пример #1
0
        public void ReFresh(object sender, EventArgs e)
        {
            PhDefaultValue.Visible = PhWidth.Visible = PhHeight.Visible = SpDateTip.Visible = PhIsSelectField.Visible = PhRepeat.Visible = false;

            TbDefaultValue.TextMode = TextBoxMode.MultiLine;
            var inputType = InputTypeUtils.GetEnumType(DdlInputType.SelectedValue);

            if (inputType == InputType.CheckBox || inputType == InputType.Radio || inputType == InputType.SelectMultiple || inputType == InputType.SelectOne)
            {
                PhIsSelectField.Visible = true;
                if (inputType == InputType.CheckBox || inputType == InputType.Radio)
                {
                    PhRepeat.Visible = true;
                }
            }
            else if (inputType == InputType.TextEditor)
            {
                PhDefaultValue.Visible = PhWidth.Visible = PhHeight.Visible = true;
            }
            else if (inputType == InputType.TextArea)
            {
                PhDefaultValue.Visible = PhWidth.Visible = PhHeight.Visible = true;
            }
            else if (inputType == InputType.Text)
            {
                PhDefaultValue.Visible  = PhWidth.Visible = true;
                TbDefaultValue.TextMode = TextBoxMode.SingleLine;
            }
            else if (inputType == InputType.Date || inputType == InputType.DateTime)
            {
                SpDateTip.Visible       = PhDefaultValue.Visible = true;
                TbDefaultValue.TextMode = TextBoxMode.SingleLine;
            }
        }
Пример #2
0
        public void ReFresh(object sender, EventArgs e)
        {
            PhRelatedField.Visible = PhWidth.Visible = PhHeight.Visible = SpanDateTip.Visible = PhIsSelectField.Visible = PhRapid.Visible = PhNotRapid.Visible = PhRepeat.Visible = PhIsFormatString.Visible = PhDefaultValue.Visible = PhCustomize.Visible = false;

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

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

            if (inputType == InputType.CheckBox || inputType == InputType.Radio || inputType == InputType.SelectMultiple || inputType == InputType.SelectOne)
            {
                PhDefaultValue.Visible = PhIsSelectField.Visible = true;
                var isRapid = TranslateUtils.ToBool(DdlIsRapid.SelectedValue);
                if (isRapid)
                {
                    PhRapid.Visible    = true;
                    PhNotRapid.Visible = false;
                }
                else
                {
                    PhRapid.Visible    = false;
                    PhNotRapid.Visible = true;
                }
                if (inputType == InputType.CheckBox || inputType == InputType.Radio)
                {
                    PhRepeat.Visible = true;
                }
            }
            else if (inputType == InputType.TextEditor)
            {
                PhDefaultValue.Visible = PhWidth.Visible = PhHeight.Visible = true;
            }
            else if (inputType == InputType.TextArea)
            {
                PhDefaultValue.Visible = PhWidth.Visible = PhHeight.Visible = true;
            }
            else if (inputType == InputType.Text)
            {
                PhDefaultValue.Visible = PhIsFormatString.Visible = PhWidth.Visible = true;
            }
            else if (inputType == InputType.Date || inputType == InputType.DateTime)
            {
                PhDefaultValue.Visible = SpanDateTip.Visible = true;
            }
            else if (inputType == InputType.SelectCascading)
            {
                PhDefaultValue.Visible = PhRelatedField.Visible = true;
            }
            else if (inputType == InputType.Image || inputType == InputType.Video || inputType == InputType.File)
            {
                PhDefaultValue.Visible = true;
            }
            else if (inputType == InputType.Customize)
            {
                PhCustomize.Visible = true;
            }
        }
Пример #3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var inputType = InputTypeUtils.GetEnumType(DdlInputType.SelectedValue);

            var isChanged = InsertTableStyleInfo(inputType);

            if (isChanged)
            {
                LayerUtils.CloseAndRedirect(Page, _redirectUrl);
            }
        }
Пример #4
0
        public static void SingleImportTableStyle(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, nameof(TableStyleInfo.AttributeName));
                var taxis           = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.Taxis)), 0);
                var displayName     = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.DisplayName));
                var helpText        = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.HelpText));
                var isVisibleInList = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.IsVisibleInList)));
                var inputType       = InputTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.InputType)));
                var defaultValue    = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.DefaultValue));
                var isHorizontal    = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.IsHorizontal)));
                //SettingsXML
                var extendValues = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.ExtendValues));

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

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

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

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

                if (TableStyleManager.IsExists(relatedIdentity, tableName, attributeName))
                {
                    DataProvider.TableStyleDao.Delete(relatedIdentity, tableName, attributeName);
                }
                DataProvider.TableStyleDao.Insert(styleInfo);
            }
        }
Пример #5
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            bool isChanged;

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

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

            if (_styleInfo.Id == 0 && _styleInfo.RelatedIdentity == 0)//数据库中没有此项及父项的表样式
            {
                isChanged = InsertTableStyleInfo(inputType);
            }
            else if (_styleInfo.RelatedIdentity != _relatedIdentities[0])//数据库中没有此项的表样式,但是有父项的表样式
            {
                isChanged = InsertTableStyleInfo(inputType);
            }
            else//数据库中有此项的表样式
            {
                isChanged = UpdateTableStyleInfo(inputType);
            }

            if (isChanged)
            {
                LayerUtils.CloseAndRedirect(Page, _redirectUrl);
            }
        }
Пример #6
0
        public void ImportTableStyles(int siteId)
        {
            if (!DirectoryUtils.IsDirectoryExists(_directoryPath))
            {
                return;
            }

            var importObject        = new ImportObject(siteId, _adminName);
            var tableNameCollection = importObject.GetTableNameCache();

            var styleDirectoryPaths = DirectoryUtils.GetDirectoryPaths(_directoryPath);

            foreach (var styleDirectoryPath in styleDirectoryPaths)
            {
                var tableName = PathUtils.GetDirectoryName(styleDirectoryPath, false);
                if (tableName == "siteserver_PublishmentSystem")
                {
                    tableName = DataProvider.SiteDao.TableName;
                }
                if (!string.IsNullOrEmpty(tableNameCollection?[tableName]))
                {
                    tableName = tableNameCollection[tableName];
                }

                var attributeNamePaths = DirectoryUtils.GetDirectoryPaths(styleDirectoryPath);
                foreach (var attributeNamePath in attributeNamePaths)
                {
                    var attributeName = PathUtils.GetDirectoryName(attributeNamePath, false);
                    var filePaths     = DirectoryUtils.GetFilePaths(attributeNamePath);
                    foreach (var filePath in filePaths)
                    {
                        var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath));

                        var taxis           = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.Taxis)), 0);
                        var displayName     = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.DisplayName));
                        var helpText        = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.HelpText));
                        var isVisibleInList = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.IsVisibleInList)));
                        var inputType       = InputTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.InputType)));
                        var defaultValue    = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.DefaultValue));
                        var isHorizontal    = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.IsHorizontal)));
                        var extendValues    = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableStyleInfo.ExtendValues));

                        var orderString = AtomUtility.GetDcElementContent(feed.AdditionalElements, "OrderString");

                        var relatedIdentity = !string.IsNullOrEmpty(orderString) ? DataProvider.ChannelDao.GetId(siteId, orderString) : siteId;

                        if (relatedIdentity <= 0 || TableStyleManager.IsExists(relatedIdentity, tableName, attributeName))
                        {
                            continue;
                        }

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

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

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

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

                        DataProvider.TableStyleDao.Insert(styleInfo);
                    }
                }
            }
        }
Пример #7
0
        private TableStyleInfo GetTableStyleInfoByReader(IDataReader rdr)
        {
            var i  = 0;
            var id = GetInt(rdr, i++);
            var relatedIdentity = GetInt(rdr, i++);
            var tableName       = GetString(rdr, i++);
            var attributeName   = GetString(rdr, i++);
            var taxis           = GetInt(rdr, i++);
            var displayName     = GetString(rdr, i++);
            var helpText        = GetString(rdr, i++);
            var isVisibleInList = GetBool(rdr, i++);
            var inputType       = GetString(rdr, i++);
            var defaultValue    = GetString(rdr, i++);
            var isHorizontal    = GetBool(rdr, i++);
            var extendValues    = GetString(rdr, i);

            var styleInfo = new TableStyleInfo(id, relatedIdentity, tableName, attributeName, taxis, displayName, helpText, isVisibleInList, InputTypeUtils.GetEnumType(inputType), defaultValue, isHorizontal, extendValues);

            return(styleInfo);
        }