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 ListingItem(null, null);

            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);
        }
Exemple #2
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);
 }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var nodeListingProvider = new NodeListingProvider();

                var project = nodeListingProvider.GetListing((int)ProjectId);
                ProjectName.Text = project.Name;

                Live.Checked = project.Live;
            }
        }
        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();
        }
        public ActionResult Index(int projectId = 0)
        {
            var project = new ListingItem(null, null);
            if (projectId != 0)
            {
                var nodeListingProvider = new NodeListingProvider();
                project = (ListingItem) nodeListingProvider.GetListing(projectId);

                var memberId = Members.GetCurrentMemberId();
                if ((project.VendorId == memberId) == false && Utils.IsProjectContributor(memberId, projectId) == false)
                {
                    Response.Redirect("/member/profile/projects/", true);
                }
            }

            var model = new ProjectDetails();
            var currentPage = Umbraco.TypedContent(UmbracoContext.PageId.Value);
            var rootNode = currentPage.AncestorOrSelf(1);
            var projects = rootNode.Children(x => x.ContentType.Alias == "Projects").First();
            var categories = projects.Children(x => x.ContentType.Alias == "ProjectGroup" && x.GetPropertyValue<bool>("hqOnly") == false);
            model.ProjectCategories = new List<SelectListItem> { new SelectListItem { Text = string.Empty, Value = string.Empty } };
            foreach (var category in categories)
                model.ProjectCategories.Add(new SelectListItem { Text = category.Name, Value = category.Id.ToString(), Selected = project.CategoryId == category.Id });

            model.License = string.IsNullOrWhiteSpace(project.LicenseName) ? "MIT" : project.LicenseName;
            model.LicenseUrl = string.IsNullOrWhiteSpace(project.LicenseUrl) ? "http://www.opensource.org/licenses/mit-license.php" : project.LicenseUrl;

            model.Title = project.Name;
            model.Description = project.Description;
            model.Version = project.CurrentVersion;
            model.SourceCodeUrl = project.SourceCodeUrl;
            model.DemonstrationUrl = project.DemonstrationUrl;
            model.OpenForCollaboration = project.OpenForCollab;
            model.GoogleAnalyticsCode = project.GACode;
            model.Id = projectId;

            return PartialView("~/Views/Partials/Project/Edit.cshtml", model);
        }
Exemple #6
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();
        }
Exemple #7
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;
 }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (library.IsLoggedOn() && ProjectId != null)
            {
                var nodeListingProvider = new NodeListingProvider();
                Member mem = Member.GetCurrentMember();
                IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
                _defaultFile = project.CurrentReleaseFile;

                if ((project.VendorId == mem.Id) ||
                    Utils.IsProjectContributor(mem.Id, (int)ProjectId))
                {
                    holder.Visible = true;
                    RebindFiles();

                    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();

                    string umboptions = "";

                    foreach (UmbracoVersion uv in UmbracoVersion.AvailableVersions().Values)
                    {
                        umboptions += string.Format("<input type='checkbox' name='wiki_version' value='{0}' /><span> {1}</span></br>", uv.Version, uv.Name);
                    }

                    lt_versions.Text = umboptions;

                    string[] dotnetversions = { "", "2.0", "3.5", "4.0", "4.5" };
                    string dotnetoptions = string.Empty;

                    foreach (var opt in dotnetversions)
                    {
                        dotnetoptions += string.Format("<option value='{0}'>{1}</option>", opt, opt);

                    }

                    lt_dotnetversions.Text = dotnetoptions;
                }

            }
        }
        protected override void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);

            if (_projectId != null)
            {
                var nodeListingProvider = new NodeListingProvider();
                _project = nodeListingProvider.GetListing((int)_projectId);

                //check security to make sure the project belongs to the vendor
                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/");
                }
            }

            _currentStep = umbraco.helper.Request("editorStep");

            ListingCreatorStep _s;

            if (string.IsNullOrEmpty(_currentStep))
                _s = ListingSteps()["details"];
            else
                _s = ListingSteps()[_currentStep];

            loadContent(_s);
        }
 private void MarkFileAsCurrent(string defaultScreenshot)
 {
     var nodeListingProvider = new NodeListingProvider();
     IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
     project.DefaultScreenshot = defaultScreenshot;
     nodeListingProvider.SaveOrUpdate(project);
     _defaultFile = project.DefaultScreenshot;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (library.IsLoggedOn() && ProjectId != null)
            {
                var nodeListingProvider = new NodeListingProvider();
                Member mem = Member.GetCurrentMember();
                IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
                _defaultFile = project.DefaultScreenshot;

                if ((project.VendorId == mem.Id) ||
                    Utils.IsProjectContributor(mem.Id, (int)ProjectId))
                {
                    holder.Visible = true;
                    RebindFiles();

                    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();
                }
            }
        }