#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

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Linq;
using System.Web.Hosting;
using System.Web.Mvc;

View File

@@ -1,4 +1,3 @@
using System;
using Orchard.Packaging.Models;
@@ -9,6 +8,7 @@ namespace Orchard.Packaging.Services {
public string PackageId { get; set; }
public string Version { get; set; }
public string PackageStreamUri { get; set; }
public string ProjectUrl { get; set; }
public DateTime LastUpdated { get; set; }
public string Authors { get; set; }
public string Description { get; set; }

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,

View File

@@ -36,6 +36,7 @@
<ul class="pageStatus">
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", item.Authors)</li>
<li>&nbsp;&#124;&nbsp;@T("Project Url: ")<a href="@item.ProjectUrl">@item.ProjectUrl</a></li>
</ul>
</div>
</li>}

View File

@@ -36,6 +36,7 @@
<ul class="pageStatus">
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", item.Authors)</li>
<li>&nbsp;&#124;&nbsp;@T("Project Url: ")<a href="@item.ProjectUrl">@item.ProjectUrl</a></li>
</ul>
</div>
</li>}