Example #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableName         = DataProvider.SiteDao.TableName;
            _itemId            = AuthRequest.GetQueryInt("itemID");
            _relatedIdentities = TableStyleManager.GetRelatedIdentities(SiteId);
            _attributeNames    = TableColumnManager.GetTableColumnNameList(_tableName);
            _returnUrl         = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.WebSitePermissions.Configration);

            //删除样式
            if (AuthRequest.IsQueryExists("DeleteStyle"))
            {
                var attributeName = AuthRequest.GetQueryString("AttributeName");
                if (TableStyleManager.IsExists(SiteId, _tableName, attributeName))
                {
                    try
                    {
                        DataProvider.TableStyleDao.Delete(SiteId, _tableName, attributeName);
                        AuthRequest.AddSiteLog(SiteId, "删除数据表单样式", $"表单:{_tableName},字段:{attributeName}");
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }
            }

            if (!string.IsNullOrEmpty(_returnUrl))
            {
                BtnReturn.Attributes.Add("onclick", $"location.href='{_returnUrl}';return false;");
            }
            else
            {
                BtnReturn.Visible = false;
            }

            RptContents.DataSource     = TableStyleManager.GetSiteStyleInfoList(SiteId);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            var redirectUrl = GetRedirectUrl(SiteId, _itemId, _returnUrl);

            BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(SiteId, 0, _relatedIdentities, _tableName, string.Empty, redirectUrl));
            BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(SiteId, _relatedIdentities, _tableName, redirectUrl));

            BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, SiteId, SiteId));
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, SiteId));
        }
Example #2
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var styleInfo = (TableStyleInfo)e.Item.DataItem;

            var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
            var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlInputType     = (Literal)e.Item.FindControl("ltlInputType");
            var ltlFieldType     = (Literal)e.Item.FindControl("ltlFieldType");
            var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
            var ltlTaxis         = (Literal)e.Item.FindControl("ltlTaxis");
            var ltlEditStyle     = (Literal)e.Item.FindControl("ltlEditStyle");
            var ltlEditValidate  = (Literal)e.Item.FindControl("ltlEditValidate");

            ltlAttributeName.Text = styleInfo.AttributeName;

            ltlDisplayName.Text = styleInfo.DisplayName;
            ltlInputType.Text   = InputTypeUtils.GetText(styleInfo.InputType);

            var columnInfo = TableColumnManager.GetTableColumnInfo(_tableName, styleInfo.AttributeName);

            ltlFieldType.Text = columnInfo != null ? $"真实 {DataTypeUtils.GetText(columnInfo.DataType)}" : "虚拟字段";

            ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo);

            if (!StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title))
            {
                var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);

                ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";

                showPopWinString     = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, _redirectUrl);
                ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";
            }

            ltlTaxis.Text = styleInfo.Taxis.ToString();

            if (styleInfo.RelatedIdentity != _channelInfo.Id)
            {
                return;
            }

            var urlStyle = PageUtils.GetCmsUrl(SiteId, nameof(PageTableStyleContent), new NameValueCollection
            {
                { "channelId", _channelInfo.Id.ToString() },
                { "DeleteStyle", true.ToString() },
                { "TableName", _tableName },
                { "AttributeName", styleInfo.AttributeName }
            });

            ltlEditStyle.Text +=
                $@"&nbsp;&nbsp;<a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
        }
