diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
index 9f105e283b..9eb5b6521f 100644
--- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
+++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
@@ -832,6 +832,7 @@
+
diff --git a/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx b/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
index 14d049c27d..be52ab61a2 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
@@ -3,12 +3,16 @@
ValidateRequest="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
+<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
+
+
+
@@ -48,9 +57,5 @@
-
+
diff --git a/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx b/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
index efa825d1ef..dfdccaaa69 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
@@ -8,32 +8,27 @@
diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js
new file mode 100644
index 0000000000..324bf08d37
--- /dev/null
+++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditScript.js
@@ -0,0 +1,63 @@
+Umbraco.Sys.registerNamespace("Umbraco.Editors");
+
+(function ($) {
+
+ Umbraco.Editors.EditScript = base2.Base.extend({
+ //private methods/variables
+ _opts: null,
+
+ // Constructor
+ constructor: function(opts) {
+ // Merge options with default
+ this._opts = $.extend({
+
+ // Default options go here
+ }, opts);
+ },
+
+ save: function() {
+ var self = this;
+
+ umbraco.presentation.webservices.codeEditorSave.SaveCss(
+ self._opts.fileName, self._opts.oldName, self._opts.codeVal, self._opts.cssId,
+ function(t) { self.submitSucces(t); },
+ function(t) { self.submitFailure(t); });
+
+ },
+
+ submitSucces: function(t) {
+ if (t != 'true') {
+ top.UmbSpeechBubble.ShowMessage('error', this._opts.text.cssErrorHeader, this._opts.text.cssErrorText);
+ }
+ else {
+ top.UmbSpeechBubble.ShowMessage('save', this._opts.text.cssSavedHeader, this._opts.text.cssSavedText);
+ }
+
+ UmbClientMgr.mainTree().setActiveTreeType('stylesheets');
+ UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.cssId, true);
+ },
+
+ submitFailure: function(t) {
+ top.UmbSpeechBubble.ShowMessage('error', this._opts.text.cssErrorHeader, this._opts.text.cssErrorText);
+ }
+ },
+ {
+ saveScript: function(codeVal, fileName, oldName, cssId) {
+ //Static method to do the saving
+
+ var codeVal = $('#' + editorSourceClientId).val();
+ //if CodeMirror is not defined, then the code editor is disabled.
+ if (typeof(CodeMirror) != "undefined") {
+ codeVal = UmbEditor.GetCode();
+ }
+
+ var processor = new Umbraco.Editors.EditStyleSheet({
+ codeVal: codeVal,
+ fileName: $('#' + nameTxtClientId).val(),
+ oldname: nameTxtValue,
+ cssId: cssId
+ });
+ processor.save();
+ }
+ });
+})(jQuery);
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditStyleSheet.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditStyleSheet.js
index 78817f3328..b68cc7e2ac 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditStyleSheet.js
+++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditStyleSheet.js
@@ -3,61 +3,62 @@
(function ($) {
Umbraco.Editors.EditStyleSheet = base2.Base.extend({
- //private methods/variables
- _opts: null,
+ //private methods/variables
+ _opts: null,
- // Constructor
- constructor: function(opts) {
- // Merge options with default
- this._opts = $.extend({
-
- // Default options go here
- }, opts);
- },
-
- save: function() {
- var self = this;
-
- umbraco.presentation.webservices.codeEditorSave.SaveCss(
- self._opts.fileName, self._opts.oldName, self._opts.codeVal, self._opts.cssId,
- function(t) { self.submitSucces(t); },
- function(t) { self.submitFailure(t); });
-
- },
-
- submitSucces: function(t) {
- if (t != 'true') {
- top.UmbSpeechBubble.ShowMessage('error', this._opts.text.cssErrorHeader, this._opts.text.cssErrorText);
- }
- else {
- top.UmbSpeechBubble.ShowMessage('save', this._opts.text.cssSavedHeader, this._opts.text.cssSavedText);
- }
+ // Constructor
+ constructor: function(opts) {
+ // Merge options with default
+ this._opts = $.extend({
- UmbClientMgr.mainTree().setActiveTreeType('stylesheets');
- UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.cssId, true);
- },
- submitFailure: function(t) {
+ // Default options go here
+ }, opts);
+ },
+
+ init: function() {
+ //setup UI elements
+ var self = this;
+
+ //bind to the save event
+ this._opts.saveButton.click(function() {
+ self.doSubmit();
+ });
+ },
+
+ doSubmit: function() {
+ var self = this;
+
+ var fileName = this._opts.nameTxtBox.val();
+ var codeVal = this._opts.editorSourceElement.val();
+ //if CodeMirror is not defined, then the code editor is disabled.
+ if (typeof(CodeMirror) != "undefined") {
+ codeVal = UmbEditor.GetCode();
+ }
+ umbraco.presentation.webservices.codeEditorSave.SaveCss(
+ fileName, self._opts.originalFileName, codeVal, self._opts.cssId,
+ function(t) { self.submitSucces(t); },
+ function(t) { self.submitFailure(t); });
+
+ },
+
+ submitSucces: function(t) {
+ if (t != 'true') {
top.UmbSpeechBubble.ShowMessage('error', this._opts.text.cssErrorHeader, this._opts.text.cssErrorText);
}
- },
- {
- saveStyleSheet: function(editorSourceClientId, nameTxtClientId, nameTxtValue, cssId) {
- //Static method to do the saving
-
- var codeVal = $('#' + editorSourceClientId).val();
- //if CodeMirror is not defined, then the code editor is disabled.
- if (typeof(CodeMirror) != "undefined") {
- codeVal = UmbEditor.GetCode();
- }
-
- var processor = new Umbraco.Editors.EditStyleSheet({
- codeVal: codeVal,
- fileName: $('#' + nameTxtClientId).val(),
- oldname: nameTxtValue,
- cssId: cssId
- });
- processor.save();
+ else {
+ top.UmbSpeechBubble.ShowMessage('save', this._opts.text.cssSavedHeader, this._opts.text.cssSavedText);
}
- });
+
+ UmbClientMgr.mainTree().setActiveTreeType('stylesheets');
+ UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.cssId, true);
+
+ //update the originalFileName prop
+ this._opts.originalFileName = this._opts.nameTxtBox.val();
+ },
+
+ submitFailure: function(t) {
+ top.UmbSpeechBubble.ShowMessage('error', this._opts.text.cssErrorHeader, this._opts.text.cssErrorText);
+ }
+ });
})(jQuery);
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs
index f03c2c360f..d430000b36 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs
@@ -17,20 +17,26 @@ namespace umbraco.cms.presentation.settings.stylesheet
{
private StyleSheet stylesheet;
+ protected MenuIconI SaveButton;
+
public editstylesheet()
{
CurrentApp = DefaultApps.settings.ToString();
}
- protected void Page_Load(object sender, EventArgs e)
- {
- var save = Panel1.Menu.NewIcon();
- save.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
- save.OnClickCommand = "Umbraco.Editors.EditStyleSheet.save('" + editorSource.ClientID + "', '" + NameTxt.ClientID + "', '" + NameTxt.Text + "', '" + Request.QueryString["id"] + "')";
+ SaveButton = Panel1.Menu.NewIcon();
+ SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
+ SaveButton.AltText = "Save stylesheet";
+ SaveButton.ID = "save";
+ }
+
+ protected void Page_Load(object sender, EventArgs e)
+ {
- save.AltText = "Save stylesheet";
- save.ID = "save";
Panel1.Text = ui.Text("stylesheet", "editstylesheet", UmbracoUser);
pp_name.Text = ui.Text("name", UmbracoUser);
pp_path.Text = ui.Text("path", UmbracoUser);