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

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var groupName = AuthRequest.GetQueryString("GroupName");

                try
                {
                    DataProvider.ContentGroupDao.Delete(groupName, SiteId);
                    AuthRequest.AddSiteLog(SiteId, "删除内容组", $"内容组:{groupName}");
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            if (AuthRequest.IsQueryExists("SetTaxis"))
            {
                var groupName = AuthRequest.GetQueryString("GroupName");
                var direction = AuthRequest.GetQueryString("Direction");

                switch (direction.ToUpper())
                {
                case "UP":
                    DataProvider.ContentGroupDao.UpdateTaxisToUp(SiteId, groupName);
                    break;

                case "DOWN":
                    DataProvider.ContentGroupDao.UpdateTaxisToDown(SiteId, groupName);
                    break;
                }
                SuccessMessage("排序成功!");
                AddWaitAndRedirectScript(GetRedirectUrl(SiteId));
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.WebSitePermissions.Configration);

            RptContents.DataSource     = DataProvider.ContentGroupDao.GetContentGroupInfoList(SiteId);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(SiteId);

            BtnAddGroup.Attributes.Add("onclick", showPopWinString);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var groupName = Body.GetQueryString("GroupName");

                try
                {
                    DataProvider.ContentGroupDao.Delete(groupName, PublishmentSystemId);
                    Body.AddSiteLog(PublishmentSystemId, "删除内容组", $"内容组:{groupName}");
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationGroupAndTags, "内容组管理", AppManager.Cms.Permission.WebSite.Configration);

                if (Body.IsQueryExists("SetTaxis"))
                {
                    var groupName = Body.GetQueryString("GroupName");
                    var direction = Body.GetQueryString("Direction");

                    switch (direction.ToUpper())
                    {
                    case "UP":
                        DataProvider.ContentGroupDao.UpdateTaxisToUp(PublishmentSystemId, groupName);
                        break;

                    case "DOWN":
                        DataProvider.ContentGroupDao.UpdateTaxisToDown(PublishmentSystemId, groupName);
                        break;

                    default:
                        break;
                    }
                    SuccessMessage("排序成功!");
                    AddWaitAndRedirectScript(GetRedirectUrl(PublishmentSystemId));
                }

                dgContents.DataSource     = DataProvider.ContentGroupDao.GetDataSource(PublishmentSystemId);
                dgContents.ItemDataBound += dgContents_ItemDataBound;
                dgContents.DataBind();

                var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(PublishmentSystemId);
                AddGroup.Attributes.Add("onclick", showPopWinString);
            }
        }
Beispiel #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (Body.IsQueryExists("IsContent"))
            {
                _isContent = Body.GetQueryBool("IsContent");
            }
            if (_isContent)
            {
                btnAddGroup.Text = " 新建内容组";
                _idsDictionary   = ContentUtility.GetIDsDictionary(Request.QueryString);
            }
            else
            {
                btnAddGroup.Text = " 新建栏目组";
                _nodeIdArrayList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"));
            }
            if (!IsPostBack)
            {
                if (_isContent)
                {
                    var contentGroupNameList = DataProvider.ContentGroupDao.GetContentGroupNameList(PublishmentSystemId);
                    foreach (var groupName in contentGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        cblGroupNameCollection.Items.Add(item);
                    }
                    var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(PublishmentSystemId);
                    btnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    var nodeGroupNameList = DataProvider.NodeGroupDao.GetNodeGroupNameList(PublishmentSystemId);
                    foreach (var groupName in nodeGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        cblGroupNameCollection.Items.Add(item);
                    }

                    var showPopWinString = ModalNodeGroupAdd.GetOpenWindowString(PublishmentSystemId);
                    btnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            if (AuthRequest.IsQueryExists("isContent"))
            {
                _isContent = AuthRequest.GetQueryBool("isContent");
            }
            if (_isContent)
            {
                BtnAddGroup.Text = " 新建内容组";
                _idsDictionary   = ContentUtility.GetIDsDictionary(Request.QueryString);
            }
            else
            {
                BtnAddGroup.Text    = " 新建栏目组";
                _channelIdArrayList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));
            }
            if (!IsPostBack)
            {
                if (_isContent)
                {
                    var contentGroupNameList = ContentGroupManager.GetGroupNameList(SiteId);
                    foreach (var groupName in contentGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        CblGroupNameCollection.Items.Add(item);
                    }
                    var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(SiteId);
                    BtnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    var nodeGroupNameList = ChannelGroupManager.GetGroupNameList(SiteId);
                    foreach (var groupName in nodeGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        CblGroupNameCollection.Items.Add(item);
                    }

                    var showPopWinString = ModalNodeGroupAdd.GetOpenWindowString(SiteId);
                    BtnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
            }
        }
