示例#1
0
        public static string GetChannelRowHtml(SiteInfo siteInfo, ChannelInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, PermissionsImpl permissionsImpl)
        {
            var nodeTreeItem = ChannelTreeItem.CreateInstance(siteInfo, nodeInfo, enabled, permissionsImpl);
            var adminId      = permissionsImpl.GetAdminId(siteInfo.Id, nodeInfo.Id);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(siteInfo.Id, nodeInfo.Id), adminId, additional);

            var rowHtml = string.Empty;

            if (loadingType == ELoadingType.ContentTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.Channel)
            {
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var editUrl      = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    if (permissionsImpl.HasChannelPermissions(nodeInfo.SiteId, nodeInfo.Id, ConfigManager.ChannelPermissions.ChannelEdit))
                    {
                        editUrl = $@"<a href=""{PageChannelEdit.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id, PageChannel.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id))}"" onclick=""event.stopPropagation()"">编辑</a>";
                        upLink  =
                            $@"<a href=""{PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                            {
                                {"Subtract", true.ToString()},
                                {"channelId", nodeInfo.Id.ToString()}
                            })}"" onclick=""event.stopPropagation()""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        downLink =
                            $@"<a href=""{PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                            {
                                {"Add", true.ToString()},
                                {"channelId", nodeInfo.Id.ToString()}
                            })}"" onclick=""event.stopPropagation()""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $@"<input type=""checkbox"" name=""ChannelIDCollection"" value=""{nodeInfo.Id}"" onclick=""checkboxClick(this)"" />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"" onclick=""activeRow(this);return false;"">
    <td>{title}</td>
    <td class=""text-nowrap"">{nodeInfo.GroupNameCollection}</td>
    <td class=""text-nowrap"">{nodeInfo.IndexName}</td>
    <td class=""text-center"">{upLink}</td>
    <td class=""text-center"">{downLink}</td>
    <td class=""text-center"">{editUrl}</td>
    <td class=""text-center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.SiteAnalysis)
            {
                var startDate = TranslateUtils.ToDateTime(additional["StartDate"]);
                var endDate   = TranslateUtils.ToDateTime(additional["EndDate"]);

                var tableName     = ChannelManager.GetTableName(siteInfo, nodeInfo);
                var num           = DataProvider.ContentDao.GetCountOfContentAdd(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty, ETriState.All);
                var contentAddNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty);
                var contentUpdateNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td class=""text-center"">{contentAddNum}</td>
	<td class=""text-center"">{contentUpdateNum}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.TemplateFilePathRule)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }
                var filePath = PageUtility.GetInputChannelUrl(siteInfo, nodeInfo, false);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{filePath}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCreateDetails)
            {
                var editChannelLink = string.Empty;

                var nodeNames = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>";
                }

                var nodeNameBuilder = new StringBuilder();
                var channelIdList   = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIdsIfContentChanged);
                foreach (var theChannelId in channelIdList)
                {
                    var theNodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, theChannelId);
                    if (theNodeInfo != null)
                    {
                        nodeNameBuilder.Append(theNodeInfo.ChannelName).Append(",");
                    }
                }
                if (nodeNameBuilder.Length > 0)
                {
                    nodeNameBuilder.Length--;
                    nodeNames = nodeNameBuilder.ToString();
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{nodeNames}</td>
	<td class=""text-center"">{editChannelLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                var contribute = CrossSiteTransUtility.GetDescription(nodeInfo.SiteId, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{contribute}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ChannelClickSelect)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }
示例#2
0
        public static string GetChannelRowHtml(PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, string administratorName)
        {
            var nodeTreeItem = NodeTreeItem.CreateInstance(nodeInfo, enabled, administratorName);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId), additional);

            var rowHtml = string.Empty;

            if (loadingType == ELoadingType.ContentTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td align=""left"" nowrap>
		{title}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.Channel)
            {
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var editUrl      = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    if (AdminUtility.HasChannelPermissions(administratorName, nodeInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                    {
                        var urlEdit = PageChannelEdit.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId, PageChannel.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId));
                        editUrl = $"<a href=\"{urlEdit}\">编辑</a>";
                        var urlSubtract = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection
                        {
                            { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                            { "Subtract", true.ToString() },
                            { "NodeID", nodeInfo.NodeId.ToString() }
                        });
                        upLink =
                            $@"<a href=""{urlSubtract}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        var urlAdd = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection
                        {
                            { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                            { "Add", true.ToString() },
                            { "NodeID", nodeInfo.NodeId.ToString() }
                        });
                        downLink =
                            $@"<a href=""{urlAdd}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{nodeInfo.NodeGroupNameCollection}</td>
    <td><nobr>{nodeInfo.NodeIndexName}</nobr></td>
    <td class=""center"">
	    {upLink}
    </td>
    <td class=""center"">
	    {downLink}
    </td>
    <td class=""center"">
	    {editUrl}
    </td>
    <td class=""center"">
	    {checkBoxHtml}
    </td>
</tr>
";
            }
            else if (loadingType == ELoadingType.SiteAnalysis)
            {
                var contentAddNum    = string.Empty;
                var contentUpdateNum = string.Empty;

                var startDate = TranslateUtils.ToDateTime(additional["StartDate"]);
                var endDate   = TranslateUtils.ToDateTime(additional["EndDate"]);

                var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);
                var num       = DataProvider.ContentDao.GetCountOfContentAdd(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty);
                contentAddNum = (num == 0) ? "0" : $"<strong>{num}</strong>";

                num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty);
                contentUpdateNum = (num == 0) ? "0" : $"<strong>{num}</strong>";

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		{contentAddNum}
	</td>
	<td>
		{contentUpdateNum}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.TemplateFilePathRule)
            {
                var editLink = string.Empty;

                var filePath = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }
                filePath = PageUtility.GetInputChannelUrl(publishmentSystemInfo, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		<nobr>{filePath}</nobr>
	</td>
	<td class=""center"">
		{editLink}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCreateDetails)
            {
                var editChannelLink = string.Empty;

                var nodeNames = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>";
                }

                if (nodeInfo.Additional.Attributes.Count > 0)
                {
                    var nodeNameBuilder = new StringBuilder();
                    var nodeIDArrayList = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIDsIfContentChanged);
                    foreach (int theNodeID in nodeIDArrayList)
                    {
                        var theNodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, theNodeID);
                        if (theNodeInfo != null)
                        {
                            nodeNameBuilder.Append(theNodeInfo.NodeName).Append(",");
                        }
                    }
                    if (nodeNameBuilder.Length > 0)
                    {
                        nodeNameBuilder.Length--;
                        nodeNames = nodeNameBuilder.ToString();
                    }
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		{nodeNames}
	</td>
	<td class=""center"">
		{editChannelLink}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans)
            {
                var editLink = string.Empty;

                var contribute = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemId, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{contribute}</td>
	<td class=""center"" width=""50"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationSignin)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationSignin.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                //string contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemID, nodeInfo);
                var isSign   = "";
                var SignUser = "";
                if (nodeInfo.Additional.IsSignin)
                {
                    isSign = "是";
                }
                else
                {
                    isSign = "否";
                }
                //if (!string.IsNullOrEmpty(nodeInfo.Additional.SigninUserGroupCollection))
                //{
                //    ArrayList groupIDlist = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.SigninUserGroupCollection);
                //    UserGroupInfo userGroupInfo = null;
                //    foreach (int groupID in groupIDlist)
                //    {
                //        userGroupInfo = DataProvider.UserGroupDAO.GetUserGroupMessage(groupID);
                //        SignUser += userGroupInfo.GroupName + ',';
                //    }
                //    SignUser = SignUser.TrimEnd(',');
                //}
                //else
                //{
                SignUser = nodeInfo.Additional.SigninUserNameCollection;
                //}

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
    <td>{SignUser}</td>
	<td class=""center"">{isSign}</td>
	<td class=""center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ChannelSelect || loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovPublicChannel)
            {
                var editUrl      = string.Empty;
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var checkBoxHtml = string.Empty;

                if (!EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId))
                {
                    enabled = false;
                }

                if (enabled)
                {
                    editUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalGovPublicChannelAdd
                            .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId,
                                string.Empty)}"">编辑</a>";

                    var urlUp = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Subtract", true.ToString() }
                    });
                    upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";

                    var urlDown = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Add", true.ToString() }
                    });
                    downLink =
                        $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";

                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                var channelCode = DataProvider.GovPublicChannelDao.GetCode(nodeInfo.NodeId);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{channelCode}</td>
    <td class=""center"">{upLink}</td>
    <td class=""center"">{downLink}</td>
    <td class=""center"">{editUrl}</td>
    <td class=""center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovInteractChannel)
            {
                var editUrl      = string.Empty;
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var styleAddUrl  = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    var applyStyleId = DataProvider.GovInteractChannelDao.GetApplyStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalGovInteractChannelAdd
                            .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId,
                                string.Empty)}"">编辑</a>";

                    var urlUp = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Subtract", true.ToString() }
                    });
                    upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";

                    var urlDown = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Add", true.ToString() }
                    });
                    downLink =
                        $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";

                    styleAddUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalTagStyleGovInteractApplyAdd.GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, applyStyleId)}"">提交设置</a>";
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                var summary = DataProvider.GovInteractChannelDao.GetSummary(nodeInfo.NodeId);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{summary}</td>
    <td class=""center"">{upLink}</td>
    <td class=""center"">{downLink}</td>
    <td class=""center"">{styleAddUrl}</td>
    <td class=""center"">{editUrl}</td>
    <td class=""center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }