コード例 #1
0
ファイル: PageChannel.cs プロジェクト: yankaics/cms-1
        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", "请选择需要导出的栏目!"));
        }
コード例 #2
0
ファイル: WebUtils.cs プロジェクト: yankaics/cms-1
        public static string GetContentCommands(string administratorName, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, string pageUrl, string currentFileName, bool isCheckPage)
        {
            var iconUrl   = SiteServerAssets.GetIconUrl(string.Empty);
            var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId);

            var builder = new StringBuilder();

            //添加内容
            if (!isCheckPage && AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentAdd) && nodeInfo.Additional.IsContentAddable)
            {
                var redirectUrl = GetContentAddAddUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo, pageUrl);
                var title       = "添加内容";
                if (modelType == EContentModelType.GovPublic)
                {
                    title = "采集信息";
                }
                else if (modelType == EContentModelType.GovInteract)
                {
                    title = "新增办件";
                }
                else if (modelType == EContentModelType.Photo)
                {
                    title = "添加图片";
                }
                else if (modelType == EContentModelType.Vote)
                {
                    title = "发起投票";
                }

                builder.Append(
                    $@"<a href=""{redirectUrl}""><img style=""margin-right: 3px"" src=""{iconUrl}/add.gif"" align=""absMiddle"" />{title}</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");

                builder.Append($@"<a href=""javascript:;"" onclick=""{ModalContentImport.GetOpenWindowString(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导入内容</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");

                if (modelType != EContentModelType.UserDefined && modelType != EContentModelType.Vote && modelType != EContentModelType.Job && modelType != EContentModelType.GovInteract)
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalUploadWord.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, StringUtils.ValueToUrl(pageUrl))}"">导入Word</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }
            //删 除
            if (nodeInfo.ContentNum > 0 && AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                builder.Append(
                    $@"<a href=""javascript:;"" onclick=""{PageContentDelete.GetRedirectClickStringForSingleChannel(
                        publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, false, pageUrl)}"">删 除</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
            }

            if (nodeInfo.ContentNum > 0)
            {
                builder.Append(
                    $@"<a href=""javascript:;"" onclick=""{ModalContentExport.GetOpenWindowString(
                        publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导 出</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                //设置
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentEdit))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentAttributes.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">设置属性</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalAddToGroup.GetOpenWindowStringToContent(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">设置内容组</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //转 移
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
                {
                    var redirectUrl = PageContentTranslate.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl);

                    var clickString = PageUtils.GetRedirectStringWithCheckBoxValue(redirectUrl, "ContentIDCollection", "ContentIDCollection", "请选择需要转移的内容!");

                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{clickString}"">转 移</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //排 序
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentEdit))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentTaxis.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">排 序</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //整理
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentOrder))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentTidyUp.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">整 理</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //审 核
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentCheck.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">审 核</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //归 档
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentArchive))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentArchive.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">归 档</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //跨站转发
                if (CrossSiteTransUtility.IsTranslatable(publishmentSystemInfo, nodeInfo))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalContentCrossSiteTrans.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">跨站转发</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //生 成
                if (!isCheckPage && (AdminUtility.HasWebsitePermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, AppManager.Cms.Permission.WebSite.Create) || AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.CreatePage)))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{Cms.ModalProgressBar
                            .GetOpenWindowStringWithCreateContentsOneByOne(publishmentSystemInfo.PublishmentSystemId,
                                nodeInfo.NodeId)}"">生 成</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }

            //选择显示项
            //if (nodeInfo.NodeType != ENodeType.BackgroundImageNode)
            //{
            if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
            {
                builder.Append(
                    $@"<a href=""javascript:;"" onclick=""{ModalSelectColumns.GetOpenWindowStringToContent(
                        publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, true)}"">显示项</a> &nbsp; &nbsp; ");
            }
            //}

            if (!isCheckPage && nodeInfo.ContentNum > 0)
            {
                if (builder.Length > 0)
                {
                    builder.Length = builder.Length - 15;
                }

                //builder.Append(GetContentLinks(publishmentSystemInfo, nodeInfo, contentType, currentFileName));

                builder.Append(
                    $@"&nbsp; <a href=""javascript:;;"" onClick=""$('#contentSearch').toggle(); return false""><img src=""{iconUrl}/search.gif"" align=""absMiddle"" alt=""快速查找"" /></a>");
            }


            //if (builder.Length > 0)
            //{
            //    builder.Length = builder.Length - 16;
            //}
            return(builder.ToString());
        }