Example #3
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var styleInfo = (TableStyleInfo)e.Item.DataItem;

            if (_attributeNames.Contains(styleInfo.AttributeName))
            {
                e.Item.Visible = false;
                return;
            }

            var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
            var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlInputType     = (Literal)e.Item.FindControl("ltlInputType");
            var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
            var ltlTaxis         = (Literal)e.Item.FindControl("ltlTaxis");
            var ltlEditStyle     = (Literal)e.Item.FindControl("ltlEditStyle");
            var ltlEditValidate  = (Literal)e.Item.FindControl("ltlEditValidate");

            ltlAttributeName.Text = styleInfo.AttributeName;

            ltlDisplayName.Text = styleInfo.DisplayName;
            ltlInputType.Text   = InputTypeUtils.GetText(styleInfo.InputType);

            ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo);

            var redirectUrl      = GetRedirectUrl(SiteId, _relatedIdentity, _itemId, _returnUrl);
            var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, redirectUrl);
            var editText         = styleInfo.RelatedIdentity == _relatedIdentity ? "修改" : "设置";

            ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{editText}</a>";

            showPopWinString     = ModalTableStyleValidateAdd.GetOpenWindowString(SiteId, styleInfo.Id, _relatedIdentities, _tableName, styleInfo.AttributeName, redirectUrl);
            ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";

            ltlTaxis.Text = styleInfo.Taxis.ToString();

            if (styleInfo.RelatedIdentity != _relatedIdentity)
            {
                return;
            }

            var urlStyle = PageUtils.GetCmsUrl(SiteId, nameof(PageTableStyleSite), new NameValueCollection
            {
                { "TableName", _tableName },
                { "RelatedIdentity", _relatedIdentity.ToString() },
                { "DeleteStyle", true.ToString() },
                { "AttributeName", styleInfo.AttributeName }
            });

            ltlEditStyle.Text +=
                $@"&nbsp;&nbsp;<a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
        }
Example #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var channelId = AuthRequest.GetQueryInt("channelId", SiteId);

            _channelInfo       = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName         = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            _redirectUrl       = GetRedirectUrl(SiteId, channelId);
            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId);

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.WebSitePermissions.Configration);

            //删除样式
            if (AuthRequest.IsQueryExists("DeleteStyle"))
            {
                var attributeName = AuthRequest.GetQueryString("AttributeName");
                if (TableStyleManager.IsExists(_channelInfo.Id, _tableName, attributeName))
                {
                    try
                    {
                        TableStyleManager.Delete(_channelInfo.Id, _tableName, attributeName);
                        AuthRequest.AddSiteLog(SiteId, "删除数据表单样式", $"表单:{_tableName},字段:{attributeName}");
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }
            }

            InfoMessage(
                $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 内容表:{DataProvider.TableDao.GetDisplayName(_tableName)}({_tableName})");
            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, false, true, AuthRequest.AdminPermissions);
            ControlUtils.SelectSingleItem(DdlChannelId, channelId.ToString());

            RptContents.DataSource     = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(SiteId, 0, _relatedIdentities, _tableName, string.Empty, _redirectUrl));
            BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(SiteId, _relatedIdentities, _tableName, _redirectUrl));
            BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, SiteId, channelId));
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, channelId));
        }
Example #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId);

            _nodeInfo    = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _modelInfo   = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId);
            _tableStyle  = EAuxiliaryTableTypeUtils.GetTableStyle(_modelInfo.TableType);
            _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "内容字段管理", AppManager.Cms.Permission.WebSite.Configration);

                //删除样式
                if (Body.IsQueryExists("DeleteStyle"))
                {
                    DeleteStyle();
                }
                else if (Body.IsQueryExists("SetTaxis"))
                {
                    SetTaxis();
                }

                InfoMessage(
                    $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 辅助表:{BaiRongDataProvider.TableCollectionDao.GetTableCnName(_modelInfo.TableName)}({_modelInfo.TableName}); 内容模型:{_modelInfo.ModelName}");
                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(NodeIDDropDownList, nodeId.ToString());

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

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

                AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _modelInfo.TableName, string.Empty, _tableStyle, _redirectUrl));
                AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _modelInfo.TableName, _tableStyle, _redirectUrl));
                Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_modelInfo.TableName, _tableStyle, PublishmentSystemId, nodeId));
                Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _modelInfo.TableName, PublishmentSystemId, nodeId));
            }
        }
