201 lines
6.7 KiB
Plaintext
201 lines
6.7 KiB
Plaintext
@using OurUmbraco.Project
|
|
@using OurUmbraco.Repository.Services
|
|
@using Umbraco.Core
|
|
@using Umbraco.Web
|
|
@{
|
|
System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
|
|
|
|
var ProjectsProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider();
|
|
int projectId;
|
|
if (int.TryParse(Request.QueryString["project_id"], out projectId) == false)
|
|
{
|
|
//TODO: Exception probably !
|
|
return;
|
|
}
|
|
|
|
var qs = Request.RawUrl.Substring(Request.RawUrl.IndexOf('?') + 1).Replace("&project_id=" + projectId, "");
|
|
var callback = Request.QueryString["callback"];
|
|
|
|
var Project = ProjectsProvider.GetListing(projectId, false);
|
|
if (Project == null)
|
|
{
|
|
throw new InvalidOperationException("No project found with id " + projectId);
|
|
}
|
|
|
|
var node = new umbraco.NodeFactory.Node(projectId);
|
|
var parentId = node.Parent.Id;
|
|
var categoryName = node.Parent.Name;
|
|
|
|
var pUrl = "repo/project?id=";
|
|
|
|
string descCssClass = "noWrap";
|
|
string ProjectCompatitbleWithUmbraco = "4.0";
|
|
string ProjectCompatitbleWithDotNet = "4.0";
|
|
string ProjectCompatitbleWithMediumTrust = "No";
|
|
|
|
if (Project.Description.Length > 2000)
|
|
{
|
|
descCssClass = "wrap";
|
|
}
|
|
|
|
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
|
|
var packageRepoService = new PackageRepositoryService(umbracoHelper, umbracoHelper.MembershipHelper, ApplicationContext.Current.DatabaseContext);
|
|
//This doesn't matter what we set it to so long as it's below 7.5 since that is the version we introduce strict dependencies
|
|
var currUmbracoVersion = new Version(4, 0, 0);
|
|
var packageDetails = packageRepoService.GetDetails(Project.ProjectGuid, currUmbracoVersion, false);
|
|
|
|
if (packageDetails == null)
|
|
{
|
|
throw new InvalidOperationException("No package found with id " + Project.ProjectGuid);
|
|
}
|
|
|
|
if (packageDetails.ZipUrl.IsNullOrWhiteSpace())
|
|
{
|
|
throw new InvalidOperationException("This package is not compatible with the Umbraco version " + currUmbracoVersion);
|
|
}
|
|
|
|
int currentReleaseFile = 0;
|
|
if (int.TryParse(Project.CurrentReleaseFile, out currentReleaseFile))
|
|
{
|
|
var file = Project.PackageFile.FirstOrDefault(x => x.Id == currentReleaseFile);
|
|
if (file != null)
|
|
{
|
|
var ct = "This project is compaitible with ";
|
|
var c = file.UmbVersion.Count;
|
|
|
|
var coms = file.UmbVersion;
|
|
|
|
if (c > 2)
|
|
{
|
|
coms = file.UmbVersion.Take(2).ToList();
|
|
}
|
|
|
|
foreach (var com in coms)
|
|
{
|
|
|
|
ct += com.Name + ", ";
|
|
}
|
|
|
|
ct = ct.Trim().TrimEnd(',');
|
|
|
|
if (c > 2)
|
|
{
|
|
ct += " and " + (c - 2) + " other versions.";
|
|
}
|
|
|
|
ProjectCompatitbleWithUmbraco = ct;
|
|
ProjectCompatitbleWithDotNet = file.DotNetVersion;
|
|
ProjectCompatitbleWithMediumTrust = (file.SupportsMediumTrust) ? "Yes" : "No";
|
|
}
|
|
}
|
|
}
|
|
<script type="text/javascript">
|
|
jQuery("#projectDescriptionText a").click(function (event) { event.preventDefault(); });
|
|
</script>
|
|
|
|
<ul id="breadcrumb">
|
|
<li><a href="/repo?@qs">Repository</a> →</li>
|
|
<li><a href="/repo_category?@qs&category_id=@parentId">@categoryName</a> →</li>
|
|
<li>@Project.Name</li>
|
|
</ul>
|
|
|
|
<div id="project">
|
|
@if (string.IsNullOrWhiteSpace(packageDetails.ZipUrl) == false)
|
|
{
|
|
<h1 class="projectName">
|
|
<span>@Project.Name</span>
|
|
<a href="#" title="@Project.Name" rel="@Project.ProjectGuid" class="btn">Install package</a>
|
|
</h1>
|
|
}
|
|
else if (currentReleaseFile != 0)
|
|
{
|
|
<span style="color: red;">Unfortunately, this package is not compatible with the version of Umbraco you are running.</span><br />
|
|
<a href="https://our.umbraco.org/@node.NiceUrl" target="_blank">Go to the package page to learn more</a>
|
|
}
|
|
else
|
|
{
|
|
<span style="color: red;">Unfortunately, this package has no current release file to install at the moment.</span><br />
|
|
<a href="https://our.umbraco.org/@node.NiceUrl" target="_blank">Go to the package page to learn more</a>
|
|
}
|
|
<div class="meta">
|
|
|
|
<div class="box">
|
|
|
|
<dl class="projetProps summary">
|
|
<dt>Project owner:</dt>
|
|
@{
|
|
|
|
var ownerName = umbracoHelper.MembershipHelper.GetById(Project.VendorId).Name;
|
|
}
|
|
<dd>@ownerName</dd>
|
|
|
|
<dt>Package downloads</dt>
|
|
<dd>@Project.Downloads</dd>
|
|
|
|
<dt>Package karma</dt>
|
|
<dd>@Project.Karma</dd>
|
|
|
|
<dt>Compatibility:</dt>
|
|
<dd>
|
|
@ProjectCompatitbleWithUmbraco<br />
|
|
.NET Version: @ProjectCompatitbleWithDotNet<br />
|
|
Supports Medium Trust: @ProjectCompatitbleWithMediumTrust
|
|
</dd>
|
|
<dt>Created:</dt>
|
|
<dd>
|
|
@Project.CreateDate.ToString("D")
|
|
</dd>
|
|
|
|
@if (Project.Stable)
|
|
{
|
|
<dt>Is Stable:</dt>
|
|
<dd>
|
|
<span class="green">Project is stable</span>
|
|
</dd>
|
|
}
|
|
<dt>Current version</dt>
|
|
<dd>
|
|
@Project.CurrentVersion
|
|
</dd>
|
|
@if (!string.IsNullOrEmpty(Project.LicenseName))
|
|
{
|
|
<dt>License</dt>
|
|
<dd>
|
|
<a target="_blank" href="@Project.LicenseUrl">@Project.LicenseName</a>
|
|
</dd>
|
|
}
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
|
|
<div id="projectDescriptionText" class="@descCssClass">
|
|
@Html.Raw(Project.Description.CleanHtmlAttributes())
|
|
</div>
|
|
|
|
<div class="divider" style="clear:left;"></div>
|
|
|
|
@if (Project.ScreenShots.Count() > 0)
|
|
{
|
|
|
|
<div id="projectScreenshots">
|
|
<h2>Screenshots</h2>
|
|
@foreach (var image in Project.ScreenShots)
|
|
{
|
|
if (image.Path.EndsWith("gif") ||
|
|
image.Path.EndsWith("png") ||
|
|
image.Path.EndsWith("jpg") ||
|
|
image.Path.EndsWith("jpeg"))
|
|
{
|
|
<a href="@image.Path" class="projectscreenshot" rel="shadowbox[gallery]">
|
|
<img src="@image.Path?bgcolor=fff&width=100&height=100&format=png" style="border: 0;" />
|
|
</a>
|
|
}
|
|
}
|
|
</div>
|
|
|
|
<div class="divider" style="clear:left;"></div>
|
|
}
|
|
|
|
</div>
|