diff --git a/Marketplace/Controllers/ProjectCompatibilityReportController.cs b/Marketplace/Controllers/ProjectCompatibilityReportController.cs index b16960f9..3cf5aa4e 100644 --- a/Marketplace/Controllers/ProjectCompatibilityReportController.cs +++ b/Marketplace/Controllers/ProjectCompatibilityReportController.cs @@ -1,9 +1,8 @@ -using System; -using System.Web.Mvc; +using System.Web.Mvc; +using our; using uProject.Models; using uProject.Services; using uProject.uVersion; -using Umbraco.Core.Models; using Umbraco.Web.Mvc; namespace uProject.Controllers @@ -21,7 +20,7 @@ namespace uProject.Controllers new VersionCompatibilityReportModel { VersionCompatibilities = compatReport.GetCompatibilityReport(projectId), - CurrentMemberHasDownloaded = currentMember != null && uProject.library.HasDownloaded(currentMember.Id, projectId), + CurrentMemberHasDownloaded = currentMember != null && Utils.HasMemberDownloadedPackage(currentMember.Id, projectId), CurrentMemberIsLoggedIn = currentMember != null, FileId = fileId, ProjectId = projectId, diff --git a/Marketplace/ProjectFileUploadHandler.cs b/Marketplace/ProjectFileUploadHandler.cs index 43d07eab..7d4199eb 100644 --- a/Marketplace/ProjectFileUploadHandler.cs +++ b/Marketplace/ProjectFileUploadHandler.cs @@ -5,12 +5,11 @@ using System.Web; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.member; -using Marketplace.Providers; using our; -using Marketplace.Providers.MediaFile; using OurUmbraco.MarketPlace.Interfaces; using OurUmbraco.Wiki.BusinessLogic; -using UmbracoVersion = Marketplace.Umbraco.BusinessLogic.UmbracoVersion; +using Umbraco.Core; +using Umbraco.Web; namespace uProject { @@ -51,20 +50,19 @@ namespace uProject } - if (!string.IsNullOrEmpty(userguid) && !string.IsNullOrEmpty(projectguid) && !string.IsNullOrEmpty(fileType) && !string.IsNullOrEmpty(fileName)) { - - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var p = provider.GetListing(new Guid(projectguid)); + if (!string.IsNullOrEmpty(userguid) && !string.IsNullOrEmpty(projectguid) && !string.IsNullOrEmpty(fileType) && !string.IsNullOrEmpty(fileName)) + { + var nodeListingProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider(); + var p = nodeListingProvider.GetListing(new Guid(projectguid)); Member mem = new Member(new Guid(userguid)); - if (p.Vendor != null && p.Vendor.Member.Id == mem.Id || Utils.IsProjectContributor(mem.Id, p.Id)) + if (p.Vendor != null && p.VendorId == mem.Id || Utils.IsProjectContributor(mem.Id, p.Id)) { - - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; + var mediaProvider = new OurUmbraco.MarketPlace.Providers.MediaProvider(); var packageFileType = (FileType)Enum.Parse(typeof(FileType), (string)fileType , true); - fileProvider.CreateFile(fileName, p.Version, mem.UniqueId, file, packageFileType, v, dotNetVersion, trust); + mediaProvider.CreateFile(fileName, p.Version, mem.UniqueId, file, packageFileType, v, dotNetVersion, trust); } else { umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 0, "wrong type or not a owner"); diff --git a/Marketplace/Services/VersionCompatibilityService.cs b/Marketplace/Services/VersionCompatibilityService.cs index 0eded40a..a930ac46 100644 --- a/Marketplace/Services/VersionCompatibilityService.cs +++ b/Marketplace/Services/VersionCompatibilityService.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Marketplace.Providers; -using OurUmbraco.MarketPlace.Interfaces; using uProject.Models; using uProject.uVersion; using Umbraco.Core; @@ -37,8 +35,8 @@ namespace uProject.Services public IEnumerable GetCompatibilityReport(int projectId) { var uVersions = UVersion.GetAllVersions(); - var projectProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var project = projectProvider.GetListing(projectId, false); + var projectProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider(); + var project = projectProvider.GetListing(projectId, true); var compatList = new List(); diff --git a/Marketplace/library.cs b/Marketplace/library.cs deleted file mode 100644 index 9e9ef7e2..00000000 --- a/Marketplace/library.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Marketplace.Providers; -using umbraco; -using our; -using System.Text.RegularExpressions; -using umbraco.NodeFactory; -using System.Globalization; -using OurUmbraco.MarketPlace.Interfaces; - -namespace uProject -{ - [XsltExtension("deli.library")] - public class library - { - - public static bool HasVendorAccess(int pageId) - { - var page = new umbraco.NodeFactory.Node(pageId); - - if (page.GetProperty("vendorOnly") != null) - { - var memberProvider = (IMemberProvider)MarketplaceProviderManager.Providers["MemberProvider"]; - var member = memberProvider.GetCurrentMember(); - - var vendorOnly = page.GetProperty("vendorOnly").Value == "1" ? true : false; - if (vendorOnly) - { - if (member.IsDeliVendor) - return true; - else - return false; - } - return true; - } - return true; - - } - - public static string ShortenText(string text) - { - text = Utils.StripHTML(text).Replace(" ", ""); - if (text.Length > 210) - { - - text = text.Substring(0, 210); - text = text.Substring(0, text.LastIndexOf(' ')); - } - - text = Regex.Replace(text, @"[^a-zA-Z0-9\s.?!&;]", ""); //strip all crap from the listing such as ======================================= !!!! - return text.Trim(); - } - - - - public static string GetTagsAsCSV(IEnumerable tagList) - { - var tags = string.Empty; - int counter = 0; - - foreach (var t in tagList) - { - tags += t.Text + ", "; - counter++; - - if (counter > 3) - break; - } - - if (tags.Length > 0) - { - tags = tags.Substring(0, tags.Length - 2); - } - return tags; - } - - public static string GetCategoryName(int projectId) - { - var node = new Node(projectId); - return node.Parent.Name; - - } - - - - - public static string GetDefaultScreenshot(string prop) - { - return !String.IsNullOrEmpty(prop) ? "/umbraco/imagegen.ashx?image=" + prop + "&pad=true&width=50&height=50;" : "/css/img/package2.png"; - } - - public static string GetManufacturerName(IVendor vendor) - { - if (!string.IsNullOrEmpty(vendor.VendorCompanyName)) - { - return vendor.VendorCompanyName; - } - else - { - return vendor.Member.Name; - } - - } - - public static string GetCountry(string code) - { - - - foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) - { - - RegionInfo ri = new RegionInfo(ci.LCID); - if (ri.TwoLetterISORegionName.ToLowerInvariant() == code) - return ri.EnglishName; - } - - return ""; - - } - - - /// - /// Check to see if member has reported on compatibility for a package regardless of version of the package - /// - /// The members Id - /// The package Id - /// - public static bool HasDownloaded(int memberId, int packageId) - { - return Utils.GetProjectMemberVotes(packageId, memberId) > 0; - } - } -} \ No newline at end of file diff --git a/Marketplace/uProject.csproj b/Marketplace/uProject.csproj index 6fad9d1f..12ef65db 100644 --- a/Marketplace/uProject.csproj +++ b/Marketplace/uProject.csproj @@ -114,25 +114,6 @@ ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll True - - False - ..\dependencies\MarketPlace\Marketplace.BusinessLogic.dll - - - False - ..\dependencies\MarketPlace\Marketplace.Presentation.dll - - - False - ..\dependencies\MarketPlace\Marketplace.Providers.dll - - - False - ..\dependencies\MarketPlace\Marketplace.Umbraco.dll - - - ..\dependencies\MarketPlace\MarketPlace.Webservices.dll - ..\packages\UmbracoCms.Core.7.2.8-build103\lib\Microsoft.ApplicationBlocks.Data.dll True @@ -286,7 +267,6 @@ - @@ -308,13 +288,6 @@ Complete.ascx - - Licenses.ascx - ASPXCodeBehind - - - Licenses.ascx - Screenshots.ascx ASPXCodeBehind @@ -355,7 +328,6 @@ - diff --git a/Marketplace/usercontrols/Deli/Package/Editor.ascx.cs b/Marketplace/usercontrols/Deli/Package/Editor.ascx.cs index a8c4126d..ac10c3ec 100644 --- a/Marketplace/usercontrols/Deli/Package/Editor.ascx.cs +++ b/Marketplace/usercontrols/Deli/Package/Editor.ascx.cs @@ -1,23 +1,23 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -using umbraco.IO; -using Marketplace.BusinessLogic.ListingCreator; -using Marketplace.BusinessLogic.ListingCreator.StepDefinitions; -using Marketplace.Providers; -using umbraco.cms.businesslogic.member; using our; +using OurUmbraco.MarketPlace.BusinessLogic.ListingCreator; using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using umbraco.cms.businesslogic.member; +using umbraco.IO; +using uProject.usercontrols.Deli.Package.Steps; +using Umbraco.Web.UI.Controls; +using Complete = OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions.Complete; +using Files = OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions.Files; +using Screenshots = OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions.Screenshots; namespace uProject.usercontrols.Deli.Package { - public partial class Editor : System.Web.UI.UserControl + public partial class Editor : UmbracoUserControl { private string _currentStep = ""; - private static IVendor _vendor; private static IListingItem _project; public string _currentStepClass = "current"; @@ -34,7 +34,7 @@ namespace uProject.usercontrols.Deli.Package } - protected void Page_Load(object sender, System.EventArgs e) + protected void Page_Load(object sender, EventArgs e) { StepNavigation.DataSource = ListingSteps().Values; StepNavigation.DataBind(); @@ -44,10 +44,10 @@ namespace uProject.usercontrols.Deli.Package private void loadContent(ListingCreatorStep currentStep) { StepPlaceHolder.Controls.Clear(); - var controlToLoad = new System.Web.UI.UserControl().LoadControl(IOHelper.ResolveUrl(currentStep.UserControl)); + var controlToLoad = new UserControl().LoadControl(IOHelper.ResolveUrl(currentStep.UserControl)); if (currentStep.Alias == "details") - ((uProject.usercontrols.Deli.Package.Steps.Details)controlToLoad).IsDeliVendor = _vendor.Member.IsDeliVendor; + ((Details)controlToLoad).IsDeliVendor = false; StepPlaceHolder.Controls.Add(controlToLoad); Step.Value = currentStep.Alias; @@ -62,7 +62,7 @@ namespace uProject.usercontrols.Deli.Package if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { - ListingCreatorStep i = (ListingCreatorStep)e.Item.DataItem; + var i = (ListingCreatorStep)e.Item.DataItem; if (!i.HideFromNavigation) { @@ -92,7 +92,7 @@ namespace uProject.usercontrols.Deli.Package public void GotoNextStep(string currentStep, int projectId) { ListingSteps().Get(currentStep).Completed = true; - ListingCreatorStep _s = ListingSteps().GotoNextStep(currentStep); + var _s = ListingSteps().GotoNextStep(currentStep); Response.Redirect("edit?editorStep=" + _s.Alias + "&id=" + projectId); } @@ -109,17 +109,16 @@ namespace uProject.usercontrols.Deli.Package InitializeComponent(); base.OnInit(e); - - - _vendor = ((IVendorProvider)MarketplaceProviderManager.Providers["VendorProvider"]).GetVendorById(Member.GetCurrentMember().Id); - if (_projectId != null) { - _project = ((IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]).GetListing((int)_projectId); - + var nodeListingProvider = new NodeListingProvider(); + _project = nodeListingProvider.GetListing((int)_projectId); //check security to make sure the project belongs to the vendor - if (!((_project.Vendor.Member.Id == _vendor.Member.Id) || Utils.IsProjectContributor(_vendor.Member.Id, (int)_projectId))) + var currentMemberId = Members.GetCurrentMemberId(); + var vendorIsCurrentMember = (_project.VendorId == currentMemberId); + var isProjectContributor = Utils.IsProjectContributor(currentMemberId, (int)_projectId); + if ((vendorIsCurrentMember || isProjectContributor) == false) { //this project does not belong to this member so kick them back to the project list in their profile. Response.Redirect("~/member/profile/projects/"); @@ -147,21 +146,16 @@ namespace uProject.usercontrols.Deli.Package } #endregion - - - + private static ListingCreatorStepCollection ListingSteps() { - ListingCreatorStepCollection lcs = new ListingCreatorStepCollection(); - lcs.Add(new Details(), _vendor.Member.IsDeliVendor); - lcs.Add(new Files(), _vendor.Member.IsDeliVendor); - lcs.Add(new Screenshots(), _vendor.Member.IsDeliVendor); - - //only add the licensing step is the project is commercial - if (_project != null) - lcs.Add(new Licenses(), (_project.ListingType == ListingType.commercial && _vendor.Member.IsDeliVendor)); - - lcs.Add(new Complete(), _vendor.Member.IsDeliVendor); + var lcs = new ListingCreatorStepCollection + { + { new OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions.Details(), false }, + { new Files(), false }, + { new Screenshots(), false }, + { new Complete(), false } + }; return lcs; } } diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Complete.ascx.cs b/Marketplace/usercontrols/Deli/Package/Steps/Complete.ascx.cs index 8b9239b8..670b7816 100644 --- a/Marketplace/usercontrols/Deli/Package/Steps/Complete.ascx.cs +++ b/Marketplace/usercontrols/Deli/Package/Steps/Complete.ascx.cs @@ -1,17 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; -using Marketplace.Providers; -using Marketplace.BusinessLogic; -using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; using uProject.Helpers; namespace uProject.usercontrols.Deli.Package.Steps { - public partial class Complete : System.Web.UI.UserControl + public partial class Complete : UserControl { public string NotificationClass; @@ -22,7 +16,7 @@ namespace uProject.usercontrols.Deli.Package.Steps { if (!string.IsNullOrEmpty(Request["id"])) { - _projectId = Int32.Parse(Request["id"]); + _projectId = int.Parse(Request["id"]); } return _projectId; } @@ -36,9 +30,9 @@ namespace uProject.usercontrols.Deli.Package.Steps { if (!IsPostBack) { - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; + var nodeListingProvider = new NodeListingProvider(); - IListingItem project = provider.GetListing((int)ProjectId); + var project = nodeListingProvider.GetListing((int)ProjectId); ProjectName.Text = project.Name; Live.Checked = project.Live; @@ -49,10 +43,10 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void Complete_Click(object sender, EventArgs e) { - var ProjectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var project = ProjectsProvider.GetListing((int)ProjectId); + var nodeListingProvider = new NodeListingProvider(); + var project = nodeListingProvider.GetListing((int)ProjectId); project.Live = Live.Checked; - ProjectsProvider.SaveOrUpdate(project); + nodeListingProvider.SaveOrUpdate(project); Response.Redirect(project.NiceUrl); } diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Details.ascx.cs b/Marketplace/usercontrols/Deli/Package/Steps/Details.ascx.cs index fc113c2d..81ba1905 100644 --- a/Marketplace/usercontrols/Deli/Package/Steps/Details.ascx.cs +++ b/Marketplace/usercontrols/Deli/Package/Steps/Details.ascx.cs @@ -3,15 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; -using Marketplace.Providers; -using Marketplace.Providers.Listing; -using Marketplace.Providers.ListingItem; using OurUmbraco.MarketPlace.Interfaces; using umbraco; using uProject.Helpers; using Umbraco.Core.Models; using Umbraco.Web.UI.Controls; -using Member = umbraco.cms.businesslogic.member.Member; namespace uProject.usercontrols.Deli.Package.Steps { @@ -81,7 +77,7 @@ namespace uProject.usercontrols.Deli.Package.Steps private void SetupTags() { string taglist = string.Empty; - var tagProvider = ((IProjectTagProvider)MarketplaceProviderManager.Providers["TagProvider"]); + var tagProvider = new OurUmbraco.MarketPlace.Providers.UmbracoProjectTagProvider(); var tags = tagProvider.GetAllTags(); foreach(var t in tags) { @@ -99,7 +95,8 @@ namespace uProject.usercontrols.Deli.Package.Steps private void BindCategories() { - var Categories = ((ICategoryProvider)MarketplaceProviderManager.Providers["CategoryProvider"]).GetAllCategories().Where(x => !x.HQOnly); + var categoryProvider = new OurUmbraco.MarketPlace.Providers.UmbracoCategoryProvider(); + var Categories = categoryProvider.GetAllCategories().Where(x => !x.HQOnly); Category.DataSource = Categories; Category.DataValueField = "Id"; Category.DataTextField = "Name"; @@ -108,8 +105,8 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void LoadProject() { - var ProjectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var project = ProjectsProvider.GetListing((int)ProjectId); + var nodeListingProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider(); + var project = nodeListingProvider.GetListing((int)ProjectId); Title.Text = project.Name; Description.Text = project.Description; @@ -128,7 +125,7 @@ namespace uProject.usercontrols.Deli.Package.Steps Collab.Checked = project.OpenForCollab; Terms.Checked = project.TermsAgreementDate != new DateTime(); - var tagProvider = ((IProjectTagProvider)MarketplaceProviderManager.Providers["TagProvider"]); + var tagProvider = new OurUmbraco.MarketPlace.Providers.UmbracoProjectTagProvider(); var projectTags = tagProvider.GetTagsByProjectId((int)ProjectId).ToList(); if (projectTags.Any()) @@ -151,7 +148,7 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void SaveStep(object sender, EventArgs e) { - var nodeListingProvider = new OurUmbraco.MarketPlace.NodeLising.NodeListingProvider(); + var nodeListingProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider(); var project = (_editMode) ? nodeListingProvider.GetListing((int)ProjectId) : new OurUmbraco.MarketPlace.ListingItem.ListingItem(null,null); project.Name = Title.Text; @@ -174,13 +171,12 @@ namespace uProject.usercontrols.Deli.Package.Steps project.TermsAgreementDate = DateTime.Now.ToUniversalTime(); - var ProjectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - ProjectsProvider.SaveOrUpdate(project); + nodeListingProvider.SaveOrUpdate(project); ProjectId = project.Id; if (Request["projecttags[]"] != null) { - ProjectsProvider.SaveOrUpdate(project); + nodeListingProvider.SaveOrUpdate(project); var tags = new List(); foreach (var tag in Request["projecttags[]"].Split(',')) diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Files.ascx.cs b/Marketplace/usercontrols/Deli/Package/Steps/Files.ascx.cs index 60ef4ba5..ba1840c7 100644 --- a/Marketplace/usercontrols/Deli/Package/Steps/Files.ascx.cs +++ b/Marketplace/usercontrols/Deli/Package/Steps/Files.ascx.cs @@ -1,23 +1,20 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -using Marketplace.Providers; -using umbraco.cms.businesslogic.member; using our; -using Marketplace.BusinessLogic; -using Marketplace.Umbraco.BusinessLogic; -using Marketplace.Providers.Helpers; -using uProject.Helpers; -using Marketplace.Providers.MediaFile; using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using OurUmbraco.MarketPlace.Providers; +using OurUmbraco.Wiki.BusinessLogic; using OurUmbraco.Wiki.Extensions; +using umbraco; +using umbraco.cms.businesslogic.member; +using uProject.Helpers; namespace uProject.usercontrols.Deli.Package.Steps { - public partial class Files : System.Web.UI.UserControl + public partial class Files : UserControl { public string MemberGuid = ""; @@ -50,8 +47,8 @@ namespace uProject.usercontrols.Deli.Package.Steps //called after upload. private void RebindFiles() { - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var files = fileProvider.GetMediaFilesByProjectId((int)ProjectId).Where(x => x.FileType != FileType.screenshot); + var mediaProvider = new MediaProvider(); + var files = mediaProvider.GetMediaFilesByProjectId((int)ProjectId).Where(x => x.FileType != FileType.screenshot.FileTypeAsString()); if (string.IsNullOrEmpty(_defaultFile)) { var defaultFile = files.OrderByDescending(x => x.CreateDate).FirstOrDefault(); @@ -61,7 +58,7 @@ namespace uProject.usercontrols.Deli.Package.Steps MarkFileAsCurrent(defaultFile.Id.ToString()); } } - + rp_packagefiles.DataSource = files; rp_packagefiles.Visible = (files.Count() > 0); @@ -71,33 +68,33 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void DeleteFile(object sender, CommandEventArgs e) { - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var f = fileProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); - + var mediaProvider = new MediaProvider(); + var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); + var mem = Member.GetCurrentMember(); if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) - //if the file is the default file we need to clear it out of the system to stop it showing as the default download - if (f.Id.ToString() == _defaultFile) - { - _defaultFile = string.Empty; - var listingProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var project = listingProvider.GetListing((int)ProjectId); - project.CurrentReleaseFile = _defaultFile; - listingProvider.SaveOrUpdate(project); + //if the file is the default file we need to clear it out of the system to stop it showing as the default download + if (f.Id.ToString() == _defaultFile) + { + _defaultFile = string.Empty; + var nodeListingProvider = new NodeListingProvider(); + var project = nodeListingProvider.GetListing((int)ProjectId); + project.CurrentReleaseFile = _defaultFile; + nodeListingProvider.SaveOrUpdate(project); - } - fileProvider.Remove(f); + } + + mediaProvider.Remove(f); RebindFiles(); } protected void ArchiveFile(object sender, CommandEventArgs e) { - - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var f = fileProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); + var mediaProvider = new MediaProvider(); + var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); if (e.CommandName == "Unarchive") { @@ -108,7 +105,7 @@ namespace uProject.usercontrols.Deli.Package.Steps f.Archived = true; } - fileProvider.SaveOrUpdate(f); + mediaProvider.SaveOrUpdate(f); RebindFiles(); } @@ -116,7 +113,7 @@ namespace uProject.usercontrols.Deli.Package.Steps { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { - IMediaFile f = (IMediaFile)e.Item.DataItem; + WikiFile f = (WikiFile)e.Item.DataItem; Literal _name = (Literal)e.Item.FindControl("lt_name"); Literal _date = (Literal)e.Item.FindControl("lt_date"); Button _delete = (Button)e.Item.FindControl("bt_delete"); @@ -127,7 +124,7 @@ namespace uProject.usercontrols.Deli.Package.Steps Literal _currentRelease = (Literal)e.Item.FindControl("lt_currentRelease"); Button _defaultPackageFile = (Button)e.Item.FindControl("bt_default"); - if (f.FileType == FileType.package) + if (f.FileType == FileType.package.FileTypeAsString()) { if (f.Id.ToString() == _defaultFile) { @@ -146,13 +143,13 @@ namespace uProject.usercontrols.Deli.Package.Steps { _defaultPackageFile.Visible = false; _currentRelease.Visible = false; - + } Button _archive = (Button)e.Item.FindControl("bt_archive"); _archive.CommandArgument = f.Id.ToString(); - + if (f.Archived) { @@ -165,40 +162,20 @@ namespace uProject.usercontrols.Deli.Package.Steps _archive.CommandName = "Archive"; } - if (f.FileType == FileType.screenshot) + if (f.FileType == FileType.screenshot.FileTypeAsString()) { _archive.Visible = false; } - if (f.UmbVersion != null) - _version.Text = f.UmbVersion.ToVersionString(); + if (f.Versions != null) + _version.Text = f.Versions.ToVersionString(); if (f.DotNetVersion != null) _dotNetVersion.Text = f.DotNetVersion; - _trustLevel.Text = (f.SupportsMediumTrust)?"Medium":"Full"; + _trustLevel.Text = (f.SupportsMediumTrust) ? "Medium" : "Full"; - - switch (f.FileType) - { - case FileType.screenshot: - _type.Text = "Screenshot"; - break; - case FileType.package: - _type.Text = "Package"; - break; - case FileType.hotfix: - _type.Text = "Hot Fix"; - break; - case FileType.docs: - _type.Text = "Document"; - break; - case FileType.source: - _type.Text = "Source"; - break; - default: - break; - } + _type.Text = f.FileType; _name.Text = "" + f.Name + ""; _date.Text = f.CreateDate.ToShortDateString() + " - " + f.CreateDate.ToShortTimeString(); @@ -216,10 +193,10 @@ namespace uProject.usercontrols.Deli.Package.Steps private void MarkFileAsCurrent(string releaseFile) { - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - IListingItem project = provider.GetListing((int)ProjectId); + var nodeListingProvider = new NodeListingProvider(); + IListingItem project = nodeListingProvider.GetListing((int)ProjectId); project.CurrentReleaseFile = releaseFile; - provider.SaveOrUpdate(project); + nodeListingProvider.SaveOrUpdate(project); _defaultFile = project.CurrentReleaseFile; } @@ -227,25 +204,25 @@ namespace uProject.usercontrols.Deli.Package.Steps { - if (umbraco.library.IsLoggedOn() && ProjectId != null) + if (library.IsLoggedOn() && ProjectId != null) { - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; + var nodeListingProvider = new NodeListingProvider(); Member mem = Member.GetCurrentMember(); - IListingItem project = provider.GetListing((int)ProjectId); + IListingItem project = nodeListingProvider.GetListing((int)ProjectId); _defaultFile = project.CurrentReleaseFile; - if ((project.Vendor.Member.Id == mem.Id) || + if ((project.VendorId == mem.Id) || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) { holder.Visible = true; RebindFiles(); - umbraco.library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js"); - umbraco.library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js"); - umbraco.library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js"); + library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js"); + library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js"); + library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js"); MemberGuid = mem.UniqueId.ToString(); ProjectGuid = project.ProjectGuid.ToString(); @@ -253,7 +230,7 @@ namespace uProject.usercontrols.Deli.Package.Steps string defaultVersion = UmbracoVersion.DefaultVersion().Version; string umboptions = ""; - foreach (UmbracoVersion uv in UmbracoVersion.AvailableVersions().Values) + foreach (OurUmbraco.Wiki.BusinessLogic.UmbracoVersion uv in UmbracoVersion.AvailableVersions().Values) { string selected = "checked='true'"; if (uv.Version != defaultVersion) @@ -263,8 +240,8 @@ namespace uProject.usercontrols.Deli.Package.Steps lt_versions.Text = umboptions; - - string[] dotnetversions = {"2.0","3.5","4.0", "4.5"}; + + string[] dotnetversions = { "2.0", "3.5", "4.0", "4.5" }; string dotnetoptions = string.Empty; foreach (var opt in dotnetversions) @@ -294,7 +271,7 @@ namespace uProject.usercontrols.Deli.Package.Steps lt_trustlevels.Text = trustoptions; - + } @@ -305,7 +282,7 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void SaveStep(object sender, EventArgs e) { //move to the file upload step - ProjectCreatorHelper.MoveToNextStep(this,(int)ProjectId); + ProjectCreatorHelper.MoveToNextStep(this, (int)ProjectId); } protected void MoveLast(object sender, EventArgs e) { diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx b/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx deleted file mode 100644 index 8586d4a9..00000000 --- a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx +++ /dev/null @@ -1,137 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Licenses.ascx.cs" Inherits="uProject.usercontrols.Deli.Package.Steps.Licenses" %> - -
- - -
- Edit License Type -

- - - -

- -

- - -

- -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
License TypePrice 
- - - - -   - - -
- -
- NOTE: Only licenses types that have not been purchased by users can be deleted. If a license has been purchased you may disable it. - -
- Create License Type -

- - - - - - - - -

- -

- - -

- -

- -

- -
-

Your Vendor Key

- - Generate your project key. This will generate a unique key for your project. This step can only be done once so click wisely. - - - Download your Vendor Key for your project. This License Key file is used in your code when you implement Deli Licensing in your project. - -

Your Packages Unique Deli Id

-

-
-
-   - -
-
-
-
- - -
\ No newline at end of file diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.cs b/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.cs deleted file mode 100644 index a53ccd99..00000000 --- a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Web.UI; -using System.Web.UI.WebControls; -using uProject.Helpers; - -namespace uProject.usercontrols.Deli.Package.Steps -{ - public partial class Licenses : UserControl - { - private Guid _projectGuid; - - - private bool _editMode - { - get - { - if (!string.IsNullOrEmpty(Request["projectId"])) - { - return true; - } - return false; - } - } - - private int? _projectId; - public int? ProjectId - { - get - { - if (!string.IsNullOrEmpty(Request["id"])) - { - _projectId = Int32.Parse(Request["id"]); - } - return _projectId; - } - set - { - _projectId = value; - } - } - - - private void ReBindLicenses() - { - } - - protected void EditLicense(object sender, CommandEventArgs e) - { - } - - protected void UpdateLicense_Click(object sender, EventArgs e) - { - } - - - protected void DeleteLicense(object sender, CommandEventArgs e) - { - } - - protected void DisableEnableLicense(object sender, CommandEventArgs e) - { - } - - protected void OnLicenseBound(object sender, RepeaterItemEventArgs e) - { - } - - - - protected void SaveLicense_Click(object sender, EventArgs e) - { - } - - - protected void Page_Load(object sender, EventArgs e) - { - } - - protected void GenKey_Click(object sender, EventArgs e) - { - } - - protected void DownloadKey_Click(object sender, EventArgs e) - { - } - - protected void SaveStep(object sender, EventArgs e) - { - //move to the license step - ProjectCreatorHelper.MoveToNextStep(this, (int)ProjectId); - } - - protected void MoveLast(object sender, EventArgs e) - { - //move to the screenshots step - ProjectCreatorHelper.MoveToPreviousStep(this, (int)ProjectId); - } - } -} \ No newline at end of file diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.designer.cs b/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.designer.cs deleted file mode 100644 index 2c38635d..00000000 --- a/Marketplace/usercontrols/Deli/Package/Steps/Licenses.ascx.designer.cs +++ /dev/null @@ -1,168 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace uProject.usercontrols.Deli.Package.Steps { - - - public partial class Licenses { - - /// - /// holder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder holder; - - /// - /// EditForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder EditForm; - - /// - /// EditLicenseType control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox EditLicenseType; - - /// - /// EditLicensePrice control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox EditLicensePrice; - - /// - /// UpdateLicense control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button UpdateLicense; - - /// - /// rp_licenses control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rp_licenses; - - /// - /// CreateForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder CreateForm; - - /// - /// licenseTypes control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList licenseTypes; - - /// - /// price control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox price; - - /// - /// btn_SaveLicense control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btn_SaveLicense; - - /// - /// GenKeyPlaceHolder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder GenKeyPlaceHolder; - - /// - /// GenKey control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton GenKey; - - /// - /// DownloadKeyPlaceHolder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder DownloadKeyPlaceHolder; - - /// - /// DownloadKey control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton DownloadKey; - - /// - /// uniqueId control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal uniqueId; - - /// - /// MovePrevious control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton MovePrevious; - - /// - /// MoveNext control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button MoveNext; - } -} diff --git a/Marketplace/usercontrols/Deli/Package/Steps/Screenshots.ascx.cs b/Marketplace/usercontrols/Deli/Package/Steps/Screenshots.ascx.cs index c2ebd924..52711429 100644 --- a/Marketplace/usercontrols/Deli/Package/Steps/Screenshots.ascx.cs +++ b/Marketplace/usercontrols/Deli/Package/Steps/Screenshots.ascx.cs @@ -1,20 +1,19 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Web; -using System.Web.UI; using System.Web.UI.WebControls; -using Marketplace.Providers; -using umbraco.cms.businesslogic.member; using our; -using Marketplace.Umbraco.BusinessLogic; -using Marketplace.Providers.Helpers; using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using OurUmbraco.MarketPlace.Providers; +using OurUmbraco.Wiki.BusinessLogic; +using umbraco; +using umbraco.cms.businesslogic.member; using uProject.Helpers; +using Umbraco.Web.UI.Controls; namespace uProject.usercontrols.Deli.Package.Steps { - public partial class Screenshots : System.Web.UI.UserControl + public partial class Screenshots : UmbracoUserControl { public string MemberGuid = ""; @@ -46,8 +45,8 @@ namespace uProject.usercontrols.Deli.Package.Steps private void RebindFiles() { - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var files = fileProvider.GetMediaFilesByProjectId((int)ProjectId).Where(x=>x.FileType == FileType.screenshot); + var mediaProvider = new MediaProvider(); + var files = mediaProvider.GetMediaFilesByProjectId((int)ProjectId).Where(x=>x.FileType == FileType.screenshot.FileTypeAsString()); if (string.IsNullOrEmpty(_defaultFile)) { @@ -67,31 +66,28 @@ namespace uProject.usercontrols.Deli.Package.Steps protected void DeleteFile(object sender, CommandEventArgs e) { - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var f = fileProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); + var mediaProvider = new MediaProvider(); + var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); _defaultFile = string.Empty; //update the project - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - IListingItem project = provider.GetListing((int)ProjectId); + var nodeListingProvider = new NodeListingProvider(); + IListingItem project = nodeListingProvider.GetListing((int)ProjectId); project.DefaultScreenshot = _defaultFile; - provider.SaveOrUpdate(project); - - - + nodeListingProvider.SaveOrUpdate(project); + var mem = Member.GetCurrentMember(); if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) - fileProvider.Remove(f); + mediaProvider.Remove(f); RebindFiles(); } protected void ArchiveFile(object sender, CommandEventArgs e) { - - var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"]; - var f = fileProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); + var mediaProvider = new MediaProvider(); + var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString())); if (e.CommandName == "Unarchive") { @@ -102,7 +98,7 @@ namespace uProject.usercontrols.Deli.Package.Steps f.Archived = true; } - fileProvider.SaveOrUpdate(f); + mediaProvider.SaveOrUpdate(f); RebindFiles(); } @@ -110,7 +106,7 @@ namespace uProject.usercontrols.Deli.Package.Steps { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { - IMediaFile f = (IMediaFile)e.Item.DataItem; + WikiFile f = (WikiFile)e.Item.DataItem; Image _image = (Image)e.Item.FindControl("img_image"); Literal _date = (Literal)e.Item.FindControl("lt_date"); Button _delete = (Button)e.Item.FindControl("bt_delete"); @@ -147,10 +143,10 @@ namespace uProject.usercontrols.Deli.Package.Steps private void MarkFileAsCurrent(string defaultScreenshot) { - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - IListingItem project = provider.GetListing((int)ProjectId); + var nodeListingProvider = new NodeListingProvider(); + IListingItem project = nodeListingProvider.GetListing((int)ProjectId); project.DefaultScreenshot = defaultScreenshot; - provider.SaveOrUpdate(project); + nodeListingProvider.SaveOrUpdate(project); _defaultFile = project.DefaultScreenshot; } @@ -158,23 +154,23 @@ namespace uProject.usercontrols.Deli.Package.Steps { - if (umbraco.library.IsLoggedOn() && ProjectId != null) + if (library.IsLoggedOn() && ProjectId != null) { - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; + var nodeListingProvider = new NodeListingProvider(); Member mem = Member.GetCurrentMember(); - IListingItem project = provider.GetListing((int)ProjectId); + IListingItem project = nodeListingProvider.GetListing((int)ProjectId); _defaultFile = project.DefaultScreenshot; - if ((project.Vendor.Member.Id == mem.Id) || + if ((project.VendorId == mem.Id) || Utils.IsProjectContributor(mem.Id, (int)ProjectId)) { holder.Visible = true; RebindFiles(); - umbraco.library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js"); - umbraco.library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js"); - umbraco.library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js"); + library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js"); + library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js"); + library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js"); MemberGuid = mem.UniqueId.ToString(); ProjectGuid = project.ProjectGuid.ToString(); diff --git a/Marketplace/usercontrols/Deli/Profile/MyProjects.ascx.cs b/Marketplace/usercontrols/Deli/Profile/MyProjects.ascx.cs index ece3626a..a98460db 100644 --- a/Marketplace/usercontrols/Deli/Profile/MyProjects.ascx.cs +++ b/Marketplace/usercontrols/Deli/Profile/MyProjects.ascx.cs @@ -1,15 +1,11 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Marketplace.Providers; -using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using Umbraco.Web.UI.Controls; namespace uProject.usercontrols.Deli.Profile { - public partial class MyProjects : System.Web.UI.UserControl + public partial class MyProjects : UmbracoUserControl { public int edit { get; set; } public int forum { get; set; } @@ -27,18 +23,15 @@ namespace uProject.usercontrols.Deli.Profile forumUrl = umbraco.library.NiceUrl(forum); licenseUrl = umbraco.library.NiceUrl(licenses); teamUrl = umbraco.library.NiceUrl(team); + + var nodeListingProvider = new NodeListingProvider(); + var memberId = Members.GetCurrentMemberId(); - - var memberProvider = (IMemberProvider)MarketplaceProviderManager.Providers["MemberProvider"]; - var member = memberProvider.GetCurrentMember(); - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - - - var projects = provider.GetListingsByVendor(member.Id, true, true).OrderBy(x=> x.Name); + var projects = nodeListingProvider.GetListingsByVendor(memberId, true, true).OrderBy(x=> x.Name); myProjects.DataSource = projects; myProjects.DataBind(); - var contribProjects = provider.GetListingsForContributor(member.Id); + var contribProjects = nodeListingProvider.GetListingsForContributor(memberId); myTeamProjects.DataSource = contribProjects; myTeamProjects.DataBind(); } diff --git a/OurUmbraco.Site/OurUmbraco.Site.csproj b/OurUmbraco.Site/OurUmbraco.Site.csproj index 8f647a44..e0a0b1d5 100644 --- a/OurUmbraco.Site/OurUmbraco.Site.csproj +++ b/OurUmbraco.Site/OurUmbraco.Site.csproj @@ -141,12 +141,6 @@ ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll - - ..\dependencies\MarketPlace\Marketplace.Providers.dll - - - ..\dependencies\MarketPlace\Marketplace.Umbraco.dll - ..\packages\UmbracoCms.Core.7.2.8-build103\lib\Microsoft.ApplicationBlocks.Data.dll True @@ -458,9 +452,6 @@ - - - @@ -4341,25 +4332,20 @@ - - - - - diff --git a/OurUmbraco.Site/Views/MacroPartials/Members/PublicProfile.cshtml b/OurUmbraco.Site/Views/MacroPartials/Members/PublicProfile.cshtml index ba7eb420..206bedce 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Members/PublicProfile.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Members/PublicProfile.cshtml @@ -1,6 +1,5 @@ @inherits Umbraco.Web.Macros.PartialViewMacroPage -@using Marketplace.Interfaces -@using Marketplace.Providers +@using System.Configuration @using OurUmbraco.Forum.Extensions @using OurUmbraco.Forum.Services @{ @@ -22,10 +21,21 @@ var roles = member.GetRoles(); - var provider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var projects = provider.GetListingsByVendor(member.Id, true, true).OrderByDescending(x => x.CreateDate); + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var content = umbracoHelper.TypedContent(int.Parse(ConfigurationManager.AppSettings["deliProjectRoot"])); + IEnumerable projects = new List(); + var contribProjects = new List(); + if (content != null) + { + projects = content.Descendants().Where(c => c.DocumentTypeAlias == "Project").Where(m => m.GetPropertyValue("owner") == member.Id).Where(p => p.GetPropertyValue("projectLive")); + const string sql = @"SELECT * FROM projectContributors WHERE memberId=@memberId"; + var contribPackageIds = UmbracoContext.Application.DatabaseContext.Database.Fetch(sql, new { memberId }); + foreach (var contribPackageId in contribPackageIds) + { + contribProjects.Add(umbracoHelper.TypedContent(contribPackageId)); + } + } - var contribProjects = provider.GetListingsForContributor(member.Id).OrderByDescending(x => x.CreateDate); var currentMember = Members.GetCurrentMember(); var reputationCurrent = member.GetPropertyValue("reputationCurrent"); @@ -124,24 +134,24 @@

Packages created

- @foreach (var project in projects.Where(x => x.Live)) + @foreach (var project in projects.Where(x => x.GetPropertyValue("projectLive")).OrderByDescending(x => x.CreateDate)) { - +
- @if (string.IsNullOrWhiteSpace(project.DefaultScreenshot.Trim())) + @if (string.IsNullOrWhiteSpace(project.GetPropertyValue("defaultScreenshotPath").Trim())) { } else { - @project.Name + @project.Name }

@project.Name

-

@Umbraco.StripHtml(Umbraco.Truncate(project.Description, 120))

+

@Umbraco.StripHtml(Umbraco.Truncate(project.GetPropertyValue("description"), 120))

@@ -157,24 +167,24 @@

Packages contributed to

- @foreach (var project in contribProjects.Where(x => x.Live)) + @foreach (var project in contribProjects.Where(x => x.GetPropertyValue("projectLive")).OrderByDescending(x => x.CreateDate)) { -
+
- @if (string.IsNullOrWhiteSpace(project.DefaultScreenshot.Trim())) + @if (string.IsNullOrWhiteSpace(project.GetPropertyValue("defaultScreenshotPath").Trim())) { } else { - @project.Name + @project.Name }

@project.Name

-

@Umbraco.StripHtml(Umbraco.Truncate(project.Description, 120))

+

@Umbraco.StripHtml(Umbraco.Truncate(project.GetPropertyValue("description"), 120))

diff --git a/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml b/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml deleted file mode 100644 index eac3da64..00000000 --- a/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml +++ /dev/null @@ -1,165 +0,0 @@ -@using Marketplace.Interfaces -@using Marketplace.Providers -@using System.Xml; -@using System.Xml.XPath; -@using OurUmbraco.Powers.Library -@using Umbraco.Core - -@{ - var projectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var take = 30; - - var wrapperClass = "notLoggedIn"; - - var qs = Request.RawUrl.Substring( Request.RawUrl.IndexOf('?')+1 ); - - var version = "v45"; - if(Request.QueryString["version"] != null){ - version = Request.QueryString["version"].ToLower(); - } - - const string uniqueWhatever = "E295637E-E957-4CCA-92CE-BF5D58F9FF59"; - var cacheKey = uniqueWhatever + "[" + version + "]"; - var cache = ApplicationContext.Current.ApplicationCache.RuntimeCache; - IEnumerable projects = (IEnumerable) cache.GetCacheItem(cacheKey, () => - { - return projectsProvider - .GetListingsByKarma(0, take, true, false) - .Where(x => !x.NotAPackage && - (string.Join("", x.UmbracoVerionsSupported).Contains("nan") || - string.Join("", x.UmbracoVerionsSupported).Contains(version))); - }, TimeSpan.FromMinutes(10)); - //var projects = projectsProvider - // .GetListingsByKarma(0, take, true, false) - // .Where(x => !x.NotAPackage && - // (string.Join("",x.UmbracoVerionsSupported).Contains("nan") || - // string.Join("",x.UmbracoVerionsSupported).Contains(version) ) ); - - var pUrl = "/repo_viewproject?" + qs + "&project_id="; - var favs = new List(); - - - if(umbraco.library.IsLoggedOn()){ - wrapperClass = "loggedIn"; - - var memId = umbraco.cms.businesslogic.member.Member.GetCurrentMember().Id; - - var iterator = Xslt.ItemsVotedFor(memId, "powersproject").Current.Select("//id"); - while (iterator.MoveNext() && iterator.CurrentPosition < 20) - { - var node = (IHasXmlNode)iterator.Current; - - if(node != null){ - string id = umbraco.xmlHelper.GetNodeValue(node.GetNode()); - - if(id != null){ - try{ - var project = projectsProvider.GetListing(int.Parse(id), false); - if(project != null){ - favs.Add(project); - } - }catch{ - //do nothing - } - } - } - } - - favs = favs.Where(x => !x.NotAPackage && (string.Join("",x.UmbracoVerionsSupported).Contains("nan") || string.Join("",x.UmbracoVerionsSupported).Contains(version) )).ToList(); - } - - } - - -
- - - -@if(favs.Count() > 0){ -
-

Your favorites

-

This is your favourites, based on your karma votes and downloads

-
    -@foreach(var project in @favs) -{ -
  • -
    - -
    - - @{ - var screenShot = project.DefaultScreenshot; - var image = string.IsNullOrEmpty(screenShot) == false ? screenShot + "?width=50&height=50&bgcolor=fff" : "/css/img/package2.png"; - } - Package - -

    @project.Name

    - -
    @uProject.library.GetCategoryName((int)project.Id)
    - - -
    - - - -
    -
    - @project.Karma - Karma -
    -
    - @project.Downloads - Downloads -
    -
    -
    -
  • -} -
-
-}else{ - Log in to see your favourites -} -
diff --git a/OurUmbraco.Site/macroScripts/repository-view-category.cshtml b/OurUmbraco.Site/macroScripts/repository-view-category.cshtml deleted file mode 100644 index ffe2b8ba..00000000 --- a/OurUmbraco.Site/macroScripts/repository-view-category.cshtml +++ /dev/null @@ -1,91 +0,0 @@ -@using Marketplace.Interfaces -@using Marketplace.Providers -@using Umbraco.Core - -@{ - - var id = int.Parse(Request.QueryString["category_id"]); - var categoryProvider = (ICategoryProvider)MarketplaceProviderManager.Providers["CategoryProvider"]; - var category = categoryProvider.GetCategory(id); - var fullversion = Request.QueryString["fullversion"]; - - var version = "v45"; - if (Request.QueryString["version"] != null) - { - version = Request.QueryString["version"].ToLower(); - } - - if (!string.IsNullOrEmpty(fullversion) && fullversion.Substring(0, 1) == "7") - { - version = "v7"; - } - - var ProjectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var qs = Request.RawUrl.Substring(Request.RawUrl.IndexOf('?') + 1).Replace("&category_id=" + id, ""); - - const string uniqueWhatever = "254D2E95-4E57-4777-AC01-2F45B28E942C"; - var cacheKey = uniqueWhatever + "[" + category.Id + "]"; - var cache = ApplicationContext.Current.ApplicationCache.RuntimeCache; - IEnumerable projects = (IEnumerable) cache.GetCacheItem(cacheKey, () => - ProjectsProvider - .GetListingsByCategory(category, true, true) - .Where(x => !x.NotAPackage && x.Approved && - (string.Join("", x.UmbracoVerionsSupported).Contains("nan") || - string.Join("", x.UmbracoVerionsSupported).Contains(version))), - TimeSpan.FromMinutes(10)); - - var pUrl = "/repo_viewproject?" + qs + "&project_id="; -} - - - - -
-

@category.Name

- -
    - @foreach (var project in projects) - { -
  • -
    - -
    - @{ - var screenShot = project.DefaultScreenshot; - var image = string.IsNullOrEmpty(screenShot) == false ? screenShot + "?width=50&height=50&bgcolor=fff" : "/css/img/package2.png"; - } - Package - -

    @project.Name

    - -
    @uProject.library.GetCategoryName((int)project.Id)
    - - -
    @project.ListingType
    -
    - - - -
    -
    - @project.Karma - Karma -
    -
    - @project.Downloads - Downloads -
    -
    -
    -
  • - - } -
-
diff --git a/OurUmbraco.Site/macroScripts/repository-view-project.cshtml b/OurUmbraco.Site/macroScripts/repository-view-project.cshtml deleted file mode 100644 index 084d3217..00000000 --- a/OurUmbraco.Site/macroScripts/repository-view-project.cshtml +++ /dev/null @@ -1,150 +0,0 @@ -@using Marketplace.Interfaces -@using Marketplace.Providers - -@{ - var ProjectsProvider = (IListingProvider)MarketplaceProviderManager.Providers["ListingProvider"]; - var projectId = int.Parse(Request.QueryString["project_id"]); - - var qs = Request.RawUrl.Substring( Request.RawUrl.IndexOf('?')+1 ).Replace("&project_id=" + projectId, ""); - var callback = Request.QueryString["callback"]; - - var Project = ProjectsProvider.GetListing(projectId, false); - var parentId = new umbraco.NodeFactory.Node(projectId).Parent.Id; - - 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 file = Project.PackageFile.Where(x => x.Id == Int32.Parse(Project.CurrentReleaseFile)).FirstOrDefault(); - 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"; - } -} - - - - - - - -
- -

@Project.Name - Install package -

- -
- - -
- -
-
Project owner:
-
@Project.Vendor.Member.Name
- -
Package downloads
-
@Project.Downloads
- -
Package karma
-
@Project.Karma
- - -
Compatibility:
-
-@ProjectCompatitbleWithUmbraco
-.NET Version: @ProjectCompatitbleWithDotNet
-Supports Medium Trust: @ProjectCompatitbleWithMediumTrust -
-
Created:
-
- @Project.CreateDate.ToString("D") -
- - - @if(Project.Stable){ -
Is Stable:
-
- Project is stable -
- } - -
Current version
-
- @Project.CurrentVersion -
- - @if (!string.IsNullOrEmpty(Project.LicenseName)) - { -
License
-
- @Project.LicenseName -
- } -
-
- -
-
- -
- @Html.Raw(Project.Description) -
- -
- - @if(Project.ScreenShots.Count() > 0){ - -
-

Screenshots

- @foreach(var image in Project.ScreenShots){ - - - - } -
- -
- } - - - -
diff --git a/OurUmbraco.Site/usercontrols/Deli/FeaturedProject.ascx b/OurUmbraco.Site/usercontrols/Deli/FeaturedProject.ascx deleted file mode 100644 index f2a45bac..00000000 --- a/OurUmbraco.Site/usercontrols/Deli/FeaturedProject.ascx +++ /dev/null @@ -1,51 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FeaturedProject.ascx.cs" Inherits="Marketplace.usercontrols.Deli.FeaturedProject" %> -<%@ Import Namespace="Marketplace.Interfaces" %> -<%@ Import Namespace="Marketplace.Providers.Helpers" %> - - - ">Featured Pakcage Titie - - - - - -
- - - - - -
-
- <%# Eval("Karma") %> - Karma -
-
- <%# Eval("Downloads") %> - Downloads -
-
-
-
-
\ No newline at end of file diff --git a/OurUmbraco.Site/usercontrols/Deli/NewestProjects.ascx b/OurUmbraco.Site/usercontrols/Deli/NewestProjects.ascx deleted file mode 100644 index 56391468..00000000 --- a/OurUmbraco.Site/usercontrols/Deli/NewestProjects.ascx +++ /dev/null @@ -1,79 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewestProjects.ascx.cs" Inherits="Marketplace.usercontrols.Deli.NewestProjects" %> -<%@ Import Namespace="Marketplace.Interfaces" %> -<%@ Import Namespace="Marketplace.Providers.Helpers" %> -<%@ Register Src="~/usercontrols/Deli/ListPagination.ascx" TagPrefix="deli" TagName="paging" %> - - -
- -
-

Latest Projects

- - - - - " class="viewAll">All new -
loading newest projects
-
- - -

Showing <%= PageStartListingNumber %> - <%=PageEndListingNumber %> of <%=TotalListings %> Projects

-
- - - - - -
- -
-
- - -
-

There are no listings that meet your filter criteria

-
-
- - \ No newline at end of file diff --git a/OurUmbraco.Site/usercontrols/Deli/Package/Steps/Licenses.ascx b/OurUmbraco.Site/usercontrols/Deli/Package/Steps/Licenses.ascx deleted file mode 100644 index 8586d4a9..00000000 --- a/OurUmbraco.Site/usercontrols/Deli/Package/Steps/Licenses.ascx +++ /dev/null @@ -1,137 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Licenses.ascx.cs" Inherits="uProject.usercontrols.Deli.Package.Steps.Licenses" %> - -
- - -
- Edit License Type -

- - - -

- -

- - -

- -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
License TypePrice 
- - - - -   - - -
- -
- NOTE: Only licenses types that have not been purchased by users can be deleted. If a license has been purchased you may disable it. - -
- Create License Type -

- - - - - - - - -

- -

- - -

- -

- -

- -
-

Your Vendor Key

- - Generate your project key. This will generate a unique key for your project. This step can only be done once so click wisely. - - - Download your Vendor Key for your project. This License Key file is used in your code when you implement Deli Licensing in your project. - -

Your Packages Unique Deli Id

-

-
-
-   - -
-
-
-
- - -
\ No newline at end of file diff --git a/OurUmbraco.Site/usercontrols/Deli/PopularProjects.ascx b/OurUmbraco.Site/usercontrols/Deli/PopularProjects.ascx deleted file mode 100644 index b74d6708..00000000 --- a/OurUmbraco.Site/usercontrols/Deli/PopularProjects.ascx +++ /dev/null @@ -1,83 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PopularProjects.ascx.cs" Inherits="Marketplace.usercontrols.Deli.PopularProjects" %> -<%@ Import Namespace="Marketplace.Interfaces" %> -<%@ Import Namespace="Marketplace.Providers.Helpers" %> -<%@ Register Src="~/usercontrols/Deli/ListPagination.ascx" TagPrefix="deli" TagName="paging" %> - - -
- - - -
-
- - -
-

There are no listings that meet your filter criteria

-
-
- - \ No newline at end of file diff --git a/OurUmbraco.Site/usercontrols/Deli/ProjectsList.ascx b/OurUmbraco.Site/usercontrols/Deli/ProjectsList.ascx deleted file mode 100644 index 112f7a5f..00000000 --- a/OurUmbraco.Site/usercontrols/Deli/ProjectsList.ascx +++ /dev/null @@ -1,62 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="ProjectsList.ascx.cs" Inherits="Marketplace.usercontrols.Deli.ProjectsList" %> -<%@ Import Namespace="Marketplace.Interfaces" %> -<%@ Import Namespace="Marketplace.Providers.Helpers" %> -<%@ Register Src="~/usercontrols/Deli/ListPagination.ascx" TagPrefix="deli" TagName="paging" %> - -
-
- - - -

Showing <%= PageStartListingNumber %> - <%=PageEndListingNumber %> of <%=TotalListings %> Projects

-
- - - - - - - - -
-

There are no listings that meet your filter criteria

-
-
- -
-
- - diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStep.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStep.cs new file mode 100644 index 00000000..10a82d8c --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStep.cs @@ -0,0 +1,32 @@ +using OurUmbraco.MarketPlace.Interfaces; + +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator +{ + public abstract class ListingCreatorStep : IListingCreatorStep + { + public abstract string Alias { get; } + public abstract string Name { get; } + public abstract string UserControl { get; } + public virtual int Index { get; set; } + + public virtual bool MoveToNextStepAutomaticly { get; set; } + + public virtual bool HideFromNavigation + { + get + { + return false; + } + } + public virtual bool CommercialOnly + { + get + { + return false; + } + } + + public virtual bool Completed { get; set; } + + } +} diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStepCollection.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStepCollection.cs new file mode 100644 index 00000000..9217e858 --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/ListingCreatorStepCollection.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Linq; + +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator +{ + public class ListingCreatorStepCollection : Dictionary + { + public void Add(ListingCreatorStep step, bool isDeliVendor) + { + step.Index = this.Count; + + if (!step.CommercialOnly) + Add(step.Alias, step); + else if (step.CommercialOnly && isDeliVendor) + Add(step.Alias, step); + } + + public ListingCreatorStep Get(string key) + { + return this.First(item => item.Key == key).Value; + } + + public bool StepExists(string key) + { + return ContainsKey(key); + } + + public ListingCreatorStep GotoNextStep(string key) + { + var s = this[key]; + + foreach (var listingCreatorStep in Values) + { + if (listingCreatorStep.Index > s.Index && !listingCreatorStep.Completed) + return listingCreatorStep; + } + + return null; + } + + public ListingCreatorStep GotoPreviousStep(string key) + { + var s = this[key]; + if (s.Index <= 0) + return null; + + foreach (var listingCreatorStep in Values) + { + if (listingCreatorStep.Index == (s.Index - 1)) + return listingCreatorStep; + } + + return null; + } + + public ListingCreatorStep FirstAvailableStep() + { + return this.First(item => item.Value.Completed == false).Value; + } + } +} diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Complete.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Complete.cs new file mode 100644 index 00000000..301d0938 --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Complete.cs @@ -0,0 +1,20 @@ +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions +{ + public class Complete : ListingCreatorStep + { + public override string Alias + { + get { return "complete"; } + } + + public override string Name + { + get { return "Creation Complete"; } + } + + public override string UserControl + { + get { return "~/usercontrols/deli/package/steps/complete.ascx"; } + } + } +} diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Details.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Details.cs new file mode 100644 index 00000000..cc298b66 --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Details.cs @@ -0,0 +1,20 @@ +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions +{ + public class Details : ListingCreatorStep + { + public override string Alias + { + get { return "details"; } + } + + public override string Name + { + get { return "Package Details"; } + } + + public override string UserControl + { + get { return "~/usercontrols/deli/package/steps/details.ascx"; } + } + } +} diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Files.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Files.cs new file mode 100644 index 00000000..ad342cdc --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Files.cs @@ -0,0 +1,20 @@ +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions +{ + public class Files : ListingCreatorStep + { + public override string Alias + { + get { return "files"; } + } + + public override string Name + { + get { return "Package Files"; } + } + + public override string UserControl + { + get { return "~/usercontrols/deli/package/steps/files.ascx"; } + } + } +} diff --git a/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Screenshots.cs b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Screenshots.cs new file mode 100644 index 00000000..90c6b612 --- /dev/null +++ b/OurUmbraco/MarketPlace/BusinessLogic/ListingCreator/StepDefinitions/Screenshots.cs @@ -0,0 +1,20 @@ +namespace OurUmbraco.MarketPlace.BusinessLogic.ListingCreator.StepDefinitions +{ + public class Screenshots : ListingCreatorStep + { + public override string Alias + { + get { return "screenshots"; } + } + + public override string Name + { + get { return "Screenshots"; } + } + + public override string UserControl + { + get { return "~/usercontrols/deli/package/steps/screenshots.ascx"; } + } + } +} diff --git a/OurUmbraco/MarketPlace/Extensions/NodeProviderExtensions.cs b/OurUmbraco/MarketPlace/Extensions/NodeProviderExtensions.cs index 004fa48a..3e0faf7f 100644 --- a/OurUmbraco/MarketPlace/Extensions/NodeProviderExtensions.cs +++ b/OurUmbraco/MarketPlace/Extensions/NodeProviderExtensions.cs @@ -1,4 +1,9 @@ -using OurUmbraco.MarketPlace.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using OurUmbraco.MarketPlace.Providers; using Umbraco.Core.Models; using Umbraco.Web; @@ -62,5 +67,61 @@ namespace OurUmbraco.MarketPlace.Extensions break; } } + + public static IEnumerable ToIListingItemList(this IEnumerable content, bool optimized) + { + var items = new List(); + foreach (var c in content) + { + yield return c.ToIListingItem(optimized); + } + } + + public static IListingItem ToIListingItem(this IPublishedContent content, bool optimized) + { + return new NodeListingProvider().GetListing(content, optimized); + } + + public static IEnumerable ToICategoryList(this IEnumerable contents) + { + List items = new List(); + foreach (var c in contents) + { + yield return c.ToICategory(); + } + } + + public static ICategory ToICategory(this IPublishedContent c) + { + var cat = new Category + { + Id = c.Id, + CategoryGuid = new Guid(c.GetPropertyValue("categoryGuid")), + Name = c.Name, + Description = c.GetPropertyValue("description"), + Image = c.GetPropertyAsMediaItem("icon"), + HQOnly = c.GetPropertyValue("hqOnly") == "1", + Url = c.Url, + ProjectCount = c.Descendants().Count(p => p.GetPropertyValue("projectLive") == 1) + }; + + return cat; + } + + public static string GetPropertyAsMediaItem(this IPublishedContent content, string field) + { + if (string.IsNullOrEmpty(content.GetPropertyValue(field)) == false) + { + var mItem = new umbraco.cms.businesslogic.media.Media(int.Parse(content.GetPropertyValue(field))); + + var propertyValue = string.Empty; + var property = mItem.getProperty("umbracoFile"); + if (property != null) + propertyValue = property.Value.ToString(); + + return propertyValue; + } + return string.Empty; + } } } diff --git a/OurUmbraco/MarketPlace/Interfaces/IListingCreatorStep.cs b/OurUmbraco/MarketPlace/Interfaces/IListingCreatorStep.cs new file mode 100644 index 00000000..e5db851c --- /dev/null +++ b/OurUmbraco/MarketPlace/Interfaces/IListingCreatorStep.cs @@ -0,0 +1,11 @@ +namespace OurUmbraco.MarketPlace.Interfaces +{ + public interface IListingCreatorStep + { + string Alias { get; } + bool Completed { get; set; } + string Name { get; } + string UserControl { get; } + bool HideFromNavigation { get; } + } +} diff --git a/OurUmbraco/MarketPlace/Interfaces/IMediaProvider.cs b/OurUmbraco/MarketPlace/Interfaces/IMediaProvider.cs index 178597ac..5a707e11 100644 --- a/OurUmbraco/MarketPlace/Interfaces/IMediaProvider.cs +++ b/OurUmbraco/MarketPlace/Interfaces/IMediaProvider.cs @@ -8,10 +8,10 @@ namespace OurUmbraco.MarketPlace.Interfaces public interface IMediaProvider { IEnumerable GetMediaForProjectByType(int projectId,FileType type); - IEnumerable GetMediaFilesByProjectId(int projectId); - void SaveOrUpdate(IMediaFile file); - IMediaFile GetFileById(int fileId); - void Remove(IMediaFile file); - IMediaFile CreateFile(string fileName, Guid listingVersionGuid, Guid vendorGuid, HttpPostedFile file, FileType fileType, List versions, string dotNetVersion, bool mediumTrust); + List GetMediaFilesByProjectId(int projectId); + void SaveOrUpdate(WikiFile file); + WikiFile GetFileById(int fileId); + void Remove(WikiFile file); + WikiFile CreateFile(string fileName, Guid listingVersionGuid, Guid vendorGuid, HttpPostedFile file, FileType fileType, List versions, string dotNetVersion, bool mediumTrust); } } diff --git a/OurUmbraco/MarketPlace/NodeLising/NodeListingProvider.cs b/OurUmbraco/MarketPlace/NodeListing/NodeListingProvider.cs similarity index 66% rename from OurUmbraco/MarketPlace/NodeLising/NodeListingProvider.cs rename to OurUmbraco/MarketPlace/NodeListing/NodeListingProvider.cs index 4de2af1e..a5ba049d 100644 --- a/OurUmbraco/MarketPlace/NodeLising/NodeListingProvider.cs +++ b/OurUmbraco/MarketPlace/NodeListing/NodeListingProvider.cs @@ -1,18 +1,17 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using OurUmbraco.MarketPlace.Extensions; using OurUmbraco.MarketPlace.Interfaces; -using OurUmbraco.MarketPlace.Models; -using OurUmbraco.Powers.BusinessLogic; -using OurUmbraco.Wiki.BusinessLogic; +using OurUmbraco.MarketPlace.Providers; using OurUmbraco.Wiki.Extensions; using umbraco; using umbraco.BusinessLogic; using Umbraco.Core.Models; using Umbraco.Web; -namespace OurUmbraco.MarketPlace.NodeLising +namespace OurUmbraco.MarketPlace.NodeListing { public class NodeListingProvider { /// @@ -33,6 +32,35 @@ namespace OurUmbraco.MarketPlace.NodeLising throw new NullReferenceException("Content is Null cannot find a node with the id:" + id); } + /// + /// get project listing based on GUID + /// + /// + /// if set performs less DB interactions to increase speed. + /// + public IListingItem GetListing(Guid guid, bool optimized = false) + { + var strGuid = guid.ToString().ToUpper(); + + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + + // we have to use the translate function to ensure that the casing is the same for comparison as there are GUIDS in the db in both upper and lowercase + var contents = + umbracoHelper.TypedContentAtXPath( + string.Format( + "//Project [@isDoc and translate(packageGuid,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = translate('{0}','ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]", + strGuid)); + + var content = contents.FirstOrDefault(); + + if (content != null) + { + return content.ToIListingItem(optimized); + } + + throw new NullReferenceException("Node is Null cannot find a node with the guid:" + strGuid); + } + /// /// get listing /// @@ -82,7 +110,7 @@ namespace OurUmbraco.MarketPlace.NodeLising listingItem.LicenseKey = content.GetPropertyValue("licenseKey", ""); //this section was created to speed up loading operations and cut down on the number of database interactions - if (!optimized) + if (optimized == false) { listingItem.DocumentationFile = GetMediaForProjectByType(content.Id, FileType.docs); listingItem.ScreenShots = GetMediaForProjectByType(content.Id, FileType.screenshot); @@ -125,39 +153,10 @@ namespace OurUmbraco.MarketPlace.NodeLising public IEnumerable GetMediaForProjectByType(int projectId, FileType type) { - var wikiFiles = WikiFile.CurrentFiles(projectId); - - var mediaFiles = new List(); - - foreach (var wikiFile in wikiFiles) - { - var mediaFile = new MediaFile - { - Current = wikiFile.Current, - Archived = wikiFile.Archived, - CreateDate = wikiFile.CreateDate, - Name = wikiFile.Name, - Id = wikiFile.Id, - CreatedBy = wikiFile.CreatedBy, - DotNetVersion = wikiFile.DotNetVersion, - Downloads = wikiFile.Downloads, - FileType = (FileType)Enum.Parse(typeof(FileType), wikiFile.FileType), - FileVersion = wikiFile.NodeVersion, - Path = wikiFile.Path, - RemovedBy = wikiFile.RemovedBy, - SupportsMediumTrust = false, - UmbVersion = wikiFile.Versions, - Verified = wikiFile.Verified - }; - - if (mediaFiles.Contains(mediaFile) == false) - mediaFiles.Add(mediaFile); - } - - return mediaFiles; + var mediaProvider = new MediaProvider(); + return mediaProvider.GetMediaForProjectByType(projectId, type); } - /// /// Persists the listing object to the database /// @@ -191,7 +190,7 @@ namespace OurUmbraco.MarketPlace.NodeLising content.SetValue("packageGuid", listingItem.ProjectGuid.ToString()); content.SetValue("approved", (listingItem.Approved) ? "1" : "0"); content.SetValue("termsAgreementDate", listingItem.TermsAgreementDate); - content.SetValue("owner", listingItem.Vendor.Member.Id); + content.SetValue("owner", listingItem.VendorId); content.SetValue("websiteUrl", listingItem.ProjectUrl); content.SetValue("licenseKey", listingItem.LicenseKey); @@ -241,7 +240,93 @@ namespace OurUmbraco.MarketPlace.NodeLising listingItem.Id = content.Id; listingItem.NiceUrl = library.NiceUrl(listingItem.Id); + } + + /// + /// Gets all listings for a vendor + /// + /// + /// if set performs less DB interactions to increase speed. + /// If set returns both live and not live listings + /// + public IEnumerable GetListingsByVendor(int vendorId, bool optimized = false, bool all = false) + { + var contents = GetProjectsFromDeliProjectRoot(all).Where(c => c.GetPropertyValue("owner") == vendorId); + + return contents.ToIListingItemList(optimized); + } + + private static IEnumerable GetProjectsFromDeliProjectRoot(bool all) + { + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var content = umbracoHelper.TypedContent(int.Parse(ConfigurationManager.AppSettings["deliProjectRoot"])); + if (content == null) + throw new Exception("Could not find the Deli project root."); + var contents = content.Descendants().Where(c => c.DocumentTypeAlias == "Project"); + + if (all == false) + contents = contents.Where(p => p.GetPropertyValue("projectLive")); + + return contents; + } + + /// + /// Returns a listing of projects that a specified member contributes to. + /// + /// + /// if set performs less DB interactions to increase speed. + /// if set returns both live and not live projects. + /// + public IEnumerable GetListingsForContributor(int memberId, bool optimized = false, bool all = false) + { + + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var contribProjects = new List(); + const string sql = @"SELECT * FROM projectContributors WHERE memberId=@memberId"; + var contribPackageIds = UmbracoContext.Current.Application.DatabaseContext.Database.Fetch(sql, new { memberId }); + + foreach (var contribPackageId in contribPackageIds) + { + contribProjects.Add(umbracoHelper.TypedContent(contribPackageId)); + } + + var listings = new List(); + foreach (var contribItem in contribProjects) + { + listings.Add(GetListing(contribItem.Id, optimized, -1)); + } + + return listings; + } + + /// + /// gets a list of listings + /// + /// if set performs less DB interactions to increase speed. + /// if set returns both live and not live listings + /// + public IEnumerable GetAllListings(bool optimized = false, bool all = false) + { + return GetAllListings(0, 0, optimized, all); + } + + /// + /// gets paged list of listings + /// + /// + /// + /// if set performs less DB interactions to increase speed. + /// if set returns both live and not live listings + /// + public IEnumerable GetAllListings(int skip, int take, bool optimized = false, bool all = false) + { + var contents = GetProjectsFromDeliProjectRoot(all); + + if (take > 0) + contents = contents.Skip(skip).Take(take); + + return contents.ToIListingItemList(optimized); } } } diff --git a/OurUmbraco/MarketPlace/Providers/Category.cs b/OurUmbraco/MarketPlace/Providers/Category.cs new file mode 100644 index 00000000..7de47e7f --- /dev/null +++ b/OurUmbraco/MarketPlace/Providers/Category.cs @@ -0,0 +1,67 @@ +using System; +using OurUmbraco.MarketPlace.Interfaces; + +namespace OurUmbraco.MarketPlace.Providers +{ + public class Category : ICategory + { + + protected int _id; + protected Guid _categoryGuid; + protected string _name; + protected string _description; + protected string _image; + protected string _url; + protected int _projectCount; + protected bool _HQOnly; + + public int Id + { + get { return _id; } + set { _id = value; } + } + + + public Guid CategoryGuid + { + get { return _categoryGuid; } + set { _categoryGuid = value; } + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + + public string Description + { + get { return _description; } + set { _description = value; } + } + + public string Image + { + get { return _image; } + set { _image = value; } + } + + public bool HQOnly + { + get { return _HQOnly; } + set { _HQOnly = value; } + } + + public string Url + { + get { return _url; } + set { _url = value; } + } + public int ProjectCount + { + get { return _projectCount; } + set { _projectCount = value; } + } + + } +} diff --git a/OurUmbraco/MarketPlace/Providers/MediaProvider.cs b/OurUmbraco/MarketPlace/Providers/MediaProvider.cs new file mode 100644 index 00000000..140f073c --- /dev/null +++ b/OurUmbraco/MarketPlace/Providers/MediaProvider.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Web; +using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.Models; +using OurUmbraco.Wiki.BusinessLogic; + +namespace OurUmbraco.MarketPlace.Providers +{ + public class MediaProvider : IMediaProvider + { + public IEnumerable GetMediaForProjectByType(int projectId, FileType type) + { + var wikiFiles = WikiFile.CurrentFiles(projectId); + + var mediaFiles = new List(); + + foreach (var wikiFile in wikiFiles) + { + var mediaFile = new MediaFile + { + Current = wikiFile.Current, + Archived = wikiFile.Archived, + CreateDate = wikiFile.CreateDate, + Name = wikiFile.Name, + Id = wikiFile.Id, + CreatedBy = wikiFile.CreatedBy, + DotNetVersion = wikiFile.DotNetVersion, + Downloads = wikiFile.Downloads, + FileType = (FileType)Enum.Parse(typeof(FileType), wikiFile.FileType), + FileVersion = wikiFile.NodeVersion, + Path = wikiFile.Path, + RemovedBy = wikiFile.RemovedBy, + SupportsMediumTrust = false, + UmbVersion = wikiFile.Versions, + Verified = wikiFile.Verified + }; + + if (mediaFiles.Contains(mediaFile) == false) + mediaFiles.Add(mediaFile); + } + + return mediaFiles; + } + /// + /// Get all the files that are associated with this project + /// + /// + /// + public List GetMediaFilesByProjectId(int projectId) + { + return WikiFile.CurrentFiles(projectId); + } + + /// + /// Get an media file by its Id + /// + /// + /// + public WikiFile GetFileById(int fileId) + { + return new WikiFile(fileId); + } + + /// + /// Save or update a media file back to the database. + /// + /// + public void SaveOrUpdate(WikiFile file) + { + var wf = file; + wf.Save(); + } + + private static string GetFileTypeAsString(FileType file) + { + switch (file) + { + case FileType.screenshot: + return "screenshot"; + break; + case FileType.package: + return "package"; + break; + case FileType.hotfix: + return "hotfix"; + break; + case FileType.docs: + return "docs"; + break; + case FileType.source: + return "source"; + break; + default: + return "package"; + break; + } + } + + public void Remove(WikiFile file) + { + file.Delete(); + } + + public WikiFile CreateFile(string fileName, Guid listingVersionGuid, Guid vendorGuid, HttpPostedFile file, FileType fileType, List v, string dotNetVersion, bool mediumTrust) + { + // we have to convert to the uWiki UmbracoVersion :( + + List vers = new List(); + + foreach (var ver in v) + { + vers.Add(UmbracoVersion.AvailableVersions()[ver.Version]); + } + + + //Create the Wiki File + var uWikiFile = WikiFile.Create(fileName, listingVersionGuid, vendorGuid, file, GetFileTypeAsString(fileType), vers); + //return the IMediaFile + + //Convert to Deli Media file + var MediaFile = GetFileById(uWikiFile.Id); + MediaFile.DotNetVersion = dotNetVersion; + SaveOrUpdate(MediaFile); + return MediaFile; + } + + public static string ToVersionString(List Versions) + { + var stringVers = string.Empty; + foreach (var ver in Versions) + { + stringVers += ver.Version + ","; + } + + return stringVers.TrimEnd(','); + + } + + + public static List GetVersionsFromString(string p) + { + var verArray = p.Split(','); + var verList = new List(); + foreach (var ver in verArray) + { + if (UmbracoVersion.AvailableVersions().ContainsKey(ver)) + verList.Add(UmbracoVersion.AvailableVersions()[ver]); + } + return verList; + } + + + } +} diff --git a/OurUmbraco/MarketPlace/Providers/ProjectTag.cs b/OurUmbraco/MarketPlace/Providers/ProjectTag.cs new file mode 100644 index 00000000..92f2d7f5 --- /dev/null +++ b/OurUmbraco/MarketPlace/Providers/ProjectTag.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OurUmbraco.MarketPlace.Interfaces; + +namespace OurUmbraco.MarketPlace.Providers +{ + class ProjectTag : IProjectTag + + { + protected int _id; + protected string _text; + protected int _count; + protected int _liveCount; + + public int Id + { + get + { + return _id; + } + set + { + _id = value; + } + } + + public string Text + { + get + { + return _text; + } + set + { + _text = value; + } + } + + public int Count + { + get { return _count; } + set { _count = value; } + } + + public int LiveCount + { + get { return _liveCount; } + set { _liveCount = value; } + } + + public bool Equals(IProjectTag other) + { + return this.Id == other.Id; + } + } +} diff --git a/OurUmbraco/MarketPlace/Providers/UmbracoCategoryProvider.cs b/OurUmbraco/MarketPlace/Providers/UmbracoCategoryProvider.cs new file mode 100644 index 00000000..48ca83e1 --- /dev/null +++ b/OurUmbraco/MarketPlace/Providers/UmbracoCategoryProvider.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Web; +using OurUmbraco.MarketPlace.Extensions; +using OurUmbraco.MarketPlace.Interfaces; +using Umbraco.Web; + +namespace OurUmbraco.MarketPlace.Providers +{ + public class UmbracoCategoryProvider : ICategoryProvider + { + public IEnumerable GetAllCategories() + { + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var content = umbracoHelper.TypedContent(int.Parse(ConfigurationManager.AppSettings["deliProjectRoot"])); + var contents = content.Descendants().Where(x => x.DocumentTypeAlias == "ProjectGroup"); + + return contents.ToICategoryList(); + } + + public ICategory GetCurrent() + { + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var content = umbracoHelper.TypedContent(HttpContext.Current.Items["pageID"]); + + if (content.DocumentTypeAlias != "ProjectGroup") + { + throw new Exception("Content is not of the correct type"); + } + + return content.ToICategory(); + } + + public ICategory GetCategory(int id) + { + var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); + var content = umbracoHelper.TypedContent(id); + + if (content.DocumentTypeAlias != "ProjectGroup") + { + throw new Exception("Content is not of the correct type"); + } + + return content.ToICategory(); + } + + public ICategory GetCategory(Guid id) + { + throw new NotImplementedException(); + } + } +} diff --git a/OurUmbraco/MarketPlace/Providers/UmbracoProjectTagProvider.cs b/OurUmbraco/MarketPlace/Providers/UmbracoProjectTagProvider.cs new file mode 100644 index 00000000..79a7fe37 --- /dev/null +++ b/OurUmbraco/MarketPlace/Providers/UmbracoProjectTagProvider.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using System.Linq; +using OurUmbraco.MarketPlace.Interfaces; +using OurUmbraco.MarketPlace.NodeListing; +using umbraco.cms.businesslogic.Tags; + +namespace OurUmbraco.MarketPlace.Providers +{ + public class UmbracoProjectTagProvider : IProjectTagProvider + { + public IEnumerable GetAllTags(bool liveOnly = false) + { + if (!liveOnly) + { + return Tag.GetTags("project").Where(x => x.NodeCount > 2).Select(x => new ProjectTag() + { + Id = x.Id, + Text = x.TagCaption, + LiveCount = x.NodeCount + }); + } + + var tagList = new List(); + + var nodeListingProvider = new NodeListingProvider(); + + var projects = nodeListingProvider.GetAllListings(true); + + foreach (var p in projects) + { + foreach (var t in p.Tags) + if (tagList.Contains(t)) + { + tagList.Find(delegate (IProjectTag tag) + { + return tag.Id == t.Id; + }).LiveCount++; + } + else + { + t.LiveCount++; + tagList.Add(t); + } + } + + + return tagList; + } + + public IEnumerable GetTagsByProjectId(int projectId) + { + return Tag.GetTags(projectId).Select(x => new ProjectTag() + { + Id = x.Id, + Text = x.TagCaption, + Count = x.NodeCount + }); + } + + + public IProjectTag GetTagById(int id) + { + return Tag.GetTags("project").Where(x => x.Id == id).Select(y => new ProjectTag() + { + Id = y.Id, + Text = y.TagCaption, + Count = y.NodeCount + }).FirstOrDefault(); + } + + public void SetTags(int projectId, string tags) + { + Tag.AddTagsToNode(projectId, tags, "project"); + } + } +} diff --git a/OurUmbraco/OurUmbraco.csproj b/OurUmbraco/OurUmbraco.csproj index 8a7dc6db..e92a63cc 100644 --- a/OurUmbraco/OurUmbraco.csproj +++ b/OurUmbraco/OurUmbraco.csproj @@ -292,10 +292,17 @@ + + + + + + + @@ -312,7 +319,12 @@ - + + + + + + diff --git a/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs b/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs index 1d00175b..8b5d0adb 100644 --- a/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs +++ b/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs @@ -29,6 +29,7 @@ namespace OurUmbraco.Wiki.BusinessLogic public bool Archived { get; set; } public bool Verified { get; set; } + public bool SupportsMediumTrust => true; public List Versions { get; set; } public UmbracoVersion Version { get; set; } @@ -109,7 +110,7 @@ namespace OurUmbraco.Wiki.BusinessLogic return wikiFiles; } } - + private readonly Events _events = new Events(); private WikiFile() { } diff --git a/dependencies/MarketPlace/MarketPlace.Webservices.dll b/dependencies/MarketPlace/MarketPlace.Webservices.dll deleted file mode 100644 index bbee39af..00000000 Binary files a/dependencies/MarketPlace/MarketPlace.Webservices.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.BusinessLogic.dll b/dependencies/MarketPlace/Marketplace.BusinessLogic.dll deleted file mode 100644 index 0617d6a7..00000000 Binary files a/dependencies/MarketPlace/Marketplace.BusinessLogic.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.Data.dll b/dependencies/MarketPlace/Marketplace.Data.dll deleted file mode 100644 index 08caba98..00000000 Binary files a/dependencies/MarketPlace/Marketplace.Data.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.Interfaces.dll b/dependencies/MarketPlace/Marketplace.Interfaces.dll deleted file mode 100644 index d67eef50..00000000 Binary files a/dependencies/MarketPlace/Marketplace.Interfaces.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.Presentation.dll b/dependencies/MarketPlace/Marketplace.Presentation.dll deleted file mode 100644 index 0fbc80bd..00000000 Binary files a/dependencies/MarketPlace/Marketplace.Presentation.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.Providers.dll b/dependencies/MarketPlace/Marketplace.Providers.dll deleted file mode 100644 index 0c819ef1..00000000 Binary files a/dependencies/MarketPlace/Marketplace.Providers.dll and /dev/null differ diff --git a/dependencies/MarketPlace/Marketplace.Umbraco.dll b/dependencies/MarketPlace/Marketplace.Umbraco.dll deleted file mode 100644 index 2a03ff52..00000000 Binary files a/dependencies/MarketPlace/Marketplace.Umbraco.dll and /dev/null differ diff --git a/our.umbraco.org/library.cs b/our.umbraco.org/library.cs index a9ac1ec9..2337fccb 100644 --- a/our.umbraco.org/library.cs +++ b/our.umbraco.org/library.cs @@ -80,6 +80,12 @@ namespace our return result ?? 0; } + public static bool HasMemberDownloadedPackage(int memberId, int projectId) + { + var result = Umbraco.Core.ApplicationContext.Current.DatabaseContext.Database.ExecuteScalar("select COUNT(*) from projectDownload where projectId = @0 and memberId = @1", projectId, memberId); + return result != 0; + } + public static int GetReleaseDownloadCount(int projectId) {