Example #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableName = DataProvider.NodeDao.TableName;
            var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId);

            _nodeInfo    = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "栏目字段管理", AppManager.Cms.Permission.WebSite.Configration);

                //删除样式
                if (Body.IsQueryExists("DeleteStyle"))
                {
                    DeleteStyle();
                }
                else if (Body.IsQueryExists("SetTaxis"))
                {
                    SetTaxis();
                }

                NodeManager.AddListItems(DdlNodeIdDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(DdlNodeIdDropDownList, nodeId.ToString());

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

                DgContents.DataSource     = styleInfoList;
                DgContents.ItemDataBound += DgContents_ItemDataBound;
                DgContents.DataBind();

                BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, ETableStyle.Channel, _redirectUrl));
                BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, ETableStyle.Channel, _redirectUrl));
                BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, ETableStyle.Channel, PublishmentSystemId, nodeId));
                BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(ETableStyle.Channel, _tableName, PublishmentSystemId, nodeId));
            }
        }
Example #7
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var styleInfo = e.Item.DataItem as TableStyleInfo;

                var ltlAttributeName = e.Item.FindControl("ltlAttributeName") as Literal;
                var ltlDataType      = e.Item.FindControl("ltlDataType") as Literal;
                var ltlDisplayName   = e.Item.FindControl("ltlDisplayName") as Literal;
                var ltlInputType     = e.Item.FindControl("ltlInputType") as Literal;
                var ltlFieldType     = e.Item.FindControl("ltlFieldType") as Literal;;
                var ltlIsVisible     = e.Item.FindControl("ltlIsVisible") as Literal;
                var ltlValidate      = e.Item.FindControl("ltlValidate") as Literal;
                var ltlEditStyle     = e.Item.FindControl("ltlEditStyle") as Literal;
                var ltlEditValidate  = e.Item.FindControl("ltlEditValidate") as Literal;
                var upLinkButton     = e.Item.FindControl("UpLinkButton") as HyperLink;
                var downLinkButton   = e.Item.FindControl("DownLinkButton") as HyperLink;

                var showPopWinString = ModalTableMetadataView.GetOpenWindowString(_modelInfo.TableType,
                                                                                  _modelInfo.TableName, styleInfo.AttributeName);
                ltlAttributeName.Text =
                    $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{styleInfo.AttributeName}</a>";

                ltlDisplayName.Text = styleInfo.DisplayName;
                ltlInputType.Text   = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType));
                if (TableManager.IsAttributeNameExists(_tableStyle, _modelInfo.TableName, styleInfo.AttributeName))
                {
                    ltlFieldType.Text =
                        $"真实 {TableManager.GetTableMetadataDataType(_modelInfo.TableName, styleInfo.AttributeName)}";
                }
                else
                {
                    ltlFieldType.Text = "虚拟字段";
                }

                ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString());
                ltlValidate.Text  = EInputValidateTypeUtils.GetValidateInfo(styleInfo);

                showPopWinString = ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, styleInfo.TableStyleId, _relatedIdentities, _modelInfo.TableName, styleInfo.AttributeName, _tableStyle, _redirectUrl);
                var editText = "添加";
                if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式
                {
                    editText = "修改";
                }
                ltlEditStyle.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>";

                showPopWinString     = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _relatedIdentities, _modelInfo.TableName, styleInfo.AttributeName, _tableStyle, _redirectUrl);
                ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>";

                if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式
                {
                    var urlStyle = PageUtils.GetCmsUrl(nameof(PageTableStyleContent), new NameValueCollection
                    {
                        { "PublishmentSystemID", PublishmentSystemId.ToString() },
                        { "NodeID", _nodeInfo.NodeId.ToString() },
                        { "DeleteStyle", true.ToString() },
                        { "TableName", _modelInfo.TableName },
                        { "AttributeName", styleInfo.AttributeName }
                    });
                    ltlEditStyle.Text +=
                        $@"&nbsp;&nbsp;<a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
                }

                var isTaxisVisible = true;
                //if (TableStyleManager.IsMetadata(this.tableStyle, styleInfo.AttributeName) || styleInfo.RelatedIdentity != this.nodeInfo.NodeID)
                //{
                //    isTaxisVisible = false;
                //}
                //else
                //{
                isTaxisVisible = !TableStyleManager.IsExistsInParents(_relatedIdentities, _modelInfo.TableName, styleInfo.AttributeName);
                //}

                if (!isTaxisVisible)
                {
                    upLinkButton.Visible = downLinkButton.Visible = false;
                }
                else
                {
                    var tableMetadataId = BaiRongDataProvider.TableMetadataDao.GetTableMetadataId(styleInfo.TableName, styleInfo.AttributeName);
                    upLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleContent), new NameValueCollection
                    {
                        { "PublishmentSystemID", PublishmentSystemId.ToString() },
                        { "NodeID", _nodeInfo.NodeId.ToString() },
                        { "SetTaxis", true.ToString() },
                        { "TableStyleID", styleInfo.TableStyleId.ToString() },
                        { "Direction", "UP" },
                        { "TableMetadataId", tableMetadataId.ToString() }
                    });
                    downLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleContent), new NameValueCollection
                    {
                        { "PublishmentSystemID", PublishmentSystemId.ToString() },
                        { "NodeID", _nodeInfo.NodeId.ToString() },
                        { "SetTaxis", true.ToString() },
                        { "TableStyleID", styleInfo.TableStyleId.ToString() },
                        { "Direction", "DOWN" },
                        { "TableMetadataId", tableMetadataId.ToString() }
                    });
                }
            }
        }
