예제 #1
0
        private string GetButtonsHtml()
        {
            var builder = new StringBuilder();

            if (HasChannelPermissionsIgnoreChannelId(ConfigManager.ChannelPermissions.ChannelAdd))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalChannelsAdd.GetOpenWindowString(SiteId, SiteId, GetRedirectUrl(SiteId, SiteId))}"">快速添加</a>
<a href=""{PageChannelAdd.GetRedirectUrl(SiteId, SiteId, GetRedirectUrl(SiteId, 0))}"" class=""btn btn-light text-secondary"">添加栏目</a>
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalChannelImport.GetOpenWindowString(SiteId, SiteId)}"">导 入</a>
");
            }

            builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalExportMessage.GetOpenWindowStringToChannel(SiteId, "ChannelIDCollection", "请选择需要导出的栏目!")}"">导 出</a>
");

            if (HasChannelPermissionsIgnoreChannelId(ConfigManager.ChannelPermissions.ChannelEdit))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalAddToGroup.GetOpenWindowStringToChannel(SiteId)}"">设置栏目组</a>
");
            }

            if (HasChannelPermissionsIgnoreChannelId(ConfigManager.ChannelPermissions.ChannelTranslate))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{
                        PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelTranslate.GetRedirectUrl(SiteId,
                                GetRedirectUrl(SiteId, _currentChannelId)), "ChannelIDCollection",
                            "ChannelIDCollection", "请选择需要转移的栏目!")
                    }"">转 移</a>
");
            }

            if (HasChannelPermissionsIgnoreChannelId(ConfigManager.ChannelPermissions.ChannelDelete))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{
                        PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelDelete.GetRedirectUrl(SiteId, GetRedirectUrl(SiteId, SiteId)), "ChannelIDCollection",
                            "ChannelIDCollection", "请选择需要删除的栏目!")
                    }"">删 除</a>
");
            }

            if (HasSitePermissions(ConfigManager.WebSitePermissions.Create) ||
                HasChannelPermissionsIgnoreChannelId(ConfigManager.ChannelPermissions.CreatePage))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-light text-secondary"" onclick=""{ModalCreateChannels.GetOpenWindowString(SiteId)}"">生 成</a>
");
            }

            return(builder.ToString());
        }
예제 #2
0
        private void ButtonPreLoad()
        {
            var showPopWinString = string.Empty;

            PlaceHolder_AddChannel.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelAdd);
            if (PlaceHolder_AddChannel.Visible)
            {
                AddChannel1.Attributes.Add("onclick", ModalChannelAdd.GetOpenWindowString(PublishmentSystemId, PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, PublishmentSystemId)));
                AddChannel2.Attributes.Add("onclick",
                                           $"location.href='{PageChannelAdd.GetRedirectUrl(PublishmentSystemId, PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, 0))}';return false;");
            }

            PlaceHolder_ChannelEdit.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelEdit);
            if (PlaceHolder_ChannelEdit.Visible)
            {
                showPopWinString = ModalAddToGroup.GetOpenWindowStringToChannel(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                SelectEditColumns.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowStringToChannel(PublishmentSystemId, false));
            }

            PlaceHolder_Translate.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelTranslate);
            if (PlaceHolder_Translate.Visible)
            {
                Translate.Attributes.Add("onclick",
                                         PageUtils.GetRedirectStringWithCheckBoxValue(
                                             PageChannelTranslate.GetRedirectUrl(PublishmentSystemId,
                                                                                 GetRedirectUrl(PublishmentSystemId, _currentNodeId)), "ChannelIDCollection",
                                             "ChannelIDCollection", "请选择需要转移的栏目!"));
            }

            PlaceHolder_Delete.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelDelete);
            if (PlaceHolder_Delete.Visible)
            {
                Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageChannelDelete.GetRedirectUrl(PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, PublishmentSystemId)), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!"));
            }

            PlaceHolder_Create.Visible = AdminUtility.HasWebsitePermissions(Body.AdministratorName, PublishmentSystemId, AppManager.Cms.Permission.WebSite.Create) ||
                                         HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.CreatePage);
            if (PlaceHolder_Create.Visible)
            {
                Create.Attributes.Add("onclick", ModalCreateChannels.GetOpenWindowString(PublishmentSystemId));
            }

            PlaceHolder_Import.Visible = PlaceHolder_AddChannel.Visible;
            if (PlaceHolder_Import.Visible)
            {
                Import.Attributes.Add("onclick", ModalChannelImport.GetOpenWindowString(PublishmentSystemId, PublishmentSystemId));
            }
            Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToChannel(PublishmentSystemId, "ChannelIDCollection", "请选择需要导出的栏目!"));
        }
