예제 #1
0
        public static string GetCommandItemRowsHtml(ETableStyle tableStyle, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, ContentInfo contentInfo, string pageUrl, string administratorName)
        {
            var builder = new StringBuilder();

            var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId);

            if (modelType == EContentModelType.Photo)
            {
                var contentPhotoUploadUrl = PageContentPhotoUpload.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, pageUrl);
                builder.Append(
                    $@"<td class=""center"" width=""50""><a href=""{contentPhotoUploadUrl}"">图片</a><span style=""color:gray"">({contentInfo
                        .Photos})</span></td>");
            }
            else if (modelType == EContentModelType.Job)
            {
                var resumeNum = DataProvider.ResumeContentDao.GetCount(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id);
                var urlResume = PageResumeContent.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id, StringUtils.ValueToUrl(pageUrl));;
                builder.Append(
                    $@"<td class=""center"" width=""50""><a href=""{urlResume}"">简历</a><span style=""color:gray"">({resumeNum})</span></td>");
            }

            if (publishmentSystemInfo.Additional.IsCommentable && modelType != EContentModelType.Job)
            {
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, AppManager.Cms.Permission.Channel.CommentCheck, AppManager.Cms.Permission.Channel.CommentDelete))
                {
                    //var urlComment = PageComment.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemID, contentInfo.NodeId, contentInfo.Id, pageUrl);
                    var urlComment = PageComments.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, pageUrl);
                    builder.Append(
                        $@"<td class=""center"" width=""50""><a href=""{urlComment}"">评论</a><span style=""color:gray"">({contentInfo
                            .Comments})</span></td>");
                }
            }

            return(builder.ToString());
        }
예제 #2
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var channelId = (int)e.Item.DataItem;
            var nodeInfo  = ChannelManager.GetChannelInfo(SiteId, channelId);

            if (nodeInfo == null)
            {
                e.Item.Visible = false;
                return;
            }

            var ltlItemChannelName  = (Literal)e.Item.FindControl("ltlItemChannelName");
            var ltlItemChannelIndex = (Literal)e.Item.FindControl("ltlItemChannelIndex");
            var ltlItemAddDate      = (Literal)e.Item.FindControl("ltlItemAddDate");

            ltlItemChannelName.Text  = ChannelManager.GetChannelNameNavigation(SiteId, channelId);
            ltlItemChannelIndex.Text = nodeInfo.IndexName;
            ltlItemAddDate.Text      = DateUtils.GetDateString(nodeInfo.AddDate);

            if (IsOwningChannelId(channelId))
            {
                if (AdminUtility.HasChannelPermissions(Body.AdminName, nodeInfo.SiteId, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelEdit))
                {
                    ltlItemChannelName.Text = $@"<a href=""javascript:;"" onclick=""{ModalChannelEdit.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id, GetRedirectUrl(nodeInfo.SiteId, _nodeGroupName))}"">{ltlItemChannelName.Text}</a>";
                }
            }
        }
예제 #3
0
        public List <KeyValuePair <int, int> > GetCountArrayListUnChecked(bool isSystemAdministrator, string administratorName, List <int> publishmentSystemIdList, List <int> owningNodeIdList, string tableName)
        {
            var list = new List <KeyValuePair <int, int> >();

            var publishmentSystemIdArrayList = PublishmentSystemManager.GetPublishmentSystemIdList();

            foreach (int publishmentSystemId in publishmentSystemIdArrayList)
            {
                if (!publishmentSystemIdList.Contains(publishmentSystemId))
                {
                    continue;
                }

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                if (!isSystemAdministrator)
                {
                    //if (!owningNodeIDArrayList.Contains(psID)) continue;
                    //if (!AdminUtility.HasChannelPermissions(psID, psID, AppManager.CMS.Permission.Channel.ContentCheck)) continue;

                    var isContentCheck = false;
                    foreach (var theNodeId in owningNodeIdList)
                    {
                        if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemId, theNodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                        {
                            isContentCheck = true;
                        }
                    }
                    if (!isContentCheck)
                    {
                        continue;
                    }
                }

                int    checkedLevel;
                var    isChecked           = CheckManager.GetUserCheckLevel(administratorName, publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId, out checkedLevel);
                var    checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayListOfNeedCheck(publishmentSystemInfo, isChecked, checkedLevel);
                string sqlString;
                if (isSystemAdministrator)
                {
                    sqlString =
                        $"SELECT COUNT(*) AS TotalNum FROM {tableName} WHERE (PublishmentSystemID = {publishmentSystemId} AND NodeID > 0 AND IsChecked = '{false}' AND CheckedLevel IN ({TranslateUtils.ToSqlInStringWithoutQuote(checkLevelArrayList)}))";
                }
                else
                {
                    sqlString =
                        $"SELECT COUNT(*) AS TotalNum FROM {tableName} WHERE (PublishmentSystemID = {publishmentSystemId} AND NodeID IN ({TranslateUtils.ToSqlInStringWithoutQuote(owningNodeIdList)}) AND IsChecked = '{false}' AND CheckedLevel IN ({TranslateUtils.ToSqlInStringWithoutQuote(checkLevelArrayList)}))";
                }

                var count = BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString);
                if (count > 0)
                {
                    list.Add(new KeyValuePair <int, int>(publishmentSystemId, count));
                }
            }
            return(list);
        }
예제 #4
0
파일: WebUtils.cs 프로젝트: zhongqi013/cms
        public static string GetContentMoreCommands(string administratorName, SiteInfo siteInfo, ChannelInfo nodeInfo, string pageUrl)
        {
            var builder = new StringBuilder();

            if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentAdd) && nodeInfo.Additional.IsContentAddable)
            {
                builder.Append($@"
<a class=""dropdown-item"" href=""javascript:;"" onclick=""{ModalContentImport.GetOpenWindowString(siteInfo.Id, nodeInfo.Id)}"">
    导 入
</a>");
            }

            if (nodeInfo.ContentNum > 0)
            {
                builder.Append($@"
<a class=""dropdown-item"" href=""javascript:;"" onclick=""{ModalContentExport.GetOpenWindowString(siteInfo.Id, nodeInfo.Id)}"">
    导 出
</a>");
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentOrder))
                {
                    builder.Append($@"
<a class=""dropdown-item"" href=""javascript:;"" onclick=""{ModalContentTidyUp.GetOpenWindowString(siteInfo.Id, nodeInfo.Id, pageUrl)}"">
    整 理
</a>");
                }
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentArchive))
                {
                    builder.Append($@"
<a class=""dropdown-item"" href=""javascript:;"" onclick=""{ModalContentArchive.GetOpenWindowString(siteInfo.Id, nodeInfo.Id, pageUrl)}"">
    归 档
</a>");
                }
                if (CrossSiteTransUtility.IsCrossSiteTrans(siteInfo, nodeInfo) && !CrossSiteTransUtility.IsAutomatic(nodeInfo))
                {
                    builder.Append($@"
<a class=""dropdown-item"" href=""javascript:;"" onclick=""{ModalContentCrossSiteTrans.GetOpenWindowString(siteInfo.Id, nodeInfo.Id)}"">
    跨站转发
</a>");
                }
            }

            return(builder.ToString());
        }
예제 #5
0
        public static string GetCommandHeadRowsHtml(string administratorName, ETableStyle tableStyle, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo)
        {
            var builder = new StringBuilder();

            var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId);

            if (modelType == EContentModelType.Photo)
            {
                builder.Append(@"<td class=""center"" width=""50"">&nbsp;</td>");
            }
            else if (modelType == EContentModelType.Job)
            {
                builder.Append(@"<td class=""center"" width=""50"">&nbsp;</td>");
            }

            if (publishmentSystemInfo.Additional.IsCommentable && modelType != EContentModelType.Job)
            {
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.CommentCheck, AppManager.Cms.Permission.Channel.CommentDelete))
                {
                    builder.Append(@"<td class=""center"" width=""50"">&nbsp;</td>");
                }
            }
            return(builder.ToString());
        }
예제 #6
0
        public static KeyValuePair <bool, int> GetUserCheckLevel(string administratorName, SiteInfo siteInfo, int channelId)
        {
            var permissions = PermissionsManager.GetPermissions(administratorName);

            if (permissions.IsSystemAdministrator)
            {
                return(new KeyValuePair <bool, int>(true, siteInfo.Additional.CheckContentLevel));
            }

            var isChecked    = false;
            var checkedLevel = 0;

            if (siteInfo.Additional.IsCheckContentLevel == false)
            {
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheck))
                {
                    isChecked = true;
                }
            }
            else
            {
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheckLevel5))
                {
                    isChecked = true;
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheckLevel4))
                {
                    if (siteInfo.Additional.CheckContentLevel <= 4)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 4;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheckLevel3))
                {
                    if (siteInfo.Additional.CheckContentLevel <= 3)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 3;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheckLevel2))
                {
                    if (siteInfo.Additional.CheckContentLevel <= 2)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 2;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentCheckLevel1))
                {
                    if (siteInfo.Additional.CheckContentLevel <= 1)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 1;
                    }
                }
                else
                {
                    checkedLevel = 0;
                }
            }
            return(new KeyValuePair <bool, int>(isChecked, checkedLevel));
        }
예제 #7
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);
        }
예제 #8
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                var targetNodeID = int.Parse(NodeIDTo.SelectedValue);

                var targetPublishmentSystemID   = int.Parse(PublishmentSystemIDDropDownList.SelectedValue);
                var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemID);
                var isChecked    = false;
                var checkedLevel = 0;
                if (targetPublishmentSystemInfo.CheckContentLevel == 0 || AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    isChecked    = true;
                    checkedLevel = 0;
                }
                else
                {
                    var UserCheckLevel  = 0;
                    var OwnHighestLevel = false;

                    if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel1))
                    {
                        UserCheckLevel = 1;
                        if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel2))
                        {
                            UserCheckLevel = 2;
                            if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel3))
                            {
                                UserCheckLevel = 3;
                                if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel4))
                                {
                                    UserCheckLevel = 4;
                                    if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel5))
                                    {
                                        UserCheckLevel = 5;
                                    }
                                }
                            }
                        }
                    }

                    if (UserCheckLevel >= targetPublishmentSystemInfo.CheckContentLevel)
                    {
                        OwnHighestLevel = true;
                    }
                    if (OwnHighestLevel)
                    {
                        isChecked    = true;
                        checkedLevel = 0;
                    }
                    else
                    {
                        isChecked    = false;
                        checkedLevel = UserCheckLevel;
                    }
                }

                try
                {
                    var translateType = ETranslateTypeUtils.GetEnumType(TranslateType.SelectedValue);

                    var nodeIDStrArrayList = ControlUtils.GetSelectedListControlValueArrayList(NodeIDFrom);

                    var nodeIDArrayList = new ArrayList();//需要转移的栏目ID
                    foreach (string nodeIDStr in nodeIDStrArrayList)
                    {
                        var nodeID = int.Parse(nodeIDStr);
                        if (translateType != ETranslateType.Content)//需要转移栏目
                        {
                            if (!ChannelUtility.IsAncestorOrSelf(PublishmentSystemId, nodeID, targetNodeID))
                            {
                                nodeIDArrayList.Add(nodeID);
                            }
                        }

                        if (translateType == ETranslateType.Content)//转移内容
                        {
                            TranslateContent(targetPublishmentSystemInfo, nodeID, targetNodeID, isChecked, checkedLevel);
                        }
                    }

                    if (translateType != ETranslateType.Content)//需要转移栏目
                    {
                        var nodeIDArrayListToTranslate = new ArrayList(nodeIDArrayList);
                        foreach (int nodeID in nodeIDArrayList)
                        {
                            var subNodeIDArrayList = DataProvider.NodeDao.GetNodeIdListForDescendant(nodeID);
                            if (subNodeIDArrayList != null && subNodeIDArrayList.Count > 0)
                            {
                                foreach (int nodeIDToDelete in subNodeIDArrayList)
                                {
                                    if (nodeIDArrayListToTranslate.Contains(nodeIDToDelete))
                                    {
                                        nodeIDArrayListToTranslate.Remove(nodeIDToDelete);
                                    }
                                }
                            }
                        }

                        var nodeInfoList = new List <NodeInfo>();
                        foreach (int nodeID in nodeIDArrayListToTranslate)
                        {
                            var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID);
                            nodeInfoList.Add(nodeInfo);
                        }

                        TranslateChannelAndContent(nodeInfoList, targetPublishmentSystemID, targetNodeID, translateType, isChecked, checkedLevel, null, null);

                        if (IsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(IsDeleteAfterTranslate.SelectedValue, EBoolean.True))
                        {
                            foreach (int nodeID in nodeIDArrayListToTranslate)
                            {
                                try
                                {
                                    DataProvider.NodeDao.Delete(nodeID);
                                }
                                catch { }
                            }
                        }
                    }
                    Submit.Enabled = false;

                    var builder = new StringBuilder();
                    foreach (ListItem listItem in NodeIDFrom.Items)
                    {
                        if (listItem.Selected)
                        {
                            builder.Append(listItem.Text).Append(",");
                        }
                    }
                    if (builder.Length > 0)
                    {
                        builder.Length = builder.Length - 1;
                    }
                    Body.AddSiteLog(PublishmentSystemId, "批量转移", $"栏目:{builder},转移后删除:{IsDeleteAfterTranslate.SelectedValue}");

                    SuccessMessage("批量转移成功!");
                    if (Body.IsQueryExists("ChannelIDCollection"))
                    {
                        PageUtils.Redirect(returnUrl);
                    }
                    else
                    {
                        PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId));
                    }
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "批量转移失败!");
                    LogUtils.AddErrorLog(ex);
                }
            }
        }
예제 #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);
            var nodeId      = PublishmentSystemId;

            _isGovPublic = Body.GetQueryBool("IsGovPublic");
            if (_isGovPublic)
            {
                nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId;
                if (nodeId == 0)
                {
                    nodeId = PublishmentSystemId;
                }
            }
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);
            _nodeInfo            = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _tableName           = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _tableStyle          = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId));

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容审核", string.Empty);

                var checkedLevel = 5;
                var isChecked    = true;
                foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                {
                    int checkedLevelByNodeId;
                    var isCheckedByNodeId = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, owningNodeId, out checkedLevelByNodeId);
                    if (checkedLevel > checkedLevelByNodeId)
                    {
                        checkedLevel = checkedLevelByNodeId;
                    }
                    if (!isCheckedByNodeId)
                    {
                        isChecked = false;
                    }
                }

                LevelManager.LoadContentLevelToList(State, PublishmentSystemInfo, PublishmentSystemId, isChecked, checkedLevel);

                if (_isGovPublic)
                {
                    PhContentModel.Visible = false;
                }
                else
                {
                    PhContentModel.Visible = true;
                    var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                    foreach (var modelInfo in contentModelInfoList)
                    {
                        DdlContentModelId.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                    }
                    ControlUtils.SelectListItems(DdlContentModelId, _nodeInfo.ContentModelId);
                    //EContentModelTypeUtils.AddListItemsForContentCheck(this.ContentModelID);
                }

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                }
                if (!string.IsNullOrEmpty(Body.GetQueryString("ModelID")))
                {
                    ControlUtils.SelectListItems(DdlContentModelId, Body.GetQueryString("ModelID"));
                }

                SpContents.ControlToPaginate = RptContents;
                SpContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

                var checkLevelArrayList = new ArrayList();

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    checkLevelArrayList.Add(Body.GetQueryString("State"));
                }
                else
                {
                    checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayList(PublishmentSystemInfo, isChecked, checkedLevel);
                }
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, DdlContentModelId.SelectedValue);
                if (_isGovPublic)
                {
                    tableName = PublishmentSystemInfo.AuxiliaryTableForGovPublic;
                }

                var owningNodeIdList = new List <int>();
                if (!permissions.IsSystemAdministrator)
                {
                    foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                    {
                        if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, owningNodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                        {
                            owningNodeIdList.Add(owningNodeId);
                        }
                    }
                }

                SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectedCommendByCheck(tableName, PublishmentSystemId, permissions.IsSystemAdministrator, owningNodeIdList, checkLevelArrayList);

                SpContents.SortField       = ContentAttribute.LastEditDate;
                SpContents.SortMode        = SortMode.DESC;
                RptContents.ItemDataBound += rptContents_ItemDataBound;

                SpContents.DataBind();

                var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                BtnCheck.Attributes.Add("onclick", showPopWinString);

                LtlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

            if (!HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }
예제 #10
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("NodeID"))
            {
                _nodeId = Body.GetQueryInt("NodeID");
            }
            else
            {
                _nodeId = PublishmentSystemId;
            }

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty;
            }

            _nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);

            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId));
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName);
            }
            else
            {
                var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State"));
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索";
                if (_isWritingOnly)
                {
                    pageTitle = "投稿内容";
                }
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty);

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

                ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核");

                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                    IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }
                else
                {
                    DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1));
                    DateTo.Text   = DateUtils.GetDateString(DateTime.Now);
                }

                spContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true);
                SelectButton.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                    Check.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    CheckPlaceHolder.Visible = false;
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
            {
                AddContent.Visible = false;
            }
            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                Translate.Visible = false;
            }
            else
            {
                Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl));
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }
예제 #11
0
파일: WebUtils.cs 프로젝트: zhongqi013/cms
        public static string GetChannelCommands(string administratorName, SiteInfo siteInfo, ChannelInfo nodeInfo, string pageUrl, string currentFileName)
        {
            var iconUrl = SiteServerAssets.GetIconUrl(string.Empty);
            var builder = new StringBuilder();

            //添加栏目
            if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelAdd) && nodeInfo.Additional.IsChannelAddable)
            {
                builder.Append(
                    $@"<a href=""{PageChannelAdd.GetRedirectUrl(siteInfo.Id,
                        nodeInfo.Id, 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=""{ModalChannelsAdd.GetOpenWindowString(
                        siteInfo.Id, nodeInfo.Id, pageUrl)}"">快速添加</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
            }
            if (nodeInfo.ChildrenCount > 0)
            {
                //删除栏目
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelDelete))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelDelete.GetRedirectUrl(siteInfo.Id, pageUrl),
                            "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!")}"">删除栏目</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
                //清空内容
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentDelete))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithCheckBoxValue(
                            PageChannelDelete.GetRedirectUrl(siteInfo.Id, pageUrl),
                            "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除内容的栏目!")}"">清空内容</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }

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

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

                //生 成
                if (AdminUtility.HasSitePermissions(administratorName, siteInfo.Id, ConfigManager.Permissions.WebSite.Create) || AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.CreatePage))
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalCreateChannels.GetOpenWindowString(
                            siteInfo.Id)}"">生 成</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }
            else
            {
                //导 入
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelAdd) && nodeInfo.Additional.IsChannelAddable)
                {
                    builder.Append(
                        $@"<a href=""javascript:;"" onclick=""{ModalChannelImport.GetOpenWindowString(
                            siteInfo.Id, nodeInfo.Id)}"">导 入</a> <span class=""gray"">&nbsp;|&nbsp;</span> ");
                }
            }
            if (siteInfo.Id != nodeInfo.Id)
            {
                builder.Append(
                    $@"<a href=""{$"{currentFileName}?siteId={siteInfo.Id}&channelId={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());
        }
예제 #12
0
파일: WebUtils.cs 프로젝트: zhongqi013/cms
        public static string GetContentCommands(string administratorName, SiteInfo siteInfo, ChannelInfo nodeInfo, string pageUrl)
        {
            var builder = new StringBuilder();

            if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentAdd) && nodeInfo.Additional.IsContentAddable)
            {
                builder.Append($@"
<a href=""{GetContentAddAddUrl(siteInfo.Id, nodeInfo, pageUrl)}"" class=""btn btn-primary"">
    <i class=""ion-plus""></i>
    添加
</a>");

                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalUploadWord.GetOpenWindowString(siteInfo.Id, nodeInfo.Id, StringUtils.ValueToUrl(pageUrl))}"">
    导入Word
</a>");
            }

            if (nodeInfo.ContentNum > 0 && AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentDelete))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{PageContentDelete.GetRedirectClickStringForSingleChannel(siteInfo.Id, nodeInfo.Id, false, pageUrl)}"">
    <i class=""ion-trash-a""></i>
    删 除
</a>");
            }

            if (nodeInfo.ContentNum > 0)
            {
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentEdit))
                {
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalContentAttributes.GetOpenWindowString(siteInfo.Id, nodeInfo.Id)}"">
    <i class=""ion-flag""></i>
    属性
</a>");
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalAddToGroup.GetOpenWindowStringToContent(siteInfo.Id, nodeInfo.Id)}"">
    内容组
</a>");
                }
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentTranslate))
                {
                    var redirectUrl = PageContentTranslate.GetRedirectUrl(siteInfo.Id, nodeInfo.Id, pageUrl);
                    var clickString = PageUtils.GetRedirectStringWithCheckBoxValue(redirectUrl, "contentIdCollection", "contentIdCollection", "请选择需要转移的内容!");
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{clickString}"">
    转 移
</a>");
                }
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentEdit))
                {
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalContentTaxis.GetOpenWindowString(siteInfo.Id, nodeInfo.Id, pageUrl)}"">
    排 序
</a>");
                }
                if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ContentCheck))
                {
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalContentCheck.GetOpenWindowString(siteInfo.Id, nodeInfo.Id, pageUrl)}"">
    审 核
</a>");
                }
                if (AdminUtility.HasSitePermissions(administratorName, siteInfo.Id, ConfigManager.Permissions.WebSite.Create) || AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.CreatePage))
                {
                    builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateContentsOneByOne(siteInfo.Id, nodeInfo.Id)}"">
    <i class=""ion-wand""></i>
    生 成
</a>");
                }
            }

            if (AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelEdit))
            {
                builder.Append($@"
<a href=""javascript:;"" class=""btn btn-primary"" onclick=""{ModalSelectColumns.GetOpenWindowStringToContent(siteInfo.Id, nodeInfo.Id, true)}"">
    <i class=""ion-ios-list-outline""></i>
    显示项
</a>");
            }

            if (nodeInfo.ContentNum > 0)
            {
                builder.Append(@"
<a href=""javascript:;;"" class=""btn btn-primary"" onClick=""$('#contentSearch').toggle(); return false"">
    <i class=""ion-search""></i>
    查找
</a>");
            }

            return(builder.ToString());
        }
예제 #13
0
        public static KeyValuePair <bool, int> GetUserCheckLevel(string administratorName, PublishmentSystemInfo publishmentSystemInfo, int nodeId)
        {
            var permissions = PermissionsManager.GetPermissions(administratorName);

            if (permissions.IsSystemAdministrator)
            {
                return(new KeyValuePair <bool, int>(true, publishmentSystemInfo.CheckContentLevel));
            }

            var isChecked    = false;
            var checkedLevel = 0;

            if (publishmentSystemInfo.IsCheckContentUseLevel == false)
            {
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    isChecked = true;
                }
            }
            else
            {
                if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheckLevel5))
                {
                    isChecked = true;
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheckLevel4))
                {
                    if (publishmentSystemInfo.CheckContentLevel <= 4)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 4;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheckLevel3))
                {
                    if (publishmentSystemInfo.CheckContentLevel <= 3)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 3;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheckLevel2))
                {
                    if (publishmentSystemInfo.CheckContentLevel <= 2)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 2;
                    }
                }
                else if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeId, AppManager.Cms.Permission.Channel.ContentCheckLevel1))
                {
                    if (publishmentSystemInfo.CheckContentLevel <= 1)
                    {
                        isChecked = true;
                    }
                    else
                    {
                        checkedLevel = 1;
                    }
                }
                else
                {
                    checkedLevel = 0;
                }
            }
            return(new KeyValuePair <bool, int>(isChecked, checkedLevel));
        }
