diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index 67669dee2a..7a9c6c8ac2 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -85,6 +85,7 @@
+
diff --git a/MediaBrowser.Api/PackageReviewService.cs b/MediaBrowser.Api/PackageReviewService.cs
new file mode 100644
index 0000000000..1aca596c0e
--- /dev/null
+++ b/MediaBrowser.Api/PackageReviewService.cs
@@ -0,0 +1,80 @@
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Common.Constants;
+using MediaBrowser.Common.Net;
+using ServiceStack.ServiceHost;
+
+namespace MediaBrowser.Api
+{
+ ///
+ /// Class InstallPackage
+ ///
+ [Route("/PackageReviews/{Id}", "POST")]
+ [Api(("Creates or updates a package review"))]
+ public class CreateReviewRequest : IReturnVoid
+ {
+ ///
+ /// Gets or sets the Id.
+ ///
+ /// The Id.
+ [ApiMember(Name = "Id", Description = "Package Id", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "POST")]
+ public int Id { get; set; }
+
+ ///
+ /// Gets or sets the rating.
+ ///
+ /// The review.
+ [ApiMember(Name = "Rating", Description = "The rating value (1-5)", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int Rating { get; set; }
+
+ ///
+ /// Gets or sets the recommend value.
+ ///
+ /// Whether or not this review recommends this item.
+ [ApiMember(Name = "Recommend", Description = "Whether or not this review recommends this item", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")]
+ public bool Recommend { get; set; }
+
+ ///
+ /// Gets or sets the title.
+ ///
+ /// The title.
+ [ApiMember(Name = "Title", Description = "Optional short description of review.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
+ public string Title { get; set; }
+
+ ///
+ /// Gets or sets the full review.
+ ///
+ /// The full review.
+ [ApiMember(Name = "Review", Description = "Optional full review.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
+ public string Review { get; set; }
+ }
+
+
+ public class PackageReviewService : BaseApiService
+ {
+ private readonly IHttpClient _httpClient;
+ private readonly INetworkManager _netManager;
+
+ public PackageReviewService(IHttpClient client, INetworkManager net)
+ {
+ _httpClient = client;
+ _netManager = net;
+ }
+
+ public void Post(CreateReviewRequest request)
+ {
+ var review = new Dictionary
+ { { "id", request.Id.ToString(CultureInfo.InvariantCulture) },
+ { "mac", _netManager.GetMacAddress() },
+ { "rating", request.Rating.ToString(CultureInfo.InvariantCulture) },
+ { "recommend", request.Recommend.ToString() },
+ { "title", request.Title },
+ { "review", request.Review },
+ };
+
+ Task.WaitAll(_httpClient.Post(Constants.MbAdminUrl + "/service/packageReview/update", review, CancellationToken.None));
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Entities/PackageReviewInfo.cs b/MediaBrowser.Model/Entities/PackageReviewInfo.cs
new file mode 100644
index 0000000000..9d71622c3b
--- /dev/null
+++ b/MediaBrowser.Model/Entities/PackageReviewInfo.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class PackageReviewInfo
+ {
+ ///
+ /// The package id (database key) for this review
+ ///
+ public int id { get; set; }
+
+ ///
+ /// The rating value
+ ///
+ public int rating { get; set; }
+
+ ///
+ /// Whether or not this review recommends this item
+ ///
+ public bool recommend { get; set; }
+
+ ///
+ /// A short description of the review
+ ///
+ public string title { get; set; }
+
+ ///
+ /// A full review
+ ///
+ public string review { get; set; }
+
+ }
+}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index d641b27052..48f2987785 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -59,6 +59,7 @@
+
diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.cs
index 96e8456c08..13c4d6194b 100644
--- a/MediaBrowser.Model/Updates/PackageInfo.cs
+++ b/MediaBrowser.Model/Updates/PackageInfo.cs
@@ -117,6 +117,24 @@ namespace MediaBrowser.Model.Updates
/// The name.
public string guid { get; set; }
+ ///
+ /// Gets or sets the total number of machines who have checked registration for this package (if premium).
+ ///
+ /// The total hits.
+ public int totalHits { get; set; }
+
+ ///
+ /// Gets or sets the total number of ratings for this package.
+ ///
+ /// The total ratings.
+ public int totalRatings { get; set; }
+
+ ///
+ /// Gets or sets the average rating for this package .
+ ///
+ /// The rating.
+ public float avgRating { get; set; }
+
///
/// Gets or sets whether or not this package is registered.
///
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 1c6cdad39b..be821922fe 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -453,7 +453,7 @@ namespace MediaBrowser.WebDashboard.Api
"extensions.js",
"site.js",
"librarybrowser.js",
-
+ "ratingdialog.js",
"aboutpage.js",
"allusersettings.js",
"alphapicker.js",
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index 3254b84f36..151e62462f 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -3569,6 +3569,16 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
url: url
});
};
+
+ self.createPackageReview = function(review) {
+
+ var url = self.getUrl("PackageReviews/" + review.id, review);
+
+ return self.ajax({
+ type: "POST",
+ url: url,
+ });
+ };
}
}(jQuery, navigator, window.JSON, window.WebSocket, setTimeout, window);
diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
index 4d12fa7709..8725435d42 100644
--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
@@ -332,6 +332,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest