summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Admin/Index.cshtml
blob: 4839e31ac4779e02ff0fceddbb93a5c35960dd76 (plain) (blame)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
@using Project_Unite.Models;
@using Microsoft.AspNet.Identity;
@using Project_Unite.Controllers;

@{
    ViewBag.Title = "Administration Control Panel";
    var db = new ApplicationDbContext();
}

<div class="panel row">
    <div class="panel-body">
        <div class="col-xs-4">
            <h4>Navigation</h4>

            <ul class="nav nav-stacked nav-pills" id="tabs" data-tabs="tabs" role="tablist">
                <li class="active"><a data-toggle="tab" href="#a_index">Home</a></li>
                <li><a data-toggle="tab" href="#a_site_config">Site Config</a></li>
                <li><a data-toggle="tab" href="#a_users">Users</a></li>
                <li><a data-toggle="tab" href="#a_roles">Roles</a></li>
                <li><a data-toggle="tab" href="#a_forums">Forums</a></li>
                <li><a data-toggle="tab" href="#a_skins">Skins</a></li>
                <li><a data-toggle="tab" href="#a_groups">Groups</a></li>
                <li><a data-toggle="tab" href="#a_backups">Backups</a></li>
                <li><a data-toggle="tab" href="#a_logs">Audit Logs</a></li>



            </ul>
        </div>
        <div class="col-xs-8">
            <div class="tab-content">
                <div class="tab-pane fade in active" id="a_index">
                    <h2>Administration Control Panel</h2>
                
                    <p>Welcome to the ShiftOS Administration Control Panel. To begin administrating, select an option from the left.</p>

                    <h4>System status</h4>

                    <table class="table-condensed">
                        <tr>
                            <td><strong>Current user: </strong></td>
                            <td>@Html.UserLink(User.Identity.GetUserId())</td>
                        </tr>
                        <tr>
                            <td><strong>Users:</strong></td>
                            <td>@db.Users.Count()</td>
                        </tr>
                        <tr>
                            <td><strong>Forum Categories:</strong></td>
                            <td>@db.ForumCategories.Count()</td>
                        </tr>
                        <tr>
                            <td><strong>Posts:</strong></td>
                            <td>@db.ForumPosts.Count()</td>
                        </tr>
                        <tr>
                            <td><strong>Topics:</strong></td>
                            <td><strong>@db.ForumTopics.Count()</strong></td>
                        </tr>
                        <tr>
                            <td><strong>Skins:</strong></td>
                            <td>@db.Skins.Count()</td>
                        </tr>
                        <tr>
                            <td><strong>Releases:</strong></td>
                            <td>@db.Downloads.Count()</td>
                        </tr>
                    </table>

                    <hr/>

                    <h4>Shifting the website</h4>

                    <p>You can add new features to the website by modifying our GitHub repository. If you are a ShiftOS developer, chances are you have write access to the repository. If not, please contact Michael.</p>

                    <p>To clone the repository, use this command:</p>

                    @Html.Markdown(@"```bash
git clone https://github.com/MichaelTheShifter/Project-Unite
```")

                    <p>Your changes will be applied after you push your commits to this repository, or your pull request gets merged.</p>
                </div>
                <div class="tab-pane fade in" id="a_site_config">
                    <h2>Site Configuration</h2>

                    <p>This feature is not yet implemented.</p>
               </div>

                @*ROLES*@
                <div class="tab-pane fade in" id="a_roles">
                    <h2>Roles</h2>

                    <p>Here, you can see a list of all the roles in the system.</p>

                    <ul class="pagination" data-tabs="roletabs" id="roletabs">
                        @for (int i = 0; i < db.Roles.GetPageCount(10); i++)
                        {
                            string htmlClass = "";
                            if (i == 0)
                            {
                                htmlClass = "active";
                            }
                            int page = i + 1;
                            <li class="@htmlClass"><a data-toggle="tab" href="#r_page_@i">@page</a></li>
                        }
                    </ul>
                    <div class="tab-content">
                        @for (int i = 0; i < db.Roles.GetPageCount(10); i++)
                        {
                            string htmlClass = "tab-pane fade in";
                            if (i == 0)
                            {
                                htmlClass += " active";
                            }
                            <div class="@htmlClass" id="r_page_@i">
                                <table class="table">
                                    <tr>
                                        <th style="width:45%">Role</th>
                                        <th>Priority</th>
                                        <th>Actions</th>
                                    </tr>
                                    @{ 
                                        var roles = db.Roles.ToArray();
                                        roles = roles.OrderByDescending(x => (x as Role).Priority).ToArray();
                                    }
                                    @foreach (Role role in roles.GetItemsOnPage(i, 10))
                                    {
                                        <tr>
                                            <td>
                                                <p class="color: @role.ColorHex">@role.Name</p>
                                                <p>ID: @role.Id &bull;Users: @role.Users.Count() &bull; Priority: @role.Priority</p>
                                            </td>
                                            <td>
                                                @if(role.Priority > 0)
                                                {
                                                    <a href="@Url.Action("DecreaseRolePriority", "Admin", new {id=role.Id})" class="btn btn-default"><span class="glyphicon glyphicon-arrow-down"></span></a>
                                                }
                                                @if (role.Priority < roles.Length - 1)
                                                {
                                                    <a href="@Url.Action("IncreaseRolePriority", "Admin", new {id=role.Id})" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></a>
                                                }
                                            </td>
                                            <td>
                                                <a href="@Url.Action("RoleDetails", "Admin", new {id=role.Id})" class="btn btn-default"><span class="glyphicon glyphicon-dashboard"></span> Details</a>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                </div>


                @*SKINS*@
                <div class="tab-pane fade in" id="a_skins">
                    <h2>Skins</h2>

                    <p>Below is a list of all skins in the system.</p>

                    <ul class="pagination" data-tabs="skintabs" id="skintabs">
                        @for (int i = 0; i < db.Skins.GetPageCount(10); i++)
                        {
                            string htmlClass = "";
                            if (i == 0)
                            {
                                htmlClass = "active";
                            }
                            int page = i + 1;
                            <li class="@htmlClass"><a data-toggle="tab" href="#skn_page_@i">@page</a></li>
                        }
                    </ul>
                    <div class="tab-content">
                        @for (int i = 0; i < db.Skins.GetPageCount(10); i++)
                        {
                            string htmlClass = "tab-pane fade in";
                            if (i == 0)
                            {
                                htmlClass += " active";
                            }
                            <div class="@htmlClass" id="skn_page_@i">
                                <table class="table">
                                    <tr>
                                        <th style="width:65%">Skin</th>
                                        <th>Actions</th>
                                    </tr>
                                    @foreach (var skin in db.Skins.OrderByDescending(x => x.PostedAt).ToArray().GetItemsOnPage(i, 10))
                                    {
                                        <tr>
                                            <td>
                                                @Html.ActionLink(skin.Name, "ViewSkin", "Skins", new { id = skin.Id }, null) <br />
                                                <p>Created at: @skin.PostedAt &bull; Likes: @skin.Likes.Count() &bull; Dislikes: @skin.Dislikes.Count() &bull; Views: @skin.Views.Count()</p>
                                                <p>@Html.Markdown(skin.ShortDescription)</p>
                                            </td>
                                            <td>
                                                <a href="@Url.Action("ModerateSkin", "Moderator", new {id=skin.Id})" class="btn btn-warning"><span class="glyphicon glyphicon-wrench">Moderate</span></a>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                </div>




                @foreach (var user in db.Users.ToArray())
                {
                    <div class="modal fade" id="[email protected]">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title">Users</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                </div>
                                <div class="modal-body">
                                    @Html.Partial("~/Views/Moderator/UserDetails.cshtml", user)
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" data-target="#[email protected]">Close</button>
                                </div>
                            </div>
                        </div>
                    </div>
                }


                @*USERS*@
                <div class="tab-pane fade in" id="a_users">
                    <h2>Users</h2>

                    <p>Below is a paginated list of all users in the database, most recent users first.</p>

                    <ul class="pagination" data-tabs="usertabs" id="usertabs" >
                        @for (int i = 0; i < db.Users.GetPageCount(10); i++)
                        {
                            string htmlClass = "";
                            if(i == 0)
                            {
                                htmlClass = "active";
                            }
                            int page = i + 1;
                            <li class="@htmlClass"><a data-toggle="tab" href="#u_page_@i">@page</a></li>
                        }
                        </ul>
                    <div class="tab-content">
                        @for(int i= 0; i < db.Users.GetPageCount(10); i++)
                        {
                            string htmlClass = "tab-pane fade in";
                            if(i==0)
                            {
                                htmlClass += " active";
                            }
                            <div class="@htmlClass" id="u_page_@i">
                                <table class="table">
                                    <tr>
                                        <th style="width:65%">User</th>
                                        <th>Actions</th>
                                    </tr>
                                    @foreach (var user in db.Users.OrderByDescending(x=>x.JoinedAt).ToArray().GetItemsOnPage(i, 10))
                                    {
                                        <tr>
                                            <td>
                                                @Html.UserLink(user.Id) <br/>
                                                <p>Joined on: @user.JoinedAt &bull; Banned: @user.IsBanned &bull; Posts: @user.PostCount &bull; Topics: @user.TopicCount</p>
                                            </td>
                                            <td>
                                                <a href="@Url.Action("ViewProfile", "Profiles", new { id = user.DisplayName })" class="btn btn-default"><span class="glyphicon glyphicon-user"></span> View Profile</a>
                                                <a data-toggle="modal" href="#[email protected]" class="btn btn-warning"><span class="glyphicon glyphicon-wrench"></span> Moderate</a>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                </div>
           </div>
        </div>
    </div>
</div>