예제 #14
0
        public void Page_Load(object sender, EventArgs e)
        {
            PageUtils.CheckRequestParameter("PublishmentSystemID");

            var nodeId = TranslateUtils.ToInt(Request.QueryString["NodeID"]);

            if (nodeId == 0)
            {
                nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId;
            }
            _contentId = TranslateUtils.ToInt(Request.QueryString["ID"]);
            ReturnUrl  = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);

            _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);

            _tableStyle        = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableName         = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);

            GovPublicContentInfo contentInfo = null;

            if (_contentId == 0)
            {
                if (_nodeInfo != null && _nodeInfo.Additional.IsContentAddable == false)
                {
                    PageUtils.RedirectToErrorPage("此栏目不能添加内容!");
                    return;
                }

                if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
                {
                    if (!Body.IsAdministratorLoggin)
                    {
                        PageUtils.RedirectToLoginPage();
                        return;
                    }
                    PageUtils.RedirectToErrorPage("您无此栏目的添加内容权限!");
                    return;
                }
            }
            else
            {
                contentInfo = DataProvider.GovPublicContentDao.GetContentInfo(PublishmentSystemInfo, _contentId);
                if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentEdit))
                {
                    if (!Body.IsAdministratorLoggin)
                    {
                        PageUtils.RedirectToLoginPage();
                        return;
                    }
                    PageUtils.RedirectToErrorPage("您无此栏目的修改内容权限!");
                    return;
                }
            }

            if (!IsPostBack)
            {
                var nodeNames      = NodeManager.GetNodeNameNavigationByGovPublic(PublishmentSystemId, nodeId);
                var departmentId   = 0;
                var departmentName = string.Empty;

                var pageTitle = _contentId == 0 ? "添加信息" : "修改信息";
                BreadCrumbWithItemTitle(AppManager.Wcm.LeftMenu.IdGovPublic, AppManager.Wcm.LeftMenu.GovPublic.IdGovPublicContent, pageTitle, nodeNames, AppManager.Wcm.Permission.WebSite.GovPublicContent);

                ltlPageTitle.Text  = pageTitle;
                ltlPageTitle.Text += $@"
<script language=""javascript"" type=""text/javascript"">
var previewUrl = '{PagePreview.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, _contentId, 0, 0)}';
</script>
";

                EBooleanUtils.AddListItems(rblIsAbolition);
                ControlUtils.SelectListItemsIgnoreCase(rblIsAbolition, false.ToString());

                //转移
                if (_tableStyle == ETableStyle.BackgroundContent && AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
                {
                    phTranslate.Visible = PublishmentSystemInfo.Additional.IsTranslate;
                    divTranslateAdd.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(PublishmentSystemId, true));

                    ETranslateContentTypeUtils.AddListItems(ddlTranslateType, true);
                    ControlUtils.SelectListItems(ddlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy));
                }
                else
                {
                    phTranslate.Visible = false;
                }

                //内容属性
                var excludeAttributeNames = TableManager.GetExcludeAttributeNames(_tableStyle);
                acAttributes.AddExcludeAttributeNames(excludeAttributeNames);

                if (excludeAttributeNames.Count == 0)
                {
                    phContentAttributes.Visible = false;
                }
                else
                {
                    phContentAttributes.Visible = true;
                    foreach (var attributeName in GovPublicContentAttribute.CheckBoxAttributes)
                    {
                        var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, attributeName, _relatedIdentities);
                        if (styleInfo.IsVisible)
                        {
                            var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            if (_contentId > 0)
                            {
                                listItem.Selected = TranslateUtils.ToBool(contentInfo.GetExtendedAttribute(styleInfo.AttributeName));
                            }
                            ContentAttributes.Items.Add(listItem);
                        }
                    }
                }

                //内容组
                var contentGroupNameList = DataProvider.ContentGroupDao.GetContentGroupNameList(PublishmentSystemId);

                if (!PublishmentSystemInfo.Additional.IsGroupContent || contentGroupNameList.Count == 0)
                {
                    phContentGroup.Visible = false;
                }
                else
                {
                    foreach (var groupName in contentGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        if (_contentId > 0)
                        {
                            item.Selected = StringUtils.In(contentInfo.ContentGroupNameCollection, groupName);
                        }
                        ContentGroupNameCollection.Items.Add(item);
                    }
                }

                if (!PublishmentSystemInfo.Additional.IsRelatedByTags || _tableStyle != ETableStyle.BackgroundContent)
                {
                    phTags.Visible = false;
                }
                else
                {
                    var tagScript = @"
<script type=""text/javascript"">
function getTags(tag){
	$.get('[url]&tag=' + encodeURIComponent(tag) + '&r=' + Math.random(), function(data) {
		if(data !=''){
			var arr = data.split('|');
			var temp='';
			for(i=0;i<arr.length;i++)
			{
				temp += '<li><a>'+arr[i].replace(tag,'<b>' + tag + '</b>') + '</a></li>';
			}
			var myli='<ul>'+temp+'</ul>';
			$('#tagTips').html(myli);
			$('#tagTips').show();
		}else{
            $('#tagTips').hide();
        }
		$('#tagTips li').click(function () {
			var tag = $('#Tags').val();
			var i = tag.lastIndexOf(' ');
			if (i > 0)
			{
				tag = tag.substring(0, i) + ' ' + $(this).text();
			}else{
				tag = $(this).text();	
			}
			$('#Tags').val(tag);
			$('#tagTips').hide();
		})
	});	
}
$(document).ready(function () {
$('#Tags').keyup(function (e) {
    if (e.keyCode != 40 && e.keyCode != 38) {
        var tag = $('#Tags').val();
		var i = tag.lastIndexOf(' ');
		if (i > 0){ tag = tag.substring(i + 1);}
        if (tag != '' && tag != ' '){
            window.setTimeout(""getTags('"" + tag + ""');"", 200);
        }else{
            $('#tagTips').hide();
        }
    }
}).blur(function () {
	window.setTimeout(""$('#tagTips').hide();"", 200);
})});
</script>
<div id=""tagTips"" class=""inputTips""></div>
";
                    ltlTags.Text = tagScript.Replace("[url]", AjaxCmsService.GetTagsUrl(PublishmentSystemId));
                }

                divAddChannel.Attributes.Add("onclick", ModalGovPublicCategoryChannelSelect.GetOpenWindowString(PublishmentSystemId));
                divAddDepartment.Attributes.Add("onclick", ModalGovPublicCategoryDepartmentSelect.GetOpenWindowString(PublishmentSystemId));

                var categoryBuilder = new StringBuilder();

                var categoryClassInfoArrayList = DataProvider.GovPublicCategoryClassDao.GetCategoryClassInfoArrayList(PublishmentSystemId, ETriState.False, ETriState.True);
                if (categoryClassInfoArrayList.Count > 0)
                {
                    var categoryIndex = 1;
                    foreach (GovPublicCategoryClassInfo categoryClassInfo in categoryClassInfoArrayList)
                    {
                        categoryIndex++;
                        if (categoryIndex % 2 == 0)
                        {
                            categoryBuilder.Append("<tr>");
                        }
                        categoryBuilder.Append(
                            $@"<td height=""30"">{categoryClassInfo.ClassName}分类:</td><td height=""30"">
<div class=""fill_box"" id=""category{categoryClassInfo.ClassCode}Container"" style=""display:none"">
                  <div class=""addr_base addr_normal""> <b id=""category{categoryClassInfo.ClassCode}Name""></b> <a class=""addr_del"" href=""javascript:;"" onClick=""showCategory{categoryClassInfo
                                .ClassCode}('', '0')""></a>
                    <input id=""category{categoryClassInfo.ClassCode}ID"" name=""category{categoryClassInfo.ClassCode}ID"" value=""0"" type=""hidden"">
                  </div>
                </div>
                <div ID=""divAdd{categoryClassInfo.ClassCode}"" class=""btn_pencil"" onclick=""{ModalGovPublicCategorySelect
                                .GetOpenWindowString(PublishmentSystemId, categoryClassInfo.ClassCode)}""><span class=""pencil""></span> 修改</div>
                <script language=""javascript"">
			  function showCategory{categoryClassInfo.ClassCode}({categoryClassInfo.ClassCode}Name, {categoryClassInfo.ClassCode}ID){{
				  $('#category{categoryClassInfo.ClassCode}Name').html({categoryClassInfo.ClassCode}Name);
				  $('#category{categoryClassInfo.ClassCode}ID').val({categoryClassInfo.ClassCode}ID);
				  if ({categoryClassInfo.ClassCode}ID == '0'){{
					$('#category{categoryClassInfo.ClassCode}Container').hide();
				  }}else{{
					  $('#category{categoryClassInfo.ClassCode}Container').show();
				  }}
			  }}
			  </script>
</td>");
                        if (categoryIndex % 2 == 1)
                        {
                            categoryBuilder.Append("</tr>");
                        }
                    }
                }

                if (_contentId == 0)
                {
                    var formCollection = new NameValueCollection();
                    if (Body.IsQueryExists("isUploadWord"))
                    {
                        var isFirstLineTitle  = TranslateUtils.ToBool(Request.QueryString["isFirstLineTitle"]);
                        var isFirstLineRemove = TranslateUtils.ToBool(Request.QueryString["isFirstLineRemove"]);
                        var isClearFormat     = TranslateUtils.ToBool(Request.QueryString["isClearFormat"]);
                        var isFirstLineIndent = TranslateUtils.ToBool(Request.QueryString["isFirstLineIndent"]);
                        var isClearFontSize   = TranslateUtils.ToBool(Request.QueryString["isClearFontSize"]);
                        var isClearFontFamily = TranslateUtils.ToBool(Request.QueryString["isClearFontFamily"]);
                        var isClearImages     = TranslateUtils.ToBool(Request.QueryString["isClearImages"]);
                        var contentLevel      = TranslateUtils.ToInt(Request.QueryString["contentLevel"]);
                        var fileName          = Request.QueryString["fileName"];

                        formCollection = WordUtils.GetWordNameValueCollection(PublishmentSystemId, _nodeInfo.ContentModelId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, contentLevel, fileName);
                    }

                    ascTitle.SetParameters(PublishmentSystemInfo, _nodeInfo.NodeId, _tableStyle, _tableName, ContentAttribute.Title, formCollection, false, IsPostBack);
                    acAttributes.SetParameters(formCollection, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, false, IsPostBack);
                }
                //else
                //{

                //    this.Tags.Text = contentInfo.Tags;
                //}

                //if (contentID == 0)
                //{
                //    NameValueCollection formCollection = new NameValueCollection();
                //    this.ascContent.SetParameters(base.PublishmentSystemInfo, base.PublishmentSystemInfo.Additional.GovPublicNodeID, ETableStyle.GovPublicContent, base.PublishmentSystemInfo.AuxiliaryTableForGovPublic, GovPublicContentAttribute.Content, formCollection, false, base.IsPostBack);
                //}
                else
                {
                    departmentId   = contentInfo.DepartmentId;
                    departmentName = DepartmentManager.GetDepartmentName(departmentId);

                    foreach (GovPublicCategoryClassInfo categoryClassInfo in categoryClassInfoArrayList)
                    {
                        var categoryId = TranslateUtils.ToInt(contentInfo.GetExtendedAttribute(categoryClassInfo.ContentAttributeName));
                        if (categoryId > 0)
                        {
                            var categoryName = DataProvider.GovPublicCategoryDao.GetCategoryName(categoryId);
                            categoryBuilder.Append(
                                $@"<script>showCategory{categoryClassInfo.ClassCode}('{categoryName}', '{categoryId}');</script>");
                        }
                    }

                    tbIdentifier.Text       = contentInfo.Identifier;
                    tbPublisher.Text        = contentInfo.Publisher;
                    tbDocumentNo.Text       = contentInfo.DocumentNo;
                    dtbPublishDate.DateTime = contentInfo.PublishDate;
                    tbKeywords.Text         = contentInfo.Keywords;
                    dtbEffectDate.DateTime  = contentInfo.EffectDate;
                    ControlUtils.SelectListItemsIgnoreCase(rblIsAbolition, contentInfo.IsAbolition.ToString());
                    dtbAbolitionDate.DateTime = contentInfo.AbolitionDate;
                    tbDescription.Text        = contentInfo.Description;

                    ascTitle.SetParameters(PublishmentSystemInfo, _nodeInfo.NodeId, _tableStyle, _tableName, ContentAttribute.Title, contentInfo.Attributes, true, IsPostBack);

                    acAttributes.SetParameters(contentInfo.Attributes, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, true, IsPostBack);
                    Tags.Text = contentInfo.Tags;
                }

                if (departmentId == 0)
                {
                    departmentId = BaiRongDataProvider.AdministratorDao.GetDepartmentId(Body.AdministratorName);
                    if (departmentId > 0)
                    {
                        departmentName = DepartmentManager.GetDepartmentName(departmentId);
                    }
                }

                categoryBuilder.Append(
                    $@"<script>showCategoryChannel('{nodeNames}', '{nodeId}');showCategoryDepartment('{departmentName}', '{departmentId}');</script>");

                ltlCategoryScript.Text = categoryBuilder.ToString();

                if (HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    phStatus.Visible = true;

                    int checkedLevel;
                    var isChecked = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, PublishmentSystemId, out checkedLevel);
                    LevelManager.LoadContentLevelToEdit(ContentLevel, PublishmentSystemInfo, nodeId, contentInfo, isChecked, checkedLevel);
                }
                else
                {
                    phStatus.Visible = false;
                }

                Submit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm"));

                if (PublishmentSystemInfo.Additional.GovPublicIsPublisherRelatedDepartmentId && string.IsNullOrEmpty(tbPublisher.Text))
                {
                    tbPublisher.Text = departmentName;
                }
            }
            else
            {
                if (_contentId == 0)
                {
                    ascTitle.SetParameters(PublishmentSystemInfo, _nodeInfo.NodeId, _tableStyle, _tableName, ContentAttribute.Title, Request.Form, false, IsPostBack);

                    acAttributes.SetParameters(Request.Form, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, false, IsPostBack);
                }
                else
                {
                    ascTitle.SetParameters(PublishmentSystemInfo, _nodeInfo.NodeId, _tableStyle, _tableName, ContentAttribute.Title, Request.Form, true, IsPostBack);

                    acAttributes.SetParameters(Request.Form, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, true, IsPostBack);
                }
                //this.ascContent.SetParameters(base.PublishmentSystemInfo, base.PublishmentSystemInfo.Additional.GovPublicNodeID, ETableStyle.GovPublicContent, base.PublishmentSystemInfo.AuxiliaryTableForGovPublic, GovPublicContentAttribute.Content, base.Request.Form, true, base.IsPostBack);
            }
            DataBind();
        }
