protected void Page_Load(object sender, System.EventArgs e) { Exception ex = new Exception(); if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); fb.type = uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message; } if (!IsPostBack) { ButtonInstall.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#installingMessage').show();; return true;"); ButtonLoadPackage.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#loadingbar').show();; return true;"); } //if we are actually in the middle of installing something... if (!String.IsNullOrEmpty(helper.Request("installing"))) { HideAllPanes(); pane_installing.Visible = true; ProcessInstall(helper.Request("installing")); } else if (!String.IsNullOrEmpty(helper.Request("guid")) && !String.IsNullOrEmpty(helper.Request("repoGuid"))) { //we'll fetch the local information we have about our repo, to find out what webservice to query. _repo = cms.businesslogic.packager.repositories.Repository.getByGuid(helper.Request("repoGuid")); if (_repo.HasConnection()) { //from the webservice we'll fetch some info about the package. cms.businesslogic.packager.repositories.Package pack = _repo.Webservice.PackageByGuid(helper.Request("guid")); //if the package is protected we will ask for the users credentials. (this happens every time they try to fetch anything) if (!pack.Protected) { //if it isn't then go straigt to the accept licens screen tempFile.Value = _installer.Import(_repo.fetch(helper.Request("guid"))); UpdateSettings(); } else if (!IsPostBack) { //Authenticate against the repo HideAllPanes(); pane_authenticate.Visible = true; } } else { fb.Style.Add("margin-top", "7px"); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>No connection to repository.</strong> Runway could not be installed as there was no connection to: '" + _repo.RepositoryUrl + "'"; pane_upload.Visible = false; } } }
protected void Page_Load(object sender, System.EventArgs e) { Exception ex = new Exception(); if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message; } string category = Request.QueryString["category"]; string repoGuid = Request.QueryString["repoGuid"]; cms.businesslogic.packager.repositories.Repository repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); string url = repo.RepositoryUrl; Panel1.Text = "Browse repository: " + repo.Name; if (!string.IsNullOrEmpty(category)) { category = "&category=" + category; } iframeGen.Text = string.Format("<iframe id=\"repoFrame\" frameborder=\"1\" style=\"border: none; display: block\" src=\"{0}?repoGuid={1}{2}&callback={3}:{4}{5}/developer/packages/proxy.htm?/{6}/developer/packages/installer.aspx?repoGuid={7}&version=v45&fullVersion={8}.{9}.{10}&useLegacySchema={11}&dotnetVersion={12}&trustLevel={13}\"></iframe>", url, repoGuid, category, Request.ServerVariables["SERVER_NAME"], Request.ServerVariables["SERVER_PORT"], IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.Umbraco).Trim('/'), repoGuid, GlobalSettings.VersionMajor, GlobalSettings.VersionMinor, GlobalSettings.VersionPatch, UmbracoSettings.UseLegacyXmlSchema.ToString(), Environment.Version, Umbraco.Core.SystemUtilities.GetCurrentTrustLevel()); }
protected void Page_Load(object sender, System.EventArgs e) { Exception ex = new Exception(); if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message; } string category = Request.QueryString["category"]; string repoGuid = Request.QueryString["repoGuid"]; cms.businesslogic.packager.repositories.Repository repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); string url = repo.RepositoryUrl; Panel1.Text = "Browse repository: " + repo.Name; if (!string.IsNullOrEmpty(category)) { category = "&category=" + category; } iframeGen.Text = "<iframe id=\"repoFrame\" frameborder=\"1\" style=\"border: none; display: block\" src=\"" + url + "?repoGuid=" + repoGuid + category + "&callback=" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/developer/packages/proxy.htm?/" + IOHelper.ResolveUrl(SystemDirectories.Umbraco).Trim('/') + "/developer/packages/installer.aspx?repoGuid=" + repoGuid + "&version=v45&useLegacySchema=" + UmbracoSettings.UseLegacyXmlSchema.ToString() + "\"></iframe>"; }
protected void Page_Load(object sender, System.EventArgs e) { Exception ex = new Exception(); if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); fb.type = uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message; } if (!IsPostBack) { ButtonInstall.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#installingMessage').show();; return true;"); ButtonLoadPackage.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#loadingbar').show();; return true;"); } //if we are actually in the middle of installing something... if (!String.IsNullOrEmpty(helper.Request("installing"))) { hideAllPanes(); pane_installing.Visible = true; processInstall(helper.Request("installing")); } else if (!String.IsNullOrEmpty(helper.Request("guid")) && !String.IsNullOrEmpty(helper.Request("repoGuid"))) { //we'll fetch the local information we have about our repo, to find out what webservice to query. repo = cms.businesslogic.packager.repositories.Repository.getByGuid(helper.Request("repoGuid")); if (repo.HasConnection()) { //from the webservice we'll fetch some info about the package. cms.businesslogic.packager.repositories.Package pack = repo.Webservice.PackageByGuid(helper.Request("guid")); //if the package is protected we will ask for the users credentials. (this happens every time they try to fetch anything) if (!pack.Protected) { //if it isn't then go straigt to the accept licens screen tempFile.Value = p.Import(repo.fetch(helper.Request("guid"))); updateSettings(); } else if (!IsPostBack) { //Authenticate against the repo hideAllPanes(); pane_authenticate.Visible = true; } } else { fb.Style.Add("margin-top", "7px"); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>No connection to repository.</strong> Runway could not be installed as there was no connection to: '" + repo.RepositoryUrl + "'"; pane_upload.Visible = false; } } }
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(); } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; cms.businesslogic.packager.repositories.Repository repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); uicontrols.Feedback fb = new global::umbraco.uicontrols.Feedback(); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>No connection to repository.</strong> Modules could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'"; if (repo.HasConnection()) { try { if (UmbracoSettings.UseLegacyXmlSchema) { rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4); } else { rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41); } rep_nitros.DataBind(); } catch (Exception ex) { LogHelper.Error <LoadNitros>("An error occurred", ex); loadNitros.Controls.Clear(); loadNitros.Controls.Add(fb); //nitroList.Visible = false; //lt_status.Text = "<div class='error'><p>Nitros could not be fetched from the repository. Please check your internet connection</p><p>You can always install Nitros later in the packages section</p><p>" + ex.ToString() + "</p></div>"; } } else { loadNitros.Controls.Clear(); loadNitros.Controls.Add(fb); } }
public void installNitros(object sender, EventArgs e) { string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; //Hardcoded official package repo key. cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer(); cms.businesslogic.packager.repositories.Repository repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); foreach (CheckBox cb in _nitroList) { if (cb.Checked) { if (!_selectedNitros.Contains(cb.ID)) { _selectedNitros.Add(cb.ID); } } } foreach (string guid in _selectedNitros) { string tempFile = p.Import(repo.fetch(guid)); p.LoadConfig(tempFile); int pId = p.CreateManifest(tempFile, guid, repoGuid); //and then copy over the files. This will take some time if it contains .dlls that will reboot the system.. p.InstallFiles(pId, tempFile); //finally install the businesslogic p.InstallBusinessLogic(pId, tempFile); //cleanup.. p.InstallCleanUp(pId, tempFile); } ApplicationContext.Current.ApplicationCache.ClearAllCache(); library.RefreshContent(); loadNitros.Visible = false; RaiseBubbleEvent(new object(), new EventArgs()); }
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(); } } }
protected void LoadSkins() { List<string> skinNames = new List<string>(); Guid? nullable = Skinning.StarterKitGuid(Node.GetCurrent().template); if(nullable.HasValue){ InstalledPackage p = InstalledPackage.GetByGuid(nullable.Value.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()); } if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template))) { this.pChangeSkin.Visible = false; } else if (this.repo.HasConnection()) { try { var skins = this.repo.Webservice.Skins(nullable.ToString()); this.rep_starterKitDesigns.DataSource = skins; this.rep_starterKitDesigns.DataBind(); foreach (var s in skins) { if(!skinNames.Contains(s.Text)) skinNames.Add(s.Text); } } catch (Exception exception) { LogHelper.Error<SkinCustomizer>("An error occurred", exception); } } else { this.ShowConnectionError(); } //check for local skins List<string> localSkins = new List<string>(); DirectoryInfo dirInfo = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages)); foreach (DirectoryInfo subDur in dirInfo.GetDirectories()) { var skinFile = subDur.GetFiles("skin.xml"); if (skinFile.Length > 0) { string c = Skin.GetSkinNameFromFile(skinFile[0].FullName); if (!skinNames.Contains(c)) localSkins.Add(c); } } if (localSkins.Count > 0) { rep_starterKitDesignsLocal.DataSource = localSkins; rep_starterKitDesignsLocal.DataBind(); } else { localSkinsContainer.Visible = false; } }
public TemplateSkinning() { CurrentApp = DefaultApps.settings.ToString(); _repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid); }
public ModuleInstaller() { _repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid); //for skinning, you need to be a developer CurrentApp = DefaultApps.developer.ToString(); }
public ModuleSelector() { this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(this.repoGuid); }
public TemplateSkinning() { repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); }
protected void Page_Load(object sender, EventArgs e) { var ex = new Exception(); if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex)) { fb.Style.Add("margin-top", "7px"); fb.type = uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message; } if (!IsPostBack) { ButtonInstall.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#installingMessage').show();; return true;"); ButtonLoadPackage.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#loadingbar').show();; return true;"); } //if we are actually in the middle of installing something... meaning we keep redirecting back to this page with // custom query strings // TODO: SD: This process needs to be fixed/changed/etc... to use the InstallPackageController // http://issues.umbraco.org/issue/U4-1047 if (!string.IsNullOrEmpty(Request.GetItemAsString("installing"))) { HideAllPanes(); pane_installing.Visible = true; ProcessInstall(Request.GetItemAsString("installing")); //process the current step } else if (tempFile.Value.IsNullOrWhiteSpace() && //if we haven't downloaded the .umb temp file yet (!Request.GetItemAsString("guid").IsNullOrWhiteSpace() && !Request.GetItemAsString("repoGuid").IsNullOrWhiteSpace())) { //we'll fetch the local information we have about our repo, to find out what webservice to query. _repo = cms.businesslogic.packager.repositories.Repository.getByGuid(Request.GetItemAsString("repoGuid")); if (_repo.HasConnection()) { //from the webservice we'll fetch some info about the package. cms.businesslogic.packager.repositories.Package pack = _repo.Webservice.PackageByGuid(Request.GetItemAsString("guid")); //if the package is protected we will ask for the users credentials. (this happens every time they try to fetch anything) if (!pack.Protected) { //if it isn't then go straigt to the accept licens screen tempFile.Value = _installer.Import(_repo.fetch(Request.GetItemAsString("guid"))); UpdateSettings(); } else if (!IsPostBack) { //Authenticate against the repo HideAllPanes(); pane_authenticate.Visible = true; } } else { fb.Style.Add("margin-top", "7px"); fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; fb.Text = "<strong>No connection to repository.</strong> Runway could not be installed as there was no connection to: '" + _repo.RepositoryUrl + "'"; pane_upload.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"])); lt_packagename.Text = pack.Data.Name; lt_packageVersion.Text = pack.Data.Version; lt_packageAuthor.Text = pack.Data.Author; lt_readme.Text = library.ReplaceLineBreaks( pack.Data.Readme ); bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;"); if (!Page.IsPostBack) { //temp list to contain failing items... List<string> tempList = new List<string>(); foreach (string str in pack.Data.Documenttypes) { int tId = 0; if (int.TryParse(str, out tId)) { try { DocumentType dc = new DocumentType(tId); if (dc != null) { ListItem li = new ListItem(dc.Text, dc.Id.ToString()); li.Selected = true; documentTypes.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing documentTypes items from the uninstall manifest syncLists(pack.Data.Documenttypes, tempList); foreach (string str in pack.Data.Templates) { int tId = 0; if (int.TryParse(str, out tId)) { try { Template t = new Template(tId); if (t != null) { ListItem li = new ListItem(t.Text, t.Id.ToString()); li.Selected = true; templates.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing template items from the uninstall manifest syncLists(pack.Data.Templates, tempList); foreach (string str in pack.Data.Stylesheets) { int tId = 0; if (int.TryParse(str, out tId)) { try { StyleSheet s = new StyleSheet(tId); if (s != null) { ListItem li = new ListItem(s.Text, s.Id.ToString()); li.Selected = true; stylesheets.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing stylesheet items from the uninstall manifest syncLists(pack.Data.Stylesheets, tempList); foreach (string str in pack.Data.Macros) { int tId = 0; if (int.TryParse(str, out tId)) { try { Macro m = new Macro(tId); if (m != null && !string.IsNullOrEmpty(m.Name)) { //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found... ListItem li = new ListItem(m.Name, m.Id.ToString()); li.Selected = true; macros.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing macros items from the uninstall manifest syncLists(pack.Data.Macros, tempList); foreach (string str in pack.Data.Files) { try { if (!String.IsNullOrEmpty(str) && System.IO.File.Exists( IOHelper.MapPath(str) )) { ListItem li = new ListItem(str, str); li.Selected = true; files.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } //removing failing files from the uninstall manifest syncLists(pack.Data.Files, tempList); foreach (string str in pack.Data.DictionaryItems) { int tId = 0; if (int.TryParse(str, out tId)) { try { cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(tId); if (di != null) { ListItem li = new ListItem(di.key, di.id.ToString()); li.Selected = true; dictionaryItems.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest syncLists(pack.Data.DictionaryItems, tempList); foreach (string str in pack.Data.DataTypes) { int tId = 0; if (int.TryParse(str, out tId)) { try { cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(tId); if (dtd != null) { ListItem li = new ListItem(dtd.Text, dtd.Id.ToString()); li.Selected = true; dataTypes.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest syncLists(pack.Data.DataTypes, tempList); //save the install manifest, so even tho the user doesn't uninstall, it stays uptodate. pack.Save(); //Look for updates on packages. if (!String.IsNullOrEmpty(pack.Data.RepositoryGuid) && !String.IsNullOrEmpty(pack.Data.PackageGuid)) { try { repo = cms.businesslogic.packager.repositories.Repository.getByGuid(pack.Data.RepositoryGuid); if (repo != null) { hl_packageRepo.Text = repo.Name; hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + repo.Guid; pp_repository.Visible = true; } cms.businesslogic.packager.repositories.Package repoPackage = repo.Webservice.PackageByGuid(pack.Data.PackageGuid); if (repoPackage != null) { if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != pack.Data.Version) { bt_update.Visible = true; bt_update.Text = "Update available: version: " + repoPackage.UpgradeVersion; lt_upgradeReadme.Text = repoPackage.UpgradeReadMe; bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;"; lt_noUpdate.Visible = false; } else { bt_update.Visible = false; lt_noUpdate.Visible = true; } if (!string.IsNullOrEmpty(repoPackage.Demo)) { lb_demoLink.OnClientClick = "openDemo(this, '" + pack.Data.PackageGuid + "'); return false;"; pp_documentation.Visible = true; } if(!string.IsNullOrEmpty(repoPackage.Documentation)) { hl_docLink.NavigateUrl = repoPackage.Documentation; hl_docLink.Target = "_blank"; pp_documentation.Visible = true; } } } catch { bt_update.Visible = false; lt_noUpdate.Visible = true; } } bool deletePackage = true; //sync the UI to match what is in the package if (macros.Items.Count == 0) pp_macros.Visible = false; else deletePackage = false; if (documentTypes.Items.Count == 0) pp_docTypes.Visible = false; else deletePackage = false; if (files.Items.Count == 0) pp_files.Visible = false; else deletePackage = false; if (templates.Items.Count == 0) pp_templates.Visible = false; else deletePackage = false; if (stylesheets.Items.Count == 0) pp_css.Visible = false; else deletePackage = false; if (dictionaryItems.Items.Count == 0) pp_di.Visible = false; else deletePackage = false; if (dataTypes.Items.Count == 0) pp_dt.Visible = false; else deletePackage = false; if (deletePackage) { pane_noItems.Visible = true; bt_uninstall.Visible = false; pane_uninstall.Visible = false; } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { _pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"])); lt_packagename.Text = _pack.Data.Name; lt_packageVersion.Text = _pack.Data.Version; lt_packageAuthor.Text = _pack.Data.Author; lt_readme.Text = library.ReplaceLineBreaks(_pack.Data.Readme); bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;"); if (!Page.IsPostBack) { //temp list to contain failing items... var tempList = new List <string>(); foreach (var str in _pack.Data.Documenttypes) { var tId = 0; if (int.TryParse(str, out tId)) { try { var dc = new DocumentType(tId); var li = new ListItem(dc.Text, dc.Id.ToString()); li.Selected = true; documentTypes.Items.Add(li); } catch { tempList.Add(str); } } } //removing failing documentTypes items from the uninstall manifest SyncLists(_pack.Data.Documenttypes, tempList); foreach (var str in _pack.Data.Templates) { var tId = 0; if (int.TryParse(str, out tId)) { try { var t = new Template(tId); var li = new ListItem(t.Text, t.Id.ToString()); li.Selected = true; templates.Items.Add(li); } catch { tempList.Add(str); } } } //removing failing template items from the uninstall manifest SyncLists(_pack.Data.Templates, tempList); foreach (string str in _pack.Data.Stylesheets) { int tId = 0; if (int.TryParse(str, out tId)) { try { var s = new StyleSheet(tId); ListItem li = new ListItem(s.Text, s.Id.ToString()); li.Selected = true; stylesheets.Items.Add(li); } catch { tempList.Add(str); } } } //removing failing stylesheet items from the uninstall manifest SyncLists(_pack.Data.Stylesheets, tempList); foreach (var str in _pack.Data.Macros) { var tId = 0; if (int.TryParse(str, out tId)) { try { var m = new Macro(tId); if (!string.IsNullOrEmpty(m.Name)) { //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found... var li = new ListItem(m.Name, m.Id.ToString()); li.Selected = true; macros.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing macros items from the uninstall manifest SyncLists(_pack.Data.Macros, tempList); foreach (var str in _pack.Data.Files) { try { if (!string.IsNullOrEmpty(str) && System.IO.File.Exists(IOHelper.MapPath(str))) { var li = new ListItem(str, str); li.Selected = true; files.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } //removing failing files from the uninstall manifest SyncLists(_pack.Data.Files, tempList); foreach (string str in _pack.Data.DictionaryItems) { var tId = 0; if (int.TryParse(str, out tId)) { try { var di = new cms.businesslogic.Dictionary.DictionaryItem(tId); var li = new ListItem(di.key, di.id.ToString()); li.Selected = true; dictionaryItems.Items.Add(li); } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest SyncLists(_pack.Data.DictionaryItems, tempList); foreach (var str in _pack.Data.DataTypes) { var tId = 0; if (int.TryParse(str, out tId)) { try { var dtd = new cms.businesslogic.datatype.DataTypeDefinition(tId); if (dtd != null) { var li = new ListItem(dtd.Text, dtd.Id.ToString()); li.Selected = true; dataTypes.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest SyncLists(_pack.Data.DataTypes, tempList); //save the install manifest, so even tho the user doesn't uninstall, it stays uptodate. _pack.Save(); //Look for updates on packages. if (!string.IsNullOrEmpty(_pack.Data.RepositoryGuid) && !string.IsNullOrEmpty(_pack.Data.PackageGuid)) { try { _repo = cms.businesslogic.packager.repositories.Repository.getByGuid(_pack.Data.RepositoryGuid); if (_repo != null) { hl_packageRepo.Text = _repo.Name; hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + _repo.Guid; pp_repository.Visible = true; } var repoPackage = _repo.Webservice.PackageByGuid(_pack.Data.PackageGuid); if (repoPackage != null) { if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != _pack.Data.Version) { pane_upgrade.Visible = true; lt_upgradeReadme.Text = repoPackage.UpgradeReadMe; bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;"; } if (!string.IsNullOrEmpty(repoPackage.Demo)) { lb_demoLink.OnClientClick = "openDemo(this, '" + _pack.Data.PackageGuid + "'); return false;"; pp_documentation.Visible = true; } if (!string.IsNullOrEmpty(repoPackage.Documentation)) { hl_docLink.NavigateUrl = repoPackage.Documentation; hl_docLink.Target = "_blank"; pp_documentation.Visible = true; } } } catch { pane_upgrade.Visible = false; } } var deletePackage = true; //sync the UI to match what is in the package if (macros.Items.Count == 0) { pp_macros.Visible = false; } else { deletePackage = false; } if (documentTypes.Items.Count == 0) { pp_docTypes.Visible = false; } else { deletePackage = false; } if (files.Items.Count == 0) { pp_files.Visible = false; } else { deletePackage = false; } if (templates.Items.Count == 0) { pp_templates.Visible = false; } else { deletePackage = false; } if (stylesheets.Items.Count == 0) { pp_css.Visible = false; } else { deletePackage = false; } if (dictionaryItems.Items.Count == 0) { pp_di.Visible = false; } else { deletePackage = false; } if (dataTypes.Items.Count == 0) { pp_dt.Visible = false; } else { deletePackage = false; } if (deletePackage) { pane_noItems.Visible = true; pane_uninstall.Visible = false; } // List the package version history [LK 2013-067-10] Version v; var packageVersionHistory = cms.businesslogic.packager.InstalledPackage.GetAllInstalledPackages() .Where(x => x.Data.Id != _pack.Data.Id && string.Equals(x.Data.Name, _pack.Data.Name, StringComparison.OrdinalIgnoreCase)) .OrderBy(x => Version.TryParse(x.Data.Version, out v) ? v : new Version()); if (packageVersionHistory != null && packageVersionHistory.Count() > 0) { rptr_versions.DataSource = packageVersionHistory; rptr_versions.DataBind(); pane_versions.Visible = true; } } } }
// Methods public SkinCustomizer() { this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(this.repoGuid); }
protected void submitPackage(object sender, EventArgs e) { Page.Validate(); string feedback = ""; if (Page.IsValid) { try { cms.businesslogic.packager.repositories.Repository repo = cms.businesslogic.packager.repositories.Repository.getByGuid(dd_repositories.SelectedValue); string memberKey = repo.Webservice.authenticate(tb_email.Text, library.md5(tb_password.Text)); byte[] doc = new byte[0]; if (fu_doc.HasFile) { doc = fu_doc.FileBytes; } if (memberKey != "") { string result = repo.SubmitPackage(memberKey, pack, doc).ToString().ToLower(); switch (result) { case "complete": feedback = "Your package has been submitted successfully. It will be reviewed by the package repository administrator before it's publicly available"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; break; case "error": feedback = "There was a general error submitting your package to the repository. This can be due to general communitations error or too much traffic. Please try again later"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; break; case "exists": feedback = "This package has already been submitted to the repository. You cannot submit it again. If you have updates for a package, you should contact the repositor administrator to submit an update"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; break; case "noaccess": feedback = "Authentication failed, You do not have access to this repository. Contact your package repository administrator"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; break; default: break; } if (result == "complete") { Pane1.Visible = false; Pane2.Visible = false; submitControls.Visible = false; feedbackControls.Visible = true; } else { Pane1.Visible = true; Pane2.Visible = true; submitControls.Visible = true; feedbackControls.Visible = false; } } else { feedback = "Authentication failed, You do not have access to this repository. Contact your package repository administrator"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; } } catch { feedback = "Authentication failed, or the repository is currently off-line. Contact your package repository administrator"; fb_feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; } fb_feedback.Text = feedback; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"])); lt_packagename.Text = pack.Data.Name; lt_packageVersion.Text = pack.Data.Version; lt_packageAuthor.Text = pack.Data.Author; lt_readme.Text = library.ReplaceLineBreaks(pack.Data.Readme); bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;"); if (!Page.IsPostBack) { //temp list to contain failing items... List <string> tempList = new List <string>(); foreach (string str in pack.Data.Documenttypes) { int tId = 0; if (int.TryParse(str, out tId)) { try { DocumentType dc = new DocumentType(tId); if (dc != null) { ListItem li = new ListItem(dc.Text, dc.Id.ToString()); li.Selected = true; documentTypes.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing documentTypes items from the uninstall manifest syncLists(pack.Data.Documenttypes, tempList); foreach (string str in pack.Data.Templates) { int tId = 0; if (int.TryParse(str, out tId)) { try { Template t = new Template(tId); if (t != null) { ListItem li = new ListItem(t.Text, t.Id.ToString()); li.Selected = true; templates.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing template items from the uninstall manifest syncLists(pack.Data.Templates, tempList); foreach (string str in pack.Data.Stylesheets) { int tId = 0; if (int.TryParse(str, out tId)) { try { StyleSheet s = new StyleSheet(tId); if (s != null) { ListItem li = new ListItem(s.Text, s.Id.ToString()); li.Selected = true; stylesheets.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing stylesheet items from the uninstall manifest syncLists(pack.Data.Stylesheets, tempList); foreach (string str in pack.Data.Macros) { int tId = 0; if (int.TryParse(str, out tId)) { try { Macro m = new Macro(tId); if (m != null && !string.IsNullOrEmpty(m.Name)) { //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found... ListItem li = new ListItem(m.Name, m.Id.ToString()); li.Selected = true; macros.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing macros items from the uninstall manifest syncLists(pack.Data.Macros, tempList); foreach (string str in pack.Data.Files) { try { if (!String.IsNullOrEmpty(str) && System.IO.File.Exists(IOHelper.MapPath(str))) { ListItem li = new ListItem(str, str); li.Selected = true; files.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } //removing failing files from the uninstall manifest syncLists(pack.Data.Files, tempList); foreach (string str in pack.Data.DictionaryItems) { int tId = 0; if (int.TryParse(str, out tId)) { try { cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(tId); if (di != null) { ListItem li = new ListItem(di.key, di.id.ToString()); li.Selected = true; dictionaryItems.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest syncLists(pack.Data.DictionaryItems, tempList); foreach (string str in pack.Data.DataTypes) { int tId = 0; if (int.TryParse(str, out tId)) { try { cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(tId); if (dtd != null) { ListItem li = new ListItem(dtd.Text, dtd.Id.ToString()); li.Selected = true; dataTypes.Items.Add(li); } else { tempList.Add(str); } } catch { tempList.Add(str); } } } //removing failing files from the uninstall manifest syncLists(pack.Data.DataTypes, tempList); //save the install manifest, so even tho the user doesn't uninstall, it stays uptodate. pack.Save(); //Look for updates on packages. if (!String.IsNullOrEmpty(pack.Data.RepositoryGuid) && !String.IsNullOrEmpty(pack.Data.PackageGuid)) { try { repo = cms.businesslogic.packager.repositories.Repository.getByGuid(pack.Data.RepositoryGuid); if (repo != null) { hl_packageRepo.Text = repo.Name; hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + repo.Guid; pp_repository.Visible = true; } cms.businesslogic.packager.repositories.Package repoPackage = repo.Webservice.PackageByGuid(pack.Data.PackageGuid); if (repoPackage != null) { if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != pack.Data.Version) { bt_update.Visible = true; bt_update.Text = "Update available: version: " + repoPackage.UpgradeVersion; lt_upgradeReadme.Text = repoPackage.UpgradeReadMe; bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;"; lt_noUpdate.Visible = false; } else { bt_update.Visible = false; lt_noUpdate.Visible = true; } if (!string.IsNullOrEmpty(repoPackage.Demo)) { lb_demoLink.OnClientClick = "openDemo(this, '" + pack.Data.PackageGuid + "'); return false;"; pp_documentation.Visible = true; } if (!string.IsNullOrEmpty(repoPackage.Documentation)) { hl_docLink.NavigateUrl = repoPackage.Documentation; hl_docLink.Target = "_blank"; pp_documentation.Visible = true; } } } catch { bt_update.Visible = false; lt_noUpdate.Visible = true; } } bool deletePackage = true; //sync the UI to match what is in the package if (macros.Items.Count == 0) { pp_macros.Visible = false; } else { deletePackage = false; } if (documentTypes.Items.Count == 0) { pp_docTypes.Visible = false; } else { deletePackage = false; } if (files.Items.Count == 0) { pp_files.Visible = false; } else { deletePackage = false; } if (templates.Items.Count == 0) { pp_templates.Visible = false; } else { deletePackage = false; } if (stylesheets.Items.Count == 0) { pp_css.Visible = false; } else { deletePackage = false; } if (dictionaryItems.Items.Count == 0) { pp_di.Visible = false; } else { deletePackage = false; } if (dataTypes.Items.Count == 0) { pp_dt.Visible = false; } else { deletePackage = false; } if (deletePackage) { pane_noItems.Visible = true; bt_uninstall.Visible = false; pane_uninstall.Visible = false; } } } }
public loadStarterKitDesigns() { repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid); }
protected void LoadSkins() { List <string> skinNames = new List <string>(); Guid?nullable = Skinning.StarterKitGuid(Node.GetCurrent().template); if (nullable.HasValue) { InstalledPackage p = InstalledPackage.GetByGuid(nullable.Value.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()); } } if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template))) { this.pChangeSkin.Visible = false; } else if (this.repo.HasConnection()) { try { var skins = this.repo.Webservice.Skins(nullable.ToString()); this.rep_starterKitDesigns.DataSource = skins; this.rep_starterKitDesigns.DataBind(); foreach (var s in skins) { if (!skinNames.Contains(s.Text)) { skinNames.Add(s.Text); } } } catch (Exception exception) { LogHelper.Error <SkinCustomizer>("An error occurred", exception); } } else { this.ShowConnectionError(); } //check for local skins List <string> localSkins = new List <string>(); DirectoryInfo dirInfo = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages)); foreach (DirectoryInfo subDur in dirInfo.GetDirectories()) { var skinFile = subDur.GetFiles("skin.xml"); if (skinFile.Length > 0) { string c = Skin.GetSkinNameFromFile(skinFile[0].FullName); if (!skinNames.Contains(c)) { localSkins.Add(c); } } } if (localSkins.Count > 0) { rep_starterKitDesignsLocal.DataSource = localSkins; rep_starterKitDesignsLocal.DataBind(); } else { localSkinsContainer.Visible = false; } }