예제 #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            if (Body.IsQueryExists("channelId") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add")))
            {
                var channelId = Body.GetQueryInt("channelId");
                if (SiteId != channelId)
                {
                    var isSubtract = Body.IsQueryExists("Subtract");
                    DataProvider.ChannelDao.UpdateTaxis(SiteId, channelId, isSubtract);

                    Body.AddSiteLog(SiteId, channelId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"),
                                    $"栏目:{ChannelManager.GetChannelName(SiteId, channelId)}");

                    PageUtils.Redirect(GetRedirectUrl(SiteId, channelId));
                    return;
                }
            }

            if (IsPostBack)
            {
                return;
            }

            ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteInfo, ELoadingType.Channel, null));

            if (Body.IsQueryExists("CurrentChannelId"))
            {
                _currentChannelId = Body.GetQueryInt("CurrentChannelId");
                var onLoadScript = ChannelLoading.GetScriptOnLoad(SiteId, _currentChannelId);
                if (!string.IsNullOrEmpty(onLoadScript))
                {
                    ClientScriptRegisterClientScriptBlock("NodeTreeScriptOnLoad", onLoadScript);
                }
            }

            PhAddChannel.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelAdd);
            if (PhAddChannel.Visible)
            {
                BtnAddChannel1.Attributes.Add("onclick", ModalChannelsAdd.GetOpenWindowString(SiteId, SiteId, GetRedirectUrl(SiteId, SiteId)));
                BtnAddChannel2.Attributes.Add("onclick",
                                              $"location.href='{PageChannelAdd.GetRedirectUrl(SiteId, SiteId, GetRedirectUrl(SiteId, 0))}';return false;");
            }

            PhChannelEdit.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelEdit);
            if (PhChannelEdit.Visible)
            {
                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToChannel(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                BtnSelectEditColumns.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowStringToChannel(SiteId, false));
            }

            PhTranslate.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelTranslate);
            if (PhTranslate.Visible)
            {
                BtnTranslate.Attributes.Add("onclick",
                                            PageUtils.GetRedirectStringWithCheckBoxValue(
                                                PageChannelTranslate.GetRedirectUrl(SiteId,
                                                                                    GetRedirectUrl(SiteId, _currentChannelId)), "ChannelIDCollection",
                                                "ChannelIDCollection", "请选择需要转移的栏目!"));
            }

            PhDelete.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelDelete);
            if (PhDelete.Visible)
            {
                BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageChannelDelete.GetRedirectUrl(SiteId, GetRedirectUrl(SiteId, SiteId)), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!"));
            }

            PhCreate.Visible = HasSitePermissions(ConfigManager.Permissions.WebSite.Create) || HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.CreatePage);
            if (PhCreate.Visible)
            {
                BtnCreate.Attributes.Add("onclick", ModalCreateChannels.GetOpenWindowString(SiteId));
            }

            PhImport.Visible = PhAddChannel.Visible;
            if (PhImport.Visible)
            {
                BtnImport.Attributes.Add("onclick", ModalChannelImport.GetOpenWindowString(SiteId, SiteId));
            }
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToChannel(SiteId, "ChannelIDCollection", "请选择需要导出的栏目!"));

            RptContents.DataSource     = DataProvider.ChannelDao.GetIdListByParentId(SiteId, 0);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();
        }