コード例 #3
0
ファイル: WebUtils.cs プロジェクト: yankaics/cms-1
        public static string GetChannelCommands(string administratorName, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, string pageUrl, string currentFileName)
        {
            var iconUrl = SiteServerAssets.GetIconUrl(string.Empty);
            var builder = new StringBuilder();

            //添加栏目
            if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelAdd) && nodeInfo.Additional.IsChannelAddable)
            {
                builder.Append(
                    $@"<a href=""{PageChannelAdd.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId,
                        nodeInfo.NodeId, pageUrl)}""><img style=""MARGIN-RIGHT: 3px"" src=""{iconUrl}/add.gif"" align=""absMiddle"" />添加栏目</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                builder.Append(
                    $@"<a href=""javascript:;"" onclick=""{ModalChannelAdd.GetOpenWindowString(
                        publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">快速添加</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
            }
            if (nodeInfo.ChildrenCount > 0)
            {
                //删除栏目
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelDelete))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelDelete.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, pageUrl),
                            "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!")}"">删除栏目</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //清空内容
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentDelete))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelDelete.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, pageUrl),
                            "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除内容的栏目!")}"">清空内容</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }

                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelAdd))
                {
                    //导 入
                    if (nodeInfo.Additional.IsChannelAddable)
                    {
                        builder.Append(
                            $@"<a href=""javascript:;"" onclick=""{ModalChannelImport.GetOpenWindowString(
                               publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导 入</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                    }
                    //导 出
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalExportMessage.GetOpenWindowStringToChannel(
                            publishmentSystemInfo.PublishmentSystemId, "ChannelIDCollection", "请选择需要导出的栏目!")}"">导 出</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }

                //设置栏目组
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalAddToGroup.GetOpenWindowStringToChannel(
                            publishmentSystemInfo.PublishmentSystemId)}"">设置栏目组</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //转 移
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelTranslate))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelTranslate.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId,
                                nodeInfo.NodeId, pageUrl), "ChannelIDCollection", "ChannelIDCollection", "请选择需要转移的栏目!")}"">转 移</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }

                //生 成
                if (AdminUtility.HasWebsitePermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, AppManager.Cms.Permission.WebSite.Create) || AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.CreatePage))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalCreateChannels.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId)}"">生 成</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }
            else
            {
                //导 入
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelAdd) && nodeInfo.Additional.IsChannelAddable)
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalChannelImport.GetOpenWindowString(
                            publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导 入</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }
            if (publishmentSystemInfo.PublishmentSystemId != nodeInfo.NodeId)
            {
                builder.Append(
                    $@"<a href=""{$"{currentFileName}?PublishmentSystemID={publishmentSystemInfo.PublishmentSystemId}&NodeID={nodeInfo.ParentId}"}""><img style=""MARGIN-RIGHT: 3px"" src=""{iconUrl}/upfolder.gif"" align=""absMiddle"" />向 上</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
            }
            if (builder.Length > 0)
            {
                builder.Length = builder.Length - 15;
            }
            return(builder.ToString());
        }
コード例 #4
0
ファイル: BasePageCms.cs プロジェクト: skotbenben/cms
 public bool HasWebsitePermissions(params string[] websitePermissionArray)
 {
     return(AdminUtility.HasWebsitePermissions(Body.AdministratorName, PublishmentSystemId, websitePermissionArray));
 }