From 7ea58030e75b00a31758e2f162818062bd1fab0b Mon Sep 17 00:00:00 2001 From: Shandem Date: Sun, 20 Jun 2010 11:26:49 +0000 Subject: [PATCH] Fixes: 27652 [TFS Changeset #70205] --- .../config/ClientDependency.config | 2 +- .../config/ClientDependency.config | 2 +- .../Packages/installedPackage.aspx.cs | 7 +- .../umbraco/developer/Packages/installer.aspx | 2 + .../developer/Packages/installer.aspx.cs | 385 +++++++++--------- .../Packages/installer.aspx.designer.cs | 3 +- .../umbraco_client/Tree/UmbracoTree.js | 24 +- 7 files changed, 218 insertions(+), 207 deletions(-) diff --git a/config templates/config/ClientDependency.config b/config templates/config/ClientDependency.config index abc292160e..51a9c39cc9 100644 --- a/config templates/config/ClientDependency.config +++ b/config templates/config/ClientDependency.config @@ -10,7 +10,7 @@ NOTES: * Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config * A new version will invalidate both client and server cache and create new persisted files --> - + diff --git a/umbraco/presentation/config/ClientDependency.config b/umbraco/presentation/config/ClientDependency.config index 1ecfe8f9e6..2f5a407161 100644 --- a/umbraco/presentation/config/ClientDependency.config +++ b/umbraco/presentation/config/ClientDependency.config @@ -10,7 +10,7 @@ NOTES: * Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config * A new version will invalidate both client and server cache and create new persisted files --> - + diff --git a/umbraco/presentation/umbraco/developer/Packages/installedPackage.aspx.cs b/umbraco/presentation/umbraco/developer/Packages/installedPackage.aspx.cs index fd9e247531..1b7adb8562 100644 --- a/umbraco/presentation/umbraco/developer/Packages/installedPackage.aspx.cs +++ b/umbraco/presentation/umbraco/developer/Packages/installedPackage.aspx.cs @@ -377,8 +377,7 @@ namespace umbraco.presentation.developer.packages protected void confirmUnInstall(object sender, EventArgs e) { - //ensure that all tree's are refreshed after uninstall - ClientTools.ClearClientTreeCache(); + bool refreshCache = false; @@ -561,6 +560,10 @@ namespace umbraco.presentation.developer.packages library.RefreshContent(); } + //ensure that all tree's are refreshed after uninstall + ClientTools.ClearClientTreeCache() + .RefreshTree(); + } private bool isManifestEmpty() diff --git a/umbraco/presentation/umbraco/developer/Packages/installer.aspx b/umbraco/presentation/umbraco/developer/Packages/installer.aspx index 4cf468bbfb..e271bf7413 100644 --- a/umbraco/presentation/umbraco/developer/Packages/installer.aspx +++ b/umbraco/presentation/umbraco/developer/Packages/installer.aspx @@ -24,6 +24,8 @@ + + diff --git a/umbraco/presentation/umbraco/developer/Packages/installer.aspx.cs b/umbraco/presentation/umbraco/developer/Packages/installer.aspx.cs index 45a4a3a130..7c5d883454 100644 --- a/umbraco/presentation/umbraco/developer/Packages/installer.aspx.cs +++ b/umbraco/presentation/umbraco/developer/Packages/installer.aspx.cs @@ -21,68 +21,68 @@ namespace umbraco.presentation.developer.packages public partial class Installer : BasePages.UmbracoEnsuredPage { private Control configControl; - private cms.businesslogic.packager.repositories.Repository repo; + private cms.businesslogic.packager.repositories.Repository repo; private cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer(); private string tempFileName = ""; 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 = "" + ui.Text("errors", "filePermissionsError") + ":
" + ex.Message; - } + 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 = "" + ui.Text("errors", "filePermissionsError") + ":
" + 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 (!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")); + //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")); + } 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 (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(); + //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) { + } else if (!IsPostBack) { - //Authenticate against the repo - hideAllPanes(); - pane_authenticate.Visible = true; + //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 = "No connection to repository. Runway could not be installed as there was no connection to: '" + repo.RepositoryUrl + "'"; - pane_upload.Visible = false; - } - } + } + } else { + fb.Style.Add("margin-top", "7px"); + fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; + fb.Text = "No connection to repository. Runway could not be installed as there was no connection to: '" + repo.RepositoryUrl + "'"; + pane_upload.Visible = false; + } + } } - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - acceptCheckbox.Attributes.Add("onmouseup", "document.getElementById('" + ButtonInstall.ClientID + "').disabled = false;"); - } + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender(e); + acceptCheckbox.Attributes.Add("onmouseup", "document.getElementById('" + ButtonInstall.ClientID + "').disabled = false;"); + } #region Web Form Designer generated code override protected void OnInit(EventArgs e) @@ -110,190 +110,191 @@ namespace umbraco.presentation.developer.packages protected void uploadFile(object sender, System.EventArgs e) { - try { - tempFileName = Guid.NewGuid().ToString() + ".umb"; - string fileName = SystemDirectories.Data + System.IO.Path.DirectorySeparatorChar + tempFileName; - file1.PostedFile.SaveAs(IOHelper.MapPath(fileName)); - tempFile.Value = p.Import(tempFileName); - updateSettings(); - } catch (Exception ex) { - fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; - fb.Text = "Could not upload file
" + ex.ToString(); - } + try { + tempFileName = Guid.NewGuid().ToString() + ".umb"; + string fileName = SystemDirectories.Data + System.IO.Path.DirectorySeparatorChar + tempFileName; + file1.PostedFile.SaveAs(IOHelper.MapPath(fileName)); + tempFile.Value = p.Import(tempFileName); + updateSettings(); + } catch (Exception ex) { + fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; + fb.Text = "Could not upload file
" + ex.ToString(); + } } - //this fetches the protected package from the repo. - protected void fetchProtectedPackage(object sender, EventArgs e) { - //we auth against the webservice. This key will be used to fetch the protected package. - string memberGuid = repo.Webservice.authenticate(tb_email.Text, library.md5(tb_password.Text)); - - //if we auth correctly and get a valid key back, we will fetch the file from the repo webservice. - if(!string.IsNullOrEmpty(memberGuid)){ - tempFile.Value = p.Import(repo.fetch(helper.Request("guid"), memberGuid)); - updateSettings(); - } - } - - //this loads the accept license screen - private void updateSettings() - { - hideAllPanes(); + //this fetches the protected package from the repo. + protected void fetchProtectedPackage(object sender, EventArgs e) { + //we auth against the webservice. This key will be used to fetch the protected package. + string memberGuid = repo.Webservice.authenticate(tb_email.Text, library.md5(tb_password.Text)); + + //if we auth correctly and get a valid key back, we will fetch the file from the repo webservice. + if(!string.IsNullOrEmpty(memberGuid)){ + tempFile.Value = p.Import(repo.fetch(helper.Request("guid"), memberGuid)); + updateSettings(); + } + } + + //this loads the accept license screen + private void updateSettings() + { + hideAllPanes(); - pane_acceptLicense.Visible = true; - pane_acceptLicenseInner.Text = "Installing the package: " + p.Name; - Panel1.Text = "Installing the package: " + p.Name; + pane_acceptLicense.Visible = true; + pane_acceptLicenseInner.Text = "Installing the package: " + p.Name; + Panel1.Text = "Installing the package: " + p.Name; - if (p.ContainsUnsecureFiles && repo == null) - { - pp_unsecureFiles.Visible = true; - foreach (string str in p.UnsecureFiles) - { - lt_files.Text += "
  • " + str + "
  • "; - } - } + if (p.ContainsUnsecureFiles && repo == null) + { + pp_unsecureFiles.Visible = true; + foreach (string str in p.UnsecureFiles) + { + lt_files.Text += "
  • " + str + "
  • "; + } + } - if (p.ContainsMacroConflict) - { - pp_macroConflicts.Visible = true; - foreach (var item in p.ConflictingMacroAliases) - { - ltrMacroAlias.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; - } - } + if (p.ContainsMacroConflict) + { + pp_macroConflicts.Visible = true; + foreach (var item in p.ConflictingMacroAliases) + { + ltrMacroAlias.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; + } + } - if (p.ContainsTemplateConflicts) - { - pp_templateConflicts.Visible = true; - foreach (var item in p.ConflictingTemplateAliases) - { - ltrTemplateAlias.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; - } - } + if (p.ContainsTemplateConflicts) + { + pp_templateConflicts.Visible = true; + foreach (var item in p.ConflictingTemplateAliases) + { + ltrTemplateAlias.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; + } + } - if (p.ContainsStyleSheeConflicts) - { - pp_stylesheetConflicts.Visible = true; - foreach (var item in p.ConflictingStyleSheetNames) - { - ltrStylesheetNames.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; - } - } + if (p.ContainsStyleSheeConflicts) + { + pp_stylesheetConflicts.Visible = true; + foreach (var item in p.ConflictingStyleSheetNames) + { + ltrStylesheetNames.Text += "
  • " + item.Key + " (Alias: " + item.Value + ")
  • "; + } + } - LabelName.Text = p.Name + " Version: " + p.Version; - LabelMore.Text = "" + p.Url + ""; - LabelAuthor.Text = "" + p.Author + ""; - LabelLicense.Text = "" + p.License + ""; - - if (p.ReadMe != "") - readme.Text = "
    " + library.ReplaceLineBreaks(library.StripHtml(p.ReadMe)) + "
    "; - else - readme.Text = "No information
    "; - } + LabelName.Text = p.Name + " Version: " + p.Version; + LabelMore.Text = "" + p.Url + ""; + LabelAuthor.Text = "" + p.Author + ""; + LabelLicense.Text = "" + p.License + ""; + + if (p.ReadMe != "") + readme.Text = "
    " + library.ReplaceLineBreaks(library.StripHtml(p.ReadMe)) + "
    "; + else + readme.Text = "No information
    "; + } - private void processInstall(string currentStep) { - string dir = helper.Request("dir"); - int packageId = 0; - int.TryParse(helper.Request("pId"), out packageId); - - //first load in the config from the temporary directory - //this will ensure that the installer have access to all the new files and the package manifest - - p.LoadConfig(dir); + private void processInstall(string currentStep) { + string dir = helper.Request("dir"); + int packageId = 0; + int.TryParse(helper.Request("pId"), out packageId); + + //first load in the config from the temporary directory + //this will ensure that the installer have access to all the new files and the package manifest + + p.LoadConfig(dir); - switch (currentStep) { - case "businesslogic": - - p.InstallBusinessLogic(packageId, dir); + switch (currentStep) { + case "businesslogic": + + p.InstallBusinessLogic(packageId, dir); - //making sure that publishing actions performed from the cms layer gets pushed to the presentation - library.RefreshContent(); + //making sure that publishing actions performed from the cms layer gets pushed to the presentation + library.RefreshContent(); - if (p.Control != null && p.Control != "") { - Response.Redirect("installer.aspx?installing=customInstaller&dir=" + dir + "&pId=" + packageId.ToString()); - } else { - Response.Redirect("installer.aspx?installing=finished&dir=" + dir + "&pId=" + packageId.ToString()); - } - break; - case "customInstaller": - if (p.Control != null && p.Control != "") { - hideAllPanes(); + if (p.Control != null && p.Control != "") { + Response.Redirect("installer.aspx?installing=customInstaller&dir=" + dir + "&pId=" + packageId.ToString()); + } else { + Response.Redirect("installer.aspx?installing=finished&dir=" + dir + "&pId=" + packageId.ToString()); + } + break; + case "customInstaller": + if (p.Control != null && p.Control != "") { + hideAllPanes(); - configControl = new System.Web.UI.UserControl().LoadControl(SystemDirectories.Root + p.Control); - configControl.ID = "packagerConfigControl"; + configControl = new System.Web.UI.UserControl().LoadControl(SystemDirectories.Root + p.Control); + configControl.ID = "packagerConfigControl"; - pane_optional.Controls.Add(configControl); - pane_optional.Visible = true; - } else { - hideAllPanes(); - pane_success.Visible = true; + pane_optional.Controls.Add(configControl); + pane_optional.Visible = true; + } else { + hideAllPanes(); + pane_success.Visible = true; BasePage.Current.ClientTools.ReloadActionNode(true, true); - } - break; - case "finished": - hideAllPanes(); - string url = p.Url; - string packageViewUrl = "installedPackage.aspx?id=" + packageId.ToString(); + } + break; + case "finished": + hideAllPanes(); + string url = p.Url; + string packageViewUrl = "installedPackage.aspx?id=" + packageId.ToString(); - bt_viewInstalledPackage.OnClientClick = "document.location = '" + packageViewUrl + "'; return false;"; - - if (!string.IsNullOrEmpty(url)) - lit_authorUrl.Text = " " + ui.Text("or") + " " + ui.Text("viewPackageWebsite") + ""; + bt_viewInstalledPackage.OnClientClick = "document.location = '" + packageViewUrl + "'; return false;"; + + if (!string.IsNullOrEmpty(url)) + lit_authorUrl.Text = " " + ui.Text("or") + " " + ui.Text("viewPackageWebsite") + ""; - pane_success.Visible = true; + pane_success.Visible = true; BasePage.Current.ClientTools.ReloadActionNode(true, true); - p.InstallCleanUp(packageId, dir); - break; - default: - break; - } - } + p.InstallCleanUp(packageId, dir); - //this accepts the package, creates the manifest and then installs the files. - protected void startInstall(object sender, System.EventArgs e) + //clear the tree cache + ClientTools.ClearClientTreeCache() + .RefreshTree("packager"); + + break; + default: + break; + } + } + + //this accepts the package, creates the manifest and then installs the files. + protected void startInstall(object sender, System.EventArgs e) { - //we will now create the installer manifest, which means that umbraco can register everything that gets added to the system - //this returns an id of the manifest. + //we will now create the installer manifest, which means that umbraco can register everything that gets added to the system + //this returns an id of the manifest. + + p.LoadConfig(tempFile.Value); - //ensure that all tree's are refreshed after uninstall - ClientTools.ClearClientTreeCache(); + int pId = p.CreateManifest(tempFile.Value, helper.Request("guid"), helper.Request("repoGuid")); - - p.LoadConfig(tempFile.Value); - - int pId = p.CreateManifest(tempFile.Value, helper.Request("guid"), helper.Request("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.Value); - - Response.Redirect("installer.aspx?installing=businesslogic&dir=" + tempFile.Value + "&pId=" + pId.ToString()); - } + //and then copy over the files. This will take some time if it contains .dlls that will reboot the system.. + p.InstallFiles(pId, tempFile.Value); + + Response.Redirect("installer.aspx?installing=businesslogic&dir=" + tempFile.Value + "&pId=" + pId.ToString()); + } private void drawConfig() { - hideAllPanes(); + hideAllPanes(); - configControl = new System.Web.UI.UserControl().LoadControl(SystemDirectories.Root + helper.Request("config")); + configControl = new System.Web.UI.UserControl().LoadControl(SystemDirectories.Root + helper.Request("config")); configControl.ID = "packagerConfigControl"; pane_optional.Controls.Add(configControl); - pane_optional.Visible = true; + pane_optional.Visible = true; } - private void hideAllPanes() { - pane_authenticate.Visible = false; - pane_acceptLicense.Visible = false; - pane_installing.Visible = false; - pane_optional.Visible = false; - pane_success.Visible = false; - pane_upload.Visible = false; - } + private void hideAllPanes() { + pane_authenticate.Visible = false; + pane_acceptLicense.Visible = false; + pane_installing.Visible = false; + pane_optional.Visible = false; + pane_success.Visible = false; + pane_upload.Visible = false; + } } } diff --git a/umbraco/presentation/umbraco/developer/Packages/installer.aspx.designer.cs b/umbraco/presentation/umbraco/developer/Packages/installer.aspx.designer.cs index b7e3f78312..fcd09e7c9b 100644 --- a/umbraco/presentation/umbraco/developer/Packages/installer.aspx.designer.cs +++ b/umbraco/presentation/umbraco/developer/Packages/installer.aspx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.3603 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ diff --git a/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js b/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js index 8a12c9d2dd..1371a63d88 100644 --- a/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js +++ b/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js @@ -152,7 +152,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); /// This wraps the standard jsTree functionality unless a treeType is specified. If one is, then it will just reload that nodes children this._debug("refreshTree: " + treeType); if (!treeType) { - this._tree.refresh(); + this.rebuildTree(); } else { var allRoots = this._getContainer().find("li[rel='rootNode']"); @@ -166,7 +166,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); } else { //couldn't find it, so refresh the whole tree - this._tree.refresh(); + this.rebuildTree(); } } @@ -176,11 +176,17 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); this._debug("rebuildTree"); - //don't rebuild if the tree object exists, the app that's being requested to be loaded is - //flagged as already loaded, and the tree actually has nodes in it - if (this._tree - && (this._opts.app.toLowerCase() == app.toLowerCase())) { + //if app is null, then we will rebuild the current app which also means clearing the cache. + if (!app) { + this.clearTreeCache(); + this._opts.app = this._opts.app; + } + else if (this._tree&& (this._opts.app.toLowerCase() == app.toLowerCase())) { this._debug("not rebuilding"); + + //don't rebuild if the tree object exists, the app that's being requested to be loaded is + //flagged as already loaded, and the tree actually has nodes in it + return; } else { @@ -468,7 +474,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); function(msg) { if (!msg || msg.length == 0) { _this._debug("reloadActionNode: error loading ajax data, performing jsTree refresh"); - _this._tree.refresh(); /*try jsTree refresh as last resort */ + _this.rebuildTree(); /*try jsTree refresh as last resort */ if (callback != null) callback.call(_this, false); return; } @@ -496,7 +502,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); } else { _this._debug("reloadActionNode: error finding child node in ajax data, performing jsTree refresh"); - _this._tree.refresh(); /*try jsTree refresh as last resort */ + _this.rebuildTree(); /*try jsTree refresh as last resort */ if (callback != null) callback.call(_this, false); } }, "json"); @@ -504,7 +510,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); } this._debug("reloadActionNode: error finding parent node, performing jsTree refresh"); - this._tree.refresh(); /*try jsTree refresh as last resort */ + this.rebuildTree(); /*try jsTree refresh as last resort */ if (callback != null) callback.call(this, false); } },