diff options
Diffstat (limited to 'Project-Unite/Views')
54 files changed, 2995 insertions, 0 deletions
diff --git a/Project-Unite/Views/Account/ConfirmEmail.cshtml b/Project-Unite/Views/Account/ConfirmEmail.cshtml new file mode 100644 index 0000000..ed02ad8 --- /dev/null +++ b/Project-Unite/Views/Account/ConfirmEmail.cshtml @@ -0,0 +1,10 @@ +@{ + ViewBag.Title = "Confirm Email"; +} + +<h2>@ViewBag.Title.</h2> +<div> + <p> + Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) + </p> +</div> diff --git a/Project-Unite/Views/Account/ExternalLoginConfirmation.cshtml b/Project-Unite/Views/Account/ExternalLoginConfirmation.cshtml new file mode 100644 index 0000000..bcc491c --- /dev/null +++ b/Project-Unite/Views/Account/ExternalLoginConfirmation.cshtml @@ -0,0 +1,36 @@ +@model Project_Unite.Models.ExternalLoginConfirmationViewModel +@{ + ViewBag.Title = "Register"; +} +<h2>@ViewBag.Title.</h2> +<h3>Associate your @ViewBag.LoginProvider account.</h3> + +@using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + + <h4>Association Form</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + <p class="text-info"> + You've successfully authenticated with <strong>@ViewBag.LoginProvider</strong>. + Please enter a user name for this site below and click the Register button to finish + logging in. + </p> + <div class="form-group"> + @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Register" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/ExternalLoginFailure.cshtml b/Project-Unite/Views/Account/ExternalLoginFailure.cshtml new file mode 100644 index 0000000..3be4ab3 --- /dev/null +++ b/Project-Unite/Views/Account/ExternalLoginFailure.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = "Login Failure"; +} + +<hgroup> + <h2>@ViewBag.Title.</h2> + <h3 class="text-danger">Unsuccessful login with service.</h3> +</hgroup> diff --git a/Project-Unite/Views/Account/ForgotPassword.cshtml b/Project-Unite/Views/Account/ForgotPassword.cshtml new file mode 100644 index 0000000..1bb2611 --- /dev/null +++ b/Project-Unite/Views/Account/ForgotPassword.cshtml @@ -0,0 +1,29 @@ +@model Project_Unite.Models.ForgotPasswordViewModel +@{ + ViewBag.Title = "Forgot your password?"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + <h4>Enter your email.</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Email Link" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/ForgotPasswordConfirmation.cshtml b/Project-Unite/Views/Account/ForgotPasswordConfirmation.cshtml new file mode 100644 index 0000000..dd7af8c --- /dev/null +++ b/Project-Unite/Views/Account/ForgotPasswordConfirmation.cshtml @@ -0,0 +1,13 @@ +@{ + ViewBag.Title = "Forgot Password Confirmation"; +} + +<hgroup class="title"> + <h1>@ViewBag.Title.</h1> +</hgroup> +<div> + <p> + Please check your email to reset your password. + </p> +</div> + diff --git a/Project-Unite/Views/Account/Login.cshtml b/Project-Unite/Views/Account/Login.cshtml new file mode 100644 index 0000000..1244c62 --- /dev/null +++ b/Project-Unite/Views/Account/Login.cshtml @@ -0,0 +1,62 @@ +@using Project_Unite.Models +@model LoginViewModel +@{ + ViewBag.Title = "Log in"; +} + +<h2>@ViewBag.Title.</h2> +<div class="row"> + <div class="col-md-8"> + <section id="loginForm"> + @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) + { + @Html.AntiForgeryToken() + <h4>Use a local account to log in.</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) + @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <div class="checkbox"> + @Html.CheckBoxFor(m => m.RememberMe) + @Html.LabelFor(m => m.RememberMe) + </div> + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Log in" class="btn btn-default" /> + </div> + </div> + <p> + @Html.ActionLink("Register as a new user", "Register") + </p> + <p> + @Html.ActionLink("Forgot your password?", "ForgotPassword") + </p> + } + </section> + </div> + <div class="col-md-4"> + <section id="socialLoginForm"> + @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { ReturnUrl = ViewBag.ReturnUrl }) + </section> + </div> +</div> + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +}
\ No newline at end of file diff --git a/Project-Unite/Views/Account/Register.cshtml b/Project-Unite/Views/Account/Register.cshtml new file mode 100644 index 0000000..a1d1225 --- /dev/null +++ b/Project-Unite/Views/Account/Register.cshtml @@ -0,0 +1,47 @@ +@model Project_Unite.Models.RegisterViewModel +@{ + ViewBag.Title = "Register"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + <h4>Create a new account.</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.Username, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Username, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Register" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/ResendConf.cshtml b/Project-Unite/Views/Account/ResendConf.cshtml new file mode 100644 index 0000000..beb8c6f --- /dev/null +++ b/Project-Unite/Views/Account/ResendConf.cshtml @@ -0,0 +1,23 @@ + +@{ + ViewBag.Title = "Confirmation email resent."; +} +@if (ViewBag.IsConfirmed == true) +{ + <h2>Email already confirmed!</h2> + + <p>We've already confirmed that your email is valid! There's no need to send a confirmation link! But, if that warning is still nagging you, there might be a bug on our end - contact @ACL.UserNameFromEmailRaw("[email protected]") ASAP!</p> +} +else +{ +<h2>Confirmation email resent.</h2> + +<p>We have just sent an email to @User.Identity.Name</p> + +<h4>We value your security.</h4> + +<p>Security within the multi-user domain is paramount. You must protect yourself the best you can, and so must we. Since you are in the process of confirming your email address, we can soon ensure you are secure within the multi-user domain by allowing us to contact you when suspicious activity occurs on your account or when you need to reset your password.</p> + +<p>Still not there? @Html.ActionLink("Resend it again, please.", "ResendConf")</p> + +}
\ No newline at end of file diff --git a/Project-Unite/Views/Account/ResetPassword.cshtml b/Project-Unite/Views/Account/ResetPassword.cshtml new file mode 100644 index 0000000..de239b8 --- /dev/null +++ b/Project-Unite/Views/Account/ResetPassword.cshtml @@ -0,0 +1,42 @@ +@model Project_Unite.Models.ResetPasswordViewModel +@{ + ViewBag.Title = "Reset password"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + <h4>Reset your password.</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + @Html.HiddenFor(model => model.Code) + <div class="form-group"> + @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Reset" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/ResetPasswordConfirmation.cshtml b/Project-Unite/Views/Account/ResetPasswordConfirmation.cshtml new file mode 100644 index 0000000..3804516 --- /dev/null +++ b/Project-Unite/Views/Account/ResetPasswordConfirmation.cshtml @@ -0,0 +1,12 @@ +@{ + ViewBag.Title = "Reset password confirmation"; +} + +<hgroup class="title"> + <h1>@ViewBag.Title.</h1> +</hgroup> +<div> + <p> + Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) + </p> +</div> diff --git a/Project-Unite/Views/Account/SendCode.cshtml b/Project-Unite/Views/Account/SendCode.cshtml new file mode 100644 index 0000000..a11a3a6 --- /dev/null +++ b/Project-Unite/Views/Account/SendCode.cshtml @@ -0,0 +1,24 @@ +@model Project_Unite.Models.SendCodeViewModel +@{ + ViewBag.Title = "Send"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { + @Html.AntiForgeryToken() + @Html.Hidden("rememberMe", @Model.RememberMe) + <h4>Send verification code</h4> + <hr /> + <div class="row"> + <div class="col-md-8"> + Select Two-Factor Authentication Provider: + @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers) + <input type="submit" value="Submit" class="btn btn-default" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/VerifyCode.cshtml b/Project-Unite/Views/Account/VerifyCode.cshtml new file mode 100644 index 0000000..0f47757 --- /dev/null +++ b/Project-Unite/Views/Account/VerifyCode.cshtml @@ -0,0 +1,38 @@ +@model Project_Unite.Models.VerifyCodeViewModel +@{ + ViewBag.Title = "Verify"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { + @Html.AntiForgeryToken() + @Html.Hidden("provider", @Model.Provider) + @Html.Hidden("rememberMe", @Model.RememberMe) + <h4>Enter verification code</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <div class="checkbox"> + @Html.CheckBoxFor(m => m.RememberBrowser) + @Html.LabelFor(m => m.RememberBrowser) + </div> + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Submit" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Account/_ExternalLoginsListPartial.cshtml b/Project-Unite/Views/Account/_ExternalLoginsListPartial.cshtml new file mode 100644 index 0000000..8b85588 --- /dev/null +++ b/Project-Unite/Views/Account/_ExternalLoginsListPartial.cshtml @@ -0,0 +1,28 @@ +@model Project_Unite.Models.ExternalLoginListViewModel +@using Microsoft.Owin.Security + +<h4>Use another service to log in.</h4> +<hr /> +@{ + var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); + if (loginProviders.Count() == 0) { + <div> + <p> + There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=403804">this article</a> + for details on setting up this ASP.NET application to support logging in via external services. + </p> + </div> + } + else { + using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) { + @Html.AntiForgeryToken() + <div id="socialLoginList"> + <p> + @foreach (AuthenticationDescription p in loginProviders) { + <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button> + } + </p> + </div> + } + } +} diff --git a/Project-Unite/Views/Admin/AccessControl.cshtml b/Project-Unite/Views/Admin/AccessControl.cshtml new file mode 100644 index 0000000..8d51d54 --- /dev/null +++ b/Project-Unite/Views/Admin/AccessControl.cshtml @@ -0,0 +1,59 @@ +@model Project_Unite.Models.AdminAccessControlViewModel + + +@{ + ViewBag.Title = "Access control"; + + Dictionary<string, string> EnumNames = new Dictionary<string, string> { + { "None", "No permissions" }, + { "CanRead", "Read only" }, + { "CanPost", "Can post new topics" }, + {"CanReply", "Can reply" } + }; + + var availablePermissions = new List<SelectListItem>(); + foreach (var v in Enum.GetValues(typeof(Project_Unite.Models.PermissionPreset))) + { + availablePermissions.Add(new SelectListItem + { + Value = v.ToString(), + Text = EnumNames[v.ToString()] + }); + } + +} + +<h2>Access control</h2> + +<p>Below, you can modify the access control list (ACL) definitions for all forum categories.</p> + + @foreach (var key in Model.IDs) + { + <h4>@key</h4> + <table class="table"> + <tr> + <th>Role ID</th> + <th>Value</th> + </tr> + @foreach (var p in Model.ACLList.Where(x => x.CategoryId == key)) + { + <tr> + <td>@Html.DisplayFor(v => p.RoleId)</td> + <td> + @foreach(var r in EnumNames) + { + if(r.Key == p.Permissions.ToString()) + { + <a href="#" class="btn btn-primary">@r.Value</a> + } + else + { + @Html.ActionLink(r.Value, "SetPermission", "Admin", new { id=p.CategoryId, role=p.RoleId, permission=r.Key}, new { @class = "btn btn-default" }) + } + } + </td> + </tr> + } + </table> + + }
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/AddForumCategory.cshtml b/Project-Unite/Views/Admin/AddForumCategory.cshtml new file mode 100644 index 0000000..4b3e9fd --- /dev/null +++ b/Project-Unite/Views/Admin/AddForumCategory.cshtml @@ -0,0 +1,48 @@ +@model Project_Unite.Models.AddForumCategoryViewModel +@{ + ViewBag.Title = "Add forum category"; +} + +<h2>Add forum category</h2> + +<p>This page allows you to add a new forum category to ShiftOS and define a set of ACL rules for this category.</p> + +<div class="panel panel-danger"> + @if(ViewBag.Error != null) + { + <p><span class="glyphicon glyphicon-warning-sign"></span> @ViewBag.Error</p> + } +</div> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.PossibleParents) + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Name)</td> + <td>@Html.TextBoxFor(Model => Model.Name)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Description)</td> + <td>@Html.TextBoxFor(Model => Model.Description)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Parent)</td> + <td>@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)</td> + </tr> + </table> + + <h4>ACL rule definitions</h4> + <p>ACL rules for this forum can be edited in the Access Control section. Additionally, you can select an existing forum to copy ACL data from.</p> + + <p><strong>Copy ACL data from: </strong>@Html.DropDownListFor(Model=>Model.StealPermissionsFrom, Model.PossibleParents)</p> + <p>Leave this value as "Top Level" to not copy permissions. Default permission values are 'Can Post' for all roles.</p> + <h4>Adding new roles</h4> + <p>When you add a new role to the site, the ACL system will automatically add it to this forum, however its permission data will be set to the default "Can Post" value.</p> + <hr/> + + + <input type="submit" value="Add" class="btn btn-primary" /> + @Html.ActionLink("Cancel", "Forums", "Admin", null, new { @class="btn btn-default"}) +}
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/AddUserToRole.cshtml b/Project-Unite/Views/Admin/AddUserToRole.cshtml new file mode 100644 index 0000000..386507c --- /dev/null +++ b/Project-Unite/Views/Admin/AddUserToRole.cshtml @@ -0,0 +1,24 @@ +@model Project_Unite.Models.AddUserToRoleViewModel + +@{ + ViewBag.Title = "Add user to role"; +} + +<h2>Add user to role</h2> + +@using (Html.BeginForm()) +{ + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(model => model.Username)</td> + <td>@Html.TextBoxFor(model => model.Username)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(model => model.RoleId)</td> + <td>@Html.TextBoxFor(model => model.RoleId)</td> + </tr> + + </table> + <input type="submit" class="btn btn-primary" value="Add" /> +} + diff --git a/Project-Unite/Views/Admin/CreateRole.cshtml b/Project-Unite/Views/Admin/CreateRole.cshtml new file mode 100644 index 0000000..736f09d --- /dev/null +++ b/Project-Unite/Views/Admin/CreateRole.cshtml @@ -0,0 +1,59 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Create"; +} + +<h2>Create</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + + <div class="form-horizontal"> + <h4>Role</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Create" class="btn btn-default" /> + </div> + </div> + </div> +} + +<div> + @Html.ActionLink("Back to List", "Index") +</div> diff --git a/Project-Unite/Views/Admin/DeleteRole.cshtml b/Project-Unite/Views/Admin/DeleteRole.cshtml new file mode 100644 index 0000000..2344d1d --- /dev/null +++ b/Project-Unite/Views/Admin/DeleteRole.cshtml @@ -0,0 +1,48 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Delete"; +} + +<h2>Delete</h2> + +<h3>Are you sure you want to delete this?</h3> +<div> + <h4>Role</h4> + <hr /> + <dl class="dl-horizontal"> + <dt> + @Html.DisplayNameFor(model => model.Name) + </dt> + + <dd> + @Html.DisplayFor(model => model.Name) + </dd> + + <dt> + @Html.DisplayNameFor(model => model.Description) + </dt> + + <dd> + @Html.DisplayFor(model => model.Description) + </dd> + + <dt> + @Html.DisplayNameFor(model => model.ColorHex) + </dt> + + <dd> + @Html.DisplayFor(model => model.ColorHex) + </dd> + + </dl> + + @using (Html.BeginForm()) { + @Html.AntiForgeryToken() + + <div class="form-actions no-color"> + <input type="submit" value="Delete" class="btn btn-default" /> | + @Html.ActionLink("Back to List", "Index") + </div> + } +</div> diff --git a/Project-Unite/Views/Admin/EditForum.cshtml b/Project-Unite/Views/Admin/EditForum.cshtml new file mode 100644 index 0000000..af22f81 --- /dev/null +++ b/Project-Unite/Views/Admin/EditForum.cshtml @@ -0,0 +1,51 @@ +@model Project_Unite.Models.AddForumCategoryViewModel +@{ + ViewBag.Title = "Edit " + Model.Name; +} + +<h2>Add forum category</h2> + +<div class="panel panel-danger"> + @if (ViewBag.Error != null) + { + <p><span class="glyphicon glyphicon-warning-sign"></span> @ViewBag.Error</p> + } +</div> + +@using (Html.BeginForm(new { id = Model.Id })) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Id) + @Html.HiddenFor(Model => Model.PossibleParents) + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Name)</td> + <td>@Html.TextBoxFor(Model => Model.Name)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Description)</td> + <td>@Html.TextBoxFor(Model => Model.Description)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Parent)</td> + <td>@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)</td> + </tr> + </table> + + <h4>ACL rule definitions</h4> + <p>Below you can specify what roles can see, reply or post to this category.</p> + <hr /> + + <table class="table-condensed"> + <tr> + <th>Role name</th> + <th>Can see?</th> + <th>Can reply?</th> + <th>Can post?</th> + </tr> + </table> + <p>ACL rules for this forum may be altered in the "Forum ACL Editor" page.</p> + + <input type="submit" value="Add" class="btn btn-primary" /> + @Html.ActionLink("Cancel", "Forums", "Admin", null, new { @class = "btn btn-default" }) +}
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/EditRole.cshtml b/Project-Unite/Views/Admin/EditRole.cshtml new file mode 100644 index 0000000..b9c1f91 --- /dev/null +++ b/Project-Unite/Views/Admin/EditRole.cshtml @@ -0,0 +1,619 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Edit role: " + Model.Id; +} + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + + <div class="form-horizontal"> + <h4>Role</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + @Html.HiddenFor(model => model.Id) + + <div class="form-group"> + @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Priority, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Priority, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Priority, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanViewProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanViewProfiles) + @Html.ValidationMessageFor(model => model.CanViewProfiles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnProfile, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnProfile) + @Html.ValidationMessageFor(model => model.CanEditOwnProfile, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditProfiles) + @Html.ValidationMessageFor(model => model.CanEditProfiles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditUsername, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditUsername) + @Html.ValidationMessageFor(model => model.CanEditUsername, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditUsernames, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditUsernames) + @Html.ValidationMessageFor(model => model.CanEditUsernames, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueBan) + @Html.ValidationMessageFor(model => model.CanIssueBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueIPBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueIPBan) + @Html.ValidationMessageFor(model => model.CanIssueIPBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueEmailBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueEmailBan) + @Html.ValidationMessageFor(model => model.CanIssueEmailBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueMute, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueMute) + @Html.ValidationMessageFor(model => model.CanIssueMute, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanReleaseBuild, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanReleaseBuild) + @Html.ValidationMessageFor(model => model.CanReleaseBuild, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanBlog, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanBlog) + @Html.ValidationMessageFor(model => model.CanBlog, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessModCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessModCP) + @Html.ValidationMessageFor(model => model.CanAccessModCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessAdminCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessAdminCP) + @Html.ValidationMessageFor(model => model.CanAccessAdminCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessDevCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessDevCP) + @Html.ValidationMessageFor(model => model.CanAccessDevCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditForumCategories, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditForumCategories) + @Html.ValidationMessageFor(model => model.CanEditForumCategories, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostTopics) + @Html.ValidationMessageFor(model => model.CanPostTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostPolls, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostPolls) + @Html.ValidationMessageFor(model => model.CanPostPolls, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostReplies, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostReplies) + @Html.ValidationMessageFor(model => model.CanPostReplies, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostStatuses) + @Html.ValidationMessageFor(model => model.CanPostStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditRoles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditRoles) + @Html.ValidationMessageFor(model => model.CanEditRoles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteRoles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteRoles) + @Html.ValidationMessageFor(model => model.CanDeleteRoles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnTopics) + @Html.ValidationMessageFor(model => model.CanDeleteOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteTopics) + @Html.ValidationMessageFor(model => model.CanDeleteTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnPosts) + @Html.ValidationMessageFor(model => model.CanDeleteOwnPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeletePosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeletePosts) + @Html.ValidationMessageFor(model => model.CanDeletePosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteOwnStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnTopics) + @Html.ValidationMessageFor(model => model.CanEditOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditTopics) + @Html.ValidationMessageFor(model => model.CanEditTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnPosts) + @Html.ValidationMessageFor(model => model.CanEditOwnPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditPosts) + @Html.ValidationMessageFor(model => model.CanEditPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnStatuses) + @Html.ValidationMessageFor(model => model.CanEditOwnStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanVoteInPolls, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanVoteInPolls) + @Html.ValidationMessageFor(model => model.CanVoteInPolls, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteUsers, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteUsers) + @Html.ValidationMessageFor(model => model.CanDeleteUsers, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnonymizeUsers, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnonymizeUsers) + @Html.ValidationMessageFor(model => model.CanAnonymizeUsers, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostSkins) + @Html.ValidationMessageFor(model => model.CanPostSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnSkins) + @Html.ValidationMessageFor(model => model.CanEditOwnSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditSkins) + @Html.ValidationMessageFor(model => model.CanEditSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnSkins) + @Html.ValidationMessageFor(model => model.CanDeleteOwnSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteSkins) + @Html.ValidationMessageFor(model => model.CanDeleteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUpvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUpvoteSkins) + @Html.ValidationMessageFor(model => model.CanUpvoteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDownvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDownvoteSkins) + @Html.ValidationMessageFor(model => model.CanDownvoteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanStickyOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanStickyOwnTopics) + @Html.ValidationMessageFor(model => model.CanStickyOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanStickyTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanStickyTopics) + @Html.ValidationMessageFor(model => model.CanStickyTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnnounceOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnnounceOwnTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnnounceTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnnounceTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanGlobalOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanGlobalOwnTopics) + @Html.ValidationMessageFor(model => model.CanGlobalOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanGlobalTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanGlobalTopics) + @Html.ValidationMessageFor(model => model.CanGlobalTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanMoveOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanMoveOwnTopics) + @Html.ValidationMessageFor(model => model.CanMoveOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanMoveTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanMoveTopics) + @Html.ValidationMessageFor(model => model.CanMoveTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlistOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlistOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlistOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlistTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlistTopics) + @Html.ValidationMessageFor(model => model.CanUnlistTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanLockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanLockOwnTopics) + @Html.ValidationMessageFor(model => model.CanLockOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlockOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlockOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanLockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanLockTopics) + @Html.ValidationMessageFor(model => model.CanLockTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlockTopics) + @Html.ValidationMessageFor(model => model.CanUnlockTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Save" class="btn btn-default" /> + </div> + </div> + </div> +} + +<div> + @Html.ActionLink("Back to List", "Index") +</div> diff --git a/Project-Unite/Views/Admin/Forums.cshtml b/Project-Unite/Views/Admin/Forums.cshtml new file mode 100644 index 0000000..904e3c5 --- /dev/null +++ b/Project-Unite/Views/Admin/Forums.cshtml @@ -0,0 +1,49 @@ +@model IEnumerable<Project_Unite.Models.ForumCategory> +@{ + ViewBag.Title = "Manage forums"; + ViewBag.Modals = new Dictionary<string, string>(); +} + +<h2>Forums</h2> + +<p>The forums are a way for users to start conversations about various topics. Here you can define where users can post and what roles can post where.</p> + +@foreach (var cat in Model) +{ + <table class="table"> + <tr> + <th>@cat.Name [@Html.ActionLink("Edit", "EditForum", "Admin", new { id = cat.Id }, null) | <a href="#[email protected]" data-toggle="modal" data-target="#[email protected]">Delete</a>] + <!-- Modal --> + + </th> + <th>Topics</th> + <th>Posts</th> + <th>Actions</th> + </tr> + @foreach (var subcat in cat.Children) + { + <tr> + <td> + @Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }) <br /> + <p>@subcat.Description</p> + </td> + <td>@subcat.Topics?.Count</td> + <td></td> + <td> + @Html.ActionLink("Edit", "EditForum", "Admin", new { id = subcat.Id }, new { @class = "btn btn-default" }) + + <!-- Trigger the modal with a button --> + <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#[email protected]">Delete</button> + + + </td> + </tr> + ViewBag.Modals.Add(subcat.Id, "/Admin/DeleteForum?id=" + subcat.Id); + } + + </table> + ViewBag.Modals.Add(cat.Id, "/Admin/DeleteForum?id=" + cat.Id); + +} + [email protected]("Add category", "AddForumCategory", "Admin", null, new { @class = "btn btn-default"}) diff --git a/Project-Unite/Views/Admin/Index.cshtml b/Project-Unite/Views/Admin/Index.cshtml new file mode 100644 index 0000000..d282f60 --- /dev/null +++ b/Project-Unite/Views/Admin/Index.cshtml @@ -0,0 +1,7 @@ + +@{ + ViewBag.Title = "Administration Control Panel"; +} + +<p>Wow, an actual index page.</p> + diff --git a/Project-Unite/Views/Admin/Logs.cshtml b/Project-Unite/Views/Admin/Logs.cshtml new file mode 100644 index 0000000..3fa066d --- /dev/null +++ b/Project-Unite/Views/Admin/Logs.cshtml @@ -0,0 +1,25 @@ +@model IEnumerable<Project_Unite.Models.AuditLog> +@{ + ViewBag.Admin = true; + ViewBag.Title = "Audit logs"; +} + +<h2>Audit logs</h2> + +<p>Below is a list of all actions carried out by all users on this site.</p> + +<table class="table"> + <tr> + <th style="width:65%">Action</th> + <th>User & Timestamp</th> + <th>Level</th> + </tr> + @foreach(var i in Model.OrderByDescending(x=>x.Timestamp)) + { + <tr> + <td>@i.Description</td> + <td>@Html.UserLink(i.UserId) at @i.Timestamp</td> + <td>@i.Level</td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/RoleDetails.cshtml b/Project-Unite/Views/Admin/RoleDetails.cshtml new file mode 100644 index 0000000..25b4146 --- /dev/null +++ b/Project-Unite/Views/Admin/RoleDetails.cshtml @@ -0,0 +1,44 @@ +@using Microsoft.AspNet.Identity + +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Details for " + Model.Name; +} + +<h2>Role details</h2> + + <h4 style="color:@Model.ColorHex">@Model.Name</h4> + <p><strong>ID: </strong>@Model.Id</p> + <p><strong>Description:</strong></p> + <p>@Model.Description</p> + <p><strong>Priority: </strong>@Model.Priority</p> + +<hr/> + +<h2>Users</h2> + +<p>Below is a list of users in this role.</p> + +<table class="table"> + <tr> + <th style="width:65%">User</th> + <th>Actions</th> + </tr> + @foreach(var user in Model.Users) + { + <tr> + <td>@Html.UserLink(user.UserId)</td> + <td> + @if(User.Identity.GetUserId() != user.UserId) + { + @Html.ActionLink("Remove", "RemoveUserFromRole", "Admin", new { id = user.RoleId, usr = user.UserId}, new { @class="btn btn-danger"}) + + } + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.UserId }, new { @class = "btn btn-default" }) + + + </td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/Roles.cshtml b/Project-Unite/Views/Admin/Roles.cshtml new file mode 100644 index 0000000..0c490f2 --- /dev/null +++ b/Project-Unite/Views/Admin/Roles.cshtml @@ -0,0 +1,65 @@ +@model IEnumerable<Project_Unite.Models.Role> + +@{ + ViewBag.Title = "Administrator Control Panel"; +} + +<h2>Roles</h2> + +<p> + @Html.ActionLink("Create New", "CreateRole") +</p> +<table class="table"> + <tr> + <th style="width:65%"> + Role + </th> + <th>Priority</th> + <th>Actions</th> + </tr> + +@foreach (var item in Model.OrderByDescending(x=>x.Priority)) { + if (ACL.CanManageRole(User.Identity.Name, item.Id)) + { + <tr> + <td> + <strong style="color:@item.ColorHex">@Html.DisplayFor(modelItem => item.Name)</strong> (@Html.DisplayFor(modelItem => item.Id)) + <p>@Html.DisplayFor(modelItem => item.Description)</p> + </td> + <td> + @item.Priority + @if (item.Priority < Model.Count() - 1) + { + <a href="@Url.Action("RaisePriority", "Admin", new { id = item.Id })" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></a> + } + @if (item.Priority > 0) + { + <a href="@Url.Action("LowerPriority", "Admin", new { id = item.Id })" class="btn btn-default"><span class="glyphicon glyphicon-arrow-down"></span></a> + } + + </td> + <td> + @Html.ActionLink("Edit", "EditRole", new { id = item.Id }, new { @class = "btn btn-default" }) + @Html.ActionLink("Details", "RoleDetails", new { id = item.Id }, new { @class = "btn btn-default" }) + @if (ACL.Granted(User.Identity.Name, "CanDeleteRoles")) + { + @Html.ActionLink("Delete", "DeleteRole", new { id = item.Id }, new { @class = "btn btn-danger" }) + } + </td> + </tr> + } +} + +</table> + +<hr/> + +<h4>Role priorities</h4> + +<p>ShiftOS users can have multiple roles at once - and me, Michael, as a programmer, had to find a way to get the user's most granting role - the one with the most permissions. Since this could change at any time (new roles, new permission definitions, etc) I needed a way to arbitrarily determine what the best role to use when determining what users can and can't do.</p> + +<p>So, I set up a role priority system. You can use the buttons above to modify a role's priority. The role listing will display all roles on the site, sorted by priority, from highest to lowest. The highest-priority role assigned to a user will determine the color of their username and the permissions they are given. It will also determine what roles the user can modify - we don't want developers messing up admin permissions, do we?</p> + +<p>You will only see roles on this page that you have permission to alter.</p> + +<p>Also, the lowest-priority role in the system will become the role of all future users - so don't be giving it admin privileges, pretty please.</p>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/Users.cshtml b/Project-Unite/Views/Admin/Users.cshtml new file mode 100644 index 0000000..a9830c5 --- /dev/null +++ b/Project-Unite/Views/Admin/Users.cshtml @@ -0,0 +1,45 @@ +@model IEnumerable<Project_Unite.Models.ApplicationUser> +@{ + ViewBag.Admin = true; + ViewBag.Title = "Users"; +} + +<h2>Users</h2> + +<p>Below is a list of all users in the database.</p> + +<table class="table"> + <tr> + <th style="width:85%">User</th> + <th>Actions</th> + </tr> + @foreach (var user in Model) + { + <tr> + <td>@Html.UserLink(user.Id)</td> + <td> + + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.DisplayName }, new { @class = "btn btn-default" }) + @if (ACL.Granted(User.Identity.Name, "CanAnonymizeUser")) + { + <a href="#" class="btn btn-danger" data-toggle="modal" data-target="#u_anonymize"><span class="glyphicon glyphicon-warning-sign"></span> Anonymize this user</a> + <div class="modal fade in"> + <div class="modal-content" id="#u_anonymize"> + <div class="modal-header"> + <a class="close" data-dissmiss="modal"></a> + <h2>Anonymize user</h2> + </div> + <div class="modal-body"> + <p>Anonymizing this user will prevent them from ever logging in, and will purge their profile data. Continue?</p> + </div> + <div class="modal-footer"> + <a class="btn btn-default" data-dismiss="modal">No</a> + @Html.ActionLink("Yes", "AnonymizeUser", "Admin", new { id = user.Id }, new { @class = "btn btn-danger" }) + </div> + </div> + </div> + } + </td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/CreateTopic.cshtml b/Project-Unite/Views/Forum/CreateTopic.cshtml new file mode 100644 index 0000000..cb080dd --- /dev/null +++ b/Project-Unite/Views/Forum/CreateTopic.cshtml @@ -0,0 +1,86 @@ +@model Project_Unite.Models.CreateTopicViewModel +@{ + ViewBag.Title = "Create topic"; +} + +<h2>Create topic</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Category) + + <table class="table"> + <tr> + <td style="width:25%">@Html.DisplayNameFor(Model => Model.Subject)</td> + <td>@Html.TextBoxFor(Model => Model.Subject, new { @class = "form-control", style = "width:100%" })</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Body) + <p>This is the content of your topic. You can use Markdown formatting to style your post.</p> + </td> + <td>@Html.TextAreaFor(Model => Model.Body, new { @class = "form-control", style = "width:100%", rows = "10" })</td> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Post" class="btn btn-primary" /></td> + </tr> + </table> + + <h3>Topic options</h3> + + + bool showGeneral = false; + if (ACL.Granted(User.Identity.Name, "CanStickyOwnTopics") || ACL.Granted(User.Identity.Name, "CanGlobalOwnTopics") || ACL.Granted(User.Identity.Name, "CanAnnounceOwnTopics")) + { + showGeneral = true; + } + string generalStyle = "tab-pane fade in"; + string pollStyle = "tab-pane fade in"; + if (showGeneral == true) { + generalStyle += " active"; + + } + else + { + pollStyle += " active"; + } + + + <ul id="tabs" data-tabs="tabs" class="nav nav-tabs" role="tablist"> + @if (showGeneral) + { + <li class="active"><a data-toggle="tab" href="#t_general">Topic status</a></li> + <li><a data-toggle="tab" href="#t_polls">Polls</a></li> + } + else + { + <li class="active"><a data-toggle="tab" href="#t_polls">Polls</a></li> + } + </ul> + + <div class="tab-content"> + <div class="@generalStyle" id="t_general"> + <h4>Topic status</h4> + + <p>Below you can set the status of your topic.</p> + + @if (ACL.Granted(User.Identity.Name, "CanStickyOwnTopics")) + { + <p><strong>Sticky: </strong>@Html.CheckBoxFor(Model => Model.IsSticky, new { @class = "form-control" })</p> + } + @if (ACL.Granted(User.Identity.Name, "CanAnnounceOwnTopics")) + { + <p><strong>Announcement: </strong>@Html.CheckBoxFor(Model => Model.IsAnnounce, new { @class = "form-control" })</p> + } + @if (ACL.Granted(User.Identity.Name, "CanGlobalOwnTopics")) + { + <p><strong>Global announcement: </strong>@Html.CheckBoxFor(Model => Model.IsGlobal, new { @class = "form-control" })</p> + } + </div> + <div class="@pollStyle" id="t_polls"> + <h4>Polls</h4> + <p>Not yet implemented.</p> + </div> + </div> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/EditPost.cshtml b/Project-Unite/Views/Forum/EditPost.cshtml new file mode 100644 index 0000000..ea02f6f --- /dev/null +++ b/Project-Unite/Views/Forum/EditPost.cshtml @@ -0,0 +1,37 @@ +@model Project_Unite.Models.EditPostViewModel +@{ + ViewBag.Title = "Edit post"; +} + +<h2>Edit post</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model=>Model.Id) + <table class="table"> + <tr> + <td style="width:25%"> + <p><strong>Body:</strong></p> + <p>Make your edits to the post in this field. CommonMark-compliant Markdown is supported.</p> + </td> + <td> + @Html.TextAreaFor(Model=>Model.Contents, new { rows = "10", @class="form-control" }) + </td> + </tr> + <tr> + <td style="width:25%"> + <p><strong>Edit reason:</strong></p> + <p>Why did you edit the post? This reason is displayed in the Moderator Control Panel as well as at the bottom of the post.</p> + </td> + <td> + @Html.TextBoxFor(Model => Model.EditReason, new { @class = "form-control" }) + </td> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Save" class="btn btn-primary" /></td> + </tr> + </table> +} + diff --git a/Project-Unite/Views/Forum/Index.cshtml b/Project-Unite/Views/Forum/Index.cshtml new file mode 100644 index 0000000..8e26c24 --- /dev/null +++ b/Project-Unite/Views/Forum/Index.cshtml @@ -0,0 +1,39 @@ +@model IEnumerable<Project_Unite.Models.ForumCategory> + +@{ + ViewBag.Title = "Forums"; +} + +<h2>Welcome to the forums.</h2> + +@foreach (var cat in Model) +{ + <table class="table"> + <tr> + <th>@cat.Name</th> + <th>Topics</th> + <th>Posts</th> + <th>Most Recent Post</th> + </tr> + @foreach (var subcat in cat.Children) + { + <tr> + <td>@Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }, null) <br/> + <p>@subcat.Description</p> + @if(subcat.Children.Length > 0) + { + <p><strong>Subforums: </strong> + @foreach(var subfrm in subcat.Children) + { + <em> @Html.ActionLink(subfrm.Name, "ViewForum", "Forum", new { id = subfrm.Id }, null) </em> + } + </p> + } + </td> + <td>@subcat.Topics.Length</td> + <td></td> + <td></td> + </tr> + } + </table> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/PostReply.cshtml b/Project-Unite/Views/Forum/PostReply.cshtml new file mode 100644 index 0000000..2305204 --- /dev/null +++ b/Project-Unite/Views/Forum/PostReply.cshtml @@ -0,0 +1,27 @@ +@model Project_Unite.Models.CreateTopicViewModel +@{ + ViewBag.Title = "Post reply"; +} + +<h2>Post reply</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Category) + + <table class="table"> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Body) + <p>This is the content of your topic. You can use Markdown formatting to style your post.</p> + </td> + <td>@Html.TextAreaFor(Model => Model.Body, new { @class = "form-control", style = "width:100%", rows = "10" })</td> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Post" class="btn btn-primary" /></td> + </tr> + </table> + + +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/ViewForum.cshtml b/Project-Unite/Views/Forum/ViewForum.cshtml new file mode 100644 index 0000000..01f1d01 --- /dev/null +++ b/Project-Unite/Views/Forum/ViewForum.cshtml @@ -0,0 +1,166 @@ +@model Project_Unite.Models.ForumCategory +@{ + ViewBag.Title = "View forum"; +} + +<h2>@Model.Name</h2> + +@if (Model.Parent == "root") +{ + @Html.ActionLink("Back", "Index", "Forum", null, new { @class = "btn btn-default" }) + +} +else +{ + @Html.ActionLink("Back", "ViewForum", "Forum", new { id=Model.Parent}, new { @class = "btn btn-default" }) +} + +@if(ACL.CanPost(User.Identity.Name, Model.Id)) +{ + @Html.ActionLink("New topic", "CreateTopic", "Forum", new { id=Model.Id}, new { @class = "btn btn-default" }) +} + +<p>@Model.Description</p> + +@if (Model.Children.Length > 0) +{ + <table class="table"> + <tr> + <th>Subforums</th> + <th>Topics</th> + <th>Posts</th> + <th>Most Recent Post</th> + </tr> + @foreach (var cat in Model.Children) + { + <tr> + <td>@Html.ActionLink(cat.Name, "ViewForum", "Forum", new { id = cat.Id }, null) + <p>@cat.Description</p> + </td> + <td> + @cat.Topics.Length + </td> + <td></td> + <td></td> + </tr> + } + </table> +} + +<hr/> + +@if (Model.Topics.Length > 0) +{ + <table class="table"> + <tr> + <th>Topics</th> + <th>Posts</th> + <th>Most recent post</th> + </tr> + @{ + var stickies = Model.Topics.Where(x => x.IsSticky == true); + var stickiesSorted = stickies.OrderByDescending(x => x.StartedAt); + var topicsSorted = Model.Topics.Where(x => x.IsSticky != true).OrderByDescending(x => x.StartedAt); + } + + @foreach (var topic in stickiesSorted) + { + bool showTopic = true; + if (topic.IsUnlisted == true) + { + if(!ACL.Granted(User.Identity.Name, "CanSeeUnlistedTopics")) + { + showTopic = false; + } + } + + if (showTopic == true) + { + <tr> + <td><span class="glyphicon glyphicon-star"></span> + @if(topic.IsUnlisted == true) + { + <span class="glyphicon glyphicon-eye-close"></span> + } + @if (topic.IsLocked == true) + { + <span class="glyphicon glyphicon-lock"></span> + } + + @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) + <p>Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt</p> + </td> + <td> + @topic.Posts.Length + </td> + <td style="text-align:center"> + @if (topic.Posts.Length > 0) + { + var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); + <strong>Re: @topic.Subject</strong> + <em>by @Html.UserLink(mostRecent.AuthorId)</em> + <p><em>at @mostRecent.PostedAt</em></p> + } + else + { + <em>No posts.</em> + } + </td> + </tr> + } + } + @foreach (var topic in topicsSorted) + { + + bool showTopic = true; + if (topic.IsUnlisted == true) + { + if (!ACL.Granted(User.Identity.Name, "CanSeeUnlistedTopics")) + { + showTopic = false; + } + } + + if (showTopic == true) + { + <tr> + <td> + @if(topic.IsUnlisted == true) + { + <span class="glyphicon glyphicon-eye-close"></span> + } + + @if (topic.IsLocked == true) + { + <span class="glyphicon glyphicon-lock"></span> + } + @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) + <p>Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt</p> + </td> + <td> + @topic.Posts.Length + </td> + <td style="text-align:center"> + @if (topic.Posts.Length > 0) + { + var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); + <strong>Re: @topic.Subject</strong> + <em>by @Html.UserLink(mostRecent.AuthorId)</em> + <p><em>at @mostRecent.PostedAt</em></p> + } + else + { + <em>No posts.</em> + } + </td> + </tr> + } + } + + + </table> +} +else +{ + <p>No topics exist in this category. Be the first to start one!</p> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/ViewTopic.cshtml b/Project-Unite/Views/Forum/ViewTopic.cshtml new file mode 100644 index 0000000..4348518 --- /dev/null +++ b/Project-Unite/Views/Forum/ViewTopic.cshtml @@ -0,0 +1,69 @@ +@model Project_Unite.Models.ForumTopic +@using Microsoft.AspNet.Identity +@{ + ViewBag.Title = Model.Subject; +} + +@if(ViewBag.Error != null) +{ + <div class="panel panel-error"> + <div class="panel-body"> + <p><span class="glyphicon glyphicon-exclamation-sign"></span> @ViewBag.Error</p> + </div> + </div> +} + +@if(Model.IsUnlisted == true) +{ + <div class="panel panel-warning"> + <div class="panel-body"> + <p><span class="glyphicon glyphicon-eye-close"></span> <strong>This topic is unlisted.</strong> Only those with the topic link as well as moderators may see this topic. Please respect its privacy.</p> + </div> + </div> +} + +<h2>@Model.Subject</h2> + +<p>Started by <strong>@Html.UserLink(Model.AuthorId)</strong> at <strong>@Model.StartedAt</strong></p> + +@{ + Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model); +} + +@foreach (var post in Model.Posts.OrderBy(x => x.PostedAt)) +{ + <div class="row panel panel-default"> + <div class="panel-body"> + <div class="col-xs-4"> <!--Mini profile data--> + <img src="@ACL.GetUserInfo(post.AuthorId).AvatarUrl" width="128" height="128" /><br/> + <strong>@Html.UserLink(post.AuthorId)</strong><br/> + @{ + var user = ACL.GetUserInfo(post.AuthorId); + <p><strong>@user.Codepoints</strong> Codepoints</p> + <p><strong><u>@user.HighestRole.Name</u></strong></p> + <p> + @if (ACL.Granted(User.Identity.Name, "CanAccessModCP")) + { + if (ACL.Granted(User.Identity.Name, "CanViewUserInfo")) + { + @Html.ActionLink("User info", "UserDetails", "Moderator", new { id = ACL.UserNameRaw(post.AuthorId) }, new { @class = "btn btn-default" }) + } + } + </p> + } + </div> + <div class="col-xs-8"><!--Post body, subject, author, time--> + <h4>@Model.Subject</h4> + <p>@Html.UserLink(post.AuthorId) at @post.PostedAt</p> + <p>@Html.Markdown(post.Body)</p> + @{ + Html.RenderPartial("~/Views/Shared/_PostModerationBar.cshtml", post); + } + </div> + </div> + </div> +} + +@{ + Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model); +} diff --git a/Project-Unite/Views/Home/About.cshtml b/Project-Unite/Views/Home/About.cshtml new file mode 100644 index 0000000..4b2d9e8 --- /dev/null +++ b/Project-Unite/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewBag.Title = "About"; +} +<h2>@ViewBag.Title.</h2> +<h3>@ViewBag.Message</h3> + +<p>Use this area to provide additional information.</p> diff --git a/Project-Unite/Views/Home/Contact.cshtml b/Project-Unite/Views/Home/Contact.cshtml new file mode 100644 index 0000000..0f4327e --- /dev/null +++ b/Project-Unite/Views/Home/Contact.cshtml @@ -0,0 +1,17 @@ +@{ + ViewBag.Title = "Contact"; +} +<h2>@ViewBag.Title.</h2> +<h3>@ViewBag.Message</h3> + +<address> + One Microsoft Way<br /> + Redmond, WA 98052-6399<br /> + <abbr title="Phone">P:</abbr> + 425.555.0100 +</address> + +<address> + <strong>Support:</strong> <a href="mailto:[email protected]">[email protected]</a><br /> + <strong>Marketing:</strong> <a href="mailto:[email protected]">[email protected]</a> +</address>
\ No newline at end of file diff --git a/Project-Unite/Views/Home/Index.cshtml b/Project-Unite/Views/Home/Index.cshtml new file mode 100644 index 0000000..419ca0e --- /dev/null +++ b/Project-Unite/Views/Home/Index.cshtml @@ -0,0 +1,66 @@ +@{ + ViewBag.Title = "Home Page"; +} + +<header style="text-align:center;"> + <div class="header-content"> + <div class="header-content-inner"> + <h1 id="homeHeading">Welcome to the multi-user domain.</h1> + <hr> + <p>You are walking into a world of skins, applications, games, websites, viruses, and untold mysteries. Shift it your way while you uncover the truth behind ShiftOS and the multi-user domain.</p> + <a href="#about" class="btn btn-primary btn-xl page-scroll">I'm in.</a> + </div> + </div> +</header> + +<section id="demo_skins" class="row"> + <div class="col-xs-4"> + <img src="http://shiftos.michaeltheshifter.me/uploads/default/optimized/1X/93d30d12608231eccf8a735c3ad56354d2caf48b_1_690x388.png" style="width:100%;height:100%" /> + </div> + <div class="col-xs-8"> + <h4>Shift it your way.</h4> + <p>With ShiftOS's extensive skinning system, you can make ShiftOS look any way you want. All it takes is your imagination, and some time, and soon you'll be using the OS of your dreams.</p> + + <h5>ArtPad and the Shifter</h5> + + <p>Want to make your very own skin? We've made it easy! Just use the ArtPad application to make textures for the various UI elements - then use the Shifter to apply them and move and resize things, and set the fonts, colors and behaviours you want.</p> + + <h5>The Skin Repository</h5> + + <p>Want to download pre-made skins to shape up your user-experience? Have a look at the Skin Repository! You can even post your own skins there!</p> + + <a href="/Skins" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> Open the Skin Repository!</a> + </div> +</section> + +<section id="demo_community" class="row"> + <div class="col-xs-8"> + <h4>Share the way you shift it.</h4> + <p>ShiftOS is not just an evolving operating system, it's a community as well! Come jump in, say hi, show off what you've done, and get to know us!</p> + + <h5>Join us on this very site</h5> + + <p>You don't have to leave the website to be a part of the community! Just create a user account, and you'll unlock a whole new world of things to do!</p> + + <h5>We have a Discord server!</h5> + + <p>Discord is the perfect way to get in touch with us live, anywhere you want. Just click the link below and say hi!</p> + + <a href="https://discord.gg/Vfhp78J" class="btn btn-default"><span class="glyphicon glyphicon-log-in"></span> Join the Discord.</a> + </div> + <div class="col-xs-4"> + <img src="http://shiftos.michaeltheshifter.me/uploads/default/optimized/1X/93d30d12608231eccf8a735c3ad56354d2caf48b_1_690x388.png" style="width:100%;height:100%" /> + </div> + +</section> + + +<section id="about"> + <h4>Ready to jump in?</h4> + + <p>Ready to jump into the world of ShiftOS? Cool! First, let's get you set up with a client. Simply click "Download" at the top of the page - and download the latest stable or unstable client - or you can download our AppVeyor release of the game or compile from source.</p> + + <a href="https://ci.appveyor.com/project/ComputeLinux/shiftos"><img alt="Build status" src="https://ci.appveyor.com/api/projects/status/ktdv3nt6c3q88g2t?svg=true"></a> - Click that to go to our AppVeyor page. + + <p>...Or you can get the source code: <a href="http://github.com/shiftos-game/ShiftOS" class="btn btn-default"><span class="glyphicon glyphicon-file"></span> ShiftOS Code on GitHub</a></p> +</section>
\ No newline at end of file diff --git a/Project-Unite/Views/Manage/AddPhoneNumber.cshtml b/Project-Unite/Views/Manage/AddPhoneNumber.cshtml new file mode 100644 index 0000000..07f35b0 --- /dev/null +++ b/Project-Unite/Views/Manage/AddPhoneNumber.cshtml @@ -0,0 +1,29 @@ +@model Project_Unite.Models.AddPhoneNumberViewModel +@{ + ViewBag.Title = "Phone Number"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + <h4>Add a phone number</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Number, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Number, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Submit" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Manage/ChangePassword.cshtml b/Project-Unite/Views/Manage/ChangePassword.cshtml new file mode 100644 index 0000000..f008697 --- /dev/null +++ b/Project-Unite/Views/Manage/ChangePassword.cshtml @@ -0,0 +1,40 @@ +@model Project_Unite.Models.ChangePasswordViewModel +@{ + ViewBag.Title = "Change Password"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + <h4>Change Password Form</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Change password" class="btn btn-default" /> + </div> + </div> +} +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +}
\ No newline at end of file diff --git a/Project-Unite/Views/Manage/Index.cshtml b/Project-Unite/Views/Manage/Index.cshtml new file mode 100644 index 0000000..8b18401 --- /dev/null +++ b/Project-Unite/Views/Manage/Index.cshtml @@ -0,0 +1,81 @@ +@model Project_Unite.Models.ApplicationUser +@{ + ViewBag.Title = "My profile"; +} + +<div class="row"> + <h3><img src="@Model.AvatarUrl" width="64" height="64" /> @if (string.IsNullOrWhiteSpace(Model.FullName)) + { <strong> @Model.DisplayName </strong>} + else { + <strong>@Model.FullName</strong> <em>(@Model.DisplayName)</em> + }</h3> +</div> + + +<p class="text-success">@ViewBag.StatusMessage</p> + +<div class="row"> + <ul id="tabs" data-tabs="tabs" class="nav nav-tabs" role="tablist"> + <li class="active"><a data-toggle="tab" href="#t_profile">Profile</a></li> + <li><a data-toggle="tab" href="#t_badges">Badges</a></li> + <li><a data-toggle="tab" href="#t_posts">Posts</a></li> + <li><a data-toggle="tab" href="#t_messages">Messages</a></li> + <li><a data-toggle="tab" href="#t_preferences">Preferences</a></li> + </ul> + + <div class="tab-content"> + <div class="tab-pane active" id="t_profile"> + <table class="table"> + <tr> + <td><strong>Full name:</strong></td> + <td> + @if (string.IsNullOrWhiteSpace(Model.FullName)) + { + <p><em>Not provided.</em></p> + } + else + { + <p>@Model.FullName</p> + } + </td> + </tr> + <tr> + <td><strong>Display name:</strong></td> + <td><p>@Model.DisplayName</p></td> + </tr> + <tr> + <td><strong>Codepoints:</strong><p>If you have your in-game system linked with your account, your Codepoints will be shown here.</p></td> + <td><p>@Model.Codepoints</p></td> + </tr> + <tr> + <td>Links</td> + <td> + @if (!string.IsNullOrWhiteSpace(Model.YoutubeUrl)) { + <a href="@Model.YoutubeUrl"><span class="glyphicon glyphicon-hd-video"></span></a> + } + + @if (!string.IsNullOrWhiteSpace(Model.Website)) { + <a href="@Model.Website">Website</a> + } + </td> + </tr> + </table> + </div> + <div class="tab-pane" id="t_badges"> + <h4>Not yet implemented.</h4> + <p>This feature has not been implemented just yet.</p> + </div> + <div class="tab-pane" id="t_posts"> + <h4>Not yet implemented.</h4> + <p>This feature has not been implemented just yet.</p> + </div> + <div class="tab-pane" id="t_messages"> + <h4>Not yet implemented.</h4> + <p>This feature has not been implemented just yet.</p> + </div> + <div class="tab-pane" id="t_preferences"> + <h4>Not yet implemented.</h4> + <p>This feature has not been implemented just yet.</p> + </div> + </div> +</div>
\ No newline at end of file diff --git a/Project-Unite/Views/Manage/ManageLogins.cshtml b/Project-Unite/Views/Manage/ManageLogins.cshtml new file mode 100644 index 0000000..709cedc --- /dev/null +++ b/Project-Unite/Views/Manage/ManageLogins.cshtml @@ -0,0 +1,70 @@ +@model Project_Unite.Models.ManageLoginsViewModel +@using Microsoft.Owin.Security +@{ + ViewBag.Title = "Manage your external logins"; +} + +<h2>@ViewBag.Title.</h2> + +<p class="text-success">@ViewBag.StatusMessage</p> +@{ + var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); + if (loginProviders.Count() == 0) { + <div> + <p> + There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=313242">this article</a> + for details on setting up this ASP.NET application to support logging in via external services. + </p> + </div> + } + else + { + if (Model.CurrentLogins.Count > 0) + { + <h4>Registered Logins</h4> + <table class="table"> + <tbody> + @foreach (var account in Model.CurrentLogins) + { + <tr> + <td>@account.LoginProvider</td> + <td> + @if (ViewBag.ShowRemoveButton) + { + using (Html.BeginForm("RemoveLogin", "Manage")) + { + @Html.AntiForgeryToken() + <div> + @Html.Hidden("loginProvider", account.LoginProvider) + @Html.Hidden("providerKey", account.ProviderKey) + <input type="submit" class="btn btn-default" value="Remove" title="Remove this @account.LoginProvider login from your account" /> + </div> + } + } + else + { + @: + } + </td> + </tr> + } + </tbody> + </table> + } + if (Model.OtherLogins.Count > 0) + { + using (Html.BeginForm("LinkLogin", "Manage")) + { + @Html.AntiForgeryToken() + <div id="socialLoginList"> + <p> + @foreach (AuthenticationDescription p in Model.OtherLogins) + { + <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button> + } + </p> + </div> + } + } + } +} diff --git a/Project-Unite/Views/Manage/SetPassword.cshtml b/Project-Unite/Views/Manage/SetPassword.cshtml new file mode 100644 index 0000000..e8711e9 --- /dev/null +++ b/Project-Unite/Views/Manage/SetPassword.cshtml @@ -0,0 +1,39 @@ +@model Project_Unite.Models.SetPasswordViewModel +@{ + ViewBag.Title = "Create Password"; +} + +<h2>@ViewBag.Title.</h2> +<p class="text-info"> + You do not have a local username/password for this site. Add a local + account so you can log in without an external login. +</p> + +@using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + + <h4>Create Local Login</h4> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Set password" class="btn btn-default" /> + </div> + </div> +} +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +}
\ No newline at end of file diff --git a/Project-Unite/Views/Manage/VerifyPhoneNumber.cshtml b/Project-Unite/Views/Manage/VerifyPhoneNumber.cshtml new file mode 100644 index 0000000..8d3098d --- /dev/null +++ b/Project-Unite/Views/Manage/VerifyPhoneNumber.cshtml @@ -0,0 +1,31 @@ +@model Project_Unite.Models.VerifyPhoneNumberViewModel +@{ + ViewBag.Title = "Verify Phone Number"; +} + +<h2>@ViewBag.Title.</h2> + +@using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +{ + @Html.AntiForgeryToken() + @Html.Hidden("phoneNumber", @Model.PhoneNumber) + <h4>Enter verification code</h4> + <h5>@ViewBag.Status</h5> + <hr /> + @Html.ValidationSummary("", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) + <div class="col-md-10"> + @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) + </div> + </div> + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" class="btn btn-default" value="Submit" /> + </div> + </div> +} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/Project-Unite/Views/Moderator/Bans.cshtml b/Project-Unite/Views/Moderator/Bans.cshtml new file mode 100644 index 0000000..90e20fc --- /dev/null +++ b/Project-Unite/Views/Moderator/Bans.cshtml @@ -0,0 +1,73 @@ +@model Project_Unite.Models.ModeratorBanListViewModel +@{ + ViewBag.Moderator = true; + ViewBag.Title = "Bans"; +} + +<h2>Bans</h2> + +<ul id="tabs" data-tabs="tabs" class="nav nav-tabs" role="tablist"> + <li class="active"><a data-toggle="tab" href="#t_users">User bans</a></li> + <li><a data-toggle="tab" href="#t_ips">IP bans</a></li> +</ul> + +<div class="tab-content"> + <div class="tab-pane fade in active" id="t_users"> + <h4>User bans</h4> + <p>Below is a list of all user bans. User bans prevent users from logging into their accounts.</p> + <table class="table"> + <tr> + <th style="width:50%">User</th> + <th>Banner</th> + <th>Timestamp</th> + <th>Actions</th> + </tr> + + @foreach(var u in Model.UserBans.OrderByDescending(x=>x.BannedAt)) + { + <tr> + <td>@Html.UserLink(u.Id)</td> + <td>@Html.UserLink(u.BannedBy)</td> + <td>@u.BannedAt</td> + <td> + @if(ACL.Granted(User.Identity.Name, "CanIssueBan")) + { + if(ACL.CanManageRole(User.Identity.Name, u.HighestRole.Id)) + { + @Html.ActionLink("Unban", "Unban", "Moderator", new { id=u.Id}, new { @class="btn btn-default"}) + } + } + + </td> + </tr> + } + </table> + </div> + <div class="tab-pane fade in" id="t_ips"> + <h4>IP address bans</h4> + <p>Below is a list of IP address bans on the site. IP bans prevent users with a certain IP address from even attempting to access the website and multi-user domain by sending back "Forbidden" responses and denying connection.</p> + <h5>BE EXTREMELY CAUTIOUS.</h5> + <p>The system does NOT associate IP addresses with usernames - it can't. If you are unsure who's IP address you are unbanning, contact someone who is sure before taking any action. We have no idea what that computer or network is capable of.</p> + <table class="table"> + <tr> + <th style="width:50%">User</th> + <th>Banner</th> + <th>Timestamp</th> + <th>Actions</th> + </tr> + + @foreach (var u in Model.IPBans) + { + <tr> + <td>@u.Address</td> + <td> + @if (ACL.Granted(User.Identity.Name, "CanIssueIPBan")) + { + @Html.ActionLink("Unban", "UnbanIP", "Moderator", new { id = u.Id }, new { @class = "btn btn-danger" }) + } + </td> + </tr> + } + </table> + </div> +</div>
\ No newline at end of file diff --git a/Project-Unite/Views/Moderator/Index.cshtml b/Project-Unite/Views/Moderator/Index.cshtml new file mode 100644 index 0000000..d4b6569 --- /dev/null +++ b/Project-Unite/Views/Moderator/Index.cshtml @@ -0,0 +1,7 @@ + +@{ + ViewBag.Title = "Moderator CP"; +} + + + diff --git a/Project-Unite/Views/Moderator/Logs.cshtml b/Project-Unite/Views/Moderator/Logs.cshtml new file mode 100644 index 0000000..bf3ed4d --- /dev/null +++ b/Project-Unite/Views/Moderator/Logs.cshtml @@ -0,0 +1,25 @@ +@model IEnumerable<Project_Unite.Models.AuditLog> +@{ + ViewBag.Moderator = true; + ViewBag.Title = "Audit logs"; +} + +<h2>Moderator audit logs</h2> + +<p>Below is a list of all actions carried out by moderators and users that can be reviewed as evidence when investigating a guideline break.</p> + +<table class="table"> + <tr> + <th style="width:65%">Action</th> + <th>User & Timestamp</th> + <th>Level</th> + </tr> + @foreach(var i in Model.OrderByDescending(x=>x.Timestamp)) + { + <tr> + <td>@i.Description</td> + <td>@Html.UserLink(i.UserId) at @i.Timestamp</td> + <td>@i.Level</td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Moderator/UserDetails.cshtml b/Project-Unite/Views/Moderator/UserDetails.cshtml new file mode 100644 index 0000000..74556df --- /dev/null +++ b/Project-Unite/Views/Moderator/UserDetails.cshtml @@ -0,0 +1,116 @@ +@model Project_Unite.Models.ApplicationUser +@{ + ViewBag.Moderator = true; + ViewBag.Title = "User details"; +} + +<h2>User details</h2> + +<h4>@Html.UserLink(Model.Id)</h4> + +<ul> + <li><strong>Email address: </strong><a href="mailto:@Model.Email">Email @Model.Email</a></li> + <li><strong>Display name: </strong>@Model.DisplayName + + @if (ACL.Granted(User.Identity.Name, "CanEditUsernames")) + { + if (ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id)) + { + <!-- Trigger the modal with a button --> + <a data-toggle="modal" data-target="#edit-user" href="#"><span class="glyphicon glyphicon-pencil"></span> Change</a> + + <!-- Modal --> + <div id="edit-user" class="modal fade" role="dialog"> + <div class="modal-dialog"> + + <!-- Modal content--> + <div class="modal-content"> + @using (Html.BeginForm("ChangeUsername", "Moderator", new { id = Model.Id })) + { + @Html.AntiForgeryToken() + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">Change username</h4> + </div> + <div class="modal-body"> + <p>Please enter a username for this user.</p> + <p><strong>@Html.DisplayNameFor(Model => Model.DisplayName)</strong>: @Html.TextBoxFor(Model => Model.DisplayName)</p> + + </div> + <div class="modal-footer"> + <input type="submit" value="Change" class="btn btn-primary" /> + <a href="#" data-dismiss="modal" class="btn btn-default">Cancel</a> + </div> + } + </div> + + </div> + </div> + } + } + </li> + @if(ACL.Granted(User.Identity.Name, "CanIssueIPBan")) + { + <li><strong>Last known IP address: </strong>@Model.LastKnownIPAddress</li> + } + <li><strong>Banned: </strong> + @if (Model.IsBanned) + { + <em>Yes</em> + if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id)) + { + @Html.ActionLink("Unban", "Unban", "Moderator", new { id = Model.Id }, null) + } + } + else + { + <em>No</em> + if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id)) + { + @Html.ActionLink("Ban", "Ban", "Moderator", new { id = Model.Id }, null) + } + } + </li> + @if(Model.IsBanned == true) + { + <li><strong>Banned on: </strong>@Model.BannedAt</li> + <li><strong>Banned by: </strong>@Html.UserLink(Model.BannedBy)</li> + } + <li> + <strong>Muted: </strong> + @if (Model.IsMuted) + { + <em>Yes</em> + if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id)) + { + @Html.ActionLink("Unmute", "Unmute", "Moderator", new { id = Model.Id }, null) + } + } + else + { + <em>No</em> + if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id)) + { + @Html.ActionLink("Mute", "Mute", "Moderator", new { id = Model.Id }, null) + } + } + </li> + @if (Model.IsMuted == true) + { + <li><strong>Muted on: </strong>@Model.MutedAt</li> + <li><strong>Muted by: </strong>@Html.UserLink(Model.MutedBy)</li> + } + <li><strong>Bio:</strong> + <p>@Html.Markdown(Model.Bio)</p> + </li> + <li> + <strong>Interests:</strong> + <p>@Model.Interests</p> + </li> + <li> + <strong>Hobbies:</strong> + <p>@Model.Hobbies</p> + </li> + + +</ul>
\ No newline at end of file diff --git a/Project-Unite/Views/Moderator/Users.cshtml b/Project-Unite/Views/Moderator/Users.cshtml new file mode 100644 index 0000000..b352d53 --- /dev/null +++ b/Project-Unite/Views/Moderator/Users.cshtml @@ -0,0 +1,28 @@ +@model IEnumerable<Project_Unite.Models.ApplicationUser> +@{ + ViewBag.Moderator = true; + ViewBag.Title = "Users"; +} + +<h2>Users</h2> + +<p>Below is a list of all users in the database.</p> + +<table class="table"> + <tr> + <th style="width:85%">User</th> + <th>Actions</th> + </tr> + @foreach (var user in Model) + { + <tr> + <td>@Html.UserLink(user.Id)</td> + <td> + + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.DisplayName }, new { @class = "btn btn-default" }) + + + </td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Shared/Error.cshtml b/Project-Unite/Views/Shared/Error.cshtml new file mode 100644 index 0000000..be55b17 --- /dev/null +++ b/Project-Unite/Views/Shared/Error.cshtml @@ -0,0 +1,9 @@ +@model System.Web.Mvc.HandleErrorInfo + +@{ + ViewBag.Title = "Error"; +} + +<h1 class="text-danger">Error.</h1> +<h2 class="text-danger">An error occurred while processing your request.</h2> + diff --git a/Project-Unite/Views/Shared/Lockout.cshtml b/Project-Unite/Views/Shared/Lockout.cshtml new file mode 100644 index 0000000..8658ff2 --- /dev/null +++ b/Project-Unite/Views/Shared/Lockout.cshtml @@ -0,0 +1,10 @@ +@model System.Web.Mvc.HandleErrorInfo + +@{ + ViewBag.Title = "Locked Out"; +} + +<hgroup> + <h1 class="text-danger">Locked out.</h1> + <h2 class="text-danger">This account has been locked out, please try again later.</h2> +</hgroup> diff --git a/Project-Unite/Views/Shared/_Layout.cshtml b/Project-Unite/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..0e64010 --- /dev/null +++ b/Project-Unite/Views/Shared/_Layout.cshtml @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>@ViewBag.Title - My ASP.NET Application</title> + @Styles.Render("~/Content/css") + @Styles.Render("~/Content/bootstrap-theme.css") + @Styles.Render("~/Content/Site.css") + + + @Scripts.Render("~/bundles/modernizr") + +</head> +<body> + @Scripts.Render("~/Scripts/highlight.js") + <div class="navbar navbar-default navbar-fixed-top"> + <div> <!--Let's just add some padding there so the page doesn't look fucked.--> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + @Html.ActionLink("ShiftOS", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li>@Html.ActionLink("Home", "Index", "Home")</li> + <li>@Html.ActionLink("Download", "Download", "Home")</li> + <li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">Community <span class="caret"></span></a> + <ul class="dropdown-menu"> + <li>@Html.ActionLink("Discord", "Discord", "Home")</li> + <li>@Html.ActionLink("Forum", "Index", "Forum")</li> + <li>@Html.ActionLink("Wiki", "Index", "Wiki")</li> + <li>@Html.ActionLink("Developer blog", "Index", "Blog")</li> + <li>@Html.ActionLink("Bug tracker", "Index", "Bugs")</li> + <li><a href="http://github.com/shiftos-game/ShiftOS">GitHub</a></li> + </ul> + </li> + </ul> + @Html.Partial("_LoginPartial") + </div> + </div> + </div> + + @if (ViewBag.Modals != null) + { + + foreach (var id in ViewBag.Modals) + { + <div id="[email protected]" class="modal fade" role="dialog"> + <div class="modal-dialog"> + + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">Are you sure?</h4> + </div> + <div class="modal-body"> + <p>Deleting this category will delete all child categories and topics associated with it. This <strong>cannot</strong> be undone.</p> + </div> + <div class="modal-footer"> + <a href="@id.Value" class="btn btn-primary">Yes</a> + <button type="button" class="btn btn-default" data-dismiss="modal">Nope.</button> + </div> + </div> + + </div> + </div> + + } + + } + + <div class="container clearfix body-content"> + @if (!ACL.UserEmailConfirmed(User.Identity.Name)) + { + <div class="panel panel-warning"> + <div class="panel-body"> + <span class="glyphicon glyphicon-info-sign"></span> <strong>Email address not confirmed!</strong> Hi! It appears that your email has not been confirmed. Please check your email. @Html.ActionLink("Resend confirmation link", "ResendConf", "Account") + </div> + </div> + } + + @if (ViewBag.Moderator == true) + { + <ul class="nav nav-tabs"> + <li>@Html.ActionLink("Home", "Index", "Moderator")</li> + @if (ACL.Granted(User.Identity.Name, "CanIssueBan")) + { + <li>@Html.ActionLink("Bans", "Bans", "Moderator")</li> + } + @if (ACL.Granted(User.Identity.Name, "CanEditProfiles")) + { + <li>@Html.ActionLink("Users", "Users", "Moderator")</li> + } + <li>@Html.ActionLink("Audit logs", "Logs", "Moderator")</li> + </ul> + @RenderBody(); + } + else if (ACL.Granted(User.Identity.Name, ViewBag.ACLRule)) + { + if (ViewBag.Admin == true) + { + if (ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <ul class="nav nav-tabs"> + <li>@Html.ActionLink("Home", "Index", "Admin")</li> + @if (ACL.Granted(User.Identity.Name, "CanEditRoles")) + { + <li>@Html.ActionLink("Roles", "Roles", "Admin")</li> + <li>@Html.ActionLink("Access Control", "AccessControl", "Admin")</li> + + } + @if (ACL.Granted(User.Identity.Name, "CanEditProfiles")) + { + <li>@Html.ActionLink("Users", "Users", "Admin")</li> + } + @if (ACL.Granted(User.Identity.Name, "CanEditForumCategories")) + { + <li>@Html.ActionLink("Forum Categories", "Forums", "Admin")</li> + } + <li>@Html.ActionLink("Audit logs", "Logs", "Admin")</li> + </ul> + @RenderBody(); + } + else + { + <h2>Access denied.</h2> + <p>You do not have permission to access this page. Contact an admin if this is in error.</p> + } + } + else + { + @RenderBody() + + } + } + else + { + <h2>Access denied.</h2> + <p>You do not have permission to access this page. Contact an admin if this is in error.</p> + + }<hr /> + + <footer> + + <p>© @DateTime.Now.Year Michael VanOverbeek and the ShiftOS Dev Team</p> + @if (ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <p>@Html.ActionLink("Administrator Control Panel", "Index", "Admin")</p> + } + </footer> + </div> + + @Scripts.Render("~/bundles/jquery") + @Scripts.Render("~/bundles/bootstrap") + @RenderSection("scripts", required: false) +</body> +</html> diff --git a/Project-Unite/Views/Shared/_LoginPartial.cshtml b/Project-Unite/Views/Shared/_LoginPartial.cshtml new file mode 100644 index 0000000..ad6978c --- /dev/null +++ b/Project-Unite/Views/Shared/_LoginPartial.cshtml @@ -0,0 +1,40 @@ +@using Microsoft.AspNet.Identity +@if (Request.IsAuthenticated) +{ + using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) + { + @Html.AntiForgeryToken() + + <ul class="nav navbar-nav navbar-right" style="margin-right:15px;"> + <li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><span class="glyphicon glyphicon-user"></span> @Html.UserName(User.Identity.GetUserId()) <span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="@Url.Action("ViewProfile", "Profiles", new { name = User.Identity.Name })"><span class="glyphicon glyphicon-user"></span> Profile</a></li> + <li class="divider"></li> + <li class="dropdown-header">Settings</li> + @if(ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <li><a href="@Url.Action("Index", "Admin")"><span class="glyphicon glyphicon-cog"></span> Admin CP</a></li> + } + @if (ACL.Granted(User.Identity.Name, "CanAccessModCP")) + { + <li><a href="@Url.Action("Index", "Moderator")"><span class="glyphicon glyphicon-warning-sign"></span> Mod CP</a></li> + } + @if (ACL.Granted(User.Identity.Name, "CanAccessDevCP")) + { + <li><a href="@Url.Action("Index", "Developer")"><span class="glyphicon glyphicon-star"></span> Developer CP</a></li> + } + <li><a href="@Url.Action("Index", "Manage")"><span class="glyphicon glyphicon-adjust"></span> Account</a></li> + <li class="divider"></li> + <li><a href="javascript:document.getElementById('logoutForm').submit()"><span class="glyphicon glyphicon-log-out"></span> Log off</a></li> + </ul> + </li> + </ul> + } +} +else +{ + <ul class="nav navbar-nav navbar-right" style="margin-right:15px;"> + <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> + <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li> + </ul> +} diff --git a/Project-Unite/Views/Shared/_ModeratorBar.cshtml b/Project-Unite/Views/Shared/_ModeratorBar.cshtml new file mode 100644 index 0000000..8f8196e --- /dev/null +++ b/Project-Unite/Views/Shared/_ModeratorBar.cshtml @@ -0,0 +1,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/>
\ No newline at end of file diff --git a/Project-Unite/Views/Shared/_PostModerationBar.cshtml b/Project-Unite/Views/Shared/_PostModerationBar.cshtml new file mode 100644 index 0000000..a647447 --- /dev/null +++ b/Project-Unite/Views/Shared/_PostModerationBar.cshtml @@ -0,0 +1,27 @@ +@using Microsoft.AspNet.Identity +@model Project_Unite.Models.ForumPost + +@{ + string acl_perm_delete = "CanDeletePosts"; + string acl_perm_edit = "CanEditPosts"; + + if (User.Identity.GetUserId() == Model.AuthorId) + { + acl_perm_delete = "CanDeleteOwnPosts"; + acl_perm_edit = "CanEditOwnPosts"; + } +} + +<ul class="nav nav-tabs"> + @if(ACL.Granted(User.Identity.Name, acl_perm_edit)) + { + <li><a href="@Url.Action("EditPost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-pencil"></span> Edit</a></li> + } + @if (ACL.Granted(User.Identity.Name, acl_perm_delete)) + { + <li><a href="@Url.Action("DeletePost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-trash"></span> Delete</a></li> + } + +</ul> + +<hr/>
\ No newline at end of file diff --git a/Project-Unite/Views/Web.config b/Project-Unite/Views/Web.config new file mode 100644 index 0000000..5a35efd --- /dev/null +++ b/Project-Unite/Views/Web.config @@ -0,0 +1,43 @@ +<?xml version="1.0"?> + +<configuration> + <configSections> + <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + </sectionGroup> + </configSections> + + <system.web.webPages.razor> + <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> + <pages pageBaseType="System.Web.Mvc.WebViewPage"> + <namespaces> + <add namespace="System.Web.Mvc" /> + <add namespace="System.Web.Mvc.Ajax" /> + <add namespace="System.Web.Mvc.Html" /> + <add namespace="System.Web.Optimization"/> + <add namespace="System.Web.Routing" /> + <add namespace="Project_Unite" /> + </namespaces> + </pages> + </system.web.webPages.razor> + + <appSettings> + <add key="webpages:Enabled" value="false" /> + </appSettings> + + <system.webServer> + <handlers> + <remove name="BlockViewHandler"/> + <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> + </handlers> + </system.webServer> + + <system.web> + <compilation> + <assemblies> + <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> + </assemblies> + </compilation> + </system.web> +</configuration> diff --git a/Project-Unite/Views/_ViewStart.cshtml b/Project-Unite/Views/_ViewStart.cshtml new file mode 100644 index 0000000..2de6241 --- /dev/null +++ b/Project-Unite/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} |
