Exemplo n.º 1
0
        public ActionResult UpdateProjectLive(ProjectCompleteModel model)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = GetProjectForAuthorizedMember(model.Id);

            if (model.ProjectLive == false)
            {
                project.Live = false;
                nodeListingProvider.SaveOrUpdate(project);
            }
            else
            {
                // Special exception
                if (string.Equals(model.Name, _exceptionName, StringComparison.InvariantCultureIgnoreCase))
                {
                    project.Live = true;
                    nodeListingProvider.SaveOrUpdate(project);
                }
                else
                {
                    var packages       = nodeListingProvider.GetMediaForProjectByType(project.Id, FileType.package);
                    var currentPackage = packages.FirstOrDefault(x => x.Current && x.Archived == false);

                    if (currentPackage != null && ZipFileContainsPackageXml(currentPackage))
                    {
                        project.Live = true;
                        nodeListingProvider.SaveOrUpdate(project);
                    }
                }
            }

            return(RedirectToCurrentUmbracoPage(Request.Url.Query));
        }
Exemplo n.º 2
0
        public ActionResult SaveDetails(ProjectDetails model)
        {
            if (ModelState.IsValid == false)
            {
                return(CurrentUmbracoPage());
            }

            var nodeListingProvider = new NodeListingProvider();
            var project             = (model.Id != 0) ? nodeListingProvider.GetListing(model.Id) : new PublishedContentListingItem();

            project.Name             = model.Title;
            project.Description      = model.Description;
            project.CurrentVersion   = model.Version;
            project.LicenseName      = model.License;
            project.LicenseUrl       = model.LicenseUrl;
            project.ProjectUrl       = model.ProjectUrl;
            project.SourceCodeUrl    = model.SourceCodeUrl;
            project.DemonstrationUrl = model.DemonstrationUrl;
            project.CategoryId       = int.Parse(model.Category);
            project.OpenForCollab    = model.OpenForCollaboration;
            project.GACode           = model.GoogleAnalyticsCode;
            project.ProjectGuid      = (model.Guid == Guid.Empty) ? Guid.NewGuid() : model.Guid; //this is used as the Unique project ID.
            project.ListingType      = ListingType.free;
            // only set memberId when saving for the first time, else collaborators will cause it to switch the owner of the package
            if (model.Id == 0)
            {
                project.VendorId = Members.GetCurrentMemberId();
            }

            project.TermsAgreementDate = DateTime.Now.ToUniversalTime();

            nodeListingProvider.SaveOrUpdate(project);

            return(Redirect("/member/profile/projects/edit?editorStep=files&id=" + project.Id));
        }
Exemplo n.º 3
0
        private void MarkFileAsCurrent(string releaseFile)
        {
            var          nodeListingProvider = new NodeListingProvider();
            IListingItem project             = nodeListingProvider.GetListing((int)ProjectId);

            project.CurrentReleaseFile = releaseFile;
            nodeListingProvider.SaveOrUpdate(project);
            _defaultFile = project.CurrentReleaseFile;
        }
Exemplo n.º 4
0
        protected void Complete_Click(object sender, EventArgs e)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = nodeListingProvider.GetListing((int)ProjectId);

            project.Live = Live.Checked;
            nodeListingProvider.SaveOrUpdate(project);
            Response.Redirect(project.NiceUrl);
        }
Exemplo n.º 5
0
        private void MarkFileAsCurrent(string defaultScreenshot)
        {
            var          nodeListingProvider = new NodeListingProvider();
            IListingItem project             = nodeListingProvider.GetListing((int)ProjectId);

            project.DefaultScreenshot = defaultScreenshot;
            nodeListingProvider.SaveOrUpdate(project);
            _defaultFile = project.DefaultScreenshot;
        }
Exemplo n.º 6
0
        public ActionResult UpdateProjectLive(ProjectCompleteModel model)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = GetProjectForAuthorizedMember(model.Id);

            project.Live = model.ProjectLive;
            nodeListingProvider.SaveOrUpdate(project);

            return(RedirectToCurrentUmbracoPage(Request.Url.Query));
        }
Exemplo n.º 7
0
        public ActionResult MarkFileAsCurrent(int id, int releaseFileId)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = GetProjectForAuthorizedMember(id);

            project.CurrentReleaseFile = releaseFileId.ToString();
            var file = new WikiFile(releaseFileId);

            if (file.FileType == "screenshot")
            {
                project.DefaultScreenshot = file.Path;
            }
            nodeListingProvider.SaveOrUpdate(project);
            return(RedirectToCurrentUmbracoPage(Request.Url.Query));
        }
Exemplo n.º 8
0
        public ActionResult UpdateProjectLive(ProjectCompleteModel model)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = GetProjectForAuthorizedMember(model.Id);

            if (model.ProjectLive == false)
            {
                project.Live = false;
                nodeListingProvider.SaveOrUpdate(project);
            }
            else
            {
                var packages       = nodeListingProvider.GetMediaForProjectByType(project.Id, FileType.package);
                var currentPackage = packages.FirstOrDefault(x => x.Current && x.Archived == false);

                if (currentPackage != null && ZipFileContainsPackageXml(IOHelper.MapPath(currentPackage.Path)))
                {
                    project.Live = true;
                    nodeListingProvider.SaveOrUpdate(project);
                }
            }

            return(RedirectToCurrentUmbracoPage(Request.Url.Query));
        }
Exemplo n.º 9
0
        public ActionResult DeleteScreenshot(int id, int releaseFileId)
        {
            var nodeListingProvider = new NodeListingProvider();
            var project             = GetProjectForAuthorizedMember(id);

            var file = new WikiFile(releaseFileId);

            if (file.Path == project.DefaultScreenshot)
            {
                project.DefaultScreenshot = string.Empty;
                nodeListingProvider.SaveOrUpdate(project);
            }

            var mediaProvider = new MediaProvider();

            mediaProvider.Remove(file);

            return(RedirectToCurrentUmbracoPage(Request.Url.Query));
        }
Exemplo n.º 10
0
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f             = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));

            _defaultFile = string.Empty;

            //update the project
            var          nodeListingProvider = new NodeListingProvider();
            IListingItem project             = nodeListingProvider.GetListing((int)ProjectId);

            project.DefaultScreenshot = _defaultFile;
            nodeListingProvider.SaveOrUpdate(project);

            var mem = Member.GetCurrentMember();

            if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))
            {
                mediaProvider.Remove(f);
            }

            RebindFiles();
        }
Exemplo n.º 11
0
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            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 nodeListingProvider = new NodeListingProvider();
                    var project             = nodeListingProvider.GetListing((int)ProjectId);
                    project.CurrentReleaseFile = _defaultFile;
                    nodeListingProvider.SaveOrUpdate(project);
                }
            }

            mediaProvider.Remove(f);

            RebindFiles();
        }