diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditMacroScripts.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditMacroScripts.js index 91823ec2aa..45e0302004 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditMacroScripts.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditMacroScripts.js @@ -48,18 +48,30 @@ submitSucces: function(t) { if (t != 'true') { top.UmbSpeechBubble.ShowMessage('error', 'Saving scripting file failed', t); - } - else { - top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', ''); - } - + } var newFilePath = this._opts.nameTxtBox.val(); - UmbClientMgr.mainTree().setActiveTreeType('python'); - //we need to pass in the newId parameter so it knows which node to resync after retreival from the server - UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); - //set the original file path to the new one - this._opts.originalFileName = newFilePath; + + //if the filename changes, we need to redirect since the file name is used in the url + if (this._opts.originalFileName != newFilePath) { + var newLocation = window.location.pathname + "?" + "&file=" + newFilePath; + + UmbClientMgr.contentFrame(newLocation); + + //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done! + top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', ''); + } + else { + + top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', ''); + UmbClientMgr.mainTree().setActiveTreeType('python'); + //we need to pass in the newId parameter so it knows which node to resync after retreival from the server + UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); + //set the original file path to the new one + this._opts.originalFileName = newFilePath; + } + + }, submitFailure: function(t) { diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js index 9ec8c8b877..fd7541cf78 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js @@ -44,20 +44,32 @@ }, submitSucces: function(t) { + if (t != 'true') { top.UmbSpeechBubble.ShowMessage('error', this._opts.text.fileErrorHeader, this._opts.text.fileErrorText); } - else { - top.UmbSpeechBubble.ShowMessage('save', this._opts.text.fileSavedHeader, this._opts.text.fileSavedText); - } - var newFilePath = this._opts.nameTxtBox.val(); - UmbClientMgr.mainTree().setActiveTreeType('scripts'); - //we need to pass in the newId parameter so it knows which node to resync after retreival from the server - UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); - //set the original file path to the new one - this._opts.originalFileName = newFilePath; + + //if the filename changes, we need to redirect since the file name is used in the url + if (this._opts.originalFileName != newFilePath) { + var newLocation = window.location.pathname + "?" + "&file=" + newFilePath; + + UmbClientMgr.contentFrame(newLocation); + + //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done! + top.UmbSpeechBubble.ShowMessage('save', this._opts.text.fileSavedHeader, this._opts.text.fileSavedText); + } + else { + + top.UmbSpeechBubble.ShowMessage('save', this._opts.text.fileSavedHeader, this._opts.text.fileSavedText); + UmbClientMgr.mainTree().setActiveTreeType('scripts'); + //we need to pass in the newId parameter so it knows which node to resync after retreival from the server + UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); + //set the original file path to the new one + this._opts.originalFileName = newFilePath; + } + }, submitFailure: function(t) { diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js index 87d387b4c5..e32c43941d 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js @@ -125,11 +125,12 @@ path = args.path; } - top.UmbSpeechBubble.ShowMessage('save', header, msg); - UmbClientMgr.mainTree().setActiveTreeType(this._opts.currentTreeType); if (this._opts.editorType == "Template") { + + top.UmbSpeechBubble.ShowMessage('save', header, msg); + //templates are different because they are ID based, whereas view files are file based without a static id if (pathChanged) { @@ -143,10 +144,40 @@ } else { var newFilePath = this._opts.nameTxtBox.val(); - //then we need to update our current tree sync path to represent the new one - this._updateNewFileProperties(newFilePath); - - UmbClientMgr.mainTree().syncTree(path, true, null, newFilePath.split("/")[1]); + + + function trimStart(str, trim) { + if (str.startsWith(trim)) { + return str.substring(trim.length); + } + return str; + } + + //if the filename changes, we need to redirect since the file name is used in the url + if (this._opts.originalFileName != newFilePath) { + var queryParts = trimStart(window.location.search, "?").split('&'); + var notFileParts = []; + for (var i = 0; i < queryParts.length; i++) { + if (queryParts[i].substr(0, "file=".length) != "file=") { + notFileParts.push(queryParts[i]); + } + } + var newLocation = window.location.pathname + "?" + notFileParts.join("&") + "&file=" + newFilePath; + + UmbClientMgr.contentFrame(newLocation); + + //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done! + top.UmbSpeechBubble.ShowMessage('save', header, msg); + } + else { + + top.UmbSpeechBubble.ShowMessage('save', header, msg); + + //then we need to update our current tree sync path to represent the new one + this._updateNewFileProperties(newFilePath); + + UmbClientMgr.mainTree().syncTree(path, true, null, newFilePath.split("/")[1]); + } } }, diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditXslt.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditXslt.js index 55b60804d9..b57278fc97 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditXslt.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditXslt.js @@ -47,16 +47,29 @@ if (t != 'true') { top.UmbSpeechBubble.ShowMessage('error', 'Saving Xslt file failed',"
" + t + ""); } - else { - top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', ''); - } var newFilePath = this._opts.nameTxtBox.val(); - UmbClientMgr.mainTree().setActiveTreeType('xslt'); - //we need to pass in the newId parameter so it knows which node to resync after retreival from the server - UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); - //set the original file path to the new one - this._opts.originalFileName = newFilePath; + + //if the filename changes, we need to redirect since the file name is used in the url + if (this._opts.originalFileName != newFilePath) { + var newLocation = window.location.pathname + "?" + "&file=" + newFilePath; + + UmbClientMgr.contentFrame(newLocation); + + //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done! + top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', ''); + } + else { + + top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', ''); + UmbClientMgr.mainTree().setActiveTreeType('xslt'); + //we need to pass in the newId parameter so it knows which node to resync after retreival from the server + UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath); + //set the original file path to the new one + this._opts.originalFileName = newFilePath; + } + + }, submitFailure: function (t) {