diff --git a/Areas/admin/Controllers/metaController.cs b/Areas/admin/Controllers/metaController.cs
index fee9062..1f6700b 100644
--- a/Areas/admin/Controllers/metaController.cs
+++ b/Areas/admin/Controllers/metaController.cs
@@ -43,7 +43,15 @@ orderby b.Key.ToString()
Type = MetaType.Version,
Value = v
}
- })
+ }).Concat(from y in MetaItem.SelectUnusedYears()
+ select new MetaItem()
+ {
+ Id = new MetaItemKey()
+ {
+ Type = MetaType.Year,
+ Value = y
+ }
+ })
group i by i.Id.Type into b
orderby b.Key.ToString()
select b
diff --git a/Areas/admin/Views/meta/index.cshtml b/Areas/admin/Views/meta/index.cshtml
index 212147c..2a8bd5a 100644
--- a/Areas/admin/Views/meta/index.cshtml
+++ b/Areas/admin/Views/meta/index.cshtml
@@ -5,6 +5,10 @@
}
Manage metadata
+
+ @Html.ActionLink("Manage users", "index")
+ @Html.ActionLink("Return to admin panel", "index", "base")
+
Current items
diff --git a/Areas/admin/Views/users/index.cshtml b/Areas/admin/Views/users/index.cshtml
index 3d131dc..5521069 100644
--- a/Areas/admin/Views/users/index.cshtml
+++ b/Areas/admin/Views/users/index.cshtml
@@ -21,6 +21,9 @@
Email Address
+
+ Registration Time
+
Last Login Time
@@ -41,6 +44,9 @@
@Html.DisplayFor(modelItem => mu.Email)
+
+ @Html.DisplayFor(modelItem => mu.CreationDate)
+
@Html.DisplayFor(modelItem => mu.LastLoginDate)
diff --git a/BuildFeed.csproj b/BuildFeed.csproj
index 8683e27..6bcb99c 100644
--- a/BuildFeed.csproj
+++ b/BuildFeed.csproj
@@ -173,7 +173,6 @@
-
@@ -310,6 +309,8 @@
+
+
diff --git a/Controllers/buildController.cs b/Controllers/buildController.cs
deleted file mode 100644
index 9507168..0000000
--- a/Controllers/buildController.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using BuildFeed.Models;
-using System;
-using System.Linq;
-using System.Web.Mvc;
-
-namespace BuildFeed.Controllers
-{
- public class buildController : Controller
- {
- public static int pageSize { get { return 25; } }
- //
- // GET: /build/
-
- public ActionResult index(int page = 1)
- {
- return RedirectToActionPermanent("index", "front");
- }
-
- public ActionResult year(int year, int page = 1)
- {
- var builds = Build.SelectInBuildOrder().Where(b => b.BuildTime.HasValue && b.BuildTime.Value.Year == year);
- var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
-
- ViewBag.PageNumber = page;
- ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
-
- return View("index", pageBuilds);
- }
-
- public ActionResult lab(string lab, int page = 1)
- {
- return RedirectToActionPermanent("viewLab", "front", new { lab = lab });
- }
-
- public ActionResult version(int major, int minor, int page = 1)
- {
- var builds = Build.SelectInBuildOrder().Where(b => b.MajorVersion == major && b.MinorVersion == minor);
- var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
-
- ViewBag.PageNumber = page;
- ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
-
- return View("index", pageBuilds);
- }
-
- public ActionResult source(TypeOfSource source, int page = 1)
- {
- var builds = Build.SelectInBuildOrder().Where(b => b.SourceType == source);
- var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
-
- ViewBag.PageNumber = page;
- ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
-
- return View("index", pageBuilds);
- }
-
- //
- // GET: /build/Info/5
-
- public ActionResult info(int id)
- {
- return RedirectToActionPermanent("viewBuild", "front", new { id = id });
- }
- }
-}
diff --git a/Controllers/frontController.cs b/Controllers/frontController.cs
index 10e6050..da8f0ae 100644
--- a/Controllers/frontController.cs
+++ b/Controllers/frontController.cs
@@ -11,7 +11,7 @@ namespace BuildFeed.Controllers
{
public class frontController : Controller
{
- private const int _pageSize = 84;
+ public const int _pageSize = 84;
[Route("", Order = 1)]
#if !DEBUG
@@ -114,6 +114,33 @@ public ActionResult viewSource(TypeOfSource source)
return View(builds);
}
+ [Route("year/{year}/")]
+#if !DEBUG
+ [OutputCache(Duration = 600, VaryByParam = "none")]
+#endif
+ public ActionResult viewYear(int year)
+ {
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Year, Value = year.ToString() });
+ ViewBag.ItemId = year.ToString();
+
+ var builds = Build.SelectInBuildOrder().Where(b => b.BuildTime.HasValue && b.BuildTime.Value.Year == year);
+ return View(builds);
+ }
+
+ [Route("version/{major}.{minor}/")]
+#if !DEBUG
+ [OutputCache(Duration = 600, VaryByParam = "none")]
+#endif
+ public ActionResult viewVersion(int major, int minor)
+ {
+ string valueString = string.Format("{0}.{1}", major, minor);
+ ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Version, Value = valueString });
+ ViewBag.ItemId = valueString;
+
+ var builds = Build.SelectInBuildOrder().Where(b => b.MajorVersion == major && b.MinorVersion == minor);
+ return View(builds);
+ }
+
[Route("add/"), Authorize]
public ActionResult addBuild()
{
diff --git a/Controllers/supportController.cs b/Controllers/supportController.cs
index d4568aa..79cf88b 100644
--- a/Controllers/supportController.cs
+++ b/Controllers/supportController.cs
@@ -145,7 +145,7 @@ public ActionResult sitemap()
action = "index",
page = 1
}),
- Pages = (builds.Count() + (buildController.pageSize - 1)) / buildController.pageSize
+ Pages = (builds.Count() + (frontController._pageSize - 1)) / frontController._pageSize
} });
actions.Add("Versions", (from b in builds
@@ -163,7 +163,7 @@ bv.Key.Minor descending
minor = bv.Key.Minor,
page = 1
}),
- Pages = (bv.Count() + (buildController.pageSize - 1)) / buildController.pageSize
+ Pages = (bv.Count() + (frontController._pageSize - 1)) / frontController._pageSize
}).ToArray());
actions.Add("Labs", (from b in builds
@@ -180,7 +180,7 @@ orderby bv.Key
lab = bv.Key,
page = 1
}),
- Pages = (bv.Count() + (buildController.pageSize - 1)) / buildController.pageSize
+ Pages = (bv.Count() + (frontController._pageSize - 1)) / frontController._pageSize
}).ToArray());
actions.Add("Years", (from b in builds
@@ -197,7 +197,7 @@ orderby bv.Key
year = bv.Key,
page = 1
}),
- Pages = (bv.Count() + (buildController.pageSize - 1)) / buildController.pageSize
+ Pages = (bv.Count() + (frontController._pageSize - 1)) / frontController._pageSize
}).ToArray());
actions.Add("Sources", (from b in builds
@@ -213,7 +213,7 @@ orderby bv.Key
source = bv.Key,
page = 1
}),
- Pages = (bv.Count() + (buildController.pageSize - 1)) / buildController.pageSize
+ Pages = (bv.Count() + (frontController._pageSize - 1)) / frontController._pageSize
}).ToArray());
SitemapData model = new SitemapData()
diff --git a/Models/MetaItem.cs b/Models/MetaItem.cs
index f9cdd51..13ba3f3 100644
--- a/Models/MetaItem.cs
+++ b/Models/MetaItem.cs
@@ -98,6 +98,25 @@ public static IEnumerable SelectUnusedVersions()
}
}
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public static IEnumerable SelectUnusedYears()
+ {
+
+ using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
+ {
+ var client = rClient.As();
+ var years = Build.SelectBuildYears();
+
+ var usedYears = from u in client.GetAll()
+ where u.Id.Type == MetaType.Year
+ select u;
+
+ return from y in years
+ where !usedYears.Any(ul => ul.Id.Value == y.ToString())
+ select y.ToString();
+ }
+ }
+
[DataObjectMethod(DataObjectMethodType.Insert, true)]
public static void Insert(MetaItem item)
{
@@ -161,6 +180,7 @@ public enum MetaType
{
Lab,
Version,
- Source
+ Source,
+ Year
}
}
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 7e81bd0..1398e41 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BuildFeed")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCopyright("Copyright © 2015, Thomas Hounsell")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/Views/front/viewBuild.cshtml b/Views/front/viewBuild.cshtml
index 927cf33..bfccf99 100644
--- a/Views/front/viewBuild.cshtml
+++ b/Views/front/viewBuild.cshtml
@@ -89,7 +89,7 @@
{
@Html.DisplayFor(model => model.BuildTime, "{0:yyMMdd-HHmm}")
- Find more builds compiled in @Model.BuildTime.Value.Year
+ Find more builds compiled in @Model.BuildTime.Value.Year
}
diff --git a/Views/front/viewVersion.cshtml b/Views/front/viewVersion.cshtml
new file mode 100644
index 0000000..49f47d8
--- /dev/null
+++ b/Views/front/viewVersion.cshtml
@@ -0,0 +1,68 @@
+@model IEnumerable
+@using Humanizer;
+@{
+ ViewBag.Title = string.Format("Windows NT {0} | BuildFeed", ViewBag.ItemId);
+}
+
+@section head
+{
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
+}
+
+@string.Format("Windows NT {0}", ViewBag.ItemId)
+@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
+{
+ About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
+}
+Share
+
+Listing
+
+ @foreach (var build in Model)
+ {
+
+
@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)
+
+ Info
+ @if (User.Identity.IsAuthenticated)
+ {
+ Edit
+ if (Roles.IsUserInRole("Administrators"))
+ {
+ Delete
+ }
+ }
+
+
+ @if (!string.IsNullOrEmpty(build.Lab))
+ {
+ @build.Lab
+ }
+ @if (build.BuildTime.HasValue)
+ {
+ @build.BuildTime.Value.ToString("d MMMM yyyy")
+ @build.BuildTime.Value.ToString("h:mm tt")
+ }
+
+
+ @if (build.IsLeaked)
+ {
+ Leaked
+ }
+ else
+ {
+ Unleaked
+ }
+
+
+ }
+
+@section scripts
+{
+
+}
\ No newline at end of file
diff --git a/Views/front/viewYear.cshtml b/Views/front/viewYear.cshtml
new file mode 100644
index 0000000..4a7db64
--- /dev/null
+++ b/Views/front/viewYear.cshtml
@@ -0,0 +1,73 @@
+@model IEnumerable
+@using Humanizer;
+@{
+ ViewBag.Title = string.Format("Builds from {0} | BuildFeed", ViewBag.ItemId);
+}
+
+@section head
+{
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
+ else
+ {
+
+
+ }
+}
+
+@string.Format("Builds from {0}", ViewBag.ItemId)
+@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
+{
+ About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
+}
+Share
+
+Listing
+
+ @foreach (var build in Model)
+ {
+
+
@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)
+
+ Info
+ @if (User.Identity.IsAuthenticated)
+ {
+ Edit
+ if (Roles.IsUserInRole("Administrators"))
+ {
+ Delete
+ }
+ }
+
+
+ @if (!string.IsNullOrEmpty(build.Lab))
+ {
+ @build.Lab
+ }
+ @if (build.BuildTime.HasValue)
+ {
+ @build.BuildTime.Value.ToString("d MMMM yyyy")
+ @build.BuildTime.Value.ToString("h:mm tt")
+ }
+
+
+ @if (build.IsLeaked)
+ {
+ Leaked
+ }
+ else
+ {
+ Unleaked
+ }
+
+
+ }
+
+@section scripts
+{
+
+}
\ No newline at end of file
diff --git a/Views/shared/_default.cshtml b/Views/shared/_default.cshtml
index b659b70..b569ca0 100644
--- a/Views/shared/_default.cshtml
+++ b/Views/shared/_default.cshtml
@@ -47,6 +47,18 @@
@Html.ActionLink("BuildFeed", "index", new { controller = "front", area = "" }, new { @class = "navbar-brand" })