protected void SelectStarterKitDesign(object sender, EventArgs e) { if (((Button)sender).CommandName == "apply") { Skin s = Skin.CreateFromName(((Button)sender).CommandArgument); Skinning.ActivateAsCurrentSkin(s); Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } else if (((Button)sender).CommandName == "remove") { NodeFactory.Node n = NodeFactory.Node.GetCurrent(); Template t = new Template(n.template); Skinning.RollbackSkin(t.Id); Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } else { Guid kitGuid = new Guid(((Button)sender).CommandArgument); cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer(); if (repo.HasConnection()) { cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer(); string tempFile = p.Import(repo.fetch(kitGuid.ToString())); p.LoadConfig(tempFile); int pID = p.CreateManifest(tempFile, kitGuid.ToString(), repoGuid); p.InstallFiles(pID, tempFile); p.InstallBusinessLogic(pID, tempFile); p.InstallCleanUp(pID, tempFile); library.RefreshContent(); if (cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0) { cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(cms.businesslogic.skinning.Skinning.GetAllSkins()[0]); } Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } else { //ShowConnectionError(); } } }
protected void SelectLocalStarterKitDesign(object sender, EventArgs e) { if (((Button)sender).CommandName == "apply") { Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandArgument)); this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); } else if (((Button)sender).CommandName == "remove") { Template template = new Template(Node.GetCurrent().template); Skinning.RollbackSkin(template.Id); this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); } }
protected void SelectStarterKitDesign(object sender, EventArgs e) { if (((Button)sender).CommandName == "apply") { var s = Skin.CreateFromName(((Button)sender).CommandArgument); Skinning.ActivateAsCurrentSkin(s); Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } else if (((Button)sender).CommandName == "remove") { var n = NodeFactory.Node.GetCurrent(); var t = new Template(n.template); Skinning.RollbackSkin(t.Id); Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } else { var kitGuid = new Guid(((Button)sender).CommandArgument); if (_repo.HasConnection()) { var p = new cms.businesslogic.packager.Installer(); var tempFile = p.Import(_repo.fetch(kitGuid.ToString())); p.LoadConfig(tempFile); var pId = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid); p.InstallFiles(pId, tempFile); p.InstallBusinessLogic(pId, tempFile); p.InstallCleanUp(pId, tempFile); //NOTE: This seems excessive to have to re-load all content from the database here!? library.RefreshContent(); if (Skinning.GetAllSkins().Count > 0) { Skinning.ActivateAsCurrentSkin(Skinning.GetAllSkins()[0]); } Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString()))); } } }
protected void SelectStarterKitDesign(object sender, EventArgs e) { if (((Button)sender).CommandName == "apply") { Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandArgument)); this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); } else if (((Button)sender).CommandName == "remove") { Template template = new Template(Node.GetCurrent().template); Skinning.RollbackSkin(template.Id); this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); } else { Guid guid = new Guid(((Button)sender).CommandArgument); InstalledPackage p = InstalledPackage.GetByGuid(guid.ToString()); if (p.Data.SkinRepoGuid != null && p.Data.SkinRepoGuid != Guid.Empty && p.Data.SkinRepoGuid.ToString() != repoGuid) { this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(p.Data.SkinRepoGuid.ToString()); } Installer installer = new Installer(); if (this.repo.HasConnection()) { Installer installer2 = new Installer(); string tempDir = installer2.Import(this.repo.fetch(guid.ToString())); installer2.LoadConfig(tempDir); int packageId = installer2.CreateManifest(tempDir, guid.ToString(), this.repoGuid); installer2.InstallFiles(packageId, tempDir); installer2.InstallBusinessLogic(packageId, tempDir); installer2.InstallCleanUp(packageId, tempDir); //NOTE: This seems excessive to have to re-load all content from the database here!? library.RefreshContent(); Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandName)); this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); } else { this.ShowConnectionError(); } } }