Beispiel #5
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var groupInfo = (ContentGroupInfo)e.Item.DataItem;

            var ltlContentGroupName = (Literal)e.Item.FindControl("ltlContentGroupName");
            var ltlDescription      = (Literal)e.Item.FindControl("ltlDescription");
            var hlUp        = (HyperLink)e.Item.FindControl("hlUp");
            var hlDown      = (HyperLink)e.Item.FindControl("hlDown");
            var ltlContents = (Literal)e.Item.FindControl("ltlContents");
            var ltlEdit     = (Literal)e.Item.FindControl("ltlEdit");
            var ltlDelete   = (Literal)e.Item.FindControl("ltlDelete");

            ltlContentGroupName.Text = groupInfo.GroupName;
            ltlDescription.Text      = groupInfo.Description;

            hlUp.NavigateUrl = PageUtils.GetCmsUrl(SiteId, nameof(PageContentGroup), new NameValueCollection
            {
                { "GroupName", groupInfo.GroupName },
                { "SetTaxis", true.ToString() },
                { "Direction", "UP" }
            });
            hlDown.NavigateUrl = PageUtils.GetCmsUrl(SiteId, nameof(PageContentGroup), new NameValueCollection
            {
                { "GroupName", groupInfo.GroupName },
                { "SetTaxis", true.ToString() },
                { "Direction", "DOWN" }
            });

            ltlContents.Text = $@"<a href=""{PageContentsGroup.GetRedirectUrl(SiteId, groupInfo.GroupName)}"">查看内容</a>";

            ltlEdit.Text =
                $@"<a href=""javascript:;"" onClick=""{ModalContentGroupAdd.GetOpenWindowString(SiteId, groupInfo.GroupName)}"">修改</a>";

            ltlDelete.Text = $@"<a href=""{PageUtils.GetCmsUrl(SiteId, nameof(PageContentGroup), new NameValueCollection
            {
                {"GroupName", groupInfo.GroupName},
                {"Delete", true.ToString()}
            })}"" onClick=""javascript:return confirm('此操作将删除内容组“{groupInfo.GroupName}”,确认吗?');"">删除</a>";
        }