예제 #15
0
 public bool HasChannelPermissions(int nodeId, params string[] channelPermissionArray)
 {
     return(AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, nodeId, channelPermissionArray));
 }
예제 #16
0
 public static bool IsEdit(SiteInfo siteInfo, int channelId, string administratorName)
 {
     return AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.ContentEdit);
 }
예제 #17
0
        public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional)
        {
            var htmlBuilder  = new StringBuilder();
            var parentsCount = _channelInfo.ParentsCount;

            for (var i = 0; i < parentsCount; i++)
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (_channelInfo.ChildrenCount > 0)
            {
                htmlBuilder.Append(
                    _channelInfo.SiteId == _channelInfo.Id
                        ? $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_channelInfo
                            .Id}"" src=""{_iconMinusUrl}"" />"
                        : $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_channelInfo
                            .Id}"" src=""{_iconPlusUrl}"" />");
            }
            else
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (!string.IsNullOrEmpty(_iconFolderUrl))
            {
                htmlBuilder.Append(
                    _channelInfo.Id > 0
                        ? $@"<a href=""{PageRedirect.GetRedirectUrlToChannel(_channelInfo.SiteId, _channelInfo.Id)}"" target=""_blank"" title=""浏览页面""><img align=""absmiddle"" border=""0"" src=""{_iconFolderUrl}"" style=""max-height: 22px; max-width: 22px"" /></a>"
                        : $@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" style=""max-height: 22px; max-width: 22px"" />");
            }

            htmlBuilder.Append("&nbsp;");

            if (_enabled)
            {
                if (loadingType == ELoadingType.ContentTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_channelInfo.ChannelName}</a>");
                }
                else if (loadingType == ELoadingType.ChannelSelect)
                {
                    var linkUrl = ModalChannelSelect.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);
                    if (additional != null)
                    {
                        if (!string.IsNullOrEmpty(additional["linkUrl"]))
                        {
                            linkUrl = additional["linkUrl"] + _channelInfo.Id;
                        }
                        else
                        {
                            foreach (string key in additional.Keys)
                            {
                                linkUrl += $"&{key}={additional[key]}";
                            }
                        }
                    }
                    htmlBuilder.Append($"<a href='{linkUrl}'>{_channelInfo.ChannelName}</a>");
                }
                else
                {
                    if (AdminUtility.HasChannelPermissions(_administratorName, _channelInfo.SiteId, _channelInfo.Id, ConfigManager.Permissions.Channel.ChannelEdit))
                    {
                        var onClickUrl = ModalChannelEdit.GetOpenWindowString(_channelInfo.SiteId, _channelInfo.Id, returnUrl);
                        htmlBuilder.Append(
                            $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_channelInfo.ChannelName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append($@"<a href=""javascript:;;"">{_channelInfo.ChannelName}</a>");
                    }
                }
            }
            else
            {
                htmlBuilder.Append(_channelInfo.ChannelName);
            }

            if (_channelInfo.SiteId != 0)
            {
                htmlBuilder.Append("&nbsp;");

                htmlBuilder.Append(ChannelManager.GetNodeTreeLastImageHtml(_siteInfo, _channelInfo));

                if (_channelInfo.ContentNum < 0)
                {
                    return(htmlBuilder.ToString());
                }

                htmlBuilder.Append(
                    $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_channelInfo.ContentNum})</span>");
            }

            return(htmlBuilder.ToString());
        }
예제 #18
0
        public bool HasChannelPermissions(int siteId, int channelId, params string[] channelPermissions)
        {
            var request = new Request();

            return(AdminUtility.HasChannelPermissions(request.AdminName, siteId, channelId, channelPermissions));
        }
