summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Admin/Index.cshtml
blob: 942838ea7b2f9b6ad3d88bd432d325d1381eb9a8 (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
@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-tabs" 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>
                <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 href="@Url.Action("UserDetails", "Moderator", new {id=user.DisplayName})" class="btn btn-warning"><span class="glyphicon glyphicon-wrench"></span> Moderate</a>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                </div>
           </div>
        </div>
    </div>
</div>