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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
@using Microsoft.AspNet.Identity
@model Project_Unite.Models.ForumTopic
@{
string acl_perm_announce = "CanAnnounceTopics";
string acl_perm_unlist = "CanUnlistTopics";
string acl_perm_sticky = "CanStickyTopics";
string acl_perm_global = "CanGlobalTopics";
string acl_perm_unlock = "CanUnlockTopics";
string acl_perm_lock = "CanLockTopics";
string like_link = Url.Action("Like", "Forum", new { id = Model.Discriminator });
string dislike_link = Url.Action("Dislike", "Forum", new { id = Model.Discriminator });
if (User.Identity.GetUserId() == Model.AuthorId)
{
acl_perm_announce = "CanAnnounceOwnTopics";
acl_perm_unlist = "CanUnlistOwnTopics";
acl_perm_sticky = "CanStickyOwnTopics";
acl_perm_global = "CanGlobalOwnTopics";
acl_perm_unlock = "CanUnlockOwnTopics";
acl_perm_lock = "CanLockOwnTopics";
}
}
<ul class="nav nav-tabs">
<li><a href="@Url.Action("ViewForum", "Forum", new { id = Model.Parent })"><span class="glyphicon glyphicon-arrow-left"></span> Back</a></li>
@if (ACL.CanReply(User.Identity.Name, Model.Parent))
{
if (Model.IsLocked == false)
{
<li><a href="@Url.Action("PostReply", "Forum", new { id = Model.Discriminator, fid = Model.Parent })"><span class="glyphicon glyphicon-comment"></span> Post reply</a></li>
}
else
{
<li>
<a data-toggle="modal" data-target="#m_locked" href="#"><span class="glyphicon glyphicon-lock"></span> Locked</a>
<div class="modal fade in" id="m_locked">
<div class="modal-content">
<div class="modal-header">
<a class="close" data-dismiss="modal"></a>
<h2>Locked</h2>
</div>
<div class="modal-body">
<p>This topic is locked, you may not reply to it.</p>
@{
string perm = "CanUnlockTopics";
if (User.Identity.GetUserId() == Model.AuthorId)
{
perm = "CanUnlockOwnTopics";
}
if (ACL.Granted(User.Identity.Name, perm))
{
<p>If you would like to unlock this topic and allow replies, click the 'Moderation Tools' -> 'Unlock Topic' menu item at the top or bottom of the page.</p>
}
}
</div>
</div>
</div>
</li>
}
}
@if (ACL.Granted(User.Identity.Name, "CanAccessModCP"))
{
<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">Moderator tools <span class="caret"></span></a>
<ul class="dropdown-menu" id="mtools">
<li class="dropdown-header">Topic status</li>
@if (ACL.Granted(User.Identity.Name, acl_perm_sticky))
{
<li>@Html.ActionLink("Make sticky", "StickyTopic", "Moderator", new { id = Model.Discriminator }, null)</li>
}
@if (ACL.Granted(User.Identity.Name, acl_perm_announce))
{
<li>@Html.ActionLink("Announce", "AnnounceTopic", "Moderator", new { id = Model.Discriminator }, null)</li>
}
@if (ACL.Granted(User.Identity.Name, acl_perm_global))
{
<li>@Html.ActionLink("Make global", "GlobalTopic", "Moderator", new { id = Model.Discriminator }, null)</li>
}
<li class="dropdown-header">Posting</li>
@if (Model.IsLocked == true)
{
if (ACL.Granted(User.Identity.Name, acl_perm_unlock))
{
<li>
@Html.ActionLink("Unlock topic", "Unlock", "Moderator", new { id = Model.Discriminator }, null)
</li>
}
}
else
{
if (ACL.Granted(User.Identity.Name, acl_perm_lock))
{
<li>
@Html.ActionLink("Lock topic", "Lock", "Moderator", new { id = Model.Discriminator }, null)
</li>
}
}
@if (Model.IsUnlisted == true)
{
if (ACL.Granted(User.Identity.Name, acl_perm_unlist))
{
<li>
@Html.ActionLink("Publish topic", "List", "Moderator", new { id = Model.Discriminator }, null)
</li>
}
}
else
{
if (ACL.Granted(User.Identity.Name, acl_perm_unlist))
{
<li>
@Html.ActionLink("Unlist topic", "Unlist", "Moderator", new { id = Model.Discriminator }, null)
</li>
}
}
</ul>
</li>
}
<li><a href="@like_link"><span class="glyphicon glyphicon-thumbs-up"></span> @Model.Likes.Length</a></li>
<li><a href="@dislike_link"><span class="glyphicon glyphicon-thumbs-down"></span> @Model.Dislikes.Length</a></li>
</ul>
<hr/>
|