#17032: Fixing gallery download link. Moving Project URL to the Views as additional information.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-12-10 16:06:22 -08:00
parent ba9391841a
commit ae6d186341
5 changed files with 14 additions and 8 deletions

View File

@@ -52,19 +52,22 @@ namespace Orchard.Packaging.Services {
private IEnumerable<PackagingEntry> GetExtensionList(string filter = null, PackagingSource packagingSource = null) {
return (packagingSource == null ? GetSources() : new[] {packagingSource})
.SelectMany(
source =>
new GalleryFeedContext(new Uri(source.FeedUrl)).Packages
.Where(p => p.PackageType == filter)
.ToList()
.Select(p => CreatePackageEntry(p, packagingSource))
source => {
GalleryFeedContext galleryFeedContext = new GalleryFeedContext(new Uri(source.FeedUrl));
return galleryFeedContext.Packages
.Where(p => p.PackageType == filter)
.ToList()
.Select(p => CreatePackageEntry(p, packagingSource, galleryFeedContext.GetReadStreamUri(p)));
}
).ToArray();
}
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PackagingSource source) {
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PackagingSource source, Uri downloadUri) {
return new PackagingEntry {
Title = String.IsNullOrWhiteSpace(package.Title) ? package.Id : package.Title,
PackageId = package.Id,
PackageStreamUri = package.ProjectUrl != null ? package.ProjectUrl.ToString() : String.Empty,
PackageStreamUri = downloadUri.ToString(),
ProjectUrl = package.ProjectUrl,
Source = source,
Version = package.Version ?? String.Empty,
Description = package.Description,