예제 #19
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

            PageUtils.CheckRequestParameter("SiteId");
            _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId;

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, _channelId) ? Body.AdminName : string.Empty;
            }

            _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName);

            var stateType   = Body.IsQueryExists("state") ? ETriStateUtils.GetEnumType(Body.GetQueryString("state")) : ETriState.All;
            var searchType  = Body.IsQueryExists("searchType") ? Body.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom    = Body.IsQueryExists("dateFrom") ? Body.GetQueryString("dateFrom") : string.Empty;
            var dateTo      = Body.IsQueryExists("dateTo") ? Body.GetQueryString("dateTo") : string.Empty;
            var isDuplicate = Body.IsQueryExists("isDuplicate") && Body.GetQueryBool("isDuplicate");
            var keyword     = Body.IsQueryExists("keyword") ? Body.GetQueryString("keyword") : string.Empty;

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, !isDuplicate, false, _isWritingOnly, administratorName);
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;
            SpContents.SortField         = ContentAttribute.Id;
            SpContents.SortMode          = SortMode.DESC;
            SpContents.OrderByString     = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc);
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName);

                DdlSearchType.Items.Add(new ListItem("标题", ContentAttribute.Title));
                if (_styleInfoList != null)
                {
                    foreach (var styleInfo in _styleInfoList)
                    {
                        if (styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            DdlSearchType.Items.Add(listitem);
                        }
                    }
                }
                DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

                if (SiteId != _channelId)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
                }
                ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("State"));
                CbIsDuplicate.Checked = isDuplicate;
                ControlUtils.SelectSingleItem(DdlSearchType, searchType);
                TbKeyword.Text  = keyword;
                TbDateFrom.Text = dateFrom;
                TbDateTo.Text   = dateTo;

                SpContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true);
                BtnSelect.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, SiteId, ConfigManager.Permissions.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);
                    BtnCheck.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    PhCheck.Visible = false;
                }

                LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
예제 #20
0
        public static string GetChannelRowHtml(SiteInfo siteInfo, ChannelInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, string administratorName)
        {
            var nodeTreeItem = NodeTreeItem.CreateInstance(siteInfo, nodeInfo, enabled, administratorName);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(siteInfo.Id, nodeInfo.Id), 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 (AdminUtility.HasChannelPermissions(administratorName, nodeInfo.SiteId, nodeInfo.Id, ConfigManager.Permissions.Channel.ChannelEdit))
                    {
                        var urlEdit = PageChannelEdit.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id, PageChannel.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id));
                        editUrl = $"<a href=\"{urlEdit}\">编辑</a>";
                        var urlSubtract = PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                        {
                            { "Subtract", true.ToString() },
                            { "channelId", nodeInfo.Id.ToString() }
                        });
                        upLink =
                            $@"<a href=""{urlSubtract}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        var urlAdd = PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                        {
                            { "Add", true.ToString() },
                            { "channelId", nodeInfo.Id.ToString() }
                        });
                        downLink =
                            $@"<a href=""{urlAdd}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.Id}' />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{nodeInfo.GroupNameCollection}</td>
    <td>{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);
                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>";
                }

                if (nodeInfo.Additional.ToNameValueCollection().Count > 0)
                {
                    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.ChannelSelect)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }
예제 #21
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId;

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _channelId);
            _tableName           = ChannelManager.GetTableName(SiteInfo, _nodeInfo);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName);

            if (IsPostBack)
            {
                return;
            }

            var checkedLevel = 5;
            var isChecked    = true;

            foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList)
            {
                int checkedLevelByChannelId;
                var isCheckedByChannelId = CheckManager.GetUserCheckLevel(Body.AdminName, SiteInfo, owningChannelId, out checkedLevelByChannelId);
                if (checkedLevel > checkedLevelByChannelId)
                {
                    checkedLevel = checkedLevelByChannelId;
                }
                if (!isCheckedByChannelId)
                {
                    isChecked = false;
                }
            }

            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName);
            CheckManager.LoadContentLevelToList(DdlState, SiteInfo, SiteId, isChecked, checkedLevel);
            var checkLevelList = new List <int>();

            if (!string.IsNullOrEmpty(Body.GetQueryString("channelId")))
            {
                ControlUtils.SelectSingleItem(DdlChannelId, Body.GetQueryString("channelId"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("state")))
            {
                ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("state"));
                checkLevelList.Add(Body.GetQueryInt("state"));
            }
            else
            {
                checkLevelList = CheckManager.LevelInt.GetCheckLevelList(SiteInfo, isChecked, checkedLevel);
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;

            var nodeInfo      = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName     = ChannelManager.GetTableName(SiteInfo, nodeInfo);
            var channelIdList = DataProvider.ChannelDao.GetIdListByScopeType(nodeInfo.Id, nodeInfo.ChildrenCount, EScopeType.All, string.Empty, string.Empty, nodeInfo.ContentModelPluginId);
            var list          = new List <int>();

            if (permissions.IsSystemAdministrator)
            {
                list = channelIdList;
            }
            else
            {
                var owningChannelIdList = new List <int>();
                foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList)
                {
                    if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, owningChannelId, ConfigManager.Permissions.Channel.ContentCheck))
                    {
                        owningChannelIdList.Add(owningChannelId);
                    }
                }
                foreach (var theChannelId in channelIdList)
                {
                    if (owningChannelIdList.Contains(theChannelId))
                    {
                        list.Add(theChannelId);
                    }
                }
            }

            SpContents.SelectCommand = DataProvider.ContentDao.GetSelectedCommendByCheck(tableName, SiteId, list, checkLevelList);

            SpContents.SortField       = ContentAttribute.LastEditDate;
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            SpContents.DataBind();

            var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);

            BtnCheck.Attributes.Add("onclick", showPopWinString);

            LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);

            if (!HasChannelPermissions(SiteId, ConfigManager.Permissions.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
예제 #22
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                return;
            }

            var targetChannelId = TranslateUtils.ToInt(DdlChannelIdTo.SelectedValue);

            var  targetSiteId   = TranslateUtils.ToInt(DdlSiteId.SelectedValue);
            var  targetSiteInfo = SiteManager.GetSiteInfo(targetSiteId);
            bool isChecked;
            int  checkedLevel;

            if (targetSiteInfo.Additional.CheckContentLevel == 0 || AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentAdd, ConfigManager.Permissions.Channel.ContentCheck))
            {
                isChecked    = true;
                checkedLevel = 0;
            }
            else
            {
                var userCheckLevel  = 0;
                var ownHighestLevel = false;

                if (AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentCheckLevel1))
                {
                    userCheckLevel = 1;
                    if (AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentCheckLevel2))
                    {
                        userCheckLevel = 2;
                        if (AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentCheckLevel3))
                        {
                            userCheckLevel = 3;
                            if (AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentCheckLevel4))
                            {
                                userCheckLevel = 4;
                                if (AdminUtility.HasChannelPermissions(Body.AdminName, targetSiteId, targetChannelId, ConfigManager.Permissions.Channel.ContentCheckLevel5))
                                {
                                    userCheckLevel = 5;
                                }
                            }
                        }
                    }
                }

                if (userCheckLevel >= targetSiteInfo.Additional.CheckContentLevel)
                {
                    ownHighestLevel = true;
                }
                if (ownHighestLevel)
                {
                    isChecked    = true;
                    checkedLevel = 0;
                }
                else
                {
                    isChecked    = false;
                    checkedLevel = userCheckLevel;
                }
            }

            try
            {
                var translateType = ETranslateTypeUtils.GetEnumType(DdlTranslateType.SelectedValue);

                var channelIdStrArrayList = ControlUtils.GetSelectedListControlValueArrayList(LbChannelIdFrom);

                var channelIdList = new List <int>();       //需要转移的栏目ID
                foreach (string channelIdStr in channelIdStrArrayList)
                {
                    var channelId = int.Parse(channelIdStr);
                    if (translateType != ETranslateType.Content)        //需要转移栏目
                    {
                        if (!ChannelManager.IsAncestorOrSelf(SiteId, channelId, targetChannelId))
                        {
                            channelIdList.Add(channelId);
                        }
                    }

                    if (translateType == ETranslateType.Content)        //转移内容
                    {
                        TranslateContent(targetSiteInfo, channelId, targetChannelId, isChecked, checkedLevel);
                    }
                }

                if (translateType != ETranslateType.Content)        //需要转移栏目
                {
                    var channelIdListToTranslate = new List <int>(channelIdList);
                    foreach (var channelId in channelIdList)
                    {
                        var subChannelIdArrayList = DataProvider.ChannelDao.GetIdListForDescendant(channelId);
                        if (subChannelIdArrayList != null && subChannelIdArrayList.Count > 0)
                        {
                            foreach (int channelIdToDelete in subChannelIdArrayList)
                            {
                                if (channelIdListToTranslate.Contains(channelIdToDelete))
                                {
                                    channelIdListToTranslate.Remove(channelIdToDelete);
                                }
                            }
                        }
                    }

                    var nodeInfoList = new List <ChannelInfo>();
                    foreach (int channelId in channelIdListToTranslate)
                    {
                        var nodeInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
                        nodeInfoList.Add(nodeInfo);
                    }

                    TranslateChannelAndContent(nodeInfoList, targetSiteId, targetChannelId, translateType, isChecked, checkedLevel, null, null);

                    if (RblIsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(RblIsDeleteAfterTranslate.SelectedValue, EBoolean.True))
                    {
                        foreach (int channelId in channelIdListToTranslate)
                        {
                            try
                            {
                                DataProvider.ChannelDao.Delete(SiteId, channelId);
                            }
                            catch
                            {
                                // ignored
                            }
                        }
                    }
                }
                BtnSubmit.Enabled = false;

                var builder = new StringBuilder();
                foreach (ListItem listItem in LbChannelIdFrom.Items)
                {
                    if (listItem.Selected)
                    {
                        builder.Append(listItem.Text).Append(",");
                    }
                }
                if (builder.Length > 0)
                {
                    builder.Length = builder.Length - 1;
                }
                Body.AddSiteLog(SiteId, "批量转移", $"栏目:{builder},转移后删除:{RblIsDeleteAfterTranslate.SelectedValue}");

                SuccessMessage("批量转移成功!");
                PageUtils.Redirect(Body.IsQueryExists("ChannelIDCollection") ? ReturnUrl : GetRedirectUrl(SiteId));
            }
            catch (Exception ex)
            {
                FailMessage(ex, "批量转移失败!");
                LogUtils.AddSystemErrorLog(ex);
            }
        }
예제 #23
0
        public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional)
        {
            var htmlBuilder  = new StringBuilder();
            var parentsCount = _nodeInfo.ParentsCount;

            if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                parentsCount = parentsCount - 1;
            }
            else if (loadingType == ELoadingType.GovPublicChannel || loadingType == ELoadingType.GovInteractChannel)
            {
                parentsCount = parentsCount - 2;
            }
            for (var i = 0; i < parentsCount; i++)
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (_nodeInfo.ChildrenCount > 0)
            {
                if (_nodeInfo.PublishmentSystemId == _nodeInfo.NodeId)
                {
                    htmlBuilder.Append(
                        $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_nodeInfo.NodeId}"" src=""{_iconMinusUrl}"" />");
                }
                else
                {
                    htmlBuilder.Append(
                        $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_nodeInfo.NodeId}"" src=""{_iconPlusUrl}"" />");
                }
            }
            else
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (!string.IsNullOrEmpty(_iconFolderUrl))
            {
                if (_nodeInfo.NodeId > 0)
                {
                    htmlBuilder.Append(
                        $@"<a href=""{PageActions.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"" target=""_blank"" title=""浏览页面""><img align=""absmiddle"" border=""0"" src=""{_iconFolderUrl}"" /></a>");
                }
                else
                {
                    htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" />");
                }
            }

            htmlBuilder.Append("&nbsp;");

            if (_enabled)
            {
                if (loadingType == ELoadingType.ContentTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>");
                }
                else if (loadingType == ELoadingType.ChannelSelect)
                {
                    var linkUrl = ModalChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);
                    if (additional != null)
                    {
                        if (!string.IsNullOrEmpty(additional["linkUrl"]))
                        {
                            linkUrl = additional["linkUrl"] + _nodeInfo.NodeId;
                        }
                        else
                        {
                            foreach (string key in additional.Keys)
                            {
                                linkUrl += $"&{key}={additional[key]}";
                            }
                        }
                    }
                    htmlBuilder.Append($"<a href='{linkUrl}'>{_nodeInfo.NodeName}</a>");
                }
                else if (loadingType == ELoadingType.GovPublicChannelAdd)
                {
                    if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.GovPublic))
                    {
                        htmlBuilder.Append($@"<a href=""{ModalGovPublicCategoryChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"">{_nodeInfo.NodeName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append(_nodeInfo.NodeName);
                    }
                }
                else if (loadingType == ELoadingType.GovPublicChannelTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>");
                }
                else
                {
                    if (AdminUtility.HasChannelPermissions(_administratorName, _nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                    {
                        var onClickUrl = ModalChannelEdit.GetOpenWindowString(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, returnUrl);
                        htmlBuilder.Append(
                            $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_nodeInfo.NodeName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append($@"<a href=""javascript:;;"">{_nodeInfo.NodeName}</a>");
                    }
                }
            }
            else
            {
                htmlBuilder.Append(_nodeInfo.NodeName);
            }

            if (_nodeInfo.PublishmentSystemId != 0)
            {
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(_nodeInfo.PublishmentSystemId);

                htmlBuilder.Append("&nbsp;");

                htmlBuilder.Append(NodeManager.GetNodeTreeLastImageHtml(publishmentSystemInfo, _nodeInfo));

                if (_nodeInfo.ContentNum >= 0)
                {
                    htmlBuilder.Append("&nbsp;");
                    htmlBuilder.Append(
                        $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_nodeInfo.ContentNum})</span>");
                }
            }

            return(htmlBuilder.ToString());
        }
예제 #24
0
 public bool HasChannelPermissions(int channelId, params string[] channelPermissionArray)
 {
     return(AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, channelId, channelPermissionArray));
 }
예제 #25
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");

            var nodeId = Body.GetQueryInt("NodeID");

            _nodeInfo = NodeManager.GetNodeInfo(1, nodeId);
            var    contentId   = Body.GetQueryInt("ID");
            string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId);

            ReturnUrl  = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={nodeId}";
            ReturnPUrl = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={ (Body.GetQueryInt("PNodeID")==0? nodeId:Body.GetQueryInt("PNodeID"))}";
            //ReturnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));
            _isAjaxSubmit = Body.GetQueryBool("isAjaxSubmit");
            _isPreview    = Body.GetQueryBool("isPreview");

            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableName  = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            //_tableName = "model_content";
            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);
            ContentInfo contentInfo = null;

            if (_isAjaxSubmit == false)
            {
                if (contentId == 0)
                {
                    if (_nodeInfo != null && _nodeInfo.Additional.IsContentAddable == false)
                    {
                        PageUtils.RedirectToErrorPage("此栏目不能添加内容!");
                        return;
                    }

                    if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
                    {
                        if (!Body.IsAdministratorLoggin)
                        {
                            PageUtils.RedirectToLoginPage();
                            return;
                        }
                        else
                        {
                            PageUtils.RedirectToErrorPage("您无此栏目的添加内容权限!");
                            return;
                        }
                    }
                }
                else
                {
                    contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId);
                    if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentEdit))
                    {
                        if (!Body.IsAdministratorLoggin)
                        {
                            PageUtils.RedirectToLoginPage();
                            return;
                        }
                        PageUtils.RedirectToErrorPage("您无此栏目的修改内容权限!");
                        return;
                    }
                }

                if (!IsPostBack)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, _nodeInfo.NodeId);
                    var pageTitle = (contentId == 0) ?
                                    $"添加{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}"
                        : $"编辑{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}";
                    BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, pageTitle, nodeNames, string.Empty);

                    LtlPageTitle.Text  = pageTitle;
                    LtlPageTitle.Text += $@"
<script language=""javascript"" type=""text/javascript"">
var previewUrl = '{PagePreview.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentId, 0, 0)}';
</script>
";

                    if (PublishmentSystemInfo.Additional.IsAutoSaveContent && PublishmentSystemInfo.Additional.AutoSaveContentInterval > 0)
                    {
                        LtlPageTitle.Text += $@"
<input type=""hidden"" id=""savedContentID"" name=""savedContentID"" value=""{contentId}"">
<script language=""javascript"" type=""text/javascript"">setInterval(""autoSave()"",{PublishmentSystemInfo.Additional.AutoSaveContentInterval*1000});</script>
";
                    }
                    //专题
                    if (contentId == 0)
                    {
                        var specialParentId = DataProvider.NodeDao.GetSpecialParentId();
                        NodeIdDic = new Dictionary <NodeInfo, List <NodeInfo> >();
                        if (nodeId != 0 && nodeId == specialParentId)
                        {
                            PhSpecial.Visible  = true;
                            PhCategory.Visible = true;
                            var             specialNodeIdList = DataProvider.NodeDao.GetNodeInfoListByParentId(1, specialParentId);
                            List <NodeInfo> secondLevel       = new List <NodeInfo>();
                            foreach (var nodeInfo in specialNodeIdList)
                            {
                                var secondChild = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeInfo.NodeId);
                                if (secondChild != null && secondChild.Count > 0)
                                {
                                    NodeIdDic.Add(nodeInfo, secondChild);
                                }
                            }
                            if (NodeIdDic != null && NodeIdDic.Count > 0)
                            {
                                KeyValuePair <NodeInfo, List <NodeInfo> > kv = NodeIdDic.First();
                                var defaultItem = new ListItem(kv.Key.NodeName, kv.Key.NodeId.ToString());
                                defaultItem.Selected = true;
                                TbSpecial.Items.Add(defaultItem);
                                foreach (var info in kv.Value)
                                {
                                    TbCategory.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString()));
                                }
                                foreach (var info in specialNodeIdList)
                                {
                                    if (info.NodeId != kv.Key.NodeId)
                                    {
                                        TbSpecial.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString()));
                                    }
                                }
                            }
                        }
                        else
                        {
                            //信息类型
                            var childSpecial = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeId);
                            if (childSpecial != null && childSpecial.Count > 0)
                            {
                                PhCategory.Visible = true;
                                foreach (var nodeInfo in childSpecial)
                                {
                                    var item = new ListItem(nodeInfo.NodeName, nodeInfo.NodeId.ToString());
                                    TbCategory.Items.Add(item);
                                }
                            }
                        }
                    }
                    else
                    {
                        PhSpecial.Visible  = false;
                        PhCategory.Visible = true;
                        TbCategory.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString()));
                        //if (_nodeInfo.ParentsCount == 1)
                        //{
                        //    PhSpecial.Visible = false;
                        //    PhCategory.Visible = true;
                        //    TbSpecial.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString()));
                        //}else if(_nodeInfo.ParentsCount == 1)
                    }


                    //转移
                    if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
                    {
                        PhTranslate.Visible = PublishmentSystemInfo.Additional.IsTranslate;
                        DivTranslateAdd.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(PublishmentSystemId, true));

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

                    //内容属性
                    var excludeAttributeNames = TableManager.GetExcludeAttributeNames(_tableStyle);
                    AcAttributes.AddExcludeAttributeNames(excludeAttributeNames);

                    if (excludeAttributeNames.Count == 0)
                    {
                        PhContentAttributes.Visible = false;
                    }
                    else
                    {
                        PhContentAttributes.Visible = true;
                        foreach (var attributeName in excludeAttributeNames)
                        {
                            var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, attributeName, _relatedIdentities);
                            if (styleInfo.IsVisible)
                            {
                                var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                                if (contentId > 0)
                                {
                                    listItem.Selected = TranslateUtils.ToBool(contentInfo?.GetExtendedAttribute(styleInfo.AttributeName));
                                }
                                else
                                {
                                    if (TranslateUtils.ToBool(styleInfo.DefaultValue))
                                    {
                                        listItem.Selected = true;
                                    }
                                }
                                CblContentAttributes.Items.Add(listItem);
                            }
                        }
                    }

                    //内容组
                    var contentGroupNameList = DataProvider.ContentGroupDao.GetContentGroupNameList(PublishmentSystemId);

                    if (!PublishmentSystemInfo.Additional.IsGroupContent || contentGroupNameList.Count == 0)
                    {
                        PhContentGroup.Visible = false;
                    }
                    else
                    {
                        foreach (var groupName in contentGroupNameList)
                        {
                            var item = new ListItem(groupName, groupName);
                            if (contentId > 0)
                            {
                                item.Selected = StringUtils.In(contentInfo?.ContentGroupNameCollection, groupName);
                            }
                            CblContentGroupNameCollection.Items.Add(item);
                        }
                    }

                    //标签
                    if (!PublishmentSystemInfo.Additional.IsRelatedByTags)
                    {
                        PhTags.Visible = false;
                    }
                    else
                    {
                        var tagScript = @"
<script type=""text/javascript"">
function getTags(tag){
	$.get('[url]&tag=' + encodeURIComponent(tag) + '&r=' + Math.random(), function(data) {
		if(data !=''){
			var arr = data.split('|');
			var temp='';
			for(i=0;i<arr.length;i++)
			{
				temp += '<li><a>'+arr[i].replace(tag,'<b>' + tag + '</b>') + '</a></li>';
			}
			var myli='<ul>'+temp+'</ul>';
			$('#tagTips').html(myli);
			$('#tagTips').show();
		}else{
            $('#tagTips').hide();
        }
		$('#tagTips li').click(function () {
			var tag = $('#TbTags').val();
			var i = tag.lastIndexOf(' ');
			if (i > 0)
			{
				tag = tag.substring(0, i) + ' ' + $(this).text();
			}else{
				tag = $(this).text();	
			}
			$('#TbTags').val(tag);
			$('#tagTips').hide();
		})
	});	
}
$(document).ready(function () {
$('#TbTags').keyup(function (e) {
    if (e.keyCode != 40 && e.keyCode != 38) {
        var tag = $('#TbTags').val();
		var i = tag.lastIndexOf(' ');
		if (i > 0){ tag = tag.substring(i + 1);}
        if (tag != '' && tag != ' '){
            window.setTimeout(""getTags('"" + tag + ""');"", 200);
        }else{
            $('#tagTips').hide();
        }
    }
}).blur(function () {
	window.setTimeout(""$('#tagTips').hide();"", 200);
})});
</script>
<div id=""tagTips"" class=""inputTips""></div>
";
                        LtlTags.Text = tagScript.Replace("[url]", AjaxCmsService.GetTagsUrl(PublishmentSystemId));
                    }

                    if (contentId == 0)
                    {
                        var formCollection = new NameValueCollection();
                        if (Body.IsQueryExists("isUploadWord"))
                        {
                            var isFirstLineTitle  = Body.GetQueryBool("isFirstLineTitle");
                            var isFirstLineRemove = Body.GetQueryBool("isFirstLineRemove");
                            var isClearFormat     = Body.GetQueryBool("isClearFormat");
                            var isFirstLineIndent = Body.GetQueryBool("isFirstLineIndent");
                            var isClearFontSize   = Body.GetQueryBool("isClearFontSize");
                            var isClearFontFamily = Body.GetQueryBool("isClearFontFamily");
                            var isClearImages     = Body.GetQueryBool("isClearImages");
                            var contentLevel      = Body.GetQueryInt("contentLevel");
                            var fileName          = Body.GetQueryString("fileName");

                            formCollection = WordUtils.GetWordNameValueCollection(PublishmentSystemId, _nodeInfo.ContentModelId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, contentLevel, fileName);
                        }

                        AcAttributes.SetParameters(formCollection, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, false, IsPostBack);
                    }
                    else
                    {
                        AcAttributes.SetParameters(contentInfo?.Attributes, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, true, IsPostBack);
                        TbTags.Text = contentInfo?.Tags;
                    }

                    if (HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                    {
                        PhStatus.Visible = true;
                        int checkedLevel;
                        var isChecked = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo.NodeId, out checkedLevel);
                        if (Body.IsQueryExists("contentLevel"))
                        {
                            checkedLevel = TranslateUtils.ToIntWithNagetive(Body.GetQueryString("contentLevel"));
                            if (checkedLevel != LevelManager.LevelInt.NotChange)
                            {
                                isChecked = checkedLevel >= PublishmentSystemInfo.CheckContentLevel;
                            }
                        }

                        LevelManager.LoadContentLevelToEdit(RblContentLevel, PublishmentSystemInfo, nodeId, contentInfo, isChecked, checkedLevel);
                    }
                    else
                    {
                        PhStatus.Visible = false;
                    }

                    BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()"));
                    //自动检测敏感词
                    ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(PublishmentSystemInfo));
                }
                else
                {
                    AcAttributes.SetParameters(Request.Form, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities,
                                               _tableStyle, _tableName, contentId != 0, IsPostBack);
                }
                DataBind();
            }
            else
            {
                var    success = false;
                string errorMessage;
                var    savedContentId = SaveContentInfo(true, _isPreview, out errorMessage);
                if (savedContentId > 0)
                {
                    success = true;
                }

                string jsonString = $@"{{success:'{success.ToString().ToLower()}',savedContentID:'{savedContentId}'}}";

                PageUtils.ResponseToJson(jsonString);
            }
        }
예제 #26
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());
        }