Beispiel #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId");

            var channelId = AuthRequest.GetQueryInt("channelId");
            var contentId = AuthRequest.GetQueryInt("id");

            ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl"));
            if (string.IsNullOrEmpty(ReturnUrl))
            {
                ReturnUrl = CmsPages.GetContentsUrl(SiteId, channelId);
            }

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName   = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            ContentInfo contentInfo = null;

            _styleInfoList = TableStyleManager.GetContentStyleInfoList(SiteInfo, _channelInfo);

            if (!IsPermissions(contentId))
            {
                return;
            }

            if (contentId > 0)
            {
                contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
            }

            var titleFormat = IsPostBack ? Request.Form[ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)] : contentInfo?.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title));

            LtlTitleHtml.Text = ContentUtility.GetTitleHtml(titleFormat, AjaxCmsService.GetTitlesUrl(SiteId, _channelInfo.Id));

            AcAttributes.SiteInfo      = SiteInfo;
            AcAttributes.ChannelId     = _channelInfo.Id;
            AcAttributes.ContentId     = contentId;
            AcAttributes.StyleInfoList = _styleInfoList;

            if (!IsPostBack)
            {
                var pageTitle = contentId == 0 ? "添加内容" : "编辑内容";

                LtlPageTitle.Text = pageTitle;

                if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentTranslate))
                {
                    PhTranslate.Visible = true;
                    BtnTranslate.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(SiteId, true));

                    ETranslateContentTypeUtils.AddListItems(DdlTranslateType, true);
                    ControlUtils.SelectSingleItem(DdlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy));
                }
                else
                {
                    PhTranslate.Visible = false;
                }

                CblContentAttributes.Items.Add(new ListItem("置顶", ContentAttribute.IsTop));
                CblContentAttributes.Items.Add(new ListItem("推荐", ContentAttribute.IsRecommend));
                CblContentAttributes.Items.Add(new ListItem("热点", ContentAttribute.IsHot));
                CblContentAttributes.Items.Add(new ListItem("醒目", ContentAttribute.IsColor));
                TbAddDate.DateTime = DateTime.Now;
                TbAddDate.Now      = true;

                var contentGroupNameList = ContentGroupManager.GetGroupNameList(SiteId);
                foreach (var groupName in contentGroupNameList)
                {
                    var item = new ListItem(groupName, groupName);
                    CblContentGroups.Items.Add(item);
                }

                BtnContentGroupAdd.Attributes.Add("onclick", ModalContentGroupAdd.GetOpenWindowString(SiteId));

                LtlTags.Text = ContentUtility.GetTagsHtml(AjaxCmsService.GetTagsUrl(SiteId));

                if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    PhStatus.Visible = true;
                    int checkedLevel;
                    var isChecked = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, _channelInfo.Id, out checkedLevel);
                    if (AuthRequest.IsQueryExists("contentLevel"))
                    {
                        checkedLevel = TranslateUtils.ToIntWithNagetive(AuthRequest.GetQueryString("contentLevel"));
                        if (checkedLevel != CheckManager.LevelInt.NotChange)
                        {
                            isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel;
                        }
                    }

                    CheckManager.LoadContentLevelToEdit(DdlContentLevel, SiteInfo, contentInfo, isChecked, checkedLevel);
                }
                else
                {
                    PhStatus.Visible = false;
                }

                BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()"));
                //自动检测敏感词
                ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(SiteInfo));

                if (contentId == 0)
                {
                    var attributes = TableStyleManager.GetDefaultAttributes(_styleInfoList);

                    if (AuthRequest.IsQueryExists("isUploadWord"))
                    {
                        var isFirstLineTitle  = AuthRequest.GetQueryBool("isFirstLineTitle");
                        var isFirstLineRemove = AuthRequest.GetQueryBool("isFirstLineRemove");
                        var isClearFormat     = AuthRequest.GetQueryBool("isClearFormat");
                        var isFirstLineIndent = AuthRequest.GetQueryBool("isFirstLineIndent");
                        var isClearFontSize   = AuthRequest.GetQueryBool("isClearFontSize");
                        var isClearFontFamily = AuthRequest.GetQueryBool("isClearFontFamily");
                        var isClearImages     = AuthRequest.GetQueryBool("isClearImages");
                        var contentLevel      = AuthRequest.GetQueryInt("contentLevel");
                        var fileName          = AuthRequest.GetQueryString("fileName");

                        var formCollection = WordUtils.GetWordNameValueCollection(SiteId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, fileName);
                        attributes.Load(formCollection);

                        TbTitle.Text = formCollection[ContentAttribute.Title];
                    }

                    AcAttributes.Attributes = attributes;
                }
                else if (contentInfo != null)
                {
                    TbTitle.Text = contentInfo.Title;

                    TbTags.Text = contentInfo.Tags;

                    var list = new List <string>();
                    if (contentInfo.IsTop)
                    {
                        list.Add(ContentAttribute.IsTop);
                    }
                    if (contentInfo.IsRecommend)
                    {
                        list.Add(ContentAttribute.IsRecommend);
                    }
                    if (contentInfo.IsHot)
                    {
                        list.Add(ContentAttribute.IsHot);
                    }
                    if (contentInfo.IsColor)
                    {
                        list.Add(ContentAttribute.IsColor);
                    }
                    ControlUtils.SelectMultiItems(CblContentAttributes, list);
                    TbLinkUrl.Text     = contentInfo.LinkUrl;
                    TbAddDate.DateTime = contentInfo.AddDate;
                    ControlUtils.SelectMultiItems(CblContentGroups, TranslateUtils.StringCollectionToStringList(contentInfo.GroupNameCollection));

                    AcAttributes.Attributes = contentInfo;
                }
            }
            else
            {
                AcAttributes.Attributes = new AttributesImpl(Request.Form);
            }
            //DataBind();
        }
        public string GetEditHtml(string groupName)
        {
            var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(PublishmentSystemId, groupName);

            return($"<a href=\"javascript:;\" onClick=\"{showPopWinString}\">修改</a>");
        }