Exemple #1
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>";
        }
Exemple #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>";
        }
Exemple #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;

            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);

            var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(0, styleInfo.Id, new List <int> {
                0
            }, _tableName, styleInfo.AttributeName, _redirectUrl);
            var editText = styleInfo.Id != 0 ? "修改" : "添加";

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

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

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

            if (styleInfo.Id == 0)
            {
                return;
            }

            ltlEditStyle.Text +=
                $@"&nbsp;&nbsp;<a href=""{PageUtils.GetSettingsUrl(nameof(PageSiteTableStyle), new NameValueCollection
                {
                    {"tableName", _tableName},
                    {"DeleteStyle", true.ToString()},
                    {"AttributeName", styleInfo.AttributeName}
                })}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
        }
        public IHttpActionResult Delete()
        {
            try
            {
                var request = new RequestImpl();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.SettingsPermissions.Admin))
                {
                    return(Unauthorized());
                }

                var attributeName = request.GetPostString("attributeName");

                DataProvider.TableStyleDao.Delete(0, DataProvider.UserDao.TableName, attributeName);

                var list = new List <object>();
                foreach (var styleInfo in TableStyleManager.GetUserStyleInfoList())
                {
                    list.Add(new
                    {
                        styleInfo.Id,
                        styleInfo.AttributeName,
                        styleInfo.DisplayName,
                        InputType = InputTypeUtils.GetText(styleInfo.InputType),
                        Validate  = TableStyleManager.GetValidateInfo(styleInfo),
                        styleInfo.Taxis,
                        IsSystem = StringUtils.ContainsIgnoreCase(UserAttribute.AllAttributes.Value, styleInfo.AttributeName)
                    });
                }

                return(Ok(new
                {
                    Value = list
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Exemple #5
0
        public IHttpActionResult Get()
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.SettingsPermissions.User))
                {
                    return(Unauthorized());
                }

                var list = new List <object>();
                foreach (var styleInfo in TableStyleManager.GetUserStyleInfoList())
                {
                    list.Add(new
                    {
                        styleInfo.Id,
                        styleInfo.AttributeName,
                        styleInfo.DisplayName,
                        InputType = InputTypeUtils.GetText(styleInfo.InputType),
                        Validate  = styleInfo.Additional.VeeValidate,
                        styleInfo.Taxis,
                        IsSystem = StringUtils.ContainsIgnoreCase(UserAttribute.AllAttributes.Value, styleInfo.AttributeName)
                    });
                }

                return(Ok(new
                {
                    Value = list,
                    DataProvider.UserDao.TableName,
                    RelatedIdentities = TableStyleManager.EmptyRelatedIdentities
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }