forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeTree.cs
More file actions
52 lines (47 loc) · 2.05 KB
/
NodeTree.cs
File metadata and controls
52 lines (47 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Text;
using System.Web.UI;
using BaiRong.Core;
using SiteServer.BackgroundPages.Core;
using SiteServer.CMS.Core;
using SiteServer.CMS.Core.Security;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Enumerations;
namespace SiteServer.BackgroundPages.Controls
{
public class NodeTree : Control
{
private PublishmentSystemInfo _publishmentSystemInfo;
protected override void Render(HtmlTextWriter writer)
{
var builder = new StringBuilder();
var body = new RequestBody();
var publishmentSystemId = int.Parse(Page.Request.QueryString["PublishmentSystemID"]);
_publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
var scripts = ChannelLoading.GetScript(_publishmentSystemInfo, ELoadingType.ContentTree, null);
builder.Append(scripts);
if (Page.Request.QueryString["PublishmentSystemID"] != null)
{
try
{
var nodeIdList = DataProvider.NodeDao.GetNodeIdListByParentId(_publishmentSystemInfo.PublishmentSystemId, 0);
foreach (var nodeId in nodeIdList)
{
var nodeInfo = NodeManager.GetNodeInfo(_publishmentSystemInfo.PublishmentSystemId, nodeId);
var enabled = AdminUtility.IsOwningNodeId(body.AdministratorName, nodeInfo.NodeId);
if (!enabled)
{
if (!AdminUtility.IsHasChildOwningNodeId(body.AdministratorName, nodeInfo.NodeId)) continue;
}
builder.Append(ChannelLoading.GetChannelRowHtml(_publishmentSystemInfo, nodeInfo, enabled, ELoadingType.ContentTree, null, body.AdministratorName));
}
}
catch (Exception ex)
{
PageUtils.RedirectToErrorPage(ex.Message);
}
}
writer.Write(builder);
}
}
}