Example #8
0
        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));
        }
Example #9
0
        private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var styleInfo = (TableStyleInfo)e.Item.DataItem;

            var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
            var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlInputType     = (Literal)e.Item.FindControl("ltlInputType");
            var ltlFieldType     = (Literal)e.Item.FindControl("ltlFieldType");
            var ltlIsVisible     = (Literal)e.Item.FindControl("ltlIsVisible");
            var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
            var ltlEditStyle     = (Literal)e.Item.FindControl("ltlEditStyle");
            var ltlEditValidate  = (Literal)e.Item.FindControl("ltlEditValidate");
            var upLinkButton     = (HyperLink)e.Item.FindControl("UpLinkButton");
            var downLinkButton   = (HyperLink)e.Item.FindControl("DownLinkButton");

            ltlAttributeName.Text = styleInfo.AttributeName;

            ltlDisplayName.Text = styleInfo.DisplayName;
            ltlInputType.Text   = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType));
            ltlFieldType.Text   = "虚拟字段";

            ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString());
            ltlValidate.Text  = EInputValidateTypeUtils.GetValidateInfo(styleInfo);

            string showPopWinString = ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, styleInfo.TableStyleId, _relatedIdentities, _tableName, styleInfo.AttributeName, ETableStyle.Channel, _redirectUrl);
            var    editText         = "添加";

            if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式
            {
                editText = "修改";
            }
            ltlEditStyle.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>";

            showPopWinString     = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _relatedIdentities, _tableName, styleInfo.AttributeName, ETableStyle.Channel, _redirectUrl);
            ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>";

            if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式
            {
                var urlStyle = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "NodeID", _nodeInfo.NodeId.ToString() },
                    { "DeleteStyle", true.ToString() },
                    { "TableName", _tableName },
                    { "AttributeName", styleInfo.AttributeName }
                });
                ltlEditStyle.Text +=
                    $@"&nbsp;&nbsp;<a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
            }

            bool isTaxisVisible;

            if (styleInfo.RelatedIdentity != _nodeInfo.NodeId)
            {
                isTaxisVisible = false;
            }
            else
            {
                isTaxisVisible = !TableStyleManager.IsExistsInParents(_relatedIdentities, _tableName, styleInfo.AttributeName);
            }

            if (!isTaxisVisible)
            {
                upLinkButton.Visible = downLinkButton.Visible = false;
            }
            else
            {
                upLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "NodeID", _nodeInfo.NodeId.ToString() },
                    { "SetTaxis", true.ToString() },
                    { "TableStyleID", styleInfo.TableStyleId.ToString() },
                    { "Direction", "UP" }
                });
                downLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "NodeID", _nodeInfo.NodeId.ToString() },
                    { "SetTaxis", true.ToString() },
                    { "TableStyleID", styleInfo.TableStyleId.ToString() },
                    { "Direction", "DOWN" }
                });
            }
        }