protected void deleteFileFromPackage(object sender, EventArgs e) { TextBox filePathControl = (TextBox)((Control)sender).Parent.FindControl("packageFilePath"); filePathControl.Text = ""; string tmpFilePathString = ""; foreach (RepeaterItem rItem in packageFilesRepeater.Items) { string tmpFFFF = ((TextBox)rItem.FindControl("packageFilePath")).Text; if (tmpFFFF.Trim() != "") { tmpFilePathString += tmpFFFF + "�"; } } CreatedPackage createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"])); PackageInstance pack = createdPackage.Data; pack.Files = new List <string>(tmpFilePathString.Trim('�').Split('�')); pack.Files.TrimExcess(); createdPackage.Save(); packageFilesRepeater.DataSource = pack.Files; packageFilesRepeater.DataBind(); }
public override bool PerformDelete() { // we need to grab the id from the alias as the new tree needs to prefix the NodeID with "package_" if (ParentID == 0) { ParentID = int.Parse(Alias.Substring("package_".Length)); } CreatedPackage.GetById(ParentID).Delete(); return(true); }
public IHttpActionResult DeleteCreatedPackage(int packageId) { var package = CreatedPackage.GetById(packageId); if (package == null) { return(NotFound()); } package.Delete(); return(Ok()); }
protected void addFileToPackage(object sender, EventArgs e) { string newPath = packageFilePathNew.Text; if (newPath.Trim() != "") { CreatedPackage createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"])); PackageInstance pack = createdPackage.Data; pack.Files.Add(newPath); createdPackage.Save(); packageFilePathNew.Text = ""; packageFilesRepeater.DataSource = pack.Files; packageFilesRepeater.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"])); pack = createdPackage.Data; /* CONTENT */ cp = new ContentPicker(); content.Controls.Add(cp); if (string.IsNullOrEmpty(pack.PackagePath) == false) { packageUmbFile.Text = " <a href='" + Page.ResolveClientUrl(pack.PackagePath) + "'>Download</a>"; } else { packageUmbFile.Text = "<em>This package is not published</em>"; } if (Page.IsPostBack == false) { ClientTools .SyncTree("-1,created," + createdPackage.Data.Id, false); packageAuthorName.Text = pack.Author; packageAuthorUrl.Text = pack.AuthorUrl; packageLicenseName.Text = pack.License; packageLicenseUrl.Text = pack.LicenseUrl; packageName.Text = pack.Name; packageReadme.Text = pack.Readme; packageVersion.Text = pack.Version; packageUrl.Text = pack.Url; iconUrl.Text = pack.IconUrl; umbracoVersion.Text = pack.UmbracoVersion != null?pack.UmbracoVersion.ToString(3) : string.Empty; /*ACTIONS XML*/ tb_actions.Text = pack.Actions; cp.Value = pack.ContentNodeId.ToString(); //startNode.Value = pack.ContentNodeId.ToString(); packageContentSubdirs.Checked = pack.ContentLoadChildNodes; /*TEMPLATES */ var nTemplates = Services.FileService.GetTemplates(); //Template[] umbTemplates = Template.GetAllAsList().ToArray(); foreach (var tmp in nTemplates) { ListItem li = new ListItem(tmp.Name, tmp.Id.ToString()); if (pack.Templates.Contains(tmp.Id.ToString())) { li.Selected = true; } templates.Items.Add(li); } /* DOC TYPES */ // fixme - media types? member types? var nContentTypes = Services.ContentTypeService.GetAll(); //DocumentType[] docs = DocumentType.GetAllAsList().ToArray(); foreach (var dc in nContentTypes) { ListItem li = new ListItem(dc.Name, dc.Id.ToString()); if (pack.Documenttypes.Contains(dc.Id.ToString())) { li.Selected = true; } documentTypes.Items.Add(li); } /*Stylesheets */ var sheets = Services.FileService.GetStylesheets(); foreach (var st in sheets) { if (string.IsNullOrEmpty(st.Name) == false) { var li = new ListItem(st.Alias, st.Name); if (pack.Stylesheets.Contains(st.Name)) { li.Selected = true; } stylesheets.Items.Add(li); } } /* MACROS */ var nMacros = Services.MacroService.GetAll(); //Macro[] umbMacros = Macro.GetAll(); foreach (var m in nMacros) { ListItem li = new ListItem(m.Name, m.Id.ToString()); if (pack.Macros.Contains(m.Id.ToString())) { li.Selected = true; } macros.Items.Add(li); } /*Langauges */ var nLanguages = Services.LocalizationService.GetAllLanguages(); //Language[] umbLanguages = Language.getAll; foreach (var l in nLanguages) { ListItem li = new ListItem(l.CultureName, l.Id.ToString()); if (pack.Languages.Contains(l.Id.ToString())) { li.Selected = true; } languages.Items.Add(li); } /*Dictionary Items*/ var umbDictionary = Services.LocalizationService.GetRootDictionaryItems(); foreach (var d in umbDictionary) { string liName = d.ItemKey; var children = Services.LocalizationService.GetDictionaryItemChildren(d.Key); if (children.Any()) { liName += " <small>(Including all child items)</small>"; } var li = new ListItem(liName, d.Id.ToString()); if (pack.DictionaryItems.Contains(d.Id.ToString())) { li.Selected = true; } dictionary.Items.Add(li); } //TODO: Fix this with the new services and apis! and then remove since this should all be in angular ///*Data types */ //cms.businesslogic.datatype.DataTypeDefinition[] umbDataType = cms.businesslogic.datatype.DataTypeDefinition.GetAll(); // sort array by name //Array.Sort(umbDataType, delegate(cms.businesslogic.datatype.DataTypeDefinition umbDataType1, cms.businesslogic.datatype.DataTypeDefinition umbDataType2) //{ // return umbDataType1.Text.CompareTo(umbDataType2.Text); //}); //foreach (cms.businesslogic.datatype.DataTypeDefinition umbDtd in umbDataType) //{ // ListItem li = new ListItem(umbDtd.Text, umbDtd.Id.ToString()); // if (pack.DataTypes.Contains(umbDtd.Id.ToString())) // li.Selected = true; // cbl_datatypes.Items.Add(li); //} /* FILES */ packageFilesRepeater.DataSource = pack.Files; packageFilesRepeater.DataBind(); packageControlPath.Text = pack.LoadControl; } else { ClientTools .SyncTree("-1,created," + createdPackage.Data.